tianheng-ui 0.1.0 → 0.1.2
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 +229 -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,472 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="widgetConfig" v-if="show">
|
3
|
+
<component
|
4
|
+
:widget="data"
|
5
|
+
:config="config"
|
6
|
+
:remoteApis="remoteApis"
|
7
|
+
:is="compsData[data.type].content"
|
8
|
+
@events-show="handleEventDialogShow"
|
9
|
+
@events-edit="handleEventsCollapseClick"
|
10
|
+
></component>
|
11
|
+
|
12
|
+
<th-dialog
|
13
|
+
title="动作设置"
|
14
|
+
v-model="eventsDialog.visible"
|
15
|
+
:modal-append-to-body="false"
|
16
|
+
@on-fullscreen="$refs.codeEditor && $refs.codeEditor.resize()"
|
17
|
+
>
|
18
|
+
<div class="eventsSetting">
|
19
|
+
<div class="list">
|
20
|
+
<div class="list-header" @click="handleAddEvent">
|
21
|
+
<div>动作库</div>
|
22
|
+
<el-button type="text" icon="el-icon-plus" size="mini"
|
23
|
+
>添加</el-button
|
24
|
+
>
|
25
|
+
</div>
|
26
|
+
<div
|
27
|
+
class="list-item"
|
28
|
+
v-for="(item, index) in eventsDialog.eventScript"
|
29
|
+
:key="item.key"
|
30
|
+
@click="eventsDialog.active = item"
|
31
|
+
>
|
32
|
+
<div class="list-item-title">Function</div>
|
33
|
+
<div class="list-item-value">{{ item.name }}</div>
|
34
|
+
<i
|
35
|
+
class="el-icon-delete"
|
36
|
+
@click.stop="handleEventDialogDelete(item, index)"
|
37
|
+
></i>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
<div class="detail" v-if="eventsDialog.active">
|
41
|
+
<div>
|
42
|
+
<span>Function Name</span>
|
43
|
+
<el-input
|
44
|
+
v-model="eventsDialog.active.name"
|
45
|
+
placeholder="请输入动作名称"
|
46
|
+
size="small"
|
47
|
+
:disabled="
|
48
|
+
eventsDialog.active.name === 'mounted' ||
|
49
|
+
eventsDialog.active.name === 'refresh'
|
50
|
+
"
|
51
|
+
></el-input>
|
52
|
+
</div>
|
53
|
+
<div>
|
54
|
+
<div>
|
55
|
+
function(
|
56
|
+
{{
|
57
|
+
eventsDialog.active.name !== "mounted" &&
|
58
|
+
eventsDialog.active.name !== "refresh"
|
59
|
+
? "item,value"
|
60
|
+
: ""
|
61
|
+
}}
|
62
|
+
) {
|
63
|
+
|
64
|
+
<el-popover
|
65
|
+
placement="top-start"
|
66
|
+
title="可用Api"
|
67
|
+
width="200"
|
68
|
+
trigger="hover"
|
69
|
+
>
|
70
|
+
<i
|
71
|
+
style="float: right;"
|
72
|
+
slot="reference"
|
73
|
+
class="el-icon-question"
|
74
|
+
></i>
|
75
|
+
<div class="functions">
|
76
|
+
<div>setData</div>
|
77
|
+
<div>getData</div>
|
78
|
+
<div>display</div>
|
79
|
+
<div>hide</div>
|
80
|
+
</div>
|
81
|
+
</el-popover>
|
82
|
+
</div>
|
83
|
+
<th-code-editor
|
84
|
+
style="height:calc(100% - 48px)"
|
85
|
+
v-model="eventsDialog.active.func"
|
86
|
+
:completions="aceCompletions"
|
87
|
+
ref="codeEditor"
|
88
|
+
></th-code-editor>
|
89
|
+
<div>}</div>
|
90
|
+
</div>
|
91
|
+
</div>
|
92
|
+
</div>
|
93
|
+
<span slot="footer" class="dialog-footer">
|
94
|
+
<el-button size="small" @click="eventsDialog.visible = false"
|
95
|
+
>取 消</el-button
|
96
|
+
>
|
97
|
+
<el-button type="primary" size="small" @click="handleEventDialogAffirm"
|
98
|
+
>保 存</el-button
|
99
|
+
>
|
100
|
+
</span>
|
101
|
+
</th-dialog>
|
102
|
+
</div>
|
103
|
+
</template>
|
104
|
+
|
105
|
+
<script>
|
106
|
+
import compsData from "./custom/register";
|
107
|
+
import ThDialog from "ui/Dialog/index.vue";
|
108
|
+
import ThCodeEditor from "ui/CodeEditor/index.vue";
|
109
|
+
export default {
|
110
|
+
components: { ThDialog, ThCodeEditor },
|
111
|
+
props: {
|
112
|
+
data: {
|
113
|
+
type: Object,
|
114
|
+
default: () => {
|
115
|
+
return {};
|
116
|
+
}
|
117
|
+
},
|
118
|
+
remoteApis: {
|
119
|
+
type: Array,
|
120
|
+
default: () => {
|
121
|
+
return [];
|
122
|
+
}
|
123
|
+
},
|
124
|
+
config: {
|
125
|
+
type: Object,
|
126
|
+
default: () => {
|
127
|
+
return {};
|
128
|
+
}
|
129
|
+
}
|
130
|
+
},
|
131
|
+
data() {
|
132
|
+
return {
|
133
|
+
compsData: JSON.parse(JSON.stringify(compsData)),
|
134
|
+
validator: {
|
135
|
+
type: null,
|
136
|
+
required: null,
|
137
|
+
pattern: null,
|
138
|
+
range: null,
|
139
|
+
length: null
|
140
|
+
},
|
141
|
+
eventsDialog: {
|
142
|
+
visible: false,
|
143
|
+
eventScript: [],
|
144
|
+
active: null
|
145
|
+
},
|
146
|
+
aceCompletions: [
|
147
|
+
{
|
148
|
+
meta: "设置数据",
|
149
|
+
caption: "setData",
|
150
|
+
value: "setData({ })",
|
151
|
+
score: 1
|
152
|
+
},
|
153
|
+
{
|
154
|
+
meta: "获取数据",
|
155
|
+
caption: "getData",
|
156
|
+
value: "getData()",
|
157
|
+
score: 1
|
158
|
+
},
|
159
|
+
{
|
160
|
+
meta: "显示组件",
|
161
|
+
caption: "display",
|
162
|
+
value: "display([ ])",
|
163
|
+
score: 1
|
164
|
+
},
|
165
|
+
{
|
166
|
+
meta: "隐藏组件",
|
167
|
+
caption: "hide",
|
168
|
+
value: "hide([ ])",
|
169
|
+
score: 1
|
170
|
+
}
|
171
|
+
]
|
172
|
+
};
|
173
|
+
},
|
174
|
+
computed: {
|
175
|
+
show() {
|
176
|
+
if (this.data && Object.keys(this.data).length > 0) {
|
177
|
+
return true;
|
178
|
+
}
|
179
|
+
return false;
|
180
|
+
}
|
181
|
+
},
|
182
|
+
created() {
|
183
|
+
const keys = Object.keys(this.compsData);
|
184
|
+
for (const key of keys) {
|
185
|
+
this.compsData[key].content = require(`./custom/configs/${key}`).default;
|
186
|
+
}
|
187
|
+
},
|
188
|
+
methods: {
|
189
|
+
generateRule() {
|
190
|
+
this.data.rules = [];
|
191
|
+
Object.keys(this.validator).forEach(key => {
|
192
|
+
if (this.validator[key]) {
|
193
|
+
this.data.rules.push(this.validator[key]);
|
194
|
+
}
|
195
|
+
});
|
196
|
+
},
|
197
|
+
|
198
|
+
validateRequired(val) {
|
199
|
+
if (val) {
|
200
|
+
this.validator.required = {
|
201
|
+
required: true,
|
202
|
+
message: `${this.data.name}必须填写`
|
203
|
+
};
|
204
|
+
} else {
|
205
|
+
this.validator.required = null;
|
206
|
+
}
|
207
|
+
|
208
|
+
this.$nextTick(() => {
|
209
|
+
this.generateRule();
|
210
|
+
});
|
211
|
+
},
|
212
|
+
|
213
|
+
validateDataType(val) {
|
214
|
+
if (!this.show) {
|
215
|
+
return false;
|
216
|
+
}
|
217
|
+
|
218
|
+
if (val) {
|
219
|
+
this.validator.type = {
|
220
|
+
type: val,
|
221
|
+
message: this.data.name + "格式不正确"
|
222
|
+
};
|
223
|
+
} else {
|
224
|
+
this.validator.type = null;
|
225
|
+
}
|
226
|
+
|
227
|
+
this.generateRule();
|
228
|
+
},
|
229
|
+
valiatePattern(val) {
|
230
|
+
if (!this.show) {
|
231
|
+
return false;
|
232
|
+
}
|
233
|
+
|
234
|
+
if (val) {
|
235
|
+
this.validator.pattern = {
|
236
|
+
pattern: val,
|
237
|
+
message: this.data.name + "格式不匹配"
|
238
|
+
};
|
239
|
+
} else {
|
240
|
+
this.validator.pattern = null;
|
241
|
+
}
|
242
|
+
|
243
|
+
this.generateRule();
|
244
|
+
},
|
245
|
+
handleInputNumberChange() {
|
246
|
+
if (this.data.options.minRows > this.data.options.maxRows) {
|
247
|
+
this.data.options.maxRows = this.data.options.minRows;
|
248
|
+
}
|
249
|
+
},
|
250
|
+
handleImguploadType(val) {
|
251
|
+
if (val == "picture-card") {
|
252
|
+
this.data.options.drag = false;
|
253
|
+
}
|
254
|
+
},
|
255
|
+
handleImguploadDrag(val) {
|
256
|
+
if (val) {
|
257
|
+
this.data.options.listType = "default";
|
258
|
+
}
|
259
|
+
},
|
260
|
+
handleEventDialogShow() {
|
261
|
+
this.eventsDialog = {
|
262
|
+
visible: true,
|
263
|
+
eventScript: JSON.parse(JSON.stringify(this.config.eventScript)),
|
264
|
+
active: null
|
265
|
+
};
|
266
|
+
},
|
267
|
+
handleAddEvent() {
|
268
|
+
const key = new Date().getTime();
|
269
|
+
const dic = {
|
270
|
+
key: key,
|
271
|
+
name: key,
|
272
|
+
func: ""
|
273
|
+
};
|
274
|
+
this.eventsDialog.eventScript.push(dic);
|
275
|
+
this.eventsDialog.active = dic;
|
276
|
+
},
|
277
|
+
handleEventDialogAffirm() {
|
278
|
+
this.config.eventScript = this.eventsDialog.eventScript;
|
279
|
+
this.eventsDialog = {
|
280
|
+
visible: false,
|
281
|
+
eventScript: [],
|
282
|
+
active: null
|
283
|
+
};
|
284
|
+
},
|
285
|
+
handleEventDialogDelete(item, index) {
|
286
|
+
this.$confirm(`确定要删除该方法 ${item.name} ?`, "", {
|
287
|
+
confirmButtonText: "确定",
|
288
|
+
cancelButtonText: "取消",
|
289
|
+
type: "warning"
|
290
|
+
})
|
291
|
+
.then(() => {
|
292
|
+
if (
|
293
|
+
this.eventsDialog.active &&
|
294
|
+
item.key === this.eventsDialog.active.key
|
295
|
+
) {
|
296
|
+
this.eventsDialog.active = null;
|
297
|
+
}
|
298
|
+
this.eventsDialog.eventScript.splice(index, 1);
|
299
|
+
})
|
300
|
+
.catch();
|
301
|
+
},
|
302
|
+
handleEventsCollapseClick(eventKey) {
|
303
|
+
for (let i = 0; i < this.config.eventScript.length; i++) {
|
304
|
+
const event = this.config.eventScript[i];
|
305
|
+
if (event.key === eventKey) {
|
306
|
+
const eventScript = JSON.parse(
|
307
|
+
JSON.stringify(this.config.eventScript)
|
308
|
+
);
|
309
|
+
this.eventsDialog = {
|
310
|
+
visible: true,
|
311
|
+
eventScript: eventScript,
|
312
|
+
active: eventScript[i]
|
313
|
+
};
|
314
|
+
break;
|
315
|
+
}
|
316
|
+
}
|
317
|
+
}
|
318
|
+
},
|
319
|
+
watch: {
|
320
|
+
"data.options.isRange": function(val) {
|
321
|
+
if (typeof val !== "undefined") {
|
322
|
+
if (val) {
|
323
|
+
this.data.options.defaultValue = null;
|
324
|
+
} else {
|
325
|
+
if (Object.keys(this.data.options).indexOf("defaultValue") >= 0)
|
326
|
+
this.data.options.defaultValue = "";
|
327
|
+
}
|
328
|
+
}
|
329
|
+
},
|
330
|
+
"data.options.required": function(val) {
|
331
|
+
this.validateRequired(val);
|
332
|
+
},
|
333
|
+
"data.options.dataType": function(val) {
|
334
|
+
this.validateDataType(val);
|
335
|
+
},
|
336
|
+
"data.options.pattern": function(val) {
|
337
|
+
this.valiatePattern(val);
|
338
|
+
},
|
339
|
+
"data.name": function(val) {
|
340
|
+
if (this.data.options) {
|
341
|
+
this.validateRequired(this.data.options.required);
|
342
|
+
this.validateDataType(this.data.options.dataType);
|
343
|
+
this.valiatePattern(this.data.options.pattern);
|
344
|
+
}
|
345
|
+
}
|
346
|
+
}
|
347
|
+
};
|
348
|
+
</script>
|
349
|
+
|
350
|
+
<style lang="less" scoped>
|
351
|
+
.widgetConfig {
|
352
|
+
.remoteApis {
|
353
|
+
width: 100%;
|
354
|
+
margin-bottom: 6px;
|
355
|
+
|
356
|
+
/deep/ .el-input--prefix .el-input__inner {
|
357
|
+
padding-left: 85px;
|
358
|
+
}
|
359
|
+
|
360
|
+
/deep/ .el-input__prefix {
|
361
|
+
left: 0;
|
362
|
+
width: 75px;
|
363
|
+
color: #999;
|
364
|
+
}
|
365
|
+
}
|
366
|
+
|
367
|
+
.el-dialog__body {
|
368
|
+
padding: 20px;
|
369
|
+
}
|
370
|
+
|
371
|
+
.eventsSetting {
|
372
|
+
height: 100%;
|
373
|
+
display: flex;
|
374
|
+
border: 1px solid #eee;
|
375
|
+
|
376
|
+
.list {
|
377
|
+
width: 270px;
|
378
|
+
min-height: 430px;
|
379
|
+
overflow-y: overlay;
|
380
|
+
border-right: 1px solid #eee;
|
381
|
+
|
382
|
+
.list-header {
|
383
|
+
position: sticky;
|
384
|
+
top: 0;
|
385
|
+
display: flex;
|
386
|
+
align-items: center;
|
387
|
+
justify-content: space-between;
|
388
|
+
padding: 5px;
|
389
|
+
line-height: 30px;
|
390
|
+
border-bottom: 1px solid #eee;
|
391
|
+
background: #f2f6fc;
|
392
|
+
}
|
393
|
+
|
394
|
+
.list-item {
|
395
|
+
display: flex;
|
396
|
+
// align-items: center;
|
397
|
+
margin: 5px;
|
398
|
+
padding: 10px;
|
399
|
+
border-radius: 3px;
|
400
|
+
border: 1px solid #dcdfe6;
|
401
|
+
transition: 0.25s;
|
402
|
+
|
403
|
+
.list-item-title {
|
404
|
+
color: var(--th-green);
|
405
|
+
}
|
406
|
+
.list-item-value {
|
407
|
+
flex: 1;
|
408
|
+
padding: 0 5px;
|
409
|
+
}
|
410
|
+
i {
|
411
|
+
cursor: pointer;
|
412
|
+
}
|
413
|
+
}
|
414
|
+
|
415
|
+
.list-item:hover {
|
416
|
+
background-color: #f2f6fc;
|
417
|
+
}
|
418
|
+
}
|
419
|
+
|
420
|
+
.detail {
|
421
|
+
flex: 1;
|
422
|
+
padding: 10px;
|
423
|
+
|
424
|
+
> div:nth-child(1) {
|
425
|
+
position: relative;
|
426
|
+
display: flex;
|
427
|
+
align-items: center;
|
428
|
+
margin-bottom: 20px;
|
429
|
+
padding-left: 10px;
|
430
|
+
|
431
|
+
/deep/ .el-input {
|
432
|
+
flex: 1;
|
433
|
+
margin-left: 10px;
|
434
|
+
}
|
435
|
+
}
|
436
|
+
|
437
|
+
> div:nth-child(1)::after {
|
438
|
+
content: "*";
|
439
|
+
position: absolute;
|
440
|
+
left: 0;
|
441
|
+
color: red;
|
442
|
+
}
|
443
|
+
|
444
|
+
> div:nth-child(2) {
|
445
|
+
height: calc(100% - 48px);
|
446
|
+
> div:nth-child(1) {
|
447
|
+
margin-bottom: 10px;
|
448
|
+
color: var(--th-blue);
|
449
|
+
}
|
450
|
+
|
451
|
+
> div:nth-child(3) {
|
452
|
+
margin-top: 10px;
|
453
|
+
color: var(--th-blue);
|
454
|
+
}
|
455
|
+
}
|
456
|
+
}
|
457
|
+
}
|
458
|
+
.selectableRange {
|
459
|
+
width: 100%;
|
460
|
+
|
461
|
+
/deep/ .el-range-separator {
|
462
|
+
width: 20px;
|
463
|
+
}
|
464
|
+
}
|
465
|
+
|
466
|
+
.functions {
|
467
|
+
span {
|
468
|
+
margin: 0 5px;
|
469
|
+
}
|
470
|
+
}
|
471
|
+
}
|
472
|
+
</style>
|
@@ -0,0 +1,159 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="widget-form-container" ref="formContainer">
|
3
|
+
<!-- <div v-if="data.list.length == 0" class="form-empty">
|
4
|
+
从左侧拖拽来添加字段
|
5
|
+
</div> -->
|
6
|
+
<th-empty
|
7
|
+
class="form-empty"
|
8
|
+
v-if="data.list.length == 0"
|
9
|
+
:image="require('@/assets/images/notData.png')"
|
10
|
+
description="从左侧拖拽来添加字段"
|
11
|
+
></th-empty>
|
12
|
+
<el-form
|
13
|
+
:class="{ 'form-hideLabel': data.config.hideLabel }"
|
14
|
+
style="margin: 0 auto;padding:5px;height:100%;"
|
15
|
+
:style="{ width: formWidth }"
|
16
|
+
:size="data.config.size"
|
17
|
+
:label-suffix="data.config.labelSuffix"
|
18
|
+
:label-position="data.config.labelPosition"
|
19
|
+
:label-width="`${data.config.labelWidth}px`"
|
20
|
+
:disabled="data.config.disabled"
|
21
|
+
>
|
22
|
+
<draggable
|
23
|
+
style="height:100%"
|
24
|
+
v-model="data.list"
|
25
|
+
v-bind="{
|
26
|
+
group: 'people',
|
27
|
+
ghostClass: 'ghost',
|
28
|
+
animation: 200,
|
29
|
+
handle: '.drag-widget'
|
30
|
+
}"
|
31
|
+
@end="handleMoveEnd"
|
32
|
+
@add="handleWidgetAdd"
|
33
|
+
>
|
34
|
+
<transition-group name="fade" tag="div" class="widget-form-list">
|
35
|
+
<widget-form-item
|
36
|
+
v-for="(element, elementIndex) in widgetList"
|
37
|
+
:key="element.key"
|
38
|
+
:widget="element"
|
39
|
+
:widgetIndex="elementIndex"
|
40
|
+
:widgetArray="data"
|
41
|
+
:config="data.config"
|
42
|
+
:select.sync="selectWidget"
|
43
|
+
></widget-form-item>
|
44
|
+
</transition-group>
|
45
|
+
</draggable>
|
46
|
+
</el-form>
|
47
|
+
</div>
|
48
|
+
</template>
|
49
|
+
|
50
|
+
<script>
|
51
|
+
import Draggable from "vuedraggable";
|
52
|
+
import WidgetFormItem from "./WidgetFormItem";
|
53
|
+
import ThEmpty from "ui/Empty/index.vue";
|
54
|
+
|
55
|
+
export default {
|
56
|
+
components: { Draggable, WidgetFormItem, ThEmpty },
|
57
|
+
props: ["data", "select", "client"],
|
58
|
+
data() {
|
59
|
+
return {
|
60
|
+
selectWidget: this.select,
|
61
|
+
config: {}
|
62
|
+
};
|
63
|
+
},
|
64
|
+
watch: {
|
65
|
+
select(val) {
|
66
|
+
this.selectWidget = val;
|
67
|
+
},
|
68
|
+
selectWidget: {
|
69
|
+
handler(val) {
|
70
|
+
this.$emit("update:select", val);
|
71
|
+
},
|
72
|
+
deep: true
|
73
|
+
}
|
74
|
+
},
|
75
|
+
computed: {
|
76
|
+
widgetList() {
|
77
|
+
return this.data.list.filter(item => {
|
78
|
+
return item.key;
|
79
|
+
});
|
80
|
+
},
|
81
|
+
formWidth() {
|
82
|
+
if (this.data.config.width) return this.data.config.width;
|
83
|
+
if (this.client === "mobile") return "375px";
|
84
|
+
|
85
|
+
return "";
|
86
|
+
}
|
87
|
+
},
|
88
|
+
mounted() {
|
89
|
+
document.body.ondrop = function(event) {
|
90
|
+
let s = navigator.userAgent;
|
91
|
+
let isFirefox =
|
92
|
+
typeof s === "string"
|
93
|
+
? s.toLowerCase().indexOf("firefox") > -1
|
94
|
+
: s.indexOf("firefox") > -1;
|
95
|
+
if (isFirefox) {
|
96
|
+
event.preventDefault();
|
97
|
+
event.stopPropagation();
|
98
|
+
}
|
99
|
+
};
|
100
|
+
},
|
101
|
+
methods: {
|
102
|
+
handleMoveEnd({ newIndex, oldIndex }) {},
|
103
|
+
handleSelectWidget(index) {
|
104
|
+
this.selectWidget = this.data.list[index];
|
105
|
+
},
|
106
|
+
handleWidgetAdd(evt) {
|
107
|
+
const newIndex = evt.newIndex;
|
108
|
+
const to = evt.to;
|
109
|
+
|
110
|
+
//为拖拽到容器的元素添加唯一 key
|
111
|
+
const key =
|
112
|
+
Date.parse(new Date()) + "_" + Math.ceil(Math.random() * 99999);
|
113
|
+
let dic = JSON.parse(JSON.stringify(this.data.list[newIndex]));
|
114
|
+
dic.key = key;
|
115
|
+
dic.model = dic.type + "_" + key;
|
116
|
+
dic.rules = [];
|
117
|
+
|
118
|
+
this.$set(this.data.list, newIndex, dic);
|
119
|
+
|
120
|
+
// if (
|
121
|
+
// this.data.list[newIndex].type === "radio" ||
|
122
|
+
// this.data.list[newIndex].type === "checkbox" ||
|
123
|
+
// this.data.list[newIndex].type === "select"
|
124
|
+
// ) {
|
125
|
+
// this.$set(this.data.list, newIndex, {
|
126
|
+
// ...this.data.list[newIndex],
|
127
|
+
// options: {
|
128
|
+
// ...this.data.list[newIndex].options,
|
129
|
+
// options: this.data.list[newIndex].options.options.map(item => ({
|
130
|
+
// ...item
|
131
|
+
// }))
|
132
|
+
// }
|
133
|
+
// });
|
134
|
+
// }
|
135
|
+
|
136
|
+
// if (this.data.list[newIndex].type === "grid") {
|
137
|
+
// this.$set(
|
138
|
+
// this.data.list,
|
139
|
+
// newIndex,
|
140
|
+
// JSON.parse(JSON.stringify(this.data.list[newIndex]))
|
141
|
+
// );
|
142
|
+
// }
|
143
|
+
|
144
|
+
// if (this.data.list[newIndex].type === "tabs") {
|
145
|
+
// this.$set(this.data.list, newIndex, JSON.parse(JSON.stringify(this.data.list[newIndex])));
|
146
|
+
// }
|
147
|
+
|
148
|
+
// if (this.data.list[newIndex].type === "table") {
|
149
|
+
// this.$set(this.data.list, newIndex, {
|
150
|
+
// ...this.data.list[newIndex],
|
151
|
+
// list: this.data.list[newIndex].list.map(item => ({ ...item }))
|
152
|
+
// });
|
153
|
+
// }
|
154
|
+
|
155
|
+
this.selectWidget = this.data.list[newIndex];
|
156
|
+
}
|
157
|
+
}
|
158
|
+
};
|
159
|
+
</script>
|