From abb72ed0fc3358620960329f6bd10c8a012a71e9 Mon Sep 17 00:00:00 2001 From: qushaowei <qushaowei@163.com> Date: 星期五, 29 十二月 2023 15:02:47 +0800 Subject: [PATCH] Merge branch 'master' of http://117.34.109.166:18448/r/vue_mdc_430 into develop --- src/views/eam/modules/equipmentNew/edit/KeyEquipmentUpdateTable.vue | 302 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 302 insertions(+), 0 deletions(-) diff --git a/src/views/eam/modules/equipmentNew/edit/KeyEquipmentUpdateTable.vue b/src/views/eam/modules/equipmentNew/edit/KeyEquipmentUpdateTable.vue new file mode 100644 index 0000000..b192121 --- /dev/null +++ b/src/views/eam/modules/equipmentNew/edit/KeyEquipmentUpdateTable.vue @@ -0,0 +1,302 @@ +<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="12"> + <a-form-model-item + label="鍏抽敭璁惧鏍囪瘑" + :labelCol="labelCol" + :wrapperCol="wrapperCol" + prop="specificEquipment" + > + <j-dict-select-tag + allow-clear + placeholder="璇烽�夋嫨鍏抽敭璁惧鏍囪瘑" + :disabled="formDisabled" + :triggerChange="true" + dictCode="specific_equipment" + v-model="model.specificEquipment" + @change="(e) =>standardResultCompute(e)" + /> + </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="keyEquipmentUpdateList.loading" + :columns="keyEquipmentUpdateList.columns" + :dataSource="keyEquipmentUpdateList.dataSource" + :maxHeight="1000" + :disabled="formDisabled" + :rowNumber="true" + :rowSelection="true" + :toolbar="true" + :alwaysEdit="true" + :toolbarConfig="toolbarConfig" + > + <template slot="toolbarPrefix"> + <a-button type="primary" @click="selectEquipmentList" :disabled="formDisabled">閫夋嫨璁惧 + </a-button> + </template> + </j-vxe-table> + </a-tab-pane> + </a-tabs> + <equipment-select-model ref="EquipmentSelectModal" @selectionRows="addSelectedEquipments"></equipment-select-model> + </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' + import EquipmentSelectModel from './EquipmentSelectModel' + export default { + name: 'KeyEquipmentUpdateTable', + mixins: [JVxeTableModelMixin], + components: { + JFormContainer, + dayjs, + EquipmentSelectModel + }, + data() { + return { + toolbarConfig: { + // prefix 鍓嶇紑锛泂uffix 鍚庣紑 + slot: ['prefix', 'suffix'], + // add 鏂板鎸夐挳锛況emove 鍒犻櫎鎸夐挳锛沜learSelection 娓呯┖閫夋嫨鎸夐挳 + btn: ['remove', 'clearSelection'] + }, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + model:{ + }, + // 鏂板鏃跺瓙琛ㄩ粯璁ゆ坊鍔犲嚑琛岀┖鏁版嵁 + addDefaultRowNum: 0, + validatorRules: { + }, + refKeys: ['keyEquipmentUpdateTable', ], + tableKeys:['keyEquipmentUpdateTable', ], + activeKey: 'keyEquipmentUpdateTable', + keyEquipmentUpdateList: { + 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: 'oldSpecificEquipment', + type: JVXETypes.select, + width:"200px", + placeholder: '鏃犳棫鏍囪瘑', + align:'center', + disabled:true, + dictCode:'specific_equipment', + options:[], + }, + { + title: '鍏抽敭璁惧鏍囪瘑锛堟柊锛�', + key: 'specificEquipment', + type: JVXETypes.select, + width:"200px", + dictCode:'specific_equipment', + options:[], + placeholder: '璇疯緭鍏ユ柊鏍囪瘑', + align:'center', + defaultValue:365, + validateRules: [ + { + required: true, // 蹇呭~ + message: '璇疯緭鍏�${title}' // 鏄剧ず鐨勬枃鏈� + }, + { handler({ cellValue, row, column }, callback, target) { + if (cellValue==row.oldSpecificEquipment) { + callback(false, '${title}涓嶈兘涓庢棫鏁版嵁闆峰悓') // false = 鏈�氳繃锛屽彲浠ヨ窡鑷畾涔夋彁绀� + } else { + callback(true) // true = 閫氳繃楠岃瘉 + } + }, + message: '${title}榛樿鎻愮ず' + }, + ] + }, + ] + }, + url: { + // add: "/tooling/toolingMakeAccountMain/add", + add: "/eam/equipment/updateKeyEquipment", + // queryById: "/tooling/toolingMakeAccountMain/queryById", + keyEquipmentUpdateList: { + list: '/eam/equipment/list' + }, + } + } + }, + props: { + //琛ㄥ崟绂佺敤 + disabled: { + type: Boolean, + default: false, + required: false + }, + }, + computed: { + formDisabled(){ + return this.disabled + }, + }, + created () { + }, + methods: { + addBefore(){ + this.keyEquipmentUpdateList.dataSource=[] + }, + getAllTable() { + let values = this.tableKeys.map(key => getRefPromise(this, key)) + return Promise.all(values) + }, + /** 璋冪敤瀹宔dit()鏂规硶涔嬪悗浼氳嚜鍔ㄨ皟鐢ㄦ鏂规硶 */ + editAfter() { + this.$nextTick(() => { + }) + // 鍔犺浇瀛愯〃鏁版嵁 + if (this.model.id) { + let params = { equipmentId: this.model.id } + this.requestSubTableData(this.url.keyEquipmentUpdateList.list, params, this.keyEquipmentUpdateList) + } + }, + //鏍¢獙鎵�鏈変竴瀵逛竴瀛愯〃琛ㄥ崟 + 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) + } + }) + }) + }, + /** 鏁寸悊鎴恌ormData */ + classifyIntoFormData(allValues) { + let main = Object.assign(this.model, allValues.formValue) + return { + ...main, // 灞曞紑 + keyEquipmentUpdateList: 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') + } + }, + //閫夋嫨璁惧 + selectEquipmentList() { + let ids = [] + let tableData = this.$refs.keyEquipmentUpdateTable.getTableData() + 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.keyEquipmentUpdateTable.getTableData() + // const seletedEquipmentIds = tableData. + var tableStr = JSON.stringify(tableData) + const addRows = [] + for (let i = 0; i < data.length; i++) { + var equipment = {} + if (tableStr.indexOf(data[i].id)==-1) { + equipment = { + id:data[i].id, + equipmentId: data[i].id, + num: data[i].num, + name: data[i].name, + model:data[i].model, + oldSpecificEquipment:data[i].specificEquipment, + } + } + addRows.push(equipment) + } + this.$refs.keyEquipmentUpdateTable.pushRows(addRows) + }, + standardResultCompute(e){ + let tableData =this.$refs.keyEquipmentUpdateTable.getTableData(); + for(var i = 0;i<tableData.length;i++){ + let row = this.$refs.keyEquipmentUpdateTable.getRowById(tableData[i].equipmentId); + row['specificEquipment']=e + } + } + + } + } +</script> + +<style scoped> +</style> \ No newline at end of file -- Gitblit v1.9.3