¶Ô±ÈÐÂÎļþ |
| | |
| | | <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> |
| | | <!-- (å°å-sealï¼å¯å°-unseal,æ¥åº-scrapï¼å¤ç½®-disposal)--> |
| | | <!-- type ="hidden"--> |
| | | <a-col :span="24" hidden> |
| | | <a-form-model-item label="å卿¹å¼" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="changeMethod"> |
| | | <a-input v-model="model.changeMethod" defaultValue="disposal"></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-button--> |
| | | <!-- type="primary"--> |
| | | <!-- :style="{ marginRight: '8px',marginBottom:'8px' }"--> |
| | | <!-- :loading="confirmLoading"--> |
| | | <!-- @click="selectEquipmentList()"--> |
| | | <!-- >éæ©è®¾å¤--> |
| | | <!-- </a-button>--> |
| | | <!-- å表ååºå --> |
| | | <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="equipmentDisposalDetailTable.loading" |
| | | :columns="equipmentDisposalDetailTable.columns" |
| | | :dataSource="equipmentDisposalDetailTable.dataSource" |
| | | :maxHeight="800" |
| | | :disabled="formDisabled" |
| | | :rowNumber="true" |
| | | :rowSelection="true" |
| | | :bordered="true" |
| | | :alwaysEdit="true" |
| | | :toolbar="true" |
| | | :toolbarConfig="toolbarConfig" |
| | | > |
| | | |
| | | <!-- 设å¤å¾çææ§½ --> |
| | | <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> |
| | | <template slot="toolbarPrefix"> |
| | | <a-button type="primary" @click="selectEquipmentList" :disabled="formDisabled">éæ©è®¾å¤ |
| | | </a-button> |
| | | </template> |
| | | </j-vxe-table> |
| | | </a-tab-pane> |
| | | </a-tabs> |
| | | |
| | | <equipment-select-modal ref="EquipmentSelectModal"></equipment-select-modal> |
| | | </a-spin> |
| | | </template> |
| | | |
| | | <script> |
| | | |
| | | import { getAction } from '@/api/manage' |
| | | import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js' |
| | | import { JVXETypes } from '@/components/jeecg/JVxeTable' |
| | | import { getRefPromise, VALIDATE_FAILED } from '@/components/jeecg/JVxeTable/utils/vxeUtils.js' |
| | | import { validateDuplicateValue } from '@/utils/util' |
| | | import JFormContainer from '@/components/jeecg/JFormContainer' |
| | | import EquipmentSelectModal from '../equipmentScrap/EquipmentSelectModal.vue' |
| | | |
| | | export default { |
| | | name: 'EquipmentDisposalForm', |
| | | mixins: [JVxeTableModelMixin], |
| | | components: { |
| | | JFormContainer, |
| | | EquipmentSelectModal |
| | | }, |
| | | data() { |
| | | return { |
| | | changeMethod: 'disposal', |
| | | 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: ['equipmentDisposalDetail'], |
| | | tableKeys: ['equipmentDisposalDetail'], |
| | | activeKey: 'equipmentDisposalDetail', |
| | | // 设å¤å¤ç½®æç» |
| | | equipmentDisposalDetailTable: { |
| | | loading: false, |
| | | dataSource: [], |
| | | columns: [ |
| | | { |
| | | title: '设å¤å¤ç½®æç»id', |
| | | key: 'id', |
| | | type: JVXETypes.hidden, |
| | | width: '100px', |
| | | align:"center", |
| | | }, |
| | | { |
| | | title: '设å¤åå¨åid', |
| | | key: 'equipmentChangeId', |
| | | type: JVXETypes.hidden, |
| | | width: '200px', |
| | | placeholder: '请è¾å
¥${title}', |
| | | align:"center", |
| | | defaultValue: '' |
| | | }, |
| | | { |
| | | title: '设å¤ID', |
| | | key: 'equipmentId', |
| | | type: JVXETypes.hidden, |
| | | disabled: true, |
| | | width: '60px', |
| | | placeholder: '请è¾å
¥${title}', |
| | | align:"center", |
| | | defaultValue: '' |
| | | }, |
| | | { |
| | | title: '设å¤ç¼ç ', |
| | | key: 'equipmentNum', |
| | | type: JVXETypes.normal, |
| | | disabled: true, |
| | | width: '200px', |
| | | align:"center", |
| | | defaultValue: '', |
| | | }, |
| | | { |
| | | title: '设å¤åç§°', |
| | | key: 'equipmentName', |
| | | type: JVXETypes.normal, |
| | | disabled: true, |
| | | width: '200px', |
| | | align:"center", |
| | | defaultValue: '', |
| | | // fixed: 'left' |
| | | }, |
| | | { |
| | | title: '设å¤åå·', |
| | | key: 'model', |
| | | type: JVXETypes.normal, |
| | | disabled: true, |
| | | width: '200px', |
| | | align:"center", |
| | | defaultValue: '' |
| | | }, |
| | | { |
| | | title: '设å¤è§æ ¼', |
| | | key: 'specification', |
| | | type: JVXETypes.normal, |
| | | disabled: true, |
| | | width: '200px', |
| | | align:"center", |
| | | defaultValue: '' |
| | | }, |
| | | { |
| | | title: '设å¤ç¶æ', |
| | | key: 'equipmentStatus_dictText', |
| | | type: JVXETypes.normal, |
| | | disabled: true, |
| | | width: '195px', |
| | | align:"center", |
| | | defaultValue: '' |
| | | }, |
| | | { |
| | | title: '设å¤ä½ç½®', |
| | | key: 'location', |
| | | type: JVXETypes.normal, |
| | | disabled: true, |
| | | width: '195px', |
| | | align:"center", |
| | | defaultValue: '' |
| | | }, |
| | | { |
| | | title: 'ç¹ç§è®¾å¤', |
| | | key: 'specificEquipment', |
| | | type: JVXETypes.hidden, |
| | | align:"center", |
| | | disabled: true, |
| | | width: '200px', |
| | | // placeholder: '请è¾å
¥${title}', |
| | | defaultValue: '' |
| | | }, |
| | | { |
| | | title: 'ç¹ç§è®¾å¤', |
| | | key: 'specificEquipment_dictText', |
| | | type: JVXETypes.normal, |
| | | disabled: true, |
| | | width: '200px', |
| | | align:"center", |
| | | defaultValue: '' |
| | | }, |
| | | { |
| | | title: 'èµäº§ç¼ç ', |
| | | key: 'assetNumber', |
| | | type: JVXETypes.normal, |
| | | disabled: true, |
| | | width: '195px', |
| | | align:"center", |
| | | defaultValue: '', |
| | | }, |
| | | { |
| | | title: 'å¤ç½®åå ', |
| | | key: 'disposalReason', |
| | | type: JVXETypes.input, |
| | | align:"center", |
| | | width: '195px', |
| | | placeholder: '请è¾å
¥${title}', |
| | | defaultValue: '', |
| | | validateRules: [ |
| | | { |
| | | required: true, // å¿
å¡« |
| | | message: '请è¾å
¥${title}' // æ¾ç¤ºçææ¬ |
| | | }] |
| | | }, |
| | | { |
| | | title: 'å¤ç½®æ¥æ', |
| | | key: 'disposalDate', |
| | | type: JVXETypes.datetime, |
| | | align:"center", |
| | | width: '200px', |
| | | placeholder: '请è¾å
¥${title}', |
| | | defaultValue: '', |
| | | validateRules: [ |
| | | { |
| | | required: true // å¿
å¡« |
| | | // message: '请è¾å
¥${title}' // æ¾ç¤ºçææ¬ |
| | | } |
| | | // { |
| | | // // èªå®ä¹å½æ°æ ¡éª handler |
| | | // handler(type, value, row, column, callback, target) { |
| | | // // type è§¦åæ ¡éªçç±»åï¼inputãchangeãblurãgetValuesï¼ |
| | | // // value å½åæ ¡éªçå¼ |
| | | // // callback(flag, message) æ¹æ³å¿
é¡»æ§è¡ä¸åªè½æ§è¡ä¸æ¬¡ |
| | | // // flag = æ¯å¦éè¿äºæ ¡éªï¼ä¸å¡«åæè
å¡«å null 代表ä¸è¿è¡ä»»ä½æä½ |
| | | // // message = æç¤ºçæ¶æ¯ï¼é»è®¤ä½¿ç¨é
ç½®ç message |
| | | // // target è¡ç¼è¾çå®ä¾å¯¹è±¡ |
| | | // |
| | | // if (type === 'blur' || type === 'getValues') { |
| | | // let { values } = target.getValuesSync({ validate: false }) |
| | | // // let count = 0 |
| | | // // for (let val of values) { |
| | | // // if (val['dbFieldName'] === value) { |
| | | // // if (++count >= 2) { |
| | | // // callback(false, '${title}ä¸è½éå¤') |
| | | // // return |
| | | // // } |
| | | // // } |
| | | // // } |
| | | // callback(true) // true = éè¿éªè¯ |
| | | // } else { |
| | | // callback() // ä¸å¡«åæè
å¡«å null 代表ä¸è¿è¡ä»»ä½æä½ |
| | | // } |
| | | // }, |
| | | // message: '${title}é»è®¤æç¤º' |
| | | // } |
| | | ] |
| | | }, |
| | | { |
| | | title: 'åå°æ¹å¼', |
| | | key: 'reduceMethod', |
| | | type: JVXETypes.selectDictSearch, |
| | | disabled: true, |
| | | width: '200px', |
| | | align:"center", |
| | | defaultValue: '', |
| | | dict:'mom_eam_transfer_method,name,id' |
| | | }, |
| | | // { |
| | | // title: 'ç¹ç§è®¾å¤', |
| | | // key: 'specificEquipment', |
| | | // type: JVXETypes.select, |
| | | // options: [], |
| | | // dictCode: 'specific_equipment', |
| | | // disabled: true, |
| | | // width: '200px', |
| | | // // placeholder: '请è¾å
¥${title}', |
| | | // 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: '200px', |
| | | align:"center", |
| | | defaultValue: '' |
| | | }, |
| | | // { |
| | | // title: 'ææ¯ç¶æ', |
| | | // key: 'technologyStatus', |
| | | // type: JVXETypes.select, |
| | | // options: [], |
| | | // dictCode: 'technology_status', |
| | | // disabled: true, |
| | | // width: '200px', |
| | | // // placeholder: '请è¾å
¥${title}', |
| | | // defaultValue: '' |
| | | // }, |
| | | { |
| | | title: 'éè¦åº¦', |
| | | key: 'equipmentImportanceId_dictText', |
| | | type: JVXETypes.normal, |
| | | disabled: true, |
| | | width: '195px', |
| | | align:"center", |
| | | defaultValue: '' |
| | | }, |
| | | |
| | | // { |
| | | // title: 'éè¦åº¦', |
| | | // key: 'equipmentImportanceId', |
| | | // type: JVXETypes.input, |
| | | // disabled: true, |
| | | // width: '200px', |
| | | // // placeholder: '请è¾å
¥${title}', |
| | | // defaultValue: '' |
| | | // }, |
| | | // { |
| | | // title: '设å¤å¾ç', |
| | | // key: 'equipmentPhoto', |
| | | // type: JVXETypes.normal, |
| | | // width: '200px', |
| | | // // placeholder: '请è¾å
¥${title}', |
| | | // defaultValue: '' |
| | | // } |
| | | // { |
| | | // title: '设å¤å¾ç', |
| | | // key: 'equipmentPhoto', |
| | | // type: JVXETypes.slot, |
| | | // disabled: true, |
| | | // width: '120px', |
| | | // slotName:'equipmentPhoto' |
| | | |
| | | // }, |
| | | // { |
| | | // title: 'æä½', |
| | | // key: 'action', |
| | | // type: JVXETypes.slot, |
| | | // disabled: true, |
| | | // width: '100px', |
| | | // align:"center", |
| | | // slotName: 'action', |
| | | // }, |
| | | |
| | | ] |
| | | }, |
| | | url: { |
| | | add: '/eam/equipmentDisposal/add', |
| | | edit: '/eam/equipmentDisposal/edit', |
| | | queryById: '/eam/equipmentDisposal/queryById', |
| | | equipmentDisposalDetail: { |
| | | list: '/eam/equipmentDisposal/listEquipmentDisposalDetailByMainId' |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | 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.equipmentDisposalDetail.getTableData() |
| | | let deleteData = this.$refs.equipmentDisposalDetail.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.equipmentDisposalDetail.getTableData() |
| | | // const seletedEquipmentIds = tableData. |
| | | var tableStr = JSON.stringify(tableData) |
| | | const addRows = [] |
| | | for (let i = 0; i < data.length; i++) { |
| | | var scrapDetail = {} |
| | | if (tableStr.indexOf(data[i].id)==-1) { |
| | | scrapDetail = { |
| | | 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 |
| | | } |
| | | } |
| | | addRows.push(scrapDetail) |
| | | } |
| | | |
| | | this.$refs.equipmentDisposalDetail.pushRows(addRows) |
| | | }, |
| | | handleDL(props) { |
| | | // è°ç¨å 餿¹æ³ |
| | | props.target.removeRows(props.row) |
| | | }, |
| | | addBefore() { |
| | | this.equipmentDisposalDetailTable.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.equipmentDisposalDetail.list, params, this.equipmentDisposalDetailTable) |
| | | } |
| | | }, |
| | | //æ ¡éªææä¸å¯¹ä¸å表表å |
| | | 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) |
| | | // this.main.changeMethod = this.changeMethod |
| | | return { |
| | | ...main, // å±å¼ |
| | | equipmentDisposalDetailList: allValues.tablesValue[0].tableData |
| | | } |
| | | }, |
| | | validateError(msg) { |
| | | this.$message.error(msg) |
| | | } |
| | | |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | </style> |