¶Ô±ÈÐÂÎļþ |
| | |
| | | <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: '责任çç»', |
| | | align: 'center', |
| | | dataIndex: 'responsibilityTeamName' |
| | | |
| | | }, |
| | | { |
| | | title: '责任人', |
| | | 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> |