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

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

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