From 92ff846fb659c62037a32b1d8c15eae9df9d9b54 Mon Sep 17 00:00:00 2001 From: zenglf <18502938215@163.com> Date: 星期一, 18 九月 2023 13:24:30 +0800 Subject: [PATCH] Merge branch 'develop' of http://117.34.109.166:18448/r/vue_mdc_430 --- src/views/eam/modules/equipmentTransferIn/EquipmentTransferInDetailModal.vue | 742 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 742 insertions(+), 0 deletions(-) diff --git a/src/views/eam/modules/equipmentTransferIn/EquipmentTransferInDetailModal.vue b/src/views/eam/modules/equipmentTransferIn/EquipmentTransferInDetailModal.vue new file mode 100644 index 0000000..60076dc --- /dev/null +++ b/src/views/eam/modules/equipmentTransferIn/EquipmentTransferInDetailModal.vue @@ -0,0 +1,742 @@ +<template> + <a-modal + :title='title' + :width='1200' + :visible='visible' + :maskClosable='false' + @ok='handleOk' + cancelText='鍏抽棴' + @cancel='handleCancel' + :confirmLoading='confirmLoading' + > + + <a-spin :spinning='confirmLoading'> + <a-form-model :form='form' ref='form' :model='model' :rules='validatorRules'> + <a-row :span='12'> + <a-col :span='12'> + <a-form-model-item label='鍗曟嵁鍙�' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='num'> + <a-input v-model='model.num' placeholder='璇疯緭鍏ュ崟鎹彿' :disabled="disableSubmit"></a-input> + </a-form-model-item> + </a-col> + <a-col :span='12'> + <a-form-model-item label='璋冨叆鍏徃' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='inEnterpriseId'> + <a-tree-select + style='width:100%' + tree-default-expand-all + :dropdown-style="{ maxHeight: '500px', overflow: 'auto' }" + :treeData='treeDataSource' + v-model='model.inEnterpriseId' + placeholder='璇烽�夋嫨璋冨叆鍏徃' + :replace-fields='replaceFields' + :disabled="disableSubmit" + @change='handleChangeInEnterpriseId'> + </a-tree-select> + </a-form-model-item> + </a-col> + </a-row> + + <a-row :Span='24'> + <a-col :span='12'> + <a-form-model-item label='璋冨嚭鍏徃' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='outEnterpriseId'> + <a-tree-select + style='width:100%' + tree-default-expand-all + :dropdown-style="{ maxHeight: '500px', overflow: 'auto' }" + :treeData='treeDataSource' + v-model='model.outEnterpriseId' + placeholder='璇烽�夋嫨璋冨嚭鍏徃' + :replace-fields='replaceFields' + :disabled="disableSubmit" + @change='handleChangeOutEnterpriseId' /> + </a-form-model-item> + </a-col> + + <a-col :span='12'> + <a-form-model-item label='澶囨敞' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='remark'> + <a-textarea v-model='model.remark' placeholder='璇疯緭鍏ュ娉�' :disabled="disableSubmit"></a-textarea> + </a-form-model-item> + </a-col> + </a-row> + </a-form-model> + </a-spin> + <a-button + type='primary' + :style="{ marginRight: '8px',marginBottom:'8px' }" + :loading='confirmLoading' + @click='selectInspectionProjects()' + >璁惧淇℃伅 + </a-button> + + <a-table + ref='table' + bordered + size='middle' + rowKey='id' + :columns='columns' + :dataSource='dataSource' + :scroll="{ x: 'calc(980px + 40%)', y: 900 }" + > + + <template + v-for='col in columns' + :slot='col.dataIndex' + slot-scope='text, record, index' + > + <div :key='col.dataIndex'> + + + <a-select + :value='text' + placeholder='璇烽�夋嫨' + :disabled="disableSubmit" + v-if="col.dataIndex == 'inDepartId'" + :options='record.departVoList' + @change='(e) => handleChange(e, record.key, col, index)' + style='width: 100%' + /> + <a-select + v-if="col.dataIndex == 'inManagerId'" + :value='text' + placeholder='璇烽�夋嫨' + :disabled="disableSubmit" + :options='record.userVoList' + @change='(e) => handleChange(e, record.key, col, index)' + style='width: 100%' + /> + <a-input + :value='text' + placeholder='璇疯緭鍏�' + :disabled="disableSubmit" + v-if="col.dataIndex == 'position'" + @change='(e)=>handleChange(e, record.key, col, index)' + /> + + + <a-select + v-if="col.dataIndex == 'responsibilityUserId'" + :value='text' + placeholder='璇烽�夋嫨' + :disabled="disableSubmit" + :options='record.userVoList' + @change='(e) => handleChange(e, record.key, col, index)' + style='width: 100%' + /> + <a-select + v-if="col.dataIndex == 'responsibilityTeamId'" + :value='text' + placeholder='璇烽�夋嫨' + :disabled="disableSubmit" + :options='record.teamVoList' + @change='(e) => handleChange(e, record.key, col, index)' + style='width: 100%' + /> + <!-- <a-input + :value='text' + placeholder='璇疯緭鍏�' + v-if="col.dataIndex == 'responsibilityTeamId'" + @change='(e)=>handleChange(e, record.key, col, index)' + />--> + + <a-select + v-if="col.dataIndex == 'useDepartId'" + :value='text' + placeholder='璇烽�夋嫨' + :disabled="disableSubmit" + :options='record.departVoList' + @change='(e) => handleChange(e, record.key, col, index)' + style='width: 100%' + /> + <a-date-picker + + v-if="col.dataIndex == 'demandDate'" + :value='text' + :disabled="disableSubmit" + format='YYYY-MM-DD HH:mm:ss' + @change='(e)=>handleChange(e, record.key, col, index)' + /> + <a-date-picker + v-if="col.dataIndex == 'actualInDate'" + :value='text' + :disabled="disableSubmit" + format='YYYY-MM-DD HH:mm:ss' + @change='(e)=>handleChange(e, record.key, col, index)' + /> + + <a-select + v-if="col.dataIndex == 'equipmentTransferCatrgoryId'" + :value='text' + placeholder='璇烽�夋嫨' + :disabled="disableSubmit" + :options='record.transferMethodVoList' + @change='(e) => handleChange(e, record.key, col, index)' + style='width: 100%' + /> + + </div> + </template> + <span + slot='action' + + slot-scope='text, record, index' + > + <a-popconfirm + title='纭畾鍒犻櫎鍚�?' + :disabled="disableSubmit" + @confirm='() => handleDelete(text,record, index)' + > + <a>鍒犻櫎</a> + </a-popconfirm> + </span> + </a-table> + <template slot='footer'> + <a-button + :style="{marginRight: '8px'}" + @click='handleCancel()' + > + 鍏抽棴 + </a-button> + + <a-button + @click='handleOk()' + type='primary' + :disabled="disableSubmit" + :loading='confirmLoading' + >纭畾 + </a-button> + </template> + <j-select-equipment-modal + ref='equipmentTransferInModalForm'></j-select-equipment-modal> + </a-modal> + +</template> + +<script> +import { getAction, postAction, requestPut } from '@/api/manage' +import JMultiSelectTag from '@/components/dict/JMultiSelectTag' +import Tooltip from 'ant-design-vue/es/tooltip' +import pick from 'lodash.pick' +import { validateDuplicateValue } from '@/utils/util' +import JSelectEquipmentModal from '@views/common/JSelectEquipmentModal' + +export default { + name: 'EquipmentTransferInDetailModal', + components: { + JMultiSelectTag, + Tooltip, + JSelectEquipmentModal + }, + data() { + return { + replaceFields: { + value: 'key' + }, + + columns: [ + { + title: '#', + dataIndex: '', + key: 'rowIndex', + align: 'center', + customRender: function(t, r, index) { + return parseInt(index) + 1 + }, + width: 100 + }, + { + title: '璁惧缂栫爜', + align: 'center', + width: 100, + dataIndex: 'equipmentNum' + }, + { + title: '璁惧鍚嶇О', + align: 'center', + width: 100, + dataIndex: 'equipmentName' + }, + { + title: '瑙勬牸', + align: 'center', + width: 100, + dataIndex: 'specification' + }, + { + title: '鍨嬪彿', + width: 100, + align: 'center', + dataIndex: 'model' + }, + { + title: '鎶�鏈姸鎬�', + align: 'center', + width: 100, + dataIndex: 'technicalStatus' + }, + { + title: '闇�姹傛棩鏈�', + align: 'center', + dataIndex: 'demandDate', + width: 200, + scopedSlots: { + customRender: 'demandDate' + } + + }, + { + title: '璋冨叆鏃ユ湡', + align: 'center', + width: 200, + dataIndex: 'actualInDate', + scopedSlots: { + customRender: 'actualInDate' + } + + }, + { + title: '澧炲姞鏂瑰紡', + align: 'center', + width: 150, + dataIndex: 'equipmentTransferCatrgoryId', + scopedSlots: { + customRender: 'equipmentTransferCatrgoryId' + } + }, + + { + title: '璋冨叆绠$悊閮ㄩ棬', + align: 'center', + width: 150, + dataIndex: 'inDepartId', + + scopedSlots: { + customRender: 'inDepartId' + } + }, + { + title: '璋冨叆绠$悊浜�', + align: 'center', + width: 150, + dataIndex: 'inManagerId', + scopedSlots: { + customRender: 'inManagerId' + } + }, + { + title: '璋冨叆璐d换鐝粍', + width: 150, + align: 'center', + dataIndex: 'responsibilityTeamId', + scopedSlots: { + customRender: 'responsibilityTeamId' + } + }, + { + title: '璋冨叆璐d换浜�', + width: 150, + align: 'center', + dataIndex: 'responsibilityUserId', + scopedSlots: { + customRender: 'responsibilityUserId' + } + }, + { + title: '浣跨敤閮ㄩ棬', + width: 150, + align: 'center', + dataIndex: 'useDepartId', + scopedSlots: { + customRender: 'useDepartId' + } + }, + + { + title: '璋冨叆浣嶇疆', + width: 150, + align: 'center', + dataIndex: 'position', + scopedSlots: { + customRender: 'position' + } + }, + { + title: '鎿嶄綔', + width: 100, + align: 'center', + dataIndex: 'action', + scopedSlots: { + customRender: 'action' + } + } + ], + title: '鎿嶄綔', + visible: false, + visible4Confirm: false, + disableSubmit: false, + codeDisable: true, + model: {}, + dateFormat: 'YYYY-MM-DD HH:mm:ss', + transferMethodVoList: {}, + text: '', + position: '', + userVoList: {}, + teamVoList: {}, + departVoList: {}, + workOrder: {}, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 } + }, + confirmLoading: false, + form: this.$form.createForm(this), + validatorRules: { + num: [ + { required: true, message: '璇疯緭鍏ュ崟鍙�!' }, + { validator: (rule, value, callback) => validateDuplicateValue('mom_eam_equipment_transfer', 'num', value, this.model.id, callback) } + ], + outEnterpriseId: [ + { required: true, message: '璇疯緭鍏ヨ皟鍑轰紒涓�!' } + + ], + inEnterpriseId: [ + { required: true, message: '璇疯緭鍏ヨ皟鍏ヤ紒涓�!' } + + ] + }, + + url: { + add: '/eam/equipmentTransfer/add', + edit: '/eam/equipmentTransfer/edit', + loadTree: '/base/enterprise/enterpriseTree', + getTransferMethod: '/eam/equipmentTransferInDetail/getTransferMethod', + userVoList: '/eam/equipmentTransferInDetail/getUser', + teamVoList: '/eam/equipmentTransferInDetail/getTeam', + departVoList: 'eam/equipmentTransferInDetail/getDepart' + }, + treeDataSource: [], + dataSource: [], + enterpriseId: '', + inEnterpriseId: '' + + + } + }, + created() { + //澶囦唤model鍘熷鍊� + this.queryTreeData() + }, + + mounted() { + this.$bus.$on('selectionRows', (data) => { + for (let i = 0; i < data.length; i++) { + this.dataSource.push({ + id: data[i].id, + equipmentId: data[i].id, + equipmentNum: data[i].num, + equipmentName: data[i].name, + model: data[i].model, + specification: data[i].specification, + technicalStatus: data[i].technologyStatus_dictText, + transferMethodVoList: this.transferMethodVoList, + userVoList: this.userVoList, + teamVoList: this.teamVoList, + departVoList: this.departVoList + + }) + } + + }) + }, + + + methods: { + + getTransferMethod() { + getAction(this.url.getTransferMethod, { type: 'add' }).then((res) => { + if (res.success) { + this.transferMethodVoList = res.result + } else { + this.$message.warn(res.message) + } + }) + }, + + /*鑾峰彇閮ㄩ棬鍒楄〃*/ + getInDepartList() { + getAction(this.url.departVoList).then((res) => { + if (res.success) { + this.departVoList = res.result + + } else { + this.$message.warn(res.message) + } + }) + }, + /*鑾峰彇绠$悊浜哄垪琛�*/ + getInUseList() { + getAction(this.url.userVoList).then((res) => { + if (res.success) { + + this.userVoList = res.result + } else { + this.$message.warn(res.message) + } + }) + }, + + /*鑾峰彇璐d换鐝粍鍒楄〃*/ + getInTeamList() { + getAction(this.url.teamVoList).then((res) => { + if (res.success) { + + this.teamVoList = res.result + } else { + this.$message.warn(res.message) + } + }) + }, + + /*鑾峰彇浼佷笟鏍戜俊鎭�*/ + queryTreeData() { + this.loading = true + this.cardLoading = true + getAction(this.url.loadTree, { version: 4 }) + .then((res) => { + if (res.success) { + this.treeDataSource = res.result + } else { + this.$message.warn(res.message) + } + }) + .finally((res) => { + this.loading = false + this.cardLoading = false + }) + }, + //閫夋嫨鐐规椤圭洰 + selectInspectionProjects: function() { + let ids = [] + for (let i = 0; i < this.dataSource.length; i++) { + ids.push(this.dataSource[i].equipmentId) + } + this.$refs.equipmentTransferInModalForm.showModals(ids) + this.$refs.equipmentTransferInModalForm.title = '閫夋嫨璁惧淇℃伅' + this.$refs.equipmentTransferInModalForm.disableSubmit = false + }, + + add() { + this.model.transferType = 'add' + this.edit(this.model, { equipmentTransferInDetailList: [] }) + }, + + + edit(record) { + let that = this + this.getTransferMethod() + this.getInDepartList() + this.getInUseList() + this.getInTeamList() + that.dataSource = [] + this.form.resetFields() + this.model = Object.assign({}, record) + this.visible = true + if (record.equipmentTransferInDetailList != undefined) { + const temp = [...record.equipmentTransferInDetailList] + that.dataSource = temp + } + that.$nextTick(() => { + that.form.setFieldsValue(pick(that.model, 'num', 'inEnterpriseId', 'outEnterpriseId', 'remark')) + }) + if (record.id) { + this.codeDisable = true + } else { + this.codeDisable = false + } + }, + + + close() { + this.$emit('close') + this.visible = false + }, + + handleCancel() { + this.close() + }, + handleChangeInEnterpriseId(value) { + this.enterpriseId = value + console.log('璋冨嚭' + this.enterpriseId) + }, + handleChangeOutEnterpriseId(value) { + this.inEnterpriseId = value + console.log('璋冨叆' + this.inEnterpriseId) + }, + + handleChange(value, key, column, index) { + let that = this + const temp = [...that.dataSource] + const target = temp.filter(item => key === item.key)[index] + if (target) { + + if (column.dataIndex == 'demandDate') { + + target[column.dataIndex] = value + + } else if (column.dataIndex == 'actualInDate') { + target[column.dataIndex] = value + + } else if (column.dataIndex == 'inManagerId') { + + target[column.dataIndex] = value + } else if (column.dataIndex == 'equipmentTransferCatrgoryId') { + + target[column.dataIndex] = value + this.text = value + + } else if (column.dataIndex == 'inDepartId') { + + target[column.dataIndex] = value + + } else if (column.dataIndex == 'responsibilityUserId') { + + target[column.dataIndex] = value + + } else if (column.dataIndex == 'useDepartId') { + + target[column.dataIndex] = value + + } else if (column.dataIndex == 'position') { + + target[column.dataIndex] = value.target.value + } else if (column.dataIndex == 'responsibilityTeamId') { + + target[column.dataIndex] = value + } + //鏄剧ず甯﹁繃鏉ョ殑鏁版嵁 + + that.dataSource = temp + + } + }, + + handleOk() { + const that = this + this.$refs.form.validate(valid => { + if (valid) { + that.confirmLoading = true + let formData = Object.assign(this.model, valid) + formData.equipmentTransferInDetailList = that.dataSource + if (that.dataSource.length ===0){ + that.confirmLoading = false + that.$message.warning("璇锋坊鍔犺皟鍏ユ槑缁�") + return + } + formData.equipmentTransferCatrgoryId = this.text + for (let annItem of that.dataSource) { + if (annItem.specification == undefined || annItem.specification == null || annItem.specification == '') { + that.$message.warning('璇峰~鍐欒鏍�') + that.confirmLoading = false + return + } + if (annItem.model == undefined || annItem.model == null || annItem.model == '') { + that.$message.warning('璇峰~鍐欏瀷鍙�') + that.confirmLoading = false + return + } + if (annItem.equipmentName == undefined || annItem.equipmentName == null || annItem.equipmentName == '') { + that.$message.warning('璁惧鍚嶇О涓嶈兘涓虹┖') + that.confirmLoading = false + return + } + if (annItem.equipmentId == undefined || annItem.equipmentId == null || annItem.equipmentId == '') { + that.$message.warning('褰撳墠璁惧淇℃伅閿欒锛岄噸鏂伴�夋嫨璁惧') + that.confirmLoading = false + return + } + if (annItem.demandDate == undefined || annItem.demandDate == null || annItem.demandDate == '') { + that.$message.warning('璇峰~鍐欓渶姹傛棩鏈�') + that.confirmLoading = false + return + } + if (annItem.inDepartId == undefined || annItem.inDepartId == null || annItem.inDepartId == '') { + that.$message.warning('璇峰~鍐欒皟鍏ョ鐞嗛儴闂�') + that.confirmLoading = false + return + } + if (annItem.inManagerId == undefined || annItem.inManagerId == null || annItem.inManagerId == '') { + that.$message.warning('璇峰~鍐欒皟鍏ョ鐞嗕汉') + that.confirmLoading = false + return + } + if (annItem.inManagerId == undefined || annItem.useDepartId == null || annItem.useDepartId == '') { + that.$message.warning('璇峰~鍐欒皟鍏ヨ矗浠婚儴闂�') + that.confirmLoading = false + return + } + + + } + let obj + if (!this.model.id) { + obj = postAction(this.url.add, formData) + } else { + obj = requestPut(this.url.edit, formData, { id: this.model.id }) + } + obj.then((res) => { + if (res.success) { + that.$message.success(res.message) + that.$emit('ok') + } else { + that.$message.warning(res.message) + } + }).finally(() => { + this.model = {} + that.confirmLoading = false + this.$set(this.model, 'auditStatus', 'notSubmitted') + that.close() + }) + } + }) + }, + + handleDelete(text, record, index) { + this.dataSource.splice(index, 1) + + } + + + } +} +</script> + +<style lang='less' scoped> +/deep/ .frozenRowClass { + color: #c9c9c9; +} + +.fontweight { + font-weight: bold; +} + +.ant-btn { + padding: 0 10px; + margin-left: 3px; +} + +.ant-form-item-control { + line-height: 0px; +} + +/** 涓昏〃鍗曡闂磋窛 */ +.ant-form .ant-form-item { + margin-bottom: 10px; +} + +/** Tab椤甸潰琛岄棿璺� */ +.ant-tabs-content .ant-form-item { + margin-bottom: 0px; +} +</style> \ No newline at end of file -- Gitblit v1.9.3