¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <a-spin :spinning="confirmLoading"> |
| | | <j-form-container :disabled="formDisabled"> |
| | | <!-- 主表ååºå --> |
| | | <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> |
| | | <a-row> |
| | | </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="warrantyUpdateTable.loading" |
| | | :columns="warrantyUpdateTable.columns" |
| | | :dataSource="warrantyUpdateTable.dataSource" |
| | | :maxHeight="600" |
| | | :disabled="formDisabled" |
| | | :rowNumber="true" |
| | | :rowSelection="false" |
| | | :toolbar="false" |
| | | bordered |
| | | :alwaysEdit="true" |
| | | /> |
| | | </a-tab-pane> |
| | | </a-tabs> |
| | | </a-spin> |
| | | </template> |
| | | |
| | | <script> |
| | | |
| | | import { getAction } from '@/api/manage' |
| | | import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js' |
| | | import { duplicateCheck } from '@/api/api' |
| | | 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 dayjs from 'dayjs' |
| | | export default { |
| | | name: 'WarrantyUpdateTable', |
| | | mixins: [JVxeTableModelMixin], |
| | | components: { |
| | | JFormContainer, |
| | | dayjs |
| | | }, |
| | | data() { |
| | | return { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 5 }, |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 16 }, |
| | | }, |
| | | model:{ |
| | | }, |
| | | // æ°å¢æ¶å表é»è®¤æ·»å å è¡ç©ºæ°æ® |
| | | addDefaultRowNum: 0, |
| | | validatorRules: { |
| | | }, |
| | | refKeys: ['warrantyUpdateTableList', ], |
| | | tableKeys:['warrantyUpdateTableList', ], |
| | | activeKey: 'warrantyUpdateTableList', |
| | | warrantyUpdateTable: { |
| | | loading: false, |
| | | dataSource: [], |
| | | columns: [ |
| | | { |
| | | title: 'id', |
| | | key: 'id', |
| | | type: JVXETypes.hidden, |
| | | disabled:true, |
| | | align:'center', |
| | | }, |
| | | { |
| | | title: 'ç»ä¸ç¼ç ', |
| | | key: 'num', |
| | | type: JVXETypes.normal, |
| | | width:"200px", |
| | | placeholder: '请è¾å
¥${title}', |
| | | disabled:true, |
| | | align:'center', |
| | | defaultValue:'', |
| | | |
| | | }, |
| | | { |
| | | title: '设å¤åç§°', |
| | | key: 'name', |
| | | type: JVXETypes.normal, |
| | | width:"200px", |
| | | placeholder: '请è¾å
¥${title}', |
| | | disabled:true, |
| | | align:'center', |
| | | defaultValue:'', |
| | | }, |
| | | { |
| | | title: '设å¤åå·', |
| | | key: 'model', |
| | | type: JVXETypes.normal, |
| | | width:"200px", |
| | | placeholder: '请è¾å
¥${title}', |
| | | disabled:true, |
| | | align:'center', |
| | | defaultValue:'', |
| | | }, |
| | | { |
| | | title: 'è´¨ä¿å¼å§æ¥æï¼æ§ï¼', |
| | | key: 'warrantyStart', |
| | | type: JVXETypes.normal, |
| | | width:"200px", |
| | | placeholder: '请è¾å
¥${title}', |
| | | align:'center', |
| | | }, |
| | | { |
| | | title: 'è´¨ä¿å¼å§æ¥æï¼æ°ï¼', |
| | | key: 'newStart', |
| | | type: JVXETypes.date, |
| | | width:"200px", |
| | | placeholder: '请è¾å
¥${title}', |
| | | align:'center', |
| | | defaultValue:365, |
| | | validateRules: [ |
| | | { |
| | | required: true, // å¿
å¡« |
| | | message: '请è¾å
¥${title}' // æ¾ç¤ºçææ¬ |
| | | }, |
| | | { handler({ cellValue, row, column }, callback, target) { |
| | | if (cellValue==row.warrantyStart) { |
| | | callback(false, '${title}ä¸è½ä¸æ§æ°æ®é·å') // false = æªéè¿ï¼å¯ä»¥è·èªå®ä¹æç¤º |
| | | } else { |
| | | callback(true) // true = éè¿éªè¯ |
| | | } |
| | | }, |
| | | message: '${title}é»è®¤æç¤º' |
| | | }, |
| | | ] |
| | | }, |
| | | { |
| | | title: 'è´¨ä¿ç»ææ¥æï¼æ§ï¼', |
| | | key: 'warrantyEnd', |
| | | type: JVXETypes.normal, |
| | | width:"200px", |
| | | placeholder: '请è¾å
¥${title}', |
| | | align:'center', |
| | | }, |
| | | { |
| | | title: 'è´¨ä¿ç»ææ¥æï¼æ°ï¼', |
| | | key: 'newEnd', |
| | | type: JVXETypes.date, |
| | | width:"200px", |
| | | placeholder: '请è¾å
¥${title}', |
| | | align:'center', |
| | | defaultValue:365, |
| | | validateRules: [ |
| | | { |
| | | required: true, // å¿
å¡« |
| | | message: '请è¾å
¥${title}' // æ¾ç¤ºçææ¬ |
| | | }, |
| | | { handler({ cellValue, row, column }, callback, target) { |
| | | if (cellValue==row.warrantyEnd) { |
| | | callback(false, '${title}ä¸è½è·æ§æ°æ®é·å') // false = æªéè¿ï¼å¯ä»¥è·èªå®ä¹æç¤º |
| | | } else { |
| | | callback(true) // true = éè¿éªè¯ |
| | | } |
| | | }, |
| | | message: '${title}é»è®¤æç¤º' |
| | | }, |
| | | ] |
| | | }, |
| | | { |
| | | title: '夿³¨', |
| | | key: 'remark', |
| | | type: JVXETypes.textarea, |
| | | width:"200px", |
| | | placeholder: '请è¾å
¥${title}', |
| | | align:'center', |
| | | validateRules: [ |
| | | ] |
| | | }, |
| | | ] |
| | | }, |
| | | url: { |
| | | // add: "/tooling/toolingMakeAccountMain/add", |
| | | add: "/eam/equipmentUpdateInfo/updateWarranty", |
| | | // queryById: "/tooling/toolingMakeAccountMain/queryById", |
| | | warrantyUpdateTableList: { |
| | | list: '/eam/equipmentPrecisionParameters/list' |
| | | }, |
| | | } |
| | | } |
| | | }, |
| | | props: { |
| | | //表åç¦ç¨ |
| | | disabled: { |
| | | type: Boolean, |
| | | default: false, |
| | | required: false |
| | | }, |
| | | updateList:{ |
| | | type:Array, |
| | | default:[], |
| | | required:false, |
| | | } |
| | | }, |
| | | computed: { |
| | | formDisabled(){ |
| | | return this.disabled |
| | | }, |
| | | }, |
| | | created () { |
| | | }, |
| | | methods: { |
| | | addBefore(){ |
| | | this.warrantyUpdateTable.dataSource = this.updateList |
| | | }, |
| | | getAllTable() { |
| | | let values = this.tableKeys.map(key => getRefPromise(this, key)) |
| | | return Promise.all(values) |
| | | }, |
| | | /** è°ç¨å®edit()æ¹æ³ä¹åä¼èªå¨è°ç¨æ¤æ¹æ³ */ |
| | | editAfter() { |
| | | this.$nextTick(() => { |
| | | }) |
| | | // å è½½åè¡¨æ°æ® |
| | | if (this.model.id) { |
| | | let params = { equipmentId: this.model.id } |
| | | this.requestSubTableData(this.url.warrantyUpdateTableList.list, params, this.warrantyUpdateTable) |
| | | } |
| | | }, |
| | | //æ ¡éªææä¸å¯¹ä¸å表表å |
| | | 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, // å±å¼ |
| | | warrantyUpdateTableList: allValues.tablesValue[0].tableData, |
| | | } |
| | | }, |
| | | validateError(msg){ |
| | | this.$message.error(msg) |
| | | }, |
| | | changeDate(target){ |
| | | console.log(target) |
| | | if(target.columnIndex==7){ |
| | | target.row.nextCheckDate=dayjs().add(target.value,'day').format('YYYY-MM-DD') |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | </style> |