提交 2ae146f9 编写于 作者: Mosher's avatar Mosher

update:更新

上级 e2d51c27
......@@ -42,8 +42,7 @@ export class TabExpPanelControl extends MainControl {
public moduleInstall() {
const superParams = super.moduleInstall();
return {
...superParams,
state: this.state,
...superParams
};
}
......
......@@ -35,58 +35,47 @@ export class TabViewPanelControl extends MainControl {
}
/**
* 处理导航数据
* 获取导航参数数据
*
* @private
* @param {string} key 标识
* @return {*}
* @memberof TabViewPanelControl
*/
private handleNavData() {
const { navPSDer, parentView } = this.state;
const { context, viewParams } = toRefs(this.state);
if (!parentView || !parentView.state || !navPSDer) {
return;
}
const data: IParam = parentView.state.viewCtx?.viewGlobal || {};
const getValue = (key: string) => {
if (isExistAndNotEmpty(data[key])) {
return data[key];
} else if (isExistAndNotEmpty(context.value[key])) {
return context.value[key];
} else if (isExistAndNotEmpty(viewParams.value[key])) {
return viewParams.value[key];
}
return null;
}
if (navPSDer.major && navPSDer.majorKey) {
const value = getValue(navPSDer.majorKey);
if (navPSDer.isMajor) {
if (value) {
Object.assign(context.value, { [navPSDer.major]: value });
}
} else {
if (value) {
Object.assign(viewParams.value, { [`n_${navPSDer.majorKey}_eq`]: value });
}
}
private getNavParamValue(key: string) {
const { parentView, context, viewParams } = this.state;
const data = parentView?.state?.viewCtx?.viewGlobal || {};
if (isExistAndNotEmpty(data[key])) {
return data[key];
} else if (isExistAndNotEmpty(context[key])) {
return context[key];
} else if (isExistAndNotEmpty(viewParams[key])) {
return viewParams[key];
}
return null;
}
/**
* 支持导航参数的处理
* 监听props里的context和viewParams,
* 当发生改变时处理一遍导航参数
*
*/
public useNavParams() {
const { navContexts, navParams, navFilter, appDeCodeName } = this.state;
// 处理导航数据
this.handleNavData();
const { navContexts, navParams, navFilter, appDeCodeName, navPSDer } = this.state;
const { context, viewParams } = toRefs(this.state);
// 处理导航过滤项
if(navFilter && appDeCodeName && context.value[appDeCodeName.toLowerCase()]){
context.value[navFilter] = context.value[appDeCodeName.toLowerCase()];
// 处理导航关系
if (navPSDer && navPSDer.major && navPSDer.majorKey) {
const value = this.getNavParamValue(navPSDer.majorKey) || this.getNavParamValue(navPSDer.major);
if (isExistAndNotEmpty(value)) {
Object.assign(context.value, { [navPSDer.major]: value });
}
}
// 处理导航过滤项
if (navFilter && appDeCodeName) {
const value = this.getNavParamValue(appDeCodeName.toLowerCase());
if (isExistAndNotEmpty(value)) {
Object.assign(context.value, { [`n_${navFilter}_eq`]: value });
}
}
// 处理导航上下文
......@@ -100,7 +89,6 @@ export class TabViewPanelControl extends MainControl {
const _param = UIUtil.computedNavData({}, context.value, viewParams.value, navParams);
Object.assign(viewParams.value, _param);
}
console.log(1111, this.state.context, this.state.viewParams);
}
/**
......
......@@ -5,12 +5,6 @@ export const ctrlState = {
navFilter: "{{ctrl.navFilter}}",
{{#if ctrl.navPSDER}}
navPSDer: {
{{#if ctrl.navPSDER.minorCodeName}}
isMajor: false,
minorCodeName: '{{lowerCase ctrl.navPSDER.minorCodeName}}',
{{else}}
isMajor: true,
{{/if}}
{{#if ctrl.navPSDER.majorPSDataEntity}}
major: '{{lowerCase ctrl.navPSDER.majorPSDataEntity.codeName}}',
majorKey: '{{lowerCase ctrl.navPSDER.majorPSDataEntity.keyPSDEField.codeName}}'
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册