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
import { ViewController } from '@ibiz-template/controller';
import { useNamespace } from '@ibiz-template/vue-util';
import { defineComponent, PropType } from 'vue';
import '@ibiz-template/theme/style/components/layout/view-base/view-base.scss';
export const ViewBase = defineComponent({
props: {
controller: {
type: Object as PropType<ViewController>,
required: true,
},
},
setup() {
const ns = useNamespace('view');
return { ns };
},
render() {
const c = this.controller;
// 外面的插槽同样传给view-layout
const inheritSlots: IData = {};
Object.keys(this.$scopedSlots).forEach(key => {
inheritSlots[key] = (arg: IData) => this.$scopedSlots[key]!(arg);
});
return (
<view-layout
class={[
this.ns.b(),
c.complete && this.ns.b(this.controller.model.typeClass),
c.complete && this.ns.m(this.controller.model.modelClass),
c.complete && this.controller.model.sysCssName,
]}
isComplete={c.complete}
modelData={c.model}
viewMode={c.modal.mode}
isLoading={c.viewLoading.isLoading}
scopedSlots={{
caption: () => {
return (
<div class={this.ns.b('caption')}>
{c.complete && c.model.source.getPSSysImage() ? (
[
<app-icon
class={this.ns.be('caption', 'icon')}
icon={c.model.source.getPSSysImage()}
></app-icon>,
<span
class={this.ns.be('caption', 'text')}
title={c.caption}
>
{c.caption}
</span>,
]
) : (
<span class={this.ns.be('caption', 'text')} title={c.caption}>
{c.caption}
</span>
)}
</div>
);
},
toolbar: () => {
if (c.complete && c.model.toolbar) {
return [
<view-toolbar
modelData={c.model.toolbar}
on-neuronInit={c.nerve.onNeuronInit(
c.model.toolbar.source.name,
)}
toolbarState={c.toolbarState}
viewMode={c.modal.mode}
></view-toolbar>,
];
}
return null;
},
...inheritSlots,
}}
/>
);
},
});