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
import { AppServiceBase } from '../service';
import { LogUtil } from '../utils';
import { EditViewEngine } from './edit-view-engine';
/**
* 视图引擎基础
*
* @export
* @class WFDynaEditViewEngine
* @extends {EditViewEngine}
*/
export class WFDynaEditViewEngine extends EditViewEngine {
/**
* Creates an instance of WFDynaEditViewEngine.
* @memberof WFDynaEditViewEngine
*/
constructor() {
super();
}
/**
* 引擎加载
*
* @param {*} [opts={}]
* @memberof WFDynaEditViewEngine
*/
public load(opts: any = {}): void {
if (this.view.getFormModel && this.view.getFormModel instanceof Function) {
this.view.getFormModel();
}
}
/**
* 部件事件机制
*
* @param {string} ctrlName
* @param {string} eventName
* @param {*} args
* @memberof WFDynaEditViewEngine
*/
public onCtrlEvent(ctrlName: string, eventName: string, args: any): void {
if (Object.is(eventName, 'load')) {
this.onFormLoad(args);
}
}
/**
* 表单加载完成
*
* @param {*} args
* @memberof WFDynaEditViewEngine
*/
public onFormLoad(arg: any): void {
// 设置标题
this.view.model.dataInfo = Object.is(arg.srfuf, '1')
? this.majorPSDEField
? arg[this.majorPSDEField]
: arg.srfmajortext
: this.view.$t('app.local.new');
this.setTabCaption(this.view.model.dataInfo, Object.is(arg.srfuf, '0'));
// 设置已读
if (Object.is(this.view?.viewparams?.srfwf, "toread") || Object.is(this.view?.viewparams?.srfwf, "todo")) {
Object.assign(arg, { taskId: this.view.viewparams.srftaskid });
this.readTask(arg);
}
// 获取工具栏模型
if (this.view.getWFLinkModel && this.view.getWFLinkModel instanceof Function) {
this.view.getWFLinkModel(arg);
}
}
/**
* 将待办任务标记为已读
*
* @param data 业务数据
* @memberof WFDynaEditViewEngine
*/
public readTask(data: any) {
this.view.appEntityService.ReadTask(this.view.context, data).then((response: any) => {
if (!response || response.status !== 200) {
LogUtil.warn(this.view.$t('app.wizardpanel.error'));
return;
}
AppServiceBase.getInstance().getAppMessageCenter().notifyMessage({ name: this.view.appDeCodeName, action: 'appRefresh', data: data });
}).catch((error: any) => {
LogUtil.warn(this.view.$t('app.wizardpanel.error'));
})
}
}