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/equipmentReturn/EquipmentUnloadingReturnDetailModal.vue | 468 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 468 insertions(+), 0 deletions(-) diff --git a/src/views/eam/modules/equipmentReturn/EquipmentUnloadingReturnDetailModal.vue b/src/views/eam/modules/equipmentReturn/EquipmentUnloadingReturnDetailModal.vue new file mode 100644 index 0000000..5916e5b --- /dev/null +++ b/src/views/eam/modules/equipmentReturn/EquipmentUnloadingReturnDetailModal.vue @@ -0,0 +1,468 @@ +<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='24'> + <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='businessType'> + <j-dict-select-tag + allow-clear + v-model='model.businessType' + :placeholder="disableSubmit?'':'璇烽�夋嫨绫诲瀷'" + :triggerChange='true' + :disabled="disableSubmit" + dictCode='business_type' + /> + </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='useDepartId'> + <a-select + placeholder='璇烽�夋嫨' + v-model='model.useDepartId' + :disabled="disableSubmit" + :options='this.departVoList' + style='width: 100%' + /> + </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' + :disabled="disableSubmit" + @click='selectInspectionProjects()' + >璁惧淇℃伅 + </a-button> + <a-table + ref='table' + bordered + size='middle' + rowKey='id' + :columns='columns' + :dataSource='dataSource' + :scroll='{ x: 1450, y: 1000 }' + > + <template + v-for='col in columns' + :slot='col.dataIndex' + slot-scope='text, record, index' + > + <div :key='col.dataIndex'> + + <a-date-picker + :value='text' + :disabled="disableSubmit" + v-if="col.dataIndex == 'actualReturnDate'" + format='YYYY-MM-DD HH:mm:ss' + @change='(e)=>handleChange(e, record.key, col, index)' + /> + + </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='equipmentUnloadingBorrowModalForm'></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: 'EquipmentUnloadingReturnDetailModal', + 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: 150, + dataIndex: 'equipmentName' + }, + { + title: '瑙勬牸', + width: 100, + align: 'center', + dataIndex: 'specification' + }, + { + title: '鍨嬪彿', + width: 100, + align: 'center', + dataIndex: 'model' + }, + { + title: '鎶�鏈姸鎬�', + align: 'center', + width: 100, + dataIndex: 'technicalStatus' + }, + + { + title: '瀹為檯棰嗗�熸棩鏈�', + align: 'center', + width: 150, + dataIndex: 'actualBorrowDate' + + + }, + { + title: '瀹為檯褰掕繕鏃ユ湡', + align: 'center', + width: 150, + dataIndex: 'actualReturnDate', + scopedSlots: { + customRender: 'actualReturnDate' + } + + }, + { + title: '璐d换鐝粍', + align: 'center', + dataIndex: 'responsibilityTeamName' + + }, + { + title: '璐d换浜�', + align: 'center', + + dataIndex: 'responsibilityUserName' + }, + { + title: '鎿嶄綔', + align: 'center', + fixed: 'right', + width: 150, + dataIndex: 'action', + scopedSlots: { + customRender: 'action' + } + } + ], + title: '鎿嶄綔', + visible: false, + visible4Confirm: false, + disableSubmit: false, + codeDisable: true, + model: {}, + dateFormat: 'YYYY-MM-DD HH:mm:ss', + workOrder: { + value: '', + text: '', + title: '' + }, + 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_unloading', 'num', value, this.model.id, callback) } + ], + + businessType: [ + { required: true, message: '璇烽�夋嫨涓氬姟绫诲瀷!' } + + ], + useDepartId: [ + { required: true, message: '璇烽�夋嫨浣跨敤閮ㄩ棬!' } + + ] + + + }, + + + url: { + add: '/eam/equipmentUnloading/add', + edit: '/eam/equipmentUnloading/edit', + departVoList: 'eam/equipmentUnloadingReturnDetail/getDepart' + + + }, + departVoList: [], + dataSource: [] + + + } + }, + created() { + //澶囦唤model鍘熷鍊� + this.getInDepartList() + }, + + 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, + responsibilityTeamId: data[i].teamId, + responsibilityUserId: data[i].functionary, + actualBorrowDate:data[i].updateTime, + responsibilityUserName:data[i].functionary_dictText, + responsibilityTeamName:data[i].teamId_dictText, + }) + } + + }) + }, + + + methods: { + + /*鑾峰彇閮ㄩ棬鍒楄〃*/ + getInDepartList() { + getAction(this.url.departVoList).then((res) => { + if (res.success) { + this.departVoList = 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.equipmentUnloadingBorrowModalForm.showModals(ids) + this.$refs.equipmentUnloadingBorrowModalForm.title = '閫夋嫨璁惧淇℃伅' + this.$refs.equipmentUnloadingBorrowModalForm.disableSubmit = false + }, + + add() { + this.model.unloadingType = 'return' + this.edit(this.model, { equipmentUnloadingReturnDetailList: [] }) + }, + + + edit(record) { + let that = this + that.dataSource = [] + this.form.resetFields() + this.model = Object.assign({}, record) + this.visible = true + if (record.equipmentUnloadingReturnDetailList != undefined) { + const temp = [...record.equipmentUnloadingReturnDetailList] + 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() + }, + + 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 == 'actualReturnDate'){ + 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.equipmentUnloadingReturnDetailList = that.dataSource + if (that.dataSource.length ===0){ + that.confirmLoading = false + that.$message.warning("璇锋坊鍔犲綊杩樻槑缁�") + return + } + for (let annItem of that.dataSource) { + + if (annItem.actualReturnDate == undefined || annItem.actualReturnDate == null || annItem.actualReturnDate == '') { + 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