Browse Source

[Feat 0000]测风装置监测曲线历史数据导出功能

bobo04052021@163.com 1 month ago
parent
commit
4f41862152

+ 1 - 1
.env

@@ -1,5 +1,5 @@
 # port
-VITE_PORT = 8062
+VITE_PORT = 3100
 
 #  网站标题
 VITE_GLOB_APP_TITLE = 智能通风管控系统

+ 17 - 6
pnpm-lock.yaml

@@ -96,8 +96,8 @@ importers:
         specifier: ^1.12.4
         version: 1.12.4
       echarts:
-        specifier: ^5.5.0
-        version: 5.6.0
+        specifier: ^6.0.0
+        version: 6.0.0
       emoji-mart-vue-fast:
         specifier: ^15.0.0
         version: 15.0.5(vue@3.5.24(typescript@4.9.5))
@@ -1863,28 +1863,24 @@ packages:
     engines: {node: '>=10'}
     cpu: [arm64]
     os: [linux]
-    libc: [glibc]
 
   '@swc/core-linux-arm64-musl@1.15.2':
     resolution: {integrity: sha512-5av6VYZZeneiYIodwzGMlnyVakpuYZryGzFIbgu1XP8wVylZxduEzup4eP8atiMDFmIm+s4wn8GySJmYqeJC0A==}
     engines: {node: '>=10'}
     cpu: [arm64]
     os: [linux]
-    libc: [musl]
 
   '@swc/core-linux-x64-gnu@1.15.2':
     resolution: {integrity: sha512-1nO/UfdCLuT/uE/7oB3EZgTeZDCIa6nL72cFEpdegnqpJVNDI6Qb8U4g/4lfVPkmHq2lvxQ0L+n+JdgaZLhrRA==}
     engines: {node: '>=10'}
     cpu: [x64]
     os: [linux]
-    libc: [glibc]
 
   '@swc/core-linux-x64-musl@1.15.2':
     resolution: {integrity: sha512-Ksfrb0Tx310kr+TLiUOvB/I80lyZ3lSOp6cM18zmNRT/92NB4mW8oX2Jo7K4eVEI2JWyaQUAFubDSha2Q+439A==}
     engines: {node: '>=10'}
     cpu: [x64]
     os: [linux]
-    libc: [musl]
 
   '@swc/core-win32-arm64-msvc@1.15.2':
     resolution: {integrity: sha512-IzUb5RlMUY0r1A9IuJrQ7Tbts1wWb73/zXVXT8VhewbHGoNlBKE0qUhKMED6Tv4wDF+pmbtUJmKXDthytAvLmg==}
@@ -3733,6 +3729,9 @@ packages:
   echarts@5.6.0:
     resolution: {integrity: sha512-oTbVTsXfKuEhxftHqL5xprgLoc0k7uScAwtryCgWF6hPYFLRwOUHiFmHGCBKP5NPFNkDVopOieyUqYGH8Fa3kA==}
 
+  echarts@6.0.0:
+    resolution: {integrity: sha512-Tte/grDQRiETQP4xz3iZWSvoHrkCQtwqd6hs+mifXcjrCuo2iKWbajFObuLJVBlDIJlOzgQPd1hsaKt/3+OMkQ==}
+
   editorconfig@1.0.4:
     resolution: {integrity: sha512-L9Qe08KWTlqYMVvMcTIvMAdl1cDUubzRNYL+WfA4bLDMHe4nemKkpmYzkznE1FwLKu0EEmy6obgQKzMJrg4x9Q==}
     engines: {node: '>=14'}
@@ -7890,6 +7889,9 @@ packages:
   zrender@5.6.1:
     resolution: {integrity: sha512-OFXkDJKcrlx5su2XbzJvj/34Q3m6PvyCZkVPHGYpcCJ52ek4U/ymZyfuV1nKE23AyBJ51E/6Yr0mhZ7xGTO4ag==}
 
+  zrender@6.0.0:
+    resolution: {integrity: sha512-41dFXEEXuJpNecuUQq6JlbybmnHaqqpGlbH1yxnA5V9MMP4SbohSVZsJIwz+zdjQXSSlR1Vc34EgH1zxyTDvhg==}
+
 snapshots:
 
   '@aesoper/normal-utils@0.1.5': {}
@@ -11813,6 +11815,11 @@ snapshots:
       tslib: 2.3.0
       zrender: 5.6.1
 
+  echarts@6.0.0:
+    dependencies:
+      tslib: 2.3.0
+      zrender: 6.0.0
+
   editorconfig@1.0.4:
     dependencies:
       '@one-ini/wasm': 0.1.1
@@ -16750,3 +16757,7 @@ snapshots:
   zrender@5.6.1:
     dependencies:
       tslib: 2.3.0
+
+  zrender@6.0.0:
+    dependencies:
+      tslib: 2.3.0

+ 11 - 11
src/components/chart/BarAndLine.vue

@@ -84,22 +84,22 @@ export default defineComponent({
       color: ['#7B68EE', '#0000CD', '#6495ED', '#00BFFF', '#AFEEEE', '#008080', '#00FA9A', '#2E8B57', '#FAFAD2', '#DAA520'],
       tooltip: {},
       grid: {},
-      toolbox: {
-        feature: {
-          saveAsImage: {
-            iconStyle: {
-              borderColor: '#ffffff',
-            },
-            show: false,
-          },
-        },
-      },
+      // toolbox: {
+      //   feature: {
+      //     saveAsImage: {
+      //       iconStyle: {
+      //         borderColor: '#ffffff',
+      //       },
+      //       show: true,
+      //     },
+      //   },
+      // },
       dataZoom: {},
       legend: {
         textStyle: {
           color: '#ffffff', // 字体颜色
         },
-        top: '20',
+        top: '30',
       },
       timeline: null,
       xAxis: {},

+ 2 - 2
src/router/routes/index.ts

@@ -38,9 +38,9 @@ export const LoginRoute: AppRouteRecordRaw = {
   path: '/login',
   name: 'Login',
   //新版后台登录,如果想要使用旧版登录放开即可
-  // component: () => import('/@/views/sys/login/Login.vue'),
+  component: () => import('/@/views/sys/login/Login.vue'),
   //数据中心登录
-  component: () => import('/@/views/sys/login/LoginDataCenter.vue'),
+  // component: () => import('/@/views/sys/login/LoginDataCenter.vue'),
   // 内页登录
   // component: () => import('/@/views/sys/login/LoginNeiye.vue'),
   // component: () => import('/@/views/system/loginmini/MiniLogin.vue'),

+ 1 - 1
src/views/vent/deviceManager/configurationTable/types.ts

@@ -99,7 +99,7 @@ export interface ModuleData {
         | 'radio_label'
         | 'button_list'
         | 'card_list'
-        | 'generalist';
+        | 'generalist'
         | 'nitrogenBtnList';
       /** 分区大小 */
       basis: string;

+ 35 - 7
src/views/vent/monitorManager/comment/DeviceEcharts.vue

@@ -113,6 +113,7 @@
           <a-select-option value="1h">1小时</a-select-option>
         </a-select>
       </template>
+      <!-- <a-button type="primary" preIcon="ant-design:export-outlined" @click="downloadChart()"> 导出</a-button> -->
       <Pagination
         size="small"
         v-model:current="currentPage"
@@ -131,6 +132,7 @@
         style="margin-top: 20px"
         :chartsColumns="chartsColumnList"
         :regValues="standardValues"
+        :key="deviceId"
       />
     </div>
   </div>
@@ -142,6 +144,7 @@ import dayjs from 'dayjs';
 import { defHttp } from '/@/utils/http/axios';
 import { Select, Pagination } from 'ant-design-vue';
 import { getTableHeaderColumns } from '/@/hooks/web/useWebColumns';
+import { size } from 'lodash';
 
 export default defineComponent({
   name: 'DeviceEcharts',
@@ -192,6 +195,12 @@ export default defineComponent({
     const chartsType = ref('listMonitor');
     const deviceId = ref('');
     const options = ref([]);
+    const selectedDeviceName = computed(() => {
+      const device = options.value.find((o) => o.deviceID === deviceId.value);
+      const name = device?.strname || '设备数据图表';
+      console.log('当前选中设备名:', name); // 你可以看控制台是否正确
+      return name;
+    });
     const historyParams = reactive({
       ttime_begin: dayjs().startOf('date').format('YYYY-MM-DD HH:mm:ss').toString(),
       ttime_end: dayjs().format('YYYY-MM-DD HH:mm:ss').toString(),
@@ -205,7 +214,7 @@ export default defineComponent({
     const detailDataSource = ref<any[]>([]);
     const historyData = ref([]);
     const currentPage = ref<number>(1);
-    const pageSize = ref<number>(20);
+    const pageSize = ref<number>(300);
     const total = ref(0);
     interface RegValueItem {
       type: string;
@@ -232,21 +241,40 @@ export default defineComponent({
         },
       },
     };
-    const echartsOption1 = {
+    const echartsOption1 = computed(() => ({
+      title: {
+        text: selectedDeviceName.value, // 动态标题
+        left: 'center',
+        textStyle: {
+          color: '#fff',
+          fontSize: 12,
+        },
+        top: 5,
+      },
       grid: {
         top: '70px',
         left: '10px',
-        right: chartsColumnList.length * 15 + 'px',
-        bottom: '45px',
+        right: '45px',
+        bottom: '25px',
         containLabel: true,
       },
       toolbox: {
-        feature: {},
+        show: true,
+        feature: {
+          saveAsImage: {
+            name: selectedDeviceName.value + '历史数据图表',
+            type: 'png',
+            pixelRatio: 2,
+            backgroundColor: '#07223a',
+          },
+        },
+        right: 10,
+        top: -5,
       },
       xAxis: {
         interval: 0,
       },
-    };
+    }));
     const echartsOption2 = {
       grid: {
         top: '70px',
@@ -259,7 +287,6 @@ export default defineComponent({
         feature: {},
       },
     };
-
     const onChange = (pageNumber: number) => {
       console.log('Page: ', pageNumber);
     };
@@ -403,6 +430,7 @@ export default defineComponent({
     return {
       chartsType,
       deviceId,
+      selectedDeviceName,
       resultDataSource,
       historyParams,
       options,