From 35bff42b22d092d164ef4b9db8701f839c57bd9c Mon Sep 17 00:00:00 2001
From: 唐耀东 <18861537@qq.com>
Date: 星期六, 11 六月 2022 11:33:08 +0800
Subject: [PATCH] 提交代码
---
src/views/components/peripheralUnit/index.vue | 24 +++++++++++++++++++-----
1 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/src/views/components/peripheralUnit/index.vue b/src/views/components/peripheralUnit/index.vue
index d4090a5..cd15ffa 100644
--- a/src/views/components/peripheralUnit/index.vue
+++ b/src/views/components/peripheralUnit/index.vue
@@ -1,10 +1,12 @@
<template>
<div>
<el-input placeholder="璇烽�夋嫨" :value="name" disabled>
- <el-button slot="append" icon="el-icon-thumb" @click="handleClick"></el-button>
+ {{ currentId }}
+ <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="澶栬鍗曞厓" :visible.sync="open" width="800px" :append-to-body="true" :destroy-on-close="true">
- <peripheral-unit-list v-if="open" ref="peripheralRef"></peripheral-unit-list>
+ <peripheral-unit-list v-if="open" ref="peripheralRef" @setCurrentRow="getCurrentRow"></peripheral-unit-list>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">纭� 瀹�</el-button>
<el-button @click="open = false">鍙� 娑�</el-button>
@@ -31,14 +33,15 @@
},
props: {
value: {
- type: [Number],
+ type: [Number, String],
default: undefined
}
},
data() {
return {
open: false,
- name: ''
+ name: '',
+ currentId: ''
}
},
watch: {
@@ -46,9 +49,11 @@
if (v) {
getPeripheralUnit(v).then(response => {
this.name = response.data.name;
+ this.currentId = response.data.id;
});
} else {
this.name = '';
+ this.currentId = ''
}
}
},
@@ -56,10 +61,19 @@
if (this.value) {
getPeripheralUnit(this.value).then(response => {
this.name = response.data.name;
+ this.currentId = response.data.id;
});
}
},
methods: {
+ handleClear () {
+ this.currentId = undefined;
+ this.name = undefined;
+ this.$emit("change", undefined);
+ },
+ getCurrentRow (e) {
+ this.currentId = e.id
+ },
handleClick() {
this.open = true;
},
@@ -80,4 +94,4 @@
<style scoped>
-</style>
\ No newline at end of file
+</style>
--
Gitblit v1.9.1