From ca2395220a55946c644d06a9c01cdf04108d4e22 Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期四, 03 四月 2025 11:37:37 +0800 Subject: [PATCH] 点检工单,设备搜索保养标准组件 --- src/views/eam/equipment/modules/MaintenanceEquipmentSelect.vue | 51 ++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 38 insertions(+), 13 deletions(-) diff --git a/src/views/eam/equipment/modules/MaintenanceEquipmentSelect.vue b/src/views/eam/equipment/modules/MaintenanceEquipmentSelect.vue index 9d7d80f..896ac55 100644 --- a/src/views/eam/equipment/modules/MaintenanceEquipmentSelect.vue +++ b/src/views/eam/equipment/modules/MaintenanceEquipmentSelect.vue @@ -8,6 +8,7 @@ @search="loadData" :placeholder="placeholder" v-model="selectedAsyncValue" + :maintenanceCategory="maintenanceCategory" style="width: 100%" :filterOption="false" @change="handleAsyncChange" @@ -19,7 +20,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> @@ -32,7 +34,7 @@ name: 'MaintenanceEquipmentSelect', props: { disabled: Boolean, - value: [String, Number], + value: [String, Number, String], placeholder: { type: String, default: '璇烽�夋嫨', @@ -43,6 +45,11 @@ default: 20, required: false }, + maintenanceCategory: { + type: String, + default: '', + required: false + } }, data() { this.loadData = debounce(this.loadData, 800)//娑堟姈 @@ -62,7 +69,7 @@ immediate: true, handler(val) { if (!val) { - this.initDictData(); + this.initDictData() } else { this.initSelectValue() } @@ -71,18 +78,23 @@ }, 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('ssfs', this.selectedAsyncValue) + console.log('ASGasgsgas', this.maintenanceCategory) + console.log('杩欐墠璇锋眰鍚庡彴') + getAction(`/eam/maintenanceStandard/listByUser`, { + id: 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.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,11 +148,13 @@ 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 -- Gitblit v1.9.3