From 172d73cbe737c04b3d2c3fe8908db2460c241543 Mon Sep 17 00:00:00 2001
From: zmc <zmc_li@foxmail.com>
Date: 星期一, 14 八月 2023 17:11:48 +0800
Subject: [PATCH] 油烟监测系统 Vue代码

---
 src/sfc/ShopNameAndID.vue |   36 +++++++++++++++++++++++-------------
 1 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/src/sfc/ShopNameAndID.vue b/src/sfc/ShopNameAndID.vue
index 62efda0..e2b164a 100644
--- a/src/sfc/ShopNameAndID.vue
+++ b/src/sfc/ShopNameAndID.vue
@@ -2,17 +2,19 @@
     灏嗛�夋嫨鐨勮澶囩紪鍙疯繑鍥炵粰鐖剁粍浠�
  -->
 <script>
-import axiosInstance from '../utils/request.js'
+import axiosInstanceInstance from '../utils/request.js'
 export default {
   // 榛樿閫夋嫨涓�涓�
-  // props:{
-  //   devId:{
-  //     type: Array,
-  //     default: ['鍏ㄩ儴','鍏ㄩ儴'],
-  //   }
+  props:{
+    devId:{
+      type: Array,
+      default(){
+        return ['鍏ㄩ儴','鍏ㄩ儴']
+      }
+    }
      
-  // }
-  props:['devId'],
+  },
+  // props:['devId'],
   emits: ['submitId'],
   data() {
     return {
@@ -36,7 +38,7 @@
   methods: {
     getDeviceInfo() {
       // 绾ц仈涓嬫媺妗嗘暟鎹� 浠庢帴鍙d腑鍔ㄦ�佽幏鍙�
-        axiosInstance.get('/fume/device').then((result) => {
+        axiosInstanceInstance.get('/fume/device').then((result) => {
           this.deviceInfo = result.data.data;
           this.deviceInfo.forEach((item) => {
             this.optionsShop[this.optionsShop.length] = {
@@ -55,7 +57,15 @@
         
         // 鎵撳紑鏃堕粯璁ゅ睍绀轰竴涓簵閾�
       this.deviceId = this.devId
-    }
+    },
+    changeDev(){
+      if(this.deviceId == null){
+        this.deviceId = ['','']
+        this.$emit('submitId', this.deviceId[1])
+      }else{
+      this.$emit('submitId', this.deviceId[1])
+      }
+    },
   }
 };
 </script>
@@ -67,11 +77,11 @@
         v-model="deviceId"
         :options="optionsShop"
         :props="{ expandTrigger: 'hover' }"
-      
-        @change="$emit('submitId', deviceId[1])"
+        @change="changeDev"
         placeholder="鍏ㄩ儴"
+        clearable
       />
-      <!--   @visible-change="getDeviceInfo" -->
+      <!--   @change="$emit('submitId', deviceId[1])"  @change="changeDev"-->
     </span>
   </div>
 </template>

--
Gitblit v1.9.3