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
import { MobPickupViewInterface, ModelTool } from 'ibiz-core'
import { MainViewBase } from './main-view-base';
import { IPSAppDEPickupView, IPSDEPickupViewPanel } from '@ibiz/dynamic-model-api';
/**
* 选择视图基类
*
* @export
* @class MobPickUpViewBase
* @extends {MainViewBase}
*/
export class MobPickUpViewBase extends MainViewBase implements MobPickupViewInterface {
/**
* 视图实例
*
* @memberof MobPickUpViewBase
*/
public declare viewInstance: IPSAppDEPickupView;
/**
* 数据选择面板实例
*
* @memberof MobPickUpViewBase
*/
public viewPickUpViewPanelInstance!: IPSDEPickupViewPanel;
/**
* 视图选中数据
*
* @type {any[]}
* @memberof MobPickUpViewBase
*/
public viewSelections: any[] = [];
/**
* 初始化数据选择视图实例
*
* @memberof MobPickUpViewBase
*/
public async viewModelInit() {
this.viewInstance = (this.staticProps?.modeldata) as IPSAppDEPickupView;
await super.viewModelInit();
this.viewPickUpViewPanelInstance = ModelTool.findPSControlByName("pickupviewpanel", this.viewInstance.getPSControls());
}
/**
* 确定
*
* @memberof MobPickUpViewBase
*/
public onClickOk(): void {
this.$emit('view-event', { viewName: this.viewInstance.codeName, action: 'viewDatasChange', data: this.viewSelections })
this.$emit('view-event', { viewName: this.viewInstance.codeName, action: 'close', data: this.viewSelections })
}
/**
* 取消
*
* @memberof MobPickUpViewBase
*/
public onClickCancel(): void {
this.$emit('view-event', { viewName: this.viewInstance.codeName, action: 'close', data: null })
}
/**
* 初始化数据选择视图实例
*
* @memberof MobPickUpViewBase
*/
public renderFooter() {
return <div class="view-footer__buttons" slot="footer">
<app-mob-button
class="button__item "
color="medium"
text={this.$t('app.button.cancel')}
on-click={() => { this.onClickCancel() }} />
<app-mob-button
class="button__item "
text={this.$t('app.button.confirm')}
disabled={this.viewSelections.length === 0}
on-click={() => { this.onClickOk() }} />
</div>
}
/**
* 渲染视图主体内容区
*
* @memberof MobPickUpViewBase
*/
public renderMainContent() {
let { targetCtrlName, targetCtrlParam, targetCtrlEvent }: { targetCtrlName: string, targetCtrlParam: any, targetCtrlEvent: any } = this.computeTargetCtrlData(this.viewPickUpViewPanelInstance);
Object.assign(targetCtrlParam.staticProps, {
isSingleSelect: true
});
return this.$createElement(targetCtrlName, { props: targetCtrlParam, ref: this.viewPickUpViewPanelInstance.name, on: targetCtrlEvent });
}
}