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
import { Vue, Component, Provide, Prop } from 'vue-property-decorator';
import { Subject } from 'rxjs';
import { CreateElement } from 'vue';
@Component({})
export default class ${view.codeName} extends Vue {
/**
* 名称
*
* @type {string}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 视图参数
*
* @type {string}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public viewData: string = '';
/**
* 监听对象
*
* @type {*}
* @memberof SPLBGridView
*/
public viewStateEvent: any;
/**
* 生命周期
*
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public created() {
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) {
return;
}
if (Object.is('load', action)) {
this.viewData = JSON.stringify(data);
}
});
}
}
/**
* vue 生命周期
*
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public destroyed() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
<#if destroyed_block??>
${destroyed_block}
</#if>
}
/**
* 绘制内容
*
* @param {CreateElement} h
* @returns
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public render(h: CreateElement) {
<#if ctrl.getEmbeddedPSAppDEView()??>
<#assign embedview = ctrl.getEmbeddedPSAppDEView()>
return (<${srffilepath2(embedview.codeName)} viewdata={this.viewData}></${srffilepath2(embedview.codeName)}>);
<#else>
return (<div>无嵌入视图</div>);
</#if>
}
}