From e0e111d15a3f3995799b8b480c162c619ec897aa Mon Sep 17 00:00:00 2001 From: hyingbo <1363390067@qq.com> Date: 星期五, 12 九月 2025 17:15:38 +0800 Subject: [PATCH] 大修项修现场问题处理 --- src/views/eam/repair/modules/EamMajorPartialRepairForm.vue | 70 ++++++++++++++++++++++++++++++++-- 1 files changed, 65 insertions(+), 5 deletions(-) diff --git a/src/views/eam/repair/modules/EamMajorPartialRepairForm.vue b/src/views/eam/repair/modules/EamMajorPartialRepairForm.vue index 9a95c52..c125a99 100644 --- a/src/views/eam/repair/modules/EamMajorPartialRepairForm.vue +++ b/src/views/eam/repair/modules/EamMajorPartialRepairForm.vue @@ -28,18 +28,19 @@ </a-col> <a-col :span="8"> <a-form-model-item label="鐢宠浜�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="applicant"> - <j-search-select-tag placeholder="璇烽�夋嫨鐢宠浜�" v-model="model.applicant" dict="sys_user,realname, username, del_flag=0 and status=1"/> + <j-search-select-tag disabled placeholder="璇烽�夋嫨鐢宠浜�" v-model="model.applicant" dict="sys_user,realname, username, del_flag=0 and status=1"/> </a-form-model-item> </a-col> <a-col :span="8"> <a-form-model-item label="鐢宠杞﹂棿" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="applicantProduction"> <a-tree-select v-model="model.applicantProduction" style="width: 100%" - :tree-data="treeData" + :tree-data="treeDataAlias" :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }" placeholder="璇烽�夋嫨鐢宠杞﹂棿" allow-clear tree-default-expand-all + @change="handleWorkShopChange" > </a-tree-select> </a-form-model-item> @@ -74,7 +75,7 @@ <a-input v-model="model.applicantReason" placeholder="璇疯緭鍏ョ敵璇峰師鍥�" ></a-input> </a-form-model-item> </a-col> - <a-col :span="8"> + <a-col :span="8" v-if="disabled"> <a-form-model-item label="璐d换浜�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="responsiblePerson"> <j-search-select-tag placeholder="璇烽�夋嫨璐d换浜�" v-model="model.responsiblePerson" dict="sys_user,realname, username, del_flag=0 and status=1"/> </a-form-model-item> @@ -120,6 +121,8 @@ import { getAction, httpAction } from '@/api/manage' import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js' import { JVXETypes } from '@/components/jeecg/JVxeTable' +import Vue from 'vue' +import { USER_INFO } from '@/store/mutation-types' export default { name: 'EamMajorPartialRepairForm', @@ -137,6 +140,7 @@ data () { return { model: {}, + treeDataAlias: [], labelCol: { xs: { span: 24 }, sm: { span: 7 }, @@ -154,7 +158,7 @@ planStartDate: { required: true, message: '璇烽�夋嫨璁″垝寮�濮嬫棩鏈�!' }, planEndDate: { required: true, message: '璇烽�夋嫨璁″垝缁撴潫鏃ユ湡!' }, applicantReason: { required: true, message: '璇疯緭鍏ョ敵璇峰師鍥�!' }, - responsiblePerson: { required: true, message: '璇疯緭鍏ヨ矗浠讳汉!' }, + // responsiblePerson: { required: true, message: '璇疯緭鍏ヨ矗浠讳汉!' }, faultDescription: { required: true, message: '璇疯緭鍏ユ晠闅滄弿杩�!' } }, treeData: [], @@ -169,6 +173,7 @@ queryById: "/eam/eamMajorPartialRepair/queryById", queryDetailList: "/eam/eamMajorPartialRepairDetail/list", queryEquipmentList: "/eam/equipment/asyncLoadEquipment", + queryEquipmentByProductionList: "/eam/equipment/asyncLoadEquipmentByProduction", loadWorkShopOptions:'/mdc/mdcProduction/loadProductionTreeOptions' } } @@ -233,16 +238,71 @@ getAction(this.url.loadWorkShopOptions).then(res => { if (res.success) { this.treeData = [...res.result] + this.treeDataAlias = this.deepCopyAndModify(res.result) }else { that.$message.warning(res.message) } }) }, + handleWorkShopChange(productionId) { + this.detail.dataSource = [] + if (productionId) { + this.getEquipmentList(productionId); + } else { + this.equipmentOptions = []; + } + }, + getEquipmentList(productionId) { + //鍔犺浇杞﹂棿閫夋嫨鏍� + getAction(this.url.queryEquipmentByProductionList, {productionId: productionId}).then((res) => { + if (res.success) { + this.equipmentOptions = res.result.map(item => { + return { + label: item.text, + value: item.value + } + }) + } + }) + }, + deepCopyAndModify(arr) { + // 濡傛灉褰撳墠鍏冪礌涓嶆槸鏁扮粍鎴栧璞★紝鐩存帴杩斿洖 + if (!Array.isArray(arr) && typeof arr !== 'object' || arr === null || arr.length === 0) { + return arr; + } + + // 濡傛灉鏄暟缁勶紝鍒涘缓涓�涓柊鏁扮粍骞堕�掑綊澶勭悊姣忎釜鍏冪礌 + if (Array.isArray(arr)) { + const newArray = []; + for (let i = 0; i < arr.length; i++) { + newArray.push(this.deepCopyAndModify(arr[i])); + } + return newArray; + } + + // 濡傛灉鏄璞★紝鍒涘缓涓�涓柊瀵硅薄骞堕�掑綊澶勭悊姣忎釜灞炴�� + const newObj = {}; + for (const key in arr) { + if (arr.hasOwnProperty(key)) { + if(key === 'selectable') { + newObj[key] = true; + } else if(key === 'children') { + newObj[key] = this.deepCopyAndModify(arr[key]); + }else { + newObj[key] = arr[key]; + } + } + } + return newObj; + }, add () { this.edit(this.modelDefault) }, edit (record) { - this.model = Object.assign({}, record); + this.model = Object.assign({ + applicant: Vue.ls.get(USER_INFO).username + }, record); + console.log("this.model", this.model) this.visible = true if (this.model.id) { getAction(this.url.queryDetailList, { repairId: this.model.id }).then((res) => { -- Gitblit v1.9.3