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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
import { Component } from 'vue-property-decorator';
import { AppServiceBase, Util } from "ibiz-core";
import { AppLoadingService, AppNavHistory } from "../../../../app-service";
import { AppStyle2DefaultLayout } from "../app-style2-default-layout/app-style2-default-layout";
import { IPSAppMenu } from '@ibiz/dynamic-model-api';
@Component({})
export class AppStyle2IndexViewLayout extends AppStyle2DefaultLayout {
/**
* 应用loading服务
*
* @memberof AppLayout
*/
public appLoadingService = AppLoadingService.getInstance();
/**
* 菜单实例
*
* @memberof AppStyle2IndexViewLayout
*/
public menuInstance!: IPSAppMenu;
/**
* 抽屉状态
*
* @type {boolean}
* @memberof AppStyle2IndexViewLayout
*/
public contextMenuDragVisiable: boolean = false;
/**
* 导航服务
*
* @memberof TabPageExpStyle2
*/
protected navHistory: AppNavHistory = AppServiceBase.getInstance().getAppNavDataService();
/**
* 是否显示标题栏
*
* @readonly
* @memberof AppDefaultViewLayout
*/
get showCaption(){
if(this.viewInstance && this.$parent && Util.isExist(this.viewInstance.showCaptionBar)){
return this.viewInstance.showCaptionBar && !(this.$parent as any).noViewCaption
}else{
return true;
}
}
/**
* 路由列表
*
* @memberof AppStyle2IndexViewLayout
*/
get routerList() {
if(this.navHistory?.historyList?.length > 0){
let temp: any = [];
this.navHistory?.historyList.forEach((item: any)=>{
temp.push(item.to.fullPath);
})
return temp;
}else{
return [];
}
}
/**
* 当前主题
*
* @memberof AppStyle2IndexViewLayout
*/
public selectTheme() {
let _this: any = this;
if (_this.$router.app.$store.state.selectTheme) {
return _this.$router.app.$store.state.selectTheme;
} else if (localStorage.getItem('theme-class')) {
return localStorage.getItem('theme-class');
} else {
return 'app-theme-studio-dark';
}
}
/**
* 路由键值
*
* @memberof AppStyle2IndexViewLayout
*/
get routerViewKey() {
let _this: any = this;
return _this.$route.fullPath;
}
/**
* 初始化
*
* @memberof AppStyle2IndexViewLayout
*/
public created() {
document.getElementsByTagName('html')[0].className = this.selectTheme();
this.$uiState.changeLayoutState({
styleMode: 'DEFAULT'
});
}
/**
* 初始化完毕
*
* @memberof AppStyle2IndexViewLayout
*/
public mounted() {
setTimeout(() => {
const el = document.getElementById('app-loading-x');
if (el) {
el.style.display = 'none';
}
}, 300);
}
/**
* 初始化类名
*
* @memberof AppStyle2IndexViewLayout
*/
public initRenderOptions(opts: any = {}) {
this.renderOptions = {};
const { viewType, viewStyle, codeName } = this.viewInstance;
const viewClassNames: any = {
'app-style2-container': true
};
if (viewType) {
Object.assign(viewClassNames, { [viewType?.toLowerCase()]: true });
}
if (viewStyle) {
Object.assign(viewClassNames, { [`app-style-${viewStyle.toLowerCase()}`]: true });
} else {
Object.assign(viewClassNames, { [`app-style-default`]: true });
}
if (codeName) {
Object.assign(viewClassNames, { [Util.srfFilePath2(codeName)]: true });
}
if (this.viewInstance?.getPSSysCss?.()?.cssName) {
Object.assign(viewClassNames, { [this.viewInstance.getPSSysCss()?.cssName]: true });
}
if (!this.showCaption) {
Object.assign(viewClassNames, { 'nocaption': true });
}
Object.assign(viewClassNames, opts);
this.$set(this.renderOptions, 'viewClassNames', viewClassNames);
}
/**
* 绘制内容
*
* @memberof AppStyle2IndexViewLayout
*/
public render(h: any): any {
const { viewClassNames } = this.renderOptions;
if (this.viewInstance && this.viewInstance.mainMenuAlign && Object.is(this.viewInstance.mainMenuAlign, "CENTER")) {
const { codeName } = this.viewInstance;
return (<studio-view
viewName={codeName?.toLowerCase()}
viewTitle={this.model.srfCaption}
viewInstance={this.viewInstance}
viewparams={this.viewparams}
context={this.context}
class={viewClassNames}>
{this.$slots.default}
</studio-view>)
} else {
let leftContent = this.$slots.leftNavMenu;
return (
<div ref="appLayout" class={viewClassNames}>
<app-style2-header>
<template slot="left">
<div class="app-style2-header__left__caption">
{this.viewInstance.enableAppSwitch ? <span class="caption__icon" on-click={() => this.contextMenuDragVisiable = !this.contextMenuDragVisiable}><icon type="md-menu" /> </span> : null}
{this.showCaption ? this.model.srfCaption : null}
</div>
</template>
<template slot="right">
{this.$slots.headerMenus}
{this.$topRenderService.rightItemsRenders.map((fun: any) => fun(h))}
<app-lang title={this.model.srfTitle || this.model.srfCaption}></app-lang>
{<app-orgsector />}
{<app-user viewStyle={this.viewInstance.viewStyle} />}
</template>
</app-style2-header>
{this.viewInstance.enableAppSwitch ? <context-menu-drag viewStyle={this.viewInstance.viewStyle} contextMenuDragVisiable={this.contextMenuDragVisiable}></context-menu-drag> : null}
<div class="app-style2-content">
<div class="app-style2-content__left">{this.$slots.leftNavMenu}</div>
<div class="app-style2-content__right">
<div class="app-style2-content__top">{this.$slots.tabPageExp}</div>
<div class="app-style2-content__body" on-click={() => this.contextMenuDragVisiable = false}>
<app-keep-alive routerList={this.routerList}>
<router-view key={this.routerViewKey}></router-view>
</app-keep-alive>
</div>
</div>
</div>
{ this.viewInstance.defaultPage
? <app-style2-footer v-notification-signal={this.appLoadingService.isLoading} ref="footer" />
: <app-style2-footer ref="footer" />
}
</div>
);
}
}
}