From 0d68be1fa109b0f55fa0b4c023baf4b66dcc9f28 Mon Sep 17 00:00:00 2001
From: liuchengxin <13104445455@163.com>
Date: 星期四, 09 六月 2022 14:06:39 +0800
Subject: [PATCH] BUG修改

---
 src/views/components/nvr/index.vue |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/src/views/components/nvr/index.vue b/src/views/components/nvr/index.vue
index 33e1b60..c404908 100644
--- a/src/views/components/nvr/index.vue
+++ b/src/views/components/nvr/index.vue
@@ -1,10 +1,11 @@
 <template>
   <div>
     <el-input placeholder="璇烽�夋嫨" :value="name" disabled>
-      <el-button slot="append" icon="el-icon-thumb" @click="handleClick"></el-button>
+      <el-button slot="append" v-if="currentId" icon="el-icon-circle-close" @click="handleClear"></el-button>
+      <el-button slot="append" v-else icon="el-icon-thumb" @click="handleClick"></el-button>
     </el-input>
-    <el-dialog title="NVR" :visible.sync="open" width="800px" :append-to-body="true" :destroy-on-close="true">
-      <nvr-list v-if="open" ref="nvrRef" :schoolId="schoolId"></nvr-list>
+    <el-dialog title="闅跺睘NVR" :visible.sync="open" width="800px" :append-to-body="true" :destroy-on-close="true">
+      <nvr-list v-if="open" ref="nvrRef" :schoolId="schoolId" @setCurrentRow="getCurrentRow"></nvr-list>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">纭� 瀹�</el-button>
         <el-button @click="open = false">鍙� 娑�</el-button>
@@ -42,7 +43,8 @@
   data() {
     return {
       open: false,
-      name: ''
+      name: '',
+      currentId: ''
     }
   },
   watch: {
@@ -50,6 +52,7 @@
       if (v) {
         getNvr(v).then(response => {
           this.name = response.data.deploymentName;
+          this.currentId = response.data.id
         });
       }else {
         this.name = '';
@@ -60,10 +63,20 @@
     if (this.value) {
       getNvr(this.value).then(response => {
         this.name = response.data.deploymentName;
+        this.currentId = response.data.id;
       });
     }
   },
   methods: {
+    handleClear () {
+      this.currentId = '';
+      this.name = undefined;
+      this.$emit("change", '');
+      this.$emit('nvrIdChange')
+    },
+    getCurrentRow (e) {
+      this.currentId = e.id
+    },
     handleClick() {
       this.open = true;
     },
@@ -84,4 +97,4 @@
 
 <style scoped>
 
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.9.1