|
@@ -8,13 +8,19 @@
|
|
</a-tabs>
|
|
</a-tabs>
|
|
</template>
|
|
</template>
|
|
<div class="desc-wrap-BasicTable">
|
|
<div class="desc-wrap-BasicTable">
|
|
- <BasicTable @register="registerTimeTable" >
|
|
|
|
|
|
+ <BasicTable @register="registerTimeTable">
|
|
<template #toolbar>
|
|
<template #toolbar>
|
|
- <a-button type="primary" @click="()=>{openAddModal(true,searchInfo.type)}">{{
|
|
|
|
- t('routes.product.addVstive')
|
|
|
|
- }}</a-button>
|
|
|
|
- </template>
|
|
|
|
- <template #action="{ record }">
|
|
|
|
|
|
+ <a-button
|
|
|
|
+ type="primary"
|
|
|
|
+ @click="
|
|
|
|
+ () => {
|
|
|
|
+ openAddModal(true, searchInfo.type);
|
|
|
|
+ }
|
|
|
|
+ "
|
|
|
|
+ >{{ t('routes.product.addVstive') }}</a-button
|
|
|
|
+ >
|
|
|
|
+ </template>
|
|
|
|
+ <template #action="{ record }">
|
|
<TableAction
|
|
<TableAction
|
|
:actions="[
|
|
:actions="[
|
|
{
|
|
{
|
|
@@ -25,11 +31,14 @@
|
|
{
|
|
{
|
|
label: '删除',
|
|
label: '删除',
|
|
icon: 'ic:outline-delete-outline',
|
|
icon: 'ic:outline-delete-outline',
|
|
- onClick: handleDelete.bind(null, record),
|
|
|
|
|
|
+ popConfirm: {
|
|
|
|
+ title: '是否确认删除',
|
|
|
|
+ confirm: handleDelete.bind(null, record),
|
|
|
|
+ },
|
|
},
|
|
},
|
|
]"
|
|
]"
|
|
/>
|
|
/>
|
|
- </template>
|
|
|
|
|
|
+ </template>
|
|
</BasicTable>
|
|
</BasicTable>
|
|
</div>
|
|
</div>
|
|
<AddModal @update="reload" @register="registerAddModal" />
|
|
<AddModal @update="reload" @register="registerAddModal" />
|
|
@@ -37,122 +46,192 @@
|
|
</PageWrapper>
|
|
</PageWrapper>
|
|
</template>
|
|
</template>
|
|
<script lang="ts">
|
|
<script lang="ts">
|
|
- import { defineComponent,reactive } from 'vue';
|
|
|
|
- import { BasicTable, useTable, FormProps,TableAction } from '/@/components/Table';
|
|
|
|
- import { PageWrapper } from '/@/components/Page';
|
|
|
|
- import { Divider, Card, Empty, Descriptions, Steps, Tabs } from 'ant-design-vue';
|
|
|
|
- import { CameraList } from '/@/api/product'
|
|
|
|
- import { useModal } from '/@/components/Modal';
|
|
|
|
- import { refundTimeTableSchema } from '../data';
|
|
|
|
- import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
|
- import AddModal from '../AddModal.vue';
|
|
|
|
- import EditModal from '../EditModal.vue';
|
|
|
|
|
|
+import { defineComponent, reactive, h } from 'vue';
|
|
|
|
+import { BasicTable, useTable, FormProps, TableAction, BasicColumn } from '/@/components/Table';
|
|
|
|
+import { PageWrapper } from '/@/components/Page';
|
|
|
|
+import { Divider, Card, Empty, Descriptions, Steps, Tabs } from 'ant-design-vue';
|
|
|
|
+import { CameraList, DelAndUpload, EditAndUpload } from '/@/api/product';
|
|
|
|
+import { useModal } from '/@/components/Modal';
|
|
|
|
+import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
|
+import AddModal from './AddModal.vue';
|
|
|
|
+import EditModal from './EditModal.vue';
|
|
|
|
+import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
|
+import { Switch } from 'ant-design-vue';
|
|
|
|
+import { Time } from '/@/components/Time';
|
|
|
|
+export default defineComponent({
|
|
|
|
+ components: {
|
|
|
|
+ BasicTable,
|
|
|
|
+ AddModal,
|
|
|
|
+ EditModal,
|
|
|
|
+ TableAction,
|
|
|
|
+ PageWrapper,
|
|
|
|
+ [Divider.name]: Divider,
|
|
|
|
+ [Card.name]: Card,
|
|
|
|
+ Empty,
|
|
|
|
+ [Descriptions.name]: Descriptions,
|
|
|
|
+ [Descriptions.Item.name]: Descriptions.Item,
|
|
|
|
+ [Steps.name]: Steps,
|
|
|
|
+ [Steps.Step.name]: Steps.Step,
|
|
|
|
+ [Tabs.name]: Tabs,
|
|
|
|
+ [Tabs.TabPane.name]: Tabs.TabPane,
|
|
|
|
+ },
|
|
|
|
+ setup() {
|
|
|
|
+ const { t } = useI18n();
|
|
|
|
+ const searchInfo = reactive<Recordable>({
|
|
|
|
+ type: '1',
|
|
|
|
+ });
|
|
|
|
+ const [registerAddModal, { openModal: openAddModal }] = useModal();
|
|
|
|
+ const [registerEditModal, { openModal: openEditModal }] = useModal();
|
|
|
|
+ const { createMessage } = useMessage();
|
|
|
|
|
|
- export default defineComponent({
|
|
|
|
- components: {
|
|
|
|
- BasicTable,
|
|
|
|
- AddModal,
|
|
|
|
- EditModal,
|
|
|
|
- TableAction,
|
|
|
|
- PageWrapper,
|
|
|
|
- [Divider.name]: Divider,
|
|
|
|
- [Card.name]: Card,
|
|
|
|
- Empty,
|
|
|
|
- [Descriptions.name]: Descriptions,
|
|
|
|
- [Descriptions.Item.name]: Descriptions.Item,
|
|
|
|
- [Steps.name]: Steps,
|
|
|
|
- [Steps.Step.name]: Steps.Step,
|
|
|
|
- [Tabs.name]: Tabs,
|
|
|
|
- [Tabs.TabPane.name]: Tabs.TabPane,
|
|
|
|
- },
|
|
|
|
- setup() {
|
|
|
|
- const { t } = useI18n();
|
|
|
|
- const searchInfo = reactive<Recordable>({
|
|
|
|
- type:'1'
|
|
|
|
- });
|
|
|
|
- const [registerAddModal, { openModal: openAddModal }] = useModal();
|
|
|
|
- const [registerEditModal, { openModal: openEditModal }] = useModal();
|
|
|
|
- const searchForm: Partial<FormProps> = {
|
|
|
|
- labelWidth: 100,
|
|
|
|
- schemas: [
|
|
|
|
- {
|
|
|
|
- field: 'version',
|
|
|
|
- label: '版本号',
|
|
|
|
- component: 'Input',
|
|
|
|
- componentProps: {
|
|
|
|
- maxLength: 100,
|
|
|
|
- },
|
|
|
|
- colProps: {
|
|
|
|
- xl: 6,
|
|
|
|
- xxl: 6,
|
|
|
|
- },
|
|
|
|
|
|
+ const refundTimeTableSchema: BasicColumn[] = [
|
|
|
|
+ {
|
|
|
|
+ title: '版本号',
|
|
|
|
+ width: 150,
|
|
|
|
+ dataIndex: 'version',
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '版本更新说明',
|
|
|
|
+ width: 150,
|
|
|
|
+ dataIndex: 'description',
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '最低版本号',
|
|
|
|
+ width: 150,
|
|
|
|
+ dataIndex: 'minVersion',
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '创建人',
|
|
|
|
+ width: 150,
|
|
|
|
+ dataIndex: 'recStatus',
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '创建时间',
|
|
|
|
+ width: 150,
|
|
|
|
+ dataIndex: 'createTime',
|
|
|
|
+ customRender: ({ record }) => {
|
|
|
|
+ return (
|
|
|
|
+ record.createTime &&
|
|
|
|
+ h(Time, {
|
|
|
|
+ value: record.createTime,
|
|
|
|
+ mode: 'datetime',
|
|
|
|
+ })
|
|
|
|
+ );
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '状态',
|
|
|
|
+ dataIndex: 'status',
|
|
|
|
+ width: 80,
|
|
|
|
+ customRender: ({ record }) => {
|
|
|
|
+ if (!Reflect.has(record, 'pendingStatus')) {
|
|
|
|
+ record.pendingStatus = false;
|
|
}
|
|
}
|
|
- ],
|
|
|
|
- };
|
|
|
|
- const [registerTimeTable, { reload }] = useTable({
|
|
|
|
- api: CameraList,
|
|
|
|
- title: '相机列表',
|
|
|
|
- columns: refundTimeTableSchema,
|
|
|
|
- useSearchForm: true,
|
|
|
|
- formConfig: searchForm,
|
|
|
|
- showTableSetting: true,
|
|
|
|
- rowKey: 'id',
|
|
|
|
- fetchSetting: {
|
|
|
|
- pageField: 'pageNum',
|
|
|
|
- sizeField: 'pageSize',
|
|
|
|
- listField: 'list',
|
|
|
|
- totalField: 'total',
|
|
|
|
|
|
+ return h(Switch, {
|
|
|
|
+ checked: record.status === 'A',
|
|
|
|
+ checkedChildren: '启用',
|
|
|
|
+ unCheckedChildren: '禁用',
|
|
|
|
+ loading: false,
|
|
|
|
+ onChange: async (checked: boolean) => {
|
|
|
|
+ record.pendingStatus = true;
|
|
|
|
+ const newStatus = checked ? 'A' : 'I';
|
|
|
|
+ await EditAndUpload({ ...record, status: newStatus });
|
|
|
|
+ if (checked) {
|
|
|
|
+ Reflect.set(record, 'status', newStatus);
|
|
|
|
+ } else {
|
|
|
|
+ Reflect.set(record, 'status', newStatus);
|
|
|
|
+ }
|
|
|
|
+ reload()
|
|
|
|
+ createMessage.success(t('common.optSuccess'));
|
|
|
|
+ },
|
|
|
|
+ });
|
|
},
|
|
},
|
|
- searchInfo:searchInfo,
|
|
|
|
- // beforeFetch:(T)=>{
|
|
|
|
- // T.type = searchInfo.type
|
|
|
|
- // console.log('beforeFetch',T,searchInfo)
|
|
|
|
- // return T
|
|
|
|
- // },
|
|
|
|
- actionColumn: {
|
|
|
|
- width: 180,
|
|
|
|
- title: '操作',
|
|
|
|
- dataIndex: 'action',
|
|
|
|
- slots: { customRender: 'action' },
|
|
|
|
|
|
+ },
|
|
|
|
+ ];
|
|
|
|
+ const searchForm: Partial<FormProps> = {
|
|
|
|
+ labelWidth: 100,
|
|
|
|
+ schemas: [
|
|
|
|
+ {
|
|
|
|
+ field: 'version',
|
|
|
|
+ label: '版本号',
|
|
|
|
+ component: 'Input',
|
|
|
|
+ componentProps: {
|
|
|
|
+ maxLength: 100,
|
|
|
|
+ },
|
|
|
|
+ colProps: {
|
|
|
|
+ xl: 6,
|
|
|
|
+ xxl: 6,
|
|
|
|
+ },
|
|
},
|
|
},
|
|
- canResize: false,
|
|
|
|
|
|
+ ],
|
|
|
|
+ };
|
|
|
|
+ const [registerTimeTable, { reload }] = useTable({
|
|
|
|
+ api: CameraList,
|
|
|
|
+ title: '相机列表',
|
|
|
|
+ columns: refundTimeTableSchema,
|
|
|
|
+ useSearchForm: true,
|
|
|
|
+ formConfig: searchForm,
|
|
|
|
+ showTableSetting: true,
|
|
|
|
+ rowKey: 'id',
|
|
|
|
+ fetchSetting: {
|
|
|
|
+ pageField: 'pageNum',
|
|
|
|
+ sizeField: 'pageSize',
|
|
|
|
+ listField: 'list',
|
|
|
|
+ totalField: 'total',
|
|
|
|
+ },
|
|
|
|
+ searchInfo: searchInfo,
|
|
|
|
+ // beforeFetch:(T)=>{
|
|
|
|
+ // T.type = searchInfo.type
|
|
|
|
+ // console.log('beforeFetch',T,searchInfo)
|
|
|
|
+ // return T
|
|
|
|
+ // },
|
|
|
|
+ actionColumn: {
|
|
|
|
+ width: 180,
|
|
|
|
+ title: '操作',
|
|
|
|
+ dataIndex: 'action',
|
|
|
|
+ slots: { customRender: 'action' },
|
|
|
|
+ },
|
|
|
|
+ canResize: false,
|
|
|
|
+ });
|
|
|
|
+ function tabChange(val: string) {
|
|
|
|
+ console.log('tabChange', val);
|
|
|
|
+ reload();
|
|
|
|
+ }
|
|
|
|
+ async function handleDelete(record: Recordable) {
|
|
|
|
+ console.log('点击了删除', record);
|
|
|
|
+ await DelAndUpload({ id: record.id });
|
|
|
|
+ createMessage.success(t('common.optSuccess'));
|
|
|
|
+ reload();
|
|
|
|
+ }
|
|
|
|
+ function handleOpen(record: Recordable) {
|
|
|
|
+ console.log('点击了启用', record);
|
|
|
|
+ }
|
|
|
|
+ function handleEdit(record: Recordable) {
|
|
|
|
+ console.log('record', record);
|
|
|
|
+ openEditModal(true, {
|
|
|
|
+ ...record,
|
|
});
|
|
});
|
|
- function tabChange(val:string){
|
|
|
|
- console.log('tabChange',val)
|
|
|
|
- reload()
|
|
|
|
- }
|
|
|
|
- function handleDelete(record: Recordable) {
|
|
|
|
- console.log('点击了删除', record);
|
|
|
|
- }
|
|
|
|
- function handleOpen(record: Recordable) {
|
|
|
|
- console.log('点击了启用', record);
|
|
|
|
- }
|
|
|
|
- function handleEdit(record: Recordable) {
|
|
|
|
- console.log('record', record);
|
|
|
|
- openEditModal(true, {
|
|
|
|
- ...record
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- return {
|
|
|
|
- registerTimeTable,
|
|
|
|
- handleDelete,
|
|
|
|
- handleOpen,
|
|
|
|
- tabChange,
|
|
|
|
- reload,
|
|
|
|
- registerAddModal,
|
|
|
|
- registerEditModal,
|
|
|
|
- openAddModal,
|
|
|
|
- handleEdit,
|
|
|
|
- t,
|
|
|
|
- searchInfo,
|
|
|
|
- };
|
|
|
|
- },
|
|
|
|
- });
|
|
|
|
|
|
+ }
|
|
|
|
+ return {
|
|
|
|
+ registerTimeTable,
|
|
|
|
+ handleDelete,
|
|
|
|
+ handleOpen,
|
|
|
|
+ tabChange,
|
|
|
|
+ reload,
|
|
|
|
+ registerAddModal,
|
|
|
|
+ registerEditModal,
|
|
|
|
+ openAddModal,
|
|
|
|
+ handleEdit,
|
|
|
|
+ t,
|
|
|
|
+ searchInfo,
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+});
|
|
</script>
|
|
</script>
|
|
<style lang="less" scoped>
|
|
<style lang="less" scoped>
|
|
-.desc-wrap-BasicTable{
|
|
|
|
|
|
+.desc-wrap-BasicTable {
|
|
background-color: #f0f2f5;
|
|
background-color: #f0f2f5;
|
|
- .vben-basic-table-form-container{
|
|
|
|
|
|
+ .vben-basic-table-form-container {
|
|
padding: 0;
|
|
padding: 0;
|
|
}
|
|
}
|
|
}
|
|
}
|