cloud-web-corejs 1.1.0-dev.4 → 1.1.0-dev.40

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 (449) 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 +27 -4
  15. package/resource-tools/index.js +126 -0
  16. package/src/app-bootstrap.js +530 -0
  17. package/src/boot-assets.legacy.js +7 -0
  18. package/src/boot-assets.next.js +7 -0
  19. package/src/components/Tinymce/dynamicLoadScript.js +51 -59
  20. package/src/components/Tinymce/index.vue +382 -336
  21. package/src/components/Tinymce/mce-chrome.scss +150 -0
  22. package/src/components/VabUpload/image-viewer.vue +18 -10
  23. package/src/components/VabUpload/index.vue +1 -1
  24. package/src/components/VabUpload/style.scss +282 -0
  25. package/src/components/VabUpload/view.vue +19 -18
  26. package/src/components/baseArea/index.vue +2 -2
  27. package/src/components/baseInputExport/mixins.js +0 -6
  28. package/src/components/bizTab/BizTabListPage.vue +66 -33
  29. package/src/components/bizTab/README.md +3 -1
  30. package/src/components/bizTab/bizBillDetailMixin.js +2 -0
  31. package/src/components/code-editor/ace-chrome.scss +17 -0
  32. package/src/components/code-editor/index.vue +361 -340
  33. package/src/components/errorMsg/index.vue +4 -4
  34. package/src/components/excelExport/conditionExportConfig.js +112 -0
  35. package/src/components/excelExport/exportColumnMemory.js +118 -0
  36. package/src/components/excelExport/exportFieldDialog.vue +50 -38
  37. package/src/components/excelExport/exportType.js +8 -0
  38. package/src/components/excelExport/index.js +30 -13
  39. package/src/components/excelExport/index.vue +7 -1
  40. package/src/components/excelExport/mixins.js +782 -293
  41. package/src/components/excelImport/index.vue +156 -156
  42. package/src/components/excelImport/mixins.js +888 -834
  43. package/src/components/fileLibrary/style.scss +579 -0
  44. package/src/components/hiprint/style.scss +188 -0
  45. package/src/components/jsonImport/index.vue +1 -1
  46. package/src/components/jsonImport/mixins.js +6 -10
  47. package/src/components/langImport/index.vue +1 -1
  48. package/src/components/langImport/mixins.js +6 -10
  49. package/src/components/luckysheet/loadResources.js +64 -0
  50. package/src/components/luckysheet/view.vue +239 -210
  51. package/src/components/mobile/buttonGroup/index.vue +1 -1
  52. package/src/components/mobile/wf/addTaskUserdialog.vue +100 -80
  53. package/src/components/mobile/wf/content.vue +141 -69
  54. package/src/components/mobile/wf/deleteTaskUserDialog.vue +73 -54
  55. package/src/components/mobile/wf/selectUserDialog.vue +118 -0
  56. package/src/components/mobile/wf/setCandidateDialog.vue +69 -48
  57. package/src/components/mobile/wf/urgingDialog.vue +75 -52
  58. package/src/components/mobile/wf/wfModifyDialog.vue +4 -0
  59. package/src/components/obsUpload/index.vue +1 -1
  60. package/src/components/onlineTalk/index.vue +4 -4
  61. package/src/components/table/index.js +22 -3
  62. package/src/components/table/plugins/cell-area/index.js +10 -3
  63. package/src/components/table/style.scss +1399 -0
  64. package/src/components/table/vxeFilter/mixin.js +28 -18
  65. package/src/components/wf/content.vue +3 -2
  66. package/src/components/wf/content2.vue +1 -1
  67. package/src/components/wf/style.scss +265 -0
  68. package/src/components/wf/wf.js +7 -0
  69. package/src/components/wf/wfActionItems.js +3 -0
  70. package/src/components/wf/wfStartDialog.vue +1 -0
  71. package/src/components/wf/wfTransferEnabled.js +54 -0
  72. package/src/components/wf/wfUtil.js +47 -29
  73. package/src/components/wf/wfVisibility.js +6 -0
  74. 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
  75. 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
  76. 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
  77. 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
  78. 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
  79. 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
  80. 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
  81. package/src/components/xform/form-designer/designer.js +2132 -2100
  82. package/src/components/xform/form-designer/form-widget/container-widget/data-table-mixin.js +7 -0
  83. package/src/components/xform/form-designer/form-widget/container-widget/data-table-widget.vue +3 -1
  84. package/src/components/xform/form-designer/form-widget/container-widget/detail-h5-widget.vue +243 -227
  85. package/src/components/xform/form-designer/form-widget/container-widget/h5-card-pane-widget.vue +228 -207
  86. package/src/components/xform/form-designer/form-widget/container-widget/h5-card-widget.vue +165 -136
  87. package/src/components/xform/form-designer/form-widget/dialog/importDialog.vue +190 -185
  88. package/src/components/xform/form-designer/form-widget/dialog/importDialogMixin.js +2656 -1774
  89. package/src/components/xform/form-designer/form-widget/field-widget/a-link-widget.vue +1 -1
  90. package/src/components/xform/form-designer/form-widget/field-widget/a-text-widget.vue +1 -1
  91. package/src/components/xform/form-designer/form-widget/field-widget/area-select-widget.vue +1 -1
  92. package/src/components/xform/form-designer/form-widget/field-widget/autocomplete-widget.vue +1 -1
  93. package/src/components/xform/form-designer/form-widget/field-widget/baseAttachment-widget.vue +1 -1
  94. package/src/components/xform/form-designer/form-widget/field-widget/button-widget.vue +1 -1
  95. package/src/components/xform/form-designer/form-widget/field-widget/cascader-widget.vue +1 -1
  96. package/src/components/xform/form-designer/form-widget/field-widget/census-widget.vue +1 -1
  97. package/src/components/xform/form-designer/form-widget/field-widget/checkbox-widget.vue +1 -1
  98. package/src/components/xform/form-designer/form-widget/field-widget/color-widget.vue +1 -1
  99. package/src/components/xform/form-designer/form-widget/field-widget/copy_button-widget.vue +1 -1
  100. package/src/components/xform/form-designer/form-widget/field-widget/date-range-widget.vue +1 -1
  101. package/src/components/xform/form-designer/form-widget/field-widget/date-widget.vue +1 -1
  102. package/src/components/xform/form-designer/form-widget/field-widget/descriptions-widget.vue +1 -1
  103. package/src/components/xform/form-designer/form-widget/field-widget/divider-widget.vue +1 -1
  104. package/src/components/xform/form-designer/form-widget/field-widget/download-button-widget.vue +1 -1
  105. package/src/components/xform/form-designer/form-widget/field-widget/dropdown-item-widget.vue +1 -1
  106. package/src/components/xform/form-designer/form-widget/field-widget/dropdown-widget.vue +35 -4
  107. package/src/components/xform/form-designer/form-widget/field-widget/echart-bar-widget.vue +1 -1
  108. package/src/components/xform/form-designer/form-widget/field-widget/echart-category-widget.vue +1 -1
  109. package/src/components/xform/form-designer/form-widget/field-widget/echart-pie-widget.vue +1 -1
  110. package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +38 -2
  111. package/src/components/xform/form-designer/form-widget/field-widget/file-upload-widget.vue +1 -1
  112. package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +1 -1
  113. package/src/components/xform/form-designer/form-widget/field-widget/html-text-widget.vue +1 -1
  114. package/src/components/xform/form-designer/form-widget/field-widget/import-button-widget.vue +19 -6
  115. package/src/components/xform/form-designer/form-widget/field-widget/import2-button-widget.vue +1 -1
  116. package/src/components/xform/form-designer/form-widget/field-widget/index.js +10 -1
  117. package/src/components/xform/form-designer/form-widget/field-widget/input-batch-widget.vue +1 -1
  118. package/src/components/xform/form-designer/form-widget/field-widget/input-widget.vue +1 -1
  119. package/src/components/xform/form-designer/form-widget/field-widget/multiSearch-widget.vue +1 -1
  120. package/src/components/xform/form-designer/form-widget/field-widget/news-list-widget.vue +1 -1
  121. package/src/components/xform/form-designer/form-widget/field-widget/number-widget.vue +1 -1
  122. package/src/components/xform/form-designer/form-widget/field-widget/oplog-widget.vue +1 -1
  123. package/src/components/xform/form-designer/form-widget/field-widget/picture-upload-widget.vue +1 -1
  124. package/src/components/xform/form-designer/form-widget/field-widget/print-button-widget.vue +1 -1
  125. package/src/components/xform/form-designer/form-widget/field-widget/print-detail-button-widget.vue +1 -1
  126. package/src/components/xform/form-designer/form-widget/field-widget/project-tag-widget.vue +1 -1
  127. package/src/components/xform/form-designer/form-widget/field-widget/radio-widget.vue +1 -1
  128. package/src/components/xform/form-designer/form-widget/field-widget/rate-widget.vue +1 -1
  129. package/src/components/xform/form-designer/form-widget/field-widget/rich-editor-widget.vue +1 -1
  130. package/src/components/xform/form-designer/form-widget/field-widget/row-col-select-widget.vue +64 -0
  131. package/src/components/xform/form-designer/form-widget/field-widget/save_submit_wf_button-widget.vue +1 -1
  132. package/src/components/xform/form-designer/form-widget/field-widget/script-input-widget.vue +1 -1
  133. package/src/components/xform/form-designer/form-widget/field-widget/search_button-widget.vue +1 -1
  134. package/src/components/xform/form-designer/form-widget/field-widget/select-export-button-widget.vue +1 -1
  135. package/src/components/xform/form-designer/form-widget/field-widget/select-export-item-button-widget.vue +6 -2
  136. package/src/components/xform/form-designer/form-widget/field-widget/select-widget.vue +1 -1
  137. package/src/components/xform/form-designer/form-widget/field-widget/singerSearch-widget.vue +1 -1
  138. package/src/components/xform/form-designer/form-widget/field-widget/singleUpload-widget.vue +145 -145
  139. package/src/components/xform/form-designer/form-widget/field-widget/slider-widget.vue +1 -1
  140. package/src/components/xform/form-designer/form-widget/field-widget/static-content-wrapper.vue +1 -1
  141. package/src/components/xform/form-designer/form-widget/field-widget/static-text-widget.vue +1 -1
  142. package/src/components/xform/form-designer/form-widget/field-widget/status-widget.vue +1 -1
  143. package/src/components/xform/form-designer/form-widget/field-widget/switch-widget.vue +1 -1
  144. package/src/components/xform/form-designer/form-widget/field-widget/table-export-button-widget.vue +3 -2
  145. package/src/components/xform/form-designer/form-widget/field-widget/tempStorage-widget.vue +1 -1
  146. package/src/components/xform/form-designer/form-widget/field-widget/text-widget.vue +1 -1
  147. package/src/components/xform/form-designer/form-widget/field-widget/textarea-widget.vue +1 -1
  148. package/src/components/xform/form-designer/form-widget/field-widget/time-range-widget.vue +1 -1
  149. package/src/components/xform/form-designer/form-widget/field-widget/time-widget.vue +1 -1
  150. package/src/components/xform/form-designer/form-widget/field-widget/title-head-widget.vue +1 -1
  151. package/src/components/xform/form-designer/form-widget/field-widget/vabSearch-widget.vue +1 -1
  152. package/src/components/xform/form-designer/form-widget/field-widget/vabUpload-widget.vue +3 -3
  153. package/src/components/xform/form-designer/form-widget/field-widget/vabUpload2-widget.vue +1 -1
  154. package/src/components/xform/form-designer/form-widget/field-widget/vue-page-widget.vue +1 -1
  155. package/src/components/xform/form-designer/indexMixin.js +35 -1
  156. package/src/components/xform/form-designer/setting-panel/form-dynamicField-setting.vue +687 -602
  157. package/src/components/xform/form-designer/setting-panel/form-setting.vue +88 -11
  158. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +335 -12
  159. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +23 -7
  160. package/src/components/xform/form-designer/setting-panel/property-editor/container-detail/detail-temp-edito.vue +13 -1
  161. package/src/components/xform/form-designer/setting-panel/property-editor/container-list-h5/list-h5-editor.vue +846 -860
  162. package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import-button-editor.vue +62 -1
  163. package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import2-button-editor.vue +142 -2
  164. package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/empty-number-input.vue +51 -0
  165. package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/select-export-item-button-editor.vue +27 -2
  166. package/src/components/xform/form-designer/setting-panel/property-editor/field-table-export-button/table-export-button-editor.vue +33 -3
  167. package/src/components/xform/form-designer/setting-panel/propertyRegister.js +9 -1
  168. package/src/components/xform/form-designer/toolbar-panel/index.vue +884 -874
  169. package/src/components/xform/form-designer/toolbar-panel/indexMixin.js +14 -0
  170. package/src/components/xform/form-designer/widget-panel/index.vue +11 -7
  171. package/src/components/xform/form-designer/widget-panel/indexMixin.js +30 -6
  172. package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +142 -9
  173. package/src/components/xform/form-render/container-item/data-table-item.vue +347 -342
  174. package/src/components/xform/form-render/container-item/data-table-mixin.js +6874 -5985
  175. package/src/components/xform/form-render/container-item/detail-h5-item.vue +48 -19
  176. package/src/components/xform/form-render/container-item/detail-item.vue +350 -446
  177. package/src/components/xform/form-render/container-item/dynamicFieldMixin.js +55 -1
  178. package/src/components/xform/form-render/container-item/list-h5-item.vue +152 -140
  179. package/src/components/xform/form-render/container-item/tab-item.vue +138 -129
  180. package/src/components/xform/form-render/fieldControlEngine.js +218 -0
  181. package/src/components/xform/form-render/fieldControlMixin.js +536 -0
  182. package/src/components/xform/form-render/index.vue +164 -153
  183. package/src/components/xform/form-render/indexMixin.js +5425 -5311
  184. package/src/components/xform/lang/en-US.js +4 -0
  185. package/src/components/xform/lang/zh-CN.js +5 -0
  186. package/src/components/xform/mixins/businessLock.js +59 -0
  187. package/src/components/xform/mixins/defaultHandle.js +713 -707
  188. package/src/components/xform/mixins/scriptHttp.js +29 -8
  189. package/src/components/xform/mixins/wfStart.js +105 -0
  190. package/src/components/xform/mixins/wfVisibility.js +33 -0
  191. package/src/components/xform/styles/census.scss +288 -0
  192. package/src/components/xform/styles/containers.scss +208 -0
  193. package/src/components/xform/styles/designer.scss +904 -0
  194. package/src/components/xform/styles/detail-temp.scss +71 -0
  195. package/src/components/xform/styles/h5-designer.scss +191 -0
  196. package/src/components/xform/styles/h5.scss +831 -514
  197. package/src/components/xform/styles/skins.scss +398 -0
  198. package/src/components/xform/styles/table-layout.scss +91 -0
  199. package/src/components/xform/styles/titles.scss +255 -0
  200. package/src/components/xform/utils/dynamicSchemaUtil.js +385 -361
  201. package/src/components/xform/utils/tableColumnHelper.js +46 -4
  202. package/src/components/xform/utils/util.js +1732 -1708
  203. package/src/core-resources/css/h5.scss +548 -0
  204. package/src/core-resources/css/iconfont.css +1447 -0
  205. package/src/core-resources/font/iconfont.ttf +0 -0
  206. package/src/core-resources/font/iconfont.woff +0 -0
  207. package/src/core-resources/font/iconfont.woff2 +0 -0
  208. package/src/core-resources/images/default-header.png +0 -0
  209. package/src/core-resources/images/ico-default_wenjian.svg +1 -0
  210. package/src/core-resources/images/ico-excel.svg +1 -0
  211. package/src/core-resources/images/ico-ftl.svg +7 -0
  212. package/src/core-resources/images/ico-html.svg +1 -0
  213. package/src/core-resources/images/ico-java.svg +1 -0
  214. package/src/core-resources/images/ico-music.svg +1 -0
  215. package/src/core-resources/images/ico-pdf.svg +1 -0
  216. package/src/core-resources/images/ico-photo.svg +1 -0
  217. package/src/core-resources/images/ico-ppt.svg +1 -0
  218. package/src/core-resources/images/ico-psd.svg +1 -0
  219. package/src/core-resources/images/ico-service.png +0 -0
  220. package/src/core-resources/images/ico-txt.svg +1 -0
  221. package/src/core-resources/images/ico-video.svg +1 -0
  222. package/src/core-resources/images/ico-vue.svg +8 -0
  223. package/src/core-resources/images/ico-wenjianjia.svg +1 -0
  224. package/src/core-resources/images/ico-wrod.svg +1 -0
  225. package/src/core-resources/images/ico-xml.svg +1 -0
  226. package/src/core-resources/images/ico-yasuobao.svg +1 -0
  227. package/src/core-resources/images/icon-error.png +0 -0
  228. package/src/core-resources/images/icon-tips.png +0 -0
  229. package/src/core-resources/images/nodata.png +0 -0
  230. package/src/core-resources/images/nodata2.png +0 -0
  231. package/src/directive/append-to-body/index.js +48 -0
  232. package/src/icons/index.js +9 -0
  233. package/src/icons/svg/404.svg +1 -0
  234. package/src/icons/svg/alert.svg +1 -0
  235. package/src/icons/svg/bug.svg +1 -0
  236. package/src/icons/svg/button.svg +1 -0
  237. package/src/icons/svg/card.svg +1 -0
  238. package/src/icons/svg/cascader-field.svg +1 -0
  239. package/src/icons/svg/census.svg +1 -0
  240. package/src/icons/svg/chart.svg +1 -0
  241. package/src/icons/svg/checkbox-field.svg +1 -0
  242. package/src/icons/svg/clipboard.svg +1 -0
  243. package/src/icons/svg/color-field.svg +1 -0
  244. package/src/icons/svg/component.svg +1 -0
  245. package/src/icons/svg/custom-component.svg +1 -0
  246. package/src/icons/svg/dashboard.svg +1 -0
  247. package/src/icons/svg/data-table.svg +1 -0
  248. package/src/icons/svg/date-field.svg +1 -0
  249. package/src/icons/svg/date-range-field.svg +1 -0
  250. package/src/icons/svg/descriptions.svg +1 -0
  251. package/src/icons/svg/divider.svg +1 -0
  252. package/src/icons/svg/document.svg +1 -0
  253. package/src/icons/svg/documentation.svg +1 -0
  254. package/src/icons/svg/drag.svg +1 -0
  255. package/src/icons/svg/echart-category.svg +1 -0
  256. package/src/icons/svg/echart-pie.svg +1 -0
  257. package/src/icons/svg/echart.svg +1 -0
  258. package/src/icons/svg/edit.svg +1 -0
  259. package/src/icons/svg/education.svg +1 -0
  260. package/src/icons/svg/email.svg +1 -0
  261. package/src/icons/svg/example.svg +1 -0
  262. package/src/icons/svg/excel.svg +1 -0
  263. package/src/icons/svg/exit-fullscreen.svg +1 -0
  264. package/src/icons/svg/eye-open.svg +1 -0
  265. package/src/icons/svg/eye.svg +1 -0
  266. package/src/icons/svg/file-upload-field.svg +1 -0
  267. package/src/icons/svg/form.svg +1 -0
  268. package/src/icons/svg/fullscreen.svg +1 -0
  269. package/src/icons/svg/github.svg +1 -0
  270. package/src/icons/svg/grid.svg +1 -0
  271. package/src/icons/svg/guide.svg +1 -0
  272. package/src/icons/svg/html-text.svg +1 -0
  273. package/src/icons/svg/ico-more.svg +1 -0
  274. package/src/icons/svg/ico-wenjianjia.svg +1 -0
  275. package/src/icons/svg/icon.svg +1 -0
  276. package/src/icons/svg/input-batch.svg +1 -0
  277. package/src/icons/svg/international.svg +1 -0
  278. package/src/icons/svg/language.svg +1 -0
  279. package/src/icons/svg/link.svg +1 -0
  280. package/src/icons/svg/list-export.svg +1 -0
  281. package/src/icons/svg/list.svg +1 -0
  282. package/src/icons/svg/lock.svg +1 -0
  283. package/src/icons/svg/message.svg +1 -0
  284. package/src/icons/svg/money.svg +1 -0
  285. package/src/icons/svg/nested.svg +1 -0
  286. package/src/icons/svg/news-list.svg +1 -0
  287. package/src/icons/svg/node-tree.svg +1 -0
  288. package/src/icons/svg/number-field.svg +1 -0
  289. package/src/icons/svg/password.svg +1 -0
  290. package/src/icons/svg/pdf.svg +1 -0
  291. package/src/icons/svg/people.svg +1 -0
  292. package/src/icons/svg/peoples.svg +1 -0
  293. package/src/icons/svg/picture-upload-field.svg +1 -0
  294. package/src/icons/svg/qq.svg +1 -0
  295. package/src/icons/svg/query.svg +1 -0
  296. package/src/icons/svg/radio-field.svg +1 -0
  297. package/src/icons/svg/rate-field.svg +1 -0
  298. package/src/icons/svg/redo.svg +1 -0
  299. package/src/icons/svg/rich-editor-field.svg +1 -0
  300. package/src/icons/svg/search.svg +1 -0
  301. package/src/icons/svg/searchbox.svg +1 -0
  302. package/src/icons/svg/section.svg +1 -0
  303. package/src/icons/svg/select-field.svg +1 -0
  304. package/src/icons/svg/shopping.svg +1 -0
  305. package/src/icons/svg/size.svg +1 -0
  306. package/src/icons/svg/skill.svg +1 -0
  307. package/src/icons/svg/slider-field.svg +1 -0
  308. package/src/icons/svg/slot-component.svg +1 -0
  309. package/src/icons/svg/slot-field.svg +1 -0
  310. package/src/icons/svg/star.svg +1 -0
  311. package/src/icons/svg/static-text.svg +1 -0
  312. package/src/icons/svg/status.svg +1 -0
  313. package/src/icons/svg/sub-form.svg +1 -0
  314. package/src/icons/svg/switch-field.svg +1 -0
  315. package/src/icons/svg/tab.svg +1 -0
  316. package/src/icons/svg/table.svg +1 -0
  317. package/src/icons/svg/text-field.svg +1 -0
  318. package/src/icons/svg/text.svg +1 -0
  319. package/src/icons/svg/textarea-field.svg +1 -0
  320. package/src/icons/svg/theme.svg +1 -0
  321. package/src/icons/svg/time-field.svg +1 -0
  322. package/src/icons/svg/time-range-field.svg +1 -0
  323. package/src/icons/svg/tips-text.svg +1 -0
  324. package/src/icons/svg/title-head.svg +1 -0
  325. package/src/icons/svg/tree-pane.svg +1 -0
  326. package/src/icons/svg/tree-table.svg +1 -0
  327. package/src/icons/svg/tree.svg +1 -0
  328. package/src/icons/svg/undo.svg +1 -0
  329. package/src/icons/svg/uploadbox.svg +1 -0
  330. package/src/icons/svg/user.svg +1 -0
  331. package/src/icons/svg/vf-box.svg +1 -0
  332. package/src/icons/svg/vf-dialog.svg +1 -0
  333. package/src/icons/svg/vf-drawer.svg +1 -0
  334. package/src/icons/svg/vue-sfc.svg +1 -0
  335. package/src/icons/svg/wechat.svg +1 -0
  336. package/src/icons/svg/zip.svg +1 -0
  337. package/src/index.js +2 -510
  338. package/src/index.next.js +5 -0
  339. package/src/layout/components/Sidebar/default.vue +1656 -1655
  340. package/src/layout/components/TagsView/index.vue +325 -323
  341. package/src/layout/defaultLayout.vue +2 -2
  342. package/src/router/index.js +43 -48
  343. package/src/store/modules/settings.js +1 -1
  344. package/src/store/modules/tagsView.js +241 -217
  345. package/src/styles/btn.scss +104 -0
  346. package/src/styles/element-ui.scss +155 -0
  347. package/src/styles/element-variables.scss +31 -0
  348. package/src/styles/global.scss +115 -0
  349. package/src/styles/index.scss +200 -0
  350. package/src/styles/menu-icons.scss +75 -0
  351. package/src/styles/mixin.scss +72 -0
  352. package/src/styles/nprogress.scss +14 -0
  353. package/src/styles/sidebar.scss +281 -0
  354. package/src/styles/split-handle.scss +52 -0
  355. package/src/styles/theme-variables.scss +7 -0
  356. package/src/styles/transition.scss +48 -0
  357. package/src/styles/utilities.scss +137 -0
  358. package/src/styles/variables.scss +44 -0
  359. package/src/utils/assetUrl.js +19 -0
  360. package/src/utils/chunkLoadError.js +24 -0
  361. package/src/utils/featureResources.js +57 -0
  362. package/src/utils/importLimit.js +72 -0
  363. package/src/utils/pdfUtil.js +6 -1
  364. package/src/utils/request.js +24 -2
  365. package/src/utils/runtimeRecovery.js +105 -0
  366. package/src/utils/swiperLoader.js +20 -0
  367. package/src/utils/vab.js +1299 -1273
  368. package/src/utils/xlsxLoader.js +29 -0
  369. package/src/views/bd/setting/formVersion/compareContMixin.scss +1 -1
  370. package/src/views/bd/setting/form_template/edit.vue +378 -356
  371. package/src/views/bd/setting/form_template/formDesignerDialog.vue +6 -0
  372. package/src/views/bd/setting/form_template/formTemplateType.js +43 -0
  373. package/src/views/bd/setting/form_template/list.vue +304 -303
  374. package/src/views/bd/setting/form_template/mixins/edit.js +344 -280
  375. package/src/views/bd/setting/form_template/mixins/list.js +749 -721
  376. package/src/views/bd/setting/form_template/mixins/list2.js +412 -411
  377. package/src/views/bd/setting/form_template/mixins/wf_list.js +431 -430
  378. package/src/views/mobile/user/area/dialog.vue +1 -1
  379. package/src/views/mobile/user/user/dialog.vue +1 -1
  380. package/src/views/user/bill_setting/mixins/wf.js +8 -0
  381. package/src/views/user/bill_setting/render.vue +1 -1
  382. package/src/views/user/commMenu/index.vue +3 -1
  383. package/src/views/user/commMenu/style.scss +123 -0
  384. package/src/views/user/file_view_ins/list.vue +970 -970
  385. package/src/views/user/form/form_template/list.vue +527 -506
  386. package/src/views/user/form/vform/designer.vue +823 -821
  387. package/src/views/user/home/default.vue +1120 -1117
  388. package/src/views/user/home/default2.vue +2 -2
  389. package/src/views/user/home/index.vue +102 -102
  390. package/src/views/user/menuFallback/index.vue +23 -0
  391. package/src/views/user/notify_message/dialog.vue +139 -139
  392. package/src/views/user/outLink/form_view.vue +202 -202
  393. package/src/views/user/outLink/index.vue +110 -110
  394. package/src/views/user/role/edit.vue +4 -0
  395. package/src/views/user/role/role-box.scss +83 -0
  396. package/src/views/user/role/voc_edit.vue +4 -0
  397. package/src/views/user/wf/iframe/index.vue +51 -51
  398. package/src/views/user/wf/iframe/index2.vue +64 -64
  399. package/src/views/user/wf/wf_diy_attribute/edit.vue +1 -1
  400. package/src/views/user/wf/wf_manage/list2.vue +871 -871
  401. package/src/views/user/wf/wf_manage/wfContentDialog.vue +177 -126
  402. package/src/views/user/wf/wf_obj_config/activiti_wf.vue +134 -133
  403. package/src/views/user/wf/wf_obj_config/importItemDialog.vue +1 -1
  404. package/src/views/user/wf/wf_obj_config/list.vue +747 -746
  405. package/src/views/user/wf/wf_obj_config/list_form.vue +374 -373
  406. package/templates/child-app/.env +3 -0
  407. package/templates/child-app/README.md +49 -0
  408. package/templates/child-app/app.config.js +6 -0
  409. package/templates/child-app/babel.config.js +1 -0
  410. package/templates/child-app/core-resources.config.js +15 -0
  411. package/templates/child-app/gitignore +7 -0
  412. package/templates/child-app/package.json +34 -0
  413. package/templates/child-app/public/index.html +12 -0
  414. package/templates/child-app/src/assets/401_images/401.gif +0 -0
  415. package/templates/child-app/src/assets/404_images/404.png +0 -0
  416. package/templates/child-app/src/assets/404_images/404_cloud.png +0 -0
  417. package/templates/child-app/src/assets/logo.png +0 -0
  418. package/templates/child-app/src/corejsConfig.js +2 -0
  419. package/templates/child-app/src/icons/index.js +2 -0
  420. package/templates/child-app/src/icons/svg/child-demo.svg +1 -0
  421. package/templates/child-app/src/layout/index.vue +4 -0
  422. package/templates/child-app/src/main.js +5 -0
  423. package/templates/child-app/src/prefixConfig.js +13 -0
  424. package/templates/child-app/src/resources/css/login.scss +29 -0
  425. package/templates/child-app/src/resources/images/bg-login5.jpg +0 -0
  426. package/templates/child-app/src/resources/images/home-img.png +0 -0
  427. package/templates/child-app/src/router/modules/customer.js +3 -0
  428. package/templates/child-app/src/settings.js +24 -0
  429. package/templates/child-app/src/styles/app.scss +2 -0
  430. package/templates/child-app/src/views/demo/detail.vue +19 -0
  431. package/templates/child-app/src/views/demo/list.vue +38 -0
  432. package/templates/child-app/src/views/user/login/index.vue +18 -0
  433. package/templates/child-app/vue.config.js +107 -0
  434. package/src/components/xform/form-render/container-item/dynamicFieldEngine.js +0 -285
  435. package/src/components/xform/form-render/formDynamicFieldMixin.js +0 -131
  436. package/src/views/demo/bizTab/bill/billConfig.js +0 -41
  437. package/src/views/demo/bizTab/bill/detail.vue +0 -436
  438. package/src/views/demo/bizTab/bill/list.vue +0 -288
  439. package/src/views/demo/bizTab/bill/productDialog.vue +0 -176
  440. package/src/views/demo/bizTab/simple/billApi.js +0 -123
  441. package/src/views/demo/bizTab/simple/detail.vue +0 -407
  442. package/src/views/demo/bizTab/simple/list.vue +0 -217
  443. package/src/views/demo/bizTab/standalone/index.vue +0 -121
  444. package/src/views/demo/bizTab/wf/billConfig.js +0 -44
  445. package/src/views/demo/bizTab/wf/detail.vue +0 -661
  446. package/src/views/demo/bizTab/wf/list.vue +0 -242
  447. package/src/views/user/home/wjl/content.vue +0 -1569
  448. package/src/views/user/outLink/cc_form_view.vue +0 -188
  449. /package/src/{resources → core-resources}/js/base/common.js +0 -0
package/src/utils/vab.js CHANGED
@@ -1,1279 +1,1305 @@
1
- /**version-1.0*/
2
- let install = {};
3
-
4
- import request from "./request";
5
- import * as lodash from "lodash";
6
- import { Loading, Message, MessageBox, Notification, Form } from "element-ui";
7
- import store from "../store";
8
- import ElImageViewer from "../components/VabUpload/image-viewer";
9
-
10
- import { getToken } from "./auth";
11
- import XEUtils from "xe-utils";
12
-
13
- import prefixConfig from "@/prefixConfig.js";
14
- import moment from "moment";
15
- import { openView } from "./repeatOpen";
16
-
17
- let imFun = {
18
- request,
19
- lodash,
20
- Loading,
21
- Message,
22
- MessageBox,
23
- Notification,
24
- Form,
25
- store,
26
- getToken,
27
- prefixConfig,
28
- };
29
-
30
- function reqImg(a) {
31
- return require("@/resources/images/" + a);
32
- }
33
-
1
+ /**version-1.0*/
2
+ let install = {};
3
+
4
+ import request from "./request";
5
+ import * as lodash from "lodash";
6
+ import { Loading, Message, MessageBox, Notification, Form } from "element-ui";
7
+ import store from "../store";
8
+ import ElImageViewer from "../components/VabUpload/image-viewer";
9
+
10
+ import { getToken } from "./auth";
11
+ import XEUtils from "xe-utils";
12
+
13
+ import prefixConfig from "@/prefixConfig.js";
14
+ import moment from "moment";
15
+ import { openView } from "./repeatOpen";
16
+ import { assetUrl } from "./assetUrl";
17
+
18
+ let imFun = {
19
+ request,
20
+ lodash,
21
+ Loading,
22
+ Message,
23
+ MessageBox,
24
+ Notification,
25
+ Form,
26
+ store,
27
+ getToken,
28
+ prefixConfig,
29
+ };
30
+
34
31
  const FILE_ICON_NAME_MAP = {
35
- word: "ico-wrod.svg",
36
- excel: "ico-excel.svg",
37
- ppt: "ico-ppt.svg",
38
- pdf: "ico-pdf.svg",
39
- picture: "ico-photo.svg",
40
- video: "ico-video.svg",
41
- audio: "ico-music.svg",
42
- html: "ico-html.svg",
43
- txt: "ico-txt.svg",
44
- java: "ico-java.svg",
45
- vue: "ico-vue.svg",
46
- ftl: "ico-ftl.svg",
47
- xml: "ico-xml.svg",
48
- flash: "ico-flash.svg",
49
- zip: "ico-yasuobao.svg",
50
- exe: "ico-ext.svg",
51
- psd: "ico-psd.svg",
52
- folder: "ico-wenjianjia.svg",
53
- other: "ico-default_wenjian.svg",
32
+ word: "ico-wrod.svg",
33
+ excel: "ico-excel.svg",
34
+ ppt: "ico-ppt.svg",
35
+ pdf: "ico-pdf.svg",
36
+ picture: "ico-photo.svg",
37
+ video: "ico-video.svg",
38
+ audio: "ico-music.svg",
39
+ html: "ico-html.svg",
40
+ txt: "ico-txt.svg",
41
+ java: "ico-java.svg",
42
+ vue: "ico-vue.svg",
43
+ ftl: "ico-ftl.svg",
44
+ xml: "ico-xml.svg",
45
+ flash: "ico-default_wenjian.svg",
46
+ zip: "ico-yasuobao.svg",
47
+ exe: "ico-default_wenjian.svg",
48
+ psd: "ico-psd.svg",
49
+ folder: "ico-wenjianjia.svg",
50
+ other: "ico-default_wenjian.svg",
54
51
  };
55
52
 
56
- const FILE_ICON_TYPE_MAP = {
57
- doc: "word",
58
- docx: "word",
59
- xls: "excel",
60
- xlsx: "excel",
61
- ppt: "ppt",
62
- pptx: "ppt",
63
- pdf: "pdf",
64
- jpg: "picture",
65
- jpeg: "picture",
66
- png: "picture",
67
- gif: "picture",
68
- mp3: "video",
69
- mp4: "video",
70
- mpg: "video",
71
- mkv: "video",
72
- rmvb: "video",
73
- avi: "video",
74
- mov: "video",
75
- wav: "audio",
76
- html: "html",
77
- htm: "html",
78
- txt: "txt",
79
- java: "java",
80
- vue: "vue",
81
- ftl: "ftl",
82
- xml: "xml",
83
- swf: "flash",
84
- zip: "zip",
85
- rar: "zip",
86
- "7z": "zip",
87
- // exe: 'exe',
88
- psd: "psd",
53
+ // 使用静态 require 建立明确的资源依赖图,避免动态目录 require 把业务图片一并打包。
54
+ // webpack4/5 的返回值差异统一由 assetUrl 处理。
55
+ const FILE_ICON_MODULE_MAP = {
56
+ "ico-wrod.svg": require("@base/core-resources/images/ico-wrod.svg"),
57
+ "ico-excel.svg": require("@base/core-resources/images/ico-excel.svg"),
58
+ "ico-ppt.svg": require("@base/core-resources/images/ico-ppt.svg"),
59
+ "ico-pdf.svg": require("@base/core-resources/images/ico-pdf.svg"),
60
+ "ico-photo.svg": require("@base/core-resources/images/ico-photo.svg"),
61
+ "ico-video.svg": require("@base/core-resources/images/ico-video.svg"),
62
+ "ico-music.svg": require("@base/core-resources/images/ico-music.svg"),
63
+ "ico-html.svg": require("@base/core-resources/images/ico-html.svg"),
64
+ "ico-txt.svg": require("@base/core-resources/images/ico-txt.svg"),
65
+ "ico-java.svg": require("@base/core-resources/images/ico-java.svg"),
66
+ "ico-vue.svg": require("@base/core-resources/images/ico-vue.svg"),
67
+ "ico-ftl.svg": require("@base/core-resources/images/ico-ftl.svg"),
68
+ "ico-xml.svg": require("@base/core-resources/images/ico-xml.svg"),
69
+ "ico-yasuobao.svg": require("@base/core-resources/images/ico-yasuobao.svg"),
70
+ "ico-psd.svg": require("@base/core-resources/images/ico-psd.svg"),
71
+ "ico-wenjianjia.svg": require("@base/core-resources/images/ico-wenjianjia.svg"),
72
+ "ico-default_wenjian.svg": require("@base/core-resources/images/ico-default_wenjian.svg"),
89
73
  };
90
74
 
91
- let typeList = [
92
- "doc",
93
- "docx",
94
- "xls",
95
- "xlsx",
96
- "ppt",
97
- "pptx",
98
- "csv",
99
- "wps",
100
- "dps",
101
- "et",
102
- "ett",
103
- "wpt",
104
- "vsd",
105
- "vsdx",
106
- "wmf",
107
- "emf",
108
- "psd",
109
- "eps",
110
- "pdf",
111
- "xmind",
112
- "obj",
113
- "3ds",
114
- "stl",
115
- "ply",
116
- "gltf",
117
- "glb",
118
- "off",
119
- "3dm",
120
- "fbx",
121
- "dae",
122
- "wrl",
123
- "3mf",
124
- "ifc",
125
- "brep",
126
- "step",
127
- "iges",
128
- "fcstd",
129
- "bim",
130
- "dwg",
131
- "dxf",
132
- "dwf",
133
- "iges",
134
- "igs",
135
- "dwt",
136
- "dng",
137
- "ifc",
138
- "dwfx",
139
- "stl",
140
- "cf2",
141
- "plt",
142
- "txt",
143
- "xml",
144
- "md",
145
- "java",
146
- "php",
147
- "py",
148
- "js",
149
- "css",
150
- "zip",
151
- "rar",
152
- "jar",
153
- "tar",
154
- "gzip",
155
- "7z",
156
- "mp3",
157
- "wav",
158
- "mp4",
159
- "flv",
160
- "avi",
161
- "mov",
162
- "rm",
163
- "mkv",
164
- "mpeg",
165
- "mpg",
166
- "rmvb",
167
- "wmv",
168
- "3gp",
169
- "swf",
170
- "drawio",
171
- "tif",
172
- "tiff",
173
- "jfif",
174
- "webp",
175
- "tga",
176
- "svg",
177
- "vue",
178
- "ftl",
179
- ];
180
-
181
- const accessToken = imFun.store.getters["user/token"];
182
-
183
- const loadingText = "";
184
- const messageDuration = 3000;
185
-
186
- install = (Vue, opts = {}) => {
187
- /**http请求*/
188
- let $http = async function (option) {
189
- option = option || {};
190
- if (!option.loadingTarget && this.$el) {
191
- option.loadingTarget = this.$el;
192
- }
193
- if (!option.vueTarget) {
194
- option.vueTarget = this;
195
- }
196
- if (option.sync === false) {
197
- return await imFun.request(option);
198
- } else {
199
- return imFun.request(option);
200
- }
201
- };
202
-
203
- Vue.prototype.$commonHttp = function (opts) {
204
- let defaultOption = {
205
- addCreateInfo: true,
206
- queryCreateInfo: window.$vueRoot.$store.getters.queryCreateInfo || "0",
207
- };
208
- let option = Object.assign({}, defaultOption, opts);
209
- if (opts.addCreateInfo === null || opts.addCreateInfo === undefined) {
210
- option.addCreateInfo = defaultOption.addCreateInfo;
211
- }
212
- if (
213
- opts.queryCreateInfo === null ||
214
- opts.queryCreateInfo === undefined ||
215
- opts.queryCreateInfo === true
216
- ) {
217
- option.queryCreateInfo = defaultOption.queryCreateInfo;
218
- }
219
- if (opts.queryCreateInfo === false) {
220
- option.queryCreateInfo = "0";
221
- }
222
- return this.$http(option);
223
- };
224
-
225
- Object.assign($http, imFun.request);
226
- $http.prototype = imFun.request.prototype;
227
- Vue.prototype.$http = $http;
228
-
229
- /* 通用打开菜单/路由:开关开启时以独立标签重复打开,否则按原逻辑跳转
230
- * 用法:this.$openView('/path') 或 this.$openView({ path, query }[, route]) */
231
- Vue.prototype.$openView = function (location, route) {
232
- return openView(this.$router, location, route);
233
- };
234
-
235
- /* 全局accessToken */
236
- Vue.prototype.$baseAccessToken = () => {
237
- return accessToken || imFun.getToken();
238
- };
239
-
240
- /* 全局加载层 */
241
- Vue.prototype.$baseLoading = function (option) {
242
- let d = this.$el;
243
- let loading;
244
- option = option || {};
245
- if (!option.index) {
246
- let opts = {
247
- lock: true,
248
- background: "hsla(0,0%,100%,.8)",
249
- target: d,
250
- };
251
- Object.assign(opts, option);
252
- loading = imFun.Loading.service(opts);
253
- } else {
254
- let opts = {
255
- lock: true,
256
- spinner: "vab-loading-type" + option.index,
257
- background: "hsla(0,0%,100%,.8)",
258
- target: d,
259
- };
260
- Object.assign(opts, option);
261
- loading = imFun.Loading.service(opts);
262
- }
263
- return loading;
264
- };
265
- /* 全局多彩加载层 */
266
- Vue.prototype.$baseColorfullLoading = function (index, text) {
267
- let loading;
268
- if (!index) {
269
- loading = imFun.Loading.service({
270
- lock: true,
271
- text: text || loadingText,
272
- spinner: "dots-loader",
273
- background: "hsla(0,0%,100%,.8)",
274
- target: this.target,
275
- fullscreen: true,
276
- });
277
- } else {
278
- switch (index) {
279
- case 1:
280
- index = "dots";
281
- break;
282
- case 2:
283
- index = "gauge";
284
- break;
285
- case 3:
286
- index = "inner-circles";
287
- break;
288
- case 4:
289
- index = "plus";
290
- break;
291
- }
292
- loading = imFun.Loading.service({
293
- lock: true,
294
- text: text || loadingText,
295
- spinner: index + "-loader",
296
- background: "hsla(0,0%,100%,.8)",
297
- target: this.target,
298
- });
299
- }
300
- return loading;
301
- };
302
- /* 全局Message */
303
- Vue.prototype.$baseMessage = ({ message, type, onClose }) => {
304
- imFun.Message({
305
- offset: 60,
306
- showClose: true,
307
- message: message,
308
- type: type,
309
- dangerouslyUseHTMLString: true,
310
- duration: messageDuration,
311
- onClose: onClose,
312
- });
313
- };
314
-
315
- /* 全局Alert */
316
- Vue.prototype.$baseAlert = function (content, title, callback) {
317
- imFun.MessageBox.alert(content, title || "提示", {
318
- confirmButtonText: "确定",
319
- dangerouslyUseHTMLString: true,
320
- target: this.$el,
321
- confirmButtonClass: "icondui",
322
- customClass: "dialog-style",
323
- callback: (action) => {
324
- if (callback) {
325
- callback();
326
- }
327
- },
328
- });
329
- };
330
-
331
- /* 全局Confirm */
332
- Vue.prototype.$baseConfirm = function (content, title) {
333
- return imFun.MessageBox.confirm(content, title || "提示", {
334
- confirmButtonText: "确定",
335
- cancelButtonText: "取消",
336
- closeOnClickModal: false,
337
- type: "warning",
338
- customClass: "dialog-style",
339
- cancelButtonClass: "iconguanbi",
340
- confirmButtonClass: "icondui",
341
- });
342
- };
343
-
344
- /* 全局Notification */
345
- Vue.prototype.$baseNotify = (message, title, type, position) => {
346
- imFun.Notification({
347
- title: title,
348
- message: message,
349
- position: position || "top-right",
350
- type: type || "success",
351
- duration: messageDuration,
352
- });
353
- };
354
-
355
- /* 全局TableHeight */
356
- Vue.prototype.$baseTableHeight = (formType) => {
357
- let height = window.innerHeight;
358
- let paddingHeight = 400;
359
- const formHeight = 50;
360
-
361
- if (true) {
362
- paddingHeight = 365;
363
- }
364
-
365
- if ("number" === typeof formType) {
366
- height = height - paddingHeight - formHeight * formType;
367
- } else {
368
- height = height - paddingHeight;
369
- }
370
- return height;
371
- };
372
-
373
- /* 全局map图层 */
374
- Vue.prototype.$baseMap = () => {
375
- return new maptalks.Map("map", {
376
- center: [116.41348403785, 39.910843952376],
377
- zoom: 12,
378
- minZoom: 1,
379
- maxZoom: 19,
380
- spatialReference: {
381
- projection: "baidu",
382
- },
383
- attribution: {
384
- content: "© vue-admin-beautiful",
385
- },
386
- baseLayer: new maptalks.TileLayer("base", {
387
- cssFilter: "sepia(100%) invert(90%)",
388
- urlTemplate:
389
- "http://online{s}.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles=pl&scaler=1&p=1",
390
- subdomains: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
391
- attribution:
392
- '&copy; <a target="_blank" href="http://map.baidu.com">Baidu</a>',
393
- }),
394
- });
395
- };
396
-
397
- /* 全局lodash */
398
- Vue.prototype.$baseLodash = imFun.lodash;
399
- /* 全局事件总线 */
400
- Vue.prototype.$baseEventBus = new Vue();
401
-
402
- Vue.prototype.$commonFileUtil = {
403
- // 文件类型获取与判断接口
404
- getFileSuffix: function (name) {
405
- let i = name.lastIndexOf(".");
406
- if (i < 0) {
407
- // 默认是文本类型
408
- return "";
409
- }
410
- let suffix = name.substring(i + 1, name.length).toLowerCase();
411
- return suffix;
412
- },
413
- isBinary: function (suffix) {
414
- if (!suffix || suffix === "") {
415
- return false;
416
- }
417
- let fileTypeMap = {
418
- bin: true,
419
- exe: true,
420
- dll: true,
421
- so: true,
422
- lib: true,
423
- war: true,
424
- jar: true,
425
- };
426
- let type = fileTypeMap[suffix];
427
- if (undefined === type) {
428
- return false;
429
- }
430
- return true;
431
- },
432
- isPicture: function (suffix) {
433
- if (!suffix || suffix === "") {
434
- return false;
435
- }
436
-
437
- let fileTypeMap = {
438
- jpg: true,
439
- jpeg: true,
440
- png: true,
441
- gif: true,
442
- bmp: true,
443
- mpg: true,
444
- webp: true,
445
- };
446
-
447
- let type = fileTypeMap[suffix];
448
- if (undefined === type) {
449
- return false;
450
- }
451
-
452
- return true;
453
- },
454
- isVideo: function (suffix) {
455
- if (!suffix || suffix === "") {
456
- return false;
457
- }
458
- let fileTypeMap = {
459
- avi: true,
460
- mov: true,
461
- mpeg: true,
462
- mpg: true,
463
- mp4: true,
464
- rmvb: true,
465
- asf: true,
466
- flv: true,
467
- ogg: true,
468
- };
469
-
470
- let type = fileTypeMap[suffix];
471
- if (undefined === type) {
472
- return false;
473
- }
474
-
475
- return true;
476
- },
477
- isText: function (suffix) {
478
- if (!suffix || suffix === "") {
479
- return false;
480
- }
481
- let fileTypeMap = {
482
- txt: true,
483
- log: true,
484
- md: true,
485
- py: true,
486
- java: true,
487
- cpp: true,
488
- hpp: true,
489
- c: true,
490
- h: true,
491
- json: true,
492
- xml: true,
493
- html: true,
494
- sql: true,
495
- js: true,
496
- css: true,
497
- jsp: true,
498
- php: true,
499
- properties: true,
500
- conf: true,
501
- out: true,
502
- sh: true,
503
- bat: true,
504
- msg: true,
505
- cmake: true,
506
- yaml: true,
507
- yml: true,
508
- };
509
-
510
- let type = fileTypeMap[suffix];
511
- if (undefined === type) {
512
- return false;
513
- }
514
-
515
- return true;
516
- },
517
- isZip: function (suffix) {
518
- if (!suffix || suffix === "") {
519
- return false;
520
- }
521
- let fileTypeMap = {
522
- zip: true,
523
- war: true,
524
- rar: true,
525
- "7z": true,
526
- gz: true,
527
- tgz: true,
528
- xz: true,
529
- txz: true,
530
- bz2: true,
531
- tbz2: true,
532
- tar: true,
533
- };
534
-
535
- let type = fileTypeMap[suffix];
536
- if (undefined === type) {
537
- return false;
538
- }
539
-
540
- return true;
541
- },
542
- isOffice: function (suffix) {
543
- if (!suffix || suffix === "") {
544
- return false;
545
- }
546
- let fileTypeMap = {
547
- doc: true,
548
- docx: true,
549
- ppt: true,
550
- pptx: true,
551
- xls: true,
552
- xlsx: true,
553
- };
554
-
555
- let type = fileTypeMap[suffix];
556
- if (undefined === type) {
557
- return false;
558
- }
559
-
560
- return true;
561
- },
562
- isPdf: function (suffix) {
563
- if (!suffix || suffix === "") {
564
- return false;
565
- }
566
- let fileTypeMap = {
567
- pdf: true,
568
- };
569
-
570
- let type = fileTypeMap[suffix];
571
- if (undefined === type) {
572
- return false;
573
- }
574
-
575
- return true;
576
- },
577
- isPictureFile: function (fileName) {
578
- if (!fileName) return false;
579
- let typeStr = Object.prototype.toString.call(fileName);
580
- let suffix = null;
581
- if (typeStr === "[object Object]") {
582
- suffix = this.getFileSuffix(fileName.name);
583
- } else {
584
- suffix = this.getFileSuffix(fileName);
585
- }
586
- return this.isPicture(suffix);
587
- },
588
- isTextFile: function (fileName) {
589
- let suffix = this.getFileSuffix(fileName);
590
- return this.isText(suffix);
591
- },
592
- getShowUrl(url, showImagePreview) {
593
- let index = url.lastIndexOf("/");
594
- let filename;
595
- if (index >= 0) {
596
- filename = url.substring(url.lastIndexOf("/") + 1);
597
- } else {
598
- filename = url;
599
- }
600
-
601
- if (this.isPictureFile(filename) && showImagePreview !== false) {
602
- return url;
603
- } else {
604
- return this.getFileIconRequire(filename);
605
- }
606
- },
607
- resolveFileIconName: function (name, showType) {
608
- let iconType = this.getDiyFileIconType(name) || "other";
609
- if (showType) {
610
- iconType = showType;
611
- }
612
- return FILE_ICON_NAME_MAP[iconType];
613
- },
614
- getFileIconRequire: function (name, showType) {
615
- return reqImg(this.resolveFileIconName(name, showType));
616
- },
617
- getFileIconPath: function (name, showType) {
618
- return "/resources/images/" + this.resolveFileIconName(name, showType);
619
- },
620
- getDiyFileIconType: function (name) {
621
- let suffix = this.getFileSuffix(name);
622
- if (suffix === "") {
623
- // 默认是文本类型
624
- return "";
625
- }
626
-
627
- let iconType = FILE_ICON_TYPE_MAP[suffix];
628
- if (undefined === iconType) {
629
- return "";
630
- }
631
- return iconType;
632
- },
633
- getFileExtension(urlString) {
634
- if (!urlString) return null;
635
- const url = new URL(urlString);
636
- // 获取路径部分,例如 "/images/photo.jpg"
637
- const pathname = url.pathname;
638
-
639
- // 使用 lastIndexOf 找到最后一个点的位置
640
- const lastDotIndex = pathname.lastIndexOf(".");
641
-
642
- // 如果没有点,或者点在最后一位(即没有后缀),返回空字符串
643
- if (lastDotIndex === -1 || lastDotIndex === pathname.length - 1) {
644
- return "";
645
- }
646
-
647
- // 截取点之后的部分
648
- return pathname.slice(lastDotIndex + 1).toLowerCase();
649
- },
650
- downloadFile: function () {
651
- let filePath, name;
652
- let opts;
653
- if (typeof arguments[0] === "string") {
654
- filePath = arguments[0];
655
- name = arguments[1];
656
- } else {
657
- opts = arguments[0];
658
- filePath = opts.filePath;
659
- name = opts.name;
660
- }
661
- if (filePath) {
662
- let url = null;
663
- if (filePath.indexOf("?") >= 0) {
664
- url = filePath + "&_d=true";
665
- } else {
666
- url = filePath + "?_d=true";
667
- }
668
- if (name) {
669
- let fileSuffix = this.getFileExtension(filePath);
670
- if (fileSuffix && !name.endsWith("." + fileSuffix)) {
671
- name = name + "." + fileSuffix;
672
- }
673
-
674
- url += "&_n=" + encodeURIComponent(name);
675
- }
676
- // window.open(url);
677
- openInNewTab(url);
678
- }
679
- },
680
- isPreviewFile(fileName) {
681
- let fileSuffix = this.getFileSuffix(fileName);
682
- return typeList.includes(fileSuffix);
683
- },
684
- };
685
-
686
- Vue.prototype.$openFilePreview = function () {
687
- let filePath;
688
- let opts;
689
- if (typeof arguments[0] === "string") {
690
- filePath = arguments[0];
691
- } else {
692
- let attachment = arguments[0];
693
- filePath = attachment.domain + attachment.url;
694
- }
695
- let fileSuffix = this.$commonFileUtil.getFileSuffix(filePath);
696
- if (!typeList.includes(fileSuffix)) {
697
- return;
698
- }
699
-
700
- this.$http({
701
- url: USER_PREFIX + "/sf_common/getFilePreviewUrl",
702
- method: `post`,
703
- data: {
704
- url: filePath,
705
- },
706
- isLoading: true,
707
- success: (res) => {
708
- if (res.objx) {
709
- openInNewTab(res.objx);
710
- }
711
- },
712
- });
713
- };
714
-
715
- function openInNewTab(url) {
716
- if (!url) return;
717
- let a = document.createElement("a");
718
- a.href = url;
719
- a.target = "_blank";
720
- document.body.appendChild(a);
721
- a.click();
722
- document.body.removeChild(a);
723
- }
724
-
725
- Vue.prototype.$getFilePreviewUrl = async function (obj, callback) {
726
- let filePath;
727
- let opts;
728
- if (typeof obj === "string") {
729
- filePath = obj;
730
- } else {
731
- let attachment = obj;
732
- filePath = attachment.domain + attachment.url;
733
- }
734
- let fileSuffix = this.$commonFileUtil.getFileSuffix(filePath);
735
- /*if (!typeList.includes(fileSuffix)) {
736
- return;
737
- }*/
738
-
739
- return this.$http({
740
- url: USER_PREFIX + "/sf_common/getFilePreviewUrl",
741
- method: `post`,
742
- data: {
743
- url: filePath,
744
- },
745
- isLoading: true,
746
- success: (res) => {
747
- callback && callback(res.objx);
748
- },
749
- });
750
- };
751
-
752
- Vue.prototype.$baseFilePreview = function (attachment, index) {
753
- let that = this;
754
- let openImagePreView = function (attachments, index) {
755
- let pictureIndex = -1;
756
- let pictureDtoList = [];
757
- index = index || 0;
758
- attachments.forEach((item, i) => {
759
- let typeStr = Object.prototype.toString.call(item);
760
- if (typeStr === "[object Object]") {
761
- if (that.$commonFileUtil.isPictureFile(item.url)) {
762
- if (i <= index) {
763
- pictureIndex++;
764
- }
765
- pictureDtoList.push(item.domain + item.url);
766
- }
767
- } else {
768
- if (that.$commonFileUtil.isPictureFile(item)) {
769
- if (i <= index) {
770
- pictureIndex++;
771
- }
772
- pictureDtoList.push(item);
773
- }
774
- }
775
- });
776
-
777
- let a = Vue.extend(ElImageViewer);
778
- let instance = new a({
779
- propsData: {
780
- onClose: () => {
781
- dom.remove();
782
- },
783
- initialIndex: pictureIndex,
784
- urlList: pictureDtoList,
785
- },
786
- });
787
- let dom = instance.$mount().$el;
788
- document.body.append(dom);
789
- };
790
- let openPreview = function (attachment, index) {
791
- if (Array.isArray(attachment)) {
792
- let currentFile = attachment[index];
793
- let typeStr = Object.prototype.toString.call(currentFile);
794
- let url =
795
- typeStr === "[object Object]"
796
- ? currentFile.domain + currentFile.url
797
- : currentFile;
798
- if (that.$commonFileUtil.isPictureFile(url)) {
799
- openImagePreView(attachment, index);
800
- } else if (that.$commonFileUtil.isPreviewFile(url)) {
801
- that.$openFilePreview(url);
802
- }
803
- } else {
804
- let typeStr = Object.prototype.toString.call(attachment);
805
- let url =
806
- typeStr === "[object Object]"
807
- ? attachment.domain + attachment.url
808
- : attachment;
809
- if (that.$commonFileUtil.isPictureFile(url)) {
810
- openImagePreView([url], 0);
811
- } else if (that.$commonFileUtil.isPreviewFile(url)) {
812
- that.$openFilePreview(url);
813
- }
814
- }
815
- };
816
- openPreview(attachment, index);
817
- };
818
-
819
- Vue.prototype.$openEditView = function (key) {
820
- this[key] = false;
821
- setTimeout(() => {
822
- this[key] = true;
823
- }, 200);
824
- };
825
-
826
- Vue.prototype.$baseReload = function (param) {
827
- this.$emit("reload", this, param);
828
- };
829
-
830
- Vue.prototype.$reloadHandle = function (target, param) {
831
- let visibleKey = target.$attrs["visible-key"] || "showEdit";
832
- let parentTarget = target.$attrs["parent-target"] || target.$parent;
833
- let originTarget = parentTarget.$refs._viewDialog ? parentTarget : target;
834
- let updateParam =
835
- param !== null &&
836
- param !== undefined &&
837
- param.updateParam !== null &&
838
- param.updateParam !== undefined
839
- ? param.updateParam
840
- : {};
841
- for (let key in updateParam) {
842
- originTarget.$emit("update:" + key, updateParam[key]);
843
- }
844
- parentTarget[visibleKey] = false;
845
- return new Promise((resolve) => {
846
- setTimeout(() => {
847
- parentTarget[visibleKey] = true;
848
- parentTarget.$nextTick(resolve);
849
- }, 200);
850
- });
851
- };
852
-
853
- Vue.prototype.$baseStartPickerOptions = function (value, type) {
854
- return {
855
- disabledDate: (time) => {
856
- if (value !== null && value !== undefined && value !== "") {
857
- let date = new Date(value.replace(/-/g, "/"));
858
- if (!type || type === "date") {
859
- date.setDate(date.getDate() + 1);
860
- return time.getTime() >= date.getTime();
861
- } else if (type === "year") {
862
- return time.getYear() > date.getYear();
863
- } else if (type === "month") {
864
- date.setMonth(date.getMonth() + 1);
865
- return time.getTime() >= date.getTime();
866
- }
867
- } else {
868
- return false;
869
- }
870
- },
871
- };
872
- };
873
-
874
- Vue.prototype.$baseEndPickerOptions = function (value, format) {
875
- return {
876
- disabledDate: (time) => {
877
- if (value !== null && value !== undefined && value !== "") {
878
- let date = new Date(value.replace(/-/g, "/"));
879
- return time.getTime() < date.getTime();
880
- } else {
881
- return false;
882
- }
883
- },
884
- };
885
- };
886
-
887
- //除法
888
- function baseDiv() {
889
- let value = 0;
890
- if (arguments.length) {
891
- value = arguments[0];
892
- for (let i = 1; i < arguments.length; i++) {
893
- value = XEUtils.divide(value, arguments[i]);
894
- }
895
- }
896
- return value;
897
- }
898
-
899
- //乘法
900
- function baseMul() {
901
- let value = 0;
902
- if (arguments.length) {
903
- value = arguments[0];
904
- for (let i = 1; i < arguments.length; i++) {
905
- value = XEUtils.multiply(value, arguments[i]);
906
- }
907
- }
908
- return value;
909
- }
910
-
911
- //加法
912
- function baseAdd() {
913
- let value = 0;
914
- if (arguments.length) {
915
- value = arguments[0];
916
- for (let i = 1; i < arguments.length; i++) {
917
- value = XEUtils.add(value, arguments[i]);
918
- }
919
- }
920
- return value;
921
- }
922
-
923
- //减法
924
- function baseSub() {
925
- let value = 0;
926
- if (arguments.length) {
927
- value = arguments[0];
928
- for (let i = 1; i < arguments.length; i++) {
929
- value = XEUtils.subtract(value, arguments[i]);
930
- }
931
- }
932
- return value;
933
- }
934
-
935
- Vue.prototype.$baseAdd = baseAdd;
936
- Vue.prototype.$baseSub = baseSub;
937
- Vue.prototype.$baseMul = baseMul;
938
- Vue.prototype.$baseDiv = baseDiv;
939
-
940
- /**
941
- * 格式化数字为带千分位的字符串。
942
- *
943
- * @param {string | number} value - 输入值
944
- * @param {Object} [options={}] - 配置
945
- * @param {boolean} [options.fixed=false] -
946
- * - `true`: 启用定点精度处理 —— 使用 toFixed(digits) 四舍五入并补零到指定小数位。
947
- * - `false`(默认): 保留原始小数形式(不四舍五入、不补零、保留尾随零)。
948
- * @param {number} [options.digits=2] - 小数位数(仅在 fixed: true 时生效)
949
- * @param {string} [options.thousandsSeparator=','] - 千分位分隔符(始终生效)
950
- * @param {string} [options.decimalSeparator='.'] - 小数点符号
951
- * @returns {string}
952
- *
953
- * @example
954
- * // 默认:保留原始小数
955
- * formatNumber(0.2); // "0.2"
956
- * formatNumber("0.2000"); // "0.2000"
957
- *
958
- * // 启用定点精度处理
959
- * formatNumber(0.2, { fixed: true }); // "0.20"
960
- * formatNumber("123.456", { fixed: true, digits: 1 }); // "123.5"
961
- * formatNumber(1000, { fixed: true, digits: 0 }); // "1,000"
962
- */
963
- function formatNumber(value, options = {}) {
964
- if (value === null || value === undefined || value === "") {
965
- return "";
966
- }
967
-
968
- const {
969
- fixed = false,
970
- digits = 2,
971
- thousandsSeparator = ",",
972
- decimalSeparator = ".",
973
- } = options;
974
-
975
- const isNumber = typeof value === "number";
976
- let str = String(value).trim();
977
-
978
- // Normalize ".123" → "0.123"
979
- if (str.charCodeAt(0) === 46) {
980
- str = "0" + str;
981
- } else if (str.startsWith("-.")) {
982
- str = "-0." + str.slice(2);
983
- }
984
-
985
- let intPart, decPart, isNegative;
986
-
987
- if (fixed) {
988
- // ✅ 启用精度处理:toFixed + 补零
989
- const num = isNumber ? value : parseFloat(str);
990
- if (num !== num) return str;
991
-
992
- const fixedStr = num.toFixed(digits);
993
- const dotIndex = fixedStr.indexOf(".");
994
- intPart = dotIndex === -1 ? fixedStr : fixedStr.slice(0, dotIndex);
995
- decPart = dotIndex === -1 ? "" : fixedStr.slice(dotIndex + 1);
996
- isNegative = intPart.charCodeAt(0) === 45;
997
- if (isNegative) intPart = intPart.slice(1);
998
- } else {
999
- // 保留原始小数
1000
- let s = str;
1001
- isNegative = s.charCodeAt(0) === 45;
1002
- if (isNegative) s = s.slice(1);
1003
-
1004
- const dotIndex = s.indexOf(".");
1005
- intPart = dotIndex === -1 ? s : s.slice(0, dotIndex);
1006
- decPart = dotIndex === -1 ? "" : s.slice(dotIndex + 1);
1007
-
1008
- if (intPart === "") intPart = "0";
1009
- if (!/^\d+$/.test(intPart)) return str;
1010
- }
1011
-
1012
- // 千分位(始终应用)
1013
- let fmtInt = intPart;
1014
- if (intPart !== "0") {
1015
- let out = "";
1016
- for (let i = intPart.length - 1, c = 0; i >= 0; i--, c++) {
1017
- if (c > 0 && c % 3 === 0) out = thousandsSeparator + out;
1018
- out = intPart[i] + out;
1019
- }
1020
- fmtInt = out;
1021
- }
1022
-
1023
- // 拼接
1024
- let result = isNegative ? "-" + fmtInt : fmtInt;
1025
- if (decPart) {
1026
- result += decimalSeparator + decPart;
1027
- } else if (fixed && digits > 0) {
1028
- result += decimalSeparator + "0".repeat(digits);
1029
- }
1030
-
1031
- return result;
1032
- }
1033
- Vue.prototype.$formatNumber = formatNumber;
1034
-
1035
- /**
1036
- * 生成一个符合 RFC4122 标准的随机 UUID (v4)
1037
- * @returns {string} 格式为 "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx" 的 UUID 字符串
1038
- */
1039
- function generateUUID() {
1040
- const buf = new Uint8Array(16);
1041
- crypto.getRandomValues(buf);
1042
- buf[6] = (buf[6] & 0x0f) | 0x40; // version 4
1043
- buf[8] = (buf[8] & 0x3f) | 0x80; // variant RFC4122
1044
- const hex = Array.from(buf, (b) => b.toString(16).padStart(2, "0")).join(
1045
- ""
1046
- );
1047
- return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(
1048
- 12,
1049
- 16
1050
- )}-${hex.slice(16, 20)}-${hex.slice(20)}`;
1051
- }
1052
- Vue.prototype.$generateUUID = generateUUID;
1053
-
1054
- //数字精确位数
1055
- Vue.prototype.$currency = function (value, priceScale, priceRoundType) {
1056
- if (value !== null && value !== undefined) {
1057
- if (priceScale === null || priceScale === undefined) {
1058
- priceScale = 2;
1059
- }
1060
- if (priceRoundType === null || priceRoundType === undefined) {
1061
- priceRoundType = "roundHalfUp";
1062
- }
1063
- let price;
1064
- if (priceRoundType === "roundHalfUp") {
1065
- price = (
1066
- Math.round(value * Math.pow(10, priceScale)) /
1067
- Math.pow(10, priceScale)
1068
- ).toFixed(priceScale);
1069
- } else if (priceRoundType === "roundUp") {
1070
- price = (
1071
- Math.ceil(value * Math.pow(10, priceScale)) / Math.pow(10, priceScale)
1072
- ).toFixed(priceScale);
1073
- } else {
1074
- price = (
1075
- Math.floor(value * Math.pow(10, priceScale)) /
1076
- Math.pow(10, priceScale)
1077
- ).toFixed(priceScale);
1078
- }
1079
- return price;
1080
- }
1081
- };
1082
-
1083
- Vue.prototype.$getBaseDicts = async function (option) {
1084
- let isLoading = option.isLoading || false;
1085
- return this.$http({
1086
- url: USER_PREFIX + "/common_attribute/listItems",
1087
- method: `post`,
1088
- data: {
1089
- code: option.code,
1090
- enabled: true,
1091
- forCompany: true,
1092
- ...option.data,
1093
- },
1094
- isLoading: isLoading,
1095
- modalStrictly: true,
1096
- success: (res) => {
1097
- let dicts = res.objx || [];
1098
- let dictMap = {};
1099
- for (let item of dicts) {
1100
- dictMap[item.sn] = item.value;
1101
- }
1102
- /* dicts.forEach((item) => {
1103
- dictMap[item.sn] = item.value;
1104
- }); */
1105
- option.success &&
1106
- option.success({
1107
- dicts,
1108
- dictMap,
1109
- });
1110
- },
1111
- });
1112
- };
1113
-
1114
- imFun.Form.methods.$baseValidate = function (callback, opt) {
1115
- let that = this;
1116
- that.validate((valid, obj, c, d) => {
1117
- if (!valid && (!opt || opt.errorTip !== false)) {
1118
- this.$message({
1119
- message: this.$t2("必填项不能为空", "system.message.required"),
1120
- type: "error",
1121
- duration: 2000,
1122
- });
1123
- }
1124
- scrollToFirstError(that);
1125
- callback(valid, obj);
1126
- });
1127
- };
1128
-
1129
- function scrollToFirstError(formTarget) {
1130
- // 获取第一个验证失败的字段
1131
- // let formTarget = this.$refs['renderForm'];
1132
- const firstErrorField = Object.keys(formTarget.fields).find((key) => {
1133
- return formTarget.fields[key].validateState === "error";
1134
- });
1135
-
1136
- if (firstErrorField) {
1137
- const field = formTarget.fields[firstErrorField];
1138
-
1139
- let dom = field.$el;
1140
- if (dom) {
1141
- // 滚动到该字段位置
1142
- dom.scrollIntoView({
1143
- behavior: "smooth",
1144
- block: "center",
1145
- });
1146
-
1147
- // 添加高亮效果
1148
- dom.classList.add("highlight");
1149
-
1150
- // 3秒后移除高亮效果
1151
- setTimeout(() => {
1152
- dom.classList.remove("highlight");
1153
- }, 3000);
1154
- }
1155
- }
1156
- }
1157
-
1158
- Vue.prototype.$getBillInfo = async function (option) {
1159
- let defaultOption = {
1160
- url: null,
1161
- method: `post`,
1162
- data: {},
1163
- isLoading: true,
1164
- modalStrictly: true,
1165
- success: null,
1166
- };
1167
- let opt = Object.assign({}, defaultOption, option);
1168
- delete opt.wfConfig;
1169
- return this.$http({
1170
- ...opt,
1171
- success: (res, response) => {
1172
- option.success && option.success(res, response);
1173
- },
1174
- });
1175
- };
1176
-
1177
- Vue.prototype.$downloadByFileWhole = function (fileWhole, fileName) {
1178
- let that = this;
1179
- if (!fileWhole) {
1180
- this.$baseAlert("凭证信息不存在");
1181
- return;
1182
- }
1183
- let getDownloadDomian = function (callback) {
1184
- that.$http({
1185
- method: "post",
1186
- url: USER_PREFIX + "/common/fileDownloadUrl",
1187
- data: {},
1188
- isLoading: true,
1189
- success: (res) => {
1190
- callback(res.objx);
1191
- },
1192
- });
1193
- };
1194
- getDownloadDomian((domain) => {
1195
- if (fileName) {
1196
- fileWhole.fileName = fileName;
1197
- }
1198
- that.$http({
1199
- method: "post",
1200
- url: domain + "/docfile/download",
1201
- data: fileWhole,
1202
- isLoading: true,
1203
- success: (res) => {
1204
- // window.open(res.objx.url);
1205
- let url = res.objx.url;
1206
- openInNewTab(url);
1207
- },
1208
- });
1209
- });
1210
- };
1211
-
1212
- let isDef = function (value) {
1213
- return value !== undefined && value !== null;
1214
- };
1215
-
1216
- Vue.prototype.$t2 = function (defaultValue, path, values) {
1217
- let that = window.$vueRoot;
1218
- if (!that.hasOwnProperty("_i18n")) {
1219
- return defaultValue;
1220
- }
1221
- const i18n = that.$i18n;
1222
- path = path || defaultValue;
1223
- return i18n.te(path) ? i18n.t(path, values) : defaultValue;
1224
- };
1225
-
1226
- Vue.prototype.$t1 = function (path, values) {
1227
- let that = window.$vueRoot;
1228
- if (!that.hasOwnProperty("_i18n")) {
1229
- return path;
1230
- }
1231
- let lang = that.$i18n.locale;
1232
- const i18n = that.$i18n;
1233
- if (lang === "zh") {
1234
- let val = i18n._t(path, lang, { zh: { [path]: path } }, null, values);
1235
- return val;
1236
- } else {
1237
- if (!i18n.te(path)) {
1238
- return i18n._t(path, lang, { zh: { [path]: path } }, null, values);
1239
- } else {
1240
- return (
1241
- i18n.t(path, values) ||
1242
- i18n._t(path, lang, { zh: { [path]: path } }, null, values)
1243
- );
1244
- }
1245
- }
1246
- };
1247
-
1248
- Vue.prototype.$i18nVal = function (zhValue, enValue) {
1249
- let that = window.$vueRoot;
1250
- if (!that.hasOwnProperty("_i18n")) {
1251
- return zhValue;
1252
- }
1253
- let $i18n = that.$i18n;
1254
- let value = zhValue;
1255
- if ($i18n.locale === "zh") {
1256
- value = zhValue;
1257
- } else if ($i18n.locale === "en") {
1258
- value = enValue;
1259
- }
1260
- return value;
1261
- };
1262
-
1263
- Vue.prototype.$utcToLocal = function (utcTime) {
1264
- if (!utcTime) return utcTime;
1265
- let offsetHours = this.$store.getters.utcTransformOffset; // 时区偏移量,单位:小时
1266
- if (!offsetHours || offsetHours === 0) return utcTime;
1267
- let localTime = moment(utcTime).add(offsetHours, "hours");
1268
- return localTime.format("YYYY-MM-DD HH:mm:ss");
1269
- };
1270
-
1271
- Vue.prototype.$window = window;
1272
- };
1273
-
1274
- window && Object.assign(window, imFun.prefixConfig);
1275
- if (typeof window !== "undefined" && window.Vue) {
1276
- install(window.Vue);
75
+ function reqImg(name) {
76
+ const mod = FILE_ICON_MODULE_MAP[name] || FILE_ICON_MODULE_MAP[FILE_ICON_NAME_MAP.other];
77
+ return assetUrl(mod);
1277
78
  }
1278
-
1279
- export default install;
79
+
80
+ const FILE_ICON_TYPE_MAP = {
81
+ doc: "word",
82
+ docx: "word",
83
+ xls: "excel",
84
+ xlsx: "excel",
85
+ ppt: "ppt",
86
+ pptx: "ppt",
87
+ pdf: "pdf",
88
+ jpg: "picture",
89
+ jpeg: "picture",
90
+ png: "picture",
91
+ gif: "picture",
92
+ mp3: "video",
93
+ mp4: "video",
94
+ mpg: "video",
95
+ mkv: "video",
96
+ rmvb: "video",
97
+ avi: "video",
98
+ mov: "video",
99
+ wav: "audio",
100
+ html: "html",
101
+ htm: "html",
102
+ txt: "txt",
103
+ java: "java",
104
+ vue: "vue",
105
+ ftl: "ftl",
106
+ xml: "xml",
107
+ swf: "flash",
108
+ zip: "zip",
109
+ rar: "zip",
110
+ "7z": "zip",
111
+ // exe: 'exe',
112
+ psd: "psd",
113
+ };
114
+
115
+ let typeList = [
116
+ "doc",
117
+ "docx",
118
+ "xls",
119
+ "xlsx",
120
+ "ppt",
121
+ "pptx",
122
+ "csv",
123
+ "wps",
124
+ "dps",
125
+ "et",
126
+ "ett",
127
+ "wpt",
128
+ "vsd",
129
+ "vsdx",
130
+ "wmf",
131
+ "emf",
132
+ "psd",
133
+ "eps",
134
+ "pdf",
135
+ "xmind",
136
+ "obj",
137
+ "3ds",
138
+ "stl",
139
+ "ply",
140
+ "gltf",
141
+ "glb",
142
+ "off",
143
+ "3dm",
144
+ "fbx",
145
+ "dae",
146
+ "wrl",
147
+ "3mf",
148
+ "ifc",
149
+ "brep",
150
+ "step",
151
+ "iges",
152
+ "fcstd",
153
+ "bim",
154
+ "dwg",
155
+ "dxf",
156
+ "dwf",
157
+ "iges",
158
+ "igs",
159
+ "dwt",
160
+ "dng",
161
+ "ifc",
162
+ "dwfx",
163
+ "stl",
164
+ "cf2",
165
+ "plt",
166
+ "txt",
167
+ "xml",
168
+ "md",
169
+ "java",
170
+ "php",
171
+ "py",
172
+ "js",
173
+ "css",
174
+ "zip",
175
+ "rar",
176
+ "jar",
177
+ "tar",
178
+ "gzip",
179
+ "7z",
180
+ "mp3",
181
+ "wav",
182
+ "mp4",
183
+ "flv",
184
+ "avi",
185
+ "mov",
186
+ "rm",
187
+ "mkv",
188
+ "mpeg",
189
+ "mpg",
190
+ "rmvb",
191
+ "wmv",
192
+ "3gp",
193
+ "swf",
194
+ "drawio",
195
+ "tif",
196
+ "tiff",
197
+ "jfif",
198
+ "webp",
199
+ "tga",
200
+ "svg",
201
+ "vue",
202
+ "ftl",
203
+ ];
204
+
205
+ const accessToken = imFun.store.getters["user/token"];
206
+
207
+ const loadingText = "";
208
+ const messageDuration = 3000;
209
+
210
+ install = (Vue, opts = {}) => {
211
+ /**http请求*/
212
+ let $http = async function (option) {
213
+ option = option || {};
214
+ if (!option.loadingTarget && this.$el) {
215
+ option.loadingTarget = this.$el;
216
+ }
217
+ if (!option.vueTarget) {
218
+ option.vueTarget = this;
219
+ }
220
+ if (option.sync === false) {
221
+ return await imFun.request(option);
222
+ } else {
223
+ return imFun.request(option);
224
+ }
225
+ };
226
+
227
+ Vue.prototype.$commonHttp = function (opts) {
228
+ let defaultOption = {
229
+ addCreateInfo: true,
230
+ queryCreateInfo: window.$vueRoot.$store.getters.queryCreateInfo || "0",
231
+ };
232
+ let option = Object.assign({}, defaultOption, opts);
233
+ if (opts.addCreateInfo === null || opts.addCreateInfo === undefined) {
234
+ option.addCreateInfo = defaultOption.addCreateInfo;
235
+ }
236
+ if (
237
+ opts.queryCreateInfo === null ||
238
+ opts.queryCreateInfo === undefined ||
239
+ opts.queryCreateInfo === true
240
+ ) {
241
+ option.queryCreateInfo = defaultOption.queryCreateInfo;
242
+ }
243
+ if (opts.queryCreateInfo === false) {
244
+ option.queryCreateInfo = "0";
245
+ }
246
+ return this.$http(option);
247
+ };
248
+
249
+ Object.assign($http, imFun.request);
250
+ $http.prototype = imFun.request.prototype;
251
+ Vue.prototype.$http = $http;
252
+
253
+ /* 通用打开菜单/路由:开关开启时以独立标签重复打开,否则按原逻辑跳转
254
+ * 用法:this.$openView('/path') 或 this.$openView({ path, query }[, route]) */
255
+ Vue.prototype.$openView = function (location, route) {
256
+ return openView(this.$router, location, route);
257
+ };
258
+
259
+ /* 全局accessToken */
260
+ Vue.prototype.$baseAccessToken = () => {
261
+ return accessToken || imFun.getToken();
262
+ };
263
+
264
+ /* 全局加载层 */
265
+ Vue.prototype.$baseLoading = function (option) {
266
+ let d = this.$el;
267
+ let loading;
268
+ option = option || {};
269
+ if (!option.index) {
270
+ let opts = {
271
+ lock: true,
272
+ background: "hsla(0,0%,100%,.8)",
273
+ target: d,
274
+ };
275
+ Object.assign(opts, option);
276
+ loading = imFun.Loading.service(opts);
277
+ } else {
278
+ let opts = {
279
+ lock: true,
280
+ spinner: "vab-loading-type" + option.index,
281
+ background: "hsla(0,0%,100%,.8)",
282
+ target: d,
283
+ };
284
+ Object.assign(opts, option);
285
+ loading = imFun.Loading.service(opts);
286
+ }
287
+ return loading;
288
+ };
289
+ /* 全局多彩加载层 */
290
+ Vue.prototype.$baseColorfullLoading = function (index, text) {
291
+ let loading;
292
+ if (!index) {
293
+ loading = imFun.Loading.service({
294
+ lock: true,
295
+ text: text || loadingText,
296
+ spinner: "dots-loader",
297
+ background: "hsla(0,0%,100%,.8)",
298
+ target: this.target,
299
+ fullscreen: true,
300
+ });
301
+ } else {
302
+ switch (index) {
303
+ case 1:
304
+ index = "dots";
305
+ break;
306
+ case 2:
307
+ index = "gauge";
308
+ break;
309
+ case 3:
310
+ index = "inner-circles";
311
+ break;
312
+ case 4:
313
+ index = "plus";
314
+ break;
315
+ }
316
+ loading = imFun.Loading.service({
317
+ lock: true,
318
+ text: text || loadingText,
319
+ spinner: index + "-loader",
320
+ background: "hsla(0,0%,100%,.8)",
321
+ target: this.target,
322
+ });
323
+ }
324
+ return loading;
325
+ };
326
+ /* 全局Message */
327
+ Vue.prototype.$baseMessage = ({ message, type, onClose }) => {
328
+ imFun.Message({
329
+ offset: 60,
330
+ showClose: true,
331
+ message: message,
332
+ type: type,
333
+ dangerouslyUseHTMLString: true,
334
+ duration: messageDuration,
335
+ onClose: onClose,
336
+ });
337
+ };
338
+
339
+ /* 全局Alert */
340
+ Vue.prototype.$baseAlert = function (content, title, callback) {
341
+ imFun.MessageBox.alert(content, title || "提示", {
342
+ confirmButtonText: "确定",
343
+ dangerouslyUseHTMLString: true,
344
+ target: this.$el,
345
+ confirmButtonClass: "icondui",
346
+ customClass: "dialog-style",
347
+ callback: (action) => {
348
+ if (callback) {
349
+ callback();
350
+ }
351
+ },
352
+ });
353
+ };
354
+
355
+ /* 全局Confirm */
356
+ Vue.prototype.$baseConfirm = function (content, title) {
357
+ return imFun.MessageBox.confirm(content, title || "提示", {
358
+ confirmButtonText: "确定",
359
+ cancelButtonText: "取消",
360
+ closeOnClickModal: false,
361
+ type: "warning",
362
+ customClass: "dialog-style",
363
+ cancelButtonClass: "iconguanbi",
364
+ confirmButtonClass: "icondui",
365
+ });
366
+ };
367
+
368
+ /* 全局Notification */
369
+ Vue.prototype.$baseNotify = (message, title, type, position) => {
370
+ imFun.Notification({
371
+ title: title,
372
+ message: message,
373
+ position: position || "top-right",
374
+ type: type || "success",
375
+ duration: messageDuration,
376
+ });
377
+ };
378
+
379
+ /* 全局TableHeight */
380
+ Vue.prototype.$baseTableHeight = (formType) => {
381
+ let height = window.innerHeight;
382
+ let paddingHeight = 400;
383
+ const formHeight = 50;
384
+
385
+ if (true) {
386
+ paddingHeight = 365;
387
+ }
388
+
389
+ if ("number" === typeof formType) {
390
+ height = height - paddingHeight - formHeight * formType;
391
+ } else {
392
+ height = height - paddingHeight;
393
+ }
394
+ return height;
395
+ };
396
+
397
+ /* 全局map图层 */
398
+ Vue.prototype.$baseMap = () => {
399
+ return new maptalks.Map("map", {
400
+ center: [116.41348403785, 39.910843952376],
401
+ zoom: 12,
402
+ minZoom: 1,
403
+ maxZoom: 19,
404
+ spatialReference: {
405
+ projection: "baidu",
406
+ },
407
+ attribution: {
408
+ content: "&copy; vue-admin-beautiful",
409
+ },
410
+ baseLayer: new maptalks.TileLayer("base", {
411
+ cssFilter: "sepia(100%) invert(90%)",
412
+ urlTemplate:
413
+ "http://online{s}.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles=pl&scaler=1&p=1",
414
+ subdomains: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
415
+ attribution:
416
+ '&copy; <a target="_blank" href="http://map.baidu.com">Baidu</a>',
417
+ }),
418
+ });
419
+ };
420
+
421
+ /* 全局lodash */
422
+ Vue.prototype.$baseLodash = imFun.lodash;
423
+ /* 全局事件总线 */
424
+ Vue.prototype.$baseEventBus = new Vue();
425
+ /* 模板里 :src="$assetUrl(require(...))" 用,见 utils/assetUrl.js */
426
+ Vue.prototype.$assetUrl = assetUrl;
427
+
428
+ Vue.prototype.$commonFileUtil = {
429
+ // 文件类型获取与判断接口
430
+ getFileSuffix: function (name) {
431
+ let i = name.lastIndexOf(".");
432
+ if (i < 0) {
433
+ // 默认是文本类型
434
+ return "";
435
+ }
436
+ let suffix = name.substring(i + 1, name.length).toLowerCase();
437
+ return suffix;
438
+ },
439
+ isBinary: function (suffix) {
440
+ if (!suffix || suffix === "") {
441
+ return false;
442
+ }
443
+ let fileTypeMap = {
444
+ bin: true,
445
+ exe: true,
446
+ dll: true,
447
+ so: true,
448
+ lib: true,
449
+ war: true,
450
+ jar: true,
451
+ };
452
+ let type = fileTypeMap[suffix];
453
+ if (undefined === type) {
454
+ return false;
455
+ }
456
+ return true;
457
+ },
458
+ isPicture: function (suffix) {
459
+ if (!suffix || suffix === "") {
460
+ return false;
461
+ }
462
+
463
+ let fileTypeMap = {
464
+ jpg: true,
465
+ jpeg: true,
466
+ png: true,
467
+ gif: true,
468
+ bmp: true,
469
+ mpg: true,
470
+ webp: true,
471
+ };
472
+
473
+ let type = fileTypeMap[suffix];
474
+ if (undefined === type) {
475
+ return false;
476
+ }
477
+
478
+ return true;
479
+ },
480
+ isVideo: function (suffix) {
481
+ if (!suffix || suffix === "") {
482
+ return false;
483
+ }
484
+ let fileTypeMap = {
485
+ avi: true,
486
+ mov: true,
487
+ mpeg: true,
488
+ mpg: true,
489
+ mp4: true,
490
+ rmvb: true,
491
+ asf: true,
492
+ flv: true,
493
+ ogg: true,
494
+ };
495
+
496
+ let type = fileTypeMap[suffix];
497
+ if (undefined === type) {
498
+ return false;
499
+ }
500
+
501
+ return true;
502
+ },
503
+ isText: function (suffix) {
504
+ if (!suffix || suffix === "") {
505
+ return false;
506
+ }
507
+ let fileTypeMap = {
508
+ txt: true,
509
+ log: true,
510
+ md: true,
511
+ py: true,
512
+ java: true,
513
+ cpp: true,
514
+ hpp: true,
515
+ c: true,
516
+ h: true,
517
+ json: true,
518
+ xml: true,
519
+ html: true,
520
+ sql: true,
521
+ js: true,
522
+ css: true,
523
+ jsp: true,
524
+ php: true,
525
+ properties: true,
526
+ conf: true,
527
+ out: true,
528
+ sh: true,
529
+ bat: true,
530
+ msg: true,
531
+ cmake: true,
532
+ yaml: true,
533
+ yml: true,
534
+ };
535
+
536
+ let type = fileTypeMap[suffix];
537
+ if (undefined === type) {
538
+ return false;
539
+ }
540
+
541
+ return true;
542
+ },
543
+ isZip: function (suffix) {
544
+ if (!suffix || suffix === "") {
545
+ return false;
546
+ }
547
+ let fileTypeMap = {
548
+ zip: true,
549
+ war: true,
550
+ rar: true,
551
+ "7z": true,
552
+ gz: true,
553
+ tgz: true,
554
+ xz: true,
555
+ txz: true,
556
+ bz2: true,
557
+ tbz2: true,
558
+ tar: true,
559
+ };
560
+
561
+ let type = fileTypeMap[suffix];
562
+ if (undefined === type) {
563
+ return false;
564
+ }
565
+
566
+ return true;
567
+ },
568
+ isOffice: function (suffix) {
569
+ if (!suffix || suffix === "") {
570
+ return false;
571
+ }
572
+ let fileTypeMap = {
573
+ doc: true,
574
+ docx: true,
575
+ ppt: true,
576
+ pptx: true,
577
+ xls: true,
578
+ xlsx: true,
579
+ };
580
+
581
+ let type = fileTypeMap[suffix];
582
+ if (undefined === type) {
583
+ return false;
584
+ }
585
+
586
+ return true;
587
+ },
588
+ isPdf: function (suffix) {
589
+ if (!suffix || suffix === "") {
590
+ return false;
591
+ }
592
+ let fileTypeMap = {
593
+ pdf: true,
594
+ };
595
+
596
+ let type = fileTypeMap[suffix];
597
+ if (undefined === type) {
598
+ return false;
599
+ }
600
+
601
+ return true;
602
+ },
603
+ isPictureFile: function (fileName) {
604
+ if (!fileName) return false;
605
+ let typeStr = Object.prototype.toString.call(fileName);
606
+ let suffix = null;
607
+ if (typeStr === "[object Object]") {
608
+ suffix = this.getFileSuffix(fileName.name);
609
+ } else {
610
+ suffix = this.getFileSuffix(fileName);
611
+ }
612
+ return this.isPicture(suffix);
613
+ },
614
+ isTextFile: function (fileName) {
615
+ let suffix = this.getFileSuffix(fileName);
616
+ return this.isText(suffix);
617
+ },
618
+ getShowUrl(url, showImagePreview) {
619
+ let index = url.lastIndexOf("/");
620
+ let filename;
621
+ if (index >= 0) {
622
+ filename = url.substring(url.lastIndexOf("/") + 1);
623
+ } else {
624
+ filename = url;
625
+ }
626
+
627
+ if (this.isPictureFile(filename) && showImagePreview !== false) {
628
+ return url;
629
+ } else {
630
+ return this.getFileIconRequire(filename);
631
+ }
632
+ },
633
+ resolveFileIconName: function (name, showType) {
634
+ let iconType = this.getDiyFileIconType(name) || "other";
635
+ if (showType) {
636
+ iconType = showType;
637
+ }
638
+ return FILE_ICON_NAME_MAP[iconType] || FILE_ICON_NAME_MAP.other;
639
+ },
640
+ getFileIconRequire: function (name, showType) {
641
+ return reqImg(this.resolveFileIconName(name, showType));
642
+ },
643
+ getFileIconPath: function (name, showType) {
644
+ return this.getFileIconRequire(name, showType);
645
+ },
646
+ getDiyFileIconType: function (name) {
647
+ let suffix = this.getFileSuffix(name);
648
+ if (suffix === "") {
649
+ // 默认是文本类型
650
+ return "";
651
+ }
652
+
653
+ let iconType = FILE_ICON_TYPE_MAP[suffix];
654
+ if (undefined === iconType) {
655
+ return "";
656
+ }
657
+ return iconType;
658
+ },
659
+ getFileExtension(urlString) {
660
+ if (!urlString) return null;
661
+ const url = new URL(urlString);
662
+ // 获取路径部分,例如 "/images/photo.jpg"
663
+ const pathname = url.pathname;
664
+
665
+ // 使用 lastIndexOf 找到最后一个点的位置
666
+ const lastDotIndex = pathname.lastIndexOf(".");
667
+
668
+ // 如果没有点,或者点在最后一位(即没有后缀),返回空字符串
669
+ if (lastDotIndex === -1 || lastDotIndex === pathname.length - 1) {
670
+ return "";
671
+ }
672
+
673
+ // 截取点之后的部分
674
+ return pathname.slice(lastDotIndex + 1).toLowerCase();
675
+ },
676
+ downloadFile: function () {
677
+ let filePath, name;
678
+ let opts;
679
+ if (typeof arguments[0] === "string") {
680
+ filePath = arguments[0];
681
+ name = arguments[1];
682
+ } else {
683
+ opts = arguments[0];
684
+ filePath = opts.filePath;
685
+ name = opts.name;
686
+ }
687
+ if (filePath) {
688
+ let url = null;
689
+ if (filePath.indexOf("?") >= 0) {
690
+ url = filePath + "&_d=true";
691
+ } else {
692
+ url = filePath + "?_d=true";
693
+ }
694
+ if (name) {
695
+ let fileSuffix = this.getFileExtension(filePath);
696
+ if (fileSuffix && !name.endsWith("." + fileSuffix)) {
697
+ name = name + "." + fileSuffix;
698
+ }
699
+
700
+ url += "&_n=" + encodeURIComponent(name);
701
+ }
702
+ // window.open(url);
703
+ openInNewTab(url);
704
+ }
705
+ },
706
+ isPreviewFile(fileName) {
707
+ let fileSuffix = this.getFileSuffix(fileName);
708
+ return typeList.includes(fileSuffix);
709
+ },
710
+ };
711
+
712
+ Vue.prototype.$openFilePreview = function () {
713
+ let filePath;
714
+ let opts;
715
+ if (typeof arguments[0] === "string") {
716
+ filePath = arguments[0];
717
+ } else {
718
+ let attachment = arguments[0];
719
+ filePath = attachment.domain + attachment.url;
720
+ }
721
+ let fileSuffix = this.$commonFileUtil.getFileSuffix(filePath);
722
+ if (!typeList.includes(fileSuffix)) {
723
+ return;
724
+ }
725
+
726
+ this.$http({
727
+ url: USER_PREFIX + "/sf_common/getFilePreviewUrl",
728
+ method: `post`,
729
+ data: {
730
+ url: filePath,
731
+ },
732
+ isLoading: true,
733
+ success: (res) => {
734
+ if (res.objx) {
735
+ openInNewTab(res.objx);
736
+ }
737
+ },
738
+ });
739
+ };
740
+
741
+ function openInNewTab(url) {
742
+ if (!url) return;
743
+ let a = document.createElement("a");
744
+ a.href = url;
745
+ a.target = "_blank";
746
+ document.body.appendChild(a);
747
+ a.click();
748
+ document.body.removeChild(a);
749
+ }
750
+
751
+ Vue.prototype.$getFilePreviewUrl = async function (obj, callback) {
752
+ let filePath;
753
+ let opts;
754
+ if (typeof obj === "string") {
755
+ filePath = obj;
756
+ } else {
757
+ let attachment = obj;
758
+ filePath = attachment.domain + attachment.url;
759
+ }
760
+ let fileSuffix = this.$commonFileUtil.getFileSuffix(filePath);
761
+ /*if (!typeList.includes(fileSuffix)) {
762
+ return;
763
+ }*/
764
+
765
+ return this.$http({
766
+ url: USER_PREFIX + "/sf_common/getFilePreviewUrl",
767
+ method: `post`,
768
+ data: {
769
+ url: filePath,
770
+ },
771
+ isLoading: true,
772
+ success: (res) => {
773
+ callback && callback(res.objx);
774
+ },
775
+ });
776
+ };
777
+
778
+ Vue.prototype.$baseFilePreview = function (attachment, index) {
779
+ let that = this;
780
+ let openImagePreView = function (attachments, index) {
781
+ let pictureIndex = -1;
782
+ let pictureDtoList = [];
783
+ index = index || 0;
784
+ attachments.forEach((item, i) => {
785
+ let typeStr = Object.prototype.toString.call(item);
786
+ if (typeStr === "[object Object]") {
787
+ if (that.$commonFileUtil.isPictureFile(item.url)) {
788
+ if (i <= index) {
789
+ pictureIndex++;
790
+ }
791
+ pictureDtoList.push(item.domain + item.url);
792
+ }
793
+ } else {
794
+ if (that.$commonFileUtil.isPictureFile(item)) {
795
+ if (i <= index) {
796
+ pictureIndex++;
797
+ }
798
+ pictureDtoList.push(item);
799
+ }
800
+ }
801
+ });
802
+
803
+ let a = Vue.extend(ElImageViewer);
804
+ let instance = new a({
805
+ propsData: {
806
+ onClose: () => {
807
+ dom.remove();
808
+ },
809
+ initialIndex: pictureIndex,
810
+ urlList: pictureDtoList,
811
+ },
812
+ });
813
+ let dom = instance.$mount().$el;
814
+ document.body.append(dom);
815
+ };
816
+ let openPreview = function (attachment, index) {
817
+ if (Array.isArray(attachment)) {
818
+ let currentFile = attachment[index];
819
+ let typeStr = Object.prototype.toString.call(currentFile);
820
+ let url =
821
+ typeStr === "[object Object]"
822
+ ? currentFile.domain + currentFile.url
823
+ : currentFile;
824
+ if (that.$commonFileUtil.isPictureFile(url)) {
825
+ openImagePreView(attachment, index);
826
+ } else if (that.$commonFileUtil.isPreviewFile(url)) {
827
+ that.$openFilePreview(url);
828
+ }
829
+ } else {
830
+ let typeStr = Object.prototype.toString.call(attachment);
831
+ let url =
832
+ typeStr === "[object Object]"
833
+ ? attachment.domain + attachment.url
834
+ : attachment;
835
+ if (that.$commonFileUtil.isPictureFile(url)) {
836
+ openImagePreView([url], 0);
837
+ } else if (that.$commonFileUtil.isPreviewFile(url)) {
838
+ that.$openFilePreview(url);
839
+ }
840
+ }
841
+ };
842
+ openPreview(attachment, index);
843
+ };
844
+
845
+ Vue.prototype.$openEditView = function (key) {
846
+ this[key] = false;
847
+ setTimeout(() => {
848
+ this[key] = true;
849
+ }, 200);
850
+ };
851
+
852
+ Vue.prototype.$baseReload = function (param) {
853
+ this.$emit("reload", this, param);
854
+ };
855
+
856
+ Vue.prototype.$reloadHandle = function (target, param) {
857
+ let visibleKey = target.$attrs["visible-key"] || "showEdit";
858
+ let parentTarget = target.$attrs["parent-target"] || target.$parent;
859
+ let originTarget = parentTarget.$refs._viewDialog ? parentTarget : target;
860
+ let updateParam =
861
+ param !== null &&
862
+ param !== undefined &&
863
+ param.updateParam !== null &&
864
+ param.updateParam !== undefined
865
+ ? param.updateParam
866
+ : {};
867
+ for (let key in updateParam) {
868
+ originTarget.$emit("update:" + key, updateParam[key]);
869
+ }
870
+ parentTarget[visibleKey] = false;
871
+ return new Promise((resolve) => {
872
+ setTimeout(() => {
873
+ parentTarget[visibleKey] = true;
874
+ parentTarget.$nextTick(resolve);
875
+ }, 200);
876
+ });
877
+ };
878
+
879
+ Vue.prototype.$baseStartPickerOptions = function (value, type) {
880
+ return {
881
+ disabledDate: (time) => {
882
+ if (value !== null && value !== undefined && value !== "") {
883
+ let date = new Date(value.replace(/-/g, "/"));
884
+ if (!type || type === "date") {
885
+ date.setDate(date.getDate() + 1);
886
+ return time.getTime() >= date.getTime();
887
+ } else if (type === "year") {
888
+ return time.getYear() > date.getYear();
889
+ } else if (type === "month") {
890
+ date.setMonth(date.getMonth() + 1);
891
+ return time.getTime() >= date.getTime();
892
+ }
893
+ } else {
894
+ return false;
895
+ }
896
+ },
897
+ };
898
+ };
899
+
900
+ Vue.prototype.$baseEndPickerOptions = function (value, format) {
901
+ return {
902
+ disabledDate: (time) => {
903
+ if (value !== null && value !== undefined && value !== "") {
904
+ let date = new Date(value.replace(/-/g, "/"));
905
+ return time.getTime() < date.getTime();
906
+ } else {
907
+ return false;
908
+ }
909
+ },
910
+ };
911
+ };
912
+
913
+ //除法
914
+ function baseDiv() {
915
+ let value = 0;
916
+ if (arguments.length) {
917
+ value = arguments[0];
918
+ for (let i = 1; i < arguments.length; i++) {
919
+ value = XEUtils.divide(value, arguments[i]);
920
+ }
921
+ }
922
+ return value;
923
+ }
924
+
925
+ //乘法
926
+ function baseMul() {
927
+ let value = 0;
928
+ if (arguments.length) {
929
+ value = arguments[0];
930
+ for (let i = 1; i < arguments.length; i++) {
931
+ value = XEUtils.multiply(value, arguments[i]);
932
+ }
933
+ }
934
+ return value;
935
+ }
936
+
937
+ //加法
938
+ function baseAdd() {
939
+ let value = 0;
940
+ if (arguments.length) {
941
+ value = arguments[0];
942
+ for (let i = 1; i < arguments.length; i++) {
943
+ value = XEUtils.add(value, arguments[i]);
944
+ }
945
+ }
946
+ return value;
947
+ }
948
+
949
+ //减法
950
+ function baseSub() {
951
+ let value = 0;
952
+ if (arguments.length) {
953
+ value = arguments[0];
954
+ for (let i = 1; i < arguments.length; i++) {
955
+ value = XEUtils.subtract(value, arguments[i]);
956
+ }
957
+ }
958
+ return value;
959
+ }
960
+
961
+ Vue.prototype.$baseAdd = baseAdd;
962
+ Vue.prototype.$baseSub = baseSub;
963
+ Vue.prototype.$baseMul = baseMul;
964
+ Vue.prototype.$baseDiv = baseDiv;
965
+
966
+ /**
967
+ * 格式化数字为带千分位的字符串。
968
+ *
969
+ * @param {string | number} value - 输入值
970
+ * @param {Object} [options={}] - 配置
971
+ * @param {boolean} [options.fixed=false] -
972
+ * - `true`: 启用定点精度处理 —— 使用 toFixed(digits) 四舍五入并补零到指定小数位。
973
+ * - `false`(默认): 保留原始小数形式(不四舍五入、不补零、保留尾随零)。
974
+ * @param {number} [options.digits=2] - 小数位数(仅在 fixed: true 时生效)
975
+ * @param {string} [options.thousandsSeparator=','] - 千分位分隔符(始终生效)
976
+ * @param {string} [options.decimalSeparator='.'] - 小数点符号
977
+ * @returns {string}
978
+ *
979
+ * @example
980
+ * // 默认:保留原始小数
981
+ * formatNumber(0.2); // "0.2"
982
+ * formatNumber("0.2000"); // "0.2000"
983
+ *
984
+ * // 启用定点精度处理
985
+ * formatNumber(0.2, { fixed: true }); // "0.20"
986
+ * formatNumber("123.456", { fixed: true, digits: 1 }); // "123.5"
987
+ * formatNumber(1000, { fixed: true, digits: 0 }); // "1,000"
988
+ */
989
+ function formatNumber(value, options = {}) {
990
+ if (value === null || value === undefined || value === "") {
991
+ return "";
992
+ }
993
+
994
+ const {
995
+ fixed = false,
996
+ digits = 2,
997
+ thousandsSeparator = ",",
998
+ decimalSeparator = ".",
999
+ } = options;
1000
+
1001
+ const isNumber = typeof value === "number";
1002
+ let str = String(value).trim();
1003
+
1004
+ // Normalize ".123" → "0.123"
1005
+ if (str.charCodeAt(0) === 46) {
1006
+ str = "0" + str;
1007
+ } else if (str.startsWith("-.")) {
1008
+ str = "-0." + str.slice(2);
1009
+ }
1010
+
1011
+ let intPart, decPart, isNegative;
1012
+
1013
+ if (fixed) {
1014
+ // ✅ 启用精度处理:toFixed + 补零
1015
+ const num = isNumber ? value : parseFloat(str);
1016
+ if (num !== num) return str;
1017
+
1018
+ const fixedStr = num.toFixed(digits);
1019
+ const dotIndex = fixedStr.indexOf(".");
1020
+ intPart = dotIndex === -1 ? fixedStr : fixedStr.slice(0, dotIndex);
1021
+ decPart = dotIndex === -1 ? "" : fixedStr.slice(dotIndex + 1);
1022
+ isNegative = intPart.charCodeAt(0) === 45;
1023
+ if (isNegative) intPart = intPart.slice(1);
1024
+ } else {
1025
+ // 保留原始小数
1026
+ let s = str;
1027
+ isNegative = s.charCodeAt(0) === 45;
1028
+ if (isNegative) s = s.slice(1);
1029
+
1030
+ const dotIndex = s.indexOf(".");
1031
+ intPart = dotIndex === -1 ? s : s.slice(0, dotIndex);
1032
+ decPart = dotIndex === -1 ? "" : s.slice(dotIndex + 1);
1033
+
1034
+ if (intPart === "") intPart = "0";
1035
+ if (!/^\d+$/.test(intPart)) return str;
1036
+ }
1037
+
1038
+ // 千分位(始终应用)
1039
+ let fmtInt = intPart;
1040
+ if (intPart !== "0") {
1041
+ let out = "";
1042
+ for (let i = intPart.length - 1, c = 0; i >= 0; i--, c++) {
1043
+ if (c > 0 && c % 3 === 0) out = thousandsSeparator + out;
1044
+ out = intPart[i] + out;
1045
+ }
1046
+ fmtInt = out;
1047
+ }
1048
+
1049
+ // 拼接
1050
+ let result = isNegative ? "-" + fmtInt : fmtInt;
1051
+ if (decPart) {
1052
+ result += decimalSeparator + decPart;
1053
+ } else if (fixed && digits > 0) {
1054
+ result += decimalSeparator + "0".repeat(digits);
1055
+ }
1056
+
1057
+ return result;
1058
+ }
1059
+ Vue.prototype.$formatNumber = formatNumber;
1060
+
1061
+ /**
1062
+ * 生成一个符合 RFC4122 标准的随机 UUID (v4)
1063
+ * @returns {string} 格式为 "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx" 的 UUID 字符串
1064
+ */
1065
+ function generateUUID() {
1066
+ const buf = new Uint8Array(16);
1067
+ crypto.getRandomValues(buf);
1068
+ buf[6] = (buf[6] & 0x0f) | 0x40; // version 4
1069
+ buf[8] = (buf[8] & 0x3f) | 0x80; // variant RFC4122
1070
+ const hex = Array.from(buf, (b) => b.toString(16).padStart(2, "0")).join(
1071
+ ""
1072
+ );
1073
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(
1074
+ 12,
1075
+ 16
1076
+ )}-${hex.slice(16, 20)}-${hex.slice(20)}`;
1077
+ }
1078
+ Vue.prototype.$generateUUID = generateUUID;
1079
+
1080
+ //数字精确位数
1081
+ Vue.prototype.$currency = function (value, priceScale, priceRoundType) {
1082
+ if (value !== null && value !== undefined) {
1083
+ if (priceScale === null || priceScale === undefined) {
1084
+ priceScale = 2;
1085
+ }
1086
+ if (priceRoundType === null || priceRoundType === undefined) {
1087
+ priceRoundType = "roundHalfUp";
1088
+ }
1089
+ let price;
1090
+ if (priceRoundType === "roundHalfUp") {
1091
+ price = (
1092
+ Math.round(value * Math.pow(10, priceScale)) /
1093
+ Math.pow(10, priceScale)
1094
+ ).toFixed(priceScale);
1095
+ } else if (priceRoundType === "roundUp") {
1096
+ price = (
1097
+ Math.ceil(value * Math.pow(10, priceScale)) / Math.pow(10, priceScale)
1098
+ ).toFixed(priceScale);
1099
+ } else {
1100
+ price = (
1101
+ Math.floor(value * Math.pow(10, priceScale)) /
1102
+ Math.pow(10, priceScale)
1103
+ ).toFixed(priceScale);
1104
+ }
1105
+ return price;
1106
+ }
1107
+ };
1108
+
1109
+ Vue.prototype.$getBaseDicts = async function (option) {
1110
+ let isLoading = option.isLoading || false;
1111
+ return this.$http({
1112
+ url: USER_PREFIX + "/common_attribute/listItems",
1113
+ method: `post`,
1114
+ data: {
1115
+ code: option.code,
1116
+ enabled: true,
1117
+ forCompany: true,
1118
+ ...option.data,
1119
+ },
1120
+ isLoading: isLoading,
1121
+ modalStrictly: true,
1122
+ success: (res) => {
1123
+ let dicts = res.objx || [];
1124
+ let dictMap = {};
1125
+ for (let item of dicts) {
1126
+ dictMap[item.sn] = item.value;
1127
+ }
1128
+ /* dicts.forEach((item) => {
1129
+ dictMap[item.sn] = item.value;
1130
+ }); */
1131
+ option.success &&
1132
+ option.success({
1133
+ dicts,
1134
+ dictMap,
1135
+ });
1136
+ },
1137
+ });
1138
+ };
1139
+
1140
+ imFun.Form.methods.$baseValidate = function (callback, opt) {
1141
+ let that = this;
1142
+ that.validate((valid, obj, c, d) => {
1143
+ if (!valid && (!opt || opt.errorTip !== false)) {
1144
+ this.$message({
1145
+ message: this.$t2("必填项不能为空", "system.message.required"),
1146
+ type: "error",
1147
+ duration: 2000,
1148
+ });
1149
+ }
1150
+ scrollToFirstError(that);
1151
+ callback(valid, obj);
1152
+ });
1153
+ };
1154
+
1155
+ function scrollToFirstError(formTarget) {
1156
+ // 获取第一个验证失败的字段
1157
+ // let formTarget = this.$refs['renderForm'];
1158
+ const firstErrorField = Object.keys(formTarget.fields).find((key) => {
1159
+ return formTarget.fields[key].validateState === "error";
1160
+ });
1161
+
1162
+ if (firstErrorField) {
1163
+ const field = formTarget.fields[firstErrorField];
1164
+
1165
+ let dom = field.$el;
1166
+ if (dom) {
1167
+ // 滚动到该字段位置
1168
+ dom.scrollIntoView({
1169
+ behavior: "smooth",
1170
+ block: "center",
1171
+ });
1172
+
1173
+ // 添加高亮效果
1174
+ dom.classList.add("highlight");
1175
+
1176
+ // 3秒后移除高亮效果
1177
+ setTimeout(() => {
1178
+ dom.classList.remove("highlight");
1179
+ }, 3000);
1180
+ }
1181
+ }
1182
+ }
1183
+
1184
+ Vue.prototype.$getBillInfo = async function (option) {
1185
+ let defaultOption = {
1186
+ url: null,
1187
+ method: `post`,
1188
+ data: {},
1189
+ isLoading: true,
1190
+ modalStrictly: true,
1191
+ success: null,
1192
+ };
1193
+ let opt = Object.assign({}, defaultOption, option);
1194
+ delete opt.wfConfig;
1195
+ return this.$http({
1196
+ ...opt,
1197
+ success: (res, response) => {
1198
+ option.success && option.success(res, response);
1199
+ },
1200
+ });
1201
+ };
1202
+
1203
+ Vue.prototype.$downloadByFileWhole = function (fileWhole, fileName) {
1204
+ let that = this;
1205
+ if (!fileWhole) {
1206
+ this.$baseAlert("凭证信息不存在");
1207
+ return;
1208
+ }
1209
+ let getDownloadDomian = function (callback) {
1210
+ that.$http({
1211
+ method: "post",
1212
+ url: USER_PREFIX + "/common/fileDownloadUrl",
1213
+ data: {},
1214
+ isLoading: true,
1215
+ success: (res) => {
1216
+ callback(res.objx);
1217
+ },
1218
+ });
1219
+ };
1220
+ getDownloadDomian((domain) => {
1221
+ if (fileName) {
1222
+ fileWhole.fileName = fileName;
1223
+ }
1224
+ that.$http({
1225
+ method: "post",
1226
+ url: domain + "/docfile/download",
1227
+ data: fileWhole,
1228
+ isLoading: true,
1229
+ success: (res) => {
1230
+ // window.open(res.objx.url);
1231
+ let url = res.objx.url;
1232
+ openInNewTab(url);
1233
+ },
1234
+ });
1235
+ });
1236
+ };
1237
+
1238
+ let isDef = function (value) {
1239
+ return value !== undefined && value !== null;
1240
+ };
1241
+
1242
+ Vue.prototype.$t2 = function (defaultValue, path, values) {
1243
+ let that = window.$vueRoot;
1244
+ if (!that.hasOwnProperty("_i18n")) {
1245
+ return defaultValue;
1246
+ }
1247
+ const i18n = that.$i18n;
1248
+ path = path || defaultValue;
1249
+ return i18n.te(path) ? i18n.t(path, values) : defaultValue;
1250
+ };
1251
+
1252
+ Vue.prototype.$t1 = function (path, values) {
1253
+ let that = window.$vueRoot;
1254
+ if (!that.hasOwnProperty("_i18n")) {
1255
+ return path;
1256
+ }
1257
+ let lang = that.$i18n.locale;
1258
+ const i18n = that.$i18n;
1259
+ if (lang === "zh") {
1260
+ let val = i18n._t(path, lang, { zh: { [path]: path } }, null, values);
1261
+ return val;
1262
+ } else {
1263
+ if (!i18n.te(path)) {
1264
+ return i18n._t(path, lang, { zh: { [path]: path } }, null, values);
1265
+ } else {
1266
+ return (
1267
+ i18n.t(path, values) ||
1268
+ i18n._t(path, lang, { zh: { [path]: path } }, null, values)
1269
+ );
1270
+ }
1271
+ }
1272
+ };
1273
+
1274
+ Vue.prototype.$i18nVal = function (zhValue, enValue) {
1275
+ let that = window.$vueRoot;
1276
+ if (!that.hasOwnProperty("_i18n")) {
1277
+ return zhValue;
1278
+ }
1279
+ let $i18n = that.$i18n;
1280
+ let value = zhValue;
1281
+ if ($i18n.locale === "zh") {
1282
+ value = zhValue;
1283
+ } else if ($i18n.locale === "en") {
1284
+ value = enValue;
1285
+ }
1286
+ return value;
1287
+ };
1288
+
1289
+ Vue.prototype.$utcToLocal = function (utcTime) {
1290
+ if (!utcTime) return utcTime;
1291
+ let offsetHours = this.$store.getters.utcTransformOffset; // 时区偏移量,单位:小时
1292
+ if (!offsetHours || offsetHours === 0) return utcTime;
1293
+ let localTime = moment(utcTime).add(offsetHours, "hours");
1294
+ return localTime.format("YYYY-MM-DD HH:mm:ss");
1295
+ };
1296
+
1297
+ Vue.prototype.$window = window;
1298
+ };
1299
+
1300
+ window && Object.assign(window, imFun.prefixConfig);
1301
+ if (typeof window !== "undefined" && window.Vue) {
1302
+ install(window.Vue);
1303
+ }
1304
+
1305
+ export default install;