提交 a3ab3e1d 编写于 作者: WodahsOrez's avatar WodahsOrez

add: 分页导航参数,导航过滤项

上级 3a6f02ee
...@@ -7,4 +7,19 @@ import { IParam, MainControlState } from '@core'; ...@@ -7,4 +7,19 @@ import { IParam, MainControlState } from '@core';
* @extends {MainControlState} * @extends {MainControlState}
*/ */
export interface TabViewPanelControlState extends MainControlState { export interface TabViewPanelControlState extends MainControlState {
/**
* 导航过滤项
*/
navFilter?:string;
/**
* 导航上下文集合
*/
navContexts?:IParam;
/**
* 导航参数集合
*/
navParams?:IParam;
} }
\ No newline at end of file
import { IActionParam, MainControl } from '@core'; import { IActionParam, MainControl, UIUtil } from '@core';
import { TabViewPanelControlProps } from './tab-view-panel-control-prop'; import { TabViewPanelControlProps } from './tab-view-panel-control-prop';
import { TabViewPanelControlState } from './tab-view-panel-control-state'; import { TabViewPanelControlState } from './tab-view-panel-control-state';
...@@ -9,7 +9,6 @@ import { TabViewPanelControlState } from './tab-view-panel-control-state'; ...@@ -9,7 +9,6 @@ import { TabViewPanelControlState } from './tab-view-panel-control-state';
* @extends {MainControl} * @extends {MainControl}
*/ */
export class TabViewPanelControl extends MainControl { export class TabViewPanelControl extends MainControl {
/** /**
* @description 部件状态 * @description 部件状态
* @type {FormControlState} * @type {FormControlState}
...@@ -17,15 +16,63 @@ export class TabViewPanelControl extends MainControl { ...@@ -17,15 +16,63 @@ export class TabViewPanelControl extends MainControl {
*/ */
public declare state: TabViewPanelControlState; public declare state: TabViewPanelControlState;
/**
* 支持导航参数的处理
* 监听props里的context和viewParams,
* 当发生改变时处理一遍导航参数
*
*/
public useNavParams() {
const { navContexts, navParams, navFilter, appDeCodeName } = this.state;
const { context, viewParams } = toRefs(this.state);
watch(
[context, viewParams],
(newValues: any[], prevValues: any[]) => {
// 处理导航过滤项
if(navFilter && appDeCodeName && this.state.context[appDeCodeName.toLowerCase()]){
this.state.context[navFilter] = this.state.context[appDeCodeName.toLowerCase()];
}
// 处理导航上下文
if (navContexts && Object.keys(navContexts).length > 0) {
const _context = UIUtil.computedNavData({}, this.state.context, this.state.viewParams, navContexts);
Object.assign(this.state.context, _context);
}
// 处理导航视图参数
if (navParams && Object.keys(navParams).length > 0) {
const _param = UIUtil.computedNavData({}, this.state.context, this.state.viewParams, navParams);
Object.assign(this.state.viewParams, _param);
}
},
{
immediate: true,
},
);
}
/**
* 部件事件
*
* @param {IActionParam} actionParam
* @memberof TabViewPanelControl
*/
public onViewEvent(actionParam: IActionParam) {
const { tag, action, data } = actionParam;
const { controlName } = this.state;
}
/** /**
* @description 安装部件所有功能模块的方法 * @description 安装部件所有功能模块的方法
* @return {*} * @return {*}
* @memberof TabViewPanelControl * @memberof TabViewPanelControl
*/ */
public moduleInstall() { public moduleInstall() {
const superParams = super.moduleInstall(); const superParams = super.moduleInstall();
this.useNavParams();
return { return {
...superParams, ...superParams,
onViewEvent: this.onViewEvent.bind(this)
}; };
} }
} }
\ No newline at end of file
...@@ -28,7 +28,7 @@ interface ViewEmit { ...@@ -28,7 +28,7 @@ interface ViewEmit {
const emit = defineEmits<ViewEmit>(); const emit = defineEmits<ViewEmit>();
// 安装功能模块,提供状态和能力方法 // 安装功能模块,提供状态和能力方法
const { state, onCancel, onConfirm, onCtrlEvent, selectData } = new TabExpView(viewState, props, emit).moduleInstall(); const { state, onCtrlEvent } = new TabExpView(viewState, props, emit).moduleInstall();
</script> </script>
<template> <template>
......
export const ctrlState = { export const ctrlState = {
controlCodeName: '{{ctrl.codeName}}', controlCodeName: '{{ctrl.codeName}}',
controlName: '{{ctrl.name}}', controlName: '{{ctrl.name}}',
data: {}, appDeCodeName: '{{ctrl.appEntity.codeName}}',
navFilter: "{{ctrl.navFilter}}",
{{#if ctrl.psNavigateContexts}}
navContexts:{{> @macro/front-end/common/navparam.hbs appNavParams=ctrl.psNavigateContexts}},
{{/if}}
{{#if ctrl.psNavigateParams}}
navParams:{{> @macro/front-end/common/navparam.hbs appNavParams=ctrl.psNavigateParams}},
{{/if}}
}; };
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册