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/equipmentChange/EquipmentChangeDetailModal.vue | 945 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 945 insertions(+), 0 deletions(-) diff --git a/src/views/eam/modules/equipmentChange/EquipmentChangeDetailModal.vue b/src/views/eam/modules/equipmentChange/EquipmentChangeDetailModal.vue new file mode 100644 index 0000000..3c5eb90 --- /dev/null +++ b/src/views/eam/modules/equipmentChange/EquipmentChangeDetailModal.vue @@ -0,0 +1,945 @@ +<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> + <a-col :span='24'> + <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='24'> + <a-form-model-item label='澶囨敞' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='remark'> + <a-textarea v-model='model.remark' rows="3" 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' + :disabled="disableSubmit" + @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='璇烽�夋嫨' + v-if="col.dataIndex === 'beforeDepartId'" + :options='record.departVoList' + :disabled=true + @change='(e) => handleChange(e, record.key, col, index)' + style='width: 100%' + /> + <a-select + :value='text' + placeholder='璇烽�夋嫨' + v-if="col.dataIndex === 'afterDepartId'" + :options='record.departVoList' + :disabled="disableSubmit" + @change='(e) => handleChange(e, record.key, col, index)' + style='width: 100%' + /> + <a-select + v-if="col.dataIndex === 'beforeManager'" + :value='text' + placeholder='璇烽�夋嫨' + :disabled=true + :options='record.userVoList' + @change='(e) => handleChange(e, record.key, col, index)' + style='width: 100%' + /> + + <a-select + v-if="col.dataIndex === 'afterManager'" + :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 === 'beforeUsageDepartId'" + :value='text' + placeholder='璇烽�夋嫨' + :disabled=true + :options='record.departVoList' + @change='(e) => handleChange(e, record.key, col, index)' + style='width: 100%' + /> + + <a-select + v-if="col.dataIndex === 'afterUsageDepartId'" + :value='text' + placeholder='璇烽�夋嫨' + :disabled="disableSubmit" + :options='record.departVoList' + @change='(e) => handleChange(e, record.key, col, index)' + style='width: 100%' + /> + + + <a-input + :value='text' + placeholder="璇疯緭鍏ヨ矗浠荤彮缁�" + :disabled=true + v-if="col.dataIndex === 'beforeTeamId'" + @change='(e)=>handleChange(e, record.key, col, index)' + /> + + + <a-input + :value='text' + placeholder="璇疯緭鍏ヨ矗浠荤彮缁�" + :disabled="disableSubmit" + v-if="col.dataIndex === 'afterTeamId'" + @change='(e)=>handleChange(e, record.key, col, index)' + /> + + + <a-select + v-if="col.dataIndex === 'beforeFunctionary'" + :value='text' + placeholder='璇烽�夋嫨' + :disabled=true + :options='record.userVoList' + @change='(e) => handleChange(e, record.key, col, index)' + style='width: 100%' + /> + + <a-select + v-if="col.dataIndex === 'afterFunctionary'" + :value='text' + placeholder='璇烽�夋嫨' + :disabled="disableSubmit" + :options='record.userVoList' + @change='(e) => handleChange(e, record.key, col, index)' + style='width: 100%' + /> + + + <a-textarea + :value='text' + v-if="col.dataIndex == 'changeReason'" + :maxLength="500" + auto-size + :disabled="disableSubmit" + placeholder="璇疯緭鍏ュ彉鍔ㄥ師鍥�" + @change='(e)=>handleChange(e, record.key, col, index)' + /> + + <a-input + :value='text' + v-if="col.dataIndex === 'afterLocation'" + placeholder='璇疯緭鍏ュ彉鍔ㄥ悗浣嶇疆' + :disabled="disableSubmit" + @change='(e)=>handleChange(e, record.key, col, index)' + /> + + <a-select + v-if="col.dataIndex === 'afterTechnologyStatus'" + :value='text' + placeholder='璇烽�夋嫨' + :disabled="disableSubmit" + :options='record.technologyStatusList' + @change='(e) => handleChange(e, record.key, col, index)' + style='width: 100%' + /> + + <a-select + v-if="col.dataIndex === 'afterEquipmentStatus'" + :value='text' + placeholder='璇烽�夋嫨' + :disabled="disableSubmit" + :options='record.equipmentStatusList' + @change='(e) => handleChange(e, record.key, col, index)' + style='width: 100%' + /> + <a-select + v-if="col.dataIndex === 'changeType'" + :value='text' + placeholder='璇烽�夋嫨' + :disabled="disableSubmit" + :options='record.changeTypeList' + @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='equipmentChangeModalForm'></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: 'EquipmentChangeDetailModal', + 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: 50 + }, + { + title: '璁惧缂栫爜', + width: 150, + align: 'center', + dataIndex: 'equipmentNum' + }, + { + title: '璁惧鍚嶇О', + align: 'center', + width: 150, + dataIndex: 'equipmentName' + + }, + { + title: '鍨嬪彿', + align: 'center', + width: 150, + dataIndex: 'specification', + ellipsis: true, + + + }, + { + title: '瑙勬牸', + align: 'center', + width: 150, + dataIndex: 'model' + + }, + { + title: '鍙樺姩鍓嶇鐞嗛儴闂�', + align: 'center', + width: 150, + dataIndex: 'beforeDepartId', + scopedSlots: { + customRender: 'beforeDepartId' + } + }, + { + title: '鍙樺姩鍓嶇鐞嗕汉', + align: 'center', + width: 150, + disabled: true, + dataIndex: 'beforeManager', + scopedSlots: { + customRender: 'beforeManager' + } + }, + { + title: '鍙樺姩鍓嶄娇鐢ㄩ儴闂�', + align: 'center', + width: 150, + disabled: true, + dataIndex: 'beforeUsageDepartId', + scopedSlots: { + customRender: 'beforeUsageDepartId' + } + + }, + { + title: '鍙樺姩鍓嶈矗浠荤彮缁�', + align: 'center', + width: 150, + disabled: true, + dataIndex: 'beforeTeamId', + scopedSlots: { + customRender: 'beforeTeamId' + } + + }, + + { + title: '鍙樺姩鍓嶈矗浠讳汉', + align: 'center', + width: 150, + disabled: true, + dataIndex: 'beforeFunctionary', + scopedSlots: { + customRender: 'beforeFunctionary' + } + }, + { + title: '鍙樺姩鍓嶄綅缃�', + width: 150, + align: 'center', + dataIndex: 'beforeLocation' + + }, + { + title: '鍙樺姩鍓嶈澶囩姸鎬�', + align: 'center', + width: 150, + disabled: true, + dataIndex: 'beforeEquipmentStatus' + + }, + { + width: 150, + title: '鍙樺姩鍓嶆妧鏈姸鎬�', + align: 'center', + disabled: true, + dataIndex: 'beforeTechnologyStatus' + + }, + { + title: '鍙樺姩绫诲瀷', + align: 'center', + width: 150, + dataIndex: 'changeType', + scopedSlots: { + customRender: 'changeType' + } + + }, + { + title: '鍙樺姩鍘熷洜', + align: 'center', + width: 150, + ellipsis: true, + dataIndex: 'changeReason', + scopedSlots: { + customRender: 'changeReason' + } + }, + { + title: '鍙樺姩鍓嶇鐞嗛儴闂�', + align: 'center', + width: 150, + dataIndex: 'beforeDepartId', + scopedSlots: { + customRender: 'beforeDepartId' + } + }, + + { + title: '鍙樺姩鍚庣鐞嗛儴闂�', + align: 'center', + width: 150, + dataIndex: 'afterDepartId', + scopedSlots: { + customRender: 'afterDepartId' + } + }, + { + title: '鍙樺姩鍓嶇鐞嗕汉', + align: 'center', + width: 150, + dataIndex: 'beforeManager', + scopedSlots: { + customRender: 'beforeManager' + } + }, + + { + title: '鍙樺姩鍚庣鐞嗕汉', + align: 'center', + width: 150, + dataIndex: 'afterManager', + scopedSlots: { + customRender: 'afterManager' + } + }, + { + title: '鍙樺姩鍓嶄娇鐢ㄩ儴闂�', + align: 'center', + width: 150, + dataIndex: 'beforeUsageDepartId', + scopedSlots: { + customRender: 'beforeUsageDepartId' + } + + }, + { + title: '鍙樺姩鍚庝娇鐢ㄩ儴闂�', + align: 'center', + width: 150, + dataIndex: 'afterUsageDepartId', + scopedSlots: { + customRender: 'afterUsageDepartId' + } + + }, + { + title: '鍙樺姩鍓嶈矗浠荤彮缁�', + align: 'center', + width: 150, + dataIndex: 'beforeTeamId', + scopedSlots: { + customRender: 'beforeTeamId' + } + + }, + + { + title: '鍙樺姩鍚庤矗浠荤彮缁�', + align: 'center', + width: 150, + dataIndex: 'afterTeamId', + scopedSlots: { + customRender: 'afterTeamId' + } + }, + { + title: '鍙樺姩鍓嶈矗浠讳汉', + align: 'center', + width: 150, + dataIndex: 'beforeFunctionary', + scopedSlots: { + customRender: 'beforeFunctionary' + } + }, + + { + title: '鍙樺姩鍚庤矗浠讳汉', + align: 'center', + width: 150, + dataIndex: 'afterFunctionary', + scopedSlots: { + customRender: 'afterFunctionary' + } + + }, + { + title: '鍙樺姩鍓嶄綅缃�', + width: 150, + align: 'center', + dataIndex: 'beforeLocation' + + }, + { + title: '鍙樺姩鍚庝綅缃�', + align: 'center', + width: 150, + dataIndex: 'afterLocation', + scopedSlots: { + customRender: 'afterLocation' + } + + }, + { + title: '鍙樺姩鍓嶈澶囩姸鎬�', + align: 'center', + width: 150, + dataIndex: 'beforeEquipmentStatus' + + }, + { + title: '鍙樺姩鍚庤澶囩姸鎬�', + align: 'center', + width: 150, + dataIndex: 'afterEquipmentStatus', + scopedSlots: { + customRender: 'afterEquipmentStatus' + } + + }, + { + width: 150, + title: '鍙樺姩鍓嶆妧鏈姸鎬�', + align: 'center', + dataIndex: 'beforeTechnologyStatus' + + }, + { + title: '鍙樺姩鍚庢妧鏈姸鎬�', + align: 'center', + width: 150, + dataIndex: 'afterTechnologyStatus', + scopedSlots: { + customRender: 'afterTechnologyStatus' + } + + }, + { + title: '鎿嶄綔', + fixed: 'right', + 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', + text: '', + position: '', + userVoList: {}, + departVoList: {}, + workOrder: {}, + technologyStatusList:{}, + changeTypeList: {}, + equipmentStatusList: {}, + 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_change', 'num', value, this.model.id, callback) } + ] + }, + + url: { + add: '/eam/equipmentChange/add', + edit: '/eam/equipmentChange/edit', + userVoList: '/eam/equipmentChangeDetail/getUser', + departVoList: 'eam/equipmentChangeDetail/getDepart', + equipmentStatusVoList: '/eam/equipmentChangeDetail/getEquipmentStatus', + logVoList: '/eam/equipmentChangeDetail/getTechnologyStatus', + changeList: '/eam/equipmentChangeDetail/getChangeType' + }, + dataSource: [] + + + } + }, + created() { + //澶囦唤model鍘熷鍊� + + }, + + 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, + beforeLocation: data[i].location, + equipmentNum: data[i].num, + equipmentName: data[i].name, + model: data[i].model, + beforeEquipmentStatus: data[i].equipmentStatus_dictText, + beforeTechnologyStatus: data[i].technologyStatus_dictText, + specification: data[i].specification, + userVoList: this.userVoList, + departVoList: this.departVoList, + technologyStatusList:this.technologyStatusList, + equipmentStatusList:this.equipmentStatusList, + changeTypeList: this.changeTypeList, + beforeUsageDepartId: data[i].useId, + beforeDepartId: data[i].manageId, + beforeManager: data[i].manager, + beforeFunctionary: data[i].functionary + + }) + } + + }) + }, + + + methods: { + + + /*鑾峰彇璁惧鐘舵��*/ + /*鑾峰彇璁惧鐘舵��*/ + getEquipmentStatueList() { + getAction(this.url.equipmentStatusVoList).then((res) => { + if (res.success) { + this.equipmentStatusList = res.result + + } else { + this.$message.warn(res.message) + } + }) + }, + + /*鑾峰彇鎶�鏈姸鎬�*/ + getTechnologyList() { + getAction(this.url.logVoList).then((res) => { + if (res.success) { + this.technologyStatusList = res.result + + } else { + this.$message.warn(res.message) + } + }) + }, + getChangeTypeList() { + getAction(this.url.changeList).then((res) => { + if (res.success) { + this.changeTypeList = 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) + } + }) + }, + + + //閫夋嫨鐐规椤圭洰 + selectInspectionProjects: function() { + let ids = [] + for (let i = 0; i < this.dataSource.length; i++) { + ids.push(this.dataSource[i].equipmentId) + } + this.$refs.equipmentChangeModalForm.showModals(ids) + this.$refs.equipmentChangeModalForm.title = '閫夋嫨璁惧淇℃伅' + this.$refs.equipmentChangeModalForm.disableSubmit = false + }, + + add() { + this.model.changeMethod = 'change' + this.edit(this.model, { equipmentChangeDetailList: [] }) + }, + + + edit(record) { + let that = this + this.getInDepartList() + this.getInUseList() + this.getEquipmentStatueList() + this.getTechnologyList() + this.getChangeTypeList() + that.dataSource = [] + this.form.resetFields() + this.model = Object.assign({}, record) + this.visible = true + if (record.equipmentChangeDetailList != undefined) { + const temp = [...record.equipmentChangeDetailList] + that.dataSource = temp + } + that.$nextTick(() => { + that.form.setFieldsValue(pick(that.model, 'num', 'remark')) + }) + if (record.id) { + this.codeDisable = true + } else { + this.codeDisable = false + } + }, + + + close() { + this.$emit('close') + this.visible = false + }, + + handleCancel() { + this.close() + }, + + 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 === 'beforeDepartId') { + + target[column.dataIndex] = value + + } else if (column.dataIndex === 'afterDepartId') { + target[column.dataIndex] = value + + } else if (column.dataIndex === 'beforeManager') { + + target[column.dataIndex] = value + } else if (column.dataIndex === 'afterManager') { + + target[column.dataIndex] = value + + } else if (column.dataIndex === 'beforeUsageDepartId') { + + target[column.dataIndex] = value + + } else if (column.dataIndex === 'afterUsageDepartId') { + + target[column.dataIndex] = value + + } else if (column.dataIndex === 'beforeTeamId') { + + + target[column.dataIndex] = value.target.value + + } else if (column.dataIndex === 'afterTeamId') { + + target[column.dataIndex] = value.target.value + + } else if (column.dataIndex === 'beforeFunctionary') { + + target[column.dataIndex] = value + } else if (column.dataIndex === 'afterFunctionary') { + + target[column.dataIndex] = value + } else if (column.dataIndex === 'changeReason') { + + target[column.dataIndex] = value.target.value + } else if (column.dataIndex === 'afterLocation') { + + target[column.dataIndex] = value.target.value + } else if (column.dataIndex === 'afterTechnologyStatus') { + + target[column.dataIndex] = value + } else if (column.dataIndex === 'afterEquipmentStatus') { + + target[column.dataIndex] = value + } else if (column.dataIndex === 'changeType') { + + 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.equipmentChangeDetailList = that.dataSource + if (that.dataSource.length ===0){ + that.confirmLoading = false + that.$message.warning("璇锋坊鍔犲彉鍔ㄦ槑缁�") + return + } + for (let annItem of that.dataSource) { + + + if (annItem.equipmentId === undefined || annItem.equipmentId == null || annItem.equipmentId === '') { + that.$message.warning('褰撳墠璁惧淇℃伅閿欒锛岄噸鏂伴�夋嫨璁惧') + that.confirmLoading = false + return + } + + if (annItem.changeType === undefined || annItem.changeType == null || annItem.changeType === '') { + that.$message.warning('璇烽�夋嫨鍙樺姩绫诲瀷') + that.confirmLoading = false + return + } + if (annItem.afterLocation === undefined || annItem.afterLocation == null || annItem.afterLocation === '') { + that.$message.warning('璇峰~鍐欏彉鍔ㄥ悗浣嶇疆') + that.confirmLoading = false + return + } + if (annItem.afterEquipmentStatus === undefined || annItem.afterEquipmentStatus == null || annItem.afterEquipmentStatus === '') { + that.$message.warning('璇烽�夋嫨鍙樺姩鍚庤澶囩姸鎬�') + that.confirmLoading = false + return + } + if (annItem.afterTechnologyStatus === undefined || annItem.afterTechnologyStatus == null || annItem.afterTechnologyStatus === '') { + that.$message.warning('璇烽�夋嫨鍙樺姩鍚庢妧鏈姸鎬�') + that.confirmLoading = false + return + } + + if (annItem.afterDepartId === undefined || annItem.afterDepartId == null || annItem.afterDepartId === '') { + that.$message.warning('璇烽�夋嫨鍙樺姩鍚庣鐞嗛儴闂�') + that.confirmLoading = false + return + } + if (annItem.afterManager === undefined || annItem.afterManager == null || annItem.afterManager === '') { + that.$message.warning('璇烽�夋嫨鍙樺姩鍚庣鐞嗕汉') + that.confirmLoading = false + return + } + if (annItem.afterManager === undefined || annItem.afterManager == null || annItem.afterManager === '') { + that.$message.warning('璇烽�夋嫨鍙樺姩鍚庣鐞嗕汉') + that.confirmLoading = false + return + } + if (annItem.afterFunctionary === undefined || annItem.afterFunctionary == null || annItem.afterFunctionary === '') { + 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> -- Gitblit v1.9.3