¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <a-spin :spinning="confirmLoading"> |
| | | <j-form-container :disabled="formDisabled"> |
| | | <!-- 主表ååºå --> |
| | | <a-form-model |
| | | ref="form" |
| | | :model="model" |
| | | :rules="validatorRules" |
| | | slot="detail" |
| | | > |
| | | <a-row> |
| | | <a-col :span="24"> |
| | | <a-form-model-item |
| | | label="åæ®å·" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | prop="num" |
| | | > |
| | | <a-input |
| | | v-model="model.num" |
| | | placeholder="请è¾å
¥åæ®å·" |
| | | ></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col |
| | | :span="12" |
| | | :hidden=true |
| | | > |
| | | <a-form-model-item |
| | | label="å卿¹å¼" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | prop="changeMethod" |
| | | > |
| | | <a-input |
| | | v-model="model.changeMethod" |
| | | placeholder="请è¾å
¥å卿¹å¼" |
| | | defaultValue="unseal" |
| | | ></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="4" |
| | | placeholder="请è¾å
¥å¤æ³¨" |
| | | /> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | </a-form-model> |
| | | </j-form-container> |
| | | <!-- å表ååºå --> |
| | | <a-tabs |
| | | v-model="activeKey" |
| | | @change="handleChangeTabs" |
| | | > |
| | | <a-tab-pane |
| | | tab="设å¤å¯å°æç»" |
| | | :key="refKeys[0]" |
| | | :forceRender="true" |
| | | > |
| | | <j-vxe-table |
| | | keep-source |
| | | :ref="refKeys[0]" |
| | | :loading="equipmentUnsealDetailTable.loading" |
| | | :columns="equipmentUnsealDetailTable.columns" |
| | | :dataSource="equipmentUnsealDetailTable.dataSource" |
| | | :maxHeight="300" |
| | | :disabled="formDisabled" |
| | | :rowNumber="true" |
| | | :rowSelection="true" |
| | | :toolbar="true" |
| | | :toolbarConfig="toolbarConfig" |
| | | :alwaysEdit='true' |
| | | :bordered='true' |
| | | > |
| | | |
| | | <template slot="toolbarPrefix"> |
| | | <a-button |
| | | type="primary" |
| | | @click="selectEquipmentList" |
| | | :disabled="formDisabled" |
| | | >éæ©è®¾å¤ |
| | | </a-button> |
| | | </template> |
| | | <!-- 设å¤å¾çææ§½ --> |
| | | <!-- <template v-slot:equipmentPhoto='props'> |
| | | <Tooltip |
| | | placement="top" |
| | | title="é¢è§å¾ç" |
| | | > |
| | | <span |
| | | v-if="!text" |
| | | style="font-size: 12px;font-style: italic;" |
| | | >æ å¾ç</span> |
| | | <img |
| | | v-else |
| | | :src="getImgView(text)" |
| | | :preview="props.rowId" |
| | | height="25px" |
| | | alt="" |
| | | style="max-width:80px;font-size: 12px;font-style: italic;" |
| | | /> |
| | | </Tooltip> |
| | | </template> --> |
| | | <template v-slot:action="props"> |
| | | <a-popconfirm |
| | | title="ç¡®å®å é¤åï¼" |
| | | @confirm="handleDL(props)" |
| | | > |
| | | <a>å é¤</a> |
| | | </a-popconfirm> |
| | | </template> |
| | | </j-vxe-table> |
| | | </a-tab-pane> |
| | | </a-tabs> |
| | | <equipment-select-modal ref="EquipmentSelectModal"></equipment-select-modal> |
| | | </a-spin> |
| | | </template> |
| | | |
| | | <script> |
| | | |
| | | import { JEditableTableModelMixin } from '@/mixins/JEditableTableModelMixin' |
| | | import { randomUUID, randomNumber } from '@/utils/util' |
| | | |
| | | import { validateDuplicateValue } from '@/utils/util' |
| | | import pick from 'lodash.pick' |
| | | import { getAction, postAction, requestPut } from '@api/manage' |
| | | import EquipmentSelectModal from './EquipmentSelectModal.vue' |
| | | |
| | | import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js' |
| | | import { JVXETypes } from '@comp/jeecg/JVxeTable' |
| | | import { getRefPromise, VALIDATE_FAILED } from '@/components/jeecg/JVxeTable/utils/vxeUtils.js' |
| | | |
| | | import JFormContainer from '@/components/jeecg/JFormContainer' |
| | | |
| | | export default { |
| | | name: 'EquipmentUnsealForm', |
| | | mixins: [JVxeTableModelMixin], |
| | | components: { |
| | | EquipmentSelectModal, |
| | | JFormContainer |
| | | }, |
| | | data() { |
| | | return { |
| | | changeMethod: 'unseal', |
| | | toolbarConfig: { |
| | | // prefix åç¼ï¼suffix åç¼ |
| | | slot: ['prefix', 'suffix'], |
| | | // add æ°å¢æé®ï¼remove å 餿é®ï¼clearSelection æ¸
ç©ºéæ©æé® |
| | | btn: ['remove', 'clearSelection'] |
| | | }, |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 5 } |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 16 } |
| | | }, |
| | | model: {}, |
| | | // æ°å¢æ¶å表é»è®¤æ·»å å è¡ç©ºæ°æ® |
| | | addDefaultRowNum: 0, |
| | | validatorRules: { |
| | | num: [ |
| | | { required: true, message: '请è¾å
¥åæ®å·!' }, |
| | | { validator: (rule, value, callback) => validateDuplicateValue('mom_eam_equipment_change', 'num', value, this.model.id, callback) } |
| | | ], |
| | | remark: [ |
| | | { required: false, message: '请è¾å
¥å¤æ³¨!' } |
| | | ] |
| | | }, |
| | | refKeys: ['equipmentUnsealDetail'], |
| | | tableKeys: ['equipmentUnsealDetail'], |
| | | activeKey: 'equipmentUnsealDetail', |
| | | // 设å¤å¯å°æç» |
| | | equipmentUnsealDetailTable: { |
| | | loading: false, |
| | | dataSource: [], |
| | | columns: [ |
| | | { |
| | | title: '设å¤å¯å°æç»id', |
| | | key: 'id', |
| | | type: JVXETypes.hidden, |
| | | width: '100px', |
| | | fixed: 'left' |
| | | }, |
| | | { |
| | | title: '设å¤åå¨åid', |
| | | key: 'equipmentChangeId', |
| | | type: JVXETypes.hidden, |
| | | |
| | | placeholder: '请è¾å
¥${title}', |
| | | defaultValue: '' |
| | | }, |
| | | { |
| | | title: '设å¤ID', |
| | | key: 'equipmentId', |
| | | type: JVXETypes.hidden, |
| | | defaultValue: '' |
| | | }, |
| | | { |
| | | title: '设å¤ç¼ç ', |
| | | key: 'equipmentNum', |
| | | type: JVXETypes.normal, |
| | | width: '150px', |
| | | align: "center", |
| | | }, |
| | | // fixed: 'left' |
| | | { |
| | | title: '设å¤åç§°', |
| | | key: 'equipmentName', |
| | | type: JVXETypes.normal, |
| | | disabled: true, |
| | | width: '150px', |
| | | align: "center", |
| | | defaultValue: '' |
| | | }, |
| | | // fixed: 'left', |
| | | { |
| | | title: '设å¤åå·', |
| | | key: 'model', |
| | | type: JVXETypes.normal, |
| | | disabled: true, |
| | | width: '150px', |
| | | align: "center", |
| | | defaultValue: '' |
| | | }, |
| | | { |
| | | title: '设å¤è§æ ¼', |
| | | key: 'specification', |
| | | type: JVXETypes.normal, |
| | | disabled: true, |
| | | width: '150px', |
| | | align: "center", |
| | | placeholder: '请è¾å
¥${title}', |
| | | defaultValue: '' |
| | | }, |
| | | { |
| | | title: 'èµäº§ç¼ç ', |
| | | key: 'assetNumber', |
| | | type: JVXETypes.normal, |
| | | width: '150px', |
| | | align: "center", |
| | | defaultValue: '' |
| | | }, |
| | | { |
| | | title: 'å°ååå ', |
| | | key: 'sealReason', |
| | | type: JVXETypes.normal, |
| | | disabled: true, |
| | | width: '200px', |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: 'å°åæ¥æ', |
| | | key: 'sealDate', |
| | | type: JVXETypes.normal, |
| | | disabled: true, |
| | | width: '150px', |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: 'å¯å°æ¥æ', |
| | | key: 'unsealDate', |
| | | type: JVXETypes.datetime, |
| | | width: '150px', |
| | | align: "center", |
| | | placeholder: '请è¾å
¥${title}', |
| | | defaultValue: '', |
| | | validateRules: [{ |
| | | required: true, // å¿
å¡« |
| | | message: '${title}ä¸è½ä¸ºç©º' // æç¤ºçææ¬ |
| | | }] |
| | | }, |
| | | { |
| | | title: 'å¯å°åå ', |
| | | key: 'unsealReason', |
| | | type: JVXETypes.textarea, |
| | | width: '200px', |
| | | align: "center", |
| | | placeholder: '请è¾å
¥${title}', |
| | | defaultValue: '', |
| | | validateRules: [{ |
| | | required: true, // å¿
å¡« |
| | | message: '${title}ä¸è½ä¸ºç©º' // æç¤ºçææ¬ |
| | | }] |
| | | }, |
| | | { |
| | | title: 'ç¹ç§è®¾å¤', |
| | | key: 'specificEquipment', |
| | | type: JVXETypes.hidden, |
| | | disabled: true, |
| | | width: '150px', |
| | | align: "center", |
| | | defaultValue: '' |
| | | }, |
| | | { |
| | | title: 'ç¹ç§è®¾å¤', |
| | | key: 'specificEquipment_dictText', |
| | | type: JVXETypes.normal, |
| | | disabled: true, |
| | | width: '150px', |
| | | align: "center", |
| | | defaultValue: '' |
| | | }, |
| | | |
| | | { |
| | | title: '设å¤ç¶æ', |
| | | key: 'equipmentStatus_dictText', |
| | | type: JVXETypes.normal, |
| | | disabled: true, |
| | | width: '150px', |
| | | align: "center", |
| | | defaultValue: '' |
| | | }, |
| | | // { |
| | | // title: '设å¤ç¶æ', |
| | | // key: 'equipmentStatus', |
| | | // type: JVXETypes.select, |
| | | // options: [], |
| | | // dictCode: 'equipment_status', |
| | | // disabled: true, |
| | | // width: '200px', |
| | | // // placeholder: '请è¾å
¥${title}', |
| | | // defaultValue: '' |
| | | // }, |
| | | { |
| | | title: 'ææ¯ç¶æ', |
| | | key: 'technologyStatus_dictText', |
| | | type: JVXETypes.normal, |
| | | disabled: true, |
| | | width: '150px', |
| | | align: "center", |
| | | defaultValue: '' |
| | | }, |
| | | { |
| | | title: '设å¤ä½ç½®', |
| | | key: 'location', |
| | | type: JVXETypes.normal, |
| | | disabled: true, |
| | | width: '150px', |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: 'éè¦åº¦', |
| | | key: 'equipmentImportanceId_dictText', |
| | | type: JVXETypes.normal, |
| | | disabled: true, |
| | | width: '150px', |
| | | align: "center", |
| | | // placeholder: '请è¾å
¥${title}', |
| | | defaultValue: '' |
| | | }, |
| | | { |
| | | title: 'éè¦åº¦', |
| | | key: 'equipmentImportanceId', |
| | | type: JVXETypes.hidden |
| | | }, |
| | | // { |
| | | // title: '设å¤å¾ç', |
| | | // key: 'equipmentPhoto', |
| | | // type: JVXETypes.slot, |
| | | // disabled: true, |
| | | // width: '120px', |
| | | // slotName: 'equipmentPhoto' |
| | | // }, |
| | | // { |
| | | // title: 'æä½', |
| | | // key: 'action', |
| | | // type: JVXETypes.slot, |
| | | // disabled: true, |
| | | // width: '100px', |
| | | // slotName: 'action', |
| | | // }, |
| | | ] |
| | | }, |
| | | url: { |
| | | add: '/eam/equipmentUnseal/add', |
| | | edit: '/eam/equipmentUnseal/edit', |
| | | queryById: '/eam/equipmentUnseal/queryById', |
| | | equipmentUnsealDetail: { |
| | | list: '/eam/equipmentUnseal/listEquipmentUnsealDetailByMainId' |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | props: { |
| | | //表åç¦ç¨ |
| | | disabled: { |
| | | type: Boolean, |
| | | default: false, |
| | | required: false |
| | | } |
| | | }, |
| | | computed: { |
| | | formDisabled() { |
| | | return this.disabled |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.$bus.$on('selectionRows', (data) => { |
| | | // å¢å éä¸ç设å¤å°åè¡¨ä¸ |
| | | this.addSelectedEquipments(data) |
| | | |
| | | }) |
| | | }, |
| | | created() { |
| | | }, |
| | | methods: { |
| | | //éæ©è®¾å¤ |
| | | selectEquipmentList() { |
| | | let ids = [] |
| | | let tableData = this.$refs.equipmentUnsealDetail.getTableData() |
| | | let deleteData = this.$refs.equipmentUnsealDetail.getDeleteData() |
| | | for (let i = 0; i < tableData.length; i++) { |
| | | ids.push(tableData[i].equipmentId) |
| | | } |
| | | this.$refs.EquipmentSelectModal.showModals(ids) |
| | | this.$refs.EquipmentSelectModal.title = 'éæ©è®¾å¤' |
| | | this.$refs.EquipmentSelectModal.disableSubmit = false |
| | | }, |
| | | addSelectedEquipments(data) { |
| | | let tableData = this.$refs.equipmentUnsealDetail.getTableData() |
| | | let tableStr = JSON.stringify(tableData) |
| | | let addRows = [] |
| | | for (let i = 0; i < data.length; i++) { |
| | | var sealDetail = {} |
| | | if (tableStr.indexOf(data[i].id) == -1) { |
| | | sealDetail = { |
| | | equipmentId: data[i].id, |
| | | equipmentNum: data[i].num, |
| | | equipmentName: data[i].name, |
| | | assetNumber: data[i].assetNumber, |
| | | specificEquipment_dictText: data[i].specificEquipment_dictText, |
| | | specificEquipment: data[i].specificEquipment, |
| | | model: data[i].model, |
| | | specification: data[i].specification, |
| | | equipmentStatus_dictText: data[i].equipmentStatus_dictText, |
| | | equipmentStatus: data[i].equipmentStatus, |
| | | technologyStatus_dictText: data[i].technologyStatus_dictText, |
| | | technologyStatus: data[i].technologyStatus, |
| | | equipmentPhoto: data[i].equipmentPhoto, |
| | | location: data[i].location, |
| | | equipmentImportanceId_dictText: data[i].equipmentImportanceId_dictText, |
| | | equipmentImportanceId: data[i].equipmentImportanceId, |
| | | sealReason: data[i].sealReason, |
| | | sealDate: data[i].sealDate |
| | | } |
| | | } |
| | | addRows.push(sealDetail) |
| | | } |
| | | this.$refs.equipmentUnsealDetail.pushRows(addRows) |
| | | }, |
| | | handleDL(props) { |
| | | // è°ç¨å 餿¹æ³ |
| | | props.target.removeRows(props.row) |
| | | }, |
| | | addBefore() { |
| | | this.equipmentUnsealDetailTable.dataSource = [] |
| | | }, |
| | | getAllTable() { |
| | | let values = this.tableKeys.map(key => getRefPromise(this, key)) |
| | | return Promise.all(values) |
| | | }, |
| | | /** è°ç¨å®edit()æ¹æ³ä¹åä¼èªå¨è°ç¨æ¤æ¹æ³ */ |
| | | editAfter() { |
| | | this.$nextTick(() => { |
| | | }) |
| | | // å è½½åè¡¨æ°æ® |
| | | if (this.model.id) { |
| | | let params = { equipmentChangeId: this.model.id } |
| | | this.requestSubTableData(this.url.equipmentUnsealDetail.list, params, this.equipmentUnsealDetailTable) |
| | | } |
| | | }, |
| | | //æ ¡éªææä¸å¯¹ä¸å表表å |
| | | validateSubForm(allValues) { |
| | | return new Promise((resolve, reject) => { |
| | | Promise.all([]).then(() => { |
| | | resolve(allValues) |
| | | }).catch(e => { |
| | | if (e.error === VALIDATE_FAILED) { |
| | | // å¦æææªéè¿è¡¨åéªè¯çå表ï¼å°±èªå¨è·³è½¬å°å®æå¨çtab |
| | | this.activeKey = e.index == null ? this.activeKey : this.refKeys[e.index] |
| | | } else { |
| | | console.error(e) |
| | | } |
| | | }) |
| | | }) |
| | | }, |
| | | /** æ´çæformData */ |
| | | classifyIntoFormData(allValues) { |
| | | let main = Object.assign(this.model, allValues.formValue) |
| | | return { |
| | | ...main, // å±å¼ |
| | | equipmentUnsealDetailList: allValues.tablesValue[0].tableData |
| | | } |
| | | }, |
| | | validateError(msg) { |
| | | this.$message.error(msg) |
| | | } |
| | | |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | /** tab panel 䏿䏿æ¡/æ¥æ è¿ç±»å¸¦ä¸æææçï¼éè¦å æ¤æ ·å¼ */ |
| | | /deep/ .jeecg-tabs-top { |
| | | overflow: visible; |
| | | } |
| | | </style> |