diff --git a/src/views/battery/monomer/index.vue b/src/views/battery/monomer/index.vue index b0bb344..cef01da 100644 --- a/src/views/battery/monomer/index.vue +++ b/src/views/battery/monomer/index.vue @@ -316,8 +316,29 @@ const buttonTableClick = async (val, row) => { /** 添加/修改操作 */ const basicFormRef = ref() -const openForm = (type: string, row?: any) => { - if(type == 'update'){ +const openForm = async (type: string, row?: any) => { + + + if(type == 'create'&&tableObject.tableList.length>0){ + if(isStatic.value){ + // 静态 + Monomer.allSchemas.formSchema.forEach(item=>{ + if(item.field=='type'){ + item.value = 'static' + } + }) + let defaultRow = await MonomerApi.getMonomer(1) + row = defaultRow + }else{ + // 动态 + Monomer.allSchemas.formSchema.forEach(item=>{ + if(item.field=='type'){ + item.value = 'moving' + } + }) + } + } + if(row){ // 设备 tableDataDevice.value = row.cellDeviceList // 环境 @@ -344,15 +365,6 @@ const openForm = (type: string, row?: any) => { // 单体直通率 tableDataPass.value = [] } - if(tableObject.tableList.length>0){ - if(isStatic.value){ - // 静态 - row = tableObject.tableList.find(item=>item.type == 'static') - }else{ - // 动态 - row = tableObject.tableList.find(item=>item.type == 'moving') - } - } basicFormRef.value.open(type, row) } @@ -369,6 +381,18 @@ const formsSuccess = async (formType,data) => { } if(data.activeTime==0)data.activeTime = null; if(data.expireTime==0)data.expireTime = null; + // 设备 + data.cellDeviceList= tableDataDevice.value + // 环境 + data.cellEnvList= tableDataEnv.value + // 单体极片 + data.cellPassList= tableDataPlate.value + // 单体卷芯或叠芯 + data.cellCoreList= tableDataCore.value + // 单体产品 + data.cellProdList= tableDataProd.value + // 单体直通率 + data.cellPassList= tableDataPass.value if (formType === 'create') { await MonomerApi.createMonomer(data) message.success(t('common.createSuccess')) diff --git a/src/views/battery/monomer/monomer.data.ts b/src/views/battery/monomer/monomer.data.ts index 5e987db..cb358a3 100644 --- a/src/views/battery/monomer/monomer.data.ts +++ b/src/views/battery/monomer/monomer.data.ts @@ -18,6 +18,11 @@ export const Monomer = useCrudSchemas(reactive([ dictType: DICT_TYPE.BATTERY_TYPE, dictClass: 'string', isTable: true, + form:{ + componentProps:{ + disabled:true + } + }, tableForm: { type: 'Select' }