From 86c49515065de7729e5b2aa17f1e260d3c4f3669 Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期四, 03 四月 2025 17:08:39 +0800 Subject: [PATCH] art: 设备管理-周保-基础代码提交 --- src/views/eam/equipment/modules/MaintenanceEquipmentSelect.vue | 55 +++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 41 insertions(+), 14 deletions(-) diff --git a/src/views/eam/equipment/modules/MaintenanceEquipmentSelect.vue b/src/views/eam/equipment/modules/MaintenanceEquipmentSelect.vue index 9d7d80f..55c9a6a 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,24 @@ }, 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.$emit('autocompleteForm', res.result[0]) } - this.options = res.result; + this.options = res.result } }) } @@ -93,8 +106,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 +130,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 +149,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.loadData('') + this.$emit('autocompleteForm', {}) } this.callback() //update-end-author:scott date:20201222 for:銆愭悳绱€�戞悳绱㈡煡璇㈢粍浠讹紝鍒犻櫎鏉′欢锛岄粯璁や笅鎷夎繕鏄笂娆$殑缂撳瓨鏁版嵁锛屼笉濂� JT-191 -- Gitblit v1.9.3