提交 5206e49f 编写于 作者: Mosher's avatar Mosher

update:更新树节点导航参数支持

上级 74e5086e
...@@ -60,7 +60,7 @@ export class TreeExpBarControl extends ExpBarControl { ...@@ -60,7 +60,7 @@ export class TreeExpBarControl extends ExpBarControl {
protected computeNavParams(arg: any): { tempContext: any, tempViewParams: any } { protected computeNavParams(arg: any): { tempContext: any, tempViewParams: any } {
const tempContext: any = {}; const tempContext: any = {};
const tempViewParams: any = {}; const tempViewParams: any = {};
const { counter, context } = this.controlState; let { counter, context } = this.controlState;
if (arg && arg.navfilter) { if (arg && arg.navfilter) {
Object.defineProperty(tempViewParams, arg.navfilter, { Object.defineProperty(tempViewParams, arg.navfilter, {
value: arg.srfkey, value: arg.srfkey,
...@@ -96,8 +96,8 @@ export class TreeExpBarControl extends ExpBarControl { ...@@ -96,8 +96,8 @@ export class TreeExpBarControl extends ExpBarControl {
Object.assign(tempData, arg); Object.assign(tempData, arg);
let _params = UIUtil.computedNavData(tempData, tempContext, tempViewParams, arg.navigateParams); let _params = UIUtil.computedNavData(tempData, tempContext, tempViewParams, arg.navigateParams);
Object.assign(tempViewParams, _params); Object.assign(tempViewParams, _params);
counter.value += 1; counter += 1;
Object.assign(tempContext, { srfcounter: counter.value }); Object.assign(tempContext, { srfcounter: counter });
} }
return { tempContext, tempViewParams }; return { tempContext, tempViewParams };
} }
......
...@@ -8,6 +8,20 @@ export interface TreeNodeRSVO { ...@@ -8,6 +8,20 @@ export interface TreeNodeRSVO {
*/ */
childDeTreeNode?: IParam; childDeTreeNode?: IParam;
/**
* @description 导航上下文
* @type {IParam}
* @memberof TreeNodeRSVO
*/
navigateContext?: IParam;
/**
* @description 导航参数
* @type {IParam}
* @memberof TreeNodeRSVO
*/
navigateParams?: IParam;
/** /**
* @description 父值过滤项 * @description 父值过滤项
* @type {string} * @type {string}
......
...@@ -176,6 +176,20 @@ export interface TreeNodeVO { ...@@ -176,6 +176,20 @@ export interface TreeNodeVO {
*/ */
navFilter: string, navFilter: string,
/**
* @description 导航上下文
* @type {IParam}
* @memberof TreeNodeVO
*/
navigateContext?: IParam;
/**
* @description 导航参数
* @type {IParam}
* @memberof TreeNodeVO
*/
navigateParams?: IParam;
/** /**
* @description 导航视图 * @description 导航视图
* @type {IParam} * @type {IParam}
...@@ -183,6 +197,7 @@ export interface TreeNodeVO { ...@@ -183,6 +197,7 @@ export interface TreeNodeVO {
*/ */
navView?: IParam, navView?: IParam,
/** /**
* @description 节点标识 * @description 节点标识
* @type {string} * @type {string}
......
...@@ -134,9 +134,9 @@ export class TreeService<T extends ControlVOBase> extends ControlServiceBase<T> ...@@ -134,9 +134,9 @@ export class TreeService<T extends ControlVOBase> extends ControlServiceBase<T>
// 填充对应节点关系的子节点 // 填充对应节点关系的子节点
if (nodeRSs && nodeRSs.length > 0) { if (nodeRSs && nodeRSs.length > 0) {
for (let i = 0, len = nodeRSs.length; i < len; i++) { for (let i = 0, len = nodeRSs.length; i < len; i++) {
let rsNavContext: any = this.getNavContext(nodeRSs[i]); let rsNavContext: any = nodeRSs[i].navigateContext;
let rsNavParams: any = this.getNavParams(nodeRSs[i]); let rsNavParams: any = nodeRSs[i].navigateParams;
let rsParams: any = this.getParams(nodeRSs[i]); let rsParams: any = nodeRSs[i].params;
// 根据节点标识填充节点 // 根据节点标识填充节点
let treeNode: any = treeNodes.find((_node: TreeNodeVO) => { let treeNode: any = treeNodes.find((_node: TreeNodeVO) => {
return nodeRSs[i].childDeTreeNode?.id == _node.id; return nodeRSs[i].childDeTreeNode?.id == _node.id;
...@@ -191,9 +191,8 @@ export class TreeService<T extends ControlVOBase> extends ControlServiceBase<T> ...@@ -191,9 +191,8 @@ export class TreeService<T extends ControlVOBase> extends ControlServiceBase<T>
leaf: !node.hasPSDETreeNodeRSs, leaf: !node.hasPSDETreeNodeRSs,
selected: node.selected, selected: node.selected,
navfilter: node.navFilter, navfilter: node.navFilter,
// TODO 导航参数 navigateContext: node.navigateContext,
// navgateContext: node.navgateContext, navigateParams: node.navigateParams
// navgateParams: node.navgateParams
}; };
// 删除无用属性 // 删除无用属性
let strNodeId: string = node.nodeType; let strNodeId: string = node.nodeType;
...@@ -557,62 +556,4 @@ export class TreeService<T extends ControlVOBase> extends ControlServiceBase<T> ...@@ -557,62 +556,4 @@ export class TreeService<T extends ControlVOBase> extends ControlServiceBase<T>
} }
} }
/**
* 获取树节点关系导航上下文
*
* @param noders 节点
* @memberof AppTreeService
*/
public getNavContext(noders: TreeNodeRSVO) {
let context: any = {};
// let navcontext: any = noders.getPSNavigateContexts();
// if (navcontext?.length > 0) {
// navcontext.forEach((item: IPSNavigateContext) => {
// context[item?.key] = {
// isRawValue: item?.rawValue,
// value: item.value
// }
// })
// }
return context;
}
/**
* 获取树节点关系导航参数
*
* @param noders 节点
* @memberof AppTreeService
*/
public getNavParams(noders: TreeNodeRSVO) {
let params: any = {};
// let navparams: any = noders.getPSNavigateParams();
// if (navparams?.length > 0) {
// navparams.forEach((item: IPSNavigateParam) => {
// params[item?.key] = {
// isRawValue: item?.rawValue,
// value: item.value
// }
// })
// }
return params;
}
/**
* 获取树节点关系参数
*
* @param noders 节点
* @memberof AppTreeService
*/
public getParams(noders: TreeNodeRSVO) {
let params: any = {};
// let reparams: any = noders?.getPSDETreeNodeRSParams();
// if (reparams?.length > 0) {
// reparams.forEach((item: IPSDETreeNodeRSParam) => {
// params[item?.key] = {
// value: item.value
// };
// })
// }
return params;
}
} }
\ No newline at end of file
import { ControlVOBase, TreeControlVO, TreeNodeVO, TreeService } from "@core"; import { ControlVOBase, TreeControlVO, TreeNodeVO, TreeNodeRSVO, TreeService } from "@core";
import { {{pascalCase ctrl.psAppDataEntity.codeName}}Service } from '@api/{{spinalCase ctrl.psAppDataEntity.codeName}}/{{spinalCase ctrl.psAppDataEntity.codeName}}-service'; import { {{pascalCase ctrl.psAppDataEntity.codeName}}Service } from '@api/{{spinalCase ctrl.psAppDataEntity.codeName}}/{{spinalCase ctrl.psAppDataEntity.codeName}}-service';
export class ControlVO extends ControlVOBase implements TreeControlVO { export class ControlVO extends ControlVOBase implements TreeControlVO {
...@@ -79,11 +79,28 @@ export class ControlVO extends ControlVOBase implements TreeControlVO { ...@@ -79,11 +79,28 @@ export class ControlVO extends ControlVOBase implements TreeControlVO {
{{/if}} {{/if}}
id: '{{treeNode.id}}', id: '{{treeNode.id}}',
navFilter: '{{treeNode.navFilter}}', navFilter: '{{treeNode.navFilter}}',
{{#if treeNode.psNavigateContexts}}
navigateContext: {
{{#each treeNode.psNavigateContexts as | navContext |}}
{{navContext.key}}: '{{#if navContext.rawValue}}{{navContext.value}}{{else}}%{{navContext.value}}%{{/if}}',
{{/each}}
},
{{/if}}
{{#if treeNode.psNavigateParams}}
navigateParams: {
{{#each treeNode.psNavigateParams as | navParam |}}
{{navParam.key}}: '{{#if navParam.rawValue}}{{navParam.value}}{{else}}%{{navParam.value}}%{{/if}}',
{{/each}}
},
{{/if}}
{{#if treeNode.navPSAppView}} {{#if treeNode.navPSAppView}}
navView: { navView: {
viewName: '{{treeNode.navPSAppView.codeName}}' viewName: '{{treeNode.navPSAppView.codeName}}'
}, },
{{/if}} {{/if}}
{{#if treeNode.nodeValue}}
nodeValue: '{{treeNode.nodeValue}}',
{{/if}}
nodeType: '{{treeNode.nodeType}}', nodeType: '{{treeNode.nodeType}}',
rootNode: {{treeNode.rootNode}}, rootNode: {{treeNode.rootNode}},
selectFirstOnly: {{treeNode.selectFirstOnly}}, selectFirstOnly: {{treeNode.selectFirstOnly}},
...@@ -112,7 +129,7 @@ export class ControlVO extends ControlVOBase implements TreeControlVO { ...@@ -112,7 +129,7 @@ export class ControlVO extends ControlVOBase implements TreeControlVO {
]; ];
} }
get treeNodeRSs() { get treeNodeRSs(): TreeNodeRSVO[] {
return [ return [
{{#each ctrl.psDETreeNodeRSs as | treeNodeRS |}} {{#each ctrl.psDETreeNodeRSs as | treeNodeRS |}}
{ {
...@@ -121,6 +138,27 @@ export class ControlVO extends ControlVOBase implements TreeControlVO { ...@@ -121,6 +138,27 @@ export class ControlVO extends ControlVOBase implements TreeControlVO {
id: '{{treeNodeRS.childPSDETreeNode.id}}' id: '{{treeNodeRS.childPSDETreeNode.id}}'
}, },
{{/if}} {{/if}}
{{#if treeNodeRS.psNavigateContexts}}
navigateContext: {
{{#each treeNodeRS.psNavigateContexts as | navContext |}}
{{navContext.key}}: '{{#if navContext.rawValue}}{{navContext.value}}{{else}}%{{navContext.value}}%{{/if}}',
{{/each}}
},
{{/if}}
{{#if treeNodeRS.psNavigateParams}}
navigateParams: {
{{#each treeNodeRS.psNavigateParams as | navParam |}}
{{navParam.key}}: '{{#if navParam.rawValue}}{{navParam.value}}{{else}}%{{navParam.value}}%{{/if}}',
{{/each}}
},
{{/if}}
{{#if treeNodeRS.psDETreeNodeRSParams}}
params: {
{{#each treeNodeRS.psDETreeNodeRSParams as | param |}}
{{param.key}}: { value: '{{param.value}}' }
{{/each}}
},
{{/if}}
{{#if treeNodeRS.parentFilter}} {{#if treeNodeRS.parentFilter}}
parentFilter: '{{treeNodeRS.parentFilter}}', parentFilter: '{{treeNodeRS.parentFilter}}',
{{/if}} {{/if}}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册