1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
import { LogUtil } from 'ibiz-core';
/**
* 获取部门成员
*
* @param state
*/
export const getDepartmentPersonnel = (state: any) => () => {
return state.departmentPersonnel;
}
/**
* 获取代码表对象
*
* @param state
*/
export const getCodeList = (state: any) => (srfkey: string) => {
return state.codelists.find((_codelist: any) => Object.is(_codelist.srfkey, srfkey));
}
/**
* 获取代码表
*
* @param state
*/
export const getCodeListItems = (state: any) => (srfkey: string) => {
let items: any[] = [];
const codelist = state.codelists.find((_codelist: any) => Object.is(_codelist.srfkey, srfkey));
if (!codelist) {
LogUtil.log(`----${srfkey}----代码表不存在`);
} else {
items = [...codelist.items];
}
return items;
}
/**
* 获取本地应用数据
*
* @param state
*/
export const getLocalData = (state: any) => () => {
return state.localdata;
}
/**
* 获取应用数据
*
* @param state
*/
export const getAppData = (state: any) => () => {
if(!state.appdata){
state.appdata = {};
}
let result:any = JSON.parse(JSON.stringify(state.appdata));
let copyContext:any = result.context?result.context:{};
if(state.localdata && Object.keys(state.localdata).length >0){
Object.assign(copyContext,state.localdata);
}else if(localStorage.getItem('localdata')){
try{
Object.assign(copyContext,JSON.parse(localStorage.getItem('localdata') as string));
}catch(error){
LogUtil.warn(error);
}
}
result.context = copyContext;
return result;
}
/**
* 获取导航标签页面
*
* @param state
*/
export const getPage = (state: any) => (arg: any) => {
let page: any = null;
if (isNaN(arg)) {
const index = state.pageTagList.findIndex((page: any) => Object.is(page.fullPath, arg));
if (index >= 0) {
page = state.pageTagList[index];
}
} else {
page = state.pageTagList[arg];
}
return page;
}
/**
* 获取 z-index
*
* @param state
*/
export const getZIndex = (state: any) => () => {
return state.zIndex;
}
/**
* 获取视图split
*
* @param state
*/
export const getViewSplit = (state: any) => (viewUID: string) => {
return state.viewSplit[viewUID];
}
/**
* 获取单位数据
*
* @param state
*/
export const getOrgData = (state: any) => (srfkey: string) => {
let orgData = state.orgDataMap[srfkey];
return orgData;
}
/**
* 获取部门数据
*
* @param state
*/
export const getDepData = (state: any) => (srfkey: string) => {
let depData = state.depDataMap[srfkey];
return depData;
}
/**
* 获取视图信息
*
* @param state
*/
export const getViewMessage = (state: any) => (tag: string) => {
let id = state.viewMessage[tag];
return id;
}
/**
* 获取指定键值value
*
* @param state
*/
export const getCustomParamByTag = (state: any) => (tag: string) => {
return state.customParam[tag];
}
/**
* 获取全局数据
*
* @param state
*/
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];
}