Commit cbad8daea0363c734842a8e1c784b5aa8eef3fd4

Authored by xp.Huang
2 parents 2273cf0b dd02c01a

Merge branch 'f-dev' into 'main'

refractor:修改报表配置相关

See merge request huang/yun-teng-iot-front!277
@@ -210,8 +210,9 @@ @@ -210,8 +210,9 @@
210 } 210 }
211 map.addOverlay(marker); 211 map.addOverlay(marker);
212 //标注监听事件 212 //标注监听事件
213 - marker.addEventListener('click', function () {  
214 - map.openInfoWindow(infoWindow, map.getCenter()); 213 + marker.addEventListener('click', function (e) {
  214 + const point = e.point;
  215 + map.openInfoWindow(infoWindow, point);
215 }); 216 });
216 //标注监听事件 217 //标注监听事件
217 // } else { 218 // } else {
@@ -50,7 +50,7 @@ export const columns: BasicColumn[] = [ @@ -50,7 +50,7 @@ export const columns: BasicColumn[] = [
50 dataIndex: 'dataType', 50 dataIndex: 'dataType',
51 width: 120, 51 width: 120,
52 format: (_text: string, record: Recordable) => { 52 format: (_text: string, record: Recordable) => {
53 - return record.dataType === 0 ? '历史数据' : record.dataType === 1 ? '同比' : '环比'; 53 + return record.dataCompare === 0 ? '原始数据' : '聚合数据';
54 }, 54 },
55 }, 55 },
56 { 56 {
1 <template> 1 <template>
2 <div> 2 <div>
3 <BasicModal 3 <BasicModal
  4 + destroyOnClose
4 v-bind="$attrs" 5 v-bind="$attrs"
5 width="60rem" 6 width="60rem"
6 :height="heightNum" 7 :height="heightNum"
1 import { BasicColumn, FormSchema } from '/@/components/Table'; 1 import { BasicColumn, FormSchema } from '/@/components/Table';
2 import moment from 'moment'; 2 import moment from 'moment';
  3 +import { h } from 'vue';
  4 +import { Tag } from 'ant-design-vue';
3 5
4 // 表格配置 6 // 表格配置
5 export const columns: BasicColumn[] = [ 7 export const columns: BasicColumn[] = [
@@ -15,10 +17,10 @@ export const columns: BasicColumn[] = [ @@ -15,10 +17,10 @@ export const columns: BasicColumn[] = [
15 }, 17 },
16 { 18 {
17 title: '数据类型', 19 title: '数据类型',
18 - dataIndex: 'dataCompare', 20 + dataIndex: 'dataType',
19 width: 120, 21 width: 120,
20 format: (_text: string, record: Recordable) => { 22 format: (_text: string, record: Recordable) => {
21 - return record.dataCompare === 0 ? '历史数据' : record.dataCompare === 1 ? '同比' : '环比'; 23 + return record.dataCompare === 0 ? '原始数据' : '聚合数据';
22 }, 24 },
23 }, 25 },
24 { 26 {
@@ -31,10 +33,13 @@ export const columns: BasicColumn[] = [ @@ -31,10 +33,13 @@ export const columns: BasicColumn[] = [
31 }, 33 },
32 { 34 {
33 title: '执行状态', 35 title: '执行状态',
34 - dataIndex: 'status', 36 + dataIndex: 'executeStatus',
35 width: 120, 37 width: 120,
36 - format: (_text: string, record: Recordable) => {  
37 - return record.status === 1 ? '成功' : record.status === 0 ? '失败' : '进行中'; 38 + customRender: ({ record }) => {
  39 + const status = record.executeStatus;
  40 + const color = status == 1 ? 'green' : status == 0 ? 'red' : 'blue';
  41 + const text = status == 1 ? '成功' : status == 0 ? '失败' : '进行中';
  42 + return h(Tag, { color: color }, () => text);
38 }, 43 },
39 }, 44 },
40 { 45 {
@@ -57,7 +62,7 @@ export const searchFormSchema: FormSchema[] = [ @@ -57,7 +62,7 @@ export const searchFormSchema: FormSchema[] = [
57 }, 62 },
58 }, 63 },
59 { 64 {
60 - field: 'status', 65 + field: 'executeStatus',
61 label: '执行状态', 66 label: '执行状态',
62 component: 'Select', 67 component: 'Select',
63 colProps: { span: 6 }, 68 colProps: { span: 6 },
@@ -2,36 +2,45 @@ @@ -2,36 +2,45 @@
2 <div> 2 <div>
3 <BasicTable :clickToRowSelect="false" @register="registerTable" :searchInfo="searchInfo"> 3 <BasicTable :clickToRowSelect="false" @register="registerTable" :searchInfo="searchInfo">
4 <template #toolbar> 4 <template #toolbar>
5 - <Authority value="api:yt:reportExport:export">  
6 - <Popconfirm title="您确定要导出报表数据吗?" ok-text="确定" cancel-text="取消" @confirm="exportCharts()">  
7 - <a-button type="primary"> 导出报表 </a-button>  
8 - </Popconfirm>  
9 - </Authority>  
10 <Authority value="api:yt:reportExport:delete"> 5 <Authority value="api:yt:reportExport:delete">
11 - <Popconfirm title="您确定要批量删除数据" ok-text="确定" cancel-text="取消" @confirm="handleDeleteOrBatchDelete(null)"> 6 + <Popconfirm
  7 + title="您确定要批量删除数据"
  8 + ok-text="确定"
  9 + cancel-text="取消"
  10 + @confirm="handleDeleteOrBatchDelete(null)"
  11 + >
12 <a-button type="primary" color="error" :disabled="hasBatchDelete"> 批量删除 </a-button> 12 <a-button type="primary" color="error" :disabled="hasBatchDelete"> 批量删除 </a-button>
13 </Popconfirm> 13 </Popconfirm>
14 </Authority> 14 </Authority>
15 </template> 15 </template>
16 <template #action="{ record }"> 16 <template #action="{ record }">
17 - <TableAction :actions="[  
18 - {  
19 - label: '报表查看',  
20 - icon: 'clarity:note-edit-line',  
21 - auth: 'api:yt:reportExport:get',  
22 - onClick: handleView.bind(null, record),  
23 - },  
24 - {  
25 - label: '删除',  
26 - icon: 'ant-design:delete-outlined',  
27 - auth: 'api:yt:reportExport:delete',  
28 - color: 'error',  
29 - popConfirm: {  
30 - title: '是否确认删除',  
31 - confirm: handleDeleteOrBatchDelete.bind(null, record), 17 + <TableAction
  18 + :actions="[
  19 + {
  20 + label: '报表导出',
  21 + icon: 'clarity:note-edit-line',
  22 + auth: 'api:yt:reportExport:export',
  23 + onClick: handleExport.bind(null, record),
  24 + ifShow: record.executeStatus === 1,
  25 + },
  26 + {
  27 + label: '报表查看',
  28 + icon: 'clarity:note-edit-line',
  29 + auth: 'api:yt:reportExport:get',
  30 + onClick: handleView.bind(null, record),
32 }, 31 },
33 - },  
34 - ]" /> 32 + {
  33 + label: '删除',
  34 + icon: 'ant-design:delete-outlined',
  35 + auth: 'api:yt:reportExport:delete',
  36 + color: 'error',
  37 + popConfirm: {
  38 + title: '是否确认删除',
  39 + confirm: handleDeleteOrBatchDelete.bind(null, record),
  40 + },
  41 + },
  42 + ]"
  43 + />
35 </template> 44 </template>
36 </BasicTable> 45 </BasicTable>
37 <ReportPreviewModal @register="registerModal" /> 46 <ReportPreviewModal @register="registerModal" />
@@ -39,75 +48,67 @@ @@ -39,75 +48,67 @@
39 </template> 48 </template>
40 49
41 <script lang="ts" setup> 50 <script lang="ts" setup>
42 -import { reactive, nextTick } from 'vue';  
43 -import { BasicTable, useTable, TableAction } from '/@/components/Table';  
44 -import { searchFormSchema, columns } from './config.data';  
45 -import { Authority } from '/@/components/Authority';  
46 -import { useBatchDelete } from '/@/hooks/web/useBatchDelete';  
47 -import { Popconfirm } from 'ant-design-vue';  
48 -import { useModal } from '/@/components/Modal';  
49 -import ReportPreviewModal from './ReportPreviewModal.vue';  
50 -import {  
51 - exportPage,  
52 - deleteExportManage  
53 -} from '/@/api/export/exportManager';  
54 -  
55 -const searchInfo = reactive<Recordable>({}); 51 + import { reactive, nextTick } from 'vue';
  52 + import { BasicTable, useTable, TableAction } from '/@/components/Table';
  53 + import { searchFormSchema, columns } from './config.data';
  54 + import { Authority } from '/@/components/Authority';
  55 + import { useBatchDelete } from '/@/hooks/web/useBatchDelete';
  56 + import { Popconfirm } from 'ant-design-vue';
  57 + import { useModal } from '/@/components/Modal';
  58 + import ReportPreviewModal from './ReportPreviewModal.vue';
  59 + import { exportPage, deleteExportManage } from '/@/api/export/exportManager';
  60 + import { downloadByUrl } from '/@/utils/file/download';
56 61
57 -const [registerTable, { reload, setProps, setTableData }] = useTable({  
58 - title: '报表导出列表',  
59 - api: exportPage,  
60 - columns,  
61 - showIndexColumn: false,  
62 - clickToRowSelect: false,  
63 - formConfig: {  
64 - labelWidth: 120,  
65 - schemas: searchFormSchema,  
66 - },  
67 - useSearchForm: true,  
68 - showTableSetting: true,  
69 - bordered: true,  
70 - rowKey: 'id',  
71 - actionColumn: {  
72 - width: 200,  
73 - title: '操作',  
74 - dataIndex: 'action',  
75 - slots: { customRender: 'action' },  
76 - fixed: 'right',  
77 - },  
78 -});  
79 -  
80 -const handleSuccess = () => {  
81 - reload();  
82 -};  
83 -  
84 -const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete(  
85 - deleteExportManage,  
86 - handleSuccess,  
87 - setProps  
88 -); 62 + const searchInfo = reactive<Recordable>({});
  63 + const [registerTable, { reload, setProps }] = useTable({
  64 + title: '报表导出列表',
  65 + api: exportPage,
  66 + columns,
  67 + showIndexColumn: false,
  68 + clickToRowSelect: false,
  69 + formConfig: {
  70 + labelWidth: 120,
  71 + schemas: searchFormSchema,
  72 + },
  73 + useSearchForm: true,
  74 + showTableSetting: true,
  75 + bordered: true,
  76 + rowKey: 'id',
  77 + actionColumn: {
  78 + width: 200,
  79 + title: '操作',
  80 + dataIndex: 'action',
  81 + slots: { customRender: 'action' },
  82 + fixed: 'right',
  83 + },
  84 + });
89 85
90 -nextTick(() => {  
91 - setProps(selectionOptions);  
92 - setTableData([  
93 - {  
94 - reportConfigName: '1',  
95 - organizationName: '2',  
96 - dataCompare: 1,  
97 - executeWay: 1,  
98 - executeTime: 1,  
99 - status: 2  
100 - }  
101 - ]) 86 + const handleSuccess = () => {
  87 + reload();
  88 + };
102 89
103 -}); 90 + const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete(
  91 + deleteExportManage,
  92 + handleSuccess,
  93 + setProps
  94 + );
104 95
105 -const [registerModal, { openModal }] = useModal();  
106 -const handleView = (_, record) => {  
107 - openModal(true, {  
108 - isUpdate: true,  
109 - record, 96 + nextTick(() => {
  97 + setProps(selectionOptions);
110 }); 98 });
111 -};  
112 -const exportCharts = () => { }; 99 +
  100 + const [registerModal, { openModal }] = useModal();
  101 + const handleView = (_, record) => {
  102 + openModal(true, {
  103 + isUpdate: true,
  104 + record,
  105 + });
  106 + };
  107 + const handleExport = (record) => {
  108 + const url = record.reportPath;
  109 + downloadByUrl({
  110 + url,
  111 + target: '_self',
  112 + });
  113 + };
113 </script> 114 </script>
@@ -116,7 +116,9 @@ @@ -116,7 +116,9 @@
116 mode: 'modal', //不要默认的错误提示 116 mode: 'modal', //不要默认的错误提示
117 }) 117 })
118 .catch((data) => { 118 .catch((data) => {
119 - createMessage.error(data.message); 119 + //登录失败返回的html,所以提示框什么都没有
  120 + //去掉提示框
  121 + // createMessage.error(data.message);
120 }); 122 });
121 if (userInfo) { 123 if (userInfo) {
122 notification.success({ 124 notification.success({