tianheng-ui 0.0.56 → 0.0.57

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.
Files changed (238) hide show
  1. package/lib/039af9192b9bb277966ceb4e4ce29c41.js +16 -0
  2. package/lib/{c755e7fc08446566ee8dd3a8aa8fe43f.js → 2d84c80112a372bc149cad3464e90fa3.js} +404 -502
  3. package/lib/5977b934a4c6b480790864ea01303173.js +10834 -0
  4. package/lib/7745f3e776488705a38e62f85adad54d.js +16 -0
  5. package/lib/de8dee841ffdaaede3a2254deef30376.js +15395 -0
  6. package/lib/e78eab250e7f8ccac3d918dfdb06ca10.js +8904 -0
  7. package/lib/index.js +4 -2
  8. package/lib/theme-chalk/fonts/PingFang.ttf +0 -0
  9. package/lib/theme-chalk/fonts/bpmn.eot +0 -0
  10. package/lib/theme-chalk/fonts/bpmn.svg +224 -0
  11. package/lib/theme-chalk/fonts/bpmn.ttf +0 -0
  12. package/lib/theme-chalk/fonts/bpmn.woff +0 -0
  13. package/lib/theme-chalk/fonts/bpmn.woff2 +0 -0
  14. package/lib/theme-chalk/fonts/fontawesome-webfont.eot +0 -0
  15. package/lib/theme-chalk/fonts/fontawesome-webfont.svg +2671 -0
  16. package/lib/theme-chalk/fonts/fontawesome-webfont.ttf +0 -0
  17. package/lib/theme-chalk/fonts/fontawesome-webfont.woff +0 -0
  18. package/lib/theme-chalk/fonts/fontawesome-webfont.woff2 +0 -0
  19. package/lib/{iconfont.eot → theme-chalk/fonts/iconfont.eot} +0 -0
  20. package/lib/{iconfont.svg → theme-chalk/fonts/iconfont.svg} +0 -0
  21. package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
  22. package/lib/theme-chalk/fonts/iconfont.woff +0 -0
  23. package/lib/theme-chalk/images/notData.png +0 -0
  24. package/lib/theme-chalk/index.scss +29 -0
  25. package/lib/theme-chalk/styles/button.scss +501 -0
  26. package/lib/theme-chalk/styles/card.scss +29 -0
  27. package/lib/theme-chalk/styles/cell.scss +54 -0
  28. package/lib/theme-chalk/styles/codeEditor.scss +9 -0
  29. package/lib/theme-chalk/styles/col.scss +151 -0
  30. package/lib/theme-chalk/styles/dialog.scss +59 -0
  31. package/lib/theme-chalk/styles/empty.scss +22 -0
  32. package/lib/theme-chalk/styles/feature.scss +42 -0
  33. package/lib/theme-chalk/styles/font.css +7 -0
  34. package/lib/theme-chalk/{icon.css → styles/icon.css} +3 -3
  35. package/lib/theme-chalk/styles/imagePreview.scss +113 -0
  36. package/lib/theme-chalk/styles/img.scss +35 -0
  37. package/lib/theme-chalk/styles/reset.scss +8 -0
  38. package/lib/theme-chalk/{root.css → styles/root.css} +2 -35
  39. package/lib/theme-chalk/styles/row.scss +23 -0
  40. package/lib/theme-chalk/styles/variable.scss +80 -0
  41. package/lib/tianheng-ui.js +71 -9
  42. package/package.json +24 -4
  43. package/packages/Button/index.js +8 -0
  44. package/packages/Button/index.vue +80 -0
  45. package/packages/Card/index.js +8 -0
  46. package/packages/Card/index.vue +37 -0
  47. package/packages/{cell → Cell}/index.js +0 -0
  48. package/packages/Cell/index.vue +68 -0
  49. package/packages/{codeEditor → CodeEditor}/index.js +0 -0
  50. package/packages/{codeEditor → CodeEditor}/index.vue +73 -108
  51. package/packages/Col/index.js +8 -0
  52. package/packages/Col/index.vue +41 -0
  53. package/packages/{dialog → Dialog}/index.js +0 -0
  54. package/packages/{dialog → Dialog}/index.vue +19 -10
  55. package/packages/Empty/images/notData.png +0 -0
  56. package/packages/{empty → Empty}/index.js +0 -0
  57. package/packages/Empty/index.vue +35 -0
  58. package/packages/FormMaking/Container.vue +1907 -0
  59. package/packages/{formMaking → FormMaking}/FormConfig.vue +22 -6
  60. package/packages/FormMaking/GenerateForm.vue +246 -0
  61. package/packages/{formMaking → FormMaking}/GenerateFormItem.vue +340 -172
  62. package/packages/FormMaking/GenerateFormItemH5.vue +828 -0
  63. package/packages/{formMaking → FormMaking}/Upload/index.vue +0 -0
  64. package/packages/FormMaking/WidgetConfig.vue +473 -0
  65. package/packages/{formMaking → FormMaking}/WidgetForm.vue +49 -31
  66. package/packages/FormMaking/WidgetFormItem.vue +157 -0
  67. package/packages/{formMaking/componentsConfig.js → FormMaking/custom/config.js} +379 -163
  68. package/packages/FormMaking/custom/configs/alliance.vue +0 -0
  69. package/packages/FormMaking/custom/configs/blank.vue +54 -0
  70. package/packages/FormMaking/custom/configs/button.vue +144 -0
  71. package/packages/FormMaking/custom/configs/cascader.vue +182 -0
  72. package/packages/FormMaking/custom/configs/cell.vue +81 -0
  73. package/packages/FormMaking/custom/configs/checkbox.vue +237 -0
  74. package/packages/FormMaking/custom/configs/color.vue +137 -0
  75. package/packages/FormMaking/custom/configs/date.vue +158 -0
  76. package/packages/FormMaking/custom/configs/divider.vue +61 -0
  77. package/packages/FormMaking/custom/configs/editor.vue +71 -0
  78. package/packages/FormMaking/custom/configs/filler.vue +52 -0
  79. package/packages/FormMaking/custom/configs/grid.vue +103 -0
  80. package/packages/FormMaking/custom/configs/image.vue +148 -0
  81. package/packages/FormMaking/custom/configs/input.vue +176 -0
  82. package/packages/FormMaking/custom/configs/number.vue +140 -0
  83. package/packages/FormMaking/custom/configs/radio.vue +215 -0
  84. package/packages/FormMaking/custom/configs/rate.vue +109 -0
  85. package/packages/FormMaking/custom/configs/select.vue +308 -0
  86. package/packages/FormMaking/custom/configs/slider.vue +142 -0
  87. package/packages/FormMaking/custom/configs/switch.vue +130 -0
  88. package/packages/FormMaking/custom/configs/table.vue +105 -0
  89. package/packages/FormMaking/custom/configs/table_h5.vue +102 -0
  90. package/packages/FormMaking/custom/configs/tabs.vue +175 -0
  91. package/packages/FormMaking/custom/configs/text.vue +71 -0
  92. package/packages/FormMaking/custom/configs/textarea.vue +167 -0
  93. package/packages/FormMaking/custom/configs/time.vue +153 -0
  94. package/packages/FormMaking/custom/configs/upload.vue +150 -0
  95. package/packages/FormMaking/custom/index.js +33 -0
  96. package/packages/FormMaking/custom/items/alliance.vue +132 -0
  97. package/packages/FormMaking/custom/items/blank.vue +16 -0
  98. package/packages/FormMaking/custom/items/button.vue +27 -0
  99. package/packages/FormMaking/custom/items/cascader.vue +29 -0
  100. package/packages/FormMaking/custom/items/cell.vue +18 -0
  101. package/packages/FormMaking/custom/items/checkbox.vue +46 -0
  102. package/packages/FormMaking/custom/items/color.vue +19 -0
  103. package/packages/FormMaking/custom/items/date.vue +29 -0
  104. package/packages/FormMaking/custom/items/divider.vue +14 -0
  105. package/packages/FormMaking/custom/items/editor.vue +22 -0
  106. package/packages/FormMaking/custom/items/filler.vue +17 -0
  107. package/packages/FormMaking/custom/items/grid.vue +129 -0
  108. package/packages/FormMaking/custom/items/image.vue +42 -0
  109. package/packages/FormMaking/custom/items/input.vue +36 -0
  110. package/packages/FormMaking/custom/items/login.vue +13 -0
  111. package/packages/FormMaking/custom/items/number.vue +24 -0
  112. package/packages/FormMaking/custom/items/radio.vue +44 -0
  113. package/packages/FormMaking/custom/items/rate.vue +20 -0
  114. package/packages/FormMaking/custom/items/select.vue +32 -0
  115. package/packages/FormMaking/custom/items/slider.vue +34 -0
  116. package/packages/FormMaking/custom/items/switch.vue +22 -0
  117. package/packages/FormMaking/custom/items/table.vue +106 -0
  118. package/packages/FormMaking/custom/items/table_h5.vue +126 -0
  119. package/packages/FormMaking/custom/items/tabs.vue +145 -0
  120. package/packages/FormMaking/custom/items/text.vue +18 -0
  121. package/packages/FormMaking/custom/items/textarea.vue +37 -0
  122. package/packages/FormMaking/custom/items/time.vue +32 -0
  123. package/packages/FormMaking/custom/items/upload.vue +83 -0
  124. package/packages/FormMaking/custom/mixins/index.js +61 -0
  125. package/packages/FormMaking/custom/register.js +18 -0
  126. package/packages/{formMaking → FormMaking}/iconfont/demo.css +0 -0
  127. package/packages/{formMaking → FormMaking}/iconfont/demo_index.html +0 -0
  128. package/packages/{formMaking → FormMaking}/iconfont/iconfont.css +0 -0
  129. package/packages/{formMaking → FormMaking}/iconfont/iconfont.eot +0 -0
  130. package/packages/{formMaking → FormMaking}/iconfont/iconfont.js +0 -0
  131. package/packages/{formMaking → FormMaking}/iconfont/iconfont.svg +0 -0
  132. package/{lib → packages/FormMaking/iconfont}/iconfont.ttf +0 -0
  133. package/{lib → packages/FormMaking/iconfont}/iconfont.woff +0 -0
  134. package/packages/{formMaking → FormMaking}/iconfont/iconfont.woff2 +0 -0
  135. package/packages/FormMaking/index.js +35 -0
  136. package/packages/{formMaking → FormMaking}/lang/en-US.js +1 -1
  137. package/packages/{formMaking → FormMaking}/lang/zh-CN.js +1 -1
  138. package/packages/{formMaking → FormMaking}/styles/cover.scss +1 -1
  139. package/packages/{formMaking → FormMaking}/styles/index.scss +445 -429
  140. package/packages/{formMaking → FormMaking/util}/generateCode.js +5 -5
  141. package/packages/{formMaking → FormMaking}/util/index.js +0 -0
  142. package/packages/{formMaking → FormMaking}/util/request.js +0 -0
  143. package/packages/{icons → Icons}/index.js +0 -0
  144. package/packages/{icons → Icons}/index.vue +26 -9
  145. package/packages/Image/index.js +8 -0
  146. package/packages/Image/index.vue +146 -0
  147. package/packages/ImagePreview/index.js +8 -0
  148. package/packages/ImagePreview/index.vue +386 -0
  149. package/packages/Row/index.js +8 -0
  150. package/packages/Row/index.vue +35 -0
  151. package/packages/{table → Table}/action.js +0 -0
  152. package/packages/{table → Table}/action.vue +1 -1
  153. package/packages/Table/column.vue +63 -0
  154. package/packages/{table → Table}/index.js +0 -0
  155. package/packages/{table → Table}/index.vue +25 -23
  156. package/packages/{table → Table}/search.js +0 -0
  157. package/packages/{table → Table}/search.vue +2 -2
  158. package/packages/{table → Table}/tools.js +0 -0
  159. package/packages/{table → Table}/tools.vue +0 -0
  160. package/packages/Workflow/Log.js +99 -0
  161. package/packages/Workflow/designer/ProcessDesigner.vue +628 -0
  162. package/packages/Workflow/designer/index.js +7 -0
  163. package/packages/Workflow/designer/plugins/content-pad/contentPadProvider.js +390 -0
  164. package/packages/Workflow/designer/plugins/content-pad/index.js +6 -0
  165. package/packages/Workflow/designer/plugins/defaultEmpty.js +24 -0
  166. package/packages/Workflow/designer/plugins/descriptor/activitiDescriptor.json +1071 -0
  167. package/packages/Workflow/designer/plugins/descriptor/camundaDescriptor.json +1087 -0
  168. package/packages/Workflow/designer/plugins/descriptor/flowableDescriptor.json +1215 -0
  169. package/packages/Workflow/designer/plugins/extension-moddle/activiti/activitiExtension.js +74 -0
  170. package/packages/Workflow/designer/plugins/extension-moddle/activiti/index.js +9 -0
  171. package/packages/Workflow/designer/plugins/extension-moddle/camunda/extension.js +148 -0
  172. package/packages/Workflow/designer/plugins/extension-moddle/camunda/index.js +6 -0
  173. package/packages/Workflow/designer/plugins/extension-moddle/flowable/flowableExtension.js +74 -0
  174. package/packages/Workflow/designer/plugins/extension-moddle/flowable/index.js +9 -0
  175. package/packages/Workflow/designer/plugins/palette/CustomPalette.js +156 -0
  176. package/packages/Workflow/designer/plugins/palette/index.js +6 -0
  177. package/packages/Workflow/designer/plugins/palette/paletteProvider.js +160 -0
  178. package/packages/Workflow/designer/plugins/translate/customTranslate.js +41 -0
  179. package/packages/Workflow/designer/plugins/translate/zh.js +238 -0
  180. package/packages/Workflow/highlight/index.js +5 -0
  181. package/packages/Workflow/index.js +26 -0
  182. package/packages/Workflow/index.vue +394 -0
  183. package/packages/Workflow/modules/auto-place/CustomAutoPlace.js +81 -0
  184. package/packages/Workflow/modules/auto-place/index.js +6 -0
  185. package/packages/Workflow/modules/custom-renderer/CustomRenderer.js +17 -0
  186. package/packages/Workflow/modules/custom-renderer/index.js +6 -0
  187. package/packages/Workflow/modules/rules/CustomRules.js +16 -0
  188. package/packages/Workflow/modules/rules/index.js +6 -0
  189. package/packages/Workflow/palette/ProcessPalette.vue +106 -0
  190. package/packages/Workflow/palette/index.js +7 -0
  191. package/packages/Workflow/penal/PropertiesPanel.vue +247 -0
  192. package/packages/Workflow/penal/base/ElementBaseInfo.vue +80 -0
  193. package/packages/Workflow/penal/flow-condition/FlowCondition.vue +142 -0
  194. package/packages/Workflow/penal/form/ElementForm.vue +367 -0
  195. package/packages/Workflow/penal/index.js +7 -0
  196. package/packages/Workflow/penal/listeners/ElementListeners.vue +299 -0
  197. package/packages/Workflow/penal/listeners/UserTaskListeners.vue +322 -0
  198. package/packages/Workflow/penal/listeners/template.js +178 -0
  199. package/packages/Workflow/penal/listeners/utilSelf.js +62 -0
  200. package/packages/Workflow/penal/multi-instance/ElementMultiInstance.vue +200 -0
  201. package/packages/Workflow/penal/other/ElementOtherConfig.vue +59 -0
  202. package/packages/Workflow/penal/properties/ElementProperties.vue +135 -0
  203. package/packages/Workflow/penal/signal-message/SignalAndMessage.vue +104 -0
  204. package/packages/Workflow/penal/task/ElementTask.vue +73 -0
  205. package/packages/Workflow/penal/task/task-components/ReceiveTask.vue +97 -0
  206. package/packages/Workflow/penal/task/task-components/ScriptTask.vue +85 -0
  207. package/packages/Workflow/penal/task/task-components/UserTask.vue +535 -0
  208. package/packages/Workflow/theme/element-variables.scss +70 -0
  209. package/packages/Workflow/theme/index.scss +2 -0
  210. package/packages/Workflow/theme/process-designer.scss +157 -0
  211. package/packages/Workflow/theme/process-panel.scss +107 -0
  212. package/packages/Workflow/translations.js +25 -0
  213. package/packages/Workflow/utils.js +71 -0
  214. package/packages/upload/ajax.js +85 -0
  215. package/packages/upload/index.js +8 -0
  216. package/packages/upload/index.vue +325 -0
  217. package/packages/upload/locale.js +9 -0
  218. package/packages/upload/upload-dragger.vue +70 -0
  219. package/packages/upload/upload-list.vue +101 -0
  220. package/packages/upload/upload.vue +211 -0
  221. package/lib/03250ed25fc1b305e9980cf7cf0dfb09.js +0 -1
  222. package/lib/theme-chalk/cell.css +0 -53
  223. package/lib/theme-chalk/dialog.css +0 -41
  224. package/lib/theme-chalk/empty.css +0 -27
  225. package/lib/theme-chalk/index.css +0 -6
  226. package/lib/theme-chalk/reset.css +0 -4
  227. package/lib/tianheng-ui.js.map +0 -1
  228. package/packages/cell/index.vue +0 -116
  229. package/packages/empty/index.vue +0 -33
  230. package/packages/formMaking/Container.vue +0 -591
  231. package/packages/formMaking/CusDialog.vue +0 -134
  232. package/packages/formMaking/GenerateForm.vue +0 -174
  233. package/packages/formMaking/WidgetConfig.vue +0 -1539
  234. package/packages/formMaking/WidgetFormItem.vue +0 -817
  235. package/packages/formMaking/iconfont/iconfont.ttf +0 -0
  236. package/packages/formMaking/iconfont/iconfont.woff +0 -0
  237. package/packages/formMaking/index.js +0 -77
  238. package/packages/table/column.vue +0 -111
@@ -0,0 +1,1907 @@
1
+ <template>
2
+ <div class="fm-container">
3
+ <el-container class="container-box">
4
+ <el-main>
5
+ <el-container>
6
+ <!-- 左侧字段区 -->
7
+ <el-aside width="250px">
8
+ <div class="components-list">
9
+ <div v-if="basicFields.length">
10
+ <div class="widget-cate">基础字段</div>
11
+ <draggable
12
+ tag="ul"
13
+ :list="getBasicComponents"
14
+ v-bind="{
15
+ group: { name: 'people', pull: 'clone', put: false },
16
+ sort: false,
17
+ ghostClass: 'ghost'
18
+ }"
19
+ >
20
+ <li
21
+ v-for="(item, index) in getBasicComponents"
22
+ class="form-edit-widget-label"
23
+ :class="{
24
+ 'no-put': item.type == 'divider',
25
+ [item.type]: true
26
+ }"
27
+ :key="index"
28
+ >
29
+ <a>
30
+ <i class="icon iconfont" :class="item.icon"></i>
31
+ <span>{{ item.name }}</span>
32
+ </a>
33
+ </li>
34
+ </draggable>
35
+ </div>
36
+
37
+ <div v-if="advanceFields.length">
38
+ <div class="widget-cate">高级字段</div>
39
+ <draggable
40
+ tag="ul"
41
+ :list="getAdvanceComponents"
42
+ v-bind="{
43
+ group: { name: 'people', pull: 'clone', put: false },
44
+ sort: false,
45
+ ghostClass: 'ghost'
46
+ }"
47
+ >
48
+ <li
49
+ v-for="(item, index) in getAdvanceComponents"
50
+ class="form-edit-widget-label"
51
+ :class="{
52
+ 'no-put': ['table', 'table_h5', 'tabs'].includes(
53
+ item.type
54
+ ),
55
+ [item.type]: true
56
+ }"
57
+ :key="index"
58
+ >
59
+ <a>
60
+ <i class="icon iconfont" :class="item.icon"></i>
61
+ <span>{{ item.name }}</span>
62
+ </a>
63
+ </li>
64
+ </draggable>
65
+ </div>
66
+
67
+ <div v-if="layoutFields.length">
68
+ <div class="widget-cate">布局字段</div>
69
+ <draggable
70
+ tag="ul"
71
+ :list="getLayoutComponents"
72
+ v-bind="{
73
+ group: { name: 'people', pull: 'clone', put: false },
74
+ sort: false,
75
+ ghostClass: 'ghost'
76
+ }"
77
+ >
78
+ <li
79
+ v-for="(item, index) in getLayoutComponents"
80
+ class="form-edit-widget-label"
81
+ :class="{
82
+ 'no-put': ['alliance'].includes(item.type),
83
+ [item.type]: true
84
+ }"
85
+ :key="index"
86
+ >
87
+ <a>
88
+ <i class="icon iconfont" :class="item.icon"></i>
89
+ <span>{{ item.name }}</span>
90
+ </a>
91
+ </li>
92
+ </draggable>
93
+ </div>
94
+ </div>
95
+ </el-aside>
96
+
97
+ <!-- 中间视图区 -->
98
+ <el-container class="center-container" direction="vertical">
99
+ <!-- 操作区 -->
100
+ <el-header>
101
+ <div class="client">
102
+ <i
103
+ class="el-icon-monitor"
104
+ :class="{ active: client === 'monitor' }"
105
+ @click="client = 'monitor'"
106
+ ></i>
107
+ <i
108
+ class="el-icon-mobile"
109
+ :class="{ active: client === 'mobile' }"
110
+ @click="client = 'mobile'"
111
+ ></i>
112
+ </div>
113
+ <slot name="action"> </slot>
114
+ <el-upload
115
+ action
116
+ accept=".xlsx, .xls"
117
+ :auto-upload="false"
118
+ :show-file-list="false"
119
+ :on-change="onExcelFileChange"
120
+ >
121
+ <el-button
122
+ v-if="upload"
123
+ type="text"
124
+ size="medium"
125
+ icon="el-icon-upload2"
126
+ >导入EXCEL
127
+ </el-button>
128
+ </el-upload>
129
+ <el-button
130
+ v-if="upload"
131
+ type="text"
132
+ size="medium"
133
+ icon="el-icon-upload2"
134
+ @click="dialog.import.visible = true"
135
+ >导入JSON
136
+ </el-button>
137
+ <el-button
138
+ v-if="clearable"
139
+ type="text"
140
+ size="medium"
141
+ icon="el-icon-delete"
142
+ @click="handleClear"
143
+ >清空
144
+ </el-button>
145
+ <el-button
146
+ v-if="preview"
147
+ type="text"
148
+ size="medium"
149
+ icon="el-icon-view"
150
+ @click="handlePreview"
151
+ >预览
152
+ </el-button>
153
+ <el-button
154
+ v-if="generateJson"
155
+ type="text"
156
+ size="medium"
157
+ icon="el-icon-tickets"
158
+ @click="handleGenerateJson"
159
+ >生成JSON</el-button
160
+ >
161
+ <el-button
162
+ v-if="generateCode"
163
+ type="text"
164
+ size="medium"
165
+ icon="el-icon-document"
166
+ @click="handleGenerateCode"
167
+ >生成代码</el-button
168
+ >
169
+ </el-header>
170
+
171
+ <!-- 工作区 -->
172
+ <el-main>
173
+ <widget-form
174
+ ref="widgetForm"
175
+ :data="widgetFormData"
176
+ :select.sync="widgetFormSelect"
177
+ :client="client"
178
+ >
179
+ </widget-form>
180
+ </el-main>
181
+ </el-container>
182
+
183
+ <!-- 右侧配置区 -->
184
+ <el-aside class="config-container">
185
+ <el-container>
186
+ <el-header height="45px">
187
+ <div
188
+ class="config-tab"
189
+ :class="{ active: configTab == 'widget' }"
190
+ @click="handleConfigSelect('widget')"
191
+ >
192
+ 字段属性
193
+ </div>
194
+ <div
195
+ class="config-tab"
196
+ :class="{ active: configTab == 'form' }"
197
+ @click="handleConfigSelect('form')"
198
+ >
199
+ 表单属性
200
+ </div>
201
+ </el-header>
202
+ <el-main class="config-container-content">
203
+ <widget-config
204
+ v-show="configTab == 'widget'"
205
+ :data="widgetFormSelect"
206
+ :remoteApis="remoteApis"
207
+ :config="widgetFormData.config"
208
+ >
209
+ </widget-config>
210
+ <form-config
211
+ v-show="configTab == 'form'"
212
+ :data="widgetFormData.config"
213
+ ></form-config>
214
+ </el-main>
215
+ </el-container>
216
+ </el-aside>
217
+
218
+ <!-- 导入JSON -->
219
+ <th-dialog
220
+ title="导入JSON"
221
+ :visible="dialog.import.visible"
222
+ @on-close="dialog.import.visible = false"
223
+ @on-affirm="handleUploadJson"
224
+ @on-fullscreen="$refs.valueCodeEditor.resize()"
225
+ >
226
+ <el-alert
227
+ type="info"
228
+ title="JSON格式如下,直接复制生成的json覆盖此处代码点击确定即可"
229
+ ></el-alert>
230
+ <th-code-editor
231
+ v-model="dialog.import.value"
232
+ ref="valueCodeEditor"
233
+ ></th-code-editor>
234
+ </th-dialog>
235
+
236
+ <!-- 预览 -->
237
+ <th-dialog
238
+ title="预览"
239
+ :visible="dialog.preview.visible"
240
+ @on-close="dialog.preview.visible = false"
241
+ >
242
+ <generate-form
243
+ v-if="dialog.preview.visible"
244
+ :data="widgetFormData"
245
+ :value="widgetValue"
246
+ :remote="remoteFuncs"
247
+ :slotKeys="slotKeys"
248
+ :client="client"
249
+ insite="true"
250
+ @on-change="handleDataChange"
251
+ ref="generateForm"
252
+ >
253
+ <template v-for="name in slotKeys" :slot="name">
254
+ <slot :name="name" />
255
+ </template>
256
+ </generate-form>
257
+
258
+ <template slot="footer">
259
+ <el-button type="primary" @click="handleGetData"
260
+ >获取数据</el-button
261
+ >
262
+ <el-button @click="handleReset">重置</el-button>
263
+ </template>
264
+ </th-dialog>
265
+
266
+ <!-- 获取数据 -->
267
+ <th-dialog
268
+ title="获取数据"
269
+ :visible="dialog.data.visible"
270
+ @on-close="dialog.data.visible = false"
271
+ @on-fullscreen="$refs.dataCodeEditor.resize()"
272
+ >
273
+ <th-code-editor
274
+ v-model="dialog.data.value"
275
+ ref="dataCodeEditor"
276
+ ></th-code-editor>
277
+
278
+ <template slot="footer">
279
+ <el-button
280
+ type="primary"
281
+ class="json-btn"
282
+ :data-clipboard-text="dialog.data.valueCopy"
283
+ >复制数据</el-button
284
+ >
285
+ </template>
286
+ </th-dialog>
287
+
288
+ <!-- 生成json -->
289
+ <th-dialog
290
+ title="生成JSON"
291
+ :visible="dialog.config.visible"
292
+ @on-close="dialog.config.visible = false"
293
+ @on-fullscreen="$refs.jsonCodeEditor.resize()"
294
+ >
295
+ <th-code-editor
296
+ v-model="dialog.config.value"
297
+ ref="jsonCodeEditor"
298
+ ></th-code-editor>
299
+
300
+ <template slot="footer">
301
+ <el-button
302
+ type="primary"
303
+ class="json-btn"
304
+ :data-clipboard-text="dialog.config.valueCopy"
305
+ >复制数据</el-button
306
+ >
307
+ </template>
308
+ </th-dialog>
309
+
310
+ <!-- 生成代码 -->
311
+ <th-dialog
312
+ class="codeDialog"
313
+ title="生成代码"
314
+ :visible="dialog.code.visible"
315
+ :showFooter="false"
316
+ @on-close="dialog.code.visible = false"
317
+ @on-fullscreen="handleDialogFullscreen"
318
+ >
319
+ <el-tabs
320
+ type="border-card"
321
+ style="box-shadow: none;"
322
+ v-model="dialog.code.type"
323
+ >
324
+ <el-tab-pane label="Vue Component" name="vue">
325
+ <th-code-editor
326
+ v-model="dialog.code.valueVue"
327
+ language="html"
328
+ readonly
329
+ ref="vueCodeEditor"
330
+ ></th-code-editor>
331
+ </el-tab-pane>
332
+ <el-tab-pane label="HTML" name="html">
333
+ <th-code-editor
334
+ v-model="dialog.code.valueHtml"
335
+ language="html"
336
+ readonly
337
+ ref="htmlCodeEditor"
338
+ ></th-code-editor>
339
+ </el-tab-pane>
340
+ </el-tabs>
341
+ </th-dialog>
342
+ </el-container>
343
+ </el-main>
344
+ </el-container>
345
+ </div>
346
+ </template>
347
+
348
+ <script>
349
+ import Draggable from "vuedraggable";
350
+ import Clipboard from "clipboard";
351
+ import WidgetConfig from "./WidgetConfig";
352
+ import FormConfig from "./FormConfig";
353
+ import WidgetForm from "./WidgetForm";
354
+ import GenerateForm from "./GenerateForm";
355
+ import ThDialog from "ui/dialog/index.vue";
356
+ import ThCodeEditor from "ui/codeEditor/index.vue";
357
+ import {
358
+ basicComponents,
359
+ advanceComponents,
360
+ layoutComponents,
361
+ baseConfig
362
+ } from "./custom/config";
363
+ import request from "./util/request";
364
+ import generateCode from "./util/generateCode.js";
365
+ import * as XLSX from 'xlsx/xlsx.mjs'
366
+
367
+ export default {
368
+ name: "th-making-form",
369
+ components: {
370
+ Draggable,
371
+ WidgetConfig,
372
+ FormConfig,
373
+ WidgetForm,
374
+ GenerateForm,
375
+ ThDialog,
376
+ ThCodeEditor
377
+ },
378
+ props: {
379
+ preview: {
380
+ type: Boolean,
381
+ default: false
382
+ },
383
+ generateCode: {
384
+ type: Boolean,
385
+ default: false
386
+ },
387
+ generateJson: {
388
+ type: Boolean,
389
+ default: false
390
+ },
391
+ upload: {
392
+ type: Boolean,
393
+ default: false
394
+ },
395
+ clearable: {
396
+ type: Boolean,
397
+ default: false
398
+ },
399
+ basicFields: {
400
+ type: Array,
401
+ default: () => [
402
+ "input",
403
+ "textarea",
404
+ "cell",
405
+ "radio",
406
+ "checkbox",
407
+ "time",
408
+ "date",
409
+ "rate",
410
+ "number",
411
+ "color",
412
+ "select",
413
+ "switch",
414
+ "slider",
415
+ "text",
416
+ "button",
417
+ "filler",
418
+ "image",
419
+ "upload",
420
+ "editor",
421
+ "cascader"
422
+ ]
423
+ },
424
+ advanceFields: {
425
+ type: Array,
426
+ default: () => ["table", "table_h5", "tabs", "blank"]
427
+ },
428
+ layoutFields: {
429
+ type: Array,
430
+ default: () => ["grid", "alliance", "divider"]
431
+ },
432
+ remoteApis: {
433
+ type: Array,
434
+ default: () => []
435
+ }
436
+ },
437
+ data() {
438
+ return {
439
+ basicComponents,
440
+ layoutComponents,
441
+ advanceComponents,
442
+ widgetFormSelect: null,
443
+ widgetFormData: {
444
+ list: [],
445
+ config: baseConfig
446
+ },
447
+ widgetValue: {},
448
+ configTab: "widget",
449
+ client: "monitor",
450
+ dialog: {
451
+ import: { visible: false, value: "" },
452
+ preview: { visible: false, value: "" },
453
+ data: { visible: false, value: "", valueCopy: "" },
454
+ config: { visible: false, value: "", valueCopy: "" },
455
+ code: { visible: false, valueHtml: "", valueVue: "", type: "vue" }
456
+ },
457
+ remoteFuncs: {
458
+ func_test(resolve) {
459
+ setTimeout(() => {
460
+ const options = [
461
+ { id: "1", name: "1111" },
462
+ { id: "2", name: "2222" },
463
+ { id: "3", name: "3333" }
464
+ ];
465
+
466
+ resolve(options);
467
+ }, 2000);
468
+ },
469
+ funcGetToken(resolve) {
470
+ request
471
+ .get("http://tools-server.making.link/api/uptoken")
472
+ .then(res => {
473
+ resolve(res.uptoken);
474
+ });
475
+ },
476
+ upload_callback(response, file, fileList) {
477
+ console.log("callback", response, file, fileList);
478
+ }
479
+ },
480
+ jsonClipboard: null,
481
+ slotKeys: []
482
+ };
483
+ },
484
+ computed: {
485
+ getBasicComponents() {
486
+ const list = this.basicComponents.filter(e => {
487
+ return this.basicFields.includes(e.type);
488
+ });
489
+ return list;
490
+ },
491
+ getAdvanceComponents() {
492
+ const list = this.advanceComponents.filter(e => {
493
+ return this.advanceFields.includes(e.type);
494
+ });
495
+ return list;
496
+ },
497
+ getLayoutComponents() {
498
+ const list = this.layoutComponents.filter(e => {
499
+ return this.layoutFields.includes(e.type);
500
+ });
501
+ return list;
502
+ }
503
+ },
504
+ mounted() {
505
+ this.dialog.import.value = JSON.stringify(
506
+ {
507
+ list: [
508
+ {
509
+ name: "文字",
510
+ type: "text",
511
+ icon: "icon-wenzishezhi-",
512
+ options: {
513
+ width: "100%",
514
+ height: "",
515
+ labelWidth: 100,
516
+ isLabelWidth: false,
517
+ defaultValue: "<h1>客户信息登记表</h1>",
518
+ customClass: "",
519
+ textAlign: "center",
520
+ hidden: false,
521
+ hideLabel: true
522
+ },
523
+ key: "1667436175000_53693",
524
+ model: "title",
525
+ rules: []
526
+ },
527
+ {
528
+ name: "栅格布局",
529
+ type: "grid",
530
+ icon: "icon-grid-",
531
+ columns: [
532
+ {
533
+ span: 6,
534
+ list: [
535
+ {
536
+ name: "姓名",
537
+ type: "input",
538
+ icon: "icon-input",
539
+ options: {
540
+ width: "100%",
541
+ labelWidth: 100,
542
+ isLabelWidth: false,
543
+ defaultValue: "",
544
+ dataType: "string",
545
+ pattern: "",
546
+ placeholder: "",
547
+ maxlength: -1,
548
+ required: true,
549
+ disabled: false,
550
+ readonly: false,
551
+ clearable: false,
552
+ showWordLimit: false,
553
+ showPassword: false,
554
+ prefixIcon: "",
555
+ suffixIcon: "",
556
+ prepend: "",
557
+ append: "",
558
+ hidden: false,
559
+ hideLabel: false
560
+ },
561
+ events: {
562
+ onChange: "",
563
+ onFocus: "",
564
+ onBlur: ""
565
+ },
566
+ key: "1667436225000_44507",
567
+ model: "name",
568
+ rules: [
569
+ {
570
+ type: "string",
571
+ message: "姓名格式不正确"
572
+ },
573
+ {
574
+ required: true,
575
+ message: "姓名必须填写"
576
+ }
577
+ ]
578
+ }
579
+ ]
580
+ },
581
+ {
582
+ span: 6,
583
+ list: [
584
+ {
585
+ name: "性别",
586
+ type: "select",
587
+ icon: "icon-select",
588
+ options: {
589
+ width: "100%",
590
+ labelWidth: 100,
591
+ isLabelWidth: false,
592
+ defaultValue: "",
593
+ multiple: false,
594
+ disabled: false,
595
+ clearable: false,
596
+ placeholder: "",
597
+ required: true,
598
+ showLabel: false,
599
+ collapseTags: false,
600
+ allowCreate: false,
601
+ options: [
602
+ {
603
+ value: "男"
604
+ },
605
+ {
606
+ value: "女"
607
+ }
608
+ ],
609
+ remote: false,
610
+ filterable: false,
611
+ remoteOptions: [],
612
+ props: {
613
+ value: "value",
614
+ label: "label"
615
+ },
616
+ remoteFunc: "",
617
+ hidden: false,
618
+ hideLabel: false
619
+ },
620
+ events: {
621
+ onChange: "",
622
+ onFocus: "",
623
+ onBlur: ""
624
+ },
625
+ key: "1667437660000_16321",
626
+ model: "select_1667437660000_16321",
627
+ rules: [
628
+ {
629
+ required: true,
630
+ message: "性别必须填写"
631
+ }
632
+ ]
633
+ }
634
+ ]
635
+ },
636
+ {
637
+ span: 6,
638
+ list: [
639
+ {
640
+ name: "年龄",
641
+ type: "input",
642
+ icon: "icon-input",
643
+ options: {
644
+ width: "100%",
645
+ labelWidth: 100,
646
+ isLabelWidth: false,
647
+ defaultValue: "",
648
+ dataType: "integer",
649
+ pattern: "",
650
+ placeholder: "",
651
+ maxlength: -1,
652
+ required: true,
653
+ disabled: false,
654
+ readonly: false,
655
+ clearable: false,
656
+ showWordLimit: false,
657
+ showPassword: false,
658
+ prefixIcon: "",
659
+ suffixIcon: "",
660
+ prepend: "",
661
+ append: "",
662
+ hidden: false,
663
+ hideLabel: false
664
+ },
665
+ events: {
666
+ onChange: "",
667
+ onFocus: "",
668
+ onBlur: ""
669
+ },
670
+ key: "1667436683000_52927",
671
+ model: "input_1667436683000_52927",
672
+ rules: [
673
+ {
674
+ type: "integer",
675
+ message: "年龄格式不正确"
676
+ },
677
+ {
678
+ required: true,
679
+ message: "年龄必须填写"
680
+ }
681
+ ]
682
+ }
683
+ ]
684
+ },
685
+ {
686
+ span: 6,
687
+ list: [
688
+ {
689
+ name: "民族",
690
+ type: "input",
691
+ icon: "icon-input",
692
+ options: {
693
+ width: "100%",
694
+ labelWidth: 100,
695
+ isLabelWidth: false,
696
+ defaultValue: "",
697
+ dataType: "string",
698
+ pattern: "",
699
+ placeholder: "",
700
+ maxlength: -1,
701
+ required: false,
702
+ disabled: false,
703
+ readonly: false,
704
+ clearable: false,
705
+ showWordLimit: false,
706
+ showPassword: false,
707
+ prefixIcon: "",
708
+ suffixIcon: "",
709
+ prepend: "",
710
+ append: "",
711
+ hidden: false,
712
+ hideLabel: false
713
+ },
714
+ events: {
715
+ onChange: "",
716
+ onFocus: "",
717
+ onBlur: ""
718
+ },
719
+ key: "1667436685000_14989",
720
+ model: "input_1667436685000_14989",
721
+ rules: [
722
+ {
723
+ type: "string",
724
+ message: "民族格式不正确"
725
+ }
726
+ ]
727
+ }
728
+ ]
729
+ }
730
+ ],
731
+ options: {
732
+ gutter: 0,
733
+ justify: "start",
734
+ align: "top",
735
+ hideLabel: true
736
+ },
737
+ key: "1667436223000_412",
738
+ model: "base",
739
+ rules: []
740
+ },
741
+ {
742
+ name: "栅格布局",
743
+ type: "grid",
744
+ icon: "icon-grid-",
745
+ columns: [
746
+ {
747
+ span: 6,
748
+ list: [
749
+ {
750
+ name: "学历",
751
+ type: "select",
752
+ icon: "icon-select",
753
+ options: {
754
+ width: "100%",
755
+ labelWidth: 100,
756
+ isLabelWidth: false,
757
+ defaultValue: "",
758
+ multiple: false,
759
+ disabled: false,
760
+ clearable: false,
761
+ placeholder: "",
762
+ required: false,
763
+ showLabel: false,
764
+ collapseTags: false,
765
+ allowCreate: false,
766
+ options: [
767
+ {
768
+ value: "小学"
769
+ },
770
+ {
771
+ value: "初中"
772
+ },
773
+ {
774
+ value: "高中"
775
+ },
776
+ {
777
+ value: "专科",
778
+ label: "新选项4"
779
+ },
780
+ {
781
+ value: "本科",
782
+ label: "新选项5"
783
+ },
784
+ {
785
+ value: "其他",
786
+ label: "新选项6"
787
+ }
788
+ ],
789
+ remote: false,
790
+ filterable: false,
791
+ remoteOptions: [],
792
+ props: {
793
+ value: "value",
794
+ label: "label"
795
+ },
796
+ remoteFunc: "",
797
+ hidden: false,
798
+ hideLabel: false
799
+ },
800
+ events: {
801
+ onChange: "",
802
+ onFocus: "",
803
+ onBlur: ""
804
+ },
805
+ key: "1667437689000_69814",
806
+ model: "select_1667437689000_69814",
807
+ rules: []
808
+ }
809
+ ]
810
+ },
811
+ {
812
+ span: 6,
813
+ list: [
814
+ {
815
+ name: "籍贯",
816
+ type: "input",
817
+ icon: "icon-input",
818
+ options: {
819
+ width: "100%",
820
+ labelWidth: 100,
821
+ isLabelWidth: false,
822
+ defaultValue: "",
823
+ dataType: "string",
824
+ pattern: "",
825
+ placeholder: "",
826
+ maxlength: -1,
827
+ required: false,
828
+ disabled: false,
829
+ readonly: false,
830
+ clearable: false,
831
+ showWordLimit: false,
832
+ showPassword: false,
833
+ prefixIcon: "",
834
+ suffixIcon: "",
835
+ prepend: "",
836
+ append: "",
837
+ hidden: false,
838
+ hideLabel: false
839
+ },
840
+ events: {
841
+ onChange: "",
842
+ onFocus: "",
843
+ onBlur: ""
844
+ },
845
+ key: "1667436627000_48070",
846
+ model: "input_1667436627000_48070",
847
+ rules: []
848
+ }
849
+ ]
850
+ },
851
+ {
852
+ span: 12,
853
+ list: [
854
+ {
855
+ name: "电子邮箱",
856
+ type: "input",
857
+ icon: "icon-input",
858
+ options: {
859
+ width: "100%",
860
+ labelWidth: 100,
861
+ isLabelWidth: false,
862
+ defaultValue: "",
863
+ dataType: "email",
864
+ pattern: "",
865
+ placeholder: "",
866
+ maxlength: -1,
867
+ required: false,
868
+ disabled: false,
869
+ readonly: false,
870
+ clearable: false,
871
+ showWordLimit: false,
872
+ showPassword: false,
873
+ prefixIcon: "",
874
+ suffixIcon: "",
875
+ prepend: "",
876
+ append: "",
877
+ hidden: false,
878
+ hideLabel: false
879
+ },
880
+ events: {
881
+ onChange: "",
882
+ onFocus: "",
883
+ onBlur: ""
884
+ },
885
+ key: "1667436642000_85695",
886
+ model: "input_1667436642000_85695",
887
+ rules: [
888
+ {
889
+ type: "email",
890
+ message: "电子邮箱格式不正确"
891
+ }
892
+ ]
893
+ }
894
+ ]
895
+ }
896
+ ],
897
+ options: {
898
+ gutter: 0,
899
+ justify: "start",
900
+ align: "top",
901
+ hideLabel: true
902
+ },
903
+ key: "1667436612000_92469",
904
+ model: "grid_1667436612000_92469",
905
+ rules: []
906
+ },
907
+ {
908
+ name: "栅格布局",
909
+ type: "grid",
910
+ icon: "icon-grid-",
911
+ columns: [
912
+ {
913
+ span: 12,
914
+ list: [
915
+ {
916
+ name: "身份证号",
917
+ type: "input",
918
+ icon: "icon-input",
919
+ options: {
920
+ width: "100%",
921
+ labelWidth: 100,
922
+ isLabelWidth: false,
923
+ defaultValue: "",
924
+ dataType: "string",
925
+ pattern: "",
926
+ placeholder: "",
927
+ maxlength: -1,
928
+ required: false,
929
+ disabled: false,
930
+ readonly: false,
931
+ clearable: false,
932
+ showWordLimit: false,
933
+ showPassword: false,
934
+ prefixIcon: "",
935
+ suffixIcon: "",
936
+ prepend: "",
937
+ append: "",
938
+ hidden: false,
939
+ hideLabel: false
940
+ },
941
+ events: {
942
+ onChange: "",
943
+ onFocus: "",
944
+ onBlur: ""
945
+ },
946
+ key: "1667436654000_38448",
947
+ model: "input_1667436654000_38448",
948
+ rules: [
949
+ {
950
+ type: "string",
951
+ message: "身份证号格式不正确"
952
+ }
953
+ ]
954
+ },
955
+ {
956
+ name: "联系方式",
957
+ type: "input",
958
+ icon: "icon-input",
959
+ options: {
960
+ width: "100%",
961
+ labelWidth: 100,
962
+ isLabelWidth: false,
963
+ defaultValue: "",
964
+ dataType: "integer",
965
+ pattern: "",
966
+ placeholder: "",
967
+ maxlength: -1,
968
+ required: true,
969
+ disabled: false,
970
+ readonly: false,
971
+ clearable: false,
972
+ showWordLimit: false,
973
+ showPassword: false,
974
+ prefixIcon: "",
975
+ suffixIcon: "",
976
+ prepend: "",
977
+ append: "",
978
+ hidden: false,
979
+ hideLabel: false
980
+ },
981
+ events: {
982
+ onChange: "",
983
+ onFocus: "",
984
+ onBlur: ""
985
+ },
986
+ key: "1667436747000_64182",
987
+ model: "input_1667436747000_64182",
988
+ rules: [
989
+ {
990
+ type: "integer",
991
+ message: "联系方式格式不正确"
992
+ },
993
+ {
994
+ required: true,
995
+ message: "联系方式必须填写"
996
+ }
997
+ ]
998
+ }
999
+ ]
1000
+ },
1001
+ {
1002
+ span: 12,
1003
+ list: [
1004
+ {
1005
+ name: "其他证件号",
1006
+ type: "input",
1007
+ icon: "icon-input",
1008
+ options: {
1009
+ width: "100%",
1010
+ labelWidth: 100,
1011
+ isLabelWidth: false,
1012
+ defaultValue: "",
1013
+ dataType: "string",
1014
+ pattern: "",
1015
+ placeholder: "",
1016
+ maxlength: -1,
1017
+ required: false,
1018
+ disabled: false,
1019
+ readonly: false,
1020
+ clearable: false,
1021
+ showWordLimit: false,
1022
+ showPassword: false,
1023
+ prefixIcon: "",
1024
+ suffixIcon: "",
1025
+ prepend: "",
1026
+ append: "",
1027
+ hidden: false,
1028
+ hideLabel: false
1029
+ },
1030
+ events: {
1031
+ onChange: "",
1032
+ onFocus: "",
1033
+ onBlur: ""
1034
+ },
1035
+ key: "1667436658000_28857",
1036
+ model: "input_1667436658000_28857",
1037
+ rules: []
1038
+ },
1039
+ {
1040
+ name: "家庭地址",
1041
+ type: "input",
1042
+ icon: "icon-input",
1043
+ options: {
1044
+ width: "100%",
1045
+ labelWidth: 100,
1046
+ isLabelWidth: false,
1047
+ defaultValue: "",
1048
+ dataType: "string",
1049
+ pattern: "",
1050
+ placeholder: "",
1051
+ maxlength: -1,
1052
+ required: false,
1053
+ disabled: false,
1054
+ readonly: false,
1055
+ clearable: false,
1056
+ showWordLimit: false,
1057
+ showPassword: false,
1058
+ prefixIcon: "",
1059
+ suffixIcon: "",
1060
+ prepend: "",
1061
+ append: "",
1062
+ hidden: false,
1063
+ hideLabel: false
1064
+ },
1065
+ events: {
1066
+ onChange: "",
1067
+ onFocus: "",
1068
+ onBlur: ""
1069
+ },
1070
+ key: "1667436744000_71241",
1071
+ model: "input_1667436744000_71241",
1072
+ rules: []
1073
+ }
1074
+ ]
1075
+ }
1076
+ ],
1077
+ options: {
1078
+ gutter: 0,
1079
+ justify: "start",
1080
+ align: "top",
1081
+ hideLabel: true
1082
+ },
1083
+ key: "1667436651000_10428",
1084
+ model: "grid_1667436651000_10428",
1085
+ rules: []
1086
+ },
1087
+ {
1088
+ name: "栅格布局",
1089
+ type: "grid",
1090
+ icon: "icon-grid-",
1091
+ columns: [
1092
+ {
1093
+ span: 18,
1094
+ list: [
1095
+ {
1096
+ name: "工作单位",
1097
+ type: "input",
1098
+ icon: "icon-input",
1099
+ options: {
1100
+ width: "100%",
1101
+ labelWidth: 100,
1102
+ isLabelWidth: false,
1103
+ defaultValue: "",
1104
+ dataType: "string",
1105
+ pattern: "",
1106
+ placeholder: "",
1107
+ maxlength: -1,
1108
+ required: false,
1109
+ disabled: false,
1110
+ readonly: false,
1111
+ clearable: false,
1112
+ showWordLimit: false,
1113
+ showPassword: false,
1114
+ prefixIcon: "",
1115
+ suffixIcon: "",
1116
+ prepend: "",
1117
+ append: "",
1118
+ hidden: false,
1119
+ hideLabel: false
1120
+ },
1121
+ events: {
1122
+ onChange: "",
1123
+ onFocus: "",
1124
+ onBlur: ""
1125
+ },
1126
+ key: "1667436760000_10945",
1127
+ model: "input_1667436760000_10945",
1128
+ rules: [
1129
+ {
1130
+ type: "string",
1131
+ message: "工作单位格式不正确"
1132
+ }
1133
+ ]
1134
+ }
1135
+ ]
1136
+ },
1137
+ {
1138
+ span: 6,
1139
+ list: [
1140
+ {
1141
+ name: "是否在职",
1142
+ type: "select",
1143
+ icon: "icon-select",
1144
+ options: {
1145
+ width: "100%",
1146
+ labelWidth: 100,
1147
+ isLabelWidth: false,
1148
+ defaultValue: "",
1149
+ multiple: false,
1150
+ disabled: false,
1151
+ clearable: false,
1152
+ placeholder: "",
1153
+ required: true,
1154
+ showLabel: false,
1155
+ collapseTags: false,
1156
+ allowCreate: false,
1157
+ options: [
1158
+ {
1159
+ value: "在职"
1160
+ },
1161
+ {
1162
+ value: "离职"
1163
+ },
1164
+ {
1165
+ value: "其他"
1166
+ }
1167
+ ],
1168
+ remote: false,
1169
+ filterable: false,
1170
+ remoteOptions: [],
1171
+ props: {
1172
+ value: "value",
1173
+ label: "label"
1174
+ },
1175
+ remoteFunc: "",
1176
+ hidden: false,
1177
+ hideLabel: false
1178
+ },
1179
+ events: {
1180
+ onChange: 1667437911752,
1181
+ onFocus: "",
1182
+ onBlur: ""
1183
+ },
1184
+ key: "1667437857000_3388",
1185
+ model: "select_1667437857000_3388",
1186
+ rules: [
1187
+ {
1188
+ required: true,
1189
+ message: "是否在职必须填写"
1190
+ }
1191
+ ]
1192
+ }
1193
+ ]
1194
+ }
1195
+ ],
1196
+ options: {
1197
+ gutter: 0,
1198
+ justify: "start",
1199
+ align: "top",
1200
+ hideLabel: true
1201
+ },
1202
+ key: "1667436759000_9701",
1203
+ model: "grid_1667436759000_9701",
1204
+ rules: []
1205
+ },
1206
+ {
1207
+ name: "栅格布局",
1208
+ type: "grid",
1209
+ icon: "icon-grid-",
1210
+ columns: [
1211
+ {
1212
+ span: 12,
1213
+ list: [
1214
+ {
1215
+ name: "职务",
1216
+ type: "input",
1217
+ icon: "icon-input",
1218
+ options: {
1219
+ width: "100%",
1220
+ labelWidth: 100,
1221
+ isLabelWidth: false,
1222
+ defaultValue: "",
1223
+ dataType: "string",
1224
+ pattern: "",
1225
+ placeholder: "",
1226
+ maxlength: -1,
1227
+ required: false,
1228
+ disabled: false,
1229
+ readonly: false,
1230
+ clearable: false,
1231
+ showWordLimit: false,
1232
+ showPassword: false,
1233
+ prefixIcon: "",
1234
+ suffixIcon: "",
1235
+ prepend: "",
1236
+ append: "",
1237
+ hidden: false,
1238
+ hideLabel: false
1239
+ },
1240
+ events: {
1241
+ onChange: "",
1242
+ onFocus: "",
1243
+ onBlur: ""
1244
+ },
1245
+ key: "1667437859000_99021",
1246
+ model: "input_1667437859000_99021",
1247
+ rules: []
1248
+ }
1249
+ ]
1250
+ },
1251
+ {
1252
+ span: 12,
1253
+ list: [
1254
+ {
1255
+ name: "入职时间",
1256
+ type: "date",
1257
+ icon: "icon-date",
1258
+ options: {
1259
+ width: "100%",
1260
+ labelWidth: 100,
1261
+ isLabelWidth: false,
1262
+ defaultValue: "",
1263
+ readonly: false,
1264
+ disabled: false,
1265
+ editable: true,
1266
+ clearable: true,
1267
+ placeholder: "",
1268
+ startPlaceholder: "",
1269
+ endPlaceholder: "",
1270
+ type: "date",
1271
+ format: "yyyy-MM-dd",
1272
+ timestamp: false,
1273
+ required: false
1274
+ },
1275
+ events: {
1276
+ onChange: "",
1277
+ onFocus: "",
1278
+ onBlur: ""
1279
+ },
1280
+ key: "1667437845000_35857",
1281
+ model: "date_1667437845000_35857",
1282
+ rules: []
1283
+ }
1284
+ ]
1285
+ }
1286
+ ],
1287
+ options: {
1288
+ gutter: 0,
1289
+ justify: "start",
1290
+ align: "top",
1291
+ hideLabel: true
1292
+ },
1293
+ key: "1667437440000_79157",
1294
+ model: "company2",
1295
+ rules: []
1296
+ },
1297
+ {
1298
+ name: "家庭常住人口",
1299
+ type: "radio",
1300
+ icon: "icon-radio-active",
1301
+ options: {
1302
+ width: "",
1303
+ labelWidth: 100,
1304
+ isLabelWidth: false,
1305
+ inline: true,
1306
+ defaultValue: "",
1307
+ showLabel: false,
1308
+ options: [
1309
+ {
1310
+ value: "1-2人",
1311
+ label: "Option 1"
1312
+ },
1313
+ {
1314
+ value: "3-4人",
1315
+ label: "Option 2"
1316
+ },
1317
+ {
1318
+ value: "5-6人",
1319
+ label: "Option 3"
1320
+ },
1321
+ {
1322
+ value: "7人及以上",
1323
+ label: "新选项4"
1324
+ }
1325
+ ],
1326
+ required: false,
1327
+ remote: false,
1328
+ remoteOptions: [],
1329
+ props: {
1330
+ value: "value",
1331
+ label: "label"
1332
+ },
1333
+ remoteFunc: "",
1334
+ disabled: false,
1335
+ border: false,
1336
+ buttonType: false
1337
+ },
1338
+ events: {
1339
+ onChange: ""
1340
+ },
1341
+ key: "1667436801000_13265",
1342
+ model: "radio_1667436801000_13265",
1343
+ rules: []
1344
+ },
1345
+ {
1346
+ name: "资产信息",
1347
+ type: "divider",
1348
+ icon: "icon-fengexian",
1349
+ options: {
1350
+ width: "100%",
1351
+ defaultValue: "资产信息",
1352
+ hidden: false,
1353
+ labelWidth: 100,
1354
+ isLabelWidth: false,
1355
+ hideLabel: true,
1356
+ contentPosition: "left",
1357
+ remoteFunc: "",
1358
+ remoteOption: "",
1359
+ tableColumn: false
1360
+ },
1361
+ rules: [],
1362
+ key: "1667436969000_57389",
1363
+ model: "divider_1667436969000_57389"
1364
+ },
1365
+ {
1366
+ name: "房屋资产",
1367
+ type: "tabs",
1368
+ icon: "icon-tabs",
1369
+ tabs: [
1370
+ {
1371
+ label: "房屋资产",
1372
+ value: "tab1",
1373
+ list: [
1374
+ {
1375
+ name: "子表单",
1376
+ type: "table",
1377
+ icon: "icon-table",
1378
+ options: {
1379
+ height: "",
1380
+ defaultValue: "",
1381
+ customClass: "",
1382
+ labelWidth: 100,
1383
+ isLabelWidth: false,
1384
+ dataBind: true,
1385
+ validatorCheck: false,
1386
+ validator: "",
1387
+ paging: false,
1388
+ pageSize: 5,
1389
+ remoteFunc: "",
1390
+ remoteOption: "",
1391
+ tableColumn: false,
1392
+ hidden: false,
1393
+ hideLabel: true,
1394
+ disabled: false,
1395
+ required: false,
1396
+ isAdd: true,
1397
+ isDelete: true,
1398
+ isSerial: true,
1399
+ border: false,
1400
+ stripe: false,
1401
+ showHeader: true,
1402
+ highlightCurrentRow: false
1403
+ },
1404
+ list: [
1405
+ {
1406
+ name: "小区名称",
1407
+ type: "input",
1408
+ icon: "icon-input",
1409
+ options: {
1410
+ width: "",
1411
+ labelWidth: 100,
1412
+ isLabelWidth: false,
1413
+ defaultValue: "",
1414
+ dataType: "string",
1415
+ pattern: "",
1416
+ placeholder: "",
1417
+ maxlength: -1,
1418
+ required: false,
1419
+ disabled: false,
1420
+ readonly: false,
1421
+ clearable: false,
1422
+ showWordLimit: false,
1423
+ showPassword: false,
1424
+ prefixIcon: "",
1425
+ suffixIcon: "",
1426
+ prepend: "",
1427
+ append: "",
1428
+ hidden: false,
1429
+ hideLabel: true
1430
+ },
1431
+ events: {
1432
+ onChange: "",
1433
+ onFocus: "",
1434
+ onBlur: ""
1435
+ },
1436
+ key: "1667437006000_97519",
1437
+ model: "input_1667437006000_97519",
1438
+ rules: [
1439
+ {
1440
+ type: "string",
1441
+ message: "小区名称格式不正确"
1442
+ }
1443
+ ]
1444
+ },
1445
+ {
1446
+ name: "房屋总价",
1447
+ type: "input",
1448
+ icon: "icon-input",
1449
+ options: {
1450
+ width: "100%",
1451
+ labelWidth: 100,
1452
+ isLabelWidth: false,
1453
+ defaultValue: "",
1454
+ dataType: "string",
1455
+ pattern: "",
1456
+ placeholder: "",
1457
+ maxlength: -1,
1458
+ required: false,
1459
+ disabled: false,
1460
+ readonly: false,
1461
+ clearable: false,
1462
+ showWordLimit: false,
1463
+ showPassword: false,
1464
+ prefixIcon: "",
1465
+ suffixIcon: "",
1466
+ prepend: "",
1467
+ append: "",
1468
+ hidden: false,
1469
+ hideLabel: true
1470
+ },
1471
+ events: {
1472
+ onChange: "",
1473
+ onFocus: "",
1474
+ onBlur: ""
1475
+ },
1476
+ key: "1667437037000_66597",
1477
+ model: "input_1667437037000_66597",
1478
+ rules: [
1479
+ {
1480
+ type: "string",
1481
+ message: "房屋总价格式不正确"
1482
+ }
1483
+ ]
1484
+ },
1485
+ {
1486
+ name: "房屋地址",
1487
+ type: "input",
1488
+ icon: "icon-input",
1489
+ options: {
1490
+ width: "",
1491
+ labelWidth: 100,
1492
+ isLabelWidth: false,
1493
+ defaultValue: "",
1494
+ dataType: "string",
1495
+ pattern: "",
1496
+ placeholder: "",
1497
+ maxlength: -1,
1498
+ required: false,
1499
+ disabled: false,
1500
+ readonly: false,
1501
+ clearable: false,
1502
+ showWordLimit: false,
1503
+ showPassword: false,
1504
+ prefixIcon: "",
1505
+ suffixIcon: "",
1506
+ prepend: "",
1507
+ append: "",
1508
+ hidden: false,
1509
+ hideLabel: true
1510
+ },
1511
+ events: {
1512
+ onChange: "",
1513
+ onFocus: "",
1514
+ onBlur: ""
1515
+ },
1516
+ key: "1667437009000_89874",
1517
+ model: "input_1667437009000_89874",
1518
+ rules: [
1519
+ {
1520
+ type: "string",
1521
+ message: "房屋地址格式不正确"
1522
+ }
1523
+ ]
1524
+ }
1525
+ ],
1526
+ key: "1667436993000_20896",
1527
+ model: "table_1667436993000_20896",
1528
+ rules: []
1529
+ }
1530
+ ]
1531
+ },
1532
+ {
1533
+ label: "车辆资产",
1534
+ value: "tab2",
1535
+ list: [
1536
+ {
1537
+ name: "子表单",
1538
+ type: "table",
1539
+ icon: "icon-table",
1540
+ options: {
1541
+ height: "",
1542
+ defaultValue: "",
1543
+ customClass: "",
1544
+ labelWidth: 100,
1545
+ isLabelWidth: false,
1546
+ dataBind: true,
1547
+ validatorCheck: false,
1548
+ validator: "",
1549
+ paging: false,
1550
+ pageSize: 5,
1551
+ remoteFunc: "",
1552
+ remoteOption: "",
1553
+ tableColumn: false,
1554
+ hidden: false,
1555
+ hideLabel: true,
1556
+ disabled: false,
1557
+ required: false,
1558
+ isAdd: true,
1559
+ isDelete: true,
1560
+ isSerial: true,
1561
+ border: false,
1562
+ stripe: false,
1563
+ showHeader: true,
1564
+ highlightCurrentRow: false
1565
+ },
1566
+ list: [
1567
+ {
1568
+ name: "车辆名称",
1569
+ type: "input",
1570
+ icon: "icon-input",
1571
+ options: {
1572
+ width: "",
1573
+ labelWidth: 100,
1574
+ isLabelWidth: false,
1575
+ defaultValue: "",
1576
+ dataType: "string",
1577
+ pattern: "",
1578
+ placeholder: "",
1579
+ maxlength: -1,
1580
+ required: false,
1581
+ disabled: false,
1582
+ readonly: false,
1583
+ clearable: false,
1584
+ showWordLimit: false,
1585
+ showPassword: false,
1586
+ prefixIcon: "",
1587
+ suffixIcon: "",
1588
+ prepend: "",
1589
+ append: "",
1590
+ hidden: false,
1591
+ hideLabel: true
1592
+ },
1593
+ events: {
1594
+ onChange: "",
1595
+ onFocus: "",
1596
+ onBlur: ""
1597
+ },
1598
+ key: "1667437284000_96215",
1599
+ model: "carName",
1600
+ rules: [
1601
+ {
1602
+ type: "string",
1603
+ message: "车辆名称格式不正确"
1604
+ }
1605
+ ]
1606
+ },
1607
+ {
1608
+ name: "车辆价格",
1609
+ type: "input",
1610
+ icon: "icon-input",
1611
+ options: {
1612
+ width: "100%",
1613
+ labelWidth: 100,
1614
+ isLabelWidth: false,
1615
+ defaultValue: "",
1616
+ dataType: "string",
1617
+ pattern: "",
1618
+ placeholder: "",
1619
+ maxlength: -1,
1620
+ required: false,
1621
+ disabled: false,
1622
+ readonly: false,
1623
+ clearable: false,
1624
+ showWordLimit: false,
1625
+ showPassword: false,
1626
+ prefixIcon: "",
1627
+ suffixIcon: "",
1628
+ prepend: "",
1629
+ append: "",
1630
+ hidden: false,
1631
+ hideLabel: true
1632
+ },
1633
+ events: {
1634
+ onChange: "",
1635
+ onFocus: "",
1636
+ onBlur: ""
1637
+ },
1638
+ key: "1667437294000_98905",
1639
+ model: "input_1667437294000_98905",
1640
+ rules: [
1641
+ {
1642
+ type: "string",
1643
+ message: "车辆价格格式不正确"
1644
+ }
1645
+ ]
1646
+ },
1647
+ {
1648
+ name: "购入日期",
1649
+ type: "date",
1650
+ icon: "icon-date",
1651
+ options: {
1652
+ width: "",
1653
+ labelWidth: 100,
1654
+ isLabelWidth: false,
1655
+ defaultValue: "",
1656
+ readonly: false,
1657
+ disabled: false,
1658
+ editable: true,
1659
+ clearable: true,
1660
+ placeholder: "",
1661
+ startPlaceholder: "",
1662
+ endPlaceholder: "",
1663
+ type: "date",
1664
+ format: "yyyy-MM-dd",
1665
+ timestamp: false,
1666
+ required: false,
1667
+ hideLabel: true
1668
+ },
1669
+ events: {
1670
+ onChange: "",
1671
+ onFocus: "",
1672
+ onBlur: ""
1673
+ },
1674
+ key: "1667437375000_47132",
1675
+ model: "date_1667437375000_47132",
1676
+ rules: []
1677
+ }
1678
+ ],
1679
+ key: "1667437282000_33973",
1680
+ model: "table_1667437282000_33973",
1681
+ rules: []
1682
+ }
1683
+ ]
1684
+ }
1685
+ ],
1686
+ options: {
1687
+ defaultValue: "tab2",
1688
+ type: "",
1689
+ tabPosition: "top",
1690
+ customClass: "",
1691
+ hidden: false,
1692
+ labelWidth: 100,
1693
+ isLabelWidth: false,
1694
+ hideLabel: true,
1695
+ remote: false,
1696
+ remoteFunc: "",
1697
+ remoteOption: "",
1698
+ tableColumn: false
1699
+ },
1700
+ rules: [],
1701
+ key: "1667436941000_19317",
1702
+ model: "tabs_1667436941000_19317"
1703
+ }
1704
+ ],
1705
+ config: {
1706
+ ui: "element",
1707
+ title: "",
1708
+ width: "",
1709
+ labelWidth: 100,
1710
+ labelPosition: "right",
1711
+ labelSuffix: ":",
1712
+ size: "small",
1713
+ disabled: false,
1714
+ hideLabel: false,
1715
+ eventScript: [
1716
+ {
1717
+ key: "mounted",
1718
+ name: "mounted",
1719
+ func: ""
1720
+ },
1721
+ {
1722
+ key: "refresh",
1723
+ name: "refresh",
1724
+ func: ""
1725
+ },
1726
+ {
1727
+ key: 1667437911752,
1728
+ name: "statusChange",
1729
+ func:
1730
+ "if(value === '在职') {\n this.display([ 'company2' ])\n}else {\n this.hide([ 'company2' ])\n}"
1731
+ }
1732
+ ]
1733
+ }
1734
+ },
1735
+ null,
1736
+ 2
1737
+ );
1738
+ },
1739
+ methods: {
1740
+ // 读取excel file
1741
+ readExcelFile(file){//文件读取
1742
+ return new Promise(resolve => {
1743
+ let reader = new FileReader();
1744
+ reader.readAsBinaryString(file);//以二进制的方式读取
1745
+ reader.onload = ev =>{
1746
+ resolve(ev.target.result);
1747
+ }
1748
+ })
1749
+ },
1750
+ // excel 文件上传 改变监听
1751
+ async onExcelFileChange(ev) {
1752
+ let file = ev.raw;
1753
+ if(!file){
1754
+ console.log("文件打开失败")
1755
+ return ;
1756
+ }else{
1757
+ let data = await this.readExcelFile(file);
1758
+ //XLSX 文档 https://www.npmjs.com/package/xlsx
1759
+ let workbook = XLSX.read(data,{ type: "binary"});//解析二进制格式数据
1760
+ let worksheet = workbook.Sheets[workbook.SheetNames[0]];//获取第一个Sheet
1761
+ let result = XLSX.utils.sheet_to_txt(worksheet);//cvs数据格式
1762
+ console.log(result)
1763
+
1764
+ // let rowData = result.split('\n')
1765
+ // if(rowData.length>0){
1766
+ // for(let i =0;i<rowData.length;i++){
1767
+ // let rowStr = rowData[i]
1768
+ // rowData[i] = this.analysisExcelRow(rowStr)
1769
+ // }
1770
+ // }
1771
+ // console.log(rowData)
1772
+ // console.log(JSON.stringify(rowData))
1773
+ }
1774
+ },
1775
+ // 解析row 数据
1776
+ analysisExcelRow(rowItem) {
1777
+ let rowData = {
1778
+ colCount: 0,
1779
+ col: []
1780
+ }
1781
+ let array = rowItem.split(',')
1782
+ if(array.length > 0){
1783
+ rowData.colCount = array.length
1784
+ let colItem = {
1785
+ span: 0,
1786
+ label: ''
1787
+ }
1788
+ array.forEach((item, index)=>{
1789
+ // 如果读取到的行数据为空 则认为是空格列
1790
+ if(item&&item !== ''){
1791
+ colItem = {
1792
+ span: 0,
1793
+ label: item
1794
+ }
1795
+ }
1796
+ colItem.span++
1797
+ if(index === array.length-1){
1798
+ rowData.col.push(colItem)
1799
+ }else{
1800
+ // 如果下一条数据有值,前面的列为一个整体作为一条元素
1801
+ let nextItem = array[index+1]
1802
+ if(nextItem&&nextItem !== ''){
1803
+ rowData.col.push(colItem)
1804
+ }
1805
+ }
1806
+ })
1807
+ }
1808
+ return rowData
1809
+ },
1810
+ initClipboard() {
1811
+ if (!this.jsonClipboard) {
1812
+ this.jsonClipboard = new Clipboard(".json-btn");
1813
+ this.jsonClipboard.on("success", e => {
1814
+ this.$message.success("复制成功");
1815
+ });
1816
+ }
1817
+ },
1818
+ handleConfigSelect(value) {
1819
+ this.configTab = value;
1820
+ },
1821
+ handlePreview() {
1822
+ this.slotKeys = Object.keys(this.$slots);
1823
+ this.dialog.preview.visible = true;
1824
+ },
1825
+ handleGetData() {
1826
+ this.$refs.generateForm.getData().then(data => {
1827
+ this.dialog.data = {
1828
+ visible: true,
1829
+ value: JSON.stringify(data, null, 2),
1830
+ valueCopy: JSON.stringify(data, null, 2)
1831
+ };
1832
+ this.$nextTick(() => {
1833
+ this.initClipboard();
1834
+ });
1835
+ });
1836
+ },
1837
+ handleReset() {
1838
+ this.$refs.generateForm.reset();
1839
+ },
1840
+ handleGenerateJson() {
1841
+ this.dialog.config = {
1842
+ visible: true,
1843
+ value: JSON.stringify(this.widgetFormData, null, 2),
1844
+ valueCopy: JSON.stringify(this.widgetFormData, null, 2)
1845
+ };
1846
+ this.$nextTick(() => {
1847
+ this.initClipboard();
1848
+ });
1849
+ },
1850
+ handleGenerateCode() {
1851
+ this.dialog.code = {
1852
+ visible: true,
1853
+ valueHtml: generateCode(JSON.stringify(this.widgetFormData), "html"),
1854
+ valueVue: generateCode(JSON.stringify(this.widgetFormData), "vue"),
1855
+ type: "vue"
1856
+ };
1857
+ },
1858
+ handleUploadJson() {
1859
+ try {
1860
+ this.setJSON(JSON.parse(this.dialog.import.value));
1861
+ this.dialog.import.visible = false;
1862
+ } catch (e) {
1863
+ this.$message.error(e.message);
1864
+ }
1865
+ },
1866
+ handleDialogFullscreen() {
1867
+ this.$refs.vueCodeEditor.resize();
1868
+ this.$refs.htmlCodeEditor.resize();
1869
+ },
1870
+ handleClear() {
1871
+ this.widgetFormData = {
1872
+ list: [],
1873
+ config: baseConfig
1874
+ };
1875
+
1876
+ this.widgetFormSelect = {};
1877
+ },
1878
+ clear() {
1879
+ this.handleClear();
1880
+ },
1881
+ getJSON() {
1882
+ return this.widgetFormData;
1883
+ },
1884
+ getHtml() {
1885
+ return generateCode(JSON.stringify(this.widgetFormData));
1886
+ },
1887
+ setJSON(json) {
1888
+ this.widgetFormData = json;
1889
+
1890
+ if (json.list.length > 0) {
1891
+ this.widgetFormSelect = json.list[0];
1892
+ }
1893
+ },
1894
+ handleDataChange(field, value, data) {
1895
+ // console.log(field, value, data);
1896
+ }
1897
+ },
1898
+ watch: {
1899
+ widgetFormData: {
1900
+ deep: true,
1901
+ handler: function(val) {
1902
+ // console.log(this.$refs.widgetForm);
1903
+ }
1904
+ }
1905
+ }
1906
+ };
1907
+ </script>