Browse Source

[Feat 0000] 历史组件添加定制模板化下载功能

hongrunxia 2 weeks ago
parent
commit
261d4891b3

+ 5 - 2
src/hooks/system/useMethods.ts

@@ -72,6 +72,7 @@ export function useMethods() {
     defHttp
       .post({ url: url, params: params, timeout: 1000 * 1000 }, { isTransformResponse: false })
       .then((data) => {
+        debugger;
         if (data.code == 200 && data.result) {
           const messageArr = data.result.split('/');
           const fileUrl = messageArr[messageArr.length - 1];
@@ -103,7 +104,8 @@ export function useMethods() {
   }
 
   async function exportXlsPost1(name, url, params, isXlsx = false) {
-    const data = await defHttp.get({ url: url, params: params, responseType: 'blob', timeout: 1000 * 1000 }, { isTransformResponse: false });
+    const data = await defHttp.post({ url: url, data: params, responseType: 'blob' }, { isTransformResponse: false });
+    debugger;
     if (!data) {
       createMessage.warning('文件下载失败');
       return;
@@ -174,7 +176,8 @@ export function useMethods() {
   return {
     handleExportXls: (name: string, url: string, params?: object) => exportXls(name, url, params),
     handleExportXlsPost: (name: string, url: string, params?: object) => exportXlsPost(name, url, params),
-    exportXlsPost0: (name: string, url: string, params?: object) => exportXlsPost1(name, url, params),
+    exportXlsGetBlob: (name: string, url: string, params?: object) => exportXls(name, url, params),
+    exportXlsPostBlob: (name: string, url: string, params?: object) => exportXlsPost1(name, url, params),
     handleImportXls: (data, url, success) => importXls(data, url, success),
     handleExportXlsx: (name: string, url: string, params?: object) => exportXls(name, url, params, true),
   };

+ 2 - 1
src/layouts/default/sider/index.vue

@@ -14,7 +14,8 @@
   <BottomSider v-else-if="getIsBottomMenu" />
   <Sider v-else /> -->
   <BottomSider v-if="!noSiderLink.includes(routePath)" />
-  <bottomSider2 v-if="noChatLink.includes(routePath)" />
+  <!-- <bottomSider2 v-if="!noChatLink.includes(routePath)" /> -->
+  <!-- <bottomSider2 /> -->
 </template>
 <script lang="ts">
   import { defineComponent } from 'vue';

+ 4 - 3
src/views/vent/monitorManager/comment/DeviceEcharts.vue

@@ -45,7 +45,7 @@
         size="small"
         style="position: absolute; z-index: 99; left: 102px; width: 150px; top: 2px"
       />
-      <template v-if="globalConfig.History_Type == 'vent'">
+      <template v-if="stationType != 'redis'">
         <a-date-picker
           v-model:value="historyParams.ttime_begin"
           valueFormat="YYYY-MM-DD HH:mm:ss"
@@ -72,7 +72,7 @@
           <a-select-option value="1">1秒</a-select-option>
           <a-select-option value="2">5秒</a-select-option>
           <a-select-option value="3">10秒</a-select-option>
-          <a-select-option value="4">30分钟</a-select-option>
+          <a-select-option value="4">30</a-select-option>
           <a-select-option value="5">1分钟</a-select-option>
           <a-select-option value="6">10分钟</a-select-option>
           <a-select-option value="7">30分钟</a-select-option>
@@ -202,7 +202,6 @@
       const currentPage = ref<number>(1);
       const pageSize = ref<number>(20);
       const total = ref(0);
-
       const echartsOption = {
         grid: {
           top: '60px',
@@ -271,6 +270,7 @@
             const device = options.value.find((device) => device['deviceID'] === newDeviceId);
             if (device) {
               let res;
+              stationType.value = device['stationtype'];
               if (device['stationtype'] !== 'redis') {
                 resultXAxisPropType.value = 'ttime';
                 historyList = (params) => defHttp.get({ url: '/safety/ventanalyMonitorData/listdays', params });
@@ -363,6 +363,7 @@
         echartsOption2,
         onChange,
         globalConfig,
+        stationType,
       };
     },
   });

+ 27 - 2
src/views/vent/monitorManager/comment/HistoryTable.vue

@@ -36,6 +36,7 @@
   import dayjs from 'dayjs';
   import { getAutoScrollContainer } from '/@/utils/common/compUtils';
   import { render } from '/@/utils/common/renderUtils';
+  import { useMethods } from '/@/hooks/system/useMethods';
 
   const globalConfig = inject('globalConfig');
   const props = defineProps({
@@ -77,7 +78,7 @@
       default: () => [],
     },
   });
-
+  const { exportXlsPostBlob } = useMethods();
   const getDeviceListApi = (params) => defHttp.post({ url: '/monitor/device', params });
   const historyTable = ref();
   const loading = ref(false);
@@ -110,6 +111,8 @@
   const tableScroll = props.scroll.y ? ref({ y: props.scroll.y - 100 }) : ref({});
   let deviceOptions = ref([]);
   const deviceTypeStr = ref('');
+  const deviceTypeName = ref('');
+  const deviceType = ref('');
   loading.value = true;
 
   watch(
@@ -203,6 +206,10 @@
         } else {
           if (res['records'] && res['records'].length > 0) result = res['records'];
         }
+        if (res['msgTxt'] && res['msgTxt'][0]) {
+          deviceTypeName.value = res['msgTxt'][0]['typeName'];
+          deviceType.value = res['msgTxt'][0]['type'];
+        }
       } else {
         const res = await getDeviceListApi({ devicetype: props.deviceType, pageSize: 10000 });
         if (res['records'] && res['records'].length > 0) {
@@ -210,6 +217,10 @@
         } else if (res['msgTxt'] && res['msgTxt'][0] && res['msgTxt'][0]['datalist']) {
           result = res['msgTxt'][0]['datalist'];
         }
+        if (res['msgTxt'] && res['msgTxt'][0]) {
+          deviceTypeName.value = res['msgTxt'][0]['typeName'];
+          deviceType.value = res['msgTxt'][0]['type'];
+        }
       }
     } else {
       const res = await getDeviceListApi({
@@ -222,6 +233,10 @@
       } else if (res['msgTxt'] && res['msgTxt'][0] && res['msgTxt'][0]['datalist']) {
         result = res['msgTxt'][0]['datalist'];
       }
+      if (res['msgTxt'] && res['msgTxt'][0]) {
+        deviceTypeName.value = res['msgTxt'][0]['typeName'];
+        deviceType.value = res['msgTxt'][0]['type'];
+      }
     }
 
     if (result) {
@@ -236,6 +251,7 @@
           stationtype: item['stationtype'],
         };
       });
+
       stationType.value = deviceOptions.value[0]['stationtype'];
       historyType.value = deviceOptions.value[0]['strtype'] || deviceOptions.value[0]['devicekind'];
     }
@@ -473,7 +489,16 @@
     const params = resetFormParam();
     // 判断时间间隔和查询时间区间,数据量下载大时进行提示
     if (stationType.value !== 'redis') {
-      return onExportXls(params);
+      if (deviceType.value === 'modelsensor_multi') {
+        const url = '/ventanaly-device/safety/reportInfo/expComReportByParam';
+        return exportXlsPostBlob('传感器历史数据', url, {
+          deviceKind: deviceType.value.split('_')[0],
+          deviceType: deviceType.value,
+          tempName: 'dcsbb',
+        });
+      } else {
+        return onExportXls(params);
+      }
     } else {
       return onExportXlsPost(params);
     }

+ 9 - 1
src/views/vent/monitorManager/windowMonitor/dandaoFcYjl.threejs.ts

@@ -53,8 +53,16 @@ class ddFc_1 {
         x: 100,
         y: 95,
       },
+      // {
+      //   text: `${selectData.OpenDegree ? '设定开度值(°)' : selectData.forntArea ? '过风面积(㎡)' : '过风面积(㎡)'}:`,
+      //   font: 'normal 30px Arial',
+      //   color: '#009900',
+      //   strokeStyle: '#002200',
+      //   x: 5,
+      //   y: 145,
+      // },
       {
-        text: `${selectData.OpenDegree ? '设定开度值(°)' : selectData.forntArea ? '过风面积(㎡)' : '过风面积(㎡)'}:`,
+        text: '设定开度值(°):',
         font: 'normal 30px Arial',
         color: '#009900',
         strokeStyle: '#002200',

+ 2 - 2
src/views/vent/safetyList/common/HistoryTable.vue

@@ -138,9 +138,9 @@
   }
   //导入导出方法
   function onExportXlsFn() {
-    const { exportXlsPost0 } = useMethods();
+    const { exportXlsGetBlob } = useMethods();
     const params = resetFormParam();
-    exportXlsPost0('历史数据', postExportXlsUrl, params);
+    exportXlsGetBlob('历史数据', postExportXlsUrl, params);
   }
 
   // 列表页面公共参数、方法