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

zpc---修复树节点上下文

上级 12452ab3
......@@ -455,28 +455,11 @@
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public computecurNodeContext(curNode:any){
let tempContext:any = JSON.parse(JSON.stringify(this.context));
while(curNode){
if(curNode.data && curNode.data.id){
let strTreeNodeId:string = curNode.data.id;
let strNodeType:string = strTreeNodeId.substring(0, strTreeNodeId.indexOf(";")).toLowerCase();
let strRealNodeValue:string = curNode.data.srfkey;
let strNodeKey:string = curNode.data.srfappctxkey?curNode.data.srfappctxkey:strNodeType;
if(!tempContext[strNodeKey]){
Object.defineProperty(tempContext, strNodeKey, {
value: strRealNodeValue,
writable: true,
enumerable: true,
configurable: true
});
}
if(tempContext[strNodeKey]){
curNode = null;
}
}
if(curNode){
curNode = curNode.parent;
}
let tempContext:any = {};
if(curNode && curNode.data && curNode.data.srfappctx){
tempContext = JSON.parse(JSON.stringify(curNode.data.srfappctx));
}else{
tempContext = JSON.parse(JSON.stringify(this.context));
}
return tempContext;
}
......
......@@ -466,15 +466,20 @@ import ${srfclassname('${node.getPSAppDataEntity().codeName}')}Service from '@se
records.forEach((entity: any) => {
let treeNode: any = {};
// 整理context
<#if node.getIdPSDEField()??>
let strId: string = entity.${node.getIdPSDEField().codeName?lower_case};
<#else>
let strId: string = entity.${node.getPSAppDataEntity().getKeyPSAppDEField().codeName?lower_case};
</#if>
<#if node.getTextPSDEField()??>
let strText: string = entity.${node.getTextPSDEField().codeName?lower_case};
<#else>
let strText: string = entity.${node.getPSAppDataEntity().getMajorPSAppDEField().codeName?lower_case};
</#if>
Object.assign(treeNode,{srfparentdename:'${node.getPSAppDataEntity().getCodeName()}',srfparentkey:entity.${node.getPSAppDataEntity().getKeyPSAppDEField().codeName?lower_case}});
Object.assign(treeNode,{srfappctxkey:'${node.getPSAppDataEntity().getCodeName()?lower_case}'});
Object.assign(treeNode,{srfappctx:{'${node.getPSAppDataEntity().getCodeName()?lower_case}':strId}});
Object.assign(treeNode,{srfparentdename:'${node.getPSAppDataEntity().getCodeName()}',srfparentkey:<#if node.getIdPSDEField()??>entity.${node.getIdPSDEField().codeName?lower_case}<#else>entity.${node.getPSAppDataEntity().getKeyPSAppDEField().codeName?lower_case}</#if>});
let tempContext:any = JSON.parse(JSON.stringify(context));
Object.assign(tempContext,{srfparentdename:'${node.getPSAppDataEntity().getCodeName()}',srfparentkey:<#if node.getIdPSDEField()??>entity.${node.getIdPSDEField().codeName?lower_case}<#else>entity.${node.getPSAppDataEntity().getKeyPSAppDEField().codeName?lower_case}</#if>,${node.getPSAppDataEntity().getCodeName()?lower_case}:strId})
Object.assign(treeNode,{srfappctx:tempContext});
Object.assign(treeNode,{'${node.getPSAppDataEntity().getCodeName()?lower_case}':strId});
Object.assign(treeNode, { srfkey: strId });
Object.assign(treeNode, { text: strText, srfmajortext: strText });
......@@ -600,6 +605,7 @@ import ${srfclassname('${node.getPSAppDataEntity().codeName}')}Service from '@se
response.then((response: any) => {
if (!response.status || response.status !== 200) {
resolve([]);
console.log(JSON.stringify(context));
console.error('查询${node.getPSAppDEDataSet().getCodeName()}数据集异常!');
}
const data: any = response.data;
......@@ -611,6 +617,7 @@ import ${srfclassname('${node.getPSAppDataEntity().codeName}')}Service from '@se
}
}).catch((response: any) => {
resolve([]);
console.log(JSON.stringify(context));
console.error('查询${node.getPSAppDEDataSet().getCodeName()}数据集异常!');
});
}
......
......@@ -224,7 +224,6 @@
if(arg.srfappctx){
Object.assign(tempContext,JSON.parse(JSON.stringify(arg.srfappctx)));
}
Object.assign(tempContext,this.context);
if(arg.srfparentdename){
Object.assign(tempContext,{srfparentdename:arg.srfparentdename});
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册