提交 0b5840dc 编写于 作者: tony001's avatar tony001

适配表格数据对象方式新建、更新默认值 --- fix1

上级 ae5b0ddb
......@@ -2186,7 +2186,7 @@ import { Environment } from '@/environments/environment';
row['${editItem.getCodeName()?lower_case}'] = this.$util.dateFormat(new Date());
<#-- 数据对象属性 -->
<#elseif editItem.getCreateDVT() == 'PARAM'>
row['${editItem.getCodeName()?lower_case}'] = this.computeDefaultValueWithParam("CREATE","${editItem.getCreateDV()}");
row['${editItem.getCodeName()?lower_case}'] = this.computeDefaultValueWithParam("CREATE","${editItem.getCreateDV()}",row);
</#if>
<#else>
<#-- 默认值 -->
......@@ -2206,7 +2206,7 @@ import { Environment } from '@/environments/environment';
public updateDefault(row: any){
<#list ctrl.getPSDEGridEditItems() as editItem><#t>
<#if editItem.getUpdateDV?? && editItem.getUpdateDV()?? && editItem.getUpdateDV() !=""><#t>
if (row.hasOwnProperty('${editItem.getCodeName()?lower_case}') && !row.${editItem.getCodeName()?lower_case} && !row.hasUpdated) {
if (row.hasOwnProperty('${editItem.getCodeName()?lower_case}') && !row.${editItem.getCodeName()?lower_case} && row.hasUpdated) {
<#if !(editItem.getUpdateDV() == '')><#t>
<#-- 网页请求 -->
<#if editItem.getUpdateDVT() == 'CONTEXT'>
......@@ -2228,7 +2228,7 @@ import { Environment } from '@/environments/environment';
row['${editItem.getCodeName()?lower_case}'] = this.$util.dateFormat(new Date());
<#-- 数据对象属性 -->
<#elseif editItem.getUpdateDVT() == 'PARAM'>
row['${editItem.getCodeName()?lower_case}'] = this.computeDefaultValueWithParam("UPDATE","${editItem.getUpdateDV()}");
row['${editItem.getCodeName()?lower_case}'] = this.computeDefaultValueWithParam("UPDATE","${editItem.getUpdateDV()}",row);
</#if>
<#else>
<#-- 默认值 -->
......@@ -2243,19 +2243,27 @@ import { Environment } from '@/environments/environment';
/**
* 计算数据对象类型的默认值
* @param {string} action 行为
* @param {string} param 参数
* @param {string} param 默认值参数
* @param {*} data 当前行数据
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public computeDefaultValueWithParam(action:string,param:string){
public computeDefaultValueWithParam(action:string,param:string,data:any){
if(Object.is(action,"UPDATE")){
const nativeData:any = this.service.getCopynativeData();
if(nativeData && (nativeData instanceof Array) && nativeData.length >0){
let targetData:any = nativeData.find((item:any) =>{
return item.${appde.getKeyPSAppDEField().getCodeName()?lower_case} === data.srfkey;
})
if(targetData){
return targetData[param]?targetData[param]:null;
}else{
return null;
}
}else{
return null;
}
}else{
return this.service.getRemoteCopyData().test?this.service.getRemoteCopyData().test:null;
return this.service.getRemoteCopyData()[param]?this.service.getRemoteCopyData()[param]:null;
}
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册