From a22a69946912221dab4d32987dda6c4c8ba3c5d8 Mon Sep 17 00:00:00 2001 From: cuilei <ray_tsu1@163.com> Date: 星期二, 24 六月 2025 17:43:24 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/views/eam/repair/modules/EamMajorPartialRepairForm.vue | 306 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 306 insertions(+), 0 deletions(-) diff --git a/src/views/eam/repair/modules/EamMajorPartialRepairForm.vue b/src/views/eam/repair/modules/EamMajorPartialRepairForm.vue new file mode 100644 index 0000000..9a95c52 --- /dev/null +++ b/src/views/eam/repair/modules/EamMajorPartialRepairForm.vue @@ -0,0 +1,306 @@ +<template> + <a-spin :spinning="confirmLoading"> + <j-form-container :disabled="formDisabled"> + <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> + <a-row> + <a-col :span="8"> + <a-form-model-item label="缁翠慨缂栫爜" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairCode"> + <a-input v-model="model.repairCode" placeholder="绯荤粺鑷姩鐢熸垚" disabled ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="8"> + <a-form-model-item label="椤圭洰鍚嶇О" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairName"> + <a-input v-model="model.repairName" placeholder="璇疯緭鍏ラ」鐩悕绉�" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="8" v-if="disabled"> + <a-form-model-item label="缁翠慨鐘舵��" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairStatus"> + <j-dict-select-tag placeholder="璇烽�夋嫨缁翠慨鐘舵��" v-model="model.repairStatus" dictCode="major_partial_repair_status" disabled/> + </a-form-model-item> + </a-col> + <a-col :span="8"> + <a-form-model-item label="缁翠慨绫诲瀷" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairType"> + <a-select v-model="model.repairType" placeholder="璇烽�夋嫨缁翠慨绫诲瀷"> + <a-select-option value="澶т慨">澶т慨</a-select-option> + <a-select-option value="椤逛慨">椤逛慨</a-select-option> + </a-select> + </a-form-model-item> + </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"/> + </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" + :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }" + placeholder="璇烽�夋嫨鐢宠杞﹂棿" + allow-clear + tree-default-expand-all + > + </a-tree-select> + </a-form-model-item> + </a-col> + <a-col :span="8"> + <a-form-model-item label="璁″垝寮�濮嬫棩鏈�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="planStartDate"> + <j-date placeholder="璇烽�夋嫨璁″垝寮�濮嬫棩鏈�" v-model="model.planStartDate" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="8"> + <a-form-model-item label="璁″垝缁撴潫鏃ユ湡" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="planEndDate"> + <j-date placeholder="璇烽�夋嫨璁″垝缁撴潫鏃ユ湡" v-model="model.planEndDate" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="8" v-if="disabled"> + <a-form-model-item label="瀹為檯寮�濮嬫椂闂�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="actualStartTime"> + <j-date :show-time="true" dateFormat="YYYY-MM-DD HH" placeholder="璇烽�夋嫨瀹為檯寮�濮嬫椂闂�" v-model="model.actualStartTime" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="8" v-if="disabled"> + <a-form-model-item label="瀹為檯缁撴潫鏃堕棿" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="actualEndTime"> + <j-date :show-time="true" dateFormat="YYYY-MM-DD HH" placeholder="璇烽�夋嫨瀹為檯缁撴潫鏃堕棿" v-model="model.actualEndTime" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="8" v-if="disabled"> + <a-form-model-item label="鎬婚噾棰�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="totalAmount"> + <a-input-number :min=0 :precision="2" v-model="model.totalAmount" placeholder="璇疯緭鍏ユ�婚噾棰�" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="8"> + <a-form-model-item label="鐢宠鍘熷洜" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="applicantReason"> + <a-input v-model="model.applicantReason" placeholder="璇疯緭鍏ョ敵璇峰師鍥�" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="8"> + <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> + </a-col> + <a-col :span="8"> + <a-form-model-item label="鏁呴殰鎻忚堪" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="faultDescription"> + <a-textarea v-model="model.faultDescription" placeholder="璇疯緭鍏ユ晠闅滄弿杩�" ></a-textarea> + </a-form-model-item> + </a-col> + <a-col :span="8"> + <a-form-model-item label="澶囨敞" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark"> + <a-textarea v-model="model.remark" placeholder="璇疯緭鍏ュ娉�" ></a-textarea> + </a-form-model-item> + </a-col> + </a-row> + <a-row :gutter="24"> + <a-tabs defaultActiveKey="1"> + <a-tab-pane key="1" tab="缁翠慨鏄庣粏"> + <j-vxe-table + ref="editableDetailTable" + :rowNumber="true" + :rowSelection="true" + :bordered="true" + :alwaysEdit="true" + :toolbar="true" + :toolbar-config="detailToolbarConfig" + keep-source + :height="300" + :loading="detail.loading" + :dataSource="detail.dataSource" + :columns="equipmentColumns" + style="margin-top: 8px;"/> + </a-tab-pane> + </a-tabs> + </a-row> + </a-form-model> + </j-form-container> + </a-spin> +</template> + +<script> + +import { getAction, httpAction } from '@/api/manage' +import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js' +import { JVXETypes } from '@/components/jeecg/JVxeTable' + +export default { + name: 'EamMajorPartialRepairForm', + mixins: [JVxeTableModelMixin], + components: { + }, + props: { + //琛ㄥ崟绂佺敤 + disabled: { + type: Boolean, + default: false, + required: false + } + }, + data () { + return { + model: {}, + labelCol: { + xs: { span: 24 }, + sm: { span: 7 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + confirmLoading: false, + validatorRules: { + repairName: { required: true, message: '璇疯緭鍏ラ」鐩悕绉�!' }, + repairType: { required: true, message: '璇烽�夋嫨缁翠慨绫诲瀷!' }, + applicant: { required: true, message: '璇烽�夋嫨鐢宠浜�!' }, + applicantProduction: { required: true, message: '璇疯緭鍏ョ敵璇疯溅闂�!' }, + planStartDate: { required: true, message: '璇烽�夋嫨璁″垝寮�濮嬫棩鏈�!' }, + planEndDate: { required: true, message: '璇烽�夋嫨璁″垝缁撴潫鏃ユ湡!' }, + applicantReason: { required: true, message: '璇疯緭鍏ョ敵璇峰師鍥�!' }, + responsiblePerson: { required: true, message: '璇疯緭鍏ヨ矗浠讳汉!' }, + faultDescription: { required: true, message: '璇疯緭鍏ユ晠闅滄弿杩�!' } + }, + treeData: [], + equipmentOptions: [], + detail: { + loading: false, + dataSource: [], + }, + url: { + add: "/eam/eamMajorPartialRepair/add", + edit: "/eam/eamMajorPartialRepair/edit", + queryById: "/eam/eamMajorPartialRepair/queryById", + queryDetailList: "/eam/eamMajorPartialRepairDetail/list", + queryEquipmentList: "/eam/equipment/asyncLoadEquipment", + loadWorkShopOptions:'/mdc/mdcProduction/loadProductionTreeOptions' + } + } + }, + computed: { + detailToolbarConfig() { + return { + // 濡傛灉鏄鎯呴〉锛屽垯涓嶆樉绀� add 鎸夐挳 + btns: this.disabled ? ['remove', 'clearSelection'] : ['add', 'remove', 'clearSelection'], + slots: ['prefix', 'suffix'] + }; + }, + formDisabled(){ + return this.disabled + }, + equipmentColumns() { + return [ + { + title: '璁惧', + key: 'equipmentId', + type: JVXETypes.select, + options: this.equipmentOptions, + width: '20%', + align: 'center', + validateRules: [{ required: true, message: '璁惧涓嶈兘涓虹┖锛�' }] + }, + { + title: '鍗曚环', + key: 'unitPrice', + type: JVXETypes.inputNumber, + width: '10%', + align: 'center', + validateRules: [{ required: true, message: '鍗曚环涓嶈兘涓虹┖锛�' }] + }, + { + title: '缁翠慨缁撴灉', + key: 'repairResult', + type: JVXETypes.textarea, + width: '20%', + align: 'center', + visible: this.disabled + }, + { + title: '缁翠慨鎻忚堪', + key: 'repairDescription', + type: JVXETypes.textarea, + width: '30%', + align: 'center', + visible: this.disabled + } + ]; + } + }, + created () { + //澶囦唤model鍘熷鍊� + this.modelDefault = JSON.parse(JSON.stringify(this.model)); + this.loadWorkShopTree() + }, + methods: { + loadWorkShopTree() { + //鍔犺浇杞﹂棿閫夋嫨鏍� + getAction(this.url.loadWorkShopOptions).then(res => { + if (res.success) { + this.treeData = [...res.result] + }else { + that.$message.warning(res.message) + } + }) + }, + add () { + this.edit(this.modelDefault) + }, + edit (record) { + this.model = Object.assign({}, record); + this.visible = true + if (this.model.id) { + getAction(this.url.queryDetailList, { repairId: this.model.id }).then((res) => { + if (res.success) { + console.log(res.result) + if (res.result.total) { + this.detail.dataSource = res.result.records + } + } + }) + } + getAction(this.url.queryEquipmentList, {}).then((res) => { + if (res.success) { + this.equipmentOptions = res.result.map(item => { + return { + label: item.text, + value: item.value + } + }) + } + }) + }, + submitForm () { + const that = this; + // 瑙﹀彂琛ㄥ崟楠岃瘉 + this.$refs.form.validate(valid => { + if (valid) { + that.confirmLoading = true; + let httpurl = ''; + let method = ''; + if(!this.model.id){ + httpurl+=this.url.add; + method = 'post'; + }else{ + httpurl+=this.url.edit; + method = 'put'; + } + const detailList = this.$refs.editableDetailTable.getTableData() + if (detailList.length === 0 || !detailList[0].equipmentId) { + this.$message.warning('璇锋坊鍔犵淮淇槑缁嗭紒') + that.confirmLoading = false; + return + } + this.model.eamMajorPartialRepairDetailList = this.$refs.editableDetailTable.getTableData() + httpAction(httpurl,this.model,method).then((res)=>{ + if(res.success){ + that.$message.success(res.message); + that.$emit('ok'); + }else{ + that.$message.warning(res.message); + } + }).finally(() => { + that.confirmLoading = false; + }) + } + + }) + }, + } + } +</script> \ No newline at end of file -- Gitblit v1.9.3