diff --git a/src/views/repair/Components/StaffChoose.vue b/src/views/repair/Components/StaffChoose.vue index d6408ea..25e62e8 100644 --- a/src/views/repair/Components/StaffChoose.vue +++ b/src/views/repair/Components/StaffChoose.vue @@ -1,6 +1,6 @@ @@ -34,6 +34,12 @@ export default { selectLoading: false, } }, + computed: { + selectedStaff() { + const staff = this.staffList.find(item => item.id === this.staffSelected) || null; + return staff; + } + }, watch: { staffSelected(val) { const staff = this.staffList.find(item => item.id === val); @@ -51,9 +57,24 @@ export default { }, mounted() { this.listStaff() - this.getNow() + // 只有在需要自动获取当前用户信息时才调用 getNow() + if (this.isGet && this.isGet !== 'false') { + this.getNow() + } }, methods: { + handleChange(val) { + if (val) { + const staff = this.staffList.find(item => item.id === val); + if (staff) { + this.$emit("input", staff); + this.$emit("input-blur", staff); + } + } else { + this.$emit("input", null); + this.$emit("input-blur", null); + } + }, async listStaff() { this.selectLoading = true try { @@ -64,7 +85,10 @@ export default { const res = await getStaffList(this.query) this.staffList = res.data if (this.query){ - this.staffSelected = this.staffList.filter(item => item.tel === this.query)[0].id + const filtered = this.staffList.filter(item => item.tel === this.query); + if (filtered.length > 0) { + this.staffSelected = filtered[0].id + } this.query = null } } @@ -87,4 +111,4 @@ export default { + \ No newline at end of file diff --git a/src/views/repair/stockOperate/Components/SoIndex.vue b/src/views/repair/stockOperate/Components/SoIndex.vue index c493c62..4c119d2 100644 --- a/src/views/repair/stockOperate/Components/SoIndex.vue +++ b/src/views/repair/stockOperate/Components/SoIndex.vue @@ -18,8 +18,8 @@ - - + + @@ -30,7 +30,7 @@ - + @@ -85,6 +85,7 @@ +