From 8e51c6b4e295d9ab188fb9346bec0297205ad9d0 Mon Sep 17 00:00:00 2001
From: yichenxi <yichenxi0601@163.com>
Date: Thu, 05 Jan 2023 15:19:38 +0800
Subject: [PATCH] 1、设备数据导出页面完成 2、列表数据导出页面完成

---
 src/views/Equipment/index.vue |   67 +++++++++++++++++++++++++++------
 1 files changed, 55 insertions(+), 12 deletions(-)

diff --git a/src/views/Equipment/index.vue b/src/views/Equipment/index.vue
index 913b6ae..38375cb 100644
--- a/src/views/Equipment/index.vue
+++ b/src/views/Equipment/index.vue
@@ -2,13 +2,13 @@
   <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
@@ -18,9 +18,10 @@
             style="width: 25rem"
           ></el-cascader>
         </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
@@ -28,11 +29,26 @@
             @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"
+        :prop="item"
+        :label="item"
+        width="180px"
+        :key="item"
+      >
+      </el-table-column>
+    </el-table>
   </div>
 </template>        
 
@@ -53,7 +69,11 @@
       options: [],
       newSensor:[],
       newMac:'',
-      newMac1:[]
+      newMac1:[],
+      value:'',
+      value1:'',
+      columnList: [], //���������������
+      dateList: [],
     }
   },
   // ������������ ���������data������
@@ -69,6 +89,12 @@
       // ������������������������������������������
       this.getSensor()
       console.log(this.newMac1)
+    },
+     value(n, o) {
+      this.value1 = []
+      for (let i = 0; i < n.length; i++) {
+        this.value1.push(n[i][0])
+      }
     },
   },
   //������������
@@ -108,7 +134,6 @@
         })
     },
     changeYz(){
-      console.log(11111);
       this.getSensor();
     },
      getSensor() {
@@ -124,18 +149,37 @@
           var sensor = result.data
           for (var i in sensor) {
             this.newSensor.push({ value: i, label: sensor[i] })
-            
           }
         })
         .catch((err) => {
           console.log(err)
         })
     },
+    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)
+        }
+      })
+    }
   },
   //������������ - ��������������������������������� this ���������
   created() {
-    var timer = this.dateTypeFormat('YYYY-mm-dd HH:MM:SS', new Date())
-    this.time = timer
+    this.time = this.dateTypeFormat('YYYY-mm-dd HH:MM:SS', new Date())
     this.getData();
   },
   //������������ - ��������������������������� DOM ���������
@@ -150,5 +194,4 @@
 }
 </script>
 <style scoped>
-
 </style>
\ No newline at end of file

--
Gitblit v1.8.0