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
import { Vue, Component, Prop } from 'vue-property-decorator';
import { UIStateService } from '../../../../app-service';
import { LogUtil } from 'ibiz-core';
/**
* 应用内容区底部导航区
*
* @export
* @class AppContentBottomExp
* @extends {Vue}
*/
@Component({})
export class AppContentBottomExp extends Vue {
/**
* UI状态服务
*
* @protected
* @type {UIStateService}
* @memberof AppContentBottomExp
*/
protected uiState: UIStateService = new UIStateService();
/**
* 部件名称
*
* @type {string}
* @memberof AppContentBottomExp
*/
@Prop()
public ctrlName!: string;
/**
* 菜单部件服务
*
* @memberof AppContentBottomExp
*/
@Prop()
protected service!: any;
/**
* 传入数据
*
* @type {any[]}
* @memberof AppContentBottomExp
*/
@Prop({ default: () => [] })
public items!: any[];
/**
* 模型服务对象
*
* @memberof AppStyle2DefaultLayout
*/
@Prop() public modelService!:any;
/**
* 菜单数据
*
* @memberof AppContentBottomExp
*/
protected menus: any[] = [];
/**
* 当前激活项下标
*
* @protected
* @type {number}
* @memberof AppContentBottomExp
*/
protected activeIndex: number = -1;
/**
* 当前激活项
*
* @protected
* @type {*}
* @memberof AppContentBottomExp
*/
protected activeItem: any;
/**
* 组件创建完毕
*
* @memberof AppContentBottomExp
*/
public async created(){
const i: number = this.uiState.layoutState.bottomExpActiveIndex;
await this.replenishData(this.items);
if (this.menus.length >= i+1) {
this.itemClick(this.menus[i], i);
}
}
/**
* 填充数据
*
* @memberof AppContentBottomExp
*/
protected async replenishData(items: any[]){
this.menus = [];
let menus = [...items];
if(menus && menus.length>0){
for(let i = 0; i < menus.length; i++){
if (menus[i].getPSAppFunc) {
const appFuncs: Array<any> = this.service.getAllFuncs();
const appFunc = appFuncs.find((element:any) =>{
return element.appfunctag === menus[i].getPSAppFunc.codeName;
});
if (appFunc && Object.is(appFunc.appFuncType, 'APPVIEW')) {
if(appFunc.getPSAppView){
await appFunc.getPSAppView.fill();
Object.assign(menus[i], { viewname: 'app-view-shell', viewModelData: appFunc.getPSAppView });
}
}
}
}
}
this.menus = menus;
}
/**
* 激活分页
*
* @protected
* @param {string} name
* @memberof AppContentBottomExp
*/
protected activeTab(name: string): void {
try {
const item: any = this.menus[parseInt(name)];
this.itemClick(item, parseInt(name));
} catch (error) {
LogUtil.warn(error);
}
}
/**
* 菜单项点击
*
* @protected
* @param {*} item
* @param {number} index
* @memberof AppContentBottomExp
*/
protected itemClick(item: any, index: number): void {
this.uiState.layoutState.bottomExpActiveIndex = index;
this.activeIndex = index;
this.activeItem = item;
this.activeItem.isActivated = true;
}
/**
* 绘制标题
*
* @protected
* @param {*} h
* @param {*} item
* @returns {*}
* @memberof AppContentBottomExp
*/
protected renderTitle(h: any, item: any): any {
return (
<div title={this.$tl(item.tooltipTag, item.tooltip)} class="tab-exp-title">
<menu-icon item={item} />
{this.$tl(item.captionTag, item.caption)}
</div>
);
}
/**
* 绘制内容
*
* @returns {*}
* @memberof AppContentBottomExp
*/
public render(): any {
return (
<div class="app-content-bottom-exp">
<tabs
size="small"
animated={false}
value={this.activeIndex.toString()}
on-on-click={(name: string) => this.activeTab(name)}
>
{this.menus.map((item: any, i: number) => {
if (item.hidden) {
return;
}
return (
<tabPane label={(h: any) => this.renderTitle(h, item)} name={i.toString()}>
{item.isActivated ? (
<div key={i} class="tab-exp-item-content">
{this.$createElement(item.viewname,{
class: "view-container",
props: {
staticProps: {
viewDefaultUsage: false,
viewModelData: item.viewModelData
}
},
})}
</div>
) : null}
</tabPane>
);
})}
</tabs>
</div>
);
}
}