Commit f4bd381f9a81f5a3fc40f068e1766ad3da71d3e6

Authored by fengtao
1 parent 412620f6

feat:新增报表导出接口

  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 +};
... ...
  1 +import { BasicPageParams } from '/@/api/model/baseModel';
  2 +export type ExportQueryParam = BasicPageParams & ExportParam;
  3 +
  4 +export type ExportParam = {
  5 + reportConfigName: string;
  6 + status: number;
  7 + orderFiled: string;
  8 + orderType: string;
  9 +};
... ...
... ... @@ -5,27 +5,33 @@ import moment from 'moment';
5 5 export const columns: BasicColumn[] = [
6 6 {
7 7 title: '配置名称',
8   - dataIndex: '1',
  8 + dataIndex: 'reportConfigName',
9 9 width: 80,
10 10 },
11 11 {
12 12 title: '所属组织',
13   - dataIndex: '2',
  13 + dataIndex: 'organizationName',
14 14 width: 120,
15 15 },
16 16 {
17 17 title: '数据类型',
18   - dataIndex: '3',
  18 + dataIndex: 'dataCompare',
19 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 27 width: 120,
  28 + format: (_text: string, record: Recordable) => {
  29 + return record.executeWay === 0 ? '立即执行' : '定时执行';
  30 + },
25 31 },
26 32 {
27 33 title: '执行日期',
28   - dataIndex: '8',
  34 + dataIndex: 'executeTime',
29 35 width: 180,
30 36 },
31 37 ];
... ... @@ -33,7 +39,7 @@ export const columns: BasicColumn[] = [
33 39 // 查询配置
34 40 export const searchFormSchema: FormSchema[] = [
35 41 {
36   - field: '1',
  42 + field: 'reportConfigName',
37 43 label: '配置名称',
38 44 component: 'Input',
39 45 colProps: { span: 6 },
... ... @@ -43,7 +49,7 @@ export const searchFormSchema: FormSchema[] = [
43 49 },
44 50 },
45 51 {
46   - field: '2',
  52 + field: 'status',
47 53 label: '执行状态',
48 54 component: 'Select',
49 55 colProps: { span: 6 },
... ... @@ -66,7 +72,7 @@ export const searchFormSchema: FormSchema[] = [
66 72 },
67 73 },
68 74 {
69   - field: '3',
  75 + field: 'executeTime',
70 76 label: '执行时间',
71 77 component: 'RangePicker',
72 78 componentProps: {
... ...
... ... @@ -6,42 +6,35 @@
6 6 <a-button type="primary" @click="exportCharts"> 导出报表 </a-button>
7 7 </Authority>
8 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 10 <a-button type="primary" color="error" :disabled="hasBatchDelete"> 批量删除 </a-button>
16 11 </Popconfirm>
17 12 </Authority>
18 13 </template>
19 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 38 </template>
46 39 </BasicTable>
47 40 <ReportPreviewModal @register="registerModal" />
... ... @@ -49,61 +42,64 @@
49 42 </template>
50 43
51 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 105 </script>
... ...