cloud-web-corejs 1.1.0-dev.5 → 1.1.0-dev.51

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