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

zpc --- 补充树节点关系导航上下文,导航参数上下文 -fix7

上级 09923249
...@@ -571,6 +571,9 @@ import ${srfclassname('${node.getPSAppDataEntity().codeName}')}Service from '@se ...@@ -571,6 +571,9 @@ import ${srfclassname('${node.getPSAppDataEntity().codeName}')}Service from '@se
@Errorlog @Errorlog
public search${srfclassname(node.getNodeType()?lower_case)}(context:any={}, searchFilter: any, filter: any): Promise<any> { public search${srfclassname(node.getNodeType()?lower_case)}(context:any={}, searchFilter: any, filter: any): Promise<any> {
return new Promise((resolve:any,reject:any) =>{ return new Promise((resolve:any,reject:any) =>{
if(!filter.tempviewparams){
Object.assign(searchFilter,filter.tempviewparams);
}
if(!searchFilter.page){ if(!searchFilter.page){
Object.assign(searchFilter,{page:0}); Object.assign(searchFilter,{page:0});
} }
...@@ -728,31 +731,121 @@ import ${srfclassname('${node.getPSAppDataEntity().codeName}')}Service from '@se ...@@ -728,31 +731,121 @@ import ${srfclassname('${node.getPSAppDataEntity().codeName}')}Service from '@se
* 处理节点关系导航上下文 * 处理节点关系导航上下文
* *
* @param context 应用上下文 * @param context 应用上下文
* @param viewparams 参数 * @param filter 参数
* @param resNavContext 节点关系导航上下文 * @param resNavContext 节点关系导航上下文
* *
* @memberof ${srfclassname('${ctrl.codeName}')}Service * @memberof ${srfclassname('${ctrl.codeName}')}Service
*/ */
public handleResNavContext(context:any,viewparams:any,resNavContext:any){ public handleResNavContext(context:any,filter:any,resNavContext:any){
if(resNavContext && Object.keys(resNavContext).length > 0){
let tempContextData:any = JSON.parse(JSON.stringify(context));
let tempViewParams:any = {};
if(filter && filter.viewparams){
tempViewParams = filter.viewparams;
}
Object.keys(resNavContext).forEach((item:any) =>{
let curDataObj:any = resNavContext[item];
this.handleCustomDataLogic(context,tempViewParams,curDataObj,tempContextData,item);
})
return tempContextData;
}else{
return context;
}
} }
/** /**
* 处理关系导航参数 * 处理关系导航参数
* *
* @param context 应用上下文 * @param context 应用上下文
* @param viewparams 参数 * @param filter 参数
* @param resNavParams 节点关系导航参数 * @param resNavParams 节点关系导航参数
* @param resParams 节点关系参数 * @param resParams 节点关系参数
* *
* @memberof ${srfclassname('${ctrl.codeName}')}Service * @memberof ${srfclassname('${ctrl.codeName}')}Service
*/ */
public handleResNavParams(context:any,viewparams:any,resNavParams:any,resParams:any){ public handleResNavParams(context:any,filter:any,resNavParams:any,resParams:any){
if((resNavParams && Object.keys(resNavParams).length >0) || (resParams && Object.keys(resParams).length >0)){
let tempViewParamData:any = {};
let tempViewParams:any = {};
if(filter && filter.viewparams){
tempViewParams = filter.viewparams;
}
if( Object.keys(resNavParams).length > 0){
Object.keys(resNavParams).forEach((item:any) =>{
let curDataObj:any = resNavParams[item];
this.handleCustomDataLogic(context,tempViewParams,curDataObj,tempViewParamData,item);
})
}
if( Object.keys(resParams).length > 0){
Object.keys(resParams).forEach((item:any) =>{
let curDataObj:any = resParams[item];
tempViewParamData[item.toLowerCase()] = curDataObj.value;
})
}
Object.assign(filter,{tempviewparams:tempViewParamData});
return filter;
}else{
return filter;
}
} }
/**
* 处理自定义节点关系导航数据
*
* @param context 应用上下文
* @param viewparams 参数
* @param curNavData 节点关系导航参数对象
* @param tempData 返回数据
* @param item 节点关系导航参数键值
*
* @memberof ${srfclassname('${ctrl.codeName}')}Service
*/
public handleCustomDataLogic(context:any,viewparams:any,curNavData:any,tempData:any,item:string){
// 直接值直接赋值
if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: curNavData.value,
writable : true,
enumerable : true,
configurable : true
});
}
}else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null // 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(context[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(viewparams[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: viewparams[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}
}
}
}
<#ibizinclude> <#ibizinclude>
../@MACRO/SERVICE/SERVICE_BOTTOM.ts.ftl ../@MACRO/SERVICE/SERVICE_BOTTOM.ts.ftl
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册