From 19cf5b237b0e2bf489c0fe0f8929bf992fae5f8f Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Mon, 17 Jun 2024 15:48:14 +0800
Subject: [PATCH] fix: bug修改

---
 src/views/Equipment/index.vue |  164 ++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 108 insertions(+), 56 deletions(-)

diff --git a/src/views/Equipment/index.vue b/src/views/Equipment/index.vue
index 913b6ae..cae8f44 100644
--- a/src/views/Equipment/index.vue
+++ b/src/views/Equipment/index.vue
@@ -2,65 +2,92 @@
   <div style="padding: 20px">
     <el-card>
       <div style="display: flex">
-        <div class="timee">
+        <div
+          class="timee"
+          style="margin-top: 0.5rem"
+        >
           {{ time }}
         </div>
-        <div style="margin-left: 1.5rem; margin-top:-1.1rem">
+        <div style="margin-left: 1.5rem">
           <span>���������������:</span>
           <el-cascader
-           v-model="newMac"
+            v-model="newMac"
             :options="options"
             :props="props"
             collapse-tags
             clearable
-            @change="changeYz"
             placeholder="������������"
             style="width: 25rem"
-          ></el-cascader>
+            @change="changeYz"
+          />
         </div>
-        <div style="margin-left: 1.5rem; margin-top: -12px">
+        <div style="margin-left: 1.5rem">
           <span>������������:</span>
           <el-cascader
+            v-model="value"
             :options="newSensor"
             :props="props"
             collapse-tags
             clearable
             @change="res"
-          ></el-cascader>
+          />
         </div>
-        <div style="margin-left: 1.5rem; margin-top: -12px">
-          <el-button type="primary">������</el-button>
+        <div style="margin-left: 1.5rem">
+          <el-button
+            type="primary"
+            @click="Equisel"
+          >
+            ������
+          </el-button>
         </div>
       </div>
     </el-card>
+    <el-table
+      :data="dateList"
+      style="margin-top: 20px"
+      border
+      max-height="800"
+    >
+      <el-table-column
+        v-for="item in columnList"
+        :key="item"
+        :prop="item"
+        :label="item"
+        width="180px"
+      />
+    </el-table>
   </div>
-</template>        
+</template>
 
 <script>
-//���������������������������������������������������������js������������������js���json������������������������������
+// ���������������������������������������������������������js������������������js���json������������������������������
 // ���������import������������������from'������������������';
 
 export default {
-  //import ���������������������������������������������������
+  // import ���������������������������������������������������
   components: {},
   props: {},
-  data() {
-    //������������������
+  data () {
+    // ������������������
     return {
       time: '',
       props: { multiple: true },
       defaultData: [],
       options: [],
-      newSensor:[],
-      newMac:'',
-      newMac1:[]
+      newSensor: [],
+      newMac: '',
+      newMac1: [],
+      value: '',
+      value1: '',
+      columnList: [], // ���������������
+      dateList: [],
     }
   },
   // ������������ ���������data������
   computed: {},
   // ������data������������������
   watch: {
-     newMac(newVal, oldval) {
+    newMac (newVal, oldval) {
       this.newMac1 = []
       for (let i = 0; i < newVal.length; i++) {
         // console.log(newVal[i], 111)
@@ -70,13 +97,33 @@
       this.getSensor()
       console.log(this.newMac1)
     },
-  },
-  //������������
-  methods: {
-    res(res){
-      console.log(res.toString());
+    value (n, o) {
+      this.value1 = []
+      for (let i = 0; i < n.length; i++) {
+        this.value1.push(n[i][0])
+      }
     },
-    getData() {
+  },
+  // ������������ - ��������������������������������� this ���������
+  created () {
+    this.time = this.dateTypeFormat('YYYY-mm-dd HH:MM:SS', new Date())
+    this.getData()
+  },
+  // ������������ - ��������������������������� DOM ���������
+  mounted () {},
+  beforeCreate () {}, // ������������ - ������������
+  beforeMount () {}, // ������������ - ������������
+  beforeUpdate () {}, // ������������ - ������������
+  updated () {}, // ������������ - ������������
+  beforeDestroy () {}, // ������������ - ������������
+  destroyed () {}, // ������������ - ������������
+  activated () {},
+  // ������������
+  methods: {
+    res (res) {
+      console.log(res.toString())
+    },
+    getData () {
       this.$request({
         url: '/monitorPoint/queryMonitorPoints',
         method: 'get',
@@ -92,14 +139,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,
+                })
+              }
             }
           }
         })
@@ -107,11 +156,10 @@
           console.log(error)
         })
     },
-    changeYz(){
-      console.log(11111);
-      this.getSensor();
+    changeYz () {
+      this.getSensor()
     },
-     getSensor() {
+    getSensor () {
       this.$request({
         url: '/deviceInfo/getMacSensors',
         method: 'post',
@@ -120,35 +168,39 @@
         },
       })
         .then((result) => {
-          console.log(result);
+          console.log(result)
           var sensor = result.data
           for (var i in sensor) {
             this.newSensor.push({ value: i, label: sensor[i] })
-            
           }
         })
         .catch((err) => {
           console.log(err)
         })
     },
-  },
-  //������������ - ��������������������������������� this ���������
-  created() {
-    var timer = this.dateTypeFormat('YYYY-mm-dd HH:MM:SS', new Date())
-    this.time = timer
-    this.getData();
-  },
-  //������������ - ��������������������������� DOM ���������
-  mounted() {},
-  beforeCreate() {}, //������������ - ������������
-  beforeMount() {}, //������������ - ������������
-  beforeUpdate() {}, //������������ - ������������
-  updated() {}, //������������ - ������������
-  beforeDestroy() {}, //������������ - ������������
-  destroyed() {}, //������������ - ������������
-  activated() {}, //���������������keep-alive������������������������������������
+    Equisel () {
+      this.$request({
+        url: '',
+        method: 'post',
+        data: {
+          time: this.time,
+          zhan: this.newMac1,
+          sensorCode: this.value1
+        }
+      }).then((res) => {
+        console.log(res)
+        this.tableData = res.data
+        console.log(this.tableData, 'this.tableData')
+        for (let key in this.tableData[0]) {
+          this.columnList.push(key)
+        }
+        for (let item of this.tableData) {
+          this.dateList.push(item)
+        }
+      })
+    }
+  }, // ���������������keep-alive������������������������������������
 }
 </script>
 <style scoped>
-
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.8.0