Showing
4 changed files
with
126 additions
and
90 deletions
src/api/export/exportManager.ts
0 → 100644
1 | +import { defHttp } from '/@/utils/http/axios'; | ||
2 | +import { ExportQueryParam } from './model/exportModel'; | ||
3 | + | ||
4 | +enum ReportManagerApi { | ||
5 | + GET_EXPORT_API = '/report/generate/record', | ||
6 | + DELETE_EXPORT_API = '/report/generate/record', | ||
7 | +} | ||
8 | + | ||
9 | +//报表导出分页 | ||
10 | +export const exportPage = (params: ExportQueryParam) => { | ||
11 | + return defHttp.get<ExportQueryParam>({ | ||
12 | + url: ReportManagerApi.GET_EXPORT_API, | ||
13 | + params, | ||
14 | + }); | ||
15 | +}; | ||
16 | + | ||
17 | +//报表导出删除 | ||
18 | +export const deleteExportManage = (ids: string[]) => { | ||
19 | + return defHttp.delete({ | ||
20 | + url: ReportManagerApi.DELETE_EXPORT_API, | ||
21 | + data: { | ||
22 | + ids: ids, | ||
23 | + }, | ||
24 | + }); | ||
25 | +}; |
src/api/export/model/exportModel.ts
0 → 100644
@@ -5,27 +5,33 @@ import moment from 'moment'; | @@ -5,27 +5,33 @@ import moment from 'moment'; | ||
5 | export const columns: BasicColumn[] = [ | 5 | export const columns: BasicColumn[] = [ |
6 | { | 6 | { |
7 | title: '配置名称', | 7 | title: '配置名称', |
8 | - dataIndex: '1', | 8 | + dataIndex: 'reportConfigName', |
9 | width: 80, | 9 | width: 80, |
10 | }, | 10 | }, |
11 | { | 11 | { |
12 | title: '所属组织', | 12 | title: '所属组织', |
13 | - dataIndex: '2', | 13 | + dataIndex: 'organizationName', |
14 | width: 120, | 14 | width: 120, |
15 | }, | 15 | }, |
16 | { | 16 | { |
17 | title: '数据类型', | 17 | title: '数据类型', |
18 | - dataIndex: '3', | 18 | + dataIndex: 'dataCompare', |
19 | width: 120, | 19 | width: 120, |
20 | + format: (_text: string, record: Recordable) => { | ||
21 | + return record.dataCompare === 0 ? '历史数据' : record.dataCompare === 1 ? '同比' : '环比'; | ||
22 | + }, | ||
20 | }, | 23 | }, |
21 | { | 24 | { |
22 | - title: '执行状态', | ||
23 | - dataIndex: '4', | 25 | + title: '执行方式', |
26 | + dataIndex: 'executeWay', | ||
24 | width: 120, | 27 | width: 120, |
28 | + format: (_text: string, record: Recordable) => { | ||
29 | + return record.executeWay === 0 ? '立即执行' : '定时执行'; | ||
30 | + }, | ||
25 | }, | 31 | }, |
26 | { | 32 | { |
27 | title: '执行日期', | 33 | title: '执行日期', |
28 | - dataIndex: '8', | 34 | + dataIndex: 'executeTime', |
29 | width: 180, | 35 | width: 180, |
30 | }, | 36 | }, |
31 | ]; | 37 | ]; |
@@ -33,7 +39,7 @@ export const columns: BasicColumn[] = [ | @@ -33,7 +39,7 @@ export const columns: BasicColumn[] = [ | ||
33 | // 查询配置 | 39 | // 查询配置 |
34 | export const searchFormSchema: FormSchema[] = [ | 40 | export const searchFormSchema: FormSchema[] = [ |
35 | { | 41 | { |
36 | - field: '1', | 42 | + field: 'reportConfigName', |
37 | label: '配置名称', | 43 | label: '配置名称', |
38 | component: 'Input', | 44 | component: 'Input', |
39 | colProps: { span: 6 }, | 45 | colProps: { span: 6 }, |
@@ -43,7 +49,7 @@ export const searchFormSchema: FormSchema[] = [ | @@ -43,7 +49,7 @@ export const searchFormSchema: FormSchema[] = [ | ||
43 | }, | 49 | }, |
44 | }, | 50 | }, |
45 | { | 51 | { |
46 | - field: '2', | 52 | + field: 'status', |
47 | label: '执行状态', | 53 | label: '执行状态', |
48 | component: 'Select', | 54 | component: 'Select', |
49 | colProps: { span: 6 }, | 55 | colProps: { span: 6 }, |
@@ -66,7 +72,7 @@ export const searchFormSchema: FormSchema[] = [ | @@ -66,7 +72,7 @@ export const searchFormSchema: FormSchema[] = [ | ||
66 | }, | 72 | }, |
67 | }, | 73 | }, |
68 | { | 74 | { |
69 | - field: '3', | 75 | + field: 'executeTime', |
70 | label: '执行时间', | 76 | label: '执行时间', |
71 | component: 'RangePicker', | 77 | component: 'RangePicker', |
72 | componentProps: { | 78 | componentProps: { |
@@ -6,42 +6,35 @@ | @@ -6,42 +6,35 @@ | ||
6 | <a-button type="primary" @click="exportCharts"> 导出报表 </a-button> | 6 | <a-button type="primary" @click="exportCharts"> 导出报表 </a-button> |
7 | </Authority> | 7 | </Authority> |
8 | <Authority value="api:yt:reportExport:delete"> | 8 | <Authority value="api:yt:reportExport:delete"> |
9 | - <Popconfirm | ||
10 | - title="您确定要批量删除数据" | ||
11 | - ok-text="确定" | ||
12 | - cancel-text="取消" | ||
13 | - @confirm="handleDeleteOrBatchDelete(null)" | ||
14 | - > | 9 | + <Popconfirm title="您确定要批量删除数据" ok-text="确定" cancel-text="取消" @confirm="handleDeleteOrBatchDelete(null)"> |
15 | <a-button type="primary" color="error" :disabled="hasBatchDelete"> 批量删除 </a-button> | 10 | <a-button type="primary" color="error" :disabled="hasBatchDelete"> 批量删除 </a-button> |
16 | </Popconfirm> | 11 | </Popconfirm> |
17 | </Authority> | 12 | </Authority> |
18 | </template> | 13 | </template> |
19 | <template #action="{ record }"> | 14 | <template #action="{ record }"> |
20 | - <TableAction | ||
21 | - :actions="[ | ||
22 | - { | ||
23 | - label: '查看', | ||
24 | - icon: 'clarity:note-edit-line', | ||
25 | - auth: 'api:yt:reportExport:get', | ||
26 | - onClick: handleView.bind(null, record), | 15 | + <TableAction :actions="[ |
16 | + { | ||
17 | + label: '查看', | ||
18 | + icon: 'clarity:note-edit-line', | ||
19 | + auth: 'api:yt:reportExport:get', | ||
20 | + onClick: handleView.bind(null, record), | ||
21 | + }, | ||
22 | + { | ||
23 | + label: '导出报表', | ||
24 | + icon: 'clarity:note-edit-line', | ||
25 | + auth: 'api:yt:reportExport:export', | ||
26 | + }, | ||
27 | + { | ||
28 | + label: '删除', | ||
29 | + icon: 'ant-design:delete-outlined', | ||
30 | + auth: 'api:yt:reportExport:delete', | ||
31 | + color: 'error', | ||
32 | + popConfirm: { | ||
33 | + title: '是否确认删除', | ||
34 | + confirm: handleDeleteOrBatchDelete.bind(null, record), | ||
27 | }, | 35 | }, |
28 | - { | ||
29 | - label: '导出报表', | ||
30 | - icon: 'clarity:note-edit-line', | ||
31 | - auth: 'api:yt:reportExport:export', | ||
32 | - }, | ||
33 | - { | ||
34 | - label: '删除', | ||
35 | - icon: 'ant-design:delete-outlined', | ||
36 | - auth: 'api:yt:reportExport:delete', | ||
37 | - color: 'error', | ||
38 | - popConfirm: { | ||
39 | - title: '是否确认删除', | ||
40 | - confirm: handleDeleteOrBatchDelete.bind(null, record), | ||
41 | - }, | ||
42 | - }, | ||
43 | - ]" | ||
44 | - /> | 36 | + }, |
37 | + ]" /> | ||
45 | </template> | 38 | </template> |
46 | </BasicTable> | 39 | </BasicTable> |
47 | <ReportPreviewModal @register="registerModal" /> | 40 | <ReportPreviewModal @register="registerModal" /> |
@@ -49,61 +42,64 @@ | @@ -49,61 +42,64 @@ | ||
49 | </template> | 42 | </template> |
50 | 43 | ||
51 | <script lang="ts" setup> | 44 | <script lang="ts" setup> |
52 | - import { reactive, nextTick } from 'vue'; | ||
53 | - import { BasicTable, useTable, TableAction } from '/@/components/Table'; | ||
54 | - import { cameraPage, deleteCameraManage } from '/@/api/camera/cameraManager'; | ||
55 | - import { searchFormSchema, columns } from './config.data'; | ||
56 | - import { Authority } from '/@/components/Authority'; | ||
57 | - import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | ||
58 | - import { Popconfirm } from 'ant-design-vue'; | ||
59 | - import { useModal } from '/@/components/Modal'; | ||
60 | - import ReportPreviewModal from './ReportPreviewModal.vue'; | 45 | +import { reactive, nextTick } from 'vue'; |
46 | +import { BasicTable, useTable, TableAction } from '/@/components/Table'; | ||
47 | +import { searchFormSchema, columns } from './config.data'; | ||
48 | +import { Authority } from '/@/components/Authority'; | ||
49 | +import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; | ||
50 | +import { Popconfirm } from 'ant-design-vue'; | ||
51 | +import { useModal } from '/@/components/Modal'; | ||
52 | +import ReportPreviewModal from './ReportPreviewModal.vue'; | ||
53 | +import { | ||
54 | + exportPage, | ||
55 | + deleteExportManage | ||
56 | +} from '/@/api/export/exportManager'; | ||
61 | 57 | ||
62 | - const searchInfo = reactive<Recordable>({}); | 58 | +const searchInfo = reactive<Recordable>({}); |
63 | 59 | ||
64 | - const [registerTable, { reload, setProps }] = useTable({ | ||
65 | - title: '报表导出列表', | ||
66 | - api: cameraPage, | ||
67 | - columns, | ||
68 | - showIndexColumn: false, | ||
69 | - clickToRowSelect: false, | ||
70 | - formConfig: { | ||
71 | - labelWidth: 120, | ||
72 | - schemas: searchFormSchema, | ||
73 | - }, | ||
74 | - useSearchForm: true, | ||
75 | - showTableSetting: true, | ||
76 | - bordered: true, | ||
77 | - rowKey: 'id', | ||
78 | - actionColumn: { | ||
79 | - width: 200, | ||
80 | - title: '操作', | ||
81 | - dataIndex: 'action', | ||
82 | - slots: { customRender: 'action' }, | ||
83 | - fixed: 'right', | ||
84 | - }, | ||
85 | - }); | 60 | +const [registerTable, { reload, setProps }] = useTable({ |
61 | + title: '报表导出列表', | ||
62 | + api: exportPage, | ||
63 | + columns, | ||
64 | + showIndexColumn: false, | ||
65 | + clickToRowSelect: false, | ||
66 | + formConfig: { | ||
67 | + labelWidth: 120, | ||
68 | + schemas: searchFormSchema, | ||
69 | + }, | ||
70 | + useSearchForm: true, | ||
71 | + showTableSetting: true, | ||
72 | + bordered: true, | ||
73 | + rowKey: 'id', | ||
74 | + actionColumn: { | ||
75 | + width: 200, | ||
76 | + title: '操作', | ||
77 | + dataIndex: 'action', | ||
78 | + slots: { customRender: 'action' }, | ||
79 | + fixed: 'right', | ||
80 | + }, | ||
81 | +}); | ||
86 | 82 | ||
87 | - const handleSuccess = () => { | ||
88 | - reload(); | ||
89 | - }; | 83 | +const handleSuccess = () => { |
84 | + reload(); | ||
85 | +}; | ||
90 | 86 | ||
91 | - const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( | ||
92 | - deleteCameraManage, | ||
93 | - handleSuccess, | ||
94 | - setProps | ||
95 | - ); | 87 | +const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( |
88 | + deleteExportManage, | ||
89 | + handleSuccess, | ||
90 | + setProps | ||
91 | +); | ||
96 | 92 | ||
97 | - nextTick(() => { | ||
98 | - setProps(selectionOptions); | ||
99 | - }); | 93 | +nextTick(() => { |
94 | + setProps(selectionOptions); | ||
95 | +}); | ||
100 | 96 | ||
101 | - const [registerModal, { openModal }] = useModal(); | ||
102 | - const handleView = (_, record) => { | ||
103 | - openModal(true, { | ||
104 | - isUpdate: true, | ||
105 | - record, | ||
106 | - }); | ||
107 | - }; | ||
108 | - const exportCharts = () => {}; | 97 | +const [registerModal, { openModal }] = useModal(); |
98 | +const handleView = (_, record) => { | ||
99 | + openModal(true, { | ||
100 | + isUpdate: true, | ||
101 | + record, | ||
102 | + }); | ||
103 | +}; | ||
104 | +const exportCharts = () => { }; | ||
109 | </script> | 105 | </script> |