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
import { ViewEngine } from './view-engine';
import { Util } from '../utils';
/**
* 实体选择视图
*
* @export
* @class TabExpViewEngine
* @extends {ViewEngine}
*/
export class TabExpViewEngine extends ViewEngine {
/**
* 分页导航面板实例
*
* @memberof TabExpviewBase
*/
public tabExpPanel: any;
/**
* 初始化引擎
*
* @param {*} options
* @memberof TabExpViewEngine
*/
public init(options: any): void {
this.tabExpPanel = options.tabexppanel;
super.init(options);
}
/**
* @description 获取分页导航面板实例
* @return {*} {*}
* @memberof TabExpViewEngine
*/
getTabExpPanelInstance(): any {
return this.tabExpPanel;
}
/**
* 引擎加载
*
* @memberof TabExpViewEngine
*/
public load(): void {
super.load();
if(this.getTabExpPanelInstance()){
const tag: any = this.getTabExpPanelInstance().name;
this.setViewState2({ tag: tag, action: 'load', viewdata: this.view.context });
}
}
/**
* 加载模型
*
* @memberof TabExpViewEngine
*/
public loadModel() {
const _this = this.view;
if (_this.context[_this.appDeCodeName.toLowerCase()]) {
let tempContext: any = Util.deepCopy(_this.context);
if (tempContext && tempContext.srfsessionid) {
tempContext.srfsessionkey = tempContext.srfsessionid;
delete tempContext.srfsessionid;
}
_this.appEntityService?.getViewData(tempContext, {}, false).then((response: any) => {
if (!response || response.status !== 200) {
_this.$throw(`${response.data?.message ? response.data.message : '发生未知错误!'}`)
return;
}
const { data: _data } = response;
if(_this.viewCtx && _this.viewCtx.view){
_this.viewCtx['viewGlobal']['srfactiveviewdata'] = _data;
// 当前视图为顶层视图
if(_this.viewCtx.topview && Object.is(_this.viewCtx.view._uid,_this.viewCtx.topview._uid)){
_this.$store.commit('addRouteViewGlobal', { tag: _this.context.srfsessionid, param: { srfactiveviewdata: _data } });
}
if(_this.forceRefresh && _this.forceRefresh instanceof Function){
_this.forceRefresh();
}
}
if(_data.srfopprivs){
_this.$store.commit('authresource/setSrfappdeData', { key: `${_this.deName}-${_data[_this.appDeKeyFieldName.toLowerCase()]}`, value: _data.srfopprivs });
}
_this.engine.computeToolbarState(false, _data);
_this.viewState.next({ tag: 'tabexppanel', action: 'loadmodel', data: _data });
if (_data[_this.appDeMajorFieldName.toLowerCase()]) {
_this.model.dataInfo = _data[_this.appDeMajorFieldName.toLowerCase()];
if (_this.$tabPageExp) {
_this.$tabPageExp.setCurPageCaption({
caption: _this.model.srfCaption,
title: _this.model.srfCaption,
info: _this.model.dataInfo,
viewtag: _this.viewtag,
cacheRoutePath: _this.cacheRoutePath
});
}
if (_this.$route) {
_this.$route.meta.info = _this.model.dataInfo;
}
}
})
}
}
/**
* 计算按钮状态
*
* @memberof TabExpViewEngine
*/
public computeToolbarState(state:boolean,data:any){
this.calcToolbarItemState(state);
this.calcToolbarItemAuthState(data);
}
/**
* @description 视图销毁
* @memberof TabExpViewEngine
*/
public destroyed() {
super.destroyed();
this.tabExpPanel = null;
}
}