From c9fc948cfa3cf91c072a13787aed5cb50fb31669 Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Mon, 15 Jan 2024 13:24:41 +0800
Subject: [PATCH] fix:bug修复

---
 src/views/reportForm/sensor.vue |  140 +++++++++++++++++++++++++++++++++-------------
 1 files changed, 100 insertions(+), 40 deletions(-)

diff --git a/src/views/reportForm/sensor.vue b/src/views/reportForm/sensor.vue
index 92afa2e..cf33276 100644
--- a/src/views/reportForm/sensor.vue
+++ b/src/views/reportForm/sensor.vue
@@ -12,7 +12,10 @@
           style="width: 21rem"
         />
         <div>
-          <el-radio-group v-model="select1" style="margin-left: 20px">
+          <el-radio-group
+            v-model="select1"
+            style="margin-left: 20px"
+          >
             <el-radio-button label="���������" />
             <el-radio-button label="������" />
             <el-radio-button label="������" />
@@ -23,8 +26,8 @@
         <component
           :is="dataType"
           style="padding-left: 0; margin-left: 30px"
-          @sendPickerChild="showPickerChild"
           class="select11"
+          @sendPickerChild="showPickerChild"
         />
         <el-date-picker
           v-if="dateDisplay"
@@ -38,11 +41,17 @@
         />
         <el-button
           type="primary"
-          @click="getReportForm()"
           style="margin-left: 10px"
-          >������</el-button
+          @click="getReportForm()"
         >
-        <el-button type="primary" @click="exportExcel()">������������</el-button>
+          ������
+        </el-button>
+        <el-button
+          type="primary"
+          @click="exportExcel()"
+        >
+          ������������
+        </el-button>
       </div>
     </div>
     <div class="topTitle">
@@ -56,7 +65,11 @@
         :stripe="true"
         @sort-change="changeTableSort"
       >
-        <el-table-column prop="rank" label="������" align="center" />
+        <el-table-column
+          prop="rank"
+          label="������"
+          align="center"
+        />
         <el-table-column
           prop="deviceName"
           label="������"
@@ -69,8 +82,18 @@
           width="180"
           align="center"
         />
-        <el-table-column prop="time" label="������" width="180" align="center" />
-        <el-table-column prop="aqi" label="AQI" sortable align="center" />
+        <el-table-column
+          prop="time"
+          label="������"
+          width="180"
+          align="center"
+        />
+        <el-table-column
+          prop="aqi"
+          label="AQI"
+          sortable
+          align="center"
+        />
         <el-table-column
           prop="comIndex"
           label="������������"
@@ -78,13 +101,48 @@
           sortable
           align="center"
         />
-        <el-table-column prop="a34004" label="PM2.5" sortable align="center" />
-        <el-table-column prop="a34002" label="PM10" sortable align="center" />
-        <el-table-column prop="a21026" label="SO2" sortable align="center" />
-        <el-table-column prop="a21004" label="NO2" sortable align="center" />
-        <el-table-column prop="a21005" label="CO" sortable align="center" />
-        <el-table-column prop="a05024" label="O3_8H" sortable align="center" />
-        <el-table-column prop="a99054" label="TVOC" sortable align="center" />
+        <el-table-column
+          prop="a34004"
+          label="PM2.5"
+          sortable
+          align="center"
+        />
+        <el-table-column
+          prop="a34002"
+          label="PM10"
+          sortable
+          align="center"
+        />
+        <el-table-column
+          prop="a21026"
+          label="SO2"
+          sortable
+          align="center"
+        />
+        <el-table-column
+          prop="a21004"
+          label="NO2"
+          sortable
+          align="center"
+        />
+        <el-table-column
+          prop="a21005"
+          label="CO"
+          sortable
+          align="center"
+        />
+        <el-table-column
+          prop="a05024"
+          label="O3_8H"
+          sortable
+          align="center"
+        />
+        <el-table-column
+          prop="a99054"
+          label="TVOC"
+          sortable
+          align="center"
+        />
       </el-table>
     </div>
   </div>
@@ -117,7 +175,7 @@
     weekPicker,
   },
   props: {},
-  data() {
+  data () {
     // ������������������
     return {
       newData: [],
@@ -152,7 +210,7 @@
   computed: {},
   // ������data������������������
   watch: {
-    select1(nv, ov) {
+    select1 (nv, ov) {
       if (nv === '������') {
         this.dataType = 'HourPicker'
         this.unit = 1
@@ -175,7 +233,7 @@
         this.dateDisplay = false
       }
     },
-    newMac(newVal, oldval) {
+    newMac (newVal, oldval) {
       this.newMac1 = []
       for (let i = 0; i < newVal.length; i++) {
         // console.log(newVal[i], 111)
@@ -186,25 +244,25 @@
   },
 
   // ������������ - ��������������������������������� this ���������
-  created() {
+  created () {
     this.getData()
   },
   // ������������ - ��������������������������� DOM ���������
-  mounted() {},
-  beforeCreate() {}, // ������������ - ������������
-  beforeMount() {}, // ������������ - ������������
-  beforeUpdate() {}, // ������������ - ������������
-  updated() {}, // ������������ - ������������
-  beforeDestroy() {}, // ������������ - ������������
-  destroyed() {}, // ������������ - ������������
-  activated() {},
+  mounted () {},
+  beforeCreate () {}, // ������������ - ������������
+  beforeMount () {}, // ������������ - ������������
+  beforeUpdate () {}, // ������������ - ������������
+  updated () {}, // ������������ - ������������
+  beforeDestroy () {}, // ������������ - ������������
+  destroyed () {}, // ������������ - ������������
+  activated () {},
   // ������������
   methods: {
-    showPickerChild(data) {
+    showPickerChild (data) {
       this.newData = data
     },
     // ������������rank������(���������������������������������������������������������������)
-    changeTableSort() {
+    changeTableSort () {
       var sortTableData = this.$refs.mytable.tableData
       // console.log(this.$refs.mytable.tableData, 111)
       for (let i = 0; i < sortTableData.length; i++) {
@@ -213,7 +271,7 @@
     },
 
     // ������������
-    exportExcel() {
+    exportExcel () {
       /* generate workbook object from table */
       var xlsxParam = { raw: true } // ���������������������������������������������������
       var wb = XLSX.utils.table_to_book(
@@ -240,7 +298,7 @@
       return wbout
     },
     // ������������������
-    getData() {
+    getData () {
       this.$request({
         url: '/monitorPoint/queryMonitorPoints',
         method: 'get',
@@ -258,14 +316,16 @@
               label: this.defaultData[i].name,
             })
             this.options[i].children = []
-            for (let j = 0; j < this.defaultData[i].devices.length; j++) {
-              this.options[i].children.push({
-                value: [
-                  this.defaultData[i].devices[j].name,
-                  this.defaultData[i].devices[j].mac,
-                ],
-                label: this.defaultData[i].devices[j].name,
-              })
+            if (this.defaultData[i].devices) {
+              for (let j = 0; j < this.defaultData[i].devices.length; j++) {
+                this.options[i].children.push({
+                  value: [
+                    this.defaultData[i].devices[j].name,
+                    this.defaultData[i].devices[j].mac,
+                  ],
+                  label: this.defaultData[i].devices[j].name,
+                })
+              }
             }
           }
         })
@@ -274,7 +334,7 @@
         })
     },
     // ������������������
-    getReportForm() {
+    getReportForm () {
       this.$request({
         url: '/dataDisplay/monitorPointDataDisplay',
         method: 'post',

--
Gitblit v1.8.0