From c2e8ebad0a7f8b505fe0f34a8e798c1978a4fd96 Mon Sep 17 00:00:00 2001 From: zhaowei <zhaowei> Date: 星期二, 15 七月 2025 15:25:27 +0800 Subject: [PATCH] 调整代码 --- src/views/eam/equipment/modules/EamEquipmentModal.vue | 198 ++++++++++++++++++++++++++++--------------------- 1 files changed, 114 insertions(+), 84 deletions(-) diff --git a/src/views/eam/equipment/modules/EamEquipmentModal.vue b/src/views/eam/equipment/modules/EamEquipmentModal.vue index 0d8a601..6609f5a 100644 --- a/src/views/eam/equipment/modules/EamEquipmentModal.vue +++ b/src/views/eam/equipment/modules/EamEquipmentModal.vue @@ -24,7 +24,7 @@ </a-col> <a-col :span="customSpan"> <a-form-model-item prop="equipmentCode" label="缁熶竴缂栫爜"> - <a-input placeholder="璇疯緭鍏ョ粺涓�缂栫爜" v-model="model.equipmentCode"/> + <a-input placeholder="璇疯緭鍏ョ粺涓�缂栫爜" v-model="model.equipmentCode" :disabled="!editable"/> </a-form-model-item> </a-col> <a-col :span="customSpan"> @@ -33,21 +33,26 @@ </a-form-model-item> </a-col> <a-col :span="customSpan"> - <a-form-model-item prop="factoryOrgCode" label="浣跨敤閮ㄩ棬"> - <a-tree-select v-model="model.factoryOrgCode" style="width: 100%" show-search - :tree-data="productionTreeData" - :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }" - placeholder="璇烽�夋嫨浣跨敤閮ㄩ棬" allow-clear treeNodeFilterProp="title" - :replaceFields="{key:'orgCode',value:'orgCode'}" - searchPlaceholder="璇疯緭鍏ュ叧閿瓧鎼滅储" tree-default-expand-all/> + <a-form-model-item label="鍨嬪彿"> + <a-input placeholder="璇疯緭鍏ュ瀷鍙�" v-model="model.equipmentModel"/> </a-form-model-item> </a-col> </a-row> <a-row> <a-col :span="customSpan"> + <a-form-model-item prop="factoryOrgCode" label="浣跨敤閮ㄩ棬"> + <a-tree-select v-model="model.factoryOrgCode" style="width: 100%" show-search + :tree-data="productionTreeData" :disabled="!editable" + :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }" + placeholder="璇烽�夋嫨浣跨敤閮ㄩ棬" allow-clear treeNodeFilterProp="title" + :replaceFields="{key:'orgCode',value:'orgCode'}" + searchPlaceholder="璇疯緭鍏ュ叧閿瓧鎼滅储" tree-default-expand-all/> + </a-form-model-item> + </a-col> + <a-col :span="customSpan"> <a-form-model-item prop="equipmentCategory" label="鎵�灞炲垎绫�"> - <j-dict-select-tag dict-code="equipment_category" placeholder="璇烽�夋嫨鎵�灞炲垎绫�" + <j-dict-select-tag dict-code="equipment_category" placeholder="璇烽�夋嫨鎵�灞炲垎绫�" :disabled="!editable" v-model="model.equipmentCategory"/> </a-form-model-item> </a-col> @@ -58,17 +63,21 @@ </a-col> <a-col :span="customSpan"> <a-form-model-item prop="repairDepartOrgCode" label="缁翠慨鐝粍"> - <a-input placeholder="璇烽�夋嫨缁翠慨鐝粍" v-model="model.repairDepartOrgCode"/> - </a-form-model-item> - </a-col> - <a-col :span="customSpan"> - <a-form-model-item label="瀹夊叏閰嶇疆"> - <a-input placeholder="璇疯緭鍏ュ畨鍏ㄩ厤缃�" v-model="model.securityConfiguration"/> + <a-tree-select v-model="model.repairDepartOrgCode" style="width: 100%" + show-search :tree-data="repairDepartTreeData" treeNodeFilterProp="title" + :replaceFields="{key:'orgCode',value:'orgCode'}" searchPlaceholder="璇疯緭鍏ュ叧閿瓧鎼滅储" + :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }" placeholder="璇烽�夋嫨缁翠慨鐝粍" + allow-clear tree-default-expand-all/> </a-form-model-item> </a-col> </a-row> <a-row> + <a-col :span="customSpan"> + <a-form-model-item label="瀹夊叏閰嶇疆"> + <a-input placeholder="璇疯緭鍏ュ畨鍏ㄩ厤缃�" v-model="model.securityConfiguration"/> + </a-form-model-item> + </a-col> <a-col :span="customSpan"> <a-form-model-item label="鍐峰嵈绯荤粺"> <j-dict-select-tag dict-code="cooling_system" placeholder="璇烽�夋嫨鍐峰嵈绯荤粺" v-model="model.coolSystem"/> @@ -76,7 +85,8 @@ </a-col> <a-col :span="customSpan"> <a-form-model-item label="鐏伀鍣�"> - <j-dict-select-tag dict-code="yn" type="radio" v-model="model.fireExtinguisher"/> + <j-dict-select-tag dict-code="yn" type="radio" v-model="model.fireExtinguisher" + @change="handleRadioChange($event,'fireExtinguisherExpirationDate')"/> </a-form-model-item> </a-col> <a-col :span="customSpan"> @@ -85,17 +95,24 @@ v-model="model.fireExtinguisherExpirationDate" placeholder="璇疯緭鍏ョ伃鐏櫒鏈夋晥鏈�"/> </a-form-model-item> </a-col> - <a-col :span="customSpan"> - <a-form-model-item label="鎿嶄綔绯荤粺"> - <j-dict-select-tag dict-code="yn " type="radio" v-model="model.operationSystem"/> - </a-form-model-item> - </a-col> + </a-row> <a-row> <a-col :span="customSpan"> + <a-form-model-item label="鎿嶄綔绯荤粺"> + <j-dict-select-tag dict-code="yn " type="radio" v-model="model.operationSystem" + @change="handleRadioChange($event,'system')"/> + </a-form-model-item> + </a-col> + <a-col :span="customSpan"> <a-form-model-item label="绯荤粺"> - <a-input placeholder="璇疯緭鍏ョ郴缁�" :disabled="Boolean(+model.operationSystem)" v-model="model.system"/> + <a-input placeholder="璇疯緭鍏ョ郴缁�" :disabled="!Boolean(+model.operationSystem)" v-model="model.system"/> + </a-form-model-item> + </a-col> + <a-col :span="customSpan"> + <a-form-model-item label="鐪熺┖鐑鐞嗙倝"> + <j-dict-select-tag dict-code="yn " type="radio" v-model="model.trueHeatTreatment"/> </a-form-model-item> </a-col> <a-col :span="customSpan"> @@ -103,6 +120,9 @@ <a-input placeholder="璇疯緭鍏ヨ澶囩鍙�" v-model="model.equipmentPort"/> </a-form-model-item> </a-col> + </a-row> + + <a-row> <a-col :span="customSpan"> <a-form-model-item label="鍧愭爣鏁伴噺"> <a-input-number placeholder="璇疯緭鍏ュ潗鏍囨暟閲�" v-model="model.coordinateNum" :min="0" :max="12" @@ -114,9 +134,6 @@ <a-input-number placeholder="璇疯緭鍏ラ噸閲�" v-model="model.equipmentWeight" :min="0" style="width: 100%"/> </a-form-model-item> </a-col> - </a-row> - - <a-row> <a-col :span="customSpan"> <a-form-model-item label="閲嶉噺璁¢噺鍗曚綅"> <a-input placeholder="璇疯緭鍏ラ噸閲忚閲忓崟浣�" v-model="model.weightUnit"/> @@ -127,6 +144,10 @@ <a-input placeholder="璇疯緭鍏ュ姛鑳戒綅缃�" v-model="model.functionalLocation"/> </a-form-model-item> </a-col> + + </a-row> + + <a-row> <a-col :span="customSpan"> <a-form-model-item label="瀹夎浣嶇疆"> <a-input placeholder="璇疯緭鍏ュ畨瑁呬綅缃�" v-model="model.installationPosition"/> @@ -137,9 +158,6 @@ <a-date-picker v-model="model.leaveFactoryDate" value-format="YYYY-MM-DD" style="width:100%"/> </a-form-model-item> </a-col> - </a-row> - - <a-row> <a-col :span="customSpan"> <a-form-model-item label="绔嬮」鍗″彿"> <a-input placeholder="璇疯緭鍏ョ珛椤瑰崱鍙�" v-model="model.cardNumber"/> @@ -150,6 +168,10 @@ <a-input placeholder="璇疯緭鍏ヨ祫閲戞潵婧�" v-model="model.fundingSource"/> </a-form-model-item> </a-col> + + </a-row> + + <a-row> <a-col :span="customSpan"> <a-form-model-item label="楠屾敹鏃ユ湡"> <a-date-picker v-model="model.acceptanceCheckDate" value-format="YYYY-MM-DD" style="width:100%"/> @@ -160,9 +182,6 @@ <a-input placeholder="璇疯緭鍏ュ嚭鍘傜紪鍙�" v-model="model.factoryNumber"/> </a-form-model-item> </a-col> - </a-row> - - <a-row> <a-col :span="customSpan"> <a-form-model-item label="璧勪骇鍒堕�犲晢"> <a-input placeholder="璇疯緭鍏ヨ祫浜у埗閫犲晢" v-model="model.manufacturingEnterprise"/> @@ -173,19 +192,15 @@ <a-input placeholder="璇疯緭鍏ヨ祫浜ф潵婧愬浗瀹�" v-model="model.originCountry"/> </a-form-model-item> </a-col> - <a-col :span="customSpan"> - <a-form-model-item label="鍨嬪彿"> - <a-input placeholder="璇疯緭鍏ュ瀷鍙�" v-model="model.equipmentModel"/> - </a-form-model-item> - </a-col> + + </a-row> + + <a-row> <a-col :span="customSpan"> <a-form-model-item label="璁惧瑙勬牸"> <a-input placeholder="璇疯緭鍏ヨ澶囪鏍�" v-model="model.equipmentSpecification"/> </a-form-model-item> </a-col> - </a-row> - - <a-row> <a-col :span="customSpan"> <a-form-model-item label="鎬诲姛鐜�(KW)"> <a-input-number placeholder="璇疯緭鍏ユ�诲姛鐜�(KW)" v-model="model.equipmentPower" :min="0" @@ -202,17 +217,19 @@ <a-date-picker v-model="model.warrantyEndDate" value-format="YYYY-MM-DD" style="width:100%"/> </a-form-model-item> </a-col> + + </a-row> + + <a-row> <a-col :span="customSpan"> <a-form-model-item label="璧勪骇鐘舵��"> <j-dict-select-tag dict-code="asset_status" placeholder="璇烽�夋嫨璧勪骇鐘舵��" v-model="model.assetStatus"/> </a-form-model-item> </a-col> - </a-row> - - <a-row> <a-col :span="customSpan"> <a-form-model-item label="鏈涓変繚鏃ユ湡"> - <a-date-picker v-model="model.latestThirdMaintenance" value-format="YYYY-MM-DD" style="width:100%"/> + <a-date-picker v-model="model.latestThirdMaintenance" value-format="YYYY-MM-DD" + :disabled="!editable" style="width:100%"/> </a-form-model-item> </a-col> <a-col :span="customSpan"> @@ -221,27 +238,35 @@ </a-form-model-item> </a-col> <a-col :span="customSpan"> - <a-form-model-item label="涓変繚鍛ㄦ湡"> - <a-input-number placeholder="璇疯緭鍏ヤ笁淇濆懆鏈�" v-model="model.thirdMaintenancePeriod" :min="0" + <a-form-model-item label="涓変繚鍛ㄦ湡锛堝勾锛�"> + <a-input-number placeholder="璇疯緭鍏ヤ笁淇濆懆鏈燂紙骞达級" v-model="model.thirdMaintenancePeriod" :min="1" style="width: 100%"/> + </a-form-model-item> + </a-col> + + </a-row> + + <a-row> + <a-col :span="customSpan"> + <a-form-model-item label="鎶�鏈姸鎬�"> + <j-dict-select-tag placeholder="璇烽�夋嫨鎶�鏈姸鎬�" dict-code="equipment_technology_status" + v-model="model.technologyStatus"/> </a-form-model-item> </a-col> <a-col :span="customSpan"> <a-form-model-item label="鏈鎶�鏈壌瀹氭棩鏈�"> - <a-date-picker v-model="model.latestTechnologyCheck" value-format="YYYY-MM-DD" style="width:100%"/> + <a-date-picker v-model="model.latestTechnologyCheck" value-format="YYYY-MM-DD" + :disabled="!editable" style="width:100%"/> </a-form-model-item> </a-col> - </a-row> - - <a-row> <a-col :span="customSpan"> <a-form-model-item label="涓嬫鎶�鏈壌瀹氭棩鏈�"> <a-date-picker v-model="model.nextTechnologyCheck" value-format="YYYY-MM-DD" style="width:100%"/> </a-form-model-item> </a-col> <a-col :span="customSpan"> - <a-form-model-item label="鎶�鏈壌瀹氬懆鏈�"> - <a-input-number placeholder="璇疯緭鍏ユ妧鏈壌瀹氬懆鏈�" v-model="model.technologyCheckPeriod" :min="0" + <a-form-model-item label="鎶�鏈壌瀹氬懆鏈燂紙骞达級"> + <a-input-number placeholder="璇疯緭鍏ユ妧鏈壌瀹氬懆鏈燂紙骞达級" v-model="model.technologyCheckPeriod" :min="1" style="width: 100%"/> </a-form-model-item> </a-col> @@ -269,13 +294,6 @@ <a-tab-pane tab="淇濆吇鏍囧噯" :key="7"> </a-tab-pane> - - <a-tab-pane tab="宸ヨ壓鍙傛暟" :key="8"> - </a-tab-pane> - - <a-tab-pane tab="璁惧绮惧害" :key="9"> - - </a-tab-pane> </template> </a-tabs> </j-modal> @@ -289,6 +307,9 @@ name: 'EamEquipmentModal', props: { productionTreeData: { + type: Array + }, + repairDepartTreeData: { type: Array } }, @@ -343,24 +364,31 @@ } } }, - created() { - this.loadAllProductionTree() - }, methods: { add() { - this.editable = false + this.editable = true //鍒濆鍖栭粯璁ゅ�� this.model = { operationSystem: 1, - fireExtinguisher: 0 + fireExtinguisher: 0, + trueHeatTreatment: 0 } this.visible = true }, edit(record) { - this.editable = true + this.editable = false this.model = Object.assign({}, record) this.visible = true + }, + + /**\ + * 鍗曢�夋鍊煎彂鐢熸敼鍙樻椂瑙﹀彂 + * @param value 鍗曢�夋鍊� + * @param key 鍗曢�夋鍏宠仈瀛楁 + */ + handleRadioChange(value, key) { + if (value == '0') delete this.model[key] }, handleOk() { @@ -369,32 +397,34 @@ this.$refs.form.validate(valid => { if (valid) { that.confirmLoading = true - let httpurl = '' + let httpUrl = '' let method = '' if (!this.model.id) { - httpurl += this.url.add + httpUrl += this.url.add method = 'post' } else { - httpurl += this.url.edit + httpUrl += this.url.edit method = 'put' } - httpAction(httpurl, this.model, method).then((res) => { - if (res.success) { - that.$notification.success({ - message: '娑堟伅', - description: res.message - }) - that.$emit('ok') - that.close() - } else { - that.$notification.warning({ - message: '娑堟伅', - description: res.message - }) - } - }).finally(() => { - that.confirmLoading = false - }) + httpAction(httpUrl, this.model, method) + .then((res) => { + if (res.success) { + that.$notification.success({ + message: '娑堟伅', + description: res.message + }) + that.$emit('ok') + that.close() + } else { + that.$notification.warning({ + message: '娑堟伅', + description: res.message + }) + } + }) + .finally(() => { + that.confirmLoading = false + }) } else { return false } -- Gitblit v1.9.3