From 34feb4908ec7b7e5b51adf6355603978c67bd3a4 Mon Sep 17 00:00:00 2001 From: cuijian <cuijian@xalxzn.com> Date: 星期四, 05 六月 2025 09:53:14 +0800 Subject: [PATCH] 申请单入库 --- src/views/eam/equipment/modules/MaintenanceEquipmentSelect.vue | 54 ++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 40 insertions(+), 14 deletions(-) diff --git a/src/views/eam/equipment/modules/MaintenanceEquipmentSelect.vue b/src/views/eam/equipment/modules/MaintenanceEquipmentSelect.vue index 9d7d80f..abc6eba 100644 --- a/src/views/eam/equipment/modules/MaintenanceEquipmentSelect.vue +++ b/src/views/eam/equipment/modules/MaintenanceEquipmentSelect.vue @@ -19,7 +19,8 @@ <a-icon type="search" /> </template> <a-spin v-if="loading" slot="notFoundContent" size="small" /> - <a-select-option v-for="d in options" :key="d.value" :value="d.value">{{ d.text }}</a-select-option> + <a-select-option v-for="d in options" :key="d.equipmentId" :value="d.equipmentId">{{ d.equipmentText }} + </a-select-option> </a-select> </template> @@ -43,6 +44,11 @@ default: 20, required: false }, + maintenanceCategory: { + type: String, + default: '', + required: false + } }, data() { this.loadData = debounce(this.loadData, 800)//娑堟姈 @@ -62,7 +68,9 @@ immediate: true, handler(val) { if (!val) { - this.initDictData(); + this.selectedValue = undefined; + this.selectedAsyncValue = undefined; + this.initDictData() } else { this.initSelectValue() } @@ -71,18 +79,22 @@ }, methods: { initSelectValue() { - if(!this.selectedAsyncValue || !this.selectedAsyncValue.key || this.selectedAsyncValue.key!=this.value){ - console.log("杩欐墠璇锋眰鍚庡彴") - getAction(`/eam/maintenanceStandard/listByUser`, { id: this.value }).then(res=>{ - if(res.success){ - if(res.result && res.result.length > 0){ + if (!this.selectedAsyncValue || !this.selectedAsyncValue.key || this.selectedAsyncValue.key != this.value || !this.maintenanceCategory) { + console.log('杩欐墠璇锋眰鍚庡彴') + getAction(`/eam/maintenanceStandard/listByUser`, { + equipmentId: this.value, + maintenanceCategory: this.maintenanceCategory + }).then(res => { + if (res.success) { + if (res.result && res.result.length > 0) { let obj = { - key : this.value, + key: this.value, label: res.result[0].text } - this.selectedAsyncValue = {...obj}; + this.selectedAsyncValue = { ...obj } + this.$emit('autocompleteForm', res.result[0]) } - this.options = res.result; + this.options = res.result } }) } @@ -93,8 +105,14 @@ const currentLoad = this.lastLoad this.options = [] this.loading = true + console.log('ssfs', this.selectedAsyncValue) + console.log('ASGasgsgas', this.maintenanceCategory) // 瀛楀吀code鏍煎紡锛歵able,text,code - getAction(`/eam/maintenanceStandard/listByUser`, { keyword: value, pageSize: this.pageSize }).then(res => { + getAction(`/eam/maintenanceStandard/listByUser`, { + keyword: value, + maintenanceCategory: this.maintenanceCategory, + pageSize: this.pageSize + }).then(res => { this.loading = false if (res.success) { if (currentLoad != this.lastLoad) { @@ -111,8 +129,13 @@ }, initDictData() { //寮傛涓�寮�濮嬩篃鍔犺浇涓�鐐规暟鎹� + console.log('fasfasgasgasgfasg') this.loading = true - getAction(`/eam/maintenanceStandard/listByUser`, { pageSize: this.pageSize, keyword: '' }).then(res => { + getAction(`/eam/maintenanceStandard/listByUser`, { + pageSize: this.pageSize, + keyword: '', + maintenanceCategory: this.maintenanceCategory + }).then(res => { this.loading = false if (res.success) { this.options = [...res.result] @@ -125,17 +148,20 @@ return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 }, handleAsyncChange(selectedObj) { + console.log('selectedObj', selectedObj) //update-begin-author:scott date:20201222 for:銆愭悳绱€�戞悳绱㈡煡璇㈢粍浠讹紝鍒犻櫎鏉′欢锛岄粯璁や笅鎷夎繕鏄笂娆$殑缂撳瓨鏁版嵁锛屼笉濂� JT-191 if (selectedObj) { this.selectedAsyncValue = selectedObj //update-begin---author:wangshuai ---date:20221115 for锛歔issues/4213]JSearchSelectTag鏀归�犳敮鎸佸閫�------------ this.selectedValue = selectedObj.key + this.$emit('autocompleteForm', this.options.find(item => item.equipmentId === selectedObj.key)) //update-end---author:wangshuai ---date:20221115 for锛歔issues/4213]JSearchSelectTag鏀归�犳敮鎸佸閫�------------ } else { - this.selectedAsyncValue = null + this.selectedAsyncValue = undefined this.selectedValue = null - this.options = null + this.options = [] this.loadData('') + this.$emit('autocompleteForm', {}) } this.callback() //update-end-author:scott date:20201222 for:銆愭悳绱€�戞悳绱㈡煡璇㈢粍浠讹紝鍒犻櫎鏉′欢锛岄粯璁や笅鎷夎繕鏄笂娆$殑缂撳瓨鏁版嵁锛屼笉濂� JT-191 -- Gitblit v1.9.3