cloud-web-corejs 1.1.0-dev.9 → 1.1.0-dev.90

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 (675) hide show
  1. package/README.md +38 -0
  2. package/bin/core-resources.js +16 -0
  3. package/bin/create-child-app.js +34 -0
  4. package/docs/child-app/README.md +95 -0
  5. package/docs/child-app/activiti-resources.md +63 -0
  6. package/docs/child-app/generate-prompt.md +55 -0
  7. package/docs/child-app/luckysheet-resources.md +80 -0
  8. package/docs/child-app/public-resources-plan.md +288 -0
  9. package/docs/child-app/resources-implementation.md +101 -0
  10. package/docs/child-app/tinymce-resources.md +88 -0
  11. package/docs/child-app/validation.md +34 -0
  12. package/docs/qiankun/346/216/245/345/205/245/345/215/217/350/256/256.md +298 -0
  13. package/docs/qiankun/350/257/246/346/203/205/346/211/277/350/275/275/345/255/220/345/272/224/347/224/250/345/257/271/346/216/245/346/270/205/345/215/225.md +111 -0
  14. package/package.json +234 -203
  15. package/resource-tools/index.js +126 -0
  16. package/src/app-bootstrap.js +539 -0
  17. package/src/app-bootstrap.sync.js +510 -0
  18. package/src/boot-assets.legacy.js +13 -0
  19. package/src/boot-assets.next.js +7 -0
  20. package/src/components/Qrcode/fileParse.vue +15 -4
  21. package/src/components/Tinymce/dynamicLoadScript.js +51 -59
  22. package/src/components/Tinymce/index.vue +435 -336
  23. package/src/components/Tinymce/mce-chrome.scss +150 -0
  24. package/src/components/VabUpload/fileLibraryDialog.vue +18 -18
  25. package/src/components/VabUpload/image-viewer.vue +19 -11
  26. package/src/components/VabUpload/index.js +11 -4
  27. package/src/components/VabUpload/index.vue +1 -1
  28. package/src/components/VabUpload/mixins/fileLibraryDialog.js +14 -12
  29. package/src/components/VabUpload/mixins.js +78 -43
  30. package/src/components/VabUpload/partUploadConfig.js +95 -0
  31. package/src/components/VabUpload/privateProfileDialog.vue +18 -18
  32. package/src/components/VabUpload/privateProfileDialogMixins.js +14 -12
  33. package/src/components/VabUpload/style.scss +282 -0
  34. package/src/components/VabUpload/view.vue +29 -25
  35. package/src/components/base-textarea/index.vue +2 -4
  36. package/src/components/baseArea/index.vue +10 -10
  37. package/src/components/baseAttachment/index.vue +1 -0
  38. package/src/components/baseAttachment/mixins.js +17 -0
  39. package/src/components/baseAttachment/showList.vue +12 -2
  40. package/src/components/baseAttachment/uploadDialog.vue +2 -1
  41. package/src/components/baseAutocomplete/README.md +157 -0
  42. package/src/components/baseAutocomplete/index.vue +489 -0
  43. package/src/components/baseAutocomplete/query.js +36 -0
  44. package/src/components/baseInputExport/mixins.js +1 -6
  45. package/src/components/bizTab/BizTabListPage.vue +57 -26
  46. package/src/components/bizTab/README.md +3 -1
  47. package/src/components/bizTab/bizBillDetailMixin.js +2 -0
  48. package/src/components/code-editor/ace-chrome.scss +17 -0
  49. package/src/components/code-editor/async.js +3 -1
  50. package/src/components/code-editor/index.vue +361 -340
  51. package/src/components/errorMsg/index.js +8 -2
  52. package/src/components/errorMsg/index.vue +152 -15
  53. package/src/components/errorMsg/mixins.js +70 -1
  54. package/src/components/excelExport/conditionExportConfig.js +112 -0
  55. package/src/components/excelExport/exportColumnMemory.js +118 -0
  56. package/src/components/excelExport/exportFieldDialog.vue +50 -38
  57. package/src/components/excelExport/exportType.js +8 -0
  58. package/src/components/excelExport/index.js +30 -13
  59. package/src/components/excelExport/index.vue +7 -1
  60. package/src/components/excelExport/mixins.js +782 -293
  61. package/src/components/excelImport/index.vue +1 -1
  62. package/src/components/excelImport/mixins.js +888 -834
  63. package/src/components/extendedProperties/view.vue +4 -5
  64. package/src/components/fileLibrary/fileObjAuthEdit.vue +1 -1
  65. package/src/components/fileLibrary/fileObjAuthEditDialog.vue +3 -5
  66. package/src/components/fileLibrary/filterDialog.vue +2 -2
  67. package/src/components/fileLibrary/index.vue +13 -13
  68. package/src/components/fileLibrary/mixins/fileObjAuthDialogMixin.js +2 -2
  69. package/src/components/fileLibrary/mixins/indexMixins.js +6 -4
  70. package/src/components/fileLibrary/mixins/recycleBinDialogMixins.js +1 -1
  71. package/src/components/fileLibrary/propertiesDialog.vue +1 -1
  72. package/src/components/fileLibrary/recycleBinDialog.vue +2 -2
  73. package/src/components/fileLibrary/recycleBinPropertiesDialog.vue +1 -2
  74. package/src/components/fileLibrary/style.scss +579 -0
  75. package/src/components/formDialog/index.vue +12 -9
  76. package/src/components/formDrawer/drawer.vue +1 -1
  77. package/src/components/hiprint/etypes/default-etyps-provider.js +22 -22
  78. package/src/components/hiprint/hiprint.bundle.js +5 -1
  79. package/src/components/hiprint/hiprint.config.js +29 -29
  80. package/src/components/hiprint/style.scss +188 -0
  81. package/src/components/hiprint/view/design/dialog.vue +3 -4
  82. package/src/components/hiprint/view/design/font-size.js +2 -2
  83. package/src/components/hiprint/view/design/index.vue +27 -29
  84. package/src/components/hiprint/view/design/mixins.js +22 -22
  85. package/src/components/hiprint/view/design/preview.vue +9 -10
  86. package/src/components/hiprint/view/design/scale.js +1 -1
  87. package/src/components/hiprint/view/json-view.vue +10 -10
  88. package/src/components/jdPrint/mixins.js +2 -0
  89. package/src/components/jsonImport/exportDialog.vue +2 -2
  90. package/src/components/jsonImport/index.js +5 -2
  91. package/src/components/jsonImport/index.vue +1 -1
  92. package/src/components/jsonImport/mixins.js +6 -10
  93. package/src/components/langImport/index.vue +2 -3
  94. package/src/components/langImport/mixins.js +6 -10
  95. package/src/components/luckysheet/dialog.vue +1 -1
  96. package/src/components/luckysheet/loadResources.js +64 -0
  97. package/src/components/luckysheet/view.vue +239 -210
  98. package/src/components/messageBox/index.js +68 -0
  99. package/src/components/messageBox/index.vue +77 -0
  100. package/src/components/messageBox/mixins.js +155 -0
  101. package/src/components/mobile/buttonGroup/index.vue +4 -5
  102. package/src/components/mobile/file/index.vue +7 -7
  103. package/src/components/mobile/oplogTable/index.vue +4 -4
  104. package/src/components/mobile/searchDialog/index.vue +3 -4
  105. package/src/components/mobile/wf/addTaskUserdialog.vue +99 -100
  106. package/src/components/mobile/wf/content.vue +1730 -1701
  107. package/src/components/mobile/wf/deleteTaskUserDialog.vue +73 -73
  108. package/src/components/mobile/wf/mixins/wfStartDialogMixin.js +1 -1
  109. package/src/components/mobile/wf/selectUserDialog.vue +21 -25
  110. package/src/components/mobile/wf/setCandidateDialog.vue +68 -69
  111. package/src/components/mobile/wf/urgingDialog.vue +75 -75
  112. package/src/components/mobile/wf/wfStartDialog.vue +2 -2
  113. package/src/components/obsUpload/index.js +4 -1
  114. package/src/components/obsUpload/index.vue +1 -1
  115. package/src/components/obsUpload/mixins.js +37 -14
  116. package/src/components/onlineTalk/index.vue +25 -28
  117. package/src/components/onlineTalk/mixins.js +24 -10
  118. package/src/components/table/index.js +96 -81
  119. package/src/components/table/plugins/cell-area/index.js +10 -3
  120. package/src/components/table/style.scss +1399 -0
  121. package/src/components/table/vxeFilter/FilterComplex.vue +6 -6
  122. package/src/components/table/vxeFilter/FilterInput.vue +1 -1
  123. package/src/components/table/vxeFilter/mixin.js +326 -316
  124. package/src/components/wf/addTaskUserdialog.vue +1 -1
  125. package/src/components/wf/content.vue +11 -12
  126. package/src/components/wf/content2.vue +58 -77
  127. package/src/components/wf/formIframeDialog.vue +1 -1
  128. package/src/components/wf/index.vue +1 -1
  129. package/src/components/wf/style.scss +265 -0
  130. package/src/components/wf/wf.js +25 -5
  131. package/src/components/wf/wfActionItems.js +3 -0
  132. package/src/components/wf/wfStartDialog.vue +1 -0
  133. package/src/components/wf/wfTransferEnabled.js +54 -0
  134. package/src/components/wf/wfUtil.js +47 -29
  135. package/src/components/wf/wfVisibility.js +6 -0
  136. package/src/components/xform/docs/2026-07 table/344/270/216excelExport/344/277/256/345/244/215/345/217/212/345/257/274/345/207/272/344/274/230/345/214/226.md" +64 -57
  137. package/src/components/xform/docs/2026-08 xform H5 P0 /345/256/236/347/216/260/350/247/204/346/240/274.md" +1 -1
  138. package/src/components/xform/docs/2026-08 xform /347/247/273/345/212/250/347/253/257/345/270/203/345/261/200/345/257/271/351/275/220 bill_setting /346/226/271/346/241/210.md" +1 -1
  139. package/src/components/xform/docs/2026-09 /345/212/250/346/200/201/345/255/227/346/256/265/350/247/204/345/210/231/344/270/216/346/265/201/347/250/213/346/216/247/345/210/266/346/211/247/350/241/214/351/241/272/345/272/217/350/220/275/345/234/260/346/226/271/346/241/210.md" +409 -0
  140. package/src/components/xform/docs/2026-09 /346/235/241/344/273/266/345/257/274/345/207/272/345/244/247/346/225/260/346/215/256/351/207/217/345/264/251/346/272/203/346/216/222/346/237/245.md" +389 -0
  141. package/src/components/xform/docs/2026-09 /346/265/217/350/247/210/345/231/250/345/264/251/346/272/203/346/262/273/347/220/206P0/344/273/243/347/240/201/350/257/204/345/256/241.md" +255 -0
  142. package/src/components/xform/docs/2026-09 /346/265/217/350/247/210/345/231/250/345/264/251/346/272/203/346/262/273/347/220/206P0/346/265/213/350/257/225/351/252/214/350/257/201/345/256/236/346/226/275/346/226/207/346/241/243.md" +595 -0
  143. package/src/components/xform/docs/2026-09 /347/274/226/350/276/221/350/241/250/350/241/214/345/206/205/344/277/235/345/255/230/346/240/241/351/252/214/350/214/203/345/233/264/344/270/216/345/210/227/345/277/205/345/241/253/350/247/243/346/236/220/344/277/256/345/244/215.md" +233 -0
  144. package/src/components/xform/docs/2026-09 /350/241/250/345/215/225/345/257/274/345/205/245/351/200/232/351/201/223/346/242/263/347/220/206/344/270/216/350/220/275/345/234/260/346/226/271/346/241/210.md" +745 -0
  145. package/src/components/xform/docs//345/270/270/347/224/250/350/204/232/346/234/254/350/260/203/347/224/250.md +227 -0
  146. package/src/components/xform/docs//346/265/217/350/247/210/345/231/250/345/264/251/346/272/203/346/262/273/347/220/206/344/270/216/344/277/256/345/244/215/350/220/275/345/234/260/346/226/271/346/241/210.md +324 -0
  147. package/src/components/xform/docs//346/266/210/346/201/257/346/241/206/350/207/252/345/256/232/344/271/211/346/214/211/351/222/256/350/257/264/346/230/216.md +92 -0
  148. package/src/components/xform/docs//347/272/247/350/201/224/351/200/211/346/213/251/346/207/222/345/212/240/350/275/275/344/275/277/347/224/250/350/257/264/346/230/216.md +247 -0
  149. package/src/components/xform/form-designer/designer.js +2133 -2084
  150. package/src/components/xform/form-designer/form-widget/components/gantt/index.vue +74 -76
  151. package/src/components/xform/form-designer/form-widget/container-widget/data-table-mixin.js +7 -0
  152. package/src/components/xform/form-designer/form-widget/container-widget/data-table-widget.vue +5 -3
  153. package/src/components/xform/form-designer/form-widget/container-widget/detail-h5-widget.vue +243 -227
  154. package/src/components/xform/form-designer/form-widget/container-widget/detail-temp-widget.vue +1 -1
  155. package/src/components/xform/form-designer/form-widget/container-widget/h5-card-pane-widget.vue +228 -207
  156. package/src/components/xform/form-designer/form-widget/container-widget/h5-card-widget.vue +165 -136
  157. package/src/components/xform/form-designer/form-widget/container-widget/list-h5-widget.vue +6 -6
  158. package/src/components/xform/form-designer/form-widget/dialog/baseFormulaDialog copy.vue +1 -1
  159. package/src/components/xform/form-designer/form-widget/dialog/baseFormulaDialog.vue +1 -1
  160. package/src/components/xform/form-designer/form-widget/dialog/formDialog.vue +30 -4
  161. package/src/components/xform/form-designer/form-widget/dialog/formFieldDialog.vue +5 -5
  162. package/src/components/xform/form-designer/form-widget/dialog/formulaDialog.vue +2 -2
  163. package/src/components/xform/form-designer/form-widget/dialog/importDialog.vue +11 -6
  164. package/src/components/xform/form-designer/form-widget/dialog/importDialogMixin.js +2657 -1774
  165. package/src/components/xform/form-designer/form-widget/dialog/searchFormDialog.vue +27 -4
  166. package/src/components/xform/form-designer/form-widget/dialog/treeMoveDialog.vue +4 -6
  167. package/src/components/xform/form-designer/form-widget/dialog/vabSearchDialog.vue +3 -3
  168. package/src/components/xform/form-designer/form-widget/field-widget/a-link-widget.vue +1 -1
  169. package/src/components/xform/form-designer/form-widget/field-widget/a-text-widget.vue +1 -1
  170. package/src/components/xform/form-designer/form-widget/field-widget/area-select-widget.vue +3 -3
  171. package/src/components/xform/form-designer/form-widget/field-widget/autocomplete-widget.vue +2 -2
  172. package/src/components/xform/form-designer/form-widget/field-widget/baseAttachment-widget.vue +9 -2
  173. package/src/components/xform/form-designer/form-widget/field-widget/button-widget.vue +1 -1
  174. package/src/components/xform/form-designer/form-widget/field-widget/cascader-widget.vue +447 -14
  175. package/src/components/xform/form-designer/form-widget/field-widget/census-widget.vue +1 -1
  176. package/src/components/xform/form-designer/form-widget/field-widget/checkbox-widget.vue +1 -1
  177. package/src/components/xform/form-designer/form-widget/field-widget/color-widget.vue +1 -1
  178. package/src/components/xform/form-designer/form-widget/field-widget/copy_button-widget.vue +2 -2
  179. package/src/components/xform/form-designer/form-widget/field-widget/date-range-widget.vue +3 -3
  180. package/src/components/xform/form-designer/form-widget/field-widget/date-widget.vue +2 -2
  181. package/src/components/xform/form-designer/form-widget/field-widget/descriptions-widget.vue +1 -1
  182. package/src/components/xform/form-designer/form-widget/field-widget/divider-widget.vue +1 -1
  183. package/src/components/xform/form-designer/form-widget/field-widget/download-button-widget.vue +1 -1
  184. package/src/components/xform/form-designer/form-widget/field-widget/dropdown-item-widget.vue +1 -1
  185. package/src/components/xform/form-designer/form-widget/field-widget/dropdown-widget.vue +35 -4
  186. package/src/components/xform/form-designer/form-widget/field-widget/echart-bar-widget.vue +1 -1
  187. package/src/components/xform/form-designer/form-widget/field-widget/echart-category-widget.vue +1 -1
  188. package/src/components/xform/form-designer/form-widget/field-widget/echart-pie-widget.vue +1 -1
  189. package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +70 -10
  190. package/src/components/xform/form-designer/form-widget/field-widget/file-upload-widget.vue +14 -17
  191. package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +16 -6
  192. package/src/components/xform/form-designer/form-widget/field-widget/gantt-widget.vue +176 -176
  193. package/src/components/xform/form-designer/form-widget/field-widget/html-text-widget.vue +1 -1
  194. package/src/components/xform/form-designer/form-widget/field-widget/import-button-widget.vue +19 -6
  195. package/src/components/xform/form-designer/form-widget/field-widget/import2-button-widget.vue +1 -1
  196. package/src/components/xform/form-designer/form-widget/field-widget/index.js +10 -1
  197. package/src/components/xform/form-designer/form-widget/field-widget/input-batch-widget.vue +1 -1
  198. package/src/components/xform/form-designer/form-widget/field-widget/input-widget.vue +29 -3
  199. package/src/components/xform/form-designer/form-widget/field-widget/mixins/autocomplete-mixin.js +22 -11
  200. package/src/components/xform/form-designer/form-widget/field-widget/mixins/date-limit-mixin.js +3 -3
  201. package/src/components/xform/form-designer/form-widget/field-widget/mixins/relativeDateUtil.js +4 -4
  202. package/src/components/xform/form-designer/form-widget/field-widget/mixins/time-limit-mixin.js +1 -1
  203. package/src/components/xform/form-designer/form-widget/field-widget/multiSearch-widget.vue +1 -1
  204. package/src/components/xform/form-designer/form-widget/field-widget/news-list-widget.vue +1 -1
  205. package/src/components/xform/form-designer/form-widget/field-widget/number-widget.vue +1 -1
  206. package/src/components/xform/form-designer/form-widget/field-widget/oplog-widget.vue +1 -1
  207. package/src/components/xform/form-designer/form-widget/field-widget/picture-upload-widget.vue +5 -5
  208. package/src/components/xform/form-designer/form-widget/field-widget/print-button-widget.vue +3 -3
  209. package/src/components/xform/form-designer/form-widget/field-widget/print-detail-button-widget.vue +3 -3
  210. package/src/components/xform/form-designer/form-widget/field-widget/project-tag-widget.vue +1 -1
  211. package/src/components/xform/form-designer/form-widget/field-widget/radio-widget.vue +1 -1
  212. package/src/components/xform/form-designer/form-widget/field-widget/rate-widget.vue +1 -1
  213. package/src/components/xform/form-designer/form-widget/field-widget/rich-editor-widget.vue +68 -27
  214. package/src/components/xform/form-designer/form-widget/field-widget/row-col-select-widget.vue +64 -0
  215. package/src/components/xform/form-designer/form-widget/field-widget/save_submit_wf_button-widget.vue +1 -1
  216. package/src/components/xform/form-designer/form-widget/field-widget/script-input-widget.vue +2 -2
  217. package/src/components/xform/form-designer/form-widget/field-widget/search_button-widget.vue +1 -1
  218. package/src/components/xform/form-designer/form-widget/field-widget/select-export-button-widget.vue +1 -1
  219. package/src/components/xform/form-designer/form-widget/field-widget/select-export-item-button-widget.vue +6 -2
  220. package/src/components/xform/form-designer/form-widget/field-widget/select-widget.vue +2 -2
  221. package/src/components/xform/form-designer/form-widget/field-widget/singerSearch-widget.vue +1 -1
  222. package/src/components/xform/form-designer/form-widget/field-widget/singleUpload-widget.vue +145 -145
  223. package/src/components/xform/form-designer/form-widget/field-widget/slider-widget.vue +1 -1
  224. package/src/components/xform/form-designer/form-widget/field-widget/static-content-wrapper.vue +1 -1
  225. package/src/components/xform/form-designer/form-widget/field-widget/static-text-widget.vue +2 -2
  226. package/src/components/xform/form-designer/form-widget/field-widget/status-widget.vue +1 -1
  227. package/src/components/xform/form-designer/form-widget/field-widget/switch-widget.vue +4 -4
  228. package/src/components/xform/form-designer/form-widget/field-widget/table-export-button-widget.vue +3 -2
  229. package/src/components/xform/form-designer/form-widget/field-widget/tempStorage-widget.vue +2 -2
  230. package/src/components/xform/form-designer/form-widget/field-widget/text-widget.vue +1 -1
  231. package/src/components/xform/form-designer/form-widget/field-widget/textarea-widget.vue +1 -1
  232. package/src/components/xform/form-designer/form-widget/field-widget/time-range-widget.vue +3 -3
  233. package/src/components/xform/form-designer/form-widget/field-widget/time-widget.vue +2 -2
  234. package/src/components/xform/form-designer/form-widget/field-widget/title-head-widget.vue +2 -2
  235. package/src/components/xform/form-designer/form-widget/field-widget/vabSearch-widget.vue +1 -1
  236. package/src/components/xform/form-designer/form-widget/field-widget/vabUpload-widget.vue +2 -1
  237. package/src/components/xform/form-designer/form-widget/field-widget/vabUpload2-widget.vue +436 -113
  238. package/src/components/xform/form-designer/form-widget/field-widget/vue-page-widget.vue +3 -3
  239. package/src/components/xform/form-designer/setting-panel/action-button-config-dialog.vue +21 -21
  240. package/src/components/xform/form-designer/setting-panel/dataSource-setting.vue +46 -46
  241. package/src/components/xform/form-designer/setting-panel/form-dynamicField-setting.vue +683 -602
  242. package/src/components/xform/form-designer/setting-panel/form-setting.vue +307 -82
  243. package/src/components/xform/form-designer/setting-panel/indexMixin.js +52 -0
  244. package/src/components/xform/form-designer/setting-panel/option-items-setting.vue +9 -9
  245. package/src/components/xform/form-designer/setting-panel/property-editor/censusItems-editor.vue +6 -6
  246. package/src/components/xform/form-designer/setting-panel/property-editor/colorClass-editor.vue +4 -4
  247. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/condition-editor.vue +1 -1
  248. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +385 -79
  249. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/edit-tree-button-group-config-dialog.vue +17 -17
  250. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/exportItemColumns-dialog.vue +14 -14
  251. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +99 -79
  252. package/src/components/xform/form-designer/setting-panel/property-editor/container-detail/detail-editor.vue +1 -2
  253. package/src/components/xform/form-designer/setting-panel/property-editor/container-detail/detail-temp-edito.vue +13 -1
  254. package/src/components/xform/form-designer/setting-panel/property-editor/container-detail-plain/detail-plain-editor.vue +1 -2
  255. package/src/components/xform/form-designer/setting-panel/property-editor/container-list-h5/list-h5-editor.vue +40 -29
  256. package/src/components/xform/form-designer/setting-panel/property-editor/container-tab/tab-lazyRender-editor.vue +27 -0
  257. package/src/components/xform/form-designer/setting-panel/property-editor/container-table/table-dynamicField-editor.vue +39 -56
  258. package/src/components/xform/form-designer/setting-panel/property-editor/container-table/table-fullWidth-editor.vue +1 -1
  259. package/src/components/xform/form-designer/setting-panel/property-editor/container-tree/tree-customClass-editor.vue +6 -6
  260. package/src/components/xform/form-designer/setting-panel/property-editor/container-tree-pane/tree-pane-editor.vue +1 -1
  261. package/src/components/xform/form-designer/setting-panel/property-editor/contentHeight-editor.vue +23 -0
  262. package/src/components/xform/form-designer/setting-panel/property-editor/copyButton-editor.vue +1 -1
  263. package/src/components/xform/form-designer/setting-panel/property-editor/descriptionsItems-editor.vue +8 -8
  264. package/src/components/xform/form-designer/setting-panel/property-editor/downloadButtonFlag-editor.vue +4 -4
  265. package/src/components/xform/form-designer/setting-panel/property-editor/dropdownFlag-editor.vue +11 -12
  266. package/src/components/xform/form-designer/setting-panel/property-editor/event-handler/onClear-editor.vue +30 -0
  267. package/src/components/xform/form-designer/setting-panel/property-editor/event-handler/onLazyLoad-editor.vue +34 -0
  268. package/src/components/xform/form-designer/setting-panel/property-editor/event-handler/onSelect-editor.vue +30 -0
  269. package/src/components/xform/form-designer/setting-panel/property-editor/event-handler/onTabChange-editor.vue +28 -0
  270. package/src/components/xform/form-designer/setting-panel/property-editor/event-handler/onTabClick-editor.vue +28 -0
  271. package/src/components/xform/form-designer/setting-panel/property-editor/field-accessUrl/accessUrl-editor.vue +7 -7
  272. package/src/components/xform/form-designer/setting-panel/property-editor/field-autocomplete/autocomplete-vabSearchName-editor.vue +22 -22
  273. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/addTableData-event-editor.vue +2 -2
  274. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/clickBindActions.js +1 -1
  275. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/clickBindEvent-editor.vue +3 -3
  276. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/form-host-event-editor.vue +40 -40
  277. package/src/components/xform/form-designer/setting-panel/property-editor/field-button/search-dialog-event-editor.vue +24 -24
  278. package/src/components/xform/form-designer/setting-panel/property-editor/field-cascader/cascader-lazy-editor.vue +108 -0
  279. package/src/components/xform/form-designer/setting-panel/property-editor/field-common/keyName-editor.vue +6 -6
  280. package/src/components/xform/form-designer/setting-panel/property-editor/field-common/keyNameEnabled-editor.vue +1 -1
  281. package/src/components/xform/form-designer/setting-panel/property-editor/field-date/date-dateLimit-editor.vue +11 -11
  282. package/src/components/xform/form-designer/setting-panel/property-editor/field-date/date-format-editor.vue +2 -2
  283. package/src/components/xform/form-designer/setting-panel/property-editor/field-date-range/date-range-format-editor.vue +2 -2
  284. package/src/components/xform/form-designer/setting-panel/property-editor/field-echart/echart-bar-editor.vue +15 -15
  285. package/src/components/xform/form-designer/setting-panel/property-editor/field-echart/echart-category-editor.vue +15 -15
  286. package/src/components/xform/form-designer/setting-panel/property-editor/field-echart/echart-pie-editor.vue +25 -25
  287. package/src/components/xform/form-designer/setting-panel/property-editor/field-gantt/gantt-editor.vue +1 -1
  288. package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import-button-editor.vue +74 -16
  289. package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import2-button-editor.vue +143 -12
  290. package/src/components/xform/form-designer/setting-panel/property-editor/field-print-button/print-button-editor.vue +4 -5
  291. package/src/components/xform/form-designer/setting-panel/property-editor/field-print-button/print-detail-button-editor.vue +4 -5
  292. package/src/components/xform/form-designer/setting-panel/property-editor/field-script/script-editor.vue +24 -24
  293. package/src/components/xform/form-designer/setting-panel/property-editor/field-script-input/script-input-editor.vue +7 -7
  294. package/src/components/xform/form-designer/setting-panel/property-editor/field-status/field-status-editor.vue +24 -24
  295. package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/empty-number-input.vue +51 -0
  296. package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/select-export-button-editor.vue +4 -4
  297. package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/select-export-item-button-editor.vue +38 -15
  298. package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/table-export-button-editor.vue +38 -9
  299. package/src/components/xform/form-designer/setting-panel/property-editor/field-time/time-format-editor.vue +1 -1
  300. package/src/components/xform/form-designer/setting-panel/property-editor/field-time/time-timeLimit-editor.vue +3 -3
  301. package/src/components/xform/form-designer/setting-panel/property-editor/field-time-range/time-range-format-editor.vue +1 -1
  302. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabSearch/vabSearchField-editor.vue +1 -1
  303. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabSearch/vabSearchName-editor.vue +6 -6
  304. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabSearch/vabsearchConfigDialog.vue +9 -9
  305. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabUpload/field-vabUpload-editor.vue +23 -10
  306. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabUpload2/field-vabUpload2-editor.vue +18 -5
  307. package/src/components/xform/form-designer/setting-panel/property-editor/field-vue-page/vue-page-editor.vue +5 -5
  308. package/src/components/xform/form-designer/setting-panel/property-editor/formScriptEnabled-editor.vue +6 -6
  309. package/src/components/xform/form-designer/setting-panel/property-editor/formatType-editor.vue +9 -9
  310. package/src/components/xform/form-designer/setting-panel/property-editor/formula-editor.vue +1 -1
  311. package/src/components/xform/form-designer/setting-panel/property-editor/iconClass-editor.vue +8 -8
  312. package/src/components/xform/form-designer/setting-panel/property-editor/labelColor-editor.vue +5 -5
  313. package/src/components/xform/form-designer/setting-panel/property-editor/labelIconPosition-editor.vue +2 -2
  314. package/src/components/xform/form-designer/setting-panel/property-editor/listItems-editor.vue +3 -3
  315. package/src/components/xform/form-designer/setting-panel/property-editor/name-editor.vue +2 -2
  316. package/src/components/xform/form-designer/setting-panel/property-editor/oplog-editor.vue +2 -2
  317. package/src/components/xform/form-designer/setting-panel/property-editor/project-tag-editor.vue +27 -29
  318. package/src/components/xform/form-designer/setting-panel/property-editor/relative-default-block.vue +14 -15
  319. package/src/components/xform/form-designer/setting-panel/property-editor/showDownloadButton-editor.vue +29 -0
  320. package/src/components/xform/form-designer/setting-panel/property-editor/showRuleFlag-editor.vue +5 -5
  321. package/src/components/xform/form-designer/setting-panel/property-editor/showText-editor.vue +1 -1
  322. package/src/components/xform/form-designer/setting-panel/property-editor/suffixIconClickable-editor.vue +23 -0
  323. package/src/components/xform/form-designer/setting-panel/property-editor/tempStorage-editor.vue +2 -2
  324. package/src/components/xform/form-designer/setting-panel/property-editor/textFlag-editor.vue +11 -11
  325. package/src/components/xform/form-designer/setting-panel/property-editor/urlValueEnabled-editor.vue +2 -3
  326. package/src/components/xform/form-designer/setting-panel/property-editor/utcTransformEnabled-editor.vue +1 -1
  327. package/src/components/xform/form-designer/setting-panel/property-editor/wfFlag-editor.vue +23 -23
  328. package/src/components/xform/form-designer/setting-panel/property-editor/widgetShowRuleFlag-editor.vue +9 -9
  329. package/src/components/xform/form-designer/setting-panel/propertyRegister.js +24 -4
  330. package/src/components/xform/form-designer/setting-panel/wfObjConfigDialog.vue +1 -1
  331. package/src/components/xform/form-designer/toolbar-panel/index.vue +3 -4
  332. package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +156 -8
  333. package/src/components/xform/form-render/container-item/containerItemMixin.js +93 -8
  334. package/src/components/xform/form-render/container-item/data-table-item.vue +353 -347
  335. package/src/components/xform/form-render/container-item/data-table-mixin.js +7511 -5985
  336. package/src/components/xform/form-render/container-item/detail-h5-item.vue +27 -17
  337. package/src/components/xform/form-render/container-item/detail-item.vue +350 -446
  338. package/src/components/xform/form-render/container-item/detail-temp-item.vue +1 -1
  339. package/src/components/xform/form-render/container-item/dynamicFieldMixin.js +55 -1
  340. package/src/components/xform/form-render/container-item/list-h5-item.vue +214 -340
  341. package/src/components/xform/form-render/container-item/panel-item.vue +1 -1
  342. package/src/components/xform/form-render/container-item/sub-form-item.vue +15 -15
  343. package/src/components/xform/form-render/container-item/tab-item.vue +177 -129
  344. package/src/components/xform/form-render/fieldControlEngine.js +218 -0
  345. package/src/components/xform/form-render/fieldControlMixin.js +536 -0
  346. package/src/components/xform/form-render/index.vue +164 -153
  347. package/src/components/xform/form-render/indexMixin.js +5444 -5331
  348. package/src/components/xform/form-render/pageDialogScope.js +54 -0
  349. package/src/components/xform/icon-picker/index.vue +1 -1
  350. package/src/components/xform/lang/en-US.js +9 -0
  351. package/src/components/xform/lang/zh-CN.js +10 -0
  352. package/src/components/xform/mixins/businessLock.js +59 -0
  353. package/src/components/xform/mixins/defaultHandle.js +713 -707
  354. package/src/components/xform/mixins/scriptHttp.js +43 -22
  355. package/src/components/xform/mixins/wfStart.js +105 -0
  356. package/src/components/xform/mixins/wfVisibility.js +33 -0
  357. package/src/components/xform/styles/census.scss +288 -0
  358. package/src/components/xform/styles/containers.scss +215 -0
  359. package/src/components/xform/styles/designer.scss +904 -0
  360. package/src/components/xform/styles/detail-temp.scss +71 -0
  361. package/src/components/xform/styles/h5-designer.scss +191 -0
  362. package/src/components/xform/styles/h5-runtime.scss +520 -0
  363. package/src/components/xform/styles/h5.scss +566 -472
  364. package/src/components/xform/styles/skins.scss +398 -0
  365. package/src/components/xform/styles/table-layout.scss +91 -0
  366. package/src/components/xform/styles/titles.scss +255 -0
  367. package/src/components/xform/utils/dynamicSchemaUtil.js +385 -361
  368. package/src/components/xform/utils/fixedQueryUtil.js +29 -4
  369. package/src/components/xform/utils/formHttp.js +1 -1
  370. package/src/components/xform/utils/serviceNameCache.js +69 -0
  371. package/src/components/xform/utils/sfc-generator.js +5 -3
  372. package/src/components/xform/utils/tableColumnHelper.js +46 -4
  373. package/src/components/xform/utils/treeTableUtil.js +44 -44
  374. package/src/components/xform/utils/util.js +1776 -1708
  375. package/src/core-resources/css/h5.scss +548 -0
  376. package/src/core-resources/css/iconfont.css +1447 -0
  377. package/src/core-resources/font/iconfont.ttf +0 -0
  378. package/src/core-resources/font/iconfont.woff +0 -0
  379. package/src/core-resources/font/iconfont.woff2 +0 -0
  380. package/src/core-resources/images/default-header.png +0 -0
  381. package/src/core-resources/images/ico-default_wenjian.svg +1 -0
  382. package/src/core-resources/images/ico-excel.svg +1 -0
  383. package/src/core-resources/images/ico-ftl.svg +7 -0
  384. package/src/core-resources/images/ico-html.svg +1 -0
  385. package/src/core-resources/images/ico-java.svg +1 -0
  386. package/src/core-resources/images/ico-music.svg +1 -0
  387. package/src/core-resources/images/ico-pdf.svg +1 -0
  388. package/src/core-resources/images/ico-photo.svg +1 -0
  389. package/src/core-resources/images/ico-ppt.svg +1 -0
  390. package/src/core-resources/images/ico-psd.svg +1 -0
  391. package/src/core-resources/images/ico-service.png +0 -0
  392. package/src/core-resources/images/ico-txt.svg +1 -0
  393. package/src/core-resources/images/ico-video.svg +1 -0
  394. package/src/core-resources/images/ico-vue.svg +8 -0
  395. package/src/core-resources/images/ico-wenjianjia.svg +1 -0
  396. package/src/core-resources/images/ico-wrod.svg +1 -0
  397. package/src/core-resources/images/ico-xml.svg +1 -0
  398. package/src/core-resources/images/ico-yasuobao.svg +1 -0
  399. package/src/core-resources/images/icon-error.png +0 -0
  400. package/src/core-resources/images/icon-tips.png +0 -0
  401. package/src/core-resources/images/nodata.png +0 -0
  402. package/src/core-resources/images/nodata2.png +0 -0
  403. package/src/directive/el-dialog-center/index.js +3 -2
  404. package/src/directive/el-drag-dialog/drag.js +33 -4
  405. package/src/icons/index.js +9 -0
  406. package/src/icons/svg/404.svg +1 -0
  407. package/src/icons/svg/alert.svg +1 -0
  408. package/src/icons/svg/bug.svg +1 -0
  409. package/src/icons/svg/button.svg +1 -0
  410. package/src/icons/svg/card.svg +1 -0
  411. package/src/icons/svg/cascader-field.svg +1 -0
  412. package/src/icons/svg/census.svg +1 -0
  413. package/src/icons/svg/chart.svg +1 -0
  414. package/src/icons/svg/checkbox-field.svg +1 -0
  415. package/src/icons/svg/clipboard.svg +1 -0
  416. package/src/icons/svg/color-field.svg +1 -0
  417. package/src/icons/svg/component.svg +1 -0
  418. package/src/icons/svg/custom-component.svg +1 -0
  419. package/src/icons/svg/dashboard.svg +1 -0
  420. package/src/icons/svg/data-table.svg +1 -0
  421. package/src/icons/svg/date-field.svg +1 -0
  422. package/src/icons/svg/date-range-field.svg +1 -0
  423. package/src/icons/svg/descriptions.svg +1 -0
  424. package/src/icons/svg/divider.svg +1 -0
  425. package/src/icons/svg/document.svg +1 -0
  426. package/src/icons/svg/documentation.svg +1 -0
  427. package/src/icons/svg/drag.svg +1 -0
  428. package/src/icons/svg/echart-category.svg +1 -0
  429. package/src/icons/svg/echart-pie.svg +1 -0
  430. package/src/icons/svg/echart.svg +1 -0
  431. package/src/icons/svg/edit.svg +1 -0
  432. package/src/icons/svg/education.svg +1 -0
  433. package/src/icons/svg/email.svg +1 -0
  434. package/src/icons/svg/example.svg +1 -0
  435. package/src/icons/svg/excel.svg +1 -0
  436. package/src/icons/svg/exit-fullscreen.svg +1 -0
  437. package/src/icons/svg/eye-open.svg +1 -0
  438. package/src/icons/svg/eye.svg +1 -0
  439. package/src/icons/svg/file-upload-field.svg +1 -0
  440. package/src/icons/svg/form.svg +1 -0
  441. package/src/icons/svg/fullscreen.svg +1 -0
  442. package/src/icons/svg/github.svg +1 -0
  443. package/src/icons/svg/grid.svg +1 -0
  444. package/src/icons/svg/guide.svg +1 -0
  445. package/src/icons/svg/html-text.svg +1 -0
  446. package/src/icons/svg/ico-more.svg +1 -0
  447. package/src/icons/svg/ico-wenjianjia.svg +1 -0
  448. package/src/icons/svg/icon.svg +1 -0
  449. package/src/icons/svg/input-batch.svg +1 -0
  450. package/src/icons/svg/international.svg +1 -0
  451. package/src/icons/svg/language.svg +1 -0
  452. package/src/icons/svg/link.svg +1 -0
  453. package/src/icons/svg/list-export.svg +1 -0
  454. package/src/icons/svg/list.svg +1 -0
  455. package/src/icons/svg/lock.svg +1 -0
  456. package/src/icons/svg/message.svg +1 -0
  457. package/src/icons/svg/money.svg +1 -0
  458. package/src/icons/svg/nested.svg +1 -0
  459. package/src/icons/svg/news-list.svg +1 -0
  460. package/src/icons/svg/node-tree.svg +1 -0
  461. package/src/icons/svg/number-field.svg +1 -0
  462. package/src/icons/svg/password.svg +1 -0
  463. package/src/icons/svg/pdf.svg +1 -0
  464. package/src/icons/svg/people.svg +1 -0
  465. package/src/icons/svg/peoples.svg +1 -0
  466. package/src/icons/svg/picture-upload-field.svg +1 -0
  467. package/src/icons/svg/qq.svg +1 -0
  468. package/src/icons/svg/query.svg +1 -0
  469. package/src/icons/svg/radio-field.svg +1 -0
  470. package/src/icons/svg/rate-field.svg +1 -0
  471. package/src/icons/svg/redo.svg +1 -0
  472. package/src/icons/svg/rich-editor-field.svg +1 -0
  473. package/src/icons/svg/search.svg +1 -0
  474. package/src/icons/svg/searchbox.svg +1 -0
  475. package/src/icons/svg/section.svg +1 -0
  476. package/src/icons/svg/select-field.svg +1 -0
  477. package/src/icons/svg/shopping.svg +1 -0
  478. package/src/icons/svg/size.svg +1 -0
  479. package/src/icons/svg/skill.svg +1 -0
  480. package/src/icons/svg/slider-field.svg +1 -0
  481. package/src/icons/svg/slot-component.svg +1 -0
  482. package/src/icons/svg/slot-field.svg +1 -0
  483. package/src/icons/svg/star.svg +1 -0
  484. package/src/icons/svg/static-text.svg +1 -0
  485. package/src/icons/svg/status.svg +1 -0
  486. package/src/icons/svg/sub-form.svg +1 -0
  487. package/src/icons/svg/switch-field.svg +1 -0
  488. package/src/icons/svg/tab.svg +1 -0
  489. package/src/icons/svg/table.svg +1 -0
  490. package/src/icons/svg/text-field.svg +1 -0
  491. package/src/icons/svg/text.svg +1 -0
  492. package/src/icons/svg/textarea-field.svg +1 -0
  493. package/src/icons/svg/theme.svg +1 -0
  494. package/src/icons/svg/time-field.svg +1 -0
  495. package/src/icons/svg/time-range-field.svg +1 -0
  496. package/src/icons/svg/tips-text.svg +1 -0
  497. package/src/icons/svg/title-head.svg +1 -0
  498. package/src/icons/svg/tree-pane.svg +1 -0
  499. package/src/icons/svg/tree-table.svg +1 -0
  500. package/src/icons/svg/tree.svg +1 -0
  501. package/src/icons/svg/undo.svg +1 -0
  502. package/src/icons/svg/uploadbox.svg +1 -0
  503. package/src/icons/svg/user.svg +1 -0
  504. package/src/icons/svg/vf-box.svg +1 -0
  505. package/src/icons/svg/vf-dialog.svg +1 -0
  506. package/src/icons/svg/vf-drawer.svg +1 -0
  507. package/src/icons/svg/vue-sfc.svg +1 -0
  508. package/src/icons/svg/wechat.svg +1 -0
  509. package/src/icons/svg/zip.svg +1 -0
  510. package/src/index.js +2 -514
  511. package/src/index.next.js +5 -0
  512. package/src/index.sync.js +5 -0
  513. package/src/layout/components/Sidebar/default.vue +20 -19
  514. package/src/layout/components/TagsView/index.vue +330 -323
  515. package/src/layout/components/TagsView/style.scss +92 -0
  516. package/src/layout/components/createCompany/createCompanyDialog.vue +2 -2
  517. package/src/layout/components/extractedCode/createDialog.vue +1 -1
  518. package/src/layout/components/langTool.vue +1 -1
  519. package/src/layout/components/watermark/index.vue +1 -1
  520. package/src/layout/defaultLayout.vue +2 -2
  521. package/src/microRouter/index.js +5 -0
  522. package/src/router/index.js +2 -7
  523. package/src/router/modules/customer.js +175 -76
  524. package/src/store/modules/permission.js +2 -0
  525. package/src/store/modules/settings.js +1 -1
  526. package/src/store/modules/tagsView.js +241 -217
  527. package/src/store/modules/user.js +21 -12
  528. package/src/styles/btn.scss +315 -0
  529. package/src/styles/dialog.scss +1710 -0
  530. package/src/styles/element-ui.scss +1076 -0
  531. package/src/styles/element-variables.scss +31 -0
  532. package/src/styles/global.scss +115 -0
  533. package/src/styles/index.scss +245 -0
  534. package/src/styles/layout-skins.scss +840 -0
  535. package/src/styles/legacy-base.scss +19 -0
  536. package/src/styles/menu-icons.scss +75 -0
  537. package/src/styles/mixin.scss +80 -0
  538. package/src/styles/nprogress.scss +14 -0
  539. package/src/styles/page-shell.scss +723 -0
  540. package/src/styles/sidebar.scss +296 -0
  541. package/src/styles/split-handle.scss +52 -0
  542. package/src/styles/theme-variables.scss +7 -0
  543. package/src/styles/transition.scss +48 -0
  544. package/src/styles/utilities.scss +253 -0
  545. package/src/styles/variables.scss +72 -0
  546. package/src/utils/aes.js +133 -12
  547. package/src/utils/baseDictsCache.js +197 -0
  548. package/src/utils/chunkLoadError.js +24 -0
  549. package/src/utils/featureResources.js +57 -0
  550. package/src/utils/importLimit.js +72 -0
  551. package/src/utils/pdfUtil.js +6 -1
  552. package/src/utils/request.js +261 -24
  553. package/src/utils/resolveViewComponent.js +45 -90
  554. package/src/utils/runtimeRecovery.js +105 -0
  555. package/src/utils/swiperLoader.js +20 -0
  556. package/src/utils/vab.js +97 -36
  557. package/src/utils/xlsxLoader.js +29 -0
  558. package/src/views/bd/setting/config_manage/list.vue +7 -1
  559. package/src/views/bd/setting/formVersion/compareContMixin.scss +1 -1
  560. package/src/views/bd/setting/form_template/copyAppendDialog.vue +173 -0
  561. package/src/views/bd/setting/form_template/list.vue +15 -0
  562. package/src/views/bd/setting/form_template/mixins/list.js +28 -6
  563. package/src/views/bd/setting/form_template/mixins/list2.js +412 -411
  564. package/src/views/bd/setting/form_template/mixins/wf_list.js +431 -430
  565. package/src/views/mobile/user/area/dialog.vue +1 -1
  566. package/src/views/mobile/user/user/dialog.vue +1 -1
  567. package/src/views/user/api_request/list.vue +6 -6
  568. package/src/views/user/area/dialog.vue +1 -1
  569. package/src/views/user/area/list.vue +1 -1
  570. package/src/views/user/bill_setting/mixins/wf.js +8 -0
  571. package/src/views/user/bill_setting/render.vue +3 -3
  572. package/src/views/user/commMenu/index.vue +3 -1
  573. package/src/views/user/commMenu/style.scss +123 -0
  574. package/src/views/user/common_attribute/edit.vue +2 -0
  575. package/src/views/user/common_attribute/itemEdit.vue +2 -0
  576. package/src/views/user/error-page/401.vue +9 -9
  577. package/src/views/user/form/form_ins_list/edit.vue +17 -17
  578. package/src/views/user/form/form_template/dialog.vue +12 -12
  579. package/src/views/user/form/form_template/edit.vue +10 -10
  580. package/src/views/user/form/form_template/itemEdit.vue +18 -18
  581. package/src/views/user/form/form_template/itemList.vue +13 -13
  582. package/src/views/user/form/form_template/list.vue +527 -506
  583. package/src/views/user/form/form_template_field/dialog.vue +3 -3
  584. package/src/views/user/form/form_type/dialog.vue +5 -5
  585. package/src/views/user/form/form_type/edit.vue +2 -2
  586. package/src/views/user/form/form_type/editDialog.vue +3 -3
  587. package/src/views/user/form/form_type/list.vue +5 -5
  588. package/src/views/user/form/report_requestaccess/dialog.vue +12 -12
  589. package/src/views/user/form/report_requestaccess/edit.vue +54 -54
  590. package/src/views/user/form/report_requestaccess/list.vue +15 -15
  591. package/src/views/user/form/vform/designer.vue +37 -37
  592. package/src/views/user/form/vform/render.vue +1 -1
  593. package/src/views/user/form/view/list.vue +28 -5
  594. package/src/views/user/home/default.vue +16 -9
  595. package/src/views/user/home/default2.vue +12 -8
  596. package/src/views/user/home/index.vue +1 -1
  597. package/src/views/user/home/wjl/content.vue +1581 -1569
  598. package/src/views/user/intf_permission/edit.vue +230 -0
  599. package/src/views/user/intf_permission/list.vue +196 -0
  600. package/src/views/user/login/default.vue +1 -1
  601. package/src/views/user/login/indexMixin.js +1 -1
  602. package/src/views/user/menuFallback/index.vue +23 -0
  603. package/src/views/user/outLink/form_view.vue +1 -1
  604. package/src/views/user/outLink/index.vue +1 -1
  605. package/src/views/user/outLink/view.vue +1 -1
  606. package/src/views/user/push_setting/list.vue +20 -20
  607. package/src/views/user/request_setting/list.vue +18 -18
  608. package/src/views/user/role/edit.vue +4 -0
  609. package/src/views/user/role/role-box.scss +83 -0
  610. package/src/views/user/role/voc_edit.vue +4 -0
  611. package/src/views/user/sale_org/list.vue +1 -1
  612. package/src/views/user/sale_org/moveDialog.vue +8 -8
  613. package/src/views/user/user/edit.vue +3 -3
  614. package/src/views/user/user/form_list.vue +6 -6
  615. package/src/views/user/user/info.vue +2 -2
  616. package/src/views/user/user/infoEdit.vue +1 -1
  617. package/src/views/user/user/list.vue +29 -7
  618. package/src/views/user/wf/iframe/index.vue +1 -1
  619. package/src/views/user/wf/iframe/index2.vue +1 -1
  620. package/src/views/user/wf/wfReport/index.vue +18 -18
  621. package/src/views/user/wf/wf_diy_attribute/edit.vue +1 -1
  622. package/src/views/user/wf/wf_manage/list.vue +8 -2
  623. package/src/views/user/wf/wf_manage/list2.vue +8 -2
  624. package/src/views/user/wf/wf_manage/wfContentDialog.vue +92 -35
  625. package/src/views/user/wf/wf_obj_config/activiti_wf.vue +134 -133
  626. package/src/views/user/wf/wf_obj_config/dialog.vue +1 -1
  627. package/src/views/user/wf/wf_obj_config/importItemDialog.vue +5 -5
  628. package/src/views/user/wf/wf_obj_config/list.vue +747 -746
  629. package/src/views/user/wf/wf_obj_config/list_form.vue +374 -373
  630. package/src/views/user/wf/wf_obj_config/wfBizDataSettingDialog.vue +3 -3
  631. package/src/views/user/wf/wf_work_calendar/components/calendar.vue +2 -8
  632. package/src/views/user/wf/wf_work_calendar/components/calendar2.vue +2 -8
  633. package/templates/child-app/.env +3 -0
  634. package/templates/child-app/README.md +49 -0
  635. package/templates/child-app/app.config.js +6 -0
  636. package/templates/child-app/babel.config.js +1 -0
  637. package/templates/child-app/core-resources.config.js +15 -0
  638. package/templates/child-app/gitignore +7 -0
  639. package/templates/child-app/package.json +34 -0
  640. package/templates/child-app/public/index.html +12 -0
  641. package/templates/child-app/src/assets/401_images/401.gif +0 -0
  642. package/templates/child-app/src/assets/404_images/404.png +0 -0
  643. package/templates/child-app/src/assets/404_images/404_cloud.png +0 -0
  644. package/templates/child-app/src/assets/logo.png +0 -0
  645. package/templates/child-app/src/corejsConfig.js +2 -0
  646. package/templates/child-app/src/icons/index.js +2 -0
  647. package/templates/child-app/src/icons/svg/child-demo.svg +1 -0
  648. package/templates/child-app/src/layout/index.vue +4 -0
  649. package/templates/child-app/src/main.js +5 -0
  650. package/templates/child-app/src/prefixConfig.js +13 -0
  651. package/templates/child-app/src/resources/css/login.scss +29 -0
  652. package/templates/child-app/src/resources/images/bg-login5.jpg +0 -0
  653. package/templates/child-app/src/resources/images/home-img.png +0 -0
  654. package/templates/child-app/src/router/modules/customer.js +3 -0
  655. package/templates/child-app/src/settings.js +25 -0
  656. package/templates/child-app/src/styles/app.scss +2 -0
  657. package/templates/child-app/src/views/demo/detail.vue +19 -0
  658. package/templates/child-app/src/views/demo/list.vue +38 -0
  659. package/templates/child-app/src/views/user/login/index.vue +18 -0
  660. package/templates/child-app/vue.config.js +107 -0
  661. package/src/components/xform/form-render/container-item/dynamicFieldEngine.js +0 -285
  662. package/src/components/xform/form-render/formDynamicFieldMixin.js +0 -131
  663. package/src/views/demo/bizTab/bill/billConfig.js +0 -41
  664. package/src/views/demo/bizTab/bill/detail.vue +0 -436
  665. package/src/views/demo/bizTab/bill/list.vue +0 -288
  666. package/src/views/demo/bizTab/bill/productDialog.vue +0 -176
  667. package/src/views/demo/bizTab/simple/billApi.js +0 -123
  668. package/src/views/demo/bizTab/simple/detail.vue +0 -407
  669. package/src/views/demo/bizTab/simple/list.vue +0 -217
  670. package/src/views/demo/bizTab/standalone/index.vue +0 -121
  671. package/src/views/demo/bizTab/wf/billConfig.js +0 -44
  672. package/src/views/demo/bizTab/wf/detail.vue +0 -661
  673. package/src/views/demo/bizTab/wf/list.vue +0 -242
  674. package/src/views/user/outLink/cc_form_view.vue +0 -188
  675. /package/src/{resources → core-resources}/js/base/common.js +0 -0
@@ -1,2084 +1,2133 @@
1
- /**
2
- * author: vformAdmin
3
- * email: vdpadmin@163.com
4
- * website: https://www.vform666.com
5
- * date: 2021.08.18
6
- * remark: 如果要分发VForm源码,需在本文件顶部保留此文件头信息!!
7
- */
8
-
9
- import {
10
- deepClone,
11
- generateId,
12
- getDefaultFormConfig,
13
- overwriteObj,
14
- createUUID,
15
- columnFormatMap,
16
- } from "../../../components/xform/utils/util";
17
- import { CLICK_BIND } from "./setting-panel/property-editor/field-button/clickBindActions";
18
- import {
19
- containers,
20
- advancedFields,
21
- basicFields,
22
- customFields,
23
- businessFields,
24
- } from "../../../components/xform/form-designer/widget-panel/widgetsConfig.js";
25
- import { VARIANT_FORM_VERSION } from "../../../components/xform/utils/config";
26
- import { keyNamePrefixMap } from "../../../components/xform/form-designer/widget-panel/widgetsConfig";
27
-
28
- let createDesigner0;
29
- const baseRefUtil = {
30
- deepClone,
31
- generateId,
32
- getDefaultFormConfig,
33
- overwriteObj,
34
- containers,
35
- advancedFields,
36
- basicFields,
37
- customFields,
38
- VARIANT_FORM_VERSION,
39
- };
40
-
41
- let chartContainers = [],
42
- chartWidgets = [];
43
-
44
- (function () {
45
- createDesigner0 = function (vueInstance) {
46
- let defaultFormConfig = baseRefUtil.deepClone(
47
- baseRefUtil.getDefaultFormConfig()
48
- );
49
-
50
- return {
51
- widgetList: [],
52
- formConfig: {
53
- cssCode: "",
54
- gridConfig: {
55
- accessReturnType: 1,
56
- isLoadDataByAccess: false,
57
- },
58
- scriptList: [],
59
- formType: 0,
60
- getConfig: {
61
- accessType: "1",
62
- accessUrl: null,
63
- accessParam: null,
64
- accessCallback: null,
65
- scriptName: null,
66
- scriptCode: null,
67
- },
68
- saveConfig: {
69
- accessType: "1",
70
- accessUrl: null,
71
- accessParam: null,
72
- accessCallback: null,
73
- scriptName: null,
74
- scriptCode: null,
75
- },
76
- editFormCode: null,
77
- editFormName: null,
78
- searchDialogNameField: null,
79
- searchDialogUniqueField: null,
80
- entity: null,
81
- wfEnabled: false,
82
- isLoadEntity: false,
83
- formScriptCode: "getOne",
84
- formScriptParam: null,
85
- formScriptSuccess: null,
86
- saveScriptCode: "saveUpdate",
87
- wfConfig: null,
88
- wfStartBindSave: false,
89
- wfStartConfirmText: null,
90
- wfAgreenBindSave: false,
91
- wfAgreeConfigData: [],
92
- wfConfigDataEnabled: false,
93
- wfConfigData: [],
94
- multiTabEnabled: false,
95
- multiTabLabelField: null,
96
- addTabEnabled: false, // 新增打开独立页签(不走「常规」页签)
97
- submitBehavior: "refreshCurrent", // 提交后行为: refreshCurrent(默认,留在详情页) | closeToList
98
- billNavEnabled: false, // 详情页签显示「上一单/下一单」翻单按钮
99
- addFormCode: null,
100
- addFormName: null,
101
- wfTheme: null,
102
- otherTabEnabled: false,
103
- otherTabList: [],
104
- hideNormalTab: false,
105
- customListTabLabel: null,
106
- globalConfig: null,
107
- // 表单级动态字段规则
108
- dynamicFieldEnabled: false,
109
- dynamicFieldSourceType: "local",
110
- dynamicFieldRules: [],
111
- dynamicFieldScriptCode: null,
112
- dynamicFieldScriptParam: null,
113
- dynamicFieldTriggerFields: [],
114
- },
115
- dataSources: [], //数据源
116
-
117
- selectedId: null,
118
- selectedWidget: null,
119
- selectedWidgetName: null, //选中组件名称(唯一)
120
- vueInstance: vueInstance,
121
-
122
- formWidget: null, //表单设计容器
123
-
124
- cssClassList: [], //自定义样式列表
125
-
126
- historyData: {
127
- index: -1, //index: 0,
128
- maxStep: 20,
129
- steps: [],
130
- },
131
-
132
- initDesigner(resetFormJson) {
133
- this.widgetList = [];
134
- this.formConfig = baseRefUtil.deepClone(defaultFormConfig);
135
- this.dataSources = [];
136
-
137
- //输出版本信息和语雀链接
138
- /* console.info(`%cVariantForm %cVer${baseRefUtil.VARIANT_FORM_VERSION} %chttps://www.yuque.com/visualdev/vform`,
139
- "color:#409EFF;font-size: 22px;font-weight:bolder",
140
- "color:#999;font-size: 12px",
141
- "color:#333"
142
- ); */
143
-
144
- /*if (!resetFormJson) {
145
- this.initHistoryData();
146
- }*/
147
- },
148
-
149
- clearDesigner(skipHistoryChange) {
150
- let emptyWidgetListFlag = this.widgetList.length === 0;
151
- /* 版式是"当前在设计哪一端",不是表单内容的一部分。defaultFormConfig 里没有
152
- layoutType,overwriteObj 之后 getLayoutType() 会退回 "PC" —— 在 H5 模板里
153
- 点一下「清空」,左侧面板就跳回 PC 组件列表了。先存后还。 */
154
- let keepLayoutType = this.getLayoutType();
155
- this.widgetList = [];
156
- this.selectedId = null;
157
- this.selectedWidgetName = null;
158
- this.selectedWidget = {}; //this.selectedWidget = null
159
- baseRefUtil.overwriteObj(this.formConfig, defaultFormConfig); //
160
- this.formConfig.gridConfig = defaultFormConfig.gridConfig;
161
- this.formConfig.layoutType = keepLayoutType;
162
-
163
- if (!!skipHistoryChange) {
164
- //什么也不做!!
165
- } else if (!emptyWidgetListFlag) {
166
- this.emitHistoryChange();
167
- } else {
168
- this.saveCurrentHistoryStep();
169
- }
170
- },
171
-
172
- loadPresetCssCode(preCssCode) {
173
- if (this.formConfig.cssCode === "" && !!preCssCode) {
174
- this.formConfig.cssCode = preCssCode;
175
- }
176
- },
177
-
178
- getLayoutType() {
179
- return this.formConfig.layoutType || "PC";
180
- },
181
-
182
- changeLayoutType(newType) {
183
- this.formConfig.layoutType = newType;
184
- },
185
-
186
- getImportTemplate() {
187
- return {
188
- widgetList: [],
189
- // formConfig: baseRefUtil.deepClone(this.formConfig)
190
- formConfig: baseRefUtil.deepClone(defaultFormConfig),
191
- };
192
- },
193
-
194
- handleImportJson(formJson) {
195
- let formConfig = formJson.formConfig;
196
- if (formConfig.formCode === vueInstance?.reportTemplate?.formCode) {
197
- return;
198
- }
199
- let widgetArr = formJson.widgetList;
200
- let itemFieldMap = {
201
- grid: "cols",
202
- table: "rows",
203
- "table-cell": "widgetList",
204
- "h5-table": "rows",
205
- "h5-table-cell": "widgetList",
206
- tab: "tabs",
207
- "tab-pane": "widgetList",
208
- "grid-col": "widgetList",
209
- "vf-box": "widgetList",
210
- card: "widgetList",
211
- detail: "panes",
212
- "detail-plain": "panes",
213
- "detail-pane": "widgetList",
214
- "detail-h5": "panes",
215
- "h5-card": "panes",
216
- "h5-card-pane": "widgetList",
217
- };
218
- let loopDo = (widgetList) => {
219
- if (!widgetList) return;
220
- widgetList.forEach((widget) => {
221
- if (widget.type === "data-table" || widget.type === "list-h5") {
222
- let vailColumns = widget.options.tableColumns.filter(
223
- (item) => item.prop && item.label
224
- );
225
- vailColumns.forEach((item) => {
226
- if (item.formatS === "editAttachment") {
227
- let prop = item.prop;
228
- let columnOption = item.columnOption;
229
- let editColumnOption = item.editColumnOption;
230
-
231
- let suffix = this.createAttachmentSuffix();
232
- let keyName = this.createAttachmentKeyName(suffix);
233
- if (columnOption) {
234
- columnOption.keyName = keyName;
235
- columnOption.keyNameSuffix = suffix;
236
- }
237
- if (editColumnOption) {
238
- editColumnOption.keyName = keyName;
239
- editColumnOption.keyNameSuffix = suffix;
240
- }
241
- item.prop = keyName;
242
- }
243
- });
244
- } else if (
245
- widget.type === "vabUpload" ||
246
- widget.type === "baseAttachment"
247
- ) {
248
- let suffix = this.createAttachmentSuffix();
249
- let keyName = this.createAttachmentKeyName(suffix);
250
- widget.options.keyName = keyName;
251
- widget.options.keyNameSuffix = suffix;
252
- } else {
253
- if (widget.category === "container") {
254
- let itemField = itemFieldMap[widget.type];
255
- if (itemField) {
256
- if ("table" === widget.type) {
257
- widget[itemField].forEach((item) => {
258
- loopDo(item.cols);
259
- });
260
- } else if ("h5-table" === widget.type) {
261
- widget[itemField].forEach((item) => {
262
- loopDo(item.cols);
263
- });
264
- } else {
265
- loopDo(widget[itemField]);
266
- }
267
- }
268
- }
269
- }
270
- });
271
- };
272
- loopDo(widgetArr);
273
- },
274
- loadFormJson(formJson) {
275
- let modifiedFlag = false;
276
-
277
- if (!!formJson && !!formJson.widgetList) {
278
- this.widgetList = formJson.widgetList;
279
- modifiedFlag = true;
280
- }
281
- if (!!formJson && !!formJson.formConfig) {
282
- //this.formConfig = importObj.formConfig
283
- baseRefUtil.overwriteObj(
284
- this.formConfig,
285
- formJson.formConfig
286
- ); /* 用=赋值,会导致inject依赖注入的formConfig属性变成非响应式 */
287
- modifiedFlag = true;
288
- }
289
-
290
- if (modifiedFlag) {
291
- this.emitEvent("form-json-imported", []); // 通知其他组件
292
- }
293
- this.setSelected();
294
- return modifiedFlag;
295
- },
296
- handleSelectedWidget(selected) {
297
- //处理历史未定义的属性
298
- if (selected.formItemFlag || selected.type === "data-table") {
299
- if (selected.options.submitFlag === void 0) {
300
- // selected.options.submitFlag = true;
301
- this.vueInstance.$set(selected.options, "submitFlag", true);
302
- }
303
- }
304
- this.handleKeyNameSuffix(selected);
305
- },
306
- handleKeyNameSuffix(selected) {
307
- if (!selected) return;
308
- let optionModel = selected.options;
309
- let prefix = this.getKeyNamePrefix(selected.type, optionModel);
310
- if (
311
- optionModel.keyNameEnabled &&
312
- !!prefix &&
313
- !optionModel.keyNameSuffix
314
- ) {
315
- let keyName = optionModel.keyName;
316
- if (keyName.startsWith(prefix)) {
317
- this.vueInstance.$set(
318
- optionModel,
319
- "keyNameSuffix",
320
- keyName.substring(prefix.length)
321
- );
322
- }
323
- }
324
- },
325
- setSelected(selected) {
326
- if (!selected) {
327
- this.clearSelected();
328
- return;
329
- }
330
-
331
- //处理历史未定义的属性
332
- this.handleSelectedWidget(selected);
333
-
334
- this.selectedWidget = selected;
335
- if (!!selected.id) {
336
- this.selectedId = selected.id;
337
- this.selectedWidgetName = selected.options.name;
338
- if (!selected.category) {
339
- this.emitEvent("canvas-select-field", selected.options.name);
340
- } else {
341
- this.emitEvent("canvas-select-container", selected.options.name);
342
- }
343
- }
344
- },
345
-
346
- updateSelectedWidgetNameAndLabel(selectedWidget, newName, newLabel) {
347
- this.selectedWidgetName = newName;
348
- //selectedWidget.options.name = newName //此行多余
349
- if (
350
- !!newLabel &&
351
- Object.keys(selectedWidget.options).indexOf("label") > -1
352
- ) {
353
- selectedWidget.options.label = newLabel;
354
- }
355
- },
356
-
357
- clearSelected() {
358
- this.selectedId = null;
359
- this.selectedWidgetName = null;
360
- this.selectedWidget = {}; //this.selectedWidget = null
361
- },
362
-
363
- checkWidgetMove(evt) {
364
- /* Only field widget can be dragged into sub-form */
365
- if (!!evt.draggedContext && !!evt.draggedContext.element) {
366
- let wgCategory = evt.draggedContext.element.category;
367
- let wgType = evt.draggedContext.element.type;
368
- if (!!evt.to) {
369
- if (
370
- evt.to.className === "sub-form-table" &&
371
- wgCategory === "container"
372
- ) {
373
- //this.$message.info(this.vueInstance.i18nt('designer.hint.onlyFieldWidgetAcceptable'))
374
- return false;
375
- }
376
- }
377
- }
378
-
379
- return true;
380
- },
381
-
382
- checkFieldMove(evt) {
383
- if (!!evt.draggedContext && !!evt.draggedContext.element) {
384
- let wgCategory = evt.draggedContext.element.category;
385
- let wgType = evt.draggedContext.element.type + "";
386
- //console.log('wgType======', wgType)
387
- if (!!evt.to) {
388
- if (evt.to.className === "sub-form-table" && wgType === "slot") {
389
- //this.$message.info(this.vueInstance.i18nt('designer.hint.onlyFieldWidgetAcceptable'))
390
- return false;
391
- }
392
- }
393
- }
394
-
395
- return true;
396
- },
397
-
398
- /**
399
- * 追加表格新行
400
- * @param widget
401
- */
402
- appendTableRow(widget) {
403
- let rowIdx = widget.rows.length; //确定插入行位置
404
- let newRow = baseRefUtil.deepClone(widget.rows[widget.rows.length - 1]);
405
- newRow.id = "table-row-" + baseRefUtil.generateId();
406
- newRow.merged = false;
407
- newRow.cols.forEach((col) => {
408
- col.id = "table-cell-" + baseRefUtil.generateId();
409
- col.options.name = col.id;
410
- col.merged = false;
411
- col.options.colspan = 1;
412
- col.options.rowspan = 1;
413
- col.widgetList.length = 0;
414
- });
415
- widget.rows.splice(rowIdx, 0, newRow);
416
-
417
- this.emitHistoryChange();
418
- },
419
-
420
- /**
421
- * 追加表格新列
422
- * @param widget
423
- */
424
- appendTableCol(widget) {
425
- let colIdx = widget.rows[0].cols.length; //确定插入列位置
426
- widget.rows.forEach((row) => {
427
- let newCol = baseRefUtil.deepClone(
428
- this.getContainerByType("table-cell")
429
- );
430
- newCol.id = "table-cell-" + baseRefUtil.generateId();
431
- newCol.options.name = newCol.id;
432
- newCol.merged = false;
433
- newCol.options.colspan = 1;
434
- newCol.options.rowspan = 1;
435
- newCol.widgetList.length = 0;
436
- row.cols.splice(colIdx, 0, newCol);
437
- });
438
-
439
- this.emitHistoryChange();
440
- },
441
-
442
- insertTableRow(widget, insertPos, cloneRowIdx, curCol, aboveFlag) {
443
- let newRowIdx = !!aboveFlag ? insertPos : insertPos + 1; //初步确定插入行位置
444
- if (!aboveFlag) {
445
- //继续向下寻找同列第一个未被合并的单元格
446
- let tmpRowIdx = newRowIdx;
447
- let rowFoundFlag = false;
448
- while (tmpRowIdx < widget.rows.length) {
449
- if (!widget.rows[tmpRowIdx].cols[curCol].merged) {
450
- newRowIdx = tmpRowIdx;
451
- rowFoundFlag = true;
452
- break;
453
- } else {
454
- tmpRowIdx++;
455
- }
456
- }
457
-
458
- if (!rowFoundFlag) {
459
- newRowIdx = widget.rows.length;
460
- }
461
- }
462
-
463
- let newRow = baseRefUtil.deepClone(widget.rows[cloneRowIdx]);
464
- newRow.id = "table-row-" + baseRefUtil.generateId();
465
- newRow.merged = false;
466
- newRow.cols.forEach((col) => {
467
- col.id = "table-cell-" + baseRefUtil.generateId();
468
- col.options.name = col.id;
469
- col.merged = false;
470
- col.options.colspan = 1;
471
- col.options.rowspan = 1;
472
- col.widgetList.length = 0;
473
- });
474
- widget.rows.splice(newRowIdx, 0, newRow);
475
-
476
- let colNo = 0;
477
- while (
478
- newRowIdx < widget.rows.length - 1 &&
479
- colNo < widget.rows[0].cols.length
480
- ) {
481
- //越界判断
482
- const cellOfNextRow = widget.rows[newRowIdx + 1].cols[colNo];
483
- const rowMerged = cellOfNextRow.merged; //确定插入位置下一行的单元格是否为合并单元格
484
- if (!!rowMerged) {
485
- let rowArray = widget.rows;
486
- let unMergedCell = {};
487
- let startRowIndex = null;
488
- for (let i = newRowIdx; i >= 0; i--) {
489
- //查找该行已合并的主单元格
490
- if (
491
- !rowArray[i].cols[colNo].merged &&
492
- rowArray[i].cols[colNo].options.rowspan > 1
493
- ) {
494
- startRowIndex = i;
495
- unMergedCell = rowArray[i].cols[colNo];
496
- break;
497
- }
498
- }
499
-
500
- if (!!unMergedCell.options) {
501
- //如果有符合条件的unMergedCell
502
- let newRowspan = unMergedCell.options.rowspan + 1;
503
- this.setPropsOfMergedRows(
504
- widget.rows,
505
- startRowIndex,
506
- colNo,
507
- unMergedCell.options.colspan,
508
- newRowspan
509
- );
510
- colNo += unMergedCell.options.colspan;
511
- } else {
512
- colNo += 1;
513
- }
514
- } else {
515
- //colNo += 1
516
- colNo += cellOfNextRow.options.colspan || 1;
517
- }
518
- }
519
-
520
- this.emitHistoryChange();
521
- },
522
-
523
- insertTableCol(widget, insertPos, curRow, leftFlag) {
524
- let newColIdx = !!leftFlag ? insertPos : insertPos + 1; //初步确定插入列位置
525
- if (!leftFlag) {
526
- //继续向右寻找同行第一个未被合并的单元格
527
- let tmpColIdx = newColIdx;
528
- let colFoundFlag = false;
529
- while (tmpColIdx < widget.rows[curRow].cols.length) {
530
- if (!widget.rows[curRow].cols[tmpColIdx].merged) {
531
- newColIdx = tmpColIdx;
532
- colFoundFlag = true;
533
- break;
534
- } else {
535
- tmpColIdx++;
536
- }
537
-
538
- if (!colFoundFlag) {
539
- newColIdx = widget.rows[curRow].cols.length;
540
- }
541
- }
542
- }
543
-
544
- widget.rows.forEach((row) => {
545
- let newCol = baseRefUtil.deepClone(
546
- this.getContainerByType("table-cell")
547
- );
548
- newCol.id = "table-cell-" + baseRefUtil.generateId();
549
- newCol.options.name = newCol.id;
550
- newCol.merged = false;
551
- newCol.options.colspan = 1;
552
- newCol.options.rowspan = 1;
553
- newCol.widgetList.length = 0;
554
- row.cols.splice(newColIdx, 0, newCol);
555
- });
556
-
557
- let rowNo = 0;
558
- while (
559
- newColIdx < widget.rows[0].cols.length - 1 &&
560
- rowNo < widget.rows.length
561
- ) {
562
- //越界判断
563
- const cellOfNextCol = widget.rows[rowNo].cols[newColIdx + 1];
564
- const colMerged = cellOfNextCol.merged; //确定插入位置右侧列的单元格是否为合并单元格
565
- if (!!colMerged) {
566
- let colArray = widget.rows[rowNo].cols;
567
- let unMergedCell = {};
568
- let startColIndex = null;
569
- for (let i = newColIdx; i >= 0; i--) {
570
- //查找该行已合并的主单元格
571
- if (!colArray[i].merged && colArray[i].options.colspan > 1) {
572
- startColIndex = i;
573
- unMergedCell = colArray[i];
574
- break;
575
- }
576
- }
577
-
578
- if (!!unMergedCell.options) {
579
- //如果有符合条件的unMergedCell
580
- let newColspan = unMergedCell.options.colspan + 1;
581
- this.setPropsOfMergedCols(
582
- widget.rows,
583
- rowNo,
584
- startColIndex,
585
- newColspan,
586
- unMergedCell.options.rowspan
587
- );
588
- rowNo += unMergedCell.options.rowspan;
589
- } else {
590
- rowNo += 1;
591
- }
592
- } else {
593
- //rowNo += 1
594
- rowNo += cellOfNextCol.options.rowspan || 1;
595
- }
596
- }
597
-
598
- this.emitHistoryChange();
599
- },
600
- insertH5TableCol(widget, insertPos, curRow, leftFlag) {
601
- let newColIdx = !!leftFlag ? insertPos : insertPos + 1; //初步确定插入列位置
602
- if (!leftFlag) {
603
- //继续向右寻找同行第一个未被合并的单元格
604
- let tmpColIdx = newColIdx;
605
- let colFoundFlag = false;
606
- while (tmpColIdx < widget.rows[curRow].cols.length) {
607
- if (!widget.rows[curRow].cols[tmpColIdx].merged) {
608
- newColIdx = tmpColIdx;
609
- colFoundFlag = true;
610
- break;
611
- } else {
612
- tmpColIdx++;
613
- }
614
-
615
- if (!colFoundFlag) {
616
- newColIdx = widget.rows[curRow].cols.length;
617
- }
618
- }
619
- }
620
-
621
- widget.rows.forEach((row) => {
622
- let newCol = baseRefUtil.deepClone(
623
- this.getContainerByType("h5-table-cell")
624
- );
625
- newCol.id = "table-cell-" + baseRefUtil.generateId();
626
- newCol.options.name = newCol.id;
627
- newCol.merged = false;
628
- newCol.options.colspan = 1;
629
- newCol.options.rowspan = 1;
630
- newCol.widgetList.length = 0;
631
- row.cols.splice(newColIdx, 0, newCol);
632
- });
633
-
634
- let rowNo = 0;
635
- while (
636
- newColIdx < widget.rows[0].cols.length - 1 &&
637
- rowNo < widget.rows.length
638
- ) {
639
- //越界判断
640
- const cellOfNextCol = widget.rows[rowNo].cols[newColIdx + 1];
641
- const colMerged = cellOfNextCol.merged; //确定插入位置右侧列的单元格是否为合并单元格
642
- if (!!colMerged) {
643
- let colArray = widget.rows[rowNo].cols;
644
- let unMergedCell = {};
645
- let startColIndex = null;
646
- for (let i = newColIdx; i >= 0; i--) {
647
- //查找该行已合并的主单元格
648
- if (!colArray[i].merged && colArray[i].options.colspan > 1) {
649
- startColIndex = i;
650
- unMergedCell = colArray[i];
651
- break;
652
- }
653
- }
654
-
655
- if (!!unMergedCell.options) {
656
- //如果有符合条件的unMergedCell
657
- let newColspan = unMergedCell.options.colspan + 1;
658
- this.setPropsOfMergedCols(
659
- widget.rows,
660
- rowNo,
661
- startColIndex,
662
- newColspan,
663
- unMergedCell.options.rowspan
664
- );
665
- rowNo += unMergedCell.options.rowspan;
666
- } else {
667
- rowNo += 1;
668
- }
669
- } else {
670
- //rowNo += 1
671
- rowNo += cellOfNextCol.options.rowspan || 1;
672
- }
673
- }
674
-
675
- this.emitHistoryChange();
676
- },
677
- setPropsOfMergedCols(
678
- rowArray,
679
- startRowIndex,
680
- startColIndex,
681
- newColspan,
682
- rowspan
683
- ) {
684
- for (let i = startRowIndex; i < startRowIndex + rowspan; i++) {
685
- for (let j = startColIndex; j < startColIndex + newColspan; j++) {
686
- if (i === startRowIndex && j === startColIndex) {
687
- rowArray[i].cols[j].options.colspan = newColspan; //合并后的主单元格
688
- continue;
689
- }
690
-
691
- rowArray[i].cols[j].merged = true;
692
- rowArray[i].cols[j].options.colspan = newColspan;
693
- rowArray[i].cols[j].widgetList = [];
694
- }
695
- }
696
- },
697
-
698
- setPropsOfMergedRows(
699
- rowArray,
700
- startRowIndex,
701
- startColIndex,
702
- colspan,
703
- newRowspan
704
- ) {
705
- for (let i = startRowIndex; i < startRowIndex + newRowspan; i++) {
706
- for (let j = startColIndex; j < startColIndex + colspan; j++) {
707
- if (i === startRowIndex && j === startColIndex) {
708
- rowArray[i].cols[j].options.rowspan = newRowspan;
709
- continue;
710
- }
711
-
712
- rowArray[i].cols[j].merged = true;
713
- rowArray[i].cols[j].options.rowspan = newRowspan;
714
- rowArray[i].cols[j].widgetList = [];
715
- }
716
- }
717
- },
718
-
719
- setPropsOfSplitCol(
720
- rowArray,
721
- startRowIndex,
722
- startColIndex,
723
- colspan,
724
- rowspan
725
- ) {
726
- for (let i = startRowIndex; i < startRowIndex + rowspan; i++) {
727
- for (let j = startColIndex; j < startColIndex + colspan; j++) {
728
- rowArray[i].cols[j].merged = false;
729
- rowArray[i].cols[j].options.rowspan = 1;
730
- rowArray[i].cols[j].options.colspan = 1;
731
- }
732
- }
733
- },
734
-
735
- setPropsOfSplitRow(
736
- rowArray,
737
- startRowIndex,
738
- startColIndex,
739
- colspan,
740
- rowspan
741
- ) {
742
- for (let i = startRowIndex; i < startRowIndex + rowspan; i++) {
743
- for (let j = startColIndex; j < startColIndex + colspan; j++) {
744
- rowArray[i].cols[j].merged = false;
745
- rowArray[i].cols[j].options.rowspan = 1;
746
- rowArray[i].cols[j].options.colspan = 1;
747
- }
748
- }
749
- },
750
-
751
- mergeTableCol(rowArray, colArray, curRow, curCol, leftFlag, cellWidget) {
752
- let mergedColIdx = !!leftFlag
753
- ? curCol
754
- : curCol + colArray[curCol].options.colspan;
755
-
756
- // let remainedColIdx = !!leftFlag ? curCol - colArray[curCol - 1].options.colspan : curCol
757
- let remainedColIdx = !!leftFlag ? curCol - 1 : curCol;
758
- if (!!leftFlag) {
759
- //继续向左寻找同行未被合并的第一个单元格
760
- let tmpColIdx = remainedColIdx;
761
- while (tmpColIdx >= 0) {
762
- if (!rowArray[curRow].cols[tmpColIdx].merged) {
763
- remainedColIdx = tmpColIdx;
764
- break;
765
- } else {
766
- tmpColIdx--;
767
- }
768
- }
769
- }
770
-
771
- if (
772
- !!colArray[mergedColIdx].widgetList &&
773
- colArray[mergedColIdx].widgetList.length > 0
774
- ) {
775
- //保留widgetList
776
- if (
777
- !colArray[remainedColIdx].widgetList ||
778
- colArray[remainedColIdx].widgetList.length === 0
779
- ) {
780
- colArray[remainedColIdx].widgetList = baseRefUtil.deepClone(
781
- colArray[mergedColIdx].widgetList
782
- );
783
- }
784
- }
785
-
786
- let newColspan =
787
- colArray[mergedColIdx].options.colspan * 1 +
788
- colArray[remainedColIdx].options.colspan * 1;
789
- this.setPropsOfMergedCols(
790
- rowArray,
791
- curRow,
792
- remainedColIdx,
793
- newColspan,
794
- cellWidget.options.rowspan
795
- );
796
-
797
- this.emitHistoryChange();
798
- },
799
-
800
- mergeTableWholeRow(rowArray, colArray, rowIndex, colIndex) {
801
- //需要考虑操作的行存在已合并的单元格!!
802
- //整行所有单元格行高不一致不可合并!!
803
- let startRowspan = rowArray[rowIndex].cols[0].options.rowspan;
804
- let unmatchedFlag = false;
805
- for (let i = 1; i < rowArray[rowIndex].cols.length; i++) {
806
- if (rowArray[rowIndex].cols[i].options.rowspan !== startRowspan) {
807
- unmatchedFlag = true;
808
- break;
809
- }
810
- }
811
- if (unmatchedFlag) {
812
- this.vueInstance.$message.info(
813
- this.vueInstance.i18nt(
814
- "designer.hint.rowspanNotConsistentForMergeEntireRow"
815
- )
816
- );
817
- return;
818
- }
819
-
820
- let widgetListCols = colArray.filter((colItem) => {
821
- return (
822
- !colItem.merged &&
823
- !!colItem.widgetList &&
824
- colItem.widgetList.length > 0
825
- );
826
- });
827
- if (!!widgetListCols && widgetListCols.length > 0) {
828
- //保留widgetList
829
- if (
830
- widgetListCols[0].id !== colArray[0].id &&
831
- (!colArray[0].widgetList || colArray[0].widgetList.length <= 0)
832
- ) {
833
- colArray[0].widgetList = baseRefUtil.deepClone(
834
- widgetListCols[0].widgetList
835
- );
836
- }
837
- }
838
-
839
- this.setPropsOfMergedCols(
840
- rowArray,
841
- rowIndex,
842
- 0,
843
- colArray.length,
844
- colArray[colIndex].options.rowspan
845
- );
846
-
847
- this.emitHistoryChange();
848
- },
849
-
850
- mergeTableRow(rowArray, curRow, curCol, aboveFlag, cellWidget) {
851
- let mergedRowIdx = !!aboveFlag
852
- ? curRow
853
- : curRow + cellWidget.options.rowspan;
854
-
855
- //let remainedRowIdx = !!aboveFlag ? curRow - cellWidget.options.rowspan : curRow
856
- let remainedRowIdx = !!aboveFlag ? curRow - 1 : curRow;
857
- if (!!aboveFlag) {
858
- //继续向上寻找同列未被合并的第一个单元格
859
- let tmpRowIdx = remainedRowIdx;
860
- while (tmpRowIdx >= 0) {
861
- if (!rowArray[tmpRowIdx].cols[curCol].merged) {
862
- remainedRowIdx = tmpRowIdx;
863
- break;
864
- } else {
865
- tmpRowIdx--;
866
- }
867
- }
868
- }
869
-
870
- if (
871
- !!rowArray[mergedRowIdx].cols[curCol].widgetList &&
872
- rowArray[mergedRowIdx].cols[curCol].widgetList.length > 0
873
- ) {
874
- //保留widgetList
875
- if (
876
- !rowArray[remainedRowIdx].cols[curCol].widgetList ||
877
- rowArray[remainedRowIdx].cols[curCol].widgetList.length === 0
878
- ) {
879
- rowArray[remainedRowIdx].cols[curCol].widgetList =
880
- baseRefUtil.deepClone(
881
- rowArray[mergedRowIdx].cols[curCol].widgetList
882
- );
883
- }
884
- }
885
-
886
- let newRowspan =
887
- rowArray[mergedRowIdx].cols[curCol].options.rowspan * 1 +
888
- rowArray[remainedRowIdx].cols[curCol].options.rowspan * 1;
889
- this.setPropsOfMergedRows(
890
- rowArray,
891
- remainedRowIdx,
892
- curCol,
893
- cellWidget.options.colspan,
894
- newRowspan
895
- );
896
-
897
- this.emitHistoryChange();
898
- },
899
-
900
- mergeTableWholeCol(rowArray, colArray, rowIndex, colIndex) {
901
- //需要考虑操作的列存在已合并的单元格!!
902
- //整列所有单元格列宽不一致不可合并!!
903
- let startColspan = rowArray[0].cols[colIndex].options.colspan;
904
- let unmatchedFlag = false;
905
- for (let i = 1; i < rowArray.length; i++) {
906
- if (rowArray[i].cols[colIndex].options.colspan !== startColspan) {
907
- unmatchedFlag = true;
908
- break;
909
- }
910
- }
911
- if (unmatchedFlag) {
912
- this.vueInstance.$message.info(
913
- this.vueInstance.i18nt(
914
- "designer.hint.colspanNotConsistentForMergeEntireColumn"
915
- )
916
- );
917
- return;
918
- }
919
-
920
- let widgetListCols = [];
921
- rowArray.forEach((rowItem) => {
922
- let tempCell = rowItem.cols[colIndex];
923
- if (
924
- !tempCell.merged &&
925
- !!tempCell.widgetList &&
926
- tempCell.widgetList.length > 0
927
- ) {
928
- widgetListCols.push(tempCell);
929
- }
930
- });
931
-
932
- let firstCellOfCol = rowArray[0].cols[colIndex];
933
- if (!!widgetListCols && widgetListCols.length > 0) {
934
- //保留widgetList
935
- if (
936
- widgetListCols[0].id !== firstCellOfCol.id &&
937
- (!firstCellOfCol.widgetList ||
938
- firstCellOfCol.widgetList.length <= 0)
939
- ) {
940
- firstCellOfCol.widgetList = baseRefUtil.deepClone(
941
- widgetListCols[0].widgetList
942
- );
943
- }
944
- }
945
-
946
- this.setPropsOfMergedRows(
947
- rowArray,
948
- 0,
949
- colIndex,
950
- firstCellOfCol.options.colspan,
951
- rowArray.length
952
- );
953
-
954
- this.emitHistoryChange();
955
- },
956
-
957
- undoMergeTableCol(rowArray, rowIndex, colIndex, colspan, rowspan) {
958
- this.setPropsOfSplitCol(rowArray, rowIndex, colIndex, colspan, rowspan);
959
-
960
- this.emitHistoryChange();
961
- },
962
-
963
- undoMergeTableRow(rowArray, rowIndex, colIndex, colspan, rowspan) {
964
- this.setPropsOfSplitRow(rowArray, rowIndex, colIndex, colspan, rowspan);
965
-
966
- this.emitHistoryChange();
967
- },
968
-
969
- deleteTableWholeCol(rowArray, colIndex) {
970
- //需考虑删除的是合并列!!
971
- let onlyOneColFlag = true;
972
- rowArray.forEach((ri) => {
973
- if (ri.cols[0].options.colspan !== rowArray[0].cols.length) {
974
- onlyOneColFlag = false;
975
- }
976
- });
977
- //仅剩一列则不可删除!!
978
- if (onlyOneColFlag) {
979
- this.vueInstance.$message.info(
980
- this.vueInstance.i18nt("designer.hint.lastColCannotBeDeleted")
981
- );
982
- return;
983
- }
984
-
985
- //整列所有单元格列宽不一致不可删除!!
986
- let startColspan = rowArray[0].cols[colIndex].options.colspan;
987
- let unmatchedFlag = false;
988
- for (let i = 1; i < rowArray.length; i++) {
989
- if (rowArray[i].cols[colIndex].options.colspan !== startColspan) {
990
- unmatchedFlag = true;
991
- break;
992
- }
993
- }
994
- if (unmatchedFlag) {
995
- this.vueInstance.$message.info(
996
- this.vueInstance.i18nt(
997
- "designer.hint.colspanNotConsistentForDeleteEntireColumn"
998
- )
999
- );
1000
- return;
1001
- }
1002
-
1003
- rowArray.forEach((rItem) => {
1004
- rItem.cols.splice(colIndex, startColspan);
1005
- });
1006
-
1007
- this.emitHistoryChange();
1008
- },
1009
-
1010
- deleteTableWholeRow(rowArray, rowIndex) {
1011
- //需考虑删除的是合并行!!
1012
- let onlyOneRowFlag = true;
1013
- rowArray[0].cols.forEach((ci) => {
1014
- if (ci.options.rowspan !== rowArray.length) {
1015
- onlyOneRowFlag = false;
1016
- }
1017
- });
1018
- //仅剩一行则不可删除!!
1019
- if (onlyOneRowFlag) {
1020
- this.vueInstance.$message.info(
1021
- this.vueInstance.i18nt("designer.hint.lastRowCannotBeDeleted")
1022
- );
1023
- return;
1024
- }
1025
-
1026
- //整行所有单元格行高不一致不可删除!!
1027
- let startRowspan = rowArray[rowIndex].cols[0].options.rowspan;
1028
- let unmatchedFlag = false;
1029
- for (let i = 1; i < rowArray[rowIndex].cols.length; i++) {
1030
- if (rowArray[rowIndex].cols[i].options.rowspan !== startRowspan) {
1031
- unmatchedFlag = true;
1032
- break;
1033
- }
1034
- }
1035
- if (unmatchedFlag) {
1036
- this.vueInstance.$message.info(
1037
- this.vueInstance.i18nt(
1038
- "designer.hint.rowspanNotConsistentForDeleteEntireRow"
1039
- )
1040
- );
1041
- return;
1042
- }
1043
-
1044
- rowArray.splice(rowIndex, startRowspan);
1045
-
1046
- this.emitHistoryChange();
1047
- },
1048
-
1049
- getContainerByType(typeName) {
1050
- let allWidgets = [
1051
- ...baseRefUtil.containers,
1052
- ...baseRefUtil.basicFields,
1053
- ...baseRefUtil.advancedFields,
1054
- ...baseRefUtil.customFields,
1055
- ...businessFields,
1056
- ];
1057
- let foundCon = null;
1058
- allWidgets.forEach((con) => {
1059
- if (!!con.category && !!con.type && con.type === typeName) {
1060
- foundCon = con;
1061
- }
1062
- });
1063
-
1064
- return foundCon;
1065
- },
1066
-
1067
- getFieldWidgetByType(typeName) {
1068
- let allWidgets = [
1069
- ...baseRefUtil.containers,
1070
- ...baseRefUtil.basicFields,
1071
- ...baseRefUtil.advancedFields,
1072
- ...baseRefUtil.customFields,
1073
- ...chartContainers,
1074
- ...chartWidgets,
1075
- ...businessFields,
1076
- ];
1077
- let foundWidget = null;
1078
- allWidgets.forEach((widget) => {
1079
- if (!!!widget.category && !!widget.type && widget.type === typeName) {
1080
- foundWidget = widget;
1081
- }
1082
- });
1083
-
1084
- return foundWidget;
1085
- },
1086
-
1087
- hasConfig(widget, configName) {
1088
- let originalWidget = null;
1089
- if (!!widget.category) {
1090
- originalWidget = this.getContainerByType(widget.type);
1091
- } else {
1092
- originalWidget = this.getFieldWidgetByType(widget.type);
1093
- }
1094
-
1095
- if (!originalWidget || !originalWidget.options) {
1096
- return false;
1097
- }
1098
-
1099
- return Object.keys(originalWidget.options).indexOf(configName) > -1;
1100
- },
1101
- /*upgradeWidgetConfig(oldWidget) {
1102
- let newWidget = null;
1103
- if (!!oldWidget.category) {
1104
- newWidget = this.getContainerByType(oldWidget.type);
1105
- } else {
1106
- newWidget = this.getFieldWidgetByType(oldWidget.type);
1107
- }
1108
-
1109
- if (!newWidget || !newWidget.options) {
1110
- return;
1111
- }
1112
-
1113
- Object.keys(newWidget.options).forEach(ck => {
1114
- if (!oldWidget.options.hasOwnProperty(ck)) {
1115
- oldWidget.options[ck] = baseRefUtil.deepClone(newWidget.options[ck]);
1116
- }
1117
- });
1118
- },*/
1119
- upgradeWidgetConfig(oldWidget) {
1120
- let newWidget = null;
1121
- if (!!oldWidget.category) {
1122
- newWidget = this.getContainerByType(oldWidget.type);
1123
- } else {
1124
- newWidget = this.getFieldWidgetByType(oldWidget.type);
1125
- }
1126
-
1127
- if (!newWidget || !newWidget.options) {
1128
- return;
1129
- }
1130
-
1131
- Object.keys(newWidget.options).forEach((ck) => {
1132
- if (!oldWidget.options.hasOwnProperty(ck)) {
1133
- let value = newWidget.options[ck];
1134
- let nullValue = Array.isArray(value) ? [] : null;
1135
- oldWidget.options[ck] = nullValue;
1136
- }
1137
- });
1138
- },
1139
-
1140
- upgradeFormConfig(oldFormConfig) {
1141
- Object.keys(this.formConfig).forEach((fc) => {
1142
- if (!oldFormConfig.hasOwnProperty(fc)) {
1143
- let value = this.formConfig[fc];
1144
- let nullValue = Array.isArray(value) ? [] : null;
1145
- oldFormConfig[fc] = baseRefUtil.deepClone(nullValue);
1146
- }
1147
- });
1148
- },
1149
-
1150
- cloneGridCol(widget, parentWidget) {
1151
- let newGridCol = baseRefUtil.deepClone(
1152
- this.getContainerByType("grid-col")
1153
- );
1154
- newGridCol.options.span = widget.options.span;
1155
- let tmpId = baseRefUtil.generateId();
1156
- newGridCol.id = "grid-col-" + tmpId;
1157
- newGridCol.options.name = "gridCol" + tmpId;
1158
-
1159
- parentWidget.cols.push(newGridCol);
1160
- },
1161
-
1162
- cloneContainer(containWidget) {
1163
- if (containWidget.type === "grid") {
1164
- let newGrid = baseRefUtil.deepClone(this.getContainerByType("grid"));
1165
- newGrid.id = newGrid.type + baseRefUtil.generateId();
1166
- newGrid.options.name = newGrid.id;
1167
- containWidget.cols.forEach((gridCol) => {
1168
- let newGridCol = baseRefUtil.deepClone(
1169
- this.getContainerByType("grid-col")
1170
- );
1171
- let tmpId = baseRefUtil.generateId();
1172
- newGridCol.id = "grid-col-" + tmpId;
1173
- newGridCol.options.name = "gridCol" + tmpId;
1174
- newGridCol.options.span = gridCol.options.span;
1175
- newGrid.cols.push(newGridCol);
1176
- });
1177
-
1178
- return newGrid;
1179
- } else if (containWidget.type === "table") {
1180
- let newTable = baseRefUtil.deepClone(
1181
- this.getContainerByType("table")
1182
- );
1183
- newTable.id = newTable.type + baseRefUtil.generateId();
1184
- newTable.options.name = newTable.id;
1185
- containWidget.rows.forEach((tRow) => {
1186
- let newRow = baseRefUtil.deepClone(tRow);
1187
- newRow.id = "table-row-" + baseRefUtil.generateId();
1188
- newRow.cols.forEach((col) => {
1189
- col.id = "table-cell-" + baseRefUtil.generateId();
1190
- col.options.name = col.id;
1191
- col.widgetList = []; //清空组件列表
1192
- });
1193
- newTable.rows.push(newRow);
1194
- });
1195
-
1196
- return newTable;
1197
- } else if (containWidget.type === "h5-table") {
1198
- let newTable = baseRefUtil.deepClone(
1199
- this.getContainerByType("h5-table")
1200
- );
1201
- newTable.id = newTable.type + baseRefUtil.generateId();
1202
- newTable.options.name = newTable.id;
1203
- containWidget.rows.forEach((tRow) => {
1204
- let newRow = baseRefUtil.deepClone(tRow);
1205
- newRow.id = "table-row-" + baseRefUtil.generateId();
1206
- newRow.cols.forEach((col) => {
1207
- col.id = "table-cell-" + baseRefUtil.generateId();
1208
- col.options.name = col.id;
1209
- col.widgetList = []; //清空组件列表
1210
- });
1211
- newTable.rows.push(newRow);
1212
- });
1213
-
1214
- return newTable;
1215
- } else {
1216
- //其他容器组件不支持clone操作
1217
- return null;
1218
- }
1219
- },
1220
-
1221
- moveUpWidget(parentList, indexOfParentList) {
1222
- if (!!parentList) {
1223
- if (indexOfParentList === 0) {
1224
- this.vueInstance.$message(
1225
- this.vueInstance.i18nt("designer.hint.moveUpFirstChildHint")
1226
- );
1227
- return;
1228
- }
1229
-
1230
- let tempWidget = parentList[indexOfParentList];
1231
- parentList.splice(indexOfParentList, 1);
1232
- parentList.splice(indexOfParentList - 1, 0, tempWidget);
1233
- }
1234
- },
1235
-
1236
- moveDownWidget(parentList, indexOfParentList) {
1237
- if (!!parentList) {
1238
- if (indexOfParentList === parentList.length - 1) {
1239
- this.vueInstance.$message(
1240
- this.vueInstance.i18nt("designer.hint.moveDownLastChildHint")
1241
- );
1242
- return;
1243
- }
1244
-
1245
- let tempWidget = parentList[indexOfParentList];
1246
- parentList.splice(indexOfParentList, 1);
1247
- parentList.splice(indexOfParentList + 1, 0, tempWidget);
1248
- }
1249
- },
1250
- copyNewFieldWidget(origin) {
1251
- let newWidget = baseRefUtil.deepClone(origin);
1252
- let sourceType = newWidget.type;
1253
- newWidget.type = newWidget.targetType || newWidget.type;
1254
- newWidget.sourceType = sourceType;
1255
- let tempId = baseRefUtil.generateId();
1256
- newWidget.id = newWidget.type.replace(/-/g, "") + tempId;
1257
- if (newWidget.hasOwnProperty("tableField")) {
1258
- newWidget.tableField = newWidget.id; //表字段
1259
- }
1260
-
1261
- // newWidget.options.name = newWidget.id;
1262
- // newWidget.options.label = newWidget.options.label || newWidget.type.toLowerCase();
1263
-
1264
- newWidget.nameReadonly
1265
- ? newWidget.options.label &&
1266
- newWidget.options.label.indexOf(".") > -1 &&
1267
- (newWidget.options.label = newWidget.options.label.substring(
1268
- newWidget.options.label.indexOf(".") + 1
1269
- ))
1270
- : ((newWidget.options.name = newWidget.id),
1271
- (newWidget.options.label =
1272
- newWidget.options.label || newWidget.type.toLowerCase()));
1273
- delete newWidget.displayName;
1274
- if (!newWidget.nameReadonly) {
1275
- newWidget.options.keyNameEnabled = true;
1276
- if (!newWidget.options.keyName)
1277
- newWidget.options.keyName = newWidget.id;
1278
- if (
1279
- newWidget.type === "vabUpload" ||
1280
- newWidget.type === "baseAttachment"
1281
- ) {
1282
- let keyNameSuffix = this.createKeyNameSuffix(newWidget.type);
1283
- // this.createKeyNameSuffix()
1284
- newWidget.options.keyName = this.createKeyName(
1285
- newWidget.type,
1286
- keyNameSuffix
1287
- );
1288
- newWidget.options.keyNameSuffix = keyNameSuffix;
1289
- }
1290
- }
1291
- if (newWidget.type === "dropdown") {
1292
- let dropdownItem1 = this.copyNewFieldWidget(
1293
- this.getFieldWidgetByType("dropdown-item")
1294
- );
1295
- dropdownItem1.options.label = "下拉按钮1";
1296
- let dropdownItem2 = this.copyNewFieldWidget(
1297
- this.getFieldWidgetByType("dropdown-item")
1298
- );
1299
- dropdownItem2.options.label = "下拉按钮2";
1300
- newWidget.widgetList.push(dropdownItem1);
1301
- newWidget.widgetList.push(dropdownItem2);
1302
- }
1303
- this.emitEvent("canvas-add-field", newWidget.options.name);
1304
- return newWidget;
1305
- },
1306
- createKeyName(type, suffix, options) {
1307
- let keyNameSuffix = suffix ? suffix : this.createKeyNameSuffix(type);
1308
- let keyNamePrefix = this.getKeyNamePrefix(type, options);
1309
- let keyName = null;
1310
- if (keyNamePrefix) {
1311
- keyName = keyNamePrefix + keyNameSuffix;
1312
- } else {
1313
- keyName = keyNameSuffix;
1314
- }
1315
- return keyName;
1316
- },
1317
- createKeyNameSuffix(type) {
1318
- let suffix = createUUID();
1319
- /*if (type === "vabUpload" || type === "baseAttachment") {
1320
- let formCode = vueInstance.reportTemplate.formCode;
1321
- suffix = formCode + "_" + suffix;
1322
- }*/
1323
- return suffix;
1324
- },
1325
- /* 开了「值存为URL」的附件字段存的是主表普通列(值是 URL 字符串),不再走
1326
- attachments_ 独立附件通道,keyName 不能带前缀——否则保存时会被
1327
- data-table-mixin 的 attachments_ 提取逻辑当附件包发走,主表列存不到 */
1328
- getKeyNamePrefix(type, options) {
1329
- if (options && options.urlValueEnabled) {
1330
- return null;
1331
- }
1332
- return keyNamePrefixMap[type] ?? null;
1333
- },
1334
- getFormCodePrefix(type) {
1335
- let prefix = this.getKeyNamePrefix(type) || "";
1336
- let attachmentPrefix =
1337
- prefix + vueInstance.reportTemplate.formCode + "_";
1338
- return attachmentPrefix;
1339
- },
1340
- createAttachmentSuffix() {
1341
- let type = "vabUpload";
1342
- return this.createKeyNameSuffix(type);
1343
- },
1344
- getAttachmentPrefix() {
1345
- let type = "vabUpload";
1346
- return this.getKeyNamePrefix(type);
1347
- },
1348
- getAttachmentFormCodePrefix() {
1349
- let type = "vabUpload";
1350
- let attachmentPrefix = this.getFormCodePrefix(type);
1351
- return attachmentPrefix;
1352
- },
1353
- createAttachmentKeyName(suffix) {
1354
- let type = "vabUpload";
1355
- let keyName = this.createKeyName(type, suffix);
1356
- return keyName;
1357
- },
1358
- copyNewContainerWidget(origin) {
1359
- let newCon = baseRefUtil.deepClone(origin);
1360
- let sourceType = newCon.type;
1361
- newCon.type = newCon.targetType || newCon.type;
1362
- newCon.sourceType = sourceType;
1363
- newCon.id = newCon.type.replace(/-/g, "") + baseRefUtil.generateId();
1364
- newCon.options.name = newCon.id;
1365
- if ((newCon.options.keyNameEnabled = true)) {
1366
- newCon.options.keyName = newCon.id;
1367
- }
1368
- if (newCon.hasOwnProperty("tableField")) {
1369
- newCon.tableField = newCon.id; //表字段
1370
- }
1371
- if (newCon.type === "grid") {
1372
- let newCol = baseRefUtil.deepClone(
1373
- this.getContainerByType("grid-col")
1374
- );
1375
- let tmpId = baseRefUtil.generateId();
1376
- newCol.id = "grid-col-" + tmpId;
1377
- newCol.options.name = "gridCol" + tmpId;
1378
- newCon.cols.push(newCol);
1379
- //
1380
- newCol = baseRefUtil.deepClone(newCol);
1381
- tmpId = baseRefUtil.generateId();
1382
- newCol.id = "grid-col-" + tmpId;
1383
- newCol.options.name = "gridCol" + tmpId;
1384
- newCon.cols.push(newCol);
1385
- } else if (newCon.type === "table") {
1386
- let newRow = {
1387
- cols: [],
1388
- };
1389
- newRow.id = "table-row-" + baseRefUtil.generateId();
1390
- newRow.merged = false;
1391
- for (let i = 0; i < 4; i++) {
1392
- let newCell = baseRefUtil.deepClone(
1393
- this.getContainerByType("table-cell")
1394
- );
1395
- newCell.id = "table-cell-" + baseRefUtil.generateId();
1396
- newCell.options.name = newCell.id;
1397
- newCell.merged = false;
1398
- newCell.options.colspan = 1;
1399
- newCell.options.rowspan = 1;
1400
- newRow.cols.push(newCell);
1401
- }
1402
- newCon.rows.push(newRow);
1403
- } else if (newCon.type === "tab") {
1404
- let newTabPane = baseRefUtil.deepClone(
1405
- this.getContainerByType("tab-pane")
1406
- );
1407
- newTabPane.id = "tab-pane-" + baseRefUtil.generateId();
1408
- newTabPane.options.name = "tab1";
1409
- newTabPane.options.label = "tab 1";
1410
- newCon.tabs.push(newTabPane);
1411
- } else if (newCon.type === "data-table") {
1412
- let add_button = this.copyNewFieldWidget(
1413
- this.getFieldWidgetByType("add_button")
1414
- );
1415
- add_button.options.onClick =
1416
- "this.getWidgetRef('" +
1417
- newCon.options.name +
1418
- "').openEditDialog();";
1419
- newCon.buttons.push(add_button);
1420
- } else if (newCon.type === "detail" || newCon.type === "detail-plain") {
1421
- /* detail-plain 无标题栏,不预置标题栏按钮;其余 panes 结构与 detail 一致 */
1422
- if (newCon.type === "detail") {
1423
- let buttonCon1 = this.copyNewFieldWidget(
1424
- this.getFieldWidgetByType("reset_button")
1425
- );
1426
- // buttonCon1.options.label = "重置";
1427
-
1428
- let buttonCon2 = this.copyNewFieldWidget(
1429
- this.getFieldWidgetByType("save_button")
1430
- );
1431
- buttonCon2.options.label = "保存";
1432
-
1433
- newCon.widgetList.push(buttonCon1);
1434
- newCon.widgetList.push(buttonCon2);
1435
- }
1436
-
1437
- let newCol = baseRefUtil.deepClone(
1438
- this.getContainerByType("detail-pane")
1439
- );
1440
- let tmpId = baseRefUtil.generateId();
1441
- newCol.id = "detail-pane-" + tmpId;
1442
- newCol.options.name = "detailPane" + tmpId;
1443
- newCol.options.label = "隐藏信息";
1444
- newCol.options.hidden = true;
1445
-
1446
- let tableCon = this.copyNewContainerWidget(
1447
- this.getContainerByType("table")
1448
- );
1449
- newCol.widgetList.push(tableCon);
1450
- newCon.panes.push(newCol);
1451
-
1452
- newCol = baseRefUtil.deepClone(
1453
- this.getContainerByType("detail-pane")
1454
- );
1455
- tmpId = baseRefUtil.generateId();
1456
- newCol.id = "detail-pane-" + tmpId;
1457
- newCol.options.name = "detailPane" + tmpId;
1458
- newCol.options.label = "基础信息";
1459
-
1460
- tableCon = this.copyNewContainerWidget(
1461
- this.getContainerByType("table")
1462
- );
1463
- newCol.widgetList.push(tableCon);
1464
- newCon.panes.push(newCol);
1465
- //
1466
- newCol = baseRefUtil.deepClone(
1467
- this.getContainerByType("detail-pane")
1468
- );
1469
- tmpId = baseRefUtil.generateId();
1470
- newCol.id = "detail-pane-" + tmpId;
1471
- newCol.options.name = "detailPane" + tmpId;
1472
- newCol.options.label = "明细信息";
1473
- newCol.options.tableRef = tableCon.id;
1474
- let dataTableCon = this.copyNewContainerWidget(
1475
- this.getContainerByType("data-table")
1476
- );
1477
- newCol.widgetList.push(dataTableCon);
1478
- newCol.options.tableRef = dataTableCon.id;
1479
-
1480
- let buttonCon3 = this.copyNewFieldWidget(
1481
- this.getFieldWidgetByType("button")
1482
- );
1483
- buttonCon3.options.label = "新增";
1484
- buttonCon3.options.icon = "el-icon-search";
1485
- // buttonCon3.options.onClick = "this.getWidgetRef('" + dataTableCon.options.name + "').addTableData();"
1486
- buttonCon3.options.clickBindEvent = CLICK_BIND.ADD_TABLE_DATA;
1487
- Object.assign(buttonCon3.options.addTableDataConfig, {
1488
- tableRef: dataTableCon.options.name,
1489
- });
1490
-
1491
- newCol.buttonWidgetList.push(buttonCon3);
1492
- newCon.panes.push(newCol);
1493
-
1494
- newCol = baseRefUtil.deepClone(
1495
- this.getContainerByType("detail-pane")
1496
- );
1497
- tmpId = baseRefUtil.generateId();
1498
- newCol.id = "detail-pane-" + tmpId;
1499
- newCol.options.name = "detailPane" + tmpId;
1500
- newCol.options.label = "附件信息";
1501
- let vabUploadCon = this.copyNewFieldWidget(
1502
- this.getFieldWidgetByType("vabUpload")
1503
- ); //vabUpload
1504
- newCol.widgetList.push(vabUploadCon);
1505
- newCon.panes.push(newCol);
1506
-
1507
- /* 「详情模块(标签)」面板条目:type=detail-tabs + targetType=detail,落地后就是 detail,
1508
- 不是新的容器类型。与「详情模块」的区别是内容模块不直接挂在正文区,而是收进标签里,
1509
- 详见 docs/详情模块标签承载方案.md */
1510
- if (newCon.sourceType === "detail-tabs") {
1511
- // 上面已按 detail 的默认骨架建好一批内容模块,整体挪进第一个标签——
1512
- // 标签形态下正文区只放标签容器,不留散在标签外面的模块。
1513
- let presetPanes = newCon.panes.splice(0);
1514
-
1515
- // 标签内的模块由 detail-plain 承载:它自带一套独立锚点导航,
1516
- // 外层 baseTabs 探测不到标签内的模块(tab-item 不满足 getTabs 的两个条件)。
1517
- let plainCon = this.copyNewContainerWidget(
1518
- this.getContainerByType("detail-plain")
1519
- );
1520
- plainCon.panes = presetPanes; // 丢掉 detail-plain 自带的默认模块,用上面建好的这批
1521
- plainCon.options.hideNav = false; // schema 默认关导航,标签内要开
1522
-
1523
- let tabCon = this.copyNewContainerWidget(
1524
- this.getContainerByType("tab")
1525
- );
1526
- tabCon.tabs[0].widgetList.push(plainCon);
1527
-
1528
- // copyNewContainerWidget 只预置 1 个 tab-pane,只有一个标签页的标签栏看着像 bug,补第二个
1529
- let secondPane = baseRefUtil.deepClone(
1530
- this.getContainerByType("tab-pane")
1531
- );
1532
- secondPane.id = "tab-pane-" + baseRefUtil.generateId();
1533
- secondPane.options.name = "tab2";
1534
- secondPane.options.label = "tab 2";
1535
- tabCon.tabs.push(secondPane);
1536
-
1537
- newCon.panes.push(tabCon);
1538
- }
1539
- } else if (newCon.type === "table-column") {
1540
- newCon.options.label = "tableColumn";
1541
- } else if (newCon.type === "h5-card") {
1542
- let newCol = baseRefUtil.deepClone(
1543
- this.getContainerByType("h5-card-pane")
1544
- );
1545
- let tmpId = baseRefUtil.generateId();
1546
- newCol.id = "h5-card-pane-" + tmpId;
1547
- newCol.options.name = "h5CardPane" + tmpId;
1548
- newCol.options.label = "基本信息";
1549
- newCon.panes.push(newCol);
1550
- } else if (newCon.type === "detail-h5") {
1551
- // 一张 h5-card:基础信息 / 明细信息 / 附件信息
1552
- let newCard = this.copyNewContainerWidget(
1553
- this.getContainerByType("h5-card")
1554
- );
1555
- newCon.panes.push(newCard);
1556
-
1557
- // 基础信息:默认放 h5 表格(一行两列),对齐 PC 详情的「基础信息 + 表格」
1558
- let basicPane = newCard.panes[0];
1559
- if (basicPane) {
1560
- basicPane.options.label = "基础信息";
1561
- let h5Table = this.copyNewContainerWidget(
1562
- this.getContainerByType("h5-table")
1563
- );
1564
- basicPane.widgetList.push(h5Table);
1565
- }
1566
-
1567
- // 明细信息:H5 列表;只读阶段不预置新增/查看按钮(点行仍可进详情)
1568
- let newCardPane = this.copyNewContainerWidget(
1569
- this.getContainerByType("h5-card-pane")
1570
- );
1571
- newCardPane.options.label = "明细信息";
1572
- newCard.panes.push(newCardPane);
1573
-
1574
- let listH5 = this.copyNewContainerWidget(
1575
- this.getContainerByType("list-h5")
1576
- );
1577
- newCardPane.widgetList.push(listH5);
1578
-
1579
- // 附件信息
1580
- newCardPane = this.copyNewContainerWidget(
1581
- this.getContainerByType("h5-card-pane")
1582
- );
1583
- newCardPane.options.label = "附件信息";
1584
- newCard.panes.push(newCardPane);
1585
-
1586
- let vabUploadCon = this.copyNewFieldWidget(
1587
- this.getFieldWidgetByType("vabUpload")
1588
- );
1589
- newCardPane.widgetList.push(vabUploadCon);
1590
- } else if (newCon.type === "h5-table") {
1591
- /* 默认 4 行 × 2 列,对齐 H5「一行两个」的紧凑版式。
1592
- 不再预置 input:H5 面板已下架单行输入,空单元格由设计者拖入字段。 */
1593
- const h5TableCols = 2;
1594
- const h5TableRows = 4;
1595
- for (let i = 0; i < h5TableRows; i++) {
1596
- let newRow = {
1597
- cols: [],
1598
- };
1599
- newRow.id = "table-row-" + baseRefUtil.generateId();
1600
- newRow.merged = false;
1601
-
1602
- for (let j = 0; j < h5TableCols; j++) {
1603
- let newCell = baseRefUtil.deepClone(
1604
- this.getContainerByType("h5-table-cell")
1605
- );
1606
- newCell.id = "table-cell-" + baseRefUtil.generateId();
1607
- newCell.options.name = newCell.id;
1608
- newCell.merged = false;
1609
- newCell.options.colspan = 1;
1610
- newCell.options.rowspan = 1;
1611
- newRow.cols.push(newCell);
1612
- }
1613
-
1614
- newCon.rows.push(newRow);
1615
- }
1616
- } else if (newCon.type === "tree-pane") {
1617
- //初始化列表
1618
- let dataTableCon = this.copyNewContainerWidget(
1619
- this.getContainerByType("data-table")
1620
- );
1621
- dataTableCon.options.showPagination = true;
1622
- dataTableCon.options.showSearchArea = true;
1623
- dataTableCon.options.isQueryTable = true;
1624
- dataTableCon.options.tableHeight = "auto";
1625
- dataTableCon.options.accessReturnType = "2";
1626
-
1627
- newCon.widgetList.push(dataTableCon);
1628
-
1629
- let addButton = this.copyNewFieldWidget(
1630
- this.getFieldWidgetByType("add_button")
1631
- );
1632
- addButton.options.onClick =
1633
- "this.getWidgetRef('" +
1634
- dataTableCon.options.name +
1635
- "').openEditDialog();";
1636
- dataTableCon.buttons.push(addButton);
1637
-
1638
- let tableExportButton = this.copyNewFieldWidget(
1639
- this.getFieldWidgetByType("table-export-button")
1640
- );
1641
- tableExportButton.options.tableExportParam =
1642
- "return { title: '导出', targetRef: '" +
1643
- dataTableCon.options.name +
1644
- "'}";
1645
- dataTableCon.buttons.push(tableExportButton);
1646
-
1647
- // 两个查询条件的值由树节点点击注入,勾上「固定查询条件」后
1648
- // 刷新、查询条件设置的还原/确定都不会把它清掉
1649
- let searchInput = this.copyNewFieldWidget(
1650
- this.getFieldWidgetByType("input")
1651
- );
1652
- searchInput.options.disabled = true;
1653
- searchInput.options.fixedQuery = true;
1654
- searchInput.options.label = newCon.options.treeLabel;
1655
- dataTableCon.widgetList.push(searchInput);
1656
-
1657
- let searchIdInput = this.copyNewFieldWidget(
1658
- this.getFieldWidgetByType("input")
1659
- );
1660
- searchIdInput.options.disabled = true;
1661
- searchIdInput.options.hidden = true;
1662
- searchIdInput.options.fixedQuery = true;
1663
- searchIdInput.options.label = `隐藏${newCon.options.treeLabel}ID`;
1664
- dataTableCon.widgetList.push(searchIdInput);
1665
-
1666
- // 存量表单没有 fixedQuery 开关,仍靠 ignoreFields 兜底刷新按钮;
1667
- // 新建的表单两条通道并存(取并集),不冲突
1668
- dataTableCon.options.onResetTable = `this.resetEvent({\n ignoreFields:['${searchInput.options.name}', '${searchIdInput.options.name}']\n});`;
1669
-
1670
- //初始化树
1671
- let treeCon = this.copyNewContainerWidget(
1672
- this.getContainerByType("tree")
1673
- );
1674
- treeCon.options.onNodeClick = `this.getWidgetRef('${searchInput.options.name}').setValue(data.label);\nthis.getWidgetRef('${searchIdInput.options.name}').setValue(data.id);\nthis.getWidgetRef('${dataTableCon.options.name}').searchEvent();`;
1675
-
1676
- newCon.options.onTreeLabelClick = `this.getWidgetRef('${treeCon.options.name}').setCurrentKey();\nthis.getWidgetRef('${searchInput.options.name}').setValue(null);\nthis.getWidgetRef('${searchIdInput.options.name}').setValue(null);\nthis.getWidgetRef('${dataTableCon.options.name}').searchEvent();`;
1677
- newCon.leftWidgetList.push(treeCon);
1678
- }
1679
- //newCon.options.customClass = []
1680
-
1681
- delete newCon.displayName;
1682
- return newCon;
1683
- },
1684
-
1685
- addContainerByDbClick(container) {
1686
- let newCon = this.copyNewContainerWidget(container);
1687
- this.widgetList.push(newCon);
1688
- this.setSelected(newCon);
1689
- },
1690
-
1691
- addFieldByDbClick(widget) {
1692
- let newWidget = this.copyNewFieldWidget(widget);
1693
- if (!!this.selectedWidget && this.selectedWidget.type === "tab") {
1694
- //获取当前激活的tabPane
1695
- let activeTab = this.selectedWidget.tabs[0];
1696
- this.selectedWidget.tabs.forEach((tabPane) => {
1697
- if (!!tabPane.options.active) {
1698
- activeTab = tabPane;
1699
- }
1700
- });
1701
-
1702
- !!activeTab && activeTab.widgetList.push(newWidget);
1703
- } else if (!!this.selectedWidget && !!this.selectedWidget.widgetList) {
1704
- this.selectedWidget.widgetList.push(newWidget);
1705
- } else {
1706
- this.widgetList.push(newWidget);
1707
- }
1708
-
1709
- this.setSelected(newWidget);
1710
- this.emitEvent("canvas-add-field", newWidget.options.name),
1711
- this.emitHistoryChange();
1712
- },
1713
- /**
1714
- * 删除详情容器下的一个 pane。
1715
- * @param gridWidget 详情容器(detail / detail-plain)
1716
- * @param paneOrIdx pane 的 widget 引用,或它在 panes 中的下标。
1717
- * detail 的属性面板按 type 做了显隐,下标不再可靠,故走引用;
1718
- * detail-plain 的属性面板仍传下标,这里一并兼容。
1719
- */
1720
- deletePaneOfDetail(gridWidget, paneOrIdx) {
1721
- if (!gridWidget || !gridWidget.panes) return;
1722
- let isIdx = typeof paneOrIdx === "number";
1723
- let colIdx = isIdx ? paneOrIdx : gridWidget.panes.indexOf(paneOrIdx);
1724
- if (colIdx < 0) return;
1725
- gridWidget.panes.splice(colIdx, 1);
1726
- },
1727
- cloneDetailPane(widget, parentWidget) {
1728
- let newGridCol = baseRefUtil.deepClone(
1729
- this.getContainerByType("detail-pane")
1730
- );
1731
- let tmpId = baseRefUtil.generateId();
1732
- newGridCol.id = "detail-pane-" + tmpId;
1733
- newGridCol.options.name = "detailPane" + tmpId;
1734
- newGridCol.options.label = widget.options.label;
1735
- parentWidget.panes.push(newGridCol);
1736
- },
1737
- cloneH5CardPanePane(widget, parentWidget) {
1738
- let newGridCol = baseRefUtil.deepClone(
1739
- this.getContainerByType("h5-card-pane")
1740
- );
1741
- let tmpId = baseRefUtil.generateId();
1742
- newGridCol.id = "h5-card-pane-" + tmpId;
1743
- newGridCol.options.name = "h5CardPane" + tmpId;
1744
- newGridCol.options.label = widget.options.label;
1745
- parentWidget.panes.push(newGridCol);
1746
- },
1747
-
1748
- addNewPaneOfDetail(gridWidget) {
1749
- const cols = gridWidget.panes;
1750
- let newGridCol = baseRefUtil.deepClone(
1751
- this.getContainerByType("detail-pane")
1752
- );
1753
- let tmpId = baseRefUtil.generateId();
1754
- newGridCol.id = "detail-pane-" + tmpId;
1755
- newGridCol.options.name = "detailPane" + tmpId;
1756
- newGridCol.options.label = "detailPane" + tmpId;
1757
- // 默认添加一个栅格控件到新 pane 的 widgetList 中,含3列平均分布
1758
- let defaultGrid = baseRefUtil.deepClone(
1759
- this.getContainerByType("grid")
1760
- );
1761
- defaultGrid.id = "grid-" + baseRefUtil.generateId();
1762
- // 添加3列,每列 span=8(24栏栅格均分)
1763
- for (let i = 0; i < 3; i++) {
1764
- let col = baseRefUtil.deepClone(
1765
- this.getContainerByType("grid-col")
1766
- );
1767
- col.id = "grid-col-" + baseRefUtil.generateId();
1768
- col.options.span = 8;
1769
- defaultGrid.cols.push(col);
1770
- }
1771
- newGridCol.widgetList.push(defaultGrid);
1772
- gridWidget.panes.push(newGridCol);
1773
- },
1774
-
1775
- deleteColOfGrid(gridWidget, colIdx) {
1776
- if (!!gridWidget && !!gridWidget.cols) {
1777
- gridWidget.cols.splice(colIdx, 1);
1778
- }
1779
- },
1780
-
1781
- addNewColOfGrid(gridWidget) {
1782
- const cols = gridWidget.cols;
1783
- let newGridCol = baseRefUtil.deepClone(
1784
- this.getContainerByType("grid-col")
1785
- );
1786
- let tmpId = baseRefUtil.generateId();
1787
- newGridCol.id = "grid-col-" + tmpId;
1788
- newGridCol.options.name = "gridCol" + tmpId;
1789
- if (!!cols && cols.length > 0) {
1790
- let spanSum = 0;
1791
- cols.forEach((col) => {
1792
- spanSum += col.options.span;
1793
- });
1794
-
1795
- if (spanSum >= 24) {
1796
- //this.$message.info('列栅格之和超出24')
1797
- console.log("列栅格之和超出24");
1798
- gridWidget.cols.push(newGridCol);
1799
- } else {
1800
- newGridCol.options.span = 24 - spanSum > 12 ? 12 : 24 - spanSum;
1801
- gridWidget.cols.push(newGridCol);
1802
- }
1803
- } else {
1804
- gridWidget.cols = [newGridCol];
1805
- }
1806
- },
1807
-
1808
- addTabPaneOfTabs(tabsWidget) {
1809
- const tabPanes = tabsWidget.tabs;
1810
- let newTabPane = baseRefUtil.deepClone(
1811
- this.getContainerByType("tab-pane")
1812
- );
1813
- newTabPane.id = "tab-pane-" + baseRefUtil.generateId();
1814
- newTabPane.options.name = newTabPane.id;
1815
- newTabPane.options.label = "tab " + (tabPanes.length + 1);
1816
- tabPanes.push(newTabPane);
1817
- },
1818
-
1819
- deleteTabPaneOfTabs(tabsWidget, tpIdx) {
1820
- tabsWidget.tabs.splice(tpIdx, 1);
1821
- },
1822
-
1823
- addDropdownItem(tabsWidget) {
1824
- const tabPanes = tabsWidget.widgetList;
1825
- let newTabPane = baseRefUtil.deepClone(
1826
- this.getFieldWidgetByType("dropdown-item")
1827
- );
1828
- newTabPane.id = "dropdown-item-" + baseRefUtil.generateId();
1829
- newTabPane.options.name = newTabPane.id;
1830
- newTabPane.options.label = "dropdown-item " + (tabPanes.length + 1);
1831
- tabPanes.push(newTabPane);
1832
- },
1833
-
1834
- deleteDropdownItem(tabsWidget, tpIdx) {
1835
- tabsWidget.widgetList.splice(tpIdx, 1);
1836
- },
1837
-
1838
- emitEvent(evtName, evtData) {
1839
- //用于兄弟组件发射事件
1840
- this.vueInstance.$emit(evtName, evtData);
1841
- },
1842
-
1843
- handleEvent(evtName, callback) {
1844
- //用于兄弟组件接收事件
1845
- this.vueInstance.$on(evtName, (data) => callback(data));
1846
- },
1847
-
1848
- setCssClassList(cssClassList) {
1849
- this.cssClassList = cssClassList;
1850
- },
1851
-
1852
- getCssClassList() {
1853
- return this.cssClassList;
1854
- },
1855
-
1856
- registerFormWidget(formWidget) {
1857
- this.formWidget = formWidget;
1858
- },
1859
-
1860
- initHistoryData() {
1861
- this.loadFormContentFromStorage();
1862
- this.historyData.index++;
1863
- this.historyData.steps[this.historyData.index] = {
1864
- widgetList: baseRefUtil.deepClone(this.widgetList),
1865
- formConfig: baseRefUtil.deepClone(this.formConfig),
1866
- };
1867
- },
1868
-
1869
- emitHistoryChange() {
1870
- //console.log('------------', 'Form history changed!')
1871
-
1872
- if (this.historyData.index === this.historyData.maxStep - 1) {
1873
- this.historyData.steps.shift();
1874
- } else {
1875
- this.historyData.index++;
1876
- }
1877
-
1878
- this.historyData.steps[this.historyData.index] = {
1879
- widgetList: baseRefUtil.deepClone(this.widgetList),
1880
- formConfig: baseRefUtil.deepClone(this.formConfig),
1881
- };
1882
-
1883
- this.saveFormContentToStorage();
1884
-
1885
- if (this.historyData.index < this.historyData.steps.length - 1) {
1886
- this.historyData.steps = this.historyData.steps.slice(
1887
- 0,
1888
- this.historyData.index + 1
1889
- );
1890
- }
1891
-
1892
- //console.log('history', this.historyData.index)
1893
- },
1894
-
1895
- saveCurrentHistoryStep() {
1896
- this.historyData.steps[this.historyData.index] = baseRefUtil.deepClone({
1897
- widgetList: this.widgetList,
1898
- formConfig: this.formConfig,
1899
- });
1900
-
1901
- this.saveFormContentToStorage();
1902
- },
1903
-
1904
- undoHistoryStep() {
1905
- if (this.historyData.index !== 0) {
1906
- this.historyData.index--;
1907
- }
1908
- //console.log('undo', this.historyData.index)
1909
-
1910
- this.widgetList = baseRefUtil.deepClone(
1911
- this.historyData.steps[this.historyData.index].widgetList
1912
- );
1913
- this.formConfig = baseRefUtil.deepClone(
1914
- this.historyData.steps[this.historyData.index].formConfig
1915
- );
1916
- },
1917
-
1918
- redoHistoryStep() {
1919
- if (this.historyData.index !== this.historyData.steps.length - 1) {
1920
- this.historyData.index++;
1921
- }
1922
- //console.log('redo', this.historyData.index)
1923
-
1924
- this.widgetList = baseRefUtil.deepClone(
1925
- this.historyData.steps[this.historyData.index].widgetList
1926
- );
1927
- this.formConfig = baseRefUtil.deepClone(
1928
- this.historyData.steps[this.historyData.index].formConfig
1929
- );
1930
- },
1931
-
1932
- undoEnabled() {
1933
- return this.historyData.index > 0 && this.historyData.steps.length > 0;
1934
- },
1935
-
1936
- redoEnabled() {
1937
- return this.historyData.index < this.historyData.steps.length - 1;
1938
- },
1939
-
1940
- saveFormContentToStorage() {
1941
- window.localStorage.setItem(
1942
- "widget__list__backup",
1943
- JSON.stringify(this.widgetList)
1944
- );
1945
- window.localStorage.setItem(
1946
- "form__config__backup",
1947
- JSON.stringify(this.formConfig)
1948
- );
1949
- },
1950
-
1951
- loadFormContentFromStorage() {
1952
- let widgetListBackup = window.localStorage.getItem(
1953
- "widget__list__backup"
1954
- );
1955
- if (!!widgetListBackup) {
1956
- this.widgetList = JSON.parse(widgetListBackup);
1957
- }
1958
-
1959
- let formConfigBackup = window.localStorage.getItem(
1960
- "form__config__backup"
1961
- );
1962
- if (!!formConfigBackup) {
1963
- //this.formConfig = JSON.parse(formConfigBackup)
1964
- baseRefUtil.overwriteObj(
1965
- this.formConfig,
1966
- JSON.parse(formConfigBackup)
1967
- ); /* 用=赋值,会导致inject依赖注入的formConfig属性变成非响应式 */
1968
- }
1969
- },
1970
- getColumnWidget(row, isEdit) {
1971
- //获取
1972
- let formatS = isEdit ? row.editFormatS : row.formatS;
1973
- let type = columnFormatMap[formatS];
1974
- if (!type) return null;
1975
- if (isEdit) {
1976
- if (row.editWidget) {
1977
- return row.editWidget;
1978
- }
1979
- if (row.editColumnOption) {
1980
- let fieldWidget = this.copyNewFieldWidget(
1981
- this.getFieldWidgetByType(type)
1982
- );
1983
- fieldWidget.options = row.editColumnOption;
1984
- return fieldWidget;
1985
- }
1986
- } else {
1987
- if (row.widget) {
1988
- return row.widget;
1989
- }
1990
- if (row.columnOption) {
1991
- let fieldWidget = this.copyNewFieldWidget(
1992
- this.getFieldWidgetByType(type)
1993
- );
1994
- fieldWidget.options = row.columnOption;
1995
- return fieldWidget;
1996
- }
1997
- }
1998
- return this.createColumnWidget(row, isEdit);
1999
- },
2000
- getIsFileWidget(type) {
2001
- return type === "vabUpload" || type === "baseAttachment";
2002
- },
2003
- createColumnWidget(row, isEdit) {
2004
- let formatS = isEdit ? row.editFormatS : row.formatS;
2005
- let type = columnFormatMap[formatS];
2006
- if (!type) return null;
2007
-
2008
- let columnSelectedWidget = null;
2009
- if (type) {
2010
- columnSelectedWidget = this.copyNewFieldWidget(
2011
- this.getFieldWidgetByType(type)
2012
- );
2013
-
2014
- if (columnSelectedWidget.options.hasOwnProperty("required")) {
2015
- columnSelectedWidget.options.required = row.required || false;
2016
- }
2017
-
2018
- if ("editDelete" === formatS) {
2019
- columnSelectedWidget.options.prefixIcon = "el-icon-delete";
2020
- columnSelectedWidget.options.label = "删除";
2021
- columnSelectedWidget.options.labelHidden = true;
2022
- columnSelectedWidget.options.hiddenByWf = true;
2023
- columnSelectedWidget.options.onClick =
2024
- "let tableParam = this.tableParam;\nlet tableRef = this.getWidgetRef(this.parentWidget.options.name);\ntableRef.deleteRow(tableParam.row,tableParam.rowIndex);";
2025
- } else if ("editButton" === formatS) {
2026
- columnSelectedWidget.options.prefixIcon = "el-icon-edit";
2027
- columnSelectedWidget.options.label = "查看";
2028
- columnSelectedWidget.options.labelHidden = true;
2029
- columnSelectedWidget.options.onClick =
2030
- "let tableParam = this.tableParam;\nlet tableRef = this.getWidgetRef(this.parentWidget.options.name);\ntableRef.openEditDialog(tableParam.row)";
2031
- } else if ("addSiblingEditRow" === formatS) {
2032
- columnSelectedWidget.options.prefixIcon = "el-icon-plus";
2033
- columnSelectedWidget.options.label = "新增兄弟节点";
2034
- columnSelectedWidget.options.labelHidden = false;
2035
- columnSelectedWidget.options.onClick =
2036
- "let tableParam = this.tableParam;\nthis.getParentTarget().addSiblingTreeRow(null,tableParam);";
2037
- } else if ("addChildTreeRow" === formatS) {
2038
- columnSelectedWidget.options.prefixIcon = "el-icon-plus";
2039
- columnSelectedWidget.options.label = "新增子节点";
2040
- columnSelectedWidget.options.labelHidden = false;
2041
- columnSelectedWidget.options.onClick =
2042
- "let tableParam = this.tableParam;\nthis.getParentTarget().addChildTreeRow(null,tableParam);";
2043
- } else if ("moveUpRow" === formatS) {
2044
- columnSelectedWidget.options.label = "↑上移";
2045
- columnSelectedWidget.options.labelHidden = false;
2046
- columnSelectedWidget.options.onClick =
2047
- "let tableParam = this.tableParam;\nthis.getParentTarget().moveUpRow(tableParam);";
2048
- } else if ("moveDownRow" === formatS) {
2049
- columnSelectedWidget.options.label = "↓下移";
2050
- columnSelectedWidget.options.labelHidden = false;
2051
- columnSelectedWidget.options.onClick =
2052
- "let tableParam = this.tableParam;\nthis.getParentTarget().moveDownRow(tableParam);";
2053
- } else if ("removeTreeRow" === formatS) {
2054
- columnSelectedWidget.options.prefixIcon = "el-icon-delete";
2055
- columnSelectedWidget.options.label = "删除";
2056
- columnSelectedWidget.options.labelHidden = true;
2057
- columnSelectedWidget.options.onClick =
2058
- "let tableParam = this.tableParam;\nthis.getParentTarget().removeTreeRow(tableParam);";
2059
- }
2060
-
2061
- if (columnSelectedWidget.options.hasOwnProperty("keyName")) {
2062
- if (!this.getIsFileWidget(type)) {
2063
- columnSelectedWidget.options.keyName = row.prop;
2064
- }
2065
-
2066
- columnSelectedWidget.options.keyNameEnabled = true;
2067
- } else {
2068
- columnSelectedWidget.options.name = row.prop;
2069
- }
2070
-
2071
- if (type === "dropdown") {
2072
- columnSelectedWidget.options.dropdownType = "link";
2073
- } else if (type !== "button" && type !== "a-link") {
2074
- columnSelectedWidget.options.label = row.label;
2075
- columnSelectedWidget.options.labelHidden = true;
2076
- }
2077
- }
2078
- return columnSelectedWidget;
2079
- },
2080
- };
2081
- };
2082
- })();
2083
-
2084
- export const createDesigner = createDesigner0;
1
+ /**
2
+ * author: vformAdmin
3
+ * email: vdpadmin@163.com
4
+ * website: https://www.vform666.com
5
+ * date: 2021.08.18
6
+ * remark: 如果要分发VForm源码,需在本文件顶部保留此文件头信息!!
7
+ */
8
+
9
+ import {
10
+ deepClone,
11
+ generateId,
12
+ getDefaultFormConfig,
13
+ overwriteObj,
14
+ createUUID,
15
+ columnFormatMap,
16
+ } from "../../../components/xform/utils/util";
17
+ import { CLICK_BIND } from "./setting-panel/property-editor/field-button/clickBindActions";
18
+ import {
19
+ containers,
20
+ advancedFields,
21
+ basicFields,
22
+ customFields,
23
+ businessFields,
24
+ } from "../../../components/xform/form-designer/widget-panel/widgetsConfig.js";
25
+ import { VARIANT_FORM_VERSION } from "../../../components/xform/utils/config";
26
+ import { keyNamePrefixMap } from "../../../components/xform/form-designer/widget-panel/widgetsConfig";
27
+
28
+ let createDesigner0;
29
+ const baseRefUtil = {
30
+ deepClone,
31
+ generateId,
32
+ getDefaultFormConfig,
33
+ overwriteObj,
34
+ containers,
35
+ advancedFields,
36
+ basicFields,
37
+ customFields,
38
+ VARIANT_FORM_VERSION,
39
+ };
40
+
41
+ let chartContainers = [],
42
+ chartWidgets = [];
43
+
44
+ (function () {
45
+ createDesigner0 = function (vueInstance) {
46
+ let defaultFormConfig = baseRefUtil.deepClone(
47
+ baseRefUtil.getDefaultFormConfig()
48
+ );
49
+
50
+ return {
51
+ widgetList: [],
52
+ formConfig: {
53
+ cssCode: "",
54
+ gridConfig: {
55
+ accessReturnType: 1,
56
+ isLoadDataByAccess: false,
57
+ },
58
+ scriptList: [],
59
+ formType: 0,
60
+ dialogScope: null,
61
+ getConfig: {
62
+ accessType: "1",
63
+ accessUrl: null,
64
+ accessParam: null,
65
+ accessCallback: null,
66
+ scriptName: null,
67
+ scriptCode: null,
68
+ },
69
+ saveConfig: {
70
+ accessType: "1",
71
+ accessUrl: null,
72
+ accessParam: null,
73
+ accessCallback: null,
74
+ scriptName: null,
75
+ scriptCode: null,
76
+ },
77
+ editFormCode: null,
78
+ editFormName: null,
79
+ searchDialogNameField: null,
80
+ searchDialogUniqueField: null,
81
+ entity: null,
82
+ wfEnabled: false,
83
+ isLoadEntity: false,
84
+ formScriptCode: "getOne",
85
+ formScriptParam: null,
86
+ formScriptSuccess: null,
87
+ saveScriptCode: "saveUpdate",
88
+ wfConfig: null,
89
+ wfStartBindSave: false,
90
+ wfStartConfirmText: null,
91
+ wfAgreenBindSave: false,
92
+ wfAgreeConfigData: [],
93
+ wfConfigDataEnabled: false,
94
+ wfConfigData: [],
95
+ multiTabEnabled: false,
96
+ multiTabLabelField: null,
97
+ addTabEnabled: false, // 新增打开独立页签(不走「常规」页签)
98
+ submitBehavior: "refreshCurrent", // 提交后行为: refreshCurrent(默认,留在详情页) | closeToList
99
+ billNavEnabled: false, // 详情页签显示「上一单/下一单」翻单按钮
100
+ addFormCode: null,
101
+ addFormName: null,
102
+ wfTheme: null,
103
+ otherTabEnabled: false,
104
+ otherTabList: [],
105
+ hideNormalTab: false,
106
+ customListTabLabel: null,
107
+ globalConfig: null,
108
+ // 表单级动态字段规则
109
+ dynamicFieldEnabled: false,
110
+ dynamicFieldRunMode: "auto",
111
+ dynamicFieldAllowValue: false,
112
+ dynamicFieldSourceType: "local",
113
+ dynamicFieldRules: [],
114
+ dynamicFieldScriptCode: null,
115
+ dynamicFieldScriptParam: null,
116
+ dynamicFieldTriggerFields: [],
117
+ },
118
+ dataSources: [], //数据源
119
+
120
+ selectedId: null,
121
+ selectedWidget: null,
122
+ selectedWidgetName: null, //选中组件名称(唯一)
123
+ vueInstance: vueInstance,
124
+
125
+ formWidget: null, //表单设计容器
126
+
127
+ cssClassList: [], //自定义样式列表
128
+
129
+ historyData: {
130
+ index: -1, //index: 0,
131
+ maxStep: 20,
132
+ steps: [],
133
+ },
134
+
135
+ initDesigner(resetFormJson) {
136
+ this.widgetList = [];
137
+ this.formConfig = baseRefUtil.deepClone(defaultFormConfig);
138
+ this.dataSources = [];
139
+
140
+ //输出版本信息和语雀链接
141
+ /* console.info(`%cVariantForm %cVer${baseRefUtil.VARIANT_FORM_VERSION} %chttps://www.yuque.com/visualdev/vform`,
142
+ "color:#409EFF;font-size: 22px;font-weight:bolder",
143
+ "color:#999;font-size: 12px",
144
+ "color:#333"
145
+ ); */
146
+
147
+ /*if (!resetFormJson) {
148
+ this.initHistoryData();
149
+ }*/
150
+ },
151
+
152
+ clearDesigner(skipHistoryChange) {
153
+ let emptyWidgetListFlag = this.widgetList.length === 0;
154
+ /* 版式是"当前在设计哪一端",不是表单内容的一部分。defaultFormConfig 里没有
155
+ layoutType,overwriteObj 之后 getLayoutType() 会退回 "PC" —— 在 H5 模板里
156
+ 点一下「清空」,左侧面板就跳回 PC 组件列表了。先存后还。 */
157
+ let keepLayoutType = this.getLayoutType();
158
+ this.widgetList = [];
159
+ this.selectedId = null;
160
+ this.selectedWidgetName = null;
161
+ this.selectedWidget = {}; //this.selectedWidget = null
162
+ baseRefUtil.overwriteObj(this.formConfig, defaultFormConfig); //
163
+ this.formConfig.gridConfig = defaultFormConfig.gridConfig;
164
+ this.formConfig.layoutType = keepLayoutType;
165
+
166
+ if (!!skipHistoryChange) {
167
+ //什么也不做!!
168
+ } else if (!emptyWidgetListFlag) {
169
+ this.emitHistoryChange();
170
+ } else {
171
+ this.saveCurrentHistoryStep();
172
+ }
173
+ },
174
+
175
+ loadPresetCssCode(preCssCode) {
176
+ if (this.formConfig.cssCode === "" && !!preCssCode) {
177
+ this.formConfig.cssCode = preCssCode;
178
+ }
179
+ },
180
+
181
+ getLayoutType() {
182
+ return this.formConfig.layoutType || "PC";
183
+ },
184
+
185
+ changeLayoutType(newType) {
186
+ this.formConfig.layoutType = newType;
187
+ },
188
+
189
+ getImportTemplate() {
190
+ return {
191
+ widgetList: [],
192
+ // formConfig: baseRefUtil.deepClone(this.formConfig)
193
+ formConfig: baseRefUtil.deepClone(defaultFormConfig),
194
+ };
195
+ },
196
+
197
+ handleImportJson(formJson) {
198
+ let formConfig = formJson.formConfig;
199
+ if (formConfig.formCode === vueInstance?.reportTemplate?.formCode) {
200
+ return;
201
+ }
202
+ let widgetArr = formJson.widgetList;
203
+ let itemFieldMap = {
204
+ grid: "cols",
205
+ table: "rows",
206
+ "table-cell": "widgetList",
207
+ "h5-table": "rows",
208
+ "h5-table-cell": "widgetList",
209
+ tab: "tabs",
210
+ "tab-pane": "widgetList",
211
+ "grid-col": "widgetList",
212
+ "vf-box": "widgetList",
213
+ card: "widgetList",
214
+ detail: "panes",
215
+ "detail-plain": "panes",
216
+ "detail-pane": "widgetList",
217
+ "detail-h5": "panes",
218
+ "h5-card": "panes",
219
+ "h5-card-pane": "widgetList",
220
+ };
221
+ let loopDo = (widgetList) => {
222
+ if (!widgetList) return;
223
+ widgetList.forEach((widget) => {
224
+ if (widget.type === "data-table" || widget.type === "list-h5") {
225
+ let vailColumns = widget.options.tableColumns.filter(
226
+ (item) => item.prop && item.label
227
+ );
228
+ vailColumns.forEach((item) => {
229
+ if (item.formatS === "editAttachment") {
230
+ let prop = item.prop;
231
+ let columnOption = item.columnOption;
232
+ let editColumnOption = item.editColumnOption;
233
+
234
+ let suffix = this.createAttachmentSuffix();
235
+ let keyName = this.createAttachmentKeyName(suffix);
236
+ if (columnOption) {
237
+ columnOption.keyName = keyName;
238
+ columnOption.keyNameSuffix = suffix;
239
+ }
240
+ if (editColumnOption) {
241
+ editColumnOption.keyName = keyName;
242
+ editColumnOption.keyNameSuffix = suffix;
243
+ }
244
+ item.prop = keyName;
245
+ }
246
+ });
247
+ } else if (
248
+ widget.type === "vabUpload" ||
249
+ widget.type === "baseAttachment"
250
+ ) {
251
+ let suffix = this.createAttachmentSuffix();
252
+ let keyName = this.createAttachmentKeyName(suffix);
253
+ widget.options.keyName = keyName;
254
+ widget.options.keyNameSuffix = suffix;
255
+ } else {
256
+ if (widget.category === "container") {
257
+ let itemField = itemFieldMap[widget.type];
258
+ if (itemField) {
259
+ if ("table" === widget.type) {
260
+ widget[itemField].forEach((item) => {
261
+ loopDo(item.cols);
262
+ });
263
+ } else if ("h5-table" === widget.type) {
264
+ widget[itemField].forEach((item) => {
265
+ loopDo(item.cols);
266
+ });
267
+ } else {
268
+ loopDo(widget[itemField]);
269
+ }
270
+ }
271
+ }
272
+ }
273
+ });
274
+ };
275
+ loopDo(widgetArr);
276
+ },
277
+ loadFormJson(formJson) {
278
+ let modifiedFlag = false;
279
+
280
+ if (!!formJson && !!formJson.widgetList) {
281
+ this.widgetList = formJson.widgetList;
282
+ modifiedFlag = true;
283
+ }
284
+ if (!!formJson && !!formJson.formConfig) {
285
+ //this.formConfig = importObj.formConfig
286
+ baseRefUtil.overwriteObj(
287
+ this.formConfig,
288
+ formJson.formConfig
289
+ ); /* 用=赋值,会导致inject依赖注入的formConfig属性变成非响应式 */
290
+ modifiedFlag = true;
291
+ }
292
+
293
+ if (modifiedFlag) {
294
+ this.emitEvent("form-json-imported", []); // 通知其他组件
295
+ }
296
+ this.setSelected();
297
+ return modifiedFlag;
298
+ },
299
+ handleSelectedWidget(selected) {
300
+ //处理历史未定义的属性
301
+ if (selected.formItemFlag || selected.type === "data-table") {
302
+ if (selected.options.submitFlag === void 0) {
303
+ // selected.options.submitFlag = true;
304
+ this.vueInstance.$set(selected.options, "submitFlag", true);
305
+ }
306
+ }
307
+ this.handleKeyNameSuffix(selected);
308
+ },
309
+ handleKeyNameSuffix(selected) {
310
+ if (!selected) return;
311
+ let optionModel = selected.options;
312
+ let prefix = this.getKeyNamePrefix(selected.type, optionModel);
313
+ if (
314
+ optionModel.keyNameEnabled &&
315
+ !!prefix &&
316
+ !optionModel.keyNameSuffix
317
+ ) {
318
+ let keyName = optionModel.keyName;
319
+ if (keyName.startsWith(prefix)) {
320
+ this.vueInstance.$set(
321
+ optionModel,
322
+ "keyNameSuffix",
323
+ keyName.substring(prefix.length)
324
+ );
325
+ }
326
+ }
327
+ },
328
+ setSelected(selected) {
329
+ if (!selected) {
330
+ this.clearSelected();
331
+ return;
332
+ }
333
+
334
+ //处理历史未定义的属性
335
+ this.handleSelectedWidget(selected);
336
+
337
+ this.selectedWidget = selected;
338
+ if (!!selected.id) {
339
+ this.selectedId = selected.id;
340
+ this.selectedWidgetName = selected.options.name;
341
+ if (!selected.category) {
342
+ this.emitEvent("canvas-select-field", selected.options.name);
343
+ } else {
344
+ this.emitEvent("canvas-select-container", selected.options.name);
345
+ }
346
+ }
347
+ },
348
+
349
+ updateSelectedWidgetNameAndLabel(selectedWidget, newName, newLabel) {
350
+ this.selectedWidgetName = newName;
351
+ //selectedWidget.options.name = newName //此行多余
352
+ if (
353
+ !!newLabel &&
354
+ Object.keys(selectedWidget.options).indexOf("label") > -1
355
+ ) {
356
+ selectedWidget.options.label = newLabel;
357
+ }
358
+ },
359
+
360
+ clearSelected() {
361
+ this.selectedId = null;
362
+ this.selectedWidgetName = null;
363
+ this.selectedWidget = {}; //this.selectedWidget = null
364
+ },
365
+
366
+ checkWidgetMove(evt) {
367
+ /* Only field widget can be dragged into sub-form */
368
+ if (!!evt.draggedContext && !!evt.draggedContext.element) {
369
+ let wgCategory = evt.draggedContext.element.category;
370
+ let wgType = evt.draggedContext.element.type;
371
+ if (!!evt.to) {
372
+ if (
373
+ evt.to.className === "sub-form-table" &&
374
+ wgCategory === "container"
375
+ ) {
376
+ //this.$message.info(this.vueInstance.i18nt('designer.hint.onlyFieldWidgetAcceptable'))
377
+ return false;
378
+ }
379
+ }
380
+ }
381
+
382
+ return true;
383
+ },
384
+
385
+ checkFieldMove(evt) {
386
+ if (!!evt.draggedContext && !!evt.draggedContext.element) {
387
+ let wgCategory = evt.draggedContext.element.category;
388
+ let wgType = evt.draggedContext.element.type + "";
389
+ //console.log('wgType======', wgType)
390
+ if (!!evt.to) {
391
+ if (evt.to.className === "sub-form-table" && wgType === "slot") {
392
+ //this.$message.info(this.vueInstance.i18nt('designer.hint.onlyFieldWidgetAcceptable'))
393
+ return false;
394
+ }
395
+ }
396
+ }
397
+
398
+ return true;
399
+ },
400
+
401
+ /**
402
+ * 追加表格新行
403
+ * @param widget
404
+ */
405
+ appendTableRow(widget) {
406
+ let rowIdx = widget.rows.length; //确定插入行位置
407
+ let newRow = baseRefUtil.deepClone(widget.rows[widget.rows.length - 1]);
408
+ newRow.id = "table-row-" + baseRefUtil.generateId();
409
+ newRow.merged = false;
410
+ newRow.cols.forEach((col) => {
411
+ col.id = "table-cell-" + baseRefUtil.generateId();
412
+ col.options.name = col.id;
413
+ col.merged = false;
414
+ col.options.colspan = 1;
415
+ col.options.rowspan = 1;
416
+ col.widgetList.length = 0;
417
+ });
418
+ widget.rows.splice(rowIdx, 0, newRow);
419
+
420
+ this.emitHistoryChange();
421
+ },
422
+
423
+ /**
424
+ * 追加表格新列
425
+ * @param widget
426
+ */
427
+ appendTableCol(widget) {
428
+ let colIdx = widget.rows[0].cols.length; //确定插入列位置
429
+ widget.rows.forEach((row) => {
430
+ let newCol = baseRefUtil.deepClone(
431
+ this.getContainerByType("table-cell")
432
+ );
433
+ newCol.id = "table-cell-" + baseRefUtil.generateId();
434
+ newCol.options.name = newCol.id;
435
+ newCol.merged = false;
436
+ newCol.options.colspan = 1;
437
+ newCol.options.rowspan = 1;
438
+ newCol.widgetList.length = 0;
439
+ row.cols.splice(colIdx, 0, newCol);
440
+ });
441
+
442
+ this.emitHistoryChange();
443
+ },
444
+
445
+ insertTableRow(widget, insertPos, cloneRowIdx, curCol, aboveFlag) {
446
+ let newRowIdx = !!aboveFlag ? insertPos : insertPos + 1; //初步确定插入行位置
447
+ if (!aboveFlag) {
448
+ //继续向下寻找同列第一个未被合并的单元格
449
+ let tmpRowIdx = newRowIdx;
450
+ let rowFoundFlag = false;
451
+ while (tmpRowIdx < widget.rows.length) {
452
+ if (!widget.rows[tmpRowIdx].cols[curCol].merged) {
453
+ newRowIdx = tmpRowIdx;
454
+ rowFoundFlag = true;
455
+ break;
456
+ } else {
457
+ tmpRowIdx++;
458
+ }
459
+ }
460
+
461
+ if (!rowFoundFlag) {
462
+ newRowIdx = widget.rows.length;
463
+ }
464
+ }
465
+
466
+ let newRow = baseRefUtil.deepClone(widget.rows[cloneRowIdx]);
467
+ newRow.id = "table-row-" + baseRefUtil.generateId();
468
+ newRow.merged = false;
469
+ newRow.cols.forEach((col) => {
470
+ col.id = "table-cell-" + baseRefUtil.generateId();
471
+ col.options.name = col.id;
472
+ col.merged = false;
473
+ col.options.colspan = 1;
474
+ col.options.rowspan = 1;
475
+ col.widgetList.length = 0;
476
+ });
477
+ widget.rows.splice(newRowIdx, 0, newRow);
478
+
479
+ let colNo = 0;
480
+ while (
481
+ newRowIdx < widget.rows.length - 1 &&
482
+ colNo < widget.rows[0].cols.length
483
+ ) {
484
+ //越界判断
485
+ const cellOfNextRow = widget.rows[newRowIdx + 1].cols[colNo];
486
+ const rowMerged = cellOfNextRow.merged; //确定插入位置下一行的单元格是否为合并单元格
487
+ if (!!rowMerged) {
488
+ let rowArray = widget.rows;
489
+ let unMergedCell = {};
490
+ let startRowIndex = null;
491
+ for (let i = newRowIdx; i >= 0; i--) {
492
+ //查找该行已合并的主单元格
493
+ if (
494
+ !rowArray[i].cols[colNo].merged &&
495
+ rowArray[i].cols[colNo].options.rowspan > 1
496
+ ) {
497
+ startRowIndex = i;
498
+ unMergedCell = rowArray[i].cols[colNo];
499
+ break;
500
+ }
501
+ }
502
+
503
+ if (!!unMergedCell.options) {
504
+ //如果有符合条件的unMergedCell
505
+ let newRowspan = unMergedCell.options.rowspan + 1;
506
+ this.setPropsOfMergedRows(
507
+ widget.rows,
508
+ startRowIndex,
509
+ colNo,
510
+ unMergedCell.options.colspan,
511
+ newRowspan
512
+ );
513
+ colNo += unMergedCell.options.colspan;
514
+ } else {
515
+ colNo += 1;
516
+ }
517
+ } else {
518
+ //colNo += 1
519
+ colNo += cellOfNextRow.options.colspan || 1;
520
+ }
521
+ }
522
+
523
+ this.emitHistoryChange();
524
+ },
525
+
526
+ insertTableCol(widget, insertPos, curRow, leftFlag) {
527
+ let newColIdx = !!leftFlag ? insertPos : insertPos + 1; //初步确定插入列位置
528
+ if (!leftFlag) {
529
+ //继续向右寻找同行第一个未被合并的单元格
530
+ let tmpColIdx = newColIdx;
531
+ let colFoundFlag = false;
532
+ while (tmpColIdx < widget.rows[curRow].cols.length) {
533
+ if (!widget.rows[curRow].cols[tmpColIdx].merged) {
534
+ newColIdx = tmpColIdx;
535
+ colFoundFlag = true;
536
+ break;
537
+ } else {
538
+ tmpColIdx++;
539
+ }
540
+
541
+ if (!colFoundFlag) {
542
+ newColIdx = widget.rows[curRow].cols.length;
543
+ }
544
+ }
545
+ }
546
+
547
+ widget.rows.forEach((row) => {
548
+ let newCol = baseRefUtil.deepClone(
549
+ this.getContainerByType("table-cell")
550
+ );
551
+ newCol.id = "table-cell-" + baseRefUtil.generateId();
552
+ newCol.options.name = newCol.id;
553
+ newCol.merged = false;
554
+ newCol.options.colspan = 1;
555
+ newCol.options.rowspan = 1;
556
+ newCol.widgetList.length = 0;
557
+ row.cols.splice(newColIdx, 0, newCol);
558
+ });
559
+
560
+ let rowNo = 0;
561
+ while (
562
+ newColIdx < widget.rows[0].cols.length - 1 &&
563
+ rowNo < widget.rows.length
564
+ ) {
565
+ //越界判断
566
+ const cellOfNextCol = widget.rows[rowNo].cols[newColIdx + 1];
567
+ const colMerged = cellOfNextCol.merged; //确定插入位置右侧列的单元格是否为合并单元格
568
+ if (!!colMerged) {
569
+ let colArray = widget.rows[rowNo].cols;
570
+ let unMergedCell = {};
571
+ let startColIndex = null;
572
+ for (let i = newColIdx; i >= 0; i--) {
573
+ //查找该行已合并的主单元格
574
+ if (!colArray[i].merged && colArray[i].options.colspan > 1) {
575
+ startColIndex = i;
576
+ unMergedCell = colArray[i];
577
+ break;
578
+ }
579
+ }
580
+
581
+ if (!!unMergedCell.options) {
582
+ //如果有符合条件的unMergedCell
583
+ let newColspan = unMergedCell.options.colspan + 1;
584
+ this.setPropsOfMergedCols(
585
+ widget.rows,
586
+ rowNo,
587
+ startColIndex,
588
+ newColspan,
589
+ unMergedCell.options.rowspan
590
+ );
591
+ rowNo += unMergedCell.options.rowspan;
592
+ } else {
593
+ rowNo += 1;
594
+ }
595
+ } else {
596
+ //rowNo += 1
597
+ rowNo += cellOfNextCol.options.rowspan || 1;
598
+ }
599
+ }
600
+
601
+ this.emitHistoryChange();
602
+ },
603
+ insertH5TableCol(widget, insertPos, curRow, leftFlag) {
604
+ let newColIdx = !!leftFlag ? insertPos : insertPos + 1; //初步确定插入列位置
605
+ if (!leftFlag) {
606
+ //继续向右寻找同行第一个未被合并的单元格
607
+ let tmpColIdx = newColIdx;
608
+ let colFoundFlag = false;
609
+ while (tmpColIdx < widget.rows[curRow].cols.length) {
610
+ if (!widget.rows[curRow].cols[tmpColIdx].merged) {
611
+ newColIdx = tmpColIdx;
612
+ colFoundFlag = true;
613
+ break;
614
+ } else {
615
+ tmpColIdx++;
616
+ }
617
+
618
+ if (!colFoundFlag) {
619
+ newColIdx = widget.rows[curRow].cols.length;
620
+ }
621
+ }
622
+ }
623
+
624
+ widget.rows.forEach((row) => {
625
+ let newCol = baseRefUtil.deepClone(
626
+ this.getContainerByType("h5-table-cell")
627
+ );
628
+ newCol.id = "table-cell-" + baseRefUtil.generateId();
629
+ newCol.options.name = newCol.id;
630
+ newCol.merged = false;
631
+ newCol.options.colspan = 1;
632
+ newCol.options.rowspan = 1;
633
+ newCol.widgetList.length = 0;
634
+ row.cols.splice(newColIdx, 0, newCol);
635
+ });
636
+
637
+ let rowNo = 0;
638
+ while (
639
+ newColIdx < widget.rows[0].cols.length - 1 &&
640
+ rowNo < widget.rows.length
641
+ ) {
642
+ //越界判断
643
+ const cellOfNextCol = widget.rows[rowNo].cols[newColIdx + 1];
644
+ const colMerged = cellOfNextCol.merged; //确定插入位置右侧列的单元格是否为合并单元格
645
+ if (!!colMerged) {
646
+ let colArray = widget.rows[rowNo].cols;
647
+ let unMergedCell = {};
648
+ let startColIndex = null;
649
+ for (let i = newColIdx; i >= 0; i--) {
650
+ //查找该行已合并的主单元格
651
+ if (!colArray[i].merged && colArray[i].options.colspan > 1) {
652
+ startColIndex = i;
653
+ unMergedCell = colArray[i];
654
+ break;
655
+ }
656
+ }
657
+
658
+ if (!!unMergedCell.options) {
659
+ //如果有符合条件的unMergedCell
660
+ let newColspan = unMergedCell.options.colspan + 1;
661
+ this.setPropsOfMergedCols(
662
+ widget.rows,
663
+ rowNo,
664
+ startColIndex,
665
+ newColspan,
666
+ unMergedCell.options.rowspan
667
+ );
668
+ rowNo += unMergedCell.options.rowspan;
669
+ } else {
670
+ rowNo += 1;
671
+ }
672
+ } else {
673
+ //rowNo += 1
674
+ rowNo += cellOfNextCol.options.rowspan || 1;
675
+ }
676
+ }
677
+
678
+ this.emitHistoryChange();
679
+ },
680
+ setPropsOfMergedCols(
681
+ rowArray,
682
+ startRowIndex,
683
+ startColIndex,
684
+ newColspan,
685
+ rowspan
686
+ ) {
687
+ for (let i = startRowIndex; i < startRowIndex + rowspan; i++) {
688
+ for (let j = startColIndex; j < startColIndex + newColspan; j++) {
689
+ if (i === startRowIndex && j === startColIndex) {
690
+ rowArray[i].cols[j].options.colspan = newColspan; //合并后的主单元格
691
+ continue;
692
+ }
693
+
694
+ rowArray[i].cols[j].merged = true;
695
+ rowArray[i].cols[j].options.colspan = newColspan;
696
+ rowArray[i].cols[j].widgetList = [];
697
+ }
698
+ }
699
+ },
700
+
701
+ setPropsOfMergedRows(
702
+ rowArray,
703
+ startRowIndex,
704
+ startColIndex,
705
+ colspan,
706
+ newRowspan
707
+ ) {
708
+ for (let i = startRowIndex; i < startRowIndex + newRowspan; i++) {
709
+ for (let j = startColIndex; j < startColIndex + colspan; j++) {
710
+ if (i === startRowIndex && j === startColIndex) {
711
+ rowArray[i].cols[j].options.rowspan = newRowspan;
712
+ continue;
713
+ }
714
+
715
+ rowArray[i].cols[j].merged = true;
716
+ rowArray[i].cols[j].options.rowspan = newRowspan;
717
+ rowArray[i].cols[j].widgetList = [];
718
+ }
719
+ }
720
+ },
721
+
722
+ setPropsOfSplitCol(
723
+ rowArray,
724
+ startRowIndex,
725
+ startColIndex,
726
+ colspan,
727
+ rowspan
728
+ ) {
729
+ for (let i = startRowIndex; i < startRowIndex + rowspan; i++) {
730
+ for (let j = startColIndex; j < startColIndex + colspan; j++) {
731
+ rowArray[i].cols[j].merged = false;
732
+ rowArray[i].cols[j].options.rowspan = 1;
733
+ rowArray[i].cols[j].options.colspan = 1;
734
+ }
735
+ }
736
+ },
737
+
738
+ setPropsOfSplitRow(
739
+ rowArray,
740
+ startRowIndex,
741
+ startColIndex,
742
+ colspan,
743
+ rowspan
744
+ ) {
745
+ for (let i = startRowIndex; i < startRowIndex + rowspan; i++) {
746
+ for (let j = startColIndex; j < startColIndex + colspan; j++) {
747
+ rowArray[i].cols[j].merged = false;
748
+ rowArray[i].cols[j].options.rowspan = 1;
749
+ rowArray[i].cols[j].options.colspan = 1;
750
+ }
751
+ }
752
+ },
753
+
754
+ mergeTableCol(rowArray, colArray, curRow, curCol, leftFlag, cellWidget) {
755
+ let mergedColIdx = !!leftFlag
756
+ ? curCol
757
+ : curCol + colArray[curCol].options.colspan;
758
+
759
+ // let remainedColIdx = !!leftFlag ? curCol - colArray[curCol - 1].options.colspan : curCol
760
+ let remainedColIdx = !!leftFlag ? curCol - 1 : curCol;
761
+ if (!!leftFlag) {
762
+ //继续向左寻找同行未被合并的第一个单元格
763
+ let tmpColIdx = remainedColIdx;
764
+ while (tmpColIdx >= 0) {
765
+ if (!rowArray[curRow].cols[tmpColIdx].merged) {
766
+ remainedColIdx = tmpColIdx;
767
+ break;
768
+ } else {
769
+ tmpColIdx--;
770
+ }
771
+ }
772
+ }
773
+
774
+ if (
775
+ !!colArray[mergedColIdx].widgetList &&
776
+ colArray[mergedColIdx].widgetList.length > 0
777
+ ) {
778
+ //保留widgetList
779
+ if (
780
+ !colArray[remainedColIdx].widgetList ||
781
+ colArray[remainedColIdx].widgetList.length === 0
782
+ ) {
783
+ colArray[remainedColIdx].widgetList = baseRefUtil.deepClone(
784
+ colArray[mergedColIdx].widgetList
785
+ );
786
+ }
787
+ }
788
+
789
+ let newColspan =
790
+ colArray[mergedColIdx].options.colspan * 1 +
791
+ colArray[remainedColIdx].options.colspan * 1;
792
+ this.setPropsOfMergedCols(
793
+ rowArray,
794
+ curRow,
795
+ remainedColIdx,
796
+ newColspan,
797
+ cellWidget.options.rowspan
798
+ );
799
+
800
+ this.emitHistoryChange();
801
+ },
802
+
803
+ mergeTableWholeRow(rowArray, colArray, rowIndex, colIndex) {
804
+ //需要考虑操作的行存在已合并的单元格!!
805
+ //整行所有单元格行高不一致不可合并!!
806
+ let startRowspan = rowArray[rowIndex].cols[0].options.rowspan;
807
+ let unmatchedFlag = false;
808
+ for (let i = 1; i < rowArray[rowIndex].cols.length; i++) {
809
+ if (rowArray[rowIndex].cols[i].options.rowspan !== startRowspan) {
810
+ unmatchedFlag = true;
811
+ break;
812
+ }
813
+ }
814
+ if (unmatchedFlag) {
815
+ this.vueInstance.$message.info(
816
+ this.vueInstance.i18nt(
817
+ "designer.hint.rowspanNotConsistentForMergeEntireRow"
818
+ )
819
+ );
820
+ return;
821
+ }
822
+
823
+ let widgetListCols = colArray.filter((colItem) => {
824
+ return (
825
+ !colItem.merged &&
826
+ !!colItem.widgetList &&
827
+ colItem.widgetList.length > 0
828
+ );
829
+ });
830
+ if (!!widgetListCols && widgetListCols.length > 0) {
831
+ //保留widgetList
832
+ if (
833
+ widgetListCols[0].id !== colArray[0].id &&
834
+ (!colArray[0].widgetList || colArray[0].widgetList.length <= 0)
835
+ ) {
836
+ colArray[0].widgetList = baseRefUtil.deepClone(
837
+ widgetListCols[0].widgetList
838
+ );
839
+ }
840
+ }
841
+
842
+ this.setPropsOfMergedCols(
843
+ rowArray,
844
+ rowIndex,
845
+ 0,
846
+ colArray.length,
847
+ colArray[colIndex].options.rowspan
848
+ );
849
+
850
+ this.emitHistoryChange();
851
+ },
852
+
853
+ mergeTableRow(rowArray, curRow, curCol, aboveFlag, cellWidget) {
854
+ let mergedRowIdx = !!aboveFlag
855
+ ? curRow
856
+ : curRow + cellWidget.options.rowspan;
857
+
858
+ //let remainedRowIdx = !!aboveFlag ? curRow - cellWidget.options.rowspan : curRow
859
+ let remainedRowIdx = !!aboveFlag ? curRow - 1 : curRow;
860
+ if (!!aboveFlag) {
861
+ //继续向上寻找同列未被合并的第一个单元格
862
+ let tmpRowIdx = remainedRowIdx;
863
+ while (tmpRowIdx >= 0) {
864
+ if (!rowArray[tmpRowIdx].cols[curCol].merged) {
865
+ remainedRowIdx = tmpRowIdx;
866
+ break;
867
+ } else {
868
+ tmpRowIdx--;
869
+ }
870
+ }
871
+ }
872
+
873
+ if (
874
+ !!rowArray[mergedRowIdx].cols[curCol].widgetList &&
875
+ rowArray[mergedRowIdx].cols[curCol].widgetList.length > 0
876
+ ) {
877
+ //保留widgetList
878
+ if (
879
+ !rowArray[remainedRowIdx].cols[curCol].widgetList ||
880
+ rowArray[remainedRowIdx].cols[curCol].widgetList.length === 0
881
+ ) {
882
+ rowArray[remainedRowIdx].cols[curCol].widgetList =
883
+ baseRefUtil.deepClone(
884
+ rowArray[mergedRowIdx].cols[curCol].widgetList
885
+ );
886
+ }
887
+ }
888
+
889
+ let newRowspan =
890
+ rowArray[mergedRowIdx].cols[curCol].options.rowspan * 1 +
891
+ rowArray[remainedRowIdx].cols[curCol].options.rowspan * 1;
892
+ this.setPropsOfMergedRows(
893
+ rowArray,
894
+ remainedRowIdx,
895
+ curCol,
896
+ cellWidget.options.colspan,
897
+ newRowspan
898
+ );
899
+
900
+ this.emitHistoryChange();
901
+ },
902
+
903
+ mergeTableWholeCol(rowArray, colArray, rowIndex, colIndex) {
904
+ //需要考虑操作的列存在已合并的单元格!!
905
+ //整列所有单元格列宽不一致不可合并!!
906
+ let startColspan = rowArray[0].cols[colIndex].options.colspan;
907
+ let unmatchedFlag = false;
908
+ for (let i = 1; i < rowArray.length; i++) {
909
+ if (rowArray[i].cols[colIndex].options.colspan !== startColspan) {
910
+ unmatchedFlag = true;
911
+ break;
912
+ }
913
+ }
914
+ if (unmatchedFlag) {
915
+ this.vueInstance.$message.info(
916
+ this.vueInstance.i18nt(
917
+ "designer.hint.colspanNotConsistentForMergeEntireColumn"
918
+ )
919
+ );
920
+ return;
921
+ }
922
+
923
+ let widgetListCols = [];
924
+ rowArray.forEach((rowItem) => {
925
+ let tempCell = rowItem.cols[colIndex];
926
+ if (
927
+ !tempCell.merged &&
928
+ !!tempCell.widgetList &&
929
+ tempCell.widgetList.length > 0
930
+ ) {
931
+ widgetListCols.push(tempCell);
932
+ }
933
+ });
934
+
935
+ let firstCellOfCol = rowArray[0].cols[colIndex];
936
+ if (!!widgetListCols && widgetListCols.length > 0) {
937
+ //保留widgetList
938
+ if (
939
+ widgetListCols[0].id !== firstCellOfCol.id &&
940
+ (!firstCellOfCol.widgetList ||
941
+ firstCellOfCol.widgetList.length <= 0)
942
+ ) {
943
+ firstCellOfCol.widgetList = baseRefUtil.deepClone(
944
+ widgetListCols[0].widgetList
945
+ );
946
+ }
947
+ }
948
+
949
+ this.setPropsOfMergedRows(
950
+ rowArray,
951
+ 0,
952
+ colIndex,
953
+ firstCellOfCol.options.colspan,
954
+ rowArray.length
955
+ );
956
+
957
+ this.emitHistoryChange();
958
+ },
959
+
960
+ undoMergeTableCol(rowArray, rowIndex, colIndex, colspan, rowspan) {
961
+ this.setPropsOfSplitCol(rowArray, rowIndex, colIndex, colspan, rowspan);
962
+
963
+ this.emitHistoryChange();
964
+ },
965
+
966
+ undoMergeTableRow(rowArray, rowIndex, colIndex, colspan, rowspan) {
967
+ this.setPropsOfSplitRow(rowArray, rowIndex, colIndex, colspan, rowspan);
968
+
969
+ this.emitHistoryChange();
970
+ },
971
+
972
+ deleteTableWholeCol(rowArray, colIndex) {
973
+ //需考虑删除的是合并列!!
974
+ let onlyOneColFlag = true;
975
+ rowArray.forEach((ri) => {
976
+ if (ri.cols[0].options.colspan !== rowArray[0].cols.length) {
977
+ onlyOneColFlag = false;
978
+ }
979
+ });
980
+ //仅剩一列则不可删除!!
981
+ if (onlyOneColFlag) {
982
+ this.vueInstance.$message.info(
983
+ this.vueInstance.i18nt("designer.hint.lastColCannotBeDeleted")
984
+ );
985
+ return;
986
+ }
987
+
988
+ //整列所有单元格列宽不一致不可删除!!
989
+ let startColspan = rowArray[0].cols[colIndex].options.colspan;
990
+ let unmatchedFlag = false;
991
+ for (let i = 1; i < rowArray.length; i++) {
992
+ if (rowArray[i].cols[colIndex].options.colspan !== startColspan) {
993
+ unmatchedFlag = true;
994
+ break;
995
+ }
996
+ }
997
+ if (unmatchedFlag) {
998
+ this.vueInstance.$message.info(
999
+ this.vueInstance.i18nt(
1000
+ "designer.hint.colspanNotConsistentForDeleteEntireColumn"
1001
+ )
1002
+ );
1003
+ return;
1004
+ }
1005
+
1006
+ rowArray.forEach((rItem) => {
1007
+ rItem.cols.splice(colIndex, startColspan);
1008
+ });
1009
+
1010
+ this.emitHistoryChange();
1011
+ },
1012
+
1013
+ deleteTableWholeRow(rowArray, rowIndex) {
1014
+ //需考虑删除的是合并行!!
1015
+ let onlyOneRowFlag = true;
1016
+ rowArray[0].cols.forEach((ci) => {
1017
+ if (ci.options.rowspan !== rowArray.length) {
1018
+ onlyOneRowFlag = false;
1019
+ }
1020
+ });
1021
+ //仅剩一行则不可删除!!
1022
+ if (onlyOneRowFlag) {
1023
+ this.vueInstance.$message.info(
1024
+ this.vueInstance.i18nt("designer.hint.lastRowCannotBeDeleted")
1025
+ );
1026
+ return;
1027
+ }
1028
+
1029
+ //整行所有单元格行高不一致不可删除!!
1030
+ let startRowspan = rowArray[rowIndex].cols[0].options.rowspan;
1031
+ let unmatchedFlag = false;
1032
+ for (let i = 1; i < rowArray[rowIndex].cols.length; i++) {
1033
+ if (rowArray[rowIndex].cols[i].options.rowspan !== startRowspan) {
1034
+ unmatchedFlag = true;
1035
+ break;
1036
+ }
1037
+ }
1038
+ if (unmatchedFlag) {
1039
+ this.vueInstance.$message.info(
1040
+ this.vueInstance.i18nt(
1041
+ "designer.hint.rowspanNotConsistentForDeleteEntireRow"
1042
+ )
1043
+ );
1044
+ return;
1045
+ }
1046
+
1047
+ rowArray.splice(rowIndex, startRowspan);
1048
+
1049
+ this.emitHistoryChange();
1050
+ },
1051
+
1052
+ getContainerByType(typeName) {
1053
+ let allWidgets = [
1054
+ ...baseRefUtil.containers,
1055
+ ...baseRefUtil.basicFields,
1056
+ ...baseRefUtil.advancedFields,
1057
+ ...baseRefUtil.customFields,
1058
+ ...businessFields,
1059
+ ];
1060
+ let foundCon = null;
1061
+ allWidgets.forEach((con) => {
1062
+ if (!!con.category && !!con.type && con.type === typeName) {
1063
+ foundCon = con;
1064
+ }
1065
+ });
1066
+
1067
+ return foundCon;
1068
+ },
1069
+
1070
+ getFieldWidgetByType(typeName) {
1071
+ let allWidgets = [
1072
+ ...baseRefUtil.containers,
1073
+ ...baseRefUtil.basicFields,
1074
+ ...baseRefUtil.advancedFields,
1075
+ ...baseRefUtil.customFields,
1076
+ ...chartContainers,
1077
+ ...chartWidgets,
1078
+ ...businessFields,
1079
+ ];
1080
+ let foundWidget = null;
1081
+ allWidgets.forEach((widget) => {
1082
+ if (!!!widget.category && !!widget.type && widget.type === typeName) {
1083
+ foundWidget = widget;
1084
+ }
1085
+ });
1086
+
1087
+ return foundWidget;
1088
+ },
1089
+
1090
+ hasConfig(widget, configName) {
1091
+ let originalWidget = null;
1092
+ if (!!widget.category) {
1093
+ originalWidget = this.getContainerByType(widget.type);
1094
+ } else {
1095
+ originalWidget = this.getFieldWidgetByType(widget.type);
1096
+ }
1097
+
1098
+ if (!originalWidget || !originalWidget.options) {
1099
+ return false;
1100
+ }
1101
+
1102
+ return Object.keys(originalWidget.options).indexOf(configName) > -1;
1103
+ },
1104
+ /*upgradeWidgetConfig(oldWidget) {
1105
+ let newWidget = null;
1106
+ if (!!oldWidget.category) {
1107
+ newWidget = this.getContainerByType(oldWidget.type);
1108
+ } else {
1109
+ newWidget = this.getFieldWidgetByType(oldWidget.type);
1110
+ }
1111
+
1112
+ if (!newWidget || !newWidget.options) {
1113
+ return;
1114
+ }
1115
+
1116
+ Object.keys(newWidget.options).forEach(ck => {
1117
+ if (!oldWidget.options.hasOwnProperty(ck)) {
1118
+ oldWidget.options[ck] = baseRefUtil.deepClone(newWidget.options[ck]);
1119
+ }
1120
+ });
1121
+ },*/
1122
+ upgradeWidgetConfig(oldWidget) {
1123
+ let newWidget = null;
1124
+ if (!!oldWidget.category) {
1125
+ newWidget = this.getContainerByType(oldWidget.type);
1126
+ } else {
1127
+ newWidget = this.getFieldWidgetByType(oldWidget.type);
1128
+ }
1129
+
1130
+ if (!newWidget || !newWidget.options) {
1131
+ return;
1132
+ }
1133
+
1134
+ Object.keys(newWidget.options).forEach((ck) => {
1135
+ if (!oldWidget.options.hasOwnProperty(ck)) {
1136
+ let value = newWidget.options[ck];
1137
+ let nullValue = Array.isArray(value) ? [] : null;
1138
+ oldWidget.options[ck] = nullValue;
1139
+ }
1140
+ });
1141
+ },
1142
+
1143
+ upgradeFormConfig(oldFormConfig) {
1144
+ Object.keys(this.formConfig).forEach((fc) => {
1145
+ if (!oldFormConfig.hasOwnProperty(fc)) {
1146
+ let value = this.formConfig[fc];
1147
+ let nullValue = Array.isArray(value) ? [] : null;
1148
+ oldFormConfig[fc] = baseRefUtil.deepClone(nullValue);
1149
+ }
1150
+ });
1151
+ },
1152
+
1153
+ cloneGridCol(widget, parentWidget) {
1154
+ let newGridCol = baseRefUtil.deepClone(
1155
+ this.getContainerByType("grid-col")
1156
+ );
1157
+ newGridCol.options.span = widget.options.span;
1158
+ let tmpId = baseRefUtil.generateId();
1159
+ newGridCol.id = "grid-col-" + tmpId;
1160
+ newGridCol.options.name = "gridCol" + tmpId;
1161
+
1162
+ parentWidget.cols.push(newGridCol);
1163
+ },
1164
+
1165
+ cloneContainer(containWidget) {
1166
+ if (containWidget.type === "grid") {
1167
+ let newGrid = baseRefUtil.deepClone(this.getContainerByType("grid"));
1168
+ newGrid.id = newGrid.type + baseRefUtil.generateId();
1169
+ newGrid.options.name = newGrid.id;
1170
+ containWidget.cols.forEach((gridCol) => {
1171
+ let newGridCol = baseRefUtil.deepClone(
1172
+ this.getContainerByType("grid-col")
1173
+ );
1174
+ let tmpId = baseRefUtil.generateId();
1175
+ newGridCol.id = "grid-col-" + tmpId;
1176
+ newGridCol.options.name = "gridCol" + tmpId;
1177
+ newGridCol.options.span = gridCol.options.span;
1178
+ newGrid.cols.push(newGridCol);
1179
+ });
1180
+
1181
+ return newGrid;
1182
+ } else if (containWidget.type === "table") {
1183
+ let newTable = baseRefUtil.deepClone(
1184
+ this.getContainerByType("table")
1185
+ );
1186
+ newTable.id = newTable.type + baseRefUtil.generateId();
1187
+ newTable.options.name = newTable.id;
1188
+ containWidget.rows.forEach((tRow) => {
1189
+ let newRow = baseRefUtil.deepClone(tRow);
1190
+ newRow.id = "table-row-" + baseRefUtil.generateId();
1191
+ newRow.cols.forEach((col) => {
1192
+ col.id = "table-cell-" + baseRefUtil.generateId();
1193
+ col.options.name = col.id;
1194
+ col.widgetList = []; //清空组件列表
1195
+ });
1196
+ newTable.rows.push(newRow);
1197
+ });
1198
+
1199
+ return newTable;
1200
+ } else if (containWidget.type === "h5-table") {
1201
+ let newTable = baseRefUtil.deepClone(
1202
+ this.getContainerByType("h5-table")
1203
+ );
1204
+ newTable.id = newTable.type + baseRefUtil.generateId();
1205
+ newTable.options.name = newTable.id;
1206
+ containWidget.rows.forEach((tRow) => {
1207
+ let newRow = baseRefUtil.deepClone(tRow);
1208
+ newRow.id = "table-row-" + baseRefUtil.generateId();
1209
+ newRow.cols.forEach((col) => {
1210
+ col.id = "table-cell-" + baseRefUtil.generateId();
1211
+ col.options.name = col.id;
1212
+ col.widgetList = []; //清空组件列表
1213
+ });
1214
+ newTable.rows.push(newRow);
1215
+ });
1216
+
1217
+ return newTable;
1218
+ } else {
1219
+ //其他容器组件不支持clone操作
1220
+ return null;
1221
+ }
1222
+ },
1223
+
1224
+ moveUpWidget(parentList, indexOfParentList) {
1225
+ if (!!parentList) {
1226
+ if (indexOfParentList === 0) {
1227
+ this.vueInstance.$message(
1228
+ this.vueInstance.i18nt("designer.hint.moveUpFirstChildHint")
1229
+ );
1230
+ return;
1231
+ }
1232
+
1233
+ let tempWidget = parentList[indexOfParentList];
1234
+ parentList.splice(indexOfParentList, 1);
1235
+ parentList.splice(indexOfParentList - 1, 0, tempWidget);
1236
+ }
1237
+ },
1238
+
1239
+ moveDownWidget(parentList, indexOfParentList) {
1240
+ if (!!parentList) {
1241
+ if (indexOfParentList === parentList.length - 1) {
1242
+ this.vueInstance.$message(
1243
+ this.vueInstance.i18nt("designer.hint.moveDownLastChildHint")
1244
+ );
1245
+ return;
1246
+ }
1247
+
1248
+ let tempWidget = parentList[indexOfParentList];
1249
+ parentList.splice(indexOfParentList, 1);
1250
+ parentList.splice(indexOfParentList + 1, 0, tempWidget);
1251
+ }
1252
+ },
1253
+ copyNewFieldWidget(origin) {
1254
+ let newWidget = baseRefUtil.deepClone(origin);
1255
+ let sourceType = newWidget.type;
1256
+ newWidget.type = newWidget.targetType || newWidget.type;
1257
+ newWidget.sourceType = sourceType;
1258
+ let tempId = baseRefUtil.generateId();
1259
+ newWidget.id = newWidget.type.replace(/-/g, "") + tempId;
1260
+ if (newWidget.hasOwnProperty("tableField")) {
1261
+ newWidget.tableField = newWidget.id; //表字段
1262
+ }
1263
+
1264
+ // newWidget.options.name = newWidget.id;
1265
+ // newWidget.options.label = newWidget.options.label || newWidget.type.toLowerCase();
1266
+
1267
+ newWidget.nameReadonly
1268
+ ? newWidget.options.label &&
1269
+ newWidget.options.label.indexOf(".") > -1 &&
1270
+ (newWidget.options.label = newWidget.options.label.substring(
1271
+ newWidget.options.label.indexOf(".") + 1
1272
+ ))
1273
+ : ((newWidget.options.name = newWidget.id),
1274
+ (newWidget.options.label =
1275
+ newWidget.options.label || newWidget.type.toLowerCase()));
1276
+ delete newWidget.displayName;
1277
+ if (!newWidget.nameReadonly) {
1278
+ newWidget.options.keyNameEnabled = true;
1279
+ if (!newWidget.options.keyName)
1280
+ newWidget.options.keyName = newWidget.id;
1281
+ if (
1282
+ newWidget.type === "vabUpload" ||
1283
+ newWidget.type === "baseAttachment"
1284
+ ) {
1285
+ let keyNameSuffix = this.createKeyNameSuffix(newWidget.type);
1286
+ // this.createKeyNameSuffix()
1287
+ newWidget.options.keyName = this.createKeyName(
1288
+ newWidget.type,
1289
+ keyNameSuffix
1290
+ );
1291
+ newWidget.options.keyNameSuffix = keyNameSuffix;
1292
+ }
1293
+ }
1294
+ if (newWidget.type === "dropdown") {
1295
+ let dropdownItem1 = this.copyNewFieldWidget(
1296
+ this.getFieldWidgetByType("dropdown-item")
1297
+ );
1298
+ dropdownItem1.options.label = (window.$vueRoot && window.$vueRoot.$t1 ? window.$vueRoot.$t1('下拉按钮1') : '下拉按钮1');
1299
+ let dropdownItem2 = this.copyNewFieldWidget(
1300
+ this.getFieldWidgetByType("dropdown-item")
1301
+ );
1302
+ dropdownItem2.options.label = (window.$vueRoot && window.$vueRoot.$t1 ? window.$vueRoot.$t1('下拉按钮2') : '下拉按钮2');
1303
+ newWidget.widgetList.push(dropdownItem1);
1304
+ newWidget.widgetList.push(dropdownItem2);
1305
+ }
1306
+ this.emitEvent("canvas-add-field", newWidget.options.name);
1307
+ return newWidget;
1308
+ },
1309
+ createKeyName(type, suffix, options) {
1310
+ let keyNameSuffix = suffix ? suffix : this.createKeyNameSuffix(type);
1311
+ let keyNamePrefix = this.getKeyNamePrefix(type, options);
1312
+ let keyName = null;
1313
+ if (keyNamePrefix) {
1314
+ keyName = keyNamePrefix + keyNameSuffix;
1315
+ } else {
1316
+ keyName = keyNameSuffix;
1317
+ }
1318
+ return keyName;
1319
+ },
1320
+ createKeyNameSuffix(type) {
1321
+ let suffix = createUUID();
1322
+ /*if (type === "vabUpload" || type === "baseAttachment") {
1323
+ let formCode = vueInstance.reportTemplate.formCode;
1324
+ suffix = formCode + "_" + suffix;
1325
+ }*/
1326
+ return suffix;
1327
+ },
1328
+ /* 开了「值存为URL」的附件字段存的是主表普通列(值是 URL 字符串),不再走
1329
+ attachments_ 独立附件通道,keyName 不能带前缀——否则保存时会被
1330
+ data-table-mixin 的 attachments_ 提取逻辑当附件包发走,主表列存不到 */
1331
+ getKeyNamePrefix(type, options) {
1332
+ if (options && options.urlValueEnabled) {
1333
+ return null;
1334
+ }
1335
+ return keyNamePrefixMap[type] ?? null;
1336
+ },
1337
+ getFormCodePrefix(type) {
1338
+ let prefix = this.getKeyNamePrefix(type) || "";
1339
+ let attachmentPrefix =
1340
+ prefix + vueInstance.reportTemplate.formCode + "_";
1341
+ return attachmentPrefix;
1342
+ },
1343
+ createAttachmentSuffix() {
1344
+ let type = "vabUpload";
1345
+ return this.createKeyNameSuffix(type);
1346
+ },
1347
+ getAttachmentPrefix() {
1348
+ let type = "vabUpload";
1349
+ return this.getKeyNamePrefix(type);
1350
+ },
1351
+ getAttachmentFormCodePrefix() {
1352
+ let type = "vabUpload";
1353
+ let attachmentPrefix = this.getFormCodePrefix(type);
1354
+ return attachmentPrefix;
1355
+ },
1356
+ createAttachmentKeyName(suffix) {
1357
+ let type = "vabUpload";
1358
+ let keyName = this.createKeyName(type, suffix);
1359
+ return keyName;
1360
+ },
1361
+ copyNewContainerWidget(origin) {
1362
+ let newCon = baseRefUtil.deepClone(origin);
1363
+ let sourceType = newCon.type;
1364
+ newCon.type = newCon.targetType || newCon.type;
1365
+ newCon.sourceType = sourceType;
1366
+ newCon.id = newCon.type.replace(/-/g, "") + baseRefUtil.generateId();
1367
+ newCon.options.name = newCon.id;
1368
+ if ((newCon.options.keyNameEnabled = true)) {
1369
+ newCon.options.keyName = newCon.id;
1370
+ }
1371
+ if (newCon.hasOwnProperty("tableField")) {
1372
+ newCon.tableField = newCon.id; //表字段
1373
+ }
1374
+ if (newCon.type === "grid") {
1375
+ let newCol = baseRefUtil.deepClone(
1376
+ this.getContainerByType("grid-col")
1377
+ );
1378
+ let tmpId = baseRefUtil.generateId();
1379
+ newCol.id = "grid-col-" + tmpId;
1380
+ newCol.options.name = "gridCol" + tmpId;
1381
+ newCon.cols.push(newCol);
1382
+ //
1383
+ newCol = baseRefUtil.deepClone(newCol);
1384
+ tmpId = baseRefUtil.generateId();
1385
+ newCol.id = "grid-col-" + tmpId;
1386
+ newCol.options.name = "gridCol" + tmpId;
1387
+ newCon.cols.push(newCol);
1388
+ } else if (newCon.type === "table") {
1389
+ let newRow = {
1390
+ cols: [],
1391
+ };
1392
+ newRow.id = "table-row-" + baseRefUtil.generateId();
1393
+ newRow.merged = false;
1394
+ for (let i = 0; i < 4; i++) {
1395
+ let newCell = baseRefUtil.deepClone(
1396
+ this.getContainerByType("table-cell")
1397
+ );
1398
+ newCell.id = "table-cell-" + baseRefUtil.generateId();
1399
+ newCell.options.name = newCell.id;
1400
+ newCell.merged = false;
1401
+ newCell.options.colspan = 1;
1402
+ newCell.options.rowspan = 1;
1403
+ newRow.cols.push(newCell);
1404
+ }
1405
+ newCon.rows.push(newRow);
1406
+ } else if (newCon.type === "tab") {
1407
+ let newTabPane = baseRefUtil.deepClone(
1408
+ this.getContainerByType("tab-pane")
1409
+ );
1410
+ newTabPane.id = "tab-pane-" + baseRefUtil.generateId();
1411
+ newTabPane.options.name = "tab1";
1412
+ newTabPane.options.label = "tab 1";
1413
+ newCon.tabs.push(newTabPane);
1414
+ } else if (newCon.type === "data-table") {
1415
+ let add_button = this.copyNewFieldWidget(
1416
+ this.getFieldWidgetByType("add_button")
1417
+ );
1418
+ add_button.options.onClick =
1419
+ "this.getWidgetRef('" +
1420
+ newCon.options.name +
1421
+ "').openEditDialog();";
1422
+ newCon.buttons.push(add_button);
1423
+ } else if (newCon.type === "detail" || newCon.type === "detail-plain") {
1424
+ /* detail-plain 无标题栏,不预置标题栏按钮;其余 panes 结构与 detail 一致 */
1425
+ if (newCon.type === "detail") {
1426
+ let buttonCon1 = this.copyNewFieldWidget(
1427
+ this.getFieldWidgetByType("reset_button")
1428
+ );
1429
+ // buttonCon1.options.label = "重置";
1430
+
1431
+ let buttonCon2 = this.copyNewFieldWidget(
1432
+ this.getFieldWidgetByType("save_button")
1433
+ );
1434
+ buttonCon2.options.label = (window.$vueRoot && window.$vueRoot.$t1 ? window.$vueRoot.$t1('保存') : '保存');
1435
+
1436
+ newCon.widgetList.push(buttonCon1);
1437
+ newCon.widgetList.push(buttonCon2);
1438
+ }
1439
+
1440
+ let newCol = baseRefUtil.deepClone(
1441
+ this.getContainerByType("detail-pane")
1442
+ );
1443
+ let tmpId = baseRefUtil.generateId();
1444
+ newCol.id = "detail-pane-" + tmpId;
1445
+ newCol.options.name = "detailPane" + tmpId;
1446
+ newCol.options.label = (window.$vueRoot && window.$vueRoot.$t1 ? window.$vueRoot.$t1('隐藏信息') : '隐藏信息');
1447
+ newCol.options.hidden = true;
1448
+
1449
+ let tableCon = this.copyNewContainerWidget(
1450
+ this.getContainerByType("table")
1451
+ );
1452
+ newCol.widgetList.push(tableCon);
1453
+ newCon.panes.push(newCol);
1454
+
1455
+ newCol = baseRefUtil.deepClone(
1456
+ this.getContainerByType("detail-pane")
1457
+ );
1458
+ tmpId = baseRefUtil.generateId();
1459
+ newCol.id = "detail-pane-" + tmpId;
1460
+ newCol.options.name = "detailPane" + tmpId;
1461
+ newCol.options.label = (window.$vueRoot && window.$vueRoot.$t1 ? window.$vueRoot.$t1('基础信息') : '基础信息');
1462
+
1463
+ tableCon = this.copyNewContainerWidget(
1464
+ this.getContainerByType("table")
1465
+ );
1466
+ newCol.widgetList.push(tableCon);
1467
+ newCon.panes.push(newCol);
1468
+ //
1469
+ newCol = baseRefUtil.deepClone(
1470
+ this.getContainerByType("detail-pane")
1471
+ );
1472
+ tmpId = baseRefUtil.generateId();
1473
+ newCol.id = "detail-pane-" + tmpId;
1474
+ newCol.options.name = "detailPane" + tmpId;
1475
+ newCol.options.label = (window.$vueRoot && window.$vueRoot.$t1 ? window.$vueRoot.$t1('明细信息') : '明细信息');
1476
+ newCol.options.tableRef = tableCon.id;
1477
+ let dataTableCon = this.copyNewContainerWidget(
1478
+ this.getContainerByType("data-table")
1479
+ );
1480
+ newCol.widgetList.push(dataTableCon);
1481
+ newCol.options.tableRef = dataTableCon.id;
1482
+
1483
+ let buttonCon3 = this.copyNewFieldWidget(
1484
+ this.getFieldWidgetByType("button")
1485
+ );
1486
+ buttonCon3.options.label = (window.$vueRoot && window.$vueRoot.$t1 ? window.$vueRoot.$t1('新增') : '新增');
1487
+ buttonCon3.options.icon = "el-icon-search";
1488
+ // buttonCon3.options.onClick = "this.getWidgetRef('" + dataTableCon.options.name + "').addTableData();"
1489
+ buttonCon3.options.clickBindEvent = CLICK_BIND.ADD_TABLE_DATA;
1490
+ Object.assign(buttonCon3.options.addTableDataConfig, {
1491
+ tableRef: dataTableCon.options.name,
1492
+ });
1493
+
1494
+ newCol.buttonWidgetList.push(buttonCon3);
1495
+ newCon.panes.push(newCol);
1496
+
1497
+ newCol = baseRefUtil.deepClone(
1498
+ this.getContainerByType("detail-pane")
1499
+ );
1500
+ tmpId = baseRefUtil.generateId();
1501
+ newCol.id = "detail-pane-" + tmpId;
1502
+ newCol.options.name = "detailPane" + tmpId;
1503
+ newCol.options.label = (window.$vueRoot && window.$vueRoot.$t1 ? window.$vueRoot.$t1('附件信息') : '附件信息');
1504
+ let vabUploadCon = this.copyNewFieldWidget(
1505
+ this.getFieldWidgetByType("vabUpload")
1506
+ ); //vabUpload
1507
+ newCol.widgetList.push(vabUploadCon);
1508
+ newCon.panes.push(newCol);
1509
+
1510
+ /* 「详情模块(标签)」面板条目:type=detail-tabs + targetType=detail,落地后就是 detail,
1511
+ 不是新的容器类型。与「详情模块」的区别是内容模块不直接挂在正文区,而是收进标签里,
1512
+ 详见 docs/详情模块标签承载方案.md */
1513
+ if (newCon.sourceType === "detail-tabs") {
1514
+ // 上面已按 detail 的默认骨架建好一批内容模块,整体挪进第一个标签——
1515
+ // 标签形态下正文区只放标签容器,不留散在标签外面的模块。
1516
+ let presetPanes = newCon.panes.splice(0);
1517
+
1518
+ // 标签内的模块由 detail-plain 承载:它自带一套独立锚点导航,
1519
+ // 外层 baseTabs 探测不到标签内的模块(tab-item 不满足 getTabs 的两个条件)。
1520
+ let plainCon = this.copyNewContainerWidget(
1521
+ this.getContainerByType("detail-plain")
1522
+ );
1523
+ plainCon.panes = presetPanes; // 丢掉 detail-plain 自带的默认模块,用上面建好的这批
1524
+ plainCon.options.hideNav = false; // schema 默认关导航,标签内要开
1525
+
1526
+ let tabCon = this.copyNewContainerWidget(
1527
+ this.getContainerByType("tab")
1528
+ );
1529
+ tabCon.tabs[0].widgetList.push(plainCon);
1530
+
1531
+ // copyNewContainerWidget 只预置 1 个 tab-pane,只有一个标签页的标签栏看着像 bug,补第二个
1532
+ let secondPane = baseRefUtil.deepClone(
1533
+ this.getContainerByType("tab-pane")
1534
+ );
1535
+ secondPane.id = "tab-pane-" + baseRefUtil.generateId();
1536
+ secondPane.options.name = "tab2";
1537
+ secondPane.options.label = "tab 2";
1538
+ tabCon.tabs.push(secondPane);
1539
+
1540
+ newCon.panes.push(tabCon);
1541
+ }
1542
+ } else if (newCon.type === "table-column") {
1543
+ newCon.options.label = "tableColumn";
1544
+ } else if (newCon.type === "h5-card") {
1545
+ let newCol = baseRefUtil.deepClone(
1546
+ this.getContainerByType("h5-card-pane")
1547
+ );
1548
+ let tmpId = baseRefUtil.generateId();
1549
+ newCol.id = "h5-card-pane-" + tmpId;
1550
+ newCol.options.name = "h5CardPane" + tmpId;
1551
+ newCol.options.label = (window.$vueRoot && window.$vueRoot.$t1 ? window.$vueRoot.$t1('基本信息') : '基本信息');
1552
+ newCon.panes.push(newCol);
1553
+ } else if (newCon.type === "detail-h5") {
1554
+ // 一张 h5-card:基础信息 / 明细信息 / 附件信息
1555
+ let newCard = this.copyNewContainerWidget(
1556
+ this.getContainerByType("h5-card")
1557
+ );
1558
+ newCon.panes.push(newCard);
1559
+
1560
+ // 基础信息:默认放 h5 表格(一行两列),对齐 PC 详情的「基础信息 + 表格」
1561
+ let basicPane = newCard.panes[0];
1562
+ if (basicPane) {
1563
+ basicPane.options.label = (window.$vueRoot && window.$vueRoot.$t1 ? window.$vueRoot.$t1('基础信息') : '基础信息');
1564
+ let h5Table = this.copyNewContainerWidget(
1565
+ this.getContainerByType("h5-table")
1566
+ );
1567
+ basicPane.widgetList.push(h5Table);
1568
+ }
1569
+
1570
+ // 明细信息:H5 列表;只读阶段不预置新增/查看按钮(点行仍可进详情)
1571
+ let newCardPane = this.copyNewContainerWidget(
1572
+ this.getContainerByType("h5-card-pane")
1573
+ );
1574
+ newCardPane.options.label = (window.$vueRoot && window.$vueRoot.$t1 ? window.$vueRoot.$t1('明细信息') : '明细信息');
1575
+ newCard.panes.push(newCardPane);
1576
+
1577
+ let listH5 = this.copyNewContainerWidget(
1578
+ this.getContainerByType("list-h5")
1579
+ );
1580
+ newCardPane.widgetList.push(listH5);
1581
+
1582
+ // 附件信息
1583
+ newCardPane = this.copyNewContainerWidget(
1584
+ this.getContainerByType("h5-card-pane")
1585
+ );
1586
+ newCardPane.options.label = (window.$vueRoot && window.$vueRoot.$t1 ? window.$vueRoot.$t1('附件信息') : '附件信息');
1587
+ newCard.panes.push(newCardPane);
1588
+
1589
+ let vabUploadCon = this.copyNewFieldWidget(
1590
+ this.getFieldWidgetByType("vabUpload")
1591
+ );
1592
+ newCardPane.widgetList.push(vabUploadCon);
1593
+ } else if (newCon.type === "h5-table") {
1594
+ /* 默认 4 行 × 2 列,对齐 H5「一行两个」的紧凑版式。
1595
+ 不再预置 input:H5 面板已下架单行输入,空单元格由设计者拖入字段。 */
1596
+ const h5TableCols = 2;
1597
+ const h5TableRows = 4;
1598
+ for (let i = 0; i < h5TableRows; i++) {
1599
+ let newRow = {
1600
+ cols: [],
1601
+ };
1602
+ newRow.id = "table-row-" + baseRefUtil.generateId();
1603
+ newRow.merged = false;
1604
+
1605
+ for (let j = 0; j < h5TableCols; j++) {
1606
+ let newCell = baseRefUtil.deepClone(
1607
+ this.getContainerByType("h5-table-cell")
1608
+ );
1609
+ newCell.id = "table-cell-" + baseRefUtil.generateId();
1610
+ newCell.options.name = newCell.id;
1611
+ newCell.merged = false;
1612
+ newCell.options.colspan = 1;
1613
+ newCell.options.rowspan = 1;
1614
+ newRow.cols.push(newCell);
1615
+ }
1616
+
1617
+ newCon.rows.push(newRow);
1618
+ }
1619
+ } else if (newCon.type === "tree-pane") {
1620
+ //初始化列表
1621
+ let dataTableCon = this.copyNewContainerWidget(
1622
+ this.getContainerByType("data-table")
1623
+ );
1624
+ dataTableCon.options.showPagination = true;
1625
+ dataTableCon.options.showSearchArea = true;
1626
+ dataTableCon.options.isQueryTable = true;
1627
+ dataTableCon.options.tableHeight = "auto";
1628
+ dataTableCon.options.accessReturnType = "2";
1629
+
1630
+ newCon.widgetList.push(dataTableCon);
1631
+
1632
+ let addButton = this.copyNewFieldWidget(
1633
+ this.getFieldWidgetByType("add_button")
1634
+ );
1635
+ addButton.options.onClick =
1636
+ "this.getWidgetRef('" +
1637
+ dataTableCon.options.name +
1638
+ "').openEditDialog();";
1639
+ dataTableCon.buttons.push(addButton);
1640
+
1641
+ let tableExportButton = this.copyNewFieldWidget(
1642
+ this.getFieldWidgetByType("table-export-button")
1643
+ );
1644
+ tableExportButton.options.tableExportParam =
1645
+ "return { title: '导出', targetRef: '" +
1646
+ dataTableCon.options.name +
1647
+ "'}";
1648
+ dataTableCon.buttons.push(tableExportButton);
1649
+
1650
+ // 两个查询条件的值由树节点点击注入,勾上「固定查询条件」后
1651
+ // 刷新、查询条件设置的还原/确定都不会把它清掉
1652
+ let searchInput = this.copyNewFieldWidget(
1653
+ this.getFieldWidgetByType("input")
1654
+ );
1655
+ searchInput.options.disabled = true;
1656
+ searchInput.options.fixedQuery = true;
1657
+ searchInput.options.label = newCon.options.treeLabel;
1658
+ dataTableCon.widgetList.push(searchInput);
1659
+
1660
+ let searchIdInput = this.copyNewFieldWidget(
1661
+ this.getFieldWidgetByType("input")
1662
+ );
1663
+ searchIdInput.options.disabled = true;
1664
+ searchIdInput.options.hidden = true;
1665
+ searchIdInput.options.fixedQuery = true;
1666
+ searchIdInput.options.label = (window.$vueRoot && window.$vueRoot.$t1 ? window.$vueRoot.$t1('隐藏{p0}ID', { p0: newCon.options.treeLabel }) : '隐藏{p0}ID');
1667
+ dataTableCon.widgetList.push(searchIdInput);
1668
+
1669
+ // 存量表单没有 fixedQuery 开关,仍靠 ignoreFields 兜底刷新按钮;
1670
+ // 新建的表单两条通道并存(取并集),不冲突
1671
+ dataTableCon.options.onResetTable = `this.resetEvent({\n ignoreFields:['${searchInput.options.name}', '${searchIdInput.options.name}']\n});`;
1672
+
1673
+ //初始化树
1674
+ let treeCon = this.copyNewContainerWidget(
1675
+ this.getContainerByType("tree")
1676
+ );
1677
+ treeCon.options.onNodeClick = `this.getWidgetRef('${searchInput.options.name}').setValue(data.label);\nthis.getWidgetRef('${searchIdInput.options.name}').setValue(data.id);\nthis.getWidgetRef('${dataTableCon.options.name}').searchEvent();`;
1678
+
1679
+ newCon.options.onTreeLabelClick = `this.getWidgetRef('${treeCon.options.name}').setCurrentKey();\nthis.getWidgetRef('${searchInput.options.name}').setValue(null);\nthis.getWidgetRef('${searchIdInput.options.name}').setValue(null);\nthis.getWidgetRef('${dataTableCon.options.name}').searchEvent();`;
1680
+ newCon.leftWidgetList.push(treeCon);
1681
+ }
1682
+ //newCon.options.customClass = []
1683
+
1684
+ delete newCon.displayName;
1685
+ return newCon;
1686
+ },
1687
+
1688
+ addContainerByDbClick(container) {
1689
+ let newCon = this.copyNewContainerWidget(container);
1690
+ this.widgetList.push(newCon);
1691
+ this.setSelected(newCon);
1692
+ },
1693
+
1694
+ addFieldByDbClick(widget) {
1695
+ let newWidget = this.copyNewFieldWidget(widget);
1696
+ if (!!this.selectedWidget && this.selectedWidget.type === "tab") {
1697
+ //获取当前激活的tabPane
1698
+ let activeTab = this.selectedWidget.tabs[0];
1699
+ this.selectedWidget.tabs.forEach((tabPane) => {
1700
+ if (!!tabPane.options.active) {
1701
+ activeTab = tabPane;
1702
+ }
1703
+ });
1704
+
1705
+ !!activeTab && activeTab.widgetList.push(newWidget);
1706
+ } else if (!!this.selectedWidget && !!this.selectedWidget.widgetList) {
1707
+ this.selectedWidget.widgetList.push(newWidget);
1708
+ } else {
1709
+ this.widgetList.push(newWidget);
1710
+ }
1711
+
1712
+ this.setSelected(newWidget);
1713
+ this.emitEvent("canvas-add-field", newWidget.options.name),
1714
+ this.emitHistoryChange();
1715
+ },
1716
+ /**
1717
+ * 删除详情容器下的一个 pane。
1718
+ * @param gridWidget 详情容器(detail / detail-plain)
1719
+ * @param paneOrIdx pane 的 widget 引用,或它在 panes 中的下标。
1720
+ * detail 的属性面板按 type 做了显隐,下标不再可靠,故走引用;
1721
+ * detail-plain 的属性面板仍传下标,这里一并兼容。
1722
+ */
1723
+ deletePaneOfDetail(gridWidget, paneOrIdx) {
1724
+ if (!gridWidget || !gridWidget.panes) return;
1725
+ let isIdx = typeof paneOrIdx === "number";
1726
+ let colIdx = isIdx ? paneOrIdx : gridWidget.panes.indexOf(paneOrIdx);
1727
+ if (colIdx < 0) return;
1728
+ gridWidget.panes.splice(colIdx, 1);
1729
+ },
1730
+ cloneDetailPane(widget, parentWidget) {
1731
+ let newGridCol = baseRefUtil.deepClone(
1732
+ this.getContainerByType("detail-pane")
1733
+ );
1734
+ let tmpId = baseRefUtil.generateId();
1735
+ newGridCol.id = "detail-pane-" + tmpId;
1736
+ newGridCol.options.name = "detailPane" + tmpId;
1737
+ newGridCol.options.label = widget.options.label;
1738
+ parentWidget.panes.push(newGridCol);
1739
+ },
1740
+ cloneH5CardPanePane(widget, parentWidget) {
1741
+ let newGridCol = baseRefUtil.deepClone(
1742
+ this.getContainerByType("h5-card-pane")
1743
+ );
1744
+ let tmpId = baseRefUtil.generateId();
1745
+ newGridCol.id = "h5-card-pane-" + tmpId;
1746
+ newGridCol.options.name = "h5CardPane" + tmpId;
1747
+ newGridCol.options.label = widget.options.label;
1748
+ parentWidget.panes.push(newGridCol);
1749
+ },
1750
+
1751
+ addNewPaneOfDetail(gridWidget) {
1752
+ const cols = gridWidget.panes;
1753
+ let newGridCol = baseRefUtil.deepClone(
1754
+ this.getContainerByType("detail-pane")
1755
+ );
1756
+ let tmpId = baseRefUtil.generateId();
1757
+ newGridCol.id = "detail-pane-" + tmpId;
1758
+ newGridCol.options.name = "detailPane" + tmpId;
1759
+ newGridCol.options.label = "detailPane" + tmpId;
1760
+ // 默认添加一个栅格控件到新 pane 的 widgetList 中,列数取模板模块配置的行列数
1761
+ let colCount = gridWidget.options.rowColCount || 3;
1762
+ let defaultGrid = this.createDefaultGridOfDetailTemp(colCount);
1763
+ newGridCol.widgetList.push(defaultGrid);
1764
+ gridWidget.panes.push(newGridCol);
1765
+ },
1766
+
1767
+ // 模板模块(detail-temp)自动生成的默认栅格:colCount 列平均分布(24 栏均分)。
1768
+ // autoLayout 标记用于行列数变更时识别并同步这些默认栅格,用户手动拖入的栅格不受影响。
1769
+ createDefaultGridOfDetailTemp(colCount) {
1770
+ let defaultGrid = baseRefUtil.deepClone(
1771
+ this.getContainerByType("grid")
1772
+ );
1773
+ defaultGrid.id = "grid-" + baseRefUtil.generateId();
1774
+ defaultGrid.options.autoLayout = true;
1775
+ let span = Math.floor(24 / colCount);
1776
+ for (let i = 0; i < colCount; i++) {
1777
+ let col = baseRefUtil.deepClone(
1778
+ this.getContainerByType("grid-col")
1779
+ );
1780
+ col.id = "grid-col-" + baseRefUtil.generateId();
1781
+ col.options.span = span;
1782
+ defaultGrid.cols.push(col);
1783
+ }
1784
+ return defaultGrid;
1785
+ },
1786
+
1787
+ // 行列数下拉变化:写回配置,并同步所有模块里自动生成的默认栅格
1788
+ changeDetailTempRowCol(gridWidget, colCount) {
1789
+ if (!gridWidget || !gridWidget.options) return;
1790
+ gridWidget.options.rowColCount = colCount;
1791
+ let span = Math.floor(24 / colCount);
1792
+ (gridWidget.panes || []).forEach((paneWidget) => {
1793
+ (paneWidget.widgetList || []).forEach((subWidget) => {
1794
+ if (
1795
+ subWidget.type === "grid" &&
1796
+ subWidget.options &&
1797
+ subWidget.options.autoLayout
1798
+ ) {
1799
+ let gridCols = subWidget.cols || (subWidget.cols = []);
1800
+ // 已有列统一为新的均分 span(列内已拖入的内容保留)
1801
+ gridCols.forEach((col) => {
1802
+ col.options.span = span;
1803
+ });
1804
+ // 列数不足:补齐新列
1805
+ while (gridCols.length < colCount) {
1806
+ let col = baseRefUtil.deepClone(
1807
+ this.getContainerByType("grid-col")
1808
+ );
1809
+ col.id = "grid-col-" + baseRefUtil.generateId();
1810
+ col.options.span = span;
1811
+ gridCols.push(col);
1812
+ }
1813
+ // 列数超出:仅移除尾部空列,非空列保留,避免丢失已拖入的组件
1814
+ while (gridCols.length > colCount) {
1815
+ let lastCol = gridCols[gridCols.length - 1];
1816
+ if (lastCol.widgetList && lastCol.widgetList.length > 0) break;
1817
+ gridCols.pop();
1818
+ }
1819
+ }
1820
+ });
1821
+ });
1822
+ },
1823
+
1824
+ deleteColOfGrid(gridWidget, colIdx) {
1825
+ if (!!gridWidget && !!gridWidget.cols) {
1826
+ gridWidget.cols.splice(colIdx, 1);
1827
+ }
1828
+ },
1829
+
1830
+ addNewColOfGrid(gridWidget) {
1831
+ const cols = gridWidget.cols;
1832
+ let newGridCol = baseRefUtil.deepClone(
1833
+ this.getContainerByType("grid-col")
1834
+ );
1835
+ let tmpId = baseRefUtil.generateId();
1836
+ newGridCol.id = "grid-col-" + tmpId;
1837
+ newGridCol.options.name = "gridCol" + tmpId;
1838
+ if (!!cols && cols.length > 0) {
1839
+ let spanSum = 0;
1840
+ cols.forEach((col) => {
1841
+ spanSum += col.options.span;
1842
+ });
1843
+
1844
+ if (spanSum >= 24) {
1845
+ //this.$message.info('列栅格之和超出24')
1846
+ console.log("列栅格之和超出24");
1847
+ gridWidget.cols.push(newGridCol);
1848
+ } else {
1849
+ newGridCol.options.span = 24 - spanSum > 12 ? 12 : 24 - spanSum;
1850
+ gridWidget.cols.push(newGridCol);
1851
+ }
1852
+ } else {
1853
+ gridWidget.cols = [newGridCol];
1854
+ }
1855
+ },
1856
+
1857
+ addTabPaneOfTabs(tabsWidget) {
1858
+ const tabPanes = tabsWidget.tabs;
1859
+ let newTabPane = baseRefUtil.deepClone(
1860
+ this.getContainerByType("tab-pane")
1861
+ );
1862
+ newTabPane.id = "tab-pane-" + baseRefUtil.generateId();
1863
+ newTabPane.options.name = newTabPane.id;
1864
+ newTabPane.options.label = "tab " + (tabPanes.length + 1);
1865
+ tabPanes.push(newTabPane);
1866
+ },
1867
+
1868
+ deleteTabPaneOfTabs(tabsWidget, tpIdx) {
1869
+ tabsWidget.tabs.splice(tpIdx, 1);
1870
+ },
1871
+
1872
+ addDropdownItem(tabsWidget) {
1873
+ const tabPanes = tabsWidget.widgetList;
1874
+ let newTabPane = baseRefUtil.deepClone(
1875
+ this.getFieldWidgetByType("dropdown-item")
1876
+ );
1877
+ newTabPane.id = "dropdown-item-" + baseRefUtil.generateId();
1878
+ newTabPane.options.name = newTabPane.id;
1879
+ newTabPane.options.label = "dropdown-item " + (tabPanes.length + 1);
1880
+ tabPanes.push(newTabPane);
1881
+ },
1882
+
1883
+ deleteDropdownItem(tabsWidget, tpIdx) {
1884
+ tabsWidget.widgetList.splice(tpIdx, 1);
1885
+ },
1886
+
1887
+ emitEvent(evtName, evtData) {
1888
+ //用于兄弟组件发射事件
1889
+ this.vueInstance.$emit(evtName, evtData);
1890
+ },
1891
+
1892
+ handleEvent(evtName, callback) {
1893
+ //用于兄弟组件接收事件
1894
+ this.vueInstance.$on(evtName, (data) => callback(data));
1895
+ },
1896
+
1897
+ setCssClassList(cssClassList) {
1898
+ this.cssClassList = cssClassList;
1899
+ },
1900
+
1901
+ getCssClassList() {
1902
+ return this.cssClassList;
1903
+ },
1904
+
1905
+ registerFormWidget(formWidget) {
1906
+ this.formWidget = formWidget;
1907
+ },
1908
+
1909
+ initHistoryData() {
1910
+ this.loadFormContentFromStorage();
1911
+ this.historyData.index++;
1912
+ this.historyData.steps[this.historyData.index] = {
1913
+ widgetList: baseRefUtil.deepClone(this.widgetList),
1914
+ formConfig: baseRefUtil.deepClone(this.formConfig),
1915
+ };
1916
+ },
1917
+
1918
+ emitHistoryChange() {
1919
+ //console.log('------------', 'Form history changed!')
1920
+
1921
+ if (this.historyData.index === this.historyData.maxStep - 1) {
1922
+ this.historyData.steps.shift();
1923
+ } else {
1924
+ this.historyData.index++;
1925
+ }
1926
+
1927
+ this.historyData.steps[this.historyData.index] = {
1928
+ widgetList: baseRefUtil.deepClone(this.widgetList),
1929
+ formConfig: baseRefUtil.deepClone(this.formConfig),
1930
+ };
1931
+
1932
+ this.saveFormContentToStorage();
1933
+
1934
+ if (this.historyData.index < this.historyData.steps.length - 1) {
1935
+ this.historyData.steps = this.historyData.steps.slice(
1936
+ 0,
1937
+ this.historyData.index + 1
1938
+ );
1939
+ }
1940
+
1941
+ //console.log('history', this.historyData.index)
1942
+ },
1943
+
1944
+ saveCurrentHistoryStep() {
1945
+ this.historyData.steps[this.historyData.index] = baseRefUtil.deepClone({
1946
+ widgetList: this.widgetList,
1947
+ formConfig: this.formConfig,
1948
+ });
1949
+
1950
+ this.saveFormContentToStorage();
1951
+ },
1952
+
1953
+ undoHistoryStep() {
1954
+ if (this.historyData.index !== 0) {
1955
+ this.historyData.index--;
1956
+ }
1957
+ //console.log('undo', this.historyData.index)
1958
+
1959
+ this.widgetList = baseRefUtil.deepClone(
1960
+ this.historyData.steps[this.historyData.index].widgetList
1961
+ );
1962
+ this.formConfig = baseRefUtil.deepClone(
1963
+ this.historyData.steps[this.historyData.index].formConfig
1964
+ );
1965
+ },
1966
+
1967
+ redoHistoryStep() {
1968
+ if (this.historyData.index !== this.historyData.steps.length - 1) {
1969
+ this.historyData.index++;
1970
+ }
1971
+ //console.log('redo', this.historyData.index)
1972
+
1973
+ this.widgetList = baseRefUtil.deepClone(
1974
+ this.historyData.steps[this.historyData.index].widgetList
1975
+ );
1976
+ this.formConfig = baseRefUtil.deepClone(
1977
+ this.historyData.steps[this.historyData.index].formConfig
1978
+ );
1979
+ },
1980
+
1981
+ undoEnabled() {
1982
+ return this.historyData.index > 0 && this.historyData.steps.length > 0;
1983
+ },
1984
+
1985
+ redoEnabled() {
1986
+ return this.historyData.index < this.historyData.steps.length - 1;
1987
+ },
1988
+
1989
+ saveFormContentToStorage() {
1990
+ window.localStorage.setItem(
1991
+ "widget__list__backup",
1992
+ JSON.stringify(this.widgetList)
1993
+ );
1994
+ window.localStorage.setItem(
1995
+ "form__config__backup",
1996
+ JSON.stringify(this.formConfig)
1997
+ );
1998
+ },
1999
+
2000
+ loadFormContentFromStorage() {
2001
+ let widgetListBackup = window.localStorage.getItem(
2002
+ "widget__list__backup"
2003
+ );
2004
+ if (!!widgetListBackup) {
2005
+ this.widgetList = JSON.parse(widgetListBackup);
2006
+ }
2007
+
2008
+ let formConfigBackup = window.localStorage.getItem(
2009
+ "form__config__backup"
2010
+ );
2011
+ if (!!formConfigBackup) {
2012
+ //this.formConfig = JSON.parse(formConfigBackup)
2013
+ baseRefUtil.overwriteObj(
2014
+ this.formConfig,
2015
+ JSON.parse(formConfigBackup)
2016
+ ); /* 用=赋值,会导致inject依赖注入的formConfig属性变成非响应式 */
2017
+ }
2018
+ },
2019
+ getColumnWidget(row, isEdit) {
2020
+ //获取
2021
+ let formatS = isEdit ? row.editFormatS : row.formatS;
2022
+ let type = columnFormatMap[formatS];
2023
+ if (!type) return null;
2024
+ if (isEdit) {
2025
+ if (row.editWidget) {
2026
+ return row.editWidget;
2027
+ }
2028
+ if (row.editColumnOption) {
2029
+ let fieldWidget = this.copyNewFieldWidget(
2030
+ this.getFieldWidgetByType(type)
2031
+ );
2032
+ fieldWidget.options = row.editColumnOption;
2033
+ return fieldWidget;
2034
+ }
2035
+ } else {
2036
+ if (row.widget) {
2037
+ return row.widget;
2038
+ }
2039
+ if (row.columnOption) {
2040
+ let fieldWidget = this.copyNewFieldWidget(
2041
+ this.getFieldWidgetByType(type)
2042
+ );
2043
+ fieldWidget.options = row.columnOption;
2044
+ return fieldWidget;
2045
+ }
2046
+ }
2047
+ return this.createColumnWidget(row, isEdit);
2048
+ },
2049
+ getIsFileWidget(type) {
2050
+ return type === "vabUpload" || type === "baseAttachment";
2051
+ },
2052
+ createColumnWidget(row, isEdit) {
2053
+ let formatS = isEdit ? row.editFormatS : row.formatS;
2054
+ let type = columnFormatMap[formatS];
2055
+ if (!type) return null;
2056
+
2057
+ let columnSelectedWidget = null;
2058
+ if (type) {
2059
+ columnSelectedWidget = this.copyNewFieldWidget(
2060
+ this.getFieldWidgetByType(type)
2061
+ );
2062
+
2063
+ if (columnSelectedWidget.options.hasOwnProperty("required")) {
2064
+ columnSelectedWidget.options.required = row.required || false;
2065
+ }
2066
+
2067
+ if ("editDelete" === formatS) {
2068
+ columnSelectedWidget.options.prefixIcon = "el-icon-delete";
2069
+ columnSelectedWidget.options.label = (window.$vueRoot && window.$vueRoot.$t1 ? window.$vueRoot.$t1('删除') : '删除');
2070
+ columnSelectedWidget.options.labelHidden = true;
2071
+ columnSelectedWidget.options.hiddenByWf = true;
2072
+ columnSelectedWidget.options.onClick =
2073
+ "let tableParam = this.tableParam;\nlet tableRef = this.getWidgetRef(this.parentWidget.options.name);\ntableRef.deleteRow(tableParam.row,tableParam.rowIndex);";
2074
+ } else if ("editButton" === formatS) {
2075
+ columnSelectedWidget.options.prefixIcon = "el-icon-edit";
2076
+ columnSelectedWidget.options.label = (window.$vueRoot && window.$vueRoot.$t1 ? window.$vueRoot.$t1('查看') : '查看');
2077
+ columnSelectedWidget.options.labelHidden = true;
2078
+ columnSelectedWidget.options.onClick =
2079
+ "let tableParam = this.tableParam;\nlet tableRef = this.getWidgetRef(this.parentWidget.options.name);\ntableRef.openEditDialog(tableParam.row)";
2080
+ } else if ("addSiblingEditRow" === formatS) {
2081
+ columnSelectedWidget.options.prefixIcon = "el-icon-plus";
2082
+ columnSelectedWidget.options.label = (window.$vueRoot && window.$vueRoot.$t1 ? window.$vueRoot.$t1('新增兄弟节点') : '新增兄弟节点');
2083
+ columnSelectedWidget.options.labelHidden = false;
2084
+ columnSelectedWidget.options.onClick =
2085
+ "let tableParam = this.tableParam;\nthis.getParentTarget().addSiblingTreeRow(null,tableParam);";
2086
+ } else if ("addChildTreeRow" === formatS) {
2087
+ columnSelectedWidget.options.prefixIcon = "el-icon-plus";
2088
+ columnSelectedWidget.options.label = (window.$vueRoot && window.$vueRoot.$t1 ? window.$vueRoot.$t1('新增子节点') : '新增子节点');
2089
+ columnSelectedWidget.options.labelHidden = false;
2090
+ columnSelectedWidget.options.onClick =
2091
+ "let tableParam = this.tableParam;\nthis.getParentTarget().addChildTreeRow(null,tableParam);";
2092
+ } else if ("moveUpRow" === formatS) {
2093
+ columnSelectedWidget.options.label = (window.$vueRoot && window.$vueRoot.$t1 ? window.$vueRoot.$t1('↑上移') : '↑上移');
2094
+ columnSelectedWidget.options.labelHidden = false;
2095
+ columnSelectedWidget.options.onClick =
2096
+ "let tableParam = this.tableParam;\nthis.getParentTarget().moveUpRow(tableParam);";
2097
+ } else if ("moveDownRow" === formatS) {
2098
+ columnSelectedWidget.options.label = (window.$vueRoot && window.$vueRoot.$t1 ? window.$vueRoot.$t1('↓下移') : '↓下移');
2099
+ columnSelectedWidget.options.labelHidden = false;
2100
+ columnSelectedWidget.options.onClick =
2101
+ "let tableParam = this.tableParam;\nthis.getParentTarget().moveDownRow(tableParam);";
2102
+ } else if ("removeTreeRow" === formatS) {
2103
+ columnSelectedWidget.options.prefixIcon = "el-icon-delete";
2104
+ columnSelectedWidget.options.label = (window.$vueRoot && window.$vueRoot.$t1 ? window.$vueRoot.$t1('删除') : '删除');
2105
+ columnSelectedWidget.options.labelHidden = true;
2106
+ columnSelectedWidget.options.onClick =
2107
+ "let tableParam = this.tableParam;\nthis.getParentTarget().removeTreeRow(tableParam);";
2108
+ }
2109
+
2110
+ if (columnSelectedWidget.options.hasOwnProperty("keyName")) {
2111
+ if (!this.getIsFileWidget(type)) {
2112
+ columnSelectedWidget.options.keyName = row.prop;
2113
+ }
2114
+
2115
+ columnSelectedWidget.options.keyNameEnabled = true;
2116
+ } else {
2117
+ columnSelectedWidget.options.name = row.prop;
2118
+ }
2119
+
2120
+ if (type === "dropdown") {
2121
+ columnSelectedWidget.options.dropdownType = "link";
2122
+ } else if (type !== "button" && type !== "a-link") {
2123
+ columnSelectedWidget.options.label = row.label;
2124
+ columnSelectedWidget.options.labelHidden = true;
2125
+ }
2126
+ }
2127
+ return columnSelectedWidget;
2128
+ },
2129
+ };
2130
+ };
2131
+ })();
2132
+
2133
+ export const createDesigner = createDesigner0;