From 3832a82fb79d4cec4cca5e2854e54953f2095ef8 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 06 九月 2024 16:55:08 +0800
Subject: [PATCH] 1. 添加溯源清单功能 2. 修复切换至走航监测界面后,之前正在加载的历史数据依旧展示至地图的问题 3. 添加折线图下载图片功能; 4. 添加数据导出功能; 5. 添加设备管理功能; 6. 添加数据弹框和溯源清单开关功能; 7. 优化3D里面的颜色展示逻辑,底部颜色由原来的因子最小值颜色改为当前量级的上一个量级对应的颜色

---
 src/components/device/DeviceManage.vue |   59 ++++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 46 insertions(+), 13 deletions(-)

diff --git a/src/components/device/DeviceManage.vue b/src/components/device/DeviceManage.vue
index b892027..889e1b8 100644
--- a/src/components/device/DeviceManage.vue
+++ b/src/components/device/DeviceManage.vue
@@ -1,17 +1,21 @@
 <template>
-  <el-button
+  <!-- <el-button
     type="primary"
     icon="Memo"
     class="el-button-custom p-events-auto"
     @click="dialogVisible = !dialogVisible"
   >
     璁惧绠$悊
-  </el-button>
-  <CardDialog v-model="dialogVisible" title="璧拌埅璁惧绠$悊">
-    <el-row class="mission-table">
+  </el-button> -->
+  <CardDialog
+    :model-value="modelValue"
+    @changed="handleChange"
+    title="璧拌埅璁惧绠$悊"
+  >
+    <el-row class="device-table">
       <el-col :span="20">
         <el-table
-          :data="deviceStore.deviceList"
+          :data="deviceData"
           table-layout="fixed"
           size="small"
           :show-overflow-tooltip="true"
@@ -28,7 +32,14 @@
             align="center"
             width="50"
           />
-          <el-table-column prop="deviceType" label="璁惧绫诲瀷" align="center" />
+          <el-table-column
+            prop="deviceType"
+            label="璁惧绫诲瀷"
+            align="center"
+            width="70"
+            :formatter="deviceFormatter"
+          />
+          <el-table-column prop="deviceName" label="璁惧鍚嶇О" align="center" />
           <el-table-column prop="deviceCode" label="璁惧缂栧彿" align="center" />
           <el-table-column
             prop="createTime"
@@ -36,7 +47,7 @@
             align="center"
             :formatter="timeFormatter"
           />
-          <el-table-column label="绠$悊" width="140" align="center">
+          <el-table-column label="绠$悊" width="70" align="center">
             <template #default="{ row }">
               <el-button
                 type="primary"
@@ -51,7 +62,7 @@
       </el-col>
       <el-col :span="4" class="flex-col">
         <div>
-          <!-- todo 璁惧鍒涘缓 -->
+          <DeviceCreate></DeviceCreate>
         </div>
       </el-col>
     </el-row>
@@ -59,24 +70,27 @@
   <MessageBox
     v-model="msgBoxVisible"
     :on-confirm="onConfirm"
-    title="鍒犻櫎璧拌埅浠诲姟"
-    msg="纭鏄惁鍒犻櫎璇ヨ蛋鑸换鍔�"
+    title="鍒犻櫎璧拌埅璁惧"
+    msg="纭鏄惁鍒犻櫎璇ヨ蛋鑸澶�"
     confirmText="鍒犻櫎"
   ></MessageBox>
 </template>
 <script>
 import moment from 'moment';
-import deviceApi from '@/api/deviceApi';
 import { mapStores } from 'pinia';
 import { useDeviceStore } from '@/stores/device';
 import { useFetchData } from '@/composables/fetchData';
+import { typeName } from '@/constant/device-type';
 
 export default {
   setup() {
     const { loading, fetchData } = useFetchData();
     return { loading, fetchData };
   },
-  props: {},
+  props: {
+    modelValue: Boolean
+  },
+  emits: ['update:modelValue'],
   data() {
     return {
       dialogVisible: false,
@@ -85,18 +99,37 @@
     };
   },
   computed: {
-    ...mapStores(useDeviceStore)
+    ...mapStores(useDeviceStore),
+    deviceData() {
+      return this.deviceStore.getDevice();
+    }
   },
   methods: {
+    handleChange(value) {
+      this.$emit('update:modelValue', value);
+    },
     deleteDevice(row) {
       this.onConfirm = () => {
         this.deviceStore.deleteDevice(row.deviceCode);
       };
       this.msgBoxVisible = true;
     },
+    // eslint-disable-next-line no-unused-vars
+    deviceFormatter(row, col, cellValue, index) {
+      return typeName(cellValue);
+    },
+    // eslint-disable-next-line no-unused-vars
     timeFormatter(row, col, cellValue, index) {
       return moment(cellValue).format('YYYY-MM-DD HH:mm:ss');
     }
   }
 };
 </script>
+<style scoped>
+.flex-col {
+  display: flex;
+  flex-direction: column;
+  gap: 4px;
+  align-items: flex-end;
+}
+</style>

--
Gitblit v1.9.3