tianheng-ui 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -18
- package/lib/039af9192b9bb277966ceb4e4ce29c41.js +16 -0
- package/lib/2d84c80112a372bc149cad3464e90fa3.js +1617 -0
- package/lib/5977b934a4c6b480790864ea01303173.js +10834 -0
- package/lib/7745f3e776488705a38e62f85adad54d.js +16 -0
- package/lib/de8dee841ffdaaede3a2254deef30376.js +15395 -0
- package/lib/e78eab250e7f8ccac3d918dfdb06ca10.js +8904 -0
- package/lib/theme-chalk/fonts/PingFang.ttf +0 -0
- package/lib/theme-chalk/fonts/bpmn.eot +0 -0
- package/lib/theme-chalk/fonts/bpmn.svg +224 -0
- package/lib/theme-chalk/fonts/bpmn.ttf +0 -0
- package/lib/theme-chalk/fonts/bpmn.woff +0 -0
- package/lib/theme-chalk/fonts/bpmn.woff2 +0 -0
- package/lib/theme-chalk/fonts/fontawesome-webfont.eot +0 -0
- package/lib/theme-chalk/fonts/fontawesome-webfont.svg +2671 -0
- package/lib/theme-chalk/fonts/fontawesome-webfont.ttf +0 -0
- package/lib/theme-chalk/fonts/fontawesome-webfont.woff +0 -0
- package/lib/theme-chalk/fonts/fontawesome-webfont.woff2 +0 -0
- package/lib/theme-chalk/fonts/iconfont.eot +0 -0
- package/lib/theme-chalk/fonts/iconfont.svg +155 -0
- package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
- package/lib/theme-chalk/fonts/iconfont.woff +0 -0
- package/lib/theme-chalk/fonts/iconfont.woff2 +0 -0
- package/lib/theme-chalk/images/notData.png +0 -0
- package/lib/theme-chalk/index.scss +31 -0
- package/lib/theme-chalk/js/Log.js +99 -0
- package/lib/theme-chalk/js/axios.js +86 -0
- package/lib/theme-chalk/js/store/getters.js +5 -0
- package/lib/theme-chalk/js/store/modules/makingForm.js +21 -0
- package/lib/theme-chalk/js/store/store.js +26 -0
- package/lib/theme-chalk/styles/button.scss +501 -0
- package/lib/theme-chalk/styles/card.scss +29 -0
- package/lib/theme-chalk/styles/cell.scss +54 -0
- package/lib/theme-chalk/styles/codeEditor.scss +9 -0
- package/lib/theme-chalk/styles/col.scss +151 -0
- package/lib/theme-chalk/styles/dialog.scss +56 -0
- package/lib/theme-chalk/styles/empty.scss +22 -0
- package/lib/theme-chalk/styles/feature.scss +46 -0
- package/lib/theme-chalk/styles/font.css +7 -0
- package/lib/theme-chalk/styles/grid.scss +41 -0
- package/lib/theme-chalk/styles/icon.css +1944 -0
- package/lib/theme-chalk/styles/imagePreview.scss +113 -0
- package/lib/theme-chalk/styles/img.scss +35 -0
- package/lib/theme-chalk/styles/reset.scss +17 -0
- package/lib/theme-chalk/styles/root.css +64 -0
- package/lib/theme-chalk/styles/row.scss +23 -0
- package/lib/theme-chalk/styles/upload.scss +744 -0
- package/lib/theme-chalk/styles/variable.scss +80 -0
- package/lib/tianheng-ui.js +116 -0
- package/package.json +86 -48
- package/packages/Button/index.js +8 -0
- package/packages/Button/index.vue +80 -0
- package/packages/Card/index.js +8 -0
- package/packages/Card/index.vue +37 -0
- package/packages/Cell/index.js +8 -0
- package/packages/Cell/index.vue +68 -0
- package/packages/CodeEditor/index.js +8 -0
- package/packages/CodeEditor/index.vue +177 -0
- package/packages/Col/index.js +8 -0
- package/packages/Col/index.vue +43 -0
- package/packages/Dialog/index.js +8 -0
- package/packages/Dialog/index.vue +129 -0
- package/packages/Empty/index.js +8 -0
- package/packages/Empty/index.vue +35 -0
- package/packages/FormMaking/FormConfig.vue +60 -0
- package/packages/FormMaking/GenerateForm.vue +308 -0
- package/packages/FormMaking/GenerateFormItem.vue +887 -0
- package/packages/FormMaking/GenerateFormItemH5.vue +825 -0
- package/packages/FormMaking/Upload/index.vue +572 -0
- package/packages/FormMaking/WidgetConfig.vue +472 -0
- package/packages/FormMaking/WidgetForm.vue +159 -0
- package/packages/FormMaking/WidgetFormItem.vue +187 -0
- package/packages/FormMaking/custom/config.js +762 -0
- package/packages/FormMaking/custom/configs/alliance.vue +0 -0
- package/packages/FormMaking/custom/configs/blank.vue +54 -0
- package/packages/FormMaking/custom/configs/button.vue +172 -0
- package/packages/FormMaking/custom/configs/cascader.vue +175 -0
- package/packages/FormMaking/custom/configs/cell.vue +81 -0
- package/packages/FormMaking/custom/configs/checkbox.vue +234 -0
- package/packages/FormMaking/custom/configs/color.vue +137 -0
- package/packages/FormMaking/custom/configs/date.vue +158 -0
- package/packages/FormMaking/custom/configs/divider.vue +61 -0
- package/packages/FormMaking/custom/configs/editor.vue +71 -0
- package/packages/FormMaking/custom/configs/filler.vue +57 -0
- package/packages/FormMaking/custom/configs/grid.vue +103 -0
- package/packages/FormMaking/custom/configs/image.vue +138 -0
- package/packages/FormMaking/custom/configs/input.vue +176 -0
- package/packages/FormMaking/custom/configs/number.vue +140 -0
- package/packages/FormMaking/custom/configs/radio.vue +211 -0
- package/packages/FormMaking/custom/configs/rate.vue +109 -0
- package/packages/FormMaking/custom/configs/select.vue +305 -0
- package/packages/FormMaking/custom/configs/slider.vue +142 -0
- package/packages/FormMaking/custom/configs/switch.vue +130 -0
- package/packages/FormMaking/custom/configs/table.vue +105 -0
- package/packages/FormMaking/custom/configs/table_h5.vue +102 -0
- package/packages/FormMaking/custom/configs/tabs.vue +175 -0
- package/packages/FormMaking/custom/configs/text.vue +71 -0
- package/packages/FormMaking/custom/configs/textarea.vue +167 -0
- package/packages/FormMaking/custom/configs/time.vue +153 -0
- package/packages/FormMaking/custom/configs/upload.vue +155 -0
- package/packages/FormMaking/custom/index.js +32 -0
- package/packages/FormMaking/custom/items/alliance.vue +132 -0
- package/packages/FormMaking/custom/items/blank.vue +16 -0
- package/packages/FormMaking/custom/items/button.vue +27 -0
- package/packages/FormMaking/custom/items/cascader.vue +29 -0
- package/packages/FormMaking/custom/items/cell.vue +18 -0
- package/packages/FormMaking/custom/items/checkbox.vue +46 -0
- package/packages/FormMaking/custom/items/color.vue +19 -0
- package/packages/FormMaking/custom/items/date.vue +29 -0
- package/packages/FormMaking/custom/items/divider.vue +14 -0
- package/packages/FormMaking/custom/items/editor.vue +22 -0
- package/packages/FormMaking/custom/items/filler.vue +17 -0
- package/packages/FormMaking/custom/items/grid.vue +130 -0
- package/packages/FormMaking/custom/items/image.vue +70 -0
- package/packages/FormMaking/custom/items/input.vue +33 -0
- package/packages/FormMaking/custom/items/login.vue +13 -0
- package/packages/FormMaking/custom/items/number.vue +24 -0
- package/packages/FormMaking/custom/items/radio.vue +44 -0
- package/packages/FormMaking/custom/items/rate.vue +20 -0
- package/packages/FormMaking/custom/items/select.vue +32 -0
- package/packages/FormMaking/custom/items/slider.vue +34 -0
- package/packages/FormMaking/custom/items/switch.vue +22 -0
- package/packages/FormMaking/custom/items/table.vue +106 -0
- package/packages/FormMaking/custom/items/table_h5.vue +126 -0
- package/packages/FormMaking/custom/items/tabs.vue +145 -0
- package/packages/FormMaking/custom/items/text.vue +18 -0
- package/packages/FormMaking/custom/items/textarea.vue +37 -0
- package/packages/FormMaking/custom/items/time.vue +32 -0
- package/packages/FormMaking/custom/items/upload.vue +102 -0
- package/packages/FormMaking/custom/mixins/index.js +61 -0
- package/packages/FormMaking/custom/register.js +18 -0
- package/packages/FormMaking/generate.js +5 -0
- package/packages/FormMaking/iconfont/demo.css +539 -0
- package/packages/FormMaking/iconfont/demo_index.html +1159 -0
- package/packages/FormMaking/iconfont/iconfont.css +189 -0
- package/packages/FormMaking/iconfont/iconfont.eot +0 -0
- package/packages/FormMaking/iconfont/iconfont.js +1 -0
- package/packages/FormMaking/iconfont/iconfont.svg +155 -0
- package/packages/FormMaking/iconfont/iconfont.ttf +0 -0
- package/packages/FormMaking/iconfont/iconfont.woff +0 -0
- package/packages/FormMaking/iconfont/iconfont.woff2 +0 -0
- package/packages/FormMaking/index.js +33 -0
- package/packages/FormMaking/index.vue +807 -0
- package/packages/FormMaking/lang/en-US.js +187 -0
- package/packages/FormMaking/lang/zh-CN.js +187 -0
- package/packages/FormMaking/making.js +9 -0
- package/packages/FormMaking/styles/cover.scss +41 -0
- package/packages/FormMaking/styles/index.scss +785 -0
- package/packages/FormMaking/util/generateCode.js +163 -0
- package/packages/FormMaking/util/index.js +33 -0
- package/packages/FormMaking/util/request.js +28 -0
- package/packages/Grid/index.js +8 -0
- package/packages/Grid/index.vue +21 -0
- package/packages/GridItem/index.js +8 -0
- package/packages/GridItem/index.vue +69 -0
- package/packages/Icons/index.js +8 -0
- package/packages/Icons/index.vue +377 -0
- package/packages/Image/index.js +8 -0
- package/packages/Image/index.vue +146 -0
- package/packages/ImagePreview/index.js +8 -0
- package/packages/ImagePreview/index.vue +386 -0
- package/packages/Row/index.js +8 -0
- package/packages/Row/index.vue +33 -0
- package/packages/Table/action.js +8 -0
- package/packages/Table/action.vue +168 -0
- package/packages/Table/column.vue +63 -0
- package/packages/Table/index.js +8 -0
- package/packages/Table/index.vue +327 -0
- package/packages/Table/search.js +8 -0
- package/packages/Table/search.vue +163 -0
- package/packages/Table/tools.js +8 -0
- package/packages/Table/tools.vue +49 -0
- package/packages/TableMaking/custom/configs/fieldSearch.vue +17 -0
- package/packages/TableMaking/custom/configs/fieldTable.vue +15 -0
- package/packages/TableMaking/custom/items/search/index.vue +158 -0
- package/packages/TableMaking/custom/items/tools/index.vue +49 -0
- package/packages/TableMaking/generate.js +5 -0
- package/packages/TableMaking/generateTable.vue +560 -0
- package/packages/TableMaking/index.vue +234 -0
- package/packages/TableMaking/making.js +5 -0
- package/packages/TableMaking/util/index.js +433 -0
- package/packages/TableMaking/widgetConfig.vue +390 -0
- package/packages/TableMaking/widgetTable.vue +305 -0
- package/packages/Upload/ajax.js +85 -0
- package/packages/Upload/index.js +8 -0
- package/packages/Upload/index.vue +325 -0
- package/packages/Upload/upload-dragger.vue +70 -0
- package/packages/Upload/upload-list.vue +121 -0
- package/packages/Upload/upload.vue +193 -0
- package/packages/VueEditor/index.js +8 -0
- package/packages/VueEditor/index.vue +38 -0
- package/packages/Workflow/Log.js +99 -0
- package/packages/Workflow/designer/ProcessDesigner.vue +628 -0
- package/packages/Workflow/designer/index.js +7 -0
- package/packages/Workflow/designer/plugins/content-pad/contentPadProvider.js +390 -0
- package/packages/Workflow/designer/plugins/content-pad/index.js +6 -0
- package/packages/Workflow/designer/plugins/defaultEmpty.js +24 -0
- package/packages/Workflow/designer/plugins/descriptor/activitiDescriptor.json +1071 -0
- package/packages/Workflow/designer/plugins/descriptor/camundaDescriptor.json +1087 -0
- package/packages/Workflow/designer/plugins/descriptor/flowableDescriptor.json +1215 -0
- package/packages/Workflow/designer/plugins/extension-moddle/activiti/activitiExtension.js +74 -0
- package/packages/Workflow/designer/plugins/extension-moddle/activiti/index.js +9 -0
- package/packages/Workflow/designer/plugins/extension-moddle/camunda/extension.js +148 -0
- package/packages/Workflow/designer/plugins/extension-moddle/camunda/index.js +6 -0
- package/packages/Workflow/designer/plugins/extension-moddle/flowable/flowableExtension.js +74 -0
- package/packages/Workflow/designer/plugins/extension-moddle/flowable/index.js +9 -0
- package/packages/Workflow/designer/plugins/palette/CustomPalette.js +156 -0
- package/packages/Workflow/designer/plugins/palette/index.js +6 -0
- package/packages/Workflow/designer/plugins/palette/paletteProvider.js +160 -0
- package/packages/Workflow/designer/plugins/translate/customTranslate.js +41 -0
- package/packages/Workflow/designer/plugins/translate/zh.js +238 -0
- package/packages/Workflow/highlight/index.js +5 -0
- package/packages/Workflow/index.js +34 -0
- package/packages/Workflow/index.vue +399 -0
- package/packages/Workflow/modules/auto-place/CustomAutoPlace.js +81 -0
- package/packages/Workflow/modules/auto-place/index.js +6 -0
- package/packages/Workflow/modules/custom-renderer/CustomRenderer.js +17 -0
- package/packages/Workflow/modules/custom-renderer/index.js +6 -0
- package/packages/Workflow/modules/rules/CustomRules.js +16 -0
- package/packages/Workflow/modules/rules/index.js +6 -0
- package/packages/Workflow/palette/ProcessPalette.vue +106 -0
- package/packages/Workflow/palette/index.js +7 -0
- package/packages/Workflow/penal/PropertiesPanel.vue +245 -0
- package/packages/Workflow/penal/base/ElementBaseInfo.vue +80 -0
- package/packages/Workflow/penal/flow-condition/FlowCondition.vue +142 -0
- package/packages/Workflow/penal/form/ElementForm.vue +367 -0
- package/packages/Workflow/penal/index.js +7 -0
- package/packages/Workflow/penal/listeners/ElementListeners.vue +299 -0
- package/packages/Workflow/penal/listeners/UserTaskListeners.vue +322 -0
- package/packages/Workflow/penal/listeners/template.js +178 -0
- package/packages/Workflow/penal/listeners/utilSelf.js +64 -0
- package/packages/Workflow/penal/multi-instance/ElementMultiInstance.vue +200 -0
- package/packages/Workflow/penal/other/ElementOtherConfig.vue +59 -0
- package/packages/Workflow/penal/properties/ElementProperties.vue +135 -0
- package/packages/Workflow/penal/signal-message/SignalAndMessage.vue +104 -0
- package/packages/Workflow/penal/task/ElementTask.vue +73 -0
- package/packages/Workflow/penal/task/task-components/ReceiveTask.vue +97 -0
- package/packages/Workflow/penal/task/task-components/ScriptTask.vue +85 -0
- package/packages/Workflow/penal/task/task-components/UserTask.vue +535 -0
- package/packages/Workflow/theme/element-variables.scss +70 -0
- package/packages/Workflow/theme/index.scss +2 -0
- package/packages/Workflow/theme/process-designer.scss +157 -0
- package/packages/Workflow/theme/process-panel.scss +107 -0
- package/packages/Workflow/translations.js +25 -0
- package/packages/Workflow/utils.js +71 -0
- package/packages/index.js +160 -0
- package/babel.config.js +0 -15
- package/index.js +0 -11
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -17
- package/src/App.vue +0 -28
- package/src/assets/logo.png +0 -0
- package/src/components/HelloWorld.vue +0 -58
- package/src/main.js +0 -8
@@ -0,0 +1,825 @@
|
|
1
|
+
<template>
|
2
|
+
<div
|
3
|
+
v-show="!widget.options.hidden"
|
4
|
+
:class="{
|
5
|
+
[widget.model]: true,
|
6
|
+
[widget.type]: true
|
7
|
+
}"
|
8
|
+
:ref="widget.model"
|
9
|
+
>
|
10
|
+
<template v-if="widget.type == 'input'">
|
11
|
+
<van-field
|
12
|
+
v-model="dataModel"
|
13
|
+
:name="prop ? prop : widget.model"
|
14
|
+
:label="widget.options.hideLabel ? '' : widget.name"
|
15
|
+
:label-width="labelWidth"
|
16
|
+
:placeholder="widget.options.placeholder"
|
17
|
+
:required="widget.options.required"
|
18
|
+
colon
|
19
|
+
:rules="widget.rules"
|
20
|
+
/>
|
21
|
+
</template>
|
22
|
+
|
23
|
+
<template v-if="widget.type == 'textarea'">
|
24
|
+
<el-input
|
25
|
+
type="textarea"
|
26
|
+
v-model="dataModel"
|
27
|
+
:disabled="widget.options.disabled"
|
28
|
+
:placeholder="widget.options.placeholder"
|
29
|
+
:style="{ width: widget.options.width }"
|
30
|
+
:maxlength="widget.options.maxlength"
|
31
|
+
:clearable="widget.options.clearable"
|
32
|
+
:show-word-limit="widget.options.showWordLimit"
|
33
|
+
:autosize="{
|
34
|
+
minRows: widget.options.minRows,
|
35
|
+
maxRows: widget.options.maxRows
|
36
|
+
}"
|
37
|
+
@input="handleEventAction(widget.events.onChange)"
|
38
|
+
@focus="handleEventAction(widget.events.onFocus)"
|
39
|
+
@blur="handleEventAction(widget.events.onBlur)"
|
40
|
+
></el-input>
|
41
|
+
</template>
|
42
|
+
|
43
|
+
<template v-if="widget.type == 'cell'">
|
44
|
+
<th-cell
|
45
|
+
:title="widget.options.title"
|
46
|
+
:value="widget.options.value"
|
47
|
+
:label="widget.options.label"
|
48
|
+
></th-cell>
|
49
|
+
</template>
|
50
|
+
|
51
|
+
<template v-if="widget.type == 'number'">
|
52
|
+
<el-input-number
|
53
|
+
v-model="dataModel"
|
54
|
+
:style="{ width: widget.options.width }"
|
55
|
+
:step="widget.options.step"
|
56
|
+
:controls-position="widget.options.controlsPosition ? 'right' : ''"
|
57
|
+
:disabled="widget.options.disabled"
|
58
|
+
:min="widget.options.min"
|
59
|
+
:max="widget.options.max"
|
60
|
+
:precision="widget.options.precision"
|
61
|
+
@change="handleEventAction(widget.events.onChange)"
|
62
|
+
@focus="handleEventAction(widget.events.onFocus)"
|
63
|
+
@blur="handleEventAction(widget.events.onBlur)"
|
64
|
+
></el-input-number>
|
65
|
+
</template>
|
66
|
+
|
67
|
+
<template v-if="widget.type == 'text'">
|
68
|
+
<div
|
69
|
+
:style="{
|
70
|
+
height: widget.options.height,
|
71
|
+
textAlign: widget.options.textAlign
|
72
|
+
}"
|
73
|
+
v-html="dataModel"
|
74
|
+
></div>
|
75
|
+
</template>
|
76
|
+
|
77
|
+
<template v-if="widget.type == 'radio'">
|
78
|
+
<el-radio-group
|
79
|
+
v-model="dataModel"
|
80
|
+
:style="{ width: widget.options.width }"
|
81
|
+
:disabled="widget.options.disabled"
|
82
|
+
@change="handleEventAction(widget.events.onChange)"
|
83
|
+
>
|
84
|
+
<template v-if="widget.options.buttonType">
|
85
|
+
<el-radio-button
|
86
|
+
:style="{
|
87
|
+
display: widget.options.inline ? 'inline-block' : 'block'
|
88
|
+
}"
|
89
|
+
v-for="(item, index) in widget.options.remote
|
90
|
+
? widget.options.remoteOptions
|
91
|
+
: widget.options.options"
|
92
|
+
:key="index"
|
93
|
+
:label="item.value"
|
94
|
+
:border="widget.options.border"
|
95
|
+
>
|
96
|
+
<template v-if="widget.options.remote">{{ item.label }}</template>
|
97
|
+
<template v-else>{{
|
98
|
+
widget.options.showLabel ? item.label : item.value
|
99
|
+
}}</template>
|
100
|
+
</el-radio-button>
|
101
|
+
</template>
|
102
|
+
<template v-else>
|
103
|
+
<el-radio
|
104
|
+
:style="{
|
105
|
+
display: widget.options.inline ? 'inline-block' : 'block'
|
106
|
+
}"
|
107
|
+
:label="item.value"
|
108
|
+
:border="widget.options.border"
|
109
|
+
v-for="(item, index) in widget.options.remote
|
110
|
+
? widget.options.remoteOptions
|
111
|
+
: widget.options.options"
|
112
|
+
:key="index"
|
113
|
+
>
|
114
|
+
<template v-if="widget.options.remote">{{ item.label }}</template>
|
115
|
+
<template v-else>{{
|
116
|
+
widget.options.showLabel ? item.label : item.value
|
117
|
+
}}</template>
|
118
|
+
</el-radio>
|
119
|
+
</template>
|
120
|
+
</el-radio-group>
|
121
|
+
</template>
|
122
|
+
|
123
|
+
<template v-if="widget.type == 'checkbox'">
|
124
|
+
<el-checkbox-group
|
125
|
+
v-model="dataModel"
|
126
|
+
:style="{ width: widget.options.width }"
|
127
|
+
:disabled="widget.options.disabled"
|
128
|
+
:min="widget.options.min"
|
129
|
+
:max="widget.options.max"
|
130
|
+
@change="handleEventAction(widget.events.onChange)"
|
131
|
+
>
|
132
|
+
<template v-if="widget.options.buttonType">
|
133
|
+
<el-checkbox-button
|
134
|
+
:style="{
|
135
|
+
display: widget.options.inline ? 'inline-block' : 'block'
|
136
|
+
}"
|
137
|
+
:label="item.value"
|
138
|
+
:border="widget.options.border"
|
139
|
+
v-for="(item, index) in widget.options.remote
|
140
|
+
? widget.options.remoteOptions
|
141
|
+
: widget.options.options"
|
142
|
+
:key="index"
|
143
|
+
>
|
144
|
+
<template v-if="widget.options.remote">{{ item.label }}</template>
|
145
|
+
<template v-else>{{
|
146
|
+
widget.options.showLabel ? item.label : item.value
|
147
|
+
}}</template>
|
148
|
+
</el-checkbox-button>
|
149
|
+
</template>
|
150
|
+
<template v-else>
|
151
|
+
<el-checkbox
|
152
|
+
:style="{
|
153
|
+
display: widget.options.inline ? 'inline-block' : 'block'
|
154
|
+
}"
|
155
|
+
:label="item.value"
|
156
|
+
:border="widget.options.border"
|
157
|
+
v-for="(item, index) in widget.options.remote
|
158
|
+
? widget.options.remoteOptions
|
159
|
+
: widget.options.options"
|
160
|
+
:key="index"
|
161
|
+
>
|
162
|
+
<template v-if="widget.options.remote">{{ item.label }}</template>
|
163
|
+
<template v-else>{{
|
164
|
+
widget.options.showLabel ? item.label : item.value
|
165
|
+
}}</template>
|
166
|
+
</el-checkbox>
|
167
|
+
</template>
|
168
|
+
</el-checkbox-group>
|
169
|
+
</template>
|
170
|
+
|
171
|
+
<template v-if="widget.type == 'time'">
|
172
|
+
<el-time-picker
|
173
|
+
v-model="dataModel"
|
174
|
+
:style="{ width: widget.options.width }"
|
175
|
+
:is-range="widget.options.isRange"
|
176
|
+
:placeholder="widget.options.placeholder"
|
177
|
+
:start-placeholder="widget.options.startPlaceholder"
|
178
|
+
:end-placeholder="widget.options.endPlaceholder"
|
179
|
+
:readonly="widget.options.readonly"
|
180
|
+
:disabled="widget.options.disabled"
|
181
|
+
:editable="widget.options.editable"
|
182
|
+
:clearable="widget.options.clearable"
|
183
|
+
:arrowControl="widget.options.arrowControl"
|
184
|
+
:value-format="widget.options.format"
|
185
|
+
:picker-options="{
|
186
|
+
selectableRange: `${widget.options.pickerOptions.selectableRange[0]} - ${widget.options.pickerOptions.selectableRange[1]}`
|
187
|
+
}"
|
188
|
+
@change="handleEventAction(widget.events.onChange)"
|
189
|
+
@focus="handleEventAction(widget.events.onFocus)"
|
190
|
+
@blur="handleEventAction(widget.events.onBlur)"
|
191
|
+
>
|
192
|
+
</el-time-picker>
|
193
|
+
</template>
|
194
|
+
|
195
|
+
<template v-if="widget.type == 'date'">
|
196
|
+
<el-date-picker
|
197
|
+
v-model="dataModel"
|
198
|
+
:style="{ width: widget.options.width }"
|
199
|
+
:type="widget.options.type"
|
200
|
+
:is-range="widget.options.isRange"
|
201
|
+
:placeholder="widget.options.placeholder"
|
202
|
+
:start-placeholder="widget.options.startPlaceholder"
|
203
|
+
:end-placeholder="widget.options.endPlaceholder"
|
204
|
+
:readonly="widget.options.readonly"
|
205
|
+
:disabled="widget.options.disabled"
|
206
|
+
:editable="widget.options.editable"
|
207
|
+
:clearable="widget.options.clearable"
|
208
|
+
:value-format="widget.options.format"
|
209
|
+
@change="handleEventAction(widget.events.onChange)"
|
210
|
+
@focus="handleEventAction(widget.events.onFocus)"
|
211
|
+
@blur="handleEventAction(widget.events.onBlur)"
|
212
|
+
>
|
213
|
+
</el-date-picker>
|
214
|
+
</template>
|
215
|
+
|
216
|
+
<template v-if="widget.type == 'select'">
|
217
|
+
<el-select
|
218
|
+
v-model="dataModel"
|
219
|
+
:style="{ width: widget.options.width }"
|
220
|
+
:disabled="widget.options.disabled"
|
221
|
+
:multiple="widget.options.multiple"
|
222
|
+
:clearable="widget.options.clearable"
|
223
|
+
:placeholder="widget.options.placeholder"
|
224
|
+
:collapseTags="widget.options.collapseTags"
|
225
|
+
:allowCreate="widget.options.allowCreate"
|
226
|
+
:filterable="
|
227
|
+
widget.options.allowCreate ? true : widget.options.filterable
|
228
|
+
"
|
229
|
+
@change="handleEventAction(widget.events.onChange)"
|
230
|
+
@focus="handleEventAction(widget.events.onFocus)"
|
231
|
+
@blur="handleEventAction(widget.events.onBlur)"
|
232
|
+
>
|
233
|
+
<el-option
|
234
|
+
v-for="item in widget.options.remote
|
235
|
+
? widget.options.remoteOptions
|
236
|
+
: widget.options.options"
|
237
|
+
:key="item.value"
|
238
|
+
:value="item.value"
|
239
|
+
:label="
|
240
|
+
widget.options.showLabel || widget.options.remote
|
241
|
+
? item.label
|
242
|
+
: item.value
|
243
|
+
"
|
244
|
+
></el-option>
|
245
|
+
</el-select>
|
246
|
+
</template>
|
247
|
+
|
248
|
+
<template v-if="widget.type == 'color'">
|
249
|
+
<el-color-picker
|
250
|
+
v-model="dataModel"
|
251
|
+
:disabled="widget.options.disabled"
|
252
|
+
:show-alpha="widget.options.showAlpha"
|
253
|
+
@change="handleEventAction(widget.events.onChange)"
|
254
|
+
></el-color-picker>
|
255
|
+
</template>
|
256
|
+
|
257
|
+
<template v-if="widget.type == 'switch'">
|
258
|
+
<el-switch
|
259
|
+
v-model="dataModel"
|
260
|
+
:width="widget.options.width - 20"
|
261
|
+
:disabled="widget.options.disabled"
|
262
|
+
:inactive-text="widget.options.switchInactiveText"
|
263
|
+
:active-text="widget.options.switchActiveText"
|
264
|
+
:inactive-color="widget.options.switchInactiveColor"
|
265
|
+
:active-color="widget.options.switchActiveColor"
|
266
|
+
@change="handleEventAction(widget.events.onChange)"
|
267
|
+
>
|
268
|
+
</el-switch>
|
269
|
+
</template>
|
270
|
+
|
271
|
+
<template v-if="widget.type == 'button'">
|
272
|
+
<el-button
|
273
|
+
:style="{
|
274
|
+
width: widget.options.width,
|
275
|
+
height: widget.options.height
|
276
|
+
}"
|
277
|
+
:size="widget.options.buttonSize"
|
278
|
+
:type="widget.options.buttonType"
|
279
|
+
:plain="widget.options.buttonPlain"
|
280
|
+
:round="widget.options.buttonRound"
|
281
|
+
:circle="widget.options.buttonCircle"
|
282
|
+
:loading="widget.options.loading"
|
283
|
+
:disabled="widget.options.disabled"
|
284
|
+
:icon="widget.options.buttonIcon"
|
285
|
+
@click="handleEventAction(widget.events.onClick)"
|
286
|
+
>{{ widget.options.defaultValue }}</el-button
|
287
|
+
>
|
288
|
+
</template>
|
289
|
+
|
290
|
+
<template v-if="widget.type == 'slider'">
|
291
|
+
<el-slider
|
292
|
+
v-model="dataModel"
|
293
|
+
:min="widget.options.min"
|
294
|
+
:max="widget.options.max"
|
295
|
+
:disabled="widget.options.disabled"
|
296
|
+
:step="widget.options.step"
|
297
|
+
:show-input="widget.options.showInput"
|
298
|
+
:range="widget.options.range"
|
299
|
+
:style="{
|
300
|
+
width: widget.options.width,
|
301
|
+
height: widget.options.height
|
302
|
+
}"
|
303
|
+
:show-tooltip="widget.options.showTooltip"
|
304
|
+
:format-tooltip="
|
305
|
+
val => formatTooltip(val, widget.options.formatTooltip)
|
306
|
+
"
|
307
|
+
:show-stops="widget.options.showStops"
|
308
|
+
:vertical="widget.options.vertical"
|
309
|
+
@change="handleEventAction(widget.events.onChange)"
|
310
|
+
></el-slider>
|
311
|
+
</template>
|
312
|
+
|
313
|
+
<template v-if="widget.type == 'rate'">
|
314
|
+
<el-rate
|
315
|
+
v-model="dataModel"
|
316
|
+
:max="widget.options.max"
|
317
|
+
:disabled="widget.options.disabled"
|
318
|
+
:allow-half="widget.options.allowHalf"
|
319
|
+
:show-text="widget.options.showText"
|
320
|
+
:texts="widget.options.auxiliaryValue"
|
321
|
+
@change="handleEventAction(widget.events.onChange)"
|
322
|
+
></el-rate>
|
323
|
+
</template>
|
324
|
+
|
325
|
+
<template v-if="widget.type == 'filler'">
|
326
|
+
<div
|
327
|
+
:style="{
|
328
|
+
width: widget.options.width,
|
329
|
+
height: widget.options.height
|
330
|
+
}"
|
331
|
+
></div>
|
332
|
+
</template>
|
333
|
+
|
334
|
+
<template v-if="widget.type == 'image'">
|
335
|
+
<th-image
|
336
|
+
:src="widget.options.url"
|
337
|
+
:height="widget.options.height"
|
338
|
+
:width="widget.options.width"
|
339
|
+
:fit="widget.options.fit"
|
340
|
+
></th-image>
|
341
|
+
</template>
|
342
|
+
|
343
|
+
<template v-if="widget.type == 'upload'">
|
344
|
+
<el-upload
|
345
|
+
class="upload-demo"
|
346
|
+
:action="widget.options.remoteFunc"
|
347
|
+
:on-preview="
|
348
|
+
file => handlePictureCardPreview(file, widget.options.listType)
|
349
|
+
"
|
350
|
+
:on-remove="handleRemove"
|
351
|
+
:multiple="widget.options.multiple"
|
352
|
+
:limit="widget.options.length"
|
353
|
+
:width="widget.options.size.width"
|
354
|
+
:height="widget.options.size.height"
|
355
|
+
:list-type="widget.options.listType"
|
356
|
+
:on-change="handleAvatar"
|
357
|
+
:on-error="handleAvatarError"
|
358
|
+
:drag="widget.options.drag"
|
359
|
+
:disabled="widget.options.disabled"
|
360
|
+
:auto-upload="false"
|
361
|
+
>
|
362
|
+
<el-button
|
363
|
+
size="small"
|
364
|
+
type="primary"
|
365
|
+
:disabled="widget.options.disabled"
|
366
|
+
v-if="
|
367
|
+
['default', 'picture'].includes(widget.options.listType) &&
|
368
|
+
!widget.options.drag
|
369
|
+
"
|
370
|
+
>点击上传</el-button
|
371
|
+
>
|
372
|
+
<i
|
373
|
+
slot="default"
|
374
|
+
class="el-icon-plus"
|
375
|
+
v-if="
|
376
|
+
widget.options.listType === 'picture-card' && !widget.options.drag
|
377
|
+
"
|
378
|
+
></i>
|
379
|
+
<i class="el-icon-upload" v-if="widget.options.drag"></i>
|
380
|
+
<div class="el-upload__text" v-if="widget.options.drag">
|
381
|
+
将文件拖到此处,或<em>点击上传</em>
|
382
|
+
</div>
|
383
|
+
<div
|
384
|
+
slot="tip"
|
385
|
+
class="el-upload__tip"
|
386
|
+
v-html="widget.options.elUploadTip"
|
387
|
+
></div>
|
388
|
+
</el-upload>
|
389
|
+
</template>
|
390
|
+
|
391
|
+
<template v-if="widget.type == 'editor'">
|
392
|
+
<vue-editor
|
393
|
+
v-model="dataModel"
|
394
|
+
:style="{ width: widget.options.width }"
|
395
|
+
:disabled="widget.options.disabled"
|
396
|
+
>
|
397
|
+
</vue-editor>
|
398
|
+
</template>
|
399
|
+
|
400
|
+
<template v-if="widget.type == 'cascader'">
|
401
|
+
<el-cascader
|
402
|
+
v-model="dataModel"
|
403
|
+
:disabled="widget.options.disabled"
|
404
|
+
:clearable="widget.options.clearable"
|
405
|
+
:placeholder="widget.options.placeholder"
|
406
|
+
:style="{
|
407
|
+
width: widget.options.width,
|
408
|
+
height: widget.options.height
|
409
|
+
}"
|
410
|
+
:options="widget.options.remoteOptions"
|
411
|
+
:props="widget.options.props"
|
412
|
+
:show-all-levels="widget.options.showAllLevels ? false : true"
|
413
|
+
:collapse-tags="widget.options.collapseTags"
|
414
|
+
:filterable="widget.options.filterable"
|
415
|
+
@change="handleEventAction(widget.events.onChange)"
|
416
|
+
>
|
417
|
+
<template slot-scope="{ data }">
|
418
|
+
<span v-html="widget.options.prepend"></span>
|
419
|
+
<span>{{ data.label }}</span>
|
420
|
+
<span v-html="widget.options.append"></span>
|
421
|
+
</template>
|
422
|
+
</el-cascader>
|
423
|
+
</template>
|
424
|
+
|
425
|
+
<template v-if="widget.type == 'blank'">
|
426
|
+
<slot :name="widget.model" />
|
427
|
+
</template>
|
428
|
+
|
429
|
+
<template v-if="widget.type == 'table'">
|
430
|
+
<el-table
|
431
|
+
style="width:100%"
|
432
|
+
:data="dataModel"
|
433
|
+
:stripe="widget.options.stripe"
|
434
|
+
:show-header="widget.options.showHeader"
|
435
|
+
:highlight-current-row="widget.options.highlightCurrentRow"
|
436
|
+
:border="widget.options.border"
|
437
|
+
>
|
438
|
+
<el-table-column
|
439
|
+
v-if="widget.options.isSerial"
|
440
|
+
label="序号"
|
441
|
+
type="index"
|
442
|
+
width="50"
|
443
|
+
align="center"
|
444
|
+
>
|
445
|
+
</el-table-column>
|
446
|
+
<el-table-column
|
447
|
+
v-for="element in widget.list"
|
448
|
+
:key="`table_${element.key}`"
|
449
|
+
:label="element.name"
|
450
|
+
:prop="element.model"
|
451
|
+
:width="element.options.width"
|
452
|
+
>
|
453
|
+
<template slot-scope="scope">
|
454
|
+
<genetate-form-item
|
455
|
+
:models.sync="dataModel[scope.$index]"
|
456
|
+
:widget="element"
|
457
|
+
:remote="remote"
|
458
|
+
:config="config"
|
459
|
+
:prop="`${prop}.${scope.$index}.${element.model}`"
|
460
|
+
:slotKeys="slotKeys"
|
461
|
+
:componentsData="componentsData"
|
462
|
+
>
|
463
|
+
<template v-for="name in slotKeys" :slot="name">
|
464
|
+
<slot :name="name" />
|
465
|
+
</template>
|
466
|
+
</genetate-form-item>
|
467
|
+
</template>
|
468
|
+
</el-table-column>
|
469
|
+
<el-table-column
|
470
|
+
v-if="widget.options.isDelete"
|
471
|
+
fixed="right"
|
472
|
+
label="操作"
|
473
|
+
width="60"
|
474
|
+
align="center"
|
475
|
+
>
|
476
|
+
<template slot-scope="scope">
|
477
|
+
<el-button
|
478
|
+
style="color:#F56C6C"
|
479
|
+
type="text"
|
480
|
+
@click.native.prevent="handleTableDelete(scope.$index)"
|
481
|
+
>
|
482
|
+
移除
|
483
|
+
</el-button>
|
484
|
+
</template>
|
485
|
+
</el-table-column>
|
486
|
+
<template v-if="widget.options.isAdd" slot="append">
|
487
|
+
<div
|
488
|
+
style="text-align: center;"
|
489
|
+
:style="{
|
490
|
+
borderTop:
|
491
|
+
dataModel && dataModel.length != 0 ? '' : '1px solid #EBEEF5'
|
492
|
+
}"
|
493
|
+
>
|
494
|
+
<el-button
|
495
|
+
type="text"
|
496
|
+
:disabled="widget.options.disabled"
|
497
|
+
@click="handleTableAdd"
|
498
|
+
>新增</el-button
|
499
|
+
>
|
500
|
+
</div>
|
501
|
+
</template>
|
502
|
+
</el-table>
|
503
|
+
</template>
|
504
|
+
|
505
|
+
<template v-if="widget.type == 'table_h5'">
|
506
|
+
<div class="tableH5">
|
507
|
+
<div
|
508
|
+
class="tableH5-item"
|
509
|
+
v-for="(column, columnIndex) in dataModel"
|
510
|
+
:key="`table_h5_${columnIndex}`"
|
511
|
+
>
|
512
|
+
<div
|
513
|
+
v-for="(element, elementIndex) in widget.list"
|
514
|
+
:key="`table_h5_${columnIndex}_${element.key}`"
|
515
|
+
>
|
516
|
+
<genetate-form-item
|
517
|
+
style="flex:1;"
|
518
|
+
:models.sync="column"
|
519
|
+
:widget="element"
|
520
|
+
:remote="remote"
|
521
|
+
:config="config"
|
522
|
+
:prop="
|
523
|
+
element.type === 'grid'
|
524
|
+
? `${prop}.${columnIndex}`
|
525
|
+
: `${prop}.${columnIndex}.${element.model}`
|
526
|
+
"
|
527
|
+
:slotKeys="slotKeys"
|
528
|
+
:componentsData="componentsData"
|
529
|
+
>
|
530
|
+
<template v-for="name in slotKeys" :slot="name">
|
531
|
+
<slot :name="name" />
|
532
|
+
</template>
|
533
|
+
</genetate-form-item>
|
534
|
+
<div
|
535
|
+
v-if="
|
536
|
+
widget.options.isDelete &&
|
537
|
+
elementIndex === 0 &&
|
538
|
+
columnIndex >= widget.options.deleteIndex
|
539
|
+
"
|
540
|
+
class="actions"
|
541
|
+
>
|
542
|
+
<el-button
|
543
|
+
type="danger"
|
544
|
+
@click.native.prevent="handleTableDelete(columnIndex)"
|
545
|
+
>{{ widget.options.deleteButtonText }}</el-button
|
546
|
+
>
|
547
|
+
</div>
|
548
|
+
</div>
|
549
|
+
</div>
|
550
|
+
|
551
|
+
<div v-if="widget.options.isAdd" style="text-align: center;">
|
552
|
+
<el-button
|
553
|
+
type="text"
|
554
|
+
:disabled="widget.options.disabled"
|
555
|
+
@click="handleTableAdd"
|
556
|
+
>{{ widget.options.addButtonText }}</el-button
|
557
|
+
>
|
558
|
+
</div>
|
559
|
+
</div>
|
560
|
+
</template>
|
561
|
+
|
562
|
+
<template v-if="widget.type == 'grid'">
|
563
|
+
<el-row
|
564
|
+
type="flex"
|
565
|
+
:gutter="widget.options.gutter ? widget.options.gutter : 0"
|
566
|
+
:justify="widget.options.justify"
|
567
|
+
:align="widget.options.align"
|
568
|
+
>
|
569
|
+
<el-col
|
570
|
+
v-for="(column, columnIndex) in widget.columns"
|
571
|
+
:key="columnIndex"
|
572
|
+
:span="column.span"
|
573
|
+
>
|
574
|
+
<genetate-form-item
|
575
|
+
v-for="element in column.list"
|
576
|
+
:key="element.key"
|
577
|
+
:widget="element"
|
578
|
+
:models="models"
|
579
|
+
:config="config"
|
580
|
+
:remote="remote"
|
581
|
+
:prop="prop ? `${prop}.${element.model}` : element.model"
|
582
|
+
:slotKeys="slotKeys"
|
583
|
+
:componentsData="componentsData"
|
584
|
+
>
|
585
|
+
<template v-for="name in slotKeys" :slot="name">
|
586
|
+
<slot :name="name" />
|
587
|
+
</template>
|
588
|
+
</genetate-form-item>
|
589
|
+
</el-col>
|
590
|
+
</el-row>
|
591
|
+
</template>
|
592
|
+
|
593
|
+
<template v-if="widget.type == 'tabs'">
|
594
|
+
<el-tabs v-model="widget.options.defaultValue">
|
595
|
+
<el-tab-pane
|
596
|
+
v-for="(column, columnIndex) in widget.tabs"
|
597
|
+
:key="`tabs_${columnIndex}`"
|
598
|
+
:label="column.label"
|
599
|
+
:name="column.value"
|
600
|
+
>
|
601
|
+
<genetate-form-item
|
602
|
+
v-for="element in column.list"
|
603
|
+
:key="`tabs_${columnIndex}_${element.key}`"
|
604
|
+
:widget="element"
|
605
|
+
:models.sync="dataModel[column.value]"
|
606
|
+
:config="config"
|
607
|
+
:remote="remote"
|
608
|
+
:prop="
|
609
|
+
element.type === 'grid'
|
610
|
+
? `${prop}.${column.value}`
|
611
|
+
: `${prop}.${column.value}.${element.model}`
|
612
|
+
"
|
613
|
+
:slotKeys="slotKeys"
|
614
|
+
:componentsData="componentsData"
|
615
|
+
>
|
616
|
+
<template v-for="name in slotKeys" :slot="name">
|
617
|
+
<slot :name="name" />
|
618
|
+
</template>
|
619
|
+
</genetate-form-item>
|
620
|
+
</el-tab-pane>
|
621
|
+
</el-tabs>
|
622
|
+
</template>
|
623
|
+
|
624
|
+
<template v-if="widget.type == 'divider'">
|
625
|
+
<el-divider :content-position="widget.options.contentPosition">
|
626
|
+
{{ widget.options.defaultValue }}
|
627
|
+
</el-divider>
|
628
|
+
</template>
|
629
|
+
|
630
|
+
<el-dialog :visible.sync="dialogVisible" append-to-body>
|
631
|
+
<img width="100%" :src="dialogImageUrl" alt="" />
|
632
|
+
</el-dialog>
|
633
|
+
</div>
|
634
|
+
</template>
|
635
|
+
|
636
|
+
<script>
|
637
|
+
import FmUpload from "./Upload";
|
638
|
+
import { VueEditor } from "vue2-editor";
|
639
|
+
import ThCell from "ui/Cell/index.vue";
|
640
|
+
import ThImage from "ui/Image/index.vue";
|
641
|
+
|
642
|
+
export default {
|
643
|
+
name: "genetate-form-item-h5",
|
644
|
+
props: [
|
645
|
+
"widget",
|
646
|
+
"models",
|
647
|
+
"remote",
|
648
|
+
"prop",
|
649
|
+
"slotKeys",
|
650
|
+
"config",
|
651
|
+
"componentsData"
|
652
|
+
],
|
653
|
+
components: { FmUpload, VueEditor, ThCell, ThImage },
|
654
|
+
data() {
|
655
|
+
return {
|
656
|
+
dataModel: this.models[this.widget.model],
|
657
|
+
dialogVisible: false,
|
658
|
+
dialogImageUrl: ""
|
659
|
+
};
|
660
|
+
},
|
661
|
+
watch: {
|
662
|
+
dataModel: {
|
663
|
+
deep: true,
|
664
|
+
handler(val) {
|
665
|
+
this.models[this.widget.model] = val;
|
666
|
+
this.$emit("update:models", {
|
667
|
+
...this.models,
|
668
|
+
[this.widget.model]: val
|
669
|
+
});
|
670
|
+
this.$emit("input-change", val, this.widget.model);
|
671
|
+
}
|
672
|
+
},
|
673
|
+
models: {
|
674
|
+
deep: true,
|
675
|
+
handler(val) {
|
676
|
+
this.dataModel = val[this.widget.model];
|
677
|
+
}
|
678
|
+
}
|
679
|
+
},
|
680
|
+
computed: {
|
681
|
+
labelWidth() {
|
682
|
+
if (this.widget.options.hideLabel) return "0";
|
683
|
+
if (this.widget.options.isLabelWidth)
|
684
|
+
return `${this.widget.options.labelWidth}px`;
|
685
|
+
|
686
|
+
return "";
|
687
|
+
}
|
688
|
+
},
|
689
|
+
created() {
|
690
|
+
if (
|
691
|
+
this.widget.options.remote &&
|
692
|
+
this.remote[this.widget.options.remoteFunc]
|
693
|
+
) {
|
694
|
+
this.remote[this.widget.options.remoteFunc](data => {
|
695
|
+
this.widget.options.remoteOptions = data.map(item => {
|
696
|
+
return {
|
697
|
+
value: item[this.widget.options.props.value],
|
698
|
+
label: item[this.widget.options.props.label],
|
699
|
+
children: item[this.widget.options.props.children]
|
700
|
+
};
|
701
|
+
});
|
702
|
+
});
|
703
|
+
}
|
704
|
+
|
705
|
+
if (
|
706
|
+
this.widget.type === "upload" &&
|
707
|
+
this.remote[this.widget.options.remoteFunc]
|
708
|
+
) {
|
709
|
+
this.remote[this.widget.options.remoteFunc](data => {
|
710
|
+
this.widget.options.remoteApi = data;
|
711
|
+
});
|
712
|
+
}
|
713
|
+
},
|
714
|
+
mounted() {
|
715
|
+
this.$nextTick(() => {
|
716
|
+
this.componentsData[this.widget.model] = this.widget;
|
717
|
+
});
|
718
|
+
},
|
719
|
+
methods: {
|
720
|
+
handleTimePicker(vals) {
|
721
|
+
this.dataModel = [];
|
722
|
+
this.dataModel[0] = vals;
|
723
|
+
this.widget.options.endTimePickerOptions.minTime = vals;
|
724
|
+
},
|
725
|
+
formatTooltip(val, num) {
|
726
|
+
return val / num;
|
727
|
+
},
|
728
|
+
handlePictureCardPreview(file, listType) {
|
729
|
+
if (listType === "picture-card") {
|
730
|
+
this.dialogImageUrl = file.url;
|
731
|
+
this.dialogVisible = true;
|
732
|
+
}
|
733
|
+
},
|
734
|
+
handleRemove(file, fileList) {
|
735
|
+
this.dataModel = {
|
736
|
+
data: fileList,
|
737
|
+
remoteApi: this.widget.options.remoteApi
|
738
|
+
};
|
739
|
+
},
|
740
|
+
handleAvatar(res, file) {
|
741
|
+
this.dataModel = {
|
742
|
+
data: file,
|
743
|
+
remoteApi: this.widget.options.remoteApi
|
744
|
+
};
|
745
|
+
},
|
746
|
+
handleAvatarError() {
|
747
|
+
console.log("上传失败!");
|
748
|
+
},
|
749
|
+
handleTableAdd() {
|
750
|
+
let dic = {};
|
751
|
+
this.widget.list.forEach(item => {
|
752
|
+
if (item.type === "grid") {
|
753
|
+
for (let i = 0; i < item.columns.length; i++) {
|
754
|
+
const element = item.columns[i];
|
755
|
+
for (let j = 0; j < element.list.length; j++) {
|
756
|
+
const element2 = element.list[j];
|
757
|
+
dic[element2.model] = element2.options.defaultValue;
|
758
|
+
}
|
759
|
+
}
|
760
|
+
} else {
|
761
|
+
dic[item.model] = item.options.defaultValue;
|
762
|
+
}
|
763
|
+
});
|
764
|
+
this.dataModel.push(dic);
|
765
|
+
},
|
766
|
+
handleTableDelete(index) {
|
767
|
+
this.dataModel.splice(index, 1);
|
768
|
+
},
|
769
|
+
|
770
|
+
// 支撑 JavaScript 动态编译
|
771
|
+
handleEventAction(key) {
|
772
|
+
if (!key) return;
|
773
|
+
const eventScript = this.config.eventScript;
|
774
|
+
for (let i = 0; i < eventScript.length; i++) {
|
775
|
+
const element = eventScript[i];
|
776
|
+
if (element.key === key) {
|
777
|
+
const func = `(item,value)=>{${element.func}}`;
|
778
|
+
eval(func)(this.widget, this.dataModel);
|
779
|
+
}
|
780
|
+
}
|
781
|
+
},
|
782
|
+
// 显示组件
|
783
|
+
display(keys) {
|
784
|
+
if (!keys || keys.length === 0) return;
|
785
|
+
for (let i = 0; i < keys.length; i++) {
|
786
|
+
const key = keys[i];
|
787
|
+
if (this.componentsData[key]) {
|
788
|
+
this.componentsData[key].options.hidden = false;
|
789
|
+
}
|
790
|
+
}
|
791
|
+
},
|
792
|
+
// 隐藏组件
|
793
|
+
hide(keys) {
|
794
|
+
if (!keys || keys.length === 0) return;
|
795
|
+
for (let i = 0; i < keys.length; i++) {
|
796
|
+
const key = keys[i];
|
797
|
+
if (this.componentsData[key]) {
|
798
|
+
this.componentsData[key].options.hidden = true;
|
799
|
+
}
|
800
|
+
}
|
801
|
+
},
|
802
|
+
// 设置数据,仅支持修改当前组件节点下的数据
|
803
|
+
setData(obj) {
|
804
|
+
const keys = Object.keys(obj);
|
805
|
+
for (let i = 0; i < keys.length; i++) {
|
806
|
+
const arr = keys[i].split(".");
|
807
|
+
if (arr.length === 1) {
|
808
|
+
const key = keys[i];
|
809
|
+
const value = obj[key];
|
810
|
+
this.$set(this.models, key, value);
|
811
|
+
} else {
|
812
|
+
const key = arr.pop();
|
813
|
+
const value = obj[keys[i]];
|
814
|
+
const path = arr.join(".");
|
815
|
+
this.$set(eval(`this.models.${path}`), key, value);
|
816
|
+
}
|
817
|
+
}
|
818
|
+
},
|
819
|
+
// 获取数据,仅支持获取当前组件节点下的数据
|
820
|
+
getData() {
|
821
|
+
return this.models;
|
822
|
+
}
|
823
|
+
}
|
824
|
+
};
|
825
|
+
</script>
|