提交 3d22165d 编写于 作者: Mosher's avatar Mosher

update:更新

上级 723ad2c7
import { UILogicParamType } from "@/logic/const/ui-logic-param-type";
import { UILogicParamBase } from "./ui-logic-param-base";
import store from '@/store';
/**
* 应用全局变量
......@@ -37,7 +38,7 @@ export class UILogicAppGlobalParam extends UILogicParamBase {
*/
public setReal(opts: any) {
this.realValue = opts;
// AppServiceBase.getInstance().getAppStore().commit('addAppGlobal', { tag: this.logicParamModel.paramFieldName, param: opts });
store.commit('addAppGlobal', { tag: this.logicParamModel.paramFieldName, param: opts });
}
/**
......@@ -68,7 +69,7 @@ export class UILogicAppGlobalParam extends UILogicParamBase {
*/
public set(strName: string, value: any) {
this.realValue[strName] = value;
// AppServiceBase.getInstance().getAppStore().commit('addAppGlobal', { tag: this.logicParamModel.paramFieldName, param: this.realValue });
store.commit('addAppGlobal', { tag: this.logicParamModel.paramFieldName, param: this.realValue });
}
/**
......@@ -79,7 +80,7 @@ export class UILogicAppGlobalParam extends UILogicParamBase {
*/
public reset(strName: string) {
this.realValue[strName] = null;
// AppServiceBase.getInstance().getAppStore().commit('addAppGlobal', { tag: this.logicParamModel.paramFieldName, param: this.realValue });
store.commit('addAppGlobal', { tag: this.logicParamModel.paramFieldName, param: this.realValue });
}
}
\ No newline at end of file
import { UILogicParamType } from "@/logic/const/ui-logic-param-type";
import { UILogicParamBase } from "./ui-logic-param-base";
import store from '@/store';
/**
* 界面顶级视图会话共享参数绑定参数
......@@ -26,7 +27,7 @@ export class UILogicRouteViewSessionParam extends UILogicParamBase {
*/
protected init(params: any) {
this.logicParamType = UILogicParamType.routeViewSessionParam;
this.realValue = this.setReal(this.getRouteViewSessionParam(params));
this.setReal(this.getRouteViewSessionParam(params));
}
/**
......@@ -38,7 +39,7 @@ export class UILogicRouteViewSessionParam extends UILogicParamBase {
public setReal(opts: any) {
this.realValue = opts;
const actionContainer = this.actionSession.actionContainer;
this.$store.commit('addRouteViewGlobal', { tag: actionContainer.context.srfsessionid, param: { [this.logicParamModel.paramFieldName]: opts } });
store.commit('addRouteViewGlobal', { tag: actionContainer.context.srfsessionid, param: { [this.logicParamModel.paramFieldName]: opts } });
}
/**
......@@ -70,7 +71,7 @@ export class UILogicRouteViewSessionParam extends UILogicParamBase {
public set(strName: string, value: any) {
this.realValue[strName] = value;
const actionContainer = this.actionSession.actionContainer;
this.$store.commit('addRouteViewGlobal', { tag: actionContainer.context.srfsessionid, param: { [this.logicParamModel.paramFieldName]: this.realValue } });
store.commit('addRouteViewGlobal', { tag: actionContainer.context.srfsessionid, param: { [this.logicParamModel.paramFieldName]: this.realValue } });
}
/**
......@@ -82,6 +83,6 @@ export class UILogicRouteViewSessionParam extends UILogicParamBase {
public reset(strName: string) {
this.realValue[strName] = null;
const actionContainer = this.actionSession.actionContainer;
this.$store.commit('addRouteViewGlobal', { tag: actionContainer.context.srfsessionid, param: { [this.logicParamModel.paramFieldName]: this.realValue } });
store.commit('addRouteViewGlobal', { tag: actionContainer.context.srfsessionid, param: { [this.logicParamModel.paramFieldName]: this.realValue } });
}
}
\ No newline at end of file
......@@ -139,3 +139,21 @@ export const getViewMessage = (state: any) => (tag: string) => {
export const getAppGlobal = (state: any) => () => {
return state.appGlobal;
}
/**
* 获取顶层路由数据
*
* @param state
*/
export const getRouteViewGlobal = (state: any) => (key:string) => {
return state.routeViewGlobal[key];
}
/**
* 获取顶层视图
*
* @param state
*/
export const getView = (state: any) => (key:string) => {
return state.appViews[key];
}
\ No newline at end of file
......@@ -327,3 +327,57 @@ export const removeAppGlobal = (state: any, tag: string) => {
delete state.appGlobal[tag];
}
}
/**
* 添加顶层路由数据参数
*
* @param state
* @param args
*/
export const addRouteViewGlobal = (state: any, args: { tag: string, param: any }) => {
if (args && args.tag && args.param) {
if(!state.routeViewGlobal[args.tag]){
state.routeViewGlobal[args.tag] = args.param;
}else{
const cacheValue = state.routeViewGlobal[args.tag];
Object.assign(cacheValue,args.param);
state.routeViewGlobal[args.tag] = cacheValue;
}
}
}
/**
* 删除指定键值顶层路由数据参数
*
* @param state
* @param args
*/
export const removeRouteViewGlobal = (state: any, tag: string) => {
if (tag && state.routeViewGlobal[tag]) {
delete state.routeViewGlobal[tag];
}
}
/**
* 添加顶层视图
*
* @param state
* @param args
*/
export const addView = (state: any, args: { tag: string, param: any }) => {
if (args && args.tag && args.param) {
state.appViews[args.tag] = args.param;
}
}
/**
* 删除顶层视图
*
* @param state
* @param args
*/
export const removeView = (state: any, tag: string) => {
if (tag && state.appViews[tag]) {
delete state.appViews[tag];
}
}
\ No newline at end of file
......@@ -18,4 +18,6 @@ export const rootstate: any = {
depDataMap:{},
viewMessage: {},
appGlobal:{},
routeViewGlobal: {},
appViews: {}
}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册