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
import { MainViewInterface } from 'ibiz-core';
import { ViewBase } from './view-base';
import { IPSAppDataEntity, IPSAppDEView } from '@ibiz/dynamic-model-api';
/**
* 主数据视图基类
*
* @export
* @class MainViewBase
* @extends {ViewBase}
* @implements {MainViewInterface}
*/
export class MainViewBase extends ViewBase implements MainViewInterface {
/**
* 视图实例
*
* @memberof MainViewBase
*/
public declare viewInstance: any;
/**
* 视图初始化
*
* @memberof MainViewBase
*/
public viewInit() {
super.viewInit();
this.opendata = this.opendata.bind(this);
this.newdata = this.newdata.bind(this);
}
/**
* @description 视图销毁
* @memberof MainViewBase
*/
public viewDestroyed() {
super.viewDestroyed();
if (this.engine) {
this.engine.destroyed();
}
}
/**
* 处理指定视图控制关系将父键转为父实体上下文
*
* @memberof MainViewBase
*/
public async handleviewRes() {
if ((this.viewInstance as IPSAppDEView)?.getParentPSAppDataEntity?.()) {
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
const parentEntityCodeName = ((this
.viewInstance as IPSAppDEView).getParentPSAppDataEntity() as IPSAppDataEntity).codeName.toLowerCase();
if (this.context.srfparentkey) {
Object.assign(this.context, { [parentEntityCodeName]: this.context.srfparentkey });
} else if (this.viewparams.srfparentkey) {
Object.assign(this.context, { [parentEntityCodeName]: this.viewparams.srfparentkey });
}
}
}
}