From 0036adeb95ec933d6b504bf9ae965d029875c76b Mon Sep 17 00:00:00 2001 From: Houjie <714924425@qq.com> Date: 星期五, 13 六月 2025 13:11:58 +0800 Subject: [PATCH] 工具盘点:选择工具/主表修改 --- src/views/tms/requirement/modules/ToolsSharpeningModal.vue | 112 ++++++++++++++++++++++++++++--------------------------- 1 files changed, 57 insertions(+), 55 deletions(-) diff --git a/src/views/tms/requirement/modules/ToolsSharpeningModal.vue b/src/views/tms/requirement/modules/ToolsSharpeningModal.vue index 9a903d0..d49bc28 100644 --- a/src/views/tms/requirement/modules/ToolsSharpeningModal.vue +++ b/src/views/tms/requirement/modules/ToolsSharpeningModal.vue @@ -11,18 +11,20 @@ @cancel="handleCancel" cancelText="鍏抽棴"> + + <a-spin :spinning="spinning"> <a-form-model ref="form" :model="model" :rules="validatorRules" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-row :gutter="24"> <a-col :span="12"> - <a-form-model-item prop="standardCode" label="宸ュ叿缂栧彿"> - <a-input-search v-model="model.toolId" placeholder="璇烽�夋嫨宸ュ叿缂栧彿" :disabled="disableSubmit" + <a-form-model-item prop="standardCode" label="宸ュ叿缂栫爜"> + <a-input-search v-model="model.toolId" placeholder="璇烽�夋嫨宸ュ叿缂栫爜" :disabled="disableSubmit" @search="selectTools" enter-button /> </a-form-model-item> </a-col> <a-col :span="12"> - <a-form-model-item prop="classify_id" label="宸ュ叿鍒嗙被缂栫爜"> + <a-form-model-item prop="classify_id" label="宸ュ叿鍒嗙被鍚嶇О"> <a-input placeholder="璇疯緭鍏ュ伐鍏峰垎绫诲悕绉�" v-model="model.classifyId" readOnly :disabled="disableSubmit" /> </a-form-model-item> </a-col> @@ -31,13 +33,13 @@ <a-row :gutter="24"> <a-col :span="12"> <a-form-model-item prop="paramaTableName" label="宸ュ叿鍙傛暟鏍囪瘑"> - <a-input placeholder="閫夋嫨璁惧鍚庤嚜鍔ㄥ甫鍑�" readOnly v-model="model.paramaTableName" readOnly + <a-input placeholder="閫夋嫨璁惧鍚庤嚜鍔ㄥ甫鍑�" readOnly v-model="model.paramaTableName_dictText" readOnly :disabled="disableSubmit" /> </a-form-model-item> </a-col> <a-col :span="12"> <a-form-model-item label="宸ュ叿绫诲瀷"> - <a-input placeholder="閫夋嫨璁惧鍚庤嚜鍔ㄥ甫鍑�" v-model="model.applicationType" readOnly + <a-input placeholder="閫夋嫨璁惧鍚庤嚜鍔ㄥ甫鍑�" v-model="model.applicationType_dictText" readOnly :disabled="disableSubmit" /> </a-form-model-item> </a-col> @@ -45,7 +47,7 @@ <a-row :gutter="24"> <a-col :span="12"> - <a-form-model-item prop="operator" label="璐d换浜�"> + <a-form-model-item prop="responsiblePerson" label="璐d换浜�"> <j-dict-select-tag type="list" v-model="model.responsiblePerson" dictCode="sys_user,realname,id" placeholder="璇烽�夋嫨璐d换浜�" :disabled="disableSubmit" /> </a-form-model-item> @@ -97,10 +99,9 @@ </a-form-model-item> </a-col> </a-row> - <a-row :gutter="24"> - <a-col :span="24"> - <a-form-model-item label="澶囨敞" :labelCol="{span:2}" :wrapperCol="{span:21}" prop="remark"> + <a-col :span="12"> + <a-form-model-item label="澶囨敞" prop="remark"> <a-textarea v-model="model.remark" rows="3" placeholder="璇疯緭鍏ュ娉�" :disabled="disableSubmit" /> </a-form-model-item> </a-col> @@ -114,21 +115,24 @@ <a-button @click="handleOk()" :disabled="disableSubmit" type="primary" :loading="confirmLoading">纭畾</a-button> </template> - <tools-modal ref="toolListModel"></tools-modal> + <tools-modal ref="toolListModel" @sendSelectionRows="getRows"></tools-modal> </j-modal> </template> <script> -import { getAction, httpAction, postAction, requestPut } from '@/api/manage' +import { getAction, postAction, requestPut } from '@/api/manage' import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js' import ToolsModal from '@views/tms/requirement/modules/ToolsModal.vue' +import pick from 'lodash.pick' +import DeviceListModel from '@views/mdc/base/modules/EquipmentList/DeviceListModal.vue' export default { name: 'ToolsSharpeningModal', mixins: [JVxeTableModelMixin], components: { + DeviceListModel, ToolsModal }, data() { @@ -153,47 +157,40 @@ sharpeningTime: [ { required: true, message: '璇烽�夋嫨鍒冪(鏃ユ湡!' } ], - responsibleRerson: [ + responsiblePerson: [ { required: true, message: '璇烽�夋嫨璐d换浜�!' } ], sharpeningResult: [ { required: true, message: '璇疯緭鍏ュ垉纾ㄧ粨鏋滃強寤鸿!' } - ], - responsiblePerson: [ - { required: true, message: '璇烽�夋嫨璐d换浜�!' } ] - }, + lastSelectionData: null, url: { add: '/tms/toolSharpening/add', edit: '/tms/toolSharpening/edit', - queryDetailList: '/tms/toolSharpening/listToolSharpening' + // queryDetailList: '/tms/toolSharpening/listToolSharpening' } } }, created() { }, - mounted() { - this.$bus.$on('selectionRows', (data) => { - console.log('selectionRows', data) - if (data && data.length > 0) { - const item = data[0] - // 浣跨敤 $set 纭繚 model 鐨勫睘鎬ф槸鍝嶅簲寮忕殑 - this.$set(this.model, 'toolId', item.toolCode) - this.$set(this.model, 'toolCode', item.id) + + methods: { + getRows(item) { + console.log(item) + if (item.id) { + this.$set(this.model, 'toolId', item.toolId) + this.$set(this.model, 'toolCode', item.toolCode) this.$set(this.model, 'classifyId', item.classifyId) - this.$set(this.model, 'paramaTableName', item.paramaTableName_dictText) - this.$set(this.model, 'applicationType', item.applicationType_dictText) + this.$set(this.model, 'paramaTableName_dictText', item.paramaTableName_dictText) + this.$set(this.model, 'applicationType_dictText', item.applicationType_dictText) this.$set(this.model, 'toolModel', item.toolModel) this.$set(this.model, 'provinceCity', item.provinceCity) this.$set(this.model, 'warehouseId', item.warehouseId) this.$set(this.model, 'positionCode', item.positionCode) this.$set(this.model, 'mainUnit', item.mainUnit) } - }) - - }, - methods: { + }, selectTools: function() { this.$refs.toolListModel.showModals() @@ -202,26 +199,32 @@ }, add() { - this.addShow = false - this.edit() + this.edit({}) }, - edit(record) { - console.log(record) - this.model = Object.assign({}, record) - this.visible = true - getAction(this.url.queryDetailList, { - id: record.id, - pageNo: 1, - pageSize: 99999 - }).then((res) => { - if (res.success) { - console.log(res.result.records) - this.dataSource = res.result.records - } else { - this.dataSource = null - } - }) + let that = this + that.visible = true + that.model = Object.assign({}, record) + // this.$nextTick(() => { + // this.form.setFieldsValue(pick(that.model, 'selectedDeparts', 'selectedProduction', 'equipmentId', 'equipmentName', 'equipmentModel', 'equipmentType', 'equipmentIp', 'dataPort', + // 'driveType', 'sortNo', 'remark', 'systemVersion', 'devicePower', 'controlSystem', 'saveTableName', 'systemValue')) + // }) + }, + // edit(record) { + // let that = this + // that.visible = true + // that.model = Object.assign({}, record) + // + // // 濡傛灉鏈� selectionRows 鏁版嵁锛屽垯閲嶆柊璧嬪�� + // if (this.lastSelectionData && this.lastSelectionData.length > 0) { + // this.assignModelFromSelection(this.lastSelectionData[0]) + // console.log('this.model',this.assignModelFromSelection(this.lastSelectionData[0])) + // } + // }, + close() { + this.$emit('close') + this.visible = false + }, handleOk() { const that = this @@ -262,15 +265,14 @@ this.close() }, - close() { - this.$emit('close') - this.visible = false - this.$refs.form.clearValidate() - } + } } </script> <style lang="less" scoped> -</style> \ No newline at end of file +</style> + + + -- Gitblit v1.9.3