From 02349238af964e19a46da93e20466a48d755a453 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期一, 02 九月 2024 17:38:04 +0800
Subject: [PATCH] 正在实现设备管理模块

---
 src/components/search/OptionDevice.vue |   21 ++++++++-------------
 1 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/src/components/search/OptionDevice.vue b/src/components/search/OptionDevice.vue
index d63fe7c..2ba1468 100644
--- a/src/components/search/OptionDevice.vue
+++ b/src/components/search/OptionDevice.vue
@@ -2,13 +2,13 @@
   <el-form-item label="璁惧">
     <el-select
       :model-value="modelValue"
-      @change="handleChange"
+      @update:model-value="handleChange"
       placeholder="璁惧"
       size="small"
       class="w-120"
     >
       <el-option
-        v-for="(s, i) in deviceList"
+        v-for="(s, i) in deviceOptions"
         :key="i"
         :label="s.label"
         :value="s.value"
@@ -18,6 +18,8 @@
 </template>
 
 <script>
+import { deviceList } from '@/constant/device-type';
+
 export default {
   props: {
     type: String,
@@ -28,19 +30,12 @@
     return {};
   },
   computed: {
-    deviceList() {
-      const t = this.type ? this.type : '0a';
-      return [1, 2, 3].map((v) => {
-        const text = `${t}000000000${v}`;
-        return {
-          label: text,
-          value: text
-        };
-      });
+    deviceOptions() {
+      return deviceList(this.type);
     }
   },
   watch: {
-    deviceList(nV, oV) {
+    deviceOptions(nV, oV) {
       if (nV != oV) {
         this.handleChange(nV[0].value);
       }
@@ -52,7 +47,7 @@
     }
   },
   mounted() {
-    this.handleChange(this.deviceList[0].value);
+    this.handleChange(this.deviceOptions[0].value);
   }
 };
 </script>

--
Gitblit v1.9.3