cloud-web-corejs 1.0.258 → 1.0.259

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 (248) hide show
  1. package/package.json +32 -25
  2. package/src/components/VabUpload/fileLibraryDialog.vue +296 -0
  3. package/src/components/VabUpload/index.js +22 -2
  4. package/src/components/VabUpload/index.vue +242 -231
  5. package/src/components/VabUpload/mixins/fileLibraryDialog.js +1112 -0
  6. package/src/components/VabUpload/mixins.js +1971 -1829
  7. package/src/components/VabUpload/privateProfileDialog.vue +2 -2
  8. package/src/components/baseArea/index.vue +1628 -0
  9. package/src/components/baseInputExport/mixins.js +48 -31
  10. package/src/components/baseInputNumber/index.vue +9 -9
  11. package/src/components/baseTabs/index.vue +16 -8
  12. package/src/components/code-editor/async.js +29 -0
  13. package/src/components/code-editor/index.vue +93 -4
  14. package/src/components/errorMsg/index.js +10 -9
  15. package/src/components/errorMsg/mixins.js +25 -23
  16. package/src/components/excelExport/exportFieldDialog.vue +40 -18
  17. package/src/components/excelExport/index.js +62 -3
  18. package/src/components/excelExport/index.vue +2 -1
  19. package/src/components/excelExport/mixins.js +496 -340
  20. package/src/components/excelImport/index.js +69 -7
  21. package/src/components/excelImport/mixins.js +841 -9
  22. package/src/components/fileLibrary/categoryMoveDialog.vue +109 -109
  23. package/src/components/fileLibrary/fileHistoryDialog.vue +1 -1
  24. package/src/components/fileLibrary/fileObjAuthDialog.vue +297 -298
  25. package/src/components/fileLibrary/fileObjAuthEdit.vue +1 -1
  26. package/src/components/fileLibrary/filterDialog.vue +1 -1
  27. package/src/components/fileLibrary/index.vue +1109 -1110
  28. package/src/components/fileLibrary/mixins/indexMixins.js +10 -0
  29. package/src/components/fileLibrary/propertiesDialog.vue +190 -190
  30. package/src/components/fileLibrary/recycleBinDialog.vue +237 -236
  31. package/src/components/formOplog/mixins.js +85 -80
  32. package/src/components/hiprint/view/design/index.vue +7 -2
  33. package/src/components/jsonImport/exportUtil.js +106 -0
  34. package/src/components/jsonImport/index.js +75 -50
  35. package/src/components/jsonImport/mixins.js +350 -348
  36. package/src/components/langImport/mixins.js +502 -500
  37. package/src/components/micro-view-host/contract.js +66 -0
  38. package/src/components/micro-view-host/index.vue +148 -0
  39. package/src/components/mobile/file/index.vue +10 -0
  40. package/src/components/mobile/wf/mixins/wfModifyDialogMixin.js +51 -47
  41. package/src/components/obsUpload/index.vue +234 -231
  42. package/src/components/obsUpload/mixins.js +1542 -1476
  43. package/src/components/onlineTalk/talkUserDialog.vue +1 -1
  44. package/src/components/table/CellSlot.vue +12 -10
  45. package/src/components/table/config.js +74 -1
  46. package/src/components/table/index.js +1208 -1
  47. package/src/components/table/tableFormMixin.js +285 -1
  48. package/src/components/table/util/index.js +38 -40
  49. package/src/components/table/vxeFilter/index.js +153 -2
  50. package/src/components/table/vxeFilter/mixin.js +305 -3
  51. package/src/components/tempStorage/tempStorageDialog.vue +1 -1
  52. package/src/components/vb-tabs/x-tabs.vue +10 -5
  53. package/src/components/wf/addTaskUserdialog.vue +1 -1
  54. package/src/components/wf/mixins/setCandidateDialog.js +217 -217
  55. package/src/components/wf/mixins/setCandidateDialog2.js +252 -252
  56. package/src/components/wf/wf.js +2224 -2203
  57. package/src/components/wf/wfUtil.js +2 -1
  58. package/src/components/xform/docs/2026-08 /345/210/227/350/241/250/345/257/274/345/207/272/350/204/261/346/225/217/345/210/227/345/211/224/351/231/244/350/220/275/345/234/260/346/226/207/346/241/243.md" +173 -0
  59. package/src/components/xform/form-designer/designer.js +1 -0
  60. package/src/components/xform/form-designer/form-widget/container-widget/containerMixin.js +110 -1
  61. package/src/components/xform/form-designer/form-widget/container-widget/data-table-mixin.js +282 -1
  62. package/src/components/xform/form-designer/form-widget/field-widget/area-select-widget.vue +272 -0
  63. package/src/components/xform/form-designer/form-widget/field-widget/autocomplete-widget.vue +119 -0
  64. package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +14 -0
  65. package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +18 -73
  66. package/src/components/xform/form-designer/form-widget/field-widget/mixins/autocomplete-mixin.js +451 -0
  67. package/src/components/xform/form-designer/form-widget/field-widget/mixins/date-limit-mixin.js +157 -0
  68. package/src/components/xform/form-designer/form-widget/field-widget/mixins/utc-transform-mixin.js +75 -0
  69. package/src/components/xform/form-designer/form-widget/field-widget/save_submit_wf_button-widget.vue +112 -0
  70. package/src/components/xform/form-designer/form-widget/field-widget/script-input-widget.vue +149 -0
  71. package/src/components/xform/form-designer/form-widget/indexMixin.js +179 -1
  72. package/src/components/xform/form-designer/indexMixin.js +823 -1
  73. package/src/components/xform/form-designer/refMixinDesign.js +27 -1
  74. package/src/components/xform/form-designer/setting-panel/action-button-config-dialog.vue +241 -0
  75. package/src/components/xform/form-designer/setting-panel/form-dynamicField-setting.vue +601 -0
  76. package/src/components/xform/form-designer/setting-panel/form-setting.vue +6 -0
  77. package/src/components/xform/form-designer/setting-panel/index.vue +314 -309
  78. package/src/components/xform/form-designer/setting-panel/indexMixin.js +324 -1
  79. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +8 -7
  80. package/src/components/xform/form-designer/setting-panel/property-editor/container-list-h5/list-h5-editor.vue +8 -7
  81. package/src/components/xform/form-designer/setting-panel/property-editor/container-table/table-dynamicField-editor.vue +344 -0
  82. package/src/components/xform/form-designer/setting-panel/property-editor/dropdownFlag-editor.vue +2 -2
  83. package/src/components/xform/form-designer/setting-panel/property-editor/field-area-select/areaDataType-editor.vue +25 -0
  84. package/src/components/xform/form-designer/setting-panel/property-editor/field-area-select/areaMinLevel-editor.vue +50 -0
  85. package/src/components/xform/form-designer/setting-panel/property-editor/field-area-select/areaName-editor.vue +20 -0
  86. package/src/components/xform/form-designer/setting-panel/property-editor/field-autocomplete/autocomplete-vabSearchName-editor.vue +199 -0
  87. package/src/components/xform/form-designer/setting-panel/property-editor/field-baseAttachment/baseAttachment-fileTypes-editor.vue +23 -0
  88. package/src/components/xform/form-designer/setting-panel/property-editor/field-cascader/showAllLevels-editor.vue +21 -0
  89. package/src/components/xform/form-designer/setting-panel/property-editor/field-date/date-dateLimit-editor.vue +157 -0
  90. package/src/components/xform/form-designer/setting-panel/property-editor/field-script-input/script-input-editor.vue +55 -0
  91. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabUpload/vabUpload-fileTypes-editor.vue +23 -0
  92. package/src/components/xform/form-designer/setting-panel/property-editor/fileTypesEditorMixin.js +116 -0
  93. package/src/components/xform/form-designer/setting-panel/property-editor/fileTypesSelect.vue +176 -0
  94. package/src/components/xform/form-designer/setting-panel/property-editor/textFlag-editor.vue +3 -3
  95. package/src/components/xform/form-designer/setting-panel/property-editor/utcTransformEnabled-editor.vue +19 -0
  96. package/src/components/xform/form-designer/setting-panel/widgetPropertyDialogMixin.js +186 -0
  97. package/src/components/xform/form-designer/toolbar-panel/indexMixin.js +566 -1
  98. package/src/components/xform/form-designer/widget-panel/indexMixin.js +290 -1
  99. package/src/components/xform/form-render/compareDelList.vue +83 -0
  100. package/src/components/xform/form-render/compareView.vue +76 -0
  101. package/src/components/xform/form-render/container-item/containerItemMixin.js +378 -1
  102. package/src/components/xform/form-render/container-item/data-table-mixin.js +35 -0
  103. package/src/components/xform/form-render/container-item/detail-item.vue +41 -0
  104. package/src/components/xform/form-render/container-item/dynamicFieldEngine.js +285 -0
  105. package/src/components/xform/form-render/container-item/dynamicFieldMixin.js +416 -0
  106. package/src/components/xform/form-render/container-item/list-h5-item.vue +12 -0
  107. package/src/components/xform/form-render/dynamicDialogRender.js +195 -1
  108. package/src/components/xform/form-render/dynamicDrawerRender.js +229 -0
  109. package/src/components/xform/form-render/formDynamicFieldMixin.js +131 -0
  110. package/src/components/xform/form-render/refMixin.js +29 -1
  111. package/src/components/xform/mixins/scriptHttp.js +172 -1
  112. package/src/components/xform/utils/dynamicSchemaUtil.js +361 -0
  113. package/src/components/xform/utils/tableCellValidateUtil.js +148 -0
  114. package/src/components/xform/utils/textMaskUtil.js +179 -0
  115. package/src/components/xform/utils/treeTableUtil.js +1265 -0
  116. package/src/components/xform/utils/util.js +1 -0
  117. package/src/components/xform/utils/validators.js +133 -1
  118. package/src/directive/LimitNumber/index.js +143 -124
  119. package/src/microRouter/index.js +447 -0
  120. package/src/mixins/tableTree/index.js +77 -14
  121. package/src/permission.js +132 -107
  122. package/src/public-path.js +38 -0
  123. package/src/router/index.js +3 -3
  124. package/src/store/modules/micro.js +57 -0
  125. package/src/store/modules/permission.js +535 -371
  126. package/src/store/modules/tagsView.js +38 -21
  127. package/src/store/modules/user.js +409 -370
  128. package/src/utils/aes.js +9 -3
  129. package/src/utils/auth.js +1 -1
  130. package/src/utils/componentDialog.js +162 -40
  131. package/src/utils/global.js +35 -34
  132. package/src/utils/index.js +579 -579
  133. package/src/utils/keepAlive.js +8 -4
  134. package/src/utils/lazyPlugin.js +66 -0
  135. package/src/utils/menuAdapter.js +277 -0
  136. package/src/utils/repeatOpen.js +48 -0
  137. package/src/utils/request.js +417 -395
  138. package/src/utils/resolveViewComponent.js +203 -0
  139. package/src/utils/vab.js +14 -3
  140. package/src/utils/validate.js +104 -106
  141. package/src/views/bd/setting/bd_attach_setting/dialog.vue +1 -1
  142. package/src/views/bd/setting/bd_attach_setting/list.vue +1 -1
  143. package/src/views/bd/setting/bd_company_env/dialog.vue +1 -1
  144. package/src/views/bd/setting/bd_company_env/list.vue +1 -1
  145. package/src/views/bd/setting/formVersion/ftHistoryDialog.vue +488 -489
  146. package/src/views/bd/setting/form_import_log/list.vue +1 -1
  147. package/src/views/bd/setting/form_script/dialog.vue +1 -1
  148. package/src/views/bd/setting/form_script/form_list.vue +174 -166
  149. package/src/views/bd/setting/form_script/list.vue +1 -1
  150. package/src/views/bd/setting/form_script/list1.vue +1 -1
  151. package/src/views/bd/setting/form_script/mixins/form_list.js +330 -322
  152. package/src/views/bd/setting/form_template/dialog.vue +1 -1
  153. package/src/views/bd/setting/form_template/formDesignerDialog.vue +172 -171
  154. package/src/views/bd/setting/form_template/ftHistoryDialog.vue +1 -1
  155. package/src/views/bd/setting/form_template/itemList.vue +1 -1
  156. package/src/views/bd/setting/form_template/list.vue +3 -3
  157. package/src/views/bd/setting/form_template/mixins/edit.js +3 -3
  158. package/src/views/bd/setting/form_template/mixins/list.js +3 -3
  159. package/src/views/bd/setting/form_template/mixins/list2.js +3 -3
  160. package/src/views/bd/setting/form_template/mixins/wf_list.js +3 -3
  161. package/src/views/bd/setting/form_template/wfObjConfigDialog.vue +253 -254
  162. package/src/views/bd/setting/form_template/wf_list.vue +3 -3
  163. package/src/views/bd/setting/logic_param/edit.vue +20 -20
  164. package/src/views/bd/setting/logic_param/list.vue +1 -1
  165. package/src/views/bd/setting/menu_kind/dialog.vue +1 -1
  166. package/src/views/bd/setting/menu_kind/list.vue +1 -1
  167. package/src/views/bd/setting/push_data/list.vue +1 -1
  168. package/src/views/bd/setting/push_data_h/list.vue +1 -1
  169. package/src/views/bd/setting/request_async_setting/list.vue +1 -1
  170. package/src/views/bd/setting/request_setting/list.vue +1 -1
  171. package/src/views/bd/setting/table_model/dialog.vue +1 -1
  172. package/src/views/bd/setting/table_model/list.vue +1 -1
  173. package/src/views/bd/setting/table_model/zdDialog.vue +1 -1
  174. package/src/views/user/access_log/list.vue +1 -1
  175. package/src/views/user/access_log/list2.vue +1 -1
  176. package/src/views/user/api_request/list.vue +1 -1
  177. package/src/views/user/area/dialog.vue +1 -1
  178. package/src/views/user/area/list.vue +1 -1
  179. package/src/views/user/bill_setting/list.vue +1 -1
  180. package/src/views/user/bill_setting/userDialog.vue +1 -1
  181. package/src/views/user/code_rules/list.vue +1 -1
  182. package/src/views/user/commMenu/index.vue +2 -2
  183. package/src/views/user/common_attribute/list.vue +2 -2
  184. package/src/views/user/common_script/list.vue +1 -1
  185. package/src/views/user/company_info/dialog.vue +1 -1
  186. package/src/views/user/country/dialog.vue +1 -1
  187. package/src/views/user/country/list.vue +1 -1
  188. package/src/views/user/data_type_setting/dialog.vue +1 -1
  189. package/src/views/user/extend_datasource/dialog.vue +4 -1
  190. package/src/views/user/extend_datasource/edit.vue +2 -1
  191. package/src/views/user/extend_datasource/list.vue +4 -1
  192. package/src/views/user/fieldTranslation/list.vue +1 -1
  193. package/src/views/user/field_values_invisible/list.vue +1 -1
  194. package/src/views/user/file_type/list.vue +1 -1
  195. package/src/views/user/file_view_area/list.vue +1 -1
  196. package/src/views/user/file_view_ins/list.vue +22 -1
  197. package/src/views/user/form/view/list.vue +64 -1
  198. package/src/views/user/groups/dialog.vue +1 -1
  199. package/src/views/user/groups/list.vue +1 -1
  200. package/src/views/user/home/default.vue +2 -2
  201. package/src/views/user/home/default2.vue +1158 -1148
  202. package/src/views/user/home/index.vue +3 -10
  203. package/src/views/user/lang_tag/dialog.vue +1 -1
  204. package/src/views/user/lang_tag/list.vue +1 -1
  205. package/src/views/user/language_setting/list.vue +1 -1
  206. package/src/views/user/login/default.vue +0 -8
  207. package/src/views/user/login/indexMixin.js +547 -556
  208. package/src/views/user/menu/list.vue +25 -2
  209. package/src/views/user/menuFallback/index.vue +123 -0
  210. package/src/views/user/mobile_menu/list.vue +1 -1
  211. package/src/views/user/notify_message/dialog.vue +22 -1
  212. package/src/views/user/notify_message/list.vue +1 -1
  213. package/src/views/user/notify_template/list.vue +1 -1
  214. package/src/views/user/notify_template/list2.vue +1 -1
  215. package/src/views/user/oplog/list.vue +1 -1
  216. package/src/views/user/outLink/form_view.vue +5 -14
  217. package/src/views/user/outLink/index.vue +6 -1
  218. package/src/views/user/outLink/view.vue +5 -13
  219. package/src/views/user/position/dialog.vue +1 -1
  220. package/src/views/user/position/list.vue +1 -1
  221. package/src/views/user/project_tag/dialog.vue +1 -1
  222. package/src/views/user/project_tag/list.vue +1 -1
  223. package/src/views/user/push_setting/list.vue +1 -1
  224. package/src/views/user/request_setting/list.vue +1 -1
  225. package/src/views/user/role/dialog.vue +1 -1
  226. package/src/views/user/role/list.vue +1 -1
  227. package/src/views/user/sale_org/dialog.vue +1 -1
  228. package/src/views/user/sale_org/list.vue +1 -1
  229. package/src/views/user/system_notice/list.vue +1 -1
  230. package/src/views/user/system_parameter/list.vue +1 -1
  231. package/src/views/user/user/dialog.vue +1 -1
  232. package/src/views/user/user/edit.vue +306 -159
  233. package/src/views/user/user/form_dialog.vue +1 -1
  234. package/src/views/user/user/form_list.vue +1 -1
  235. package/src/views/user/user/list.vue +2 -2
  236. package/src/views/user/user_log_classify/list.vue +1 -1
  237. package/src/views/user/wf/iframe/index.vue +6 -1
  238. package/src/views/user/wf/iframe/index2.vue +6 -1
  239. package/src/views/user/wf/wfReport/index.vue +12 -6
  240. package/src/views/user/wf/wf_auto_submit_data/list.vue +2 -2
  241. package/src/views/user/wf/wf_manage/list.vue +97 -24
  242. package/src/views/user/wf/wf_manage/list2.vue +875 -0
  243. package/src/views/user/wf/wf_manage/wfContentDialog.vue +23 -1
  244. package/src/views/user/wf/wf_obj_config/dialog.vue +1 -1
  245. package/src/views/user/wf/wf_obj_config/list.vue +1 -1
  246. package/src/views/user/wf/wf_obj_config/list_form.vue +1 -1
  247. package/src/views/user/wf/wf_transfer_setting/list.vue +1 -1
  248. package/src/views/user/workbench_menu/list.vue +1 -1
@@ -1,16 +1,14 @@
1
1
  /**version-1.0*/
2
2
  let tmixins = {};
3
- import {
4
- getToken
5
- } from '../../utils/auth'
6
- import indexUtil from '../../utils/index.js'
3
+ import { getToken } from "../../utils/auth";
4
+ import indexUtil from "../../utils/index.js";
7
5
  import exportFieldDialog from "./exportFieldDialog.vue";
8
- import {getCellValue} from "@base/components/table/util/index";
6
+ import { getCellValue } from "@base/components/table/util/index";
9
7
 
10
8
  let configUtil = {
11
9
  baseUrl: process.env.VUE_APP_BASE_API,
12
10
  getToken,
13
- indexUtil
11
+ indexUtil,
14
12
  };
15
13
 
16
14
  function getGrid(that, tableRef) {
@@ -24,11 +22,10 @@ function getGrid(that, tableRef) {
24
22
  }
25
23
 
26
24
  (function () {
27
- let exportTimer, exportMtTimer, countTimer;
28
25
  tmixins = {
29
- props: ['param'],
26
+ props: ["param"],
30
27
  components: {
31
- exportFieldDialog
28
+ exportFieldDialog,
32
29
  },
33
30
  data() {
34
31
  return {
@@ -39,11 +36,11 @@ function getGrid(that, tableRef) {
39
36
  tTotalPage: 0,
40
37
  tTotalSize: 0,
41
38
  doneSize: 0,
42
- CURRENT_PREFIX: '',
39
+ CURRENT_PREFIX: "",
43
40
  option: {},
44
- uuid: '',
41
+ uuid: "",
45
42
  fileRows: [],
46
- title: this.$t2('导出', 'components.excelExport.title'),
43
+ title: this.$t2("导出", "components.excelExport.title"),
47
44
  tableTarget: null,
48
45
  showContent: true,
49
46
  percentageNum: 0,
@@ -54,34 +51,33 @@ function getGrid(that, tableRef) {
54
51
  stripe: true,
55
52
  highlightCurrentRow: true,
56
53
  highlightHoverRow: true,
57
- columns: [{
58
- field: 'name',
59
- minWidth: 140,
60
- title: this.$t2('文件名', 'components.excelExport.fileName'),
61
- sortable: true,
62
- slots: {
63
- default: ({
64
- row
65
- }) => {
66
- return row.title + "-" + row.uuid;
67
- }
68
- }
69
- },
54
+ columns: [
55
+ {
56
+ field: "name",
57
+ minWidth: 140,
58
+ title: this.$t2("文件名", "components.excelExport.fileName"),
59
+ sortable: true,
60
+ slots: {
61
+ default: ({ row }) => {
62
+ return row.title + "-" + row.uuid;
63
+ },
64
+ },
65
+ },
70
66
  {
71
- field: 'fileSize',
67
+ field: "fileSize",
72
68
  minWidth: 140,
73
- title: this.$t2('大小', 'components.excelExport.fileSize'),
74
- sortable: true
69
+ title: this.$t2("大小", "components.excelExport.fileSize"),
70
+ sortable: true,
75
71
  },
76
72
  {
77
- field: 'oper',
73
+ field: "oper",
78
74
  width: 140,
79
- fixed: 'right',
80
- title: '',
75
+ fixed: "right",
76
+ title: "",
81
77
  sortable: false,
82
78
  slots: {
83
- default: 'row_edit'
84
- }
79
+ default: "row_edit",
80
+ },
85
81
  },
86
82
  ],
87
83
  },
@@ -89,18 +85,20 @@ function getGrid(that, tableRef) {
89
85
  showExportFieldDialog: false,
90
86
  leafColumns: [],
91
87
  columns: [],
92
- queryParam:{},
93
- isMinimize:false
94
- }
95
- },
96
- created() {
97
-
88
+ queryParam: {},
89
+ isMinimize: false,
90
+ // 定时器必须放实例上:模块级共享会导致并发导出互相清除对方的定时器
91
+ exportTimer: null,
92
+ countTimer: null,
93
+ exportError: false,
94
+ };
98
95
  },
96
+ created() {},
99
97
  mounted() {
100
98
  // this.exc();
101
99
  },
102
100
  beforeDestroy() {
103
- this.clearExportTimer()
101
+ this.clearExportTimer();
104
102
  this.unlockMenu();
105
103
  },
106
104
  methods: {
@@ -108,17 +106,24 @@ function getGrid(that, tableRef) {
108
106
  this.option = this.param;
109
107
  let $grid = getGrid(this.option.vue, this.option.targetRef);
110
108
  let datas = [];
111
- if (this.option.type === "selected" || this.option.type === "exportItem") {
109
+ if (
110
+ this.option.type === "selected" ||
111
+ this.option.type === "exportItem"
112
+ ) {
112
113
  datas = $grid.getCheckboxRecords(true);
113
114
  if (!datas.length) {
114
- this.$baseAlert(this.$t2('请选择导出的数据', 'components.excelExport.warmMsg1'));
115
+ this.$baseAlert(
116
+ this.$t2("请选择导出的数据", "components.excelExport.warmMsg1")
117
+ );
115
118
  this.param.destroyComponent();
116
119
  return;
117
120
  }
118
121
  } else if (this.option.type === "current") {
119
122
  datas = $grid.getTableData().fullData;
120
123
  if (!datas.length) {
121
- this.$baseAlert(this.$t2('不存在可导出的数据', 'components.excelExport.warmMsg2'));
124
+ this.$baseAlert(
125
+ this.$t2("不存在可导出的数据", "components.excelExport.warmMsg2")
126
+ );
122
127
  this.param.destroyComponent();
123
128
  return;
124
129
  }
@@ -126,18 +131,17 @@ function getGrid(that, tableRef) {
126
131
 
127
132
  this.isMinimize = false;
128
133
  this.showExportFieldDialog = true;
129
-
130
134
  },
131
- handleMinimize(){
135
+ handleMinimize() {
132
136
  let result = !this.showImportDialog2;
133
137
  this.isMinimize = !result;
134
- this.showImportDialog2 = result
138
+ this.showImportDialog2 = result;
135
139
  },
136
140
  dialogClose2() {
137
- if(this.isMinimize)return;
141
+ if (this.isMinimize) return;
138
142
  let loadingObj = window.$vueRoot.$baseLoading({
139
143
  target: document.body,
140
- background: 'unset'
144
+ background: "unset",
141
145
  });
142
146
 
143
147
  this.$emit("update:visiable", false);
@@ -147,7 +151,7 @@ function getGrid(that, tableRef) {
147
151
  // this.showContent = false;
148
152
  setTimeout(() => {
149
153
  this.param.destroyComponent(loadingObj);
150
- }, 0)
154
+ }, 0);
151
155
  },
152
156
  dialogPrimary2() {
153
157
  // this.showUserDialog=false
@@ -162,57 +166,76 @@ function getGrid(that, tableRef) {
162
166
 
163
167
  //获取查询条件
164
168
  let originOption = this.tableTarget.params.originOption;
165
- this.queryParam = this.$baseLodash.cloneDeep(originOption.param() || {});
169
+ this.queryParam = this.$baseLodash.cloneDeep(
170
+ originOption.param() || {}
171
+ );
166
172
 
167
173
  let that = this;
168
174
  let options = this.option;
169
- let title = options.title? this.$t1(options.title) : this.$t2('导出', 'components.excelExport.title');
170
- if (!options.prefix && options.prefix !== '') {
175
+ let title = options.title
176
+ ? this.$t1(options.title)
177
+ : this.$t2("导出", "components.excelExport.title");
178
+ if (!options.prefix && options.prefix !== "") {
171
179
  let originOption = this.tableTarget.params.originOption;
172
180
  let path = originOption.exportPath || originOption.path;
173
- let os = path.split("/");
174
- if (path.indexOf("http://") >= 0 || path.indexOf("https://") >= 0) {
175
- options.prefix = "/" + os[3];
176
- } else {
177
- options.prefix = "/" + os[1];
181
+ if (typeof path === "function") path = path();
182
+ if (path && typeof path === "string" && path !== "#") {
183
+ let os = path.split("/");
184
+ if (path.indexOf("http://") >= 0 || path.indexOf("https://") >= 0) {
185
+ options.prefix = "/" + os[3];
186
+ } else {
187
+ options.prefix = "/" + os[1];
188
+ }
178
189
  }
179
190
  }
191
+ if (!options.prefix) {
192
+ this.abortExport(
193
+ this.$t1("无法确定导出服务前缀,请在导出配置中指定 prefix")
194
+ );
195
+ this.unlockMenu();
196
+ return;
197
+ }
180
198
  this.CURRENT_PREFIX = options.prefix;
181
199
 
182
200
  this.title = title;
183
201
  that.tTotalPage = 0;
184
202
  that.tTotalSize = 0;
185
- that.createExcelFile().then(resultMsg => {
186
- if (resultMsg.type === "success") {
187
- let aObj = resultMsg.objx;
188
- that.uuid = aObj.uuid;
189
- that.nowDate = aObj.nowDate;
190
- that.ippaaapp = aObj.ippaaapp;
191
- setTimeout(function () {
192
- /*num = 1;
203
+ that
204
+ .createExcelFile()
205
+ .then((resultMsg) => {
206
+ if (resultMsg.type === "success") {
207
+ let aObj = resultMsg.objx;
208
+ that.uuid = aObj.uuid;
209
+ that.nowDate = aObj.nowDate;
210
+ that.ippaaapp = aObj.ippaaapp;
211
+ setTimeout(function () {
212
+ /*num = 1;
193
213
  loopToDo(0, num);*/
194
- that.handleLoopToDo();
195
- }, 300);
196
- } else {
214
+ that.handleLoopToDo();
215
+ }, 300);
216
+ } else {
217
+ that.abortExport();
218
+ that.showImportDialog = false;
219
+ that.showImportDialog2 = false;
220
+ }
221
+ })
222
+ .catch((error) => {
223
+ console.error(error);
224
+ that.abortExport(that.$t1("创建导出文件失败,导出已中止"));
197
225
  that.showImportDialog = false;
198
226
  that.showImportDialog2 = false;
199
- }
200
- }).catch(error => {
201
- console.error(error);
202
- that.showImportDialog = false;
203
- that.showImportDialog2 = false;
204
- });
227
+ });
205
228
  },
206
229
  getExportPageSize() {
207
- let pageSize = Math.min((this.option.pageSize || 1000), 1000);
230
+ let pageSize = Math.min(this.option.pageSize || 1000, 1000);
208
231
  let showImageAtTable = this.option.showImageAtTable || false;
209
- let hasExportImage = !!this.leafColumns.find(item => {
210
- let exportType = item?.params?.exportType
211
- return exportType === 'Image'
232
+ let hasExportImage = !!this.leafColumns.find((item) => {
233
+ let exportType = item?.params?.exportType;
234
+ return exportType === "Image";
212
235
  });
213
- let hasExportImage2 = !!this.leafColumns.find(item => {
214
- let exportType = item?.params?.exportType
215
- return exportType === 'Image2'
236
+ let hasExportImage2 = !!this.leafColumns.find((item) => {
237
+ let exportType = item?.params?.exportType;
238
+ return exportType === "Image2";
216
239
  });
217
240
  if (hasExportImage || (hasExportImage2 && showImageAtTable)) {
218
241
  pageSize = Math.min(pageSize, 150);
@@ -248,55 +271,61 @@ function getGrid(that, tableRef) {
248
271
  endPage = totalPages;
249
272
  }
250
273
  if (startPage > endPage) {
251
- that.clearExportTimer();
274
+ // 页码越界属异常状态,中止并不再发出非法页码的合并请求
275
+ that.abortExport();
276
+ return;
252
277
  }
253
278
  currentIndex = endPage;
254
279
 
255
- that.mergeExcel(startPage, endPage).then(function (resultMsg3) {
256
- if (resultMsg3.type === "success") {
257
- mtExcedSuccessNum++;
258
- let fileInfo = resultMsg3.objx;
259
- let fileName = fileInfo.fileName;
260
- let fileSize = fileInfo.fileSize;
261
-
262
- let dataMap = {};
263
- dataMap["startPage"] = startPage;
264
- dataMap["endPage"] = endPage;
265
- dataMap["title"] = title;
266
- dataMap["uuid"] = fileName;
267
- dataMap["fileSize"] = fileSize;
268
- // fileRows.push(dataMap);
269
-
270
- that.$refs["exportTable"].insertAt(
271
- dataMap, -1);
272
-
273
- let fileSizeStr = fileSize;
274
-
275
- // that.fileRows.push(dataMap);
276
- if (mtExcedNum < fileNum) {
277
- loopDo();
278
- } else if (mtExcedNum >= fileNum && mtExcedSuccessNum >= fileNum) {
279
- setTimeout(function () {
280
- that.percentageNum =
281
- parseInt(100);
282
- }, 100);
283
- that.clearExportTimer();
284
- } else if (mtExcedSuccessNum >= fileNum) {
285
- setTimeout(function () {
286
- that.percentageNum = parseInt(100);
287
- }, 100);
288
- that.clearExportTimer();
280
+ that
281
+ .mergeExcel(startPage, endPage)
282
+ .then(function (resultMsg3) {
283
+ if (resultMsg3.type === "success") {
284
+ mtExcedSuccessNum++;
285
+ let fileInfo = resultMsg3.objx;
286
+ let fileName = fileInfo.fileName;
287
+ let fileSize = fileInfo.fileSize;
288
+
289
+ let dataMap = {};
290
+ dataMap["startPage"] = startPage;
291
+ dataMap["endPage"] = endPage;
292
+ dataMap["title"] = title;
293
+ dataMap["uuid"] = fileName;
294
+ dataMap["fileSize"] = fileSize;
295
+ // fileRows.push(dataMap);
296
+
297
+ that.$refs["exportTable"].insertAt(dataMap, -1);
298
+
299
+ let fileSizeStr = fileSize;
300
+
301
+ // that.fileRows.push(dataMap);
302
+ if (mtExcedNum < fileNum) {
303
+ loopDo();
304
+ } else if (
305
+ mtExcedNum >= fileNum &&
306
+ mtExcedSuccessNum >= fileNum
307
+ ) {
308
+ setTimeout(function () {
309
+ that.percentageNum = parseInt(100);
310
+ }, 100);
311
+ that.clearExportTimer();
312
+ } else if (mtExcedSuccessNum >= fileNum) {
313
+ setTimeout(function () {
314
+ that.percentageNum = parseInt(100);
315
+ }, 100);
316
+ that.clearExportTimer();
317
+ }
318
+ } else {
319
+ that.abortExport();
289
320
  }
290
- } else {
291
- that.clearExportTimer();
292
- }
293
- }).catch(function (e) {
294
- console.error(e);
295
- that.clearExportTimer();
296
- });
297
- that.clearExportTimer();
321
+ })
322
+ .catch(function (e) {
323
+ console.error(e);
324
+ that.abortExport(that.$t1("文件合并异常,导出已中止"));
325
+ });
326
+ // 注意:此处不能同步 clearExportTimer,否则计时统计会在合并完成前被提前停掉
298
327
  }
299
- }
328
+ };
300
329
  loopDo();
301
330
  },
302
331
  handleLoopToDo() {
@@ -318,48 +347,49 @@ function getGrid(that, tableRef) {
318
347
 
319
348
  let handleData = function (resultMsg) {
320
349
  let pageNumber = resultMsg.objx.pageNumber || 1;
321
- that.addExcelData({
322
- rows: resultMsg.objx.records,
323
- pageNumber: pageNumber,
324
- }).then(function (resultMsg2) {
325
- let data = resultMsg.objx;
326
- let total = data.total;
327
-
328
- let pageNumber = data.pageNumber || 1;
329
- let totalPages = that.tTotalPage || 1;
330
- if (resultMsg2.type === "success") {
331
- excedNum++;
332
- let pageNumber = data.pageNumber || 1;
333
- let k = excedNum * 100 / totalPages;
334
- if (k > 0 && k < 1) {
335
- k = 1;
336
- }
337
- if (k > 100) k = 100;
338
- let cTotal = that.tTotalSize;
339
- let pageSize = data.pageSize;
340
- // let datas = data.records;
341
- let size = data.records.length;
342
- cSize = cSize + size;
343
-
344
- let ttNum = cSize + "/" + cTotal;
345
- let percentageStr = parseInt(k) + "%";
346
-
347
- let percentageNum = k;
348
- if (percentageNum >= 100) {
349
- percentageNum = 99;
350
- }
351
- // that.$set(that, "doneSize", parseInt(cSize));
352
- // that.$set(that, "percentageNum", parseInt(percentageNum));
350
+ that
351
+ .addExcelData({
352
+ rows: resultMsg.objx.records,
353
+ pageNumber: pageNumber,
354
+ })
355
+ .then(function (resultMsg2) {
356
+ let data = resultMsg.objx;
357
+ let total = data.total;
353
358
 
354
- that.doneSize = parseInt(cSize)
355
- that.percentageNum = parseInt(percentageNum)
359
+ let pageNumber = data.pageNumber || 1;
360
+ let totalPages = that.tTotalPage || 1;
361
+ if (resultMsg2.type === "success") {
362
+ excedNum++;
363
+ let pageNumber = data.pageNumber || 1;
364
+ let k = (excedNum * 100) / totalPages;
365
+ if (k > 0 && k < 1) {
366
+ k = 1;
367
+ }
368
+ if (k > 100) k = 100;
369
+ let cTotal = that.tTotalSize;
370
+ let pageSize = data.pageSize;
371
+ // let datas = data.records;
372
+ let size = data.records.length;
373
+ cSize = cSize + size;
374
+
375
+ let ttNum = cSize + "/" + cTotal;
376
+ let percentageStr = parseInt(k) + "%";
377
+
378
+ let percentageNum = k;
379
+ if (percentageNum >= 100) {
380
+ percentageNum = 99;
381
+ }
382
+ // that.$set(that, "doneSize", parseInt(cSize));
383
+ // that.$set(that, "percentageNum", parseInt(percentageNum));
356
384
 
357
- if (totalPages === 0 || (excedNum >= totalPages)) {
385
+ that.doneSize = parseInt(cSize);
386
+ that.percentageNum = parseInt(percentageNum);
358
387
 
359
- that.hadleMergeExcel(data.pageSize);
360
- return
388
+ if (totalPages === 0 || excedNum >= totalPages) {
389
+ that.hadleMergeExcel(data.pageSize);
390
+ return;
361
391
 
362
- /*let kTotalPages = parseInt(limitFileSize / data.pageSize);
392
+ /*let kTotalPages = parseInt(limitFileSize / data.pageSize);
363
393
 
364
394
  let fileNum = parseInt(totalPages / kTotalPages);
365
395
  if (totalPages % kTotalPages !== 0) {
@@ -434,20 +464,21 @@ function getGrid(that, tableRef) {
434
464
  that.clearExportTimer();
435
465
  }
436
466
  }, 100);*/
437
- return false;
467
+ return false;
468
+ }
469
+ } else {
470
+ that.abortExport();
438
471
  }
439
- } else {
440
- that.clearExportTimer();
441
- }
442
- }).catch(function (e) {
443
- console.error(e);
444
- that.clearExportTimer();
445
- });
446
- }
472
+ })
473
+ .catch(function (e) {
474
+ console.error(e);
475
+ that.abortExport(that.$t1("导出数据写入失败,导出已中止"));
476
+ });
477
+ };
447
478
 
448
479
  let waitReqNum = 0;
449
480
  let promise;
450
- let loopToDo = function (flag, pageNumber) {
481
+ let loopToDo = function (flag, pageNumber, retryCount = 0) {
451
482
  let maxWaitNum = limitThreadNum;
452
483
  let nowDate = options.nowDate;
453
484
  if (flag === 1) {
@@ -472,12 +503,12 @@ function getGrid(that, tableRef) {
472
503
  current: pageNumber,
473
504
  size: pPageSize,
474
505
  nowDate: nowDate,
475
- searchCount: flag !== 1
476
- }
506
+ searchCount: flag !== 1,
507
+ };
477
508
  let cpParam;
478
509
  if (originOption.vform === true) {
479
510
  params.conditions = params.conditions || {};
480
- cpParam = params.conditions
511
+ cpParam = params.conditions;
481
512
  } else {
482
513
  cpParam = params;
483
514
  }
@@ -486,8 +517,10 @@ function getGrid(that, tableRef) {
486
517
  if (!originOption.exportAjax) {
487
518
  let turl = url.replace("searchCount=false", "1=1");
488
519
  let finaParams = params;
489
- if(originOption.paramHandle){
490
- finaParams = originOption.paramHandle ? originOption.paramHandle(params) || {} : {};
520
+ if (originOption.paramHandle) {
521
+ finaParams = originOption.paramHandle
522
+ ? originOption.paramHandle(params) || {}
523
+ : {};
491
524
  }
492
525
  promise = that.$commonHttp({
493
526
  aes: originOption.aes || false,
@@ -496,87 +529,108 @@ function getGrid(that, tableRef) {
496
529
  data: finaParams,
497
530
  modal: false,
498
531
  queryCreateInfo: originOption.queryCreateInfo,
499
- addCreateInfo: originOption.addCreateInfo
532
+ addCreateInfo: originOption.addCreateInfo,
500
533
  });
501
534
  } else {
502
535
  promise = originOption.exportAjax(aParam, options);
503
536
  }
504
537
 
505
- promise.then(function (resultMsg) {
506
-
507
- if (resultMsg.type === 'success') {
508
- let objx = resultMsg.objx;
509
- objx.pageNumber = objx.current || 1;
510
- objx.totalPages = objx.pages || 1;
511
- objx.pageSize = objx.size;
512
- let size = objx.records.length;
513
- if (flag === 0) {
538
+ promise
539
+ .then(function (resultMsg) {
540
+ if (resultMsg.type === "success") {
541
+ let objx = resultMsg.objx;
542
+ objx.pageNumber = objx.current || 1;
543
+ objx.totalPages = objx.pages || 1;
544
+ objx.pageSize = objx.size;
545
+ let size = objx.records.length;
546
+ if (flag === 0) {
547
+ that.tTotalPage = objx.pages;
548
+ // that.tTotalSize = objx.total;
549
+ setTimeout(function () {
550
+ that.$set(that, "tTotalSize", objx.total);
551
+ }, 0);
552
+ let tTotalPage = objx.pages;
553
+ let tTotalSize = objx.total;
554
+ let ttNum = 0 + "/" + objx.total;
555
+
556
+ let opNum = limitFileSize;
557
+ let kTotalPages = parseInt(opNum / objx.size);
558
+
559
+ let fileNum = parseInt(tTotalPage / kTotalPages);
560
+ if (tTotalPage % kTotalPages !== 0) {
561
+ fileNum = fileNum + 1;
562
+ }
563
+ if (
564
+ size > 0 ||
565
+ objx.totalPages > 0 ||
566
+ objx.pageNumber < objx.totalPages
567
+ ) {
568
+ that.exportTimer = setInterval(function () {
569
+ if (waitReqNum < maxWaitNum && num < tTotalPage) {
570
+ waitReqNum++;
571
+ num++;
572
+ let pageNumber = num;
573
+ loopToDo(1, pageNumber);
574
+ }
575
+ if (num >= tTotalPage) {
576
+ // 所有页已派发,停掉调度器(数据写入完成与否由 handleData 计数判断)
577
+ clearInterval(that.exportTimer);
578
+ that.exportTimer = null;
579
+ }
580
+ }, 100);
581
+ } else {
582
+ clearInterval(that.exportTimer);
583
+ that.exportTimer = null;
584
+ }
585
+ } else {
586
+ if (waitReqNum > 0) waitReqNum--;
587
+ }
514
588
 
515
- that.tTotalPage = objx.pages;
516
- // that.tTotalSize = objx.total;
517
589
  setTimeout(function () {
518
- that.$set(that, 'tTotalSize', objx.total);
519
- }, 0)
520
- let tTotalPage = objx.pages;
521
- let tTotalSize = objx.total;
522
- let ttNum = 0 + "/" + objx.total;
523
-
524
- let opNum = limitFileSize;
525
- let kTotalPages = parseInt(opNum / objx.size);
526
-
527
- let fileNum = parseInt(tTotalPage / kTotalPages);
528
- if (tTotalPage % kTotalPages !== 0) {
529
- fileNum = fileNum + 1;
530
- }
531
- if (size > 0 || objx.totalPages > 0 || (objx.pageNumber < objx
532
- .totalPages)) {
533
- exportTimer = setInterval(function () {
534
- if (waitReqNum < maxWaitNum && num < tTotalPage) {
535
- waitReqNum++;
536
- num++;
537
- let pageNumber = num;
538
- loopToDo(1, pageNumber);
539
- }
540
- if (num >= tTotalPage) {
541
- clearInterval(loopToDo);
542
- }
543
- }, 100);
590
+ handleData(resultMsg, flag);
591
+ }, 1);
592
+ } else {
593
+ // 单页拉取失败自动重试一次;仍失败则中止(缺页合并会静默丢数据,必须中止)
594
+ if (retryCount < 1) {
595
+ setTimeout(function () {
596
+ loopToDo(flag, pageNumber, retryCount + 1);
597
+ }, 500);
544
598
  } else {
545
- clearInterval(exportTimer);
546
- exportTimer = null;
599
+ that.abortExport();
547
600
  }
601
+ }
602
+ })
603
+ .catch(function (e) {
604
+ console.error(e);
605
+ if (retryCount < 1) {
606
+ setTimeout(function () {
607
+ loopToDo(flag, pageNumber, retryCount + 1);
608
+ }, 500);
548
609
  } else {
549
- if (waitReqNum > 0) waitReqNum--;
610
+ that.abortExport(
611
+ that.$t1("第{n}页数据拉取失败,导出已中止", {
612
+ n: pageNumber,
613
+ })
614
+ );
550
615
  }
551
-
552
- setTimeout(function () {
553
- handleData(resultMsg, flag);
554
- }, 1);
555
- } else {
556
- that.clearExportTimer();
557
- }
558
-
559
- }).catch(function (e) {
560
- console.error(e);
561
- that.clearExportTimer();
562
- });
563
- }
616
+ });
617
+ };
564
618
 
565
619
  num = 1;
566
620
  loopToDo(0, num);
567
621
  },
568
622
  createExcelFile(loading) {
569
- let url1 = this.CURRENT_PREFIX + '/excel/createExcelTemplate';
623
+ let url1 = this.CURRENT_PREFIX + "/excel/createExcelTemplate";
570
624
  let datas = this.getHeadTitleJson();
571
625
  return this.$http({
572
626
  url: url1,
573
627
  method: "post",
574
628
  headers: {
575
- 'Content-Type': 'application/json;charset=utf-8'
629
+ "Content-Type": "application/json;charset=utf-8",
576
630
  },
577
631
  data: datas,
578
632
  modal: loading || false,
579
- isLoading: loading
633
+ isLoading: loading,
580
634
  });
581
635
  },
582
636
  /*getExportTitleJson() {
@@ -625,7 +679,7 @@ function getGrid(that, tableRef) {
625
679
  let that = this;
626
680
  let target = this.tableTarget;
627
681
  // let columns = target.getTableColumn().collectColumn;
628
- let columns = this.columns
682
+ let columns = this.columns;
629
683
 
630
684
  this.computeRealColSpan(columns);
631
685
 
@@ -633,14 +687,14 @@ function getGrid(that, tableRef) {
633
687
  let loop = function (column, n) {
634
688
  if (column.children && column.children.length > 0) {
635
689
  let num = n + 1;
636
- column.children.forEach(child => {
690
+ column.children.forEach((child) => {
637
691
  return loop(child, num);
638
692
  });
639
693
  } else {
640
694
  let num = n;
641
695
  if (num > maxRowNum) maxRowNum = num;
642
696
  }
643
- }
697
+ };
644
698
 
645
699
  columns.forEach((column) => {
646
700
  if (column.title) {
@@ -666,7 +720,10 @@ function getGrid(that, tableRef) {
666
720
  contents.push({
667
721
  colspan: column.realColSpan,
668
722
  rowspan: column.rowSpan,
669
- title: column.title !== null && column.title !== undefined ? column.title : ''
723
+ title:
724
+ column.title !== null && column.title !== undefined
725
+ ? column.title
726
+ : "",
670
727
  });
671
728
  }
672
729
  });
@@ -682,47 +739,65 @@ function getGrid(that, tableRef) {
682
739
  let datas = this.getExcelData(opts.rows);
683
740
  let cUUid = this.uuid;
684
741
  let ippaaapp = this.ippaaapp;
685
- let url1 = this.CURRENT_PREFIX + "/excel/appendExcelData?uuid=" + cUUid + "&ippaaapp=" +
686
- ippaaapp + "&pageNumber=" + pageNumber;
742
+ let url1 =
743
+ this.CURRENT_PREFIX +
744
+ "/excel/appendExcelData?uuid=" +
745
+ cUUid +
746
+ "&ippaaapp=" +
747
+ ippaaapp +
748
+ "&pageNumber=" +
749
+ pageNumber;
687
750
  return this.$http({
688
751
  url: url1,
689
752
  method: "post",
690
753
  headers: {
691
- 'Content-Type': 'application/json;charset=utf-8'
754
+ "Content-Type": "application/json;charset=utf-8",
692
755
  },
693
756
  data: datas,
694
757
  modal: loading || false,
695
- isLoading: loading || false
758
+ isLoading: loading || false,
696
759
  });
697
760
  },
698
761
  mergeExcel(startPage, endPage, loading) {
699
- let url1 = this.CURRENT_PREFIX + "/excel/mergeExcel?uuid=" + this.uuid + "&ippaaapp=" + this.ippaaapp;
762
+ let url1 =
763
+ this.CURRENT_PREFIX +
764
+ "/excel/mergeExcel?uuid=" +
765
+ this.uuid +
766
+ "&ippaaapp=" +
767
+ this.ippaaapp;
700
768
  return this.$http({
701
769
  url: url1 + "&startPage=" + startPage + "&endPage=" + endPage,
702
770
  method: "post",
703
771
  modal: loading || false,
704
- isLoading: loading || false
705
- })
772
+ isLoading: loading || false,
773
+ });
706
774
  },
707
775
  createCountTimer() {
708
776
  this.excTime = 0;
709
777
  let beginTime = new Date().getTime();
710
- countTimer = setInterval(() => {
778
+ this.countTimer = setInterval(() => {
711
779
  let nowTime = new Date().getTime();
712
780
  let diffTime = (nowTime - beginTime) / 1000;
713
- this.$set(this, 'excTime', this.$baseLodash.round(diffTime, 2));
781
+ this.$set(this, "excTime", this.$baseLodash.round(diffTime, 2));
714
782
  }, 100);
715
783
  },
716
784
  clearExportTimer() {
717
- if (exportTimer) clearInterval(exportTimer);
718
- if (exportMtTimer) clearInterval(exportMtTimer);
719
- if (countTimer) clearInterval(countTimer);
720
- exportTimer = null;
721
- exportMtTimer = null;
722
- countTimer = null;
785
+ if (this.exportTimer) clearInterval(this.exportTimer);
786
+ if (this.countTimer) clearInterval(this.countTimer);
787
+ this.exportTimer = null;
788
+ this.countTimer = null;
789
+ },
790
+ /**
791
+ * 中止导出:停止全部定时器并把进度条置为错误态。
792
+ * @param {String} [msg] 需要额外弹给用户的提示;服务端已 toast 过的失败不传,避免重复提示。
793
+ */
794
+ abortExport(msg) {
795
+ this.clearExportTimer();
796
+ this.exportError = true;
797
+ if (msg) this.$baseAlert(msg);
723
798
  },
724
799
  isPicture: function (suffix) {
725
- if (!suffix || suffix === '') {
800
+ if (!suffix || suffix === "") {
726
801
  return false;
727
802
  }
728
803
  suffix = suffix.toLowerCase();
@@ -732,7 +807,7 @@ function getGrid(that, tableRef) {
732
807
  png: true,
733
808
  // gif: true,
734
809
  bmp: true,
735
- mpg: true
810
+ mpg: true,
736
811
  };
737
812
 
738
813
  let type = fileTypeMap[suffix];
@@ -742,61 +817,121 @@ function getGrid(that, tableRef) {
742
817
 
743
818
  return true;
744
819
  },
820
+ /**
821
+ * 导出取值快路径:优先纯函数取值(filterVal → formatter → 原始字段),
822
+ * 只有真正配置了自定义渲染(renderCell/函数型 slots.default)的列才走
823
+ * getCellValue 的 vNode 挂载渲染兜底 —— 后者每个单元格要挂载一次 Vue
824
+ * 组件再爬 DOM,是导出耗时的大头。
825
+ * 字符串型 slots.default(具名插槽,如 xform 的 "widget")由 getCellValue
826
+ * 从 grid 作用域插槽解析后渲染;解析不到时其内部回退原始字段。
827
+ */
828
+ getExportCellValue(params) {
829
+ let column = params.column;
830
+ if (column.slots && typeof column.slots.filterVal === "function") {
831
+ return column.slots.filterVal(params);
832
+ }
833
+ let slotDefault = column.slots && column.slots.default;
834
+ let hasRenderFn =
835
+ !!column.renderCell ||
836
+ typeof slotDefault === "function" ||
837
+ typeof slotDefault === "string";
838
+ if (!hasRenderFn) {
839
+ let cellValue = params.row[column.field];
840
+ if (typeof column.formatter === "function") {
841
+ return column.formatter({
842
+ cellValue,
843
+ row: params.row,
844
+ column,
845
+ });
846
+ }
847
+ return cellValue;
848
+ }
849
+ return getCellValue(params);
850
+ },
745
851
  getExcelData(rows) {
746
852
  let that = this;
747
853
 
748
854
  let showImageAtTable = this.option.showImageAtTable || false;
749
855
  // let target = this.option.vue.$refs[this.option.targetRef];
750
- let target = getGrid(this.option.vue, this.option.targetRef)
856
+ let target = getGrid(this.option.vue, this.option.targetRef);
751
857
  let $table = target.$refs.xTable;
752
858
 
753
859
  // let columns = target.getColumns();
754
- let columns = this.leafColumns;
860
+ let columns = this.leafColumns.filter(
861
+ (column) => !column.params?.exportDisabled
862
+ );
755
863
 
756
864
  let arr = [];
757
865
  let contents;
758
866
  let params;
759
867
  let resultStr;
868
+ // 批量取值期间复用 vNode 渲染的临时实例,结束时统一销毁
760
869
  rows.forEach(function (row, index) {
761
870
  contents = [];
762
- columns.forEach(column => {
871
+ columns.forEach((column) => {
763
872
  if (column.title) {
764
873
  params = {
765
- '$table': $table,
874
+ $table: $table,
766
875
  row: row,
767
876
  rowIndex: index,
768
- '$rowIndex': index,
877
+ $rowIndex: index,
769
878
  column: column,
770
879
  // columnIndex: 0,
771
880
  // $columnIndex: 0,
772
881
  // _columnIndex
773
- }
882
+ };
774
883
  let exportType = column.params?.exportType;
775
- let exportVal = column.params && column.params.exportVal ? column.params.exportVal : null;
884
+ let exportVal =
885
+ column.params && column.params.exportVal
886
+ ? column.params.exportVal
887
+ : null;
776
888
  if (exportVal) {
777
889
  resultStr = exportVal(params);
778
890
  } else if (exportType === "Number") {
779
- resultStr = getCellValue(params);
780
- if (resultStr !== null && resultStr !== undefined && resultStr !== "" && !(resultStr + "").startsWith("[EXPNUM]")) {
891
+ resultStr = that.getExportCellValue(params);
892
+ if (
893
+ resultStr !== null &&
894
+ resultStr !== undefined &&
895
+ resultStr !== "" &&
896
+ !(resultStr + "").startsWith("[EXPNUM]")
897
+ ) {
781
898
  resultStr = "[EXPNUM]" + resultStr;
782
899
  }
783
- } else if (exportType === "Image" || (showImageAtTable && exportType === "Image2")) {
784
- resultStr = getCellValue(params);
900
+ } else if (
901
+ exportType === "Image" ||
902
+ (showImageAtTable && exportType === "Image2")
903
+ ) {
904
+ resultStr = that.getExportCellValue(params);
785
905
  let attachments = row[column.field];
786
906
  if (attachments) {
787
907
  if (Array.isArray(attachments)) {
788
- let items = attachments.filter(item => that.isPicture(item.extension))
908
+ let items = attachments.filter((item) =>
909
+ that.isPicture(item.extension)
910
+ );
789
911
  if (items.length > 0) {
790
- resultStr = "[EXPIMG]" + items.map(item => {
791
- let url = item.large || item.medium;
792
- return item.domain + url;
793
- }).join(',')
912
+ resultStr =
913
+ "[EXPIMG]" +
914
+ items
915
+ .map((item) => {
916
+ let url = item.large || item.medium;
917
+ return item.domain + url;
918
+ })
919
+ .join(",");
794
920
  } else {
795
921
  resultStr = null;
796
922
  }
797
923
  } else {
798
- if (that.isPicture(that.$commonFileUtil.getFileSuffix(resultStr))) {
799
- if (resultStr !== null && resultStr !== undefined && resultStr !== "" && !(resultStr + "").startsWith("[EXPIMG]")) {
924
+ if (
925
+ that.isPicture(
926
+ that.$commonFileUtil.getFileSuffix(resultStr)
927
+ )
928
+ ) {
929
+ if (
930
+ resultStr !== null &&
931
+ resultStr !== undefined &&
932
+ resultStr !== "" &&
933
+ !(resultStr + "").startsWith("[EXPIMG]")
934
+ ) {
800
935
  resultStr = "[EXPIMG]" + resultStr;
801
936
  }
802
937
  } else {
@@ -806,8 +941,8 @@ function getGrid(that, tableRef) {
806
941
  } else {
807
942
  resultStr = null;
808
943
  }
809
- }else{
810
- resultStr = getCellValue(params);
944
+ } else {
945
+ resultStr = that.getExportCellValue(params);
811
946
  }
812
947
  contents.push(resultStr);
813
948
  resultStr = null;
@@ -820,17 +955,22 @@ function getGrid(that, tableRef) {
820
955
  exportAll(row) {
821
956
  let cUUid = encodeURIComponent(row.uuid);
822
957
  let fileName = row.title;
823
- let fileUrl = configUtil.baseUrl + this.CURRENT_PREFIX + '/excel/download?uuid=' + cUUid;
958
+ let fileUrl =
959
+ configUtil.baseUrl +
960
+ this.CURRENT_PREFIX +
961
+ "/excel/download?uuid=" +
962
+ cUUid;
824
963
 
825
964
  function downLoadFile2() {
826
965
  let params = {
827
- n: fileName
966
+ n: fileName,
828
967
  };
829
- params['access_token'] = configUtil.getToken();
968
+ params["access_token"] = configUtil.getToken();
830
969
 
831
- let form = document.createElement('form');
970
+ let form = document.createElement("form");
832
971
 
833
- let randomNum = (new Date()).valueOf() + Math.floor(Math.random() * 1000000);
972
+ let randomNum =
973
+ new Date().valueOf() + Math.floor(Math.random() * 1000000);
834
974
  let formId = "formId-" + randomNum;
835
975
  let formName = "formName-" + randomNum;
836
976
 
@@ -840,8 +980,8 @@ function getGrid(that, tableRef) {
840
980
  document.body.appendChild(form);
841
981
  for (let obj in params) {
842
982
  if (params.hasOwnProperty(obj)) {
843
- let input = document.createElement('input');
844
- input.tpye = 'hidden';
983
+ let input = document.createElement("input");
984
+ input.type = "hidden";
845
985
  input.name = obj;
846
986
  input.value = params[obj];
847
987
  form.appendChild(input);
@@ -851,7 +991,6 @@ function getGrid(that, tableRef) {
851
991
  form.action = fileUrl;
852
992
  form.submit();
853
993
  document.body.removeChild(form);
854
-
855
994
  }
856
995
 
857
996
  downLoadFile2();
@@ -860,11 +999,13 @@ function getGrid(that, tableRef) {
860
999
  this.tableTarget = getGrid(this.option.vue, this.option.targetRef);
861
1000
  let that = this;
862
1001
  let options = this.option;
863
- let title = options.title || this.$t2('导出', 'components.excelExport.title');
864
- if (!options.prefix && options.prefix !== '') {
1002
+ let title =
1003
+ options.title || this.$t2("导出", "components.excelExport.title");
1004
+ if (!options.prefix && options.prefix !== "") {
865
1005
  let originOption = this.tableTarget.params.originOption;
866
1006
  let path = originOption.exportPath || originOption.path;
867
- if (path) {
1007
+ if (typeof path === "function") path = path();
1008
+ if (path && typeof path === "string" && path !== "#") {
868
1009
  let os = path.split("/");
869
1010
  if (path.indexOf("http://") >= 0 || path.indexOf("https://") >= 0) {
870
1011
  options.prefix = "/" + os[3];
@@ -874,39 +1015,46 @@ function getGrid(that, tableRef) {
874
1015
  }
875
1016
  }
876
1017
  if (!options.prefix) {
1018
+ this.$baseAlert(
1019
+ this.$t1("无法确定导出服务前缀,请在导出配置中指定 prefix")
1020
+ );
877
1021
  return;
878
1022
  }
879
1023
  this.CURRENT_PREFIX = options.prefix;
880
1024
 
881
1025
  let handleData = function () {
882
1026
  let total = datas.length;
883
- that.addExcelData({
884
- rows: datas,
885
- pageNumber: 1,
886
- }, true).then(resultMsg2 => {
887
- if (resultMsg2.type === "success") {
888
- setTimeout(() => {
889
- that.mergeExcel(1, 1, true).then(resultMsg3 => {
890
- if (resultMsg3.type === "success") {
891
- let fileInfo = resultMsg3.objx;
892
- let fileName = fileInfo.fileName;
893
- let fileSize = fileInfo.fileSize;
894
-
895
- let dataMap = {};
896
- dataMap["startPage"] = 1;
897
- dataMap["endPage"] = 1;
898
- dataMap["title"] = title;
899
- dataMap["uuid"] = fileName;
900
- dataMap["fileSize"] = fileSize;
901
- that.exportAll(dataMap);
902
- }
903
- })
904
- }, 0)
905
-
906
- }
907
- })
908
- }
909
- that.createExcelFile(true).then(resultMsg => {
1027
+ that
1028
+ .addExcelData(
1029
+ {
1030
+ rows: datas,
1031
+ pageNumber: 1,
1032
+ },
1033
+ true
1034
+ )
1035
+ .then((resultMsg2) => {
1036
+ if (resultMsg2.type === "success") {
1037
+ setTimeout(() => {
1038
+ that.mergeExcel(1, 1, true).then((resultMsg3) => {
1039
+ if (resultMsg3.type === "success") {
1040
+ let fileInfo = resultMsg3.objx;
1041
+ let fileName = fileInfo.fileName;
1042
+ let fileSize = fileInfo.fileSize;
1043
+
1044
+ let dataMap = {};
1045
+ dataMap["startPage"] = 1;
1046
+ dataMap["endPage"] = 1;
1047
+ dataMap["title"] = title;
1048
+ dataMap["uuid"] = fileName;
1049
+ dataMap["fileSize"] = fileSize;
1050
+ that.exportAll(dataMap);
1051
+ }
1052
+ });
1053
+ }, 0);
1054
+ }
1055
+ });
1056
+ };
1057
+ that.createExcelFile(true).then((resultMsg) => {
910
1058
  if (resultMsg.type === "success") {
911
1059
  let aObj = resultMsg.objx;
912
1060
  that.uuid = aObj.uuid;
@@ -914,18 +1062,18 @@ function getGrid(that, tableRef) {
914
1062
  that.ippaaapp = aObj.ippaaapp;
915
1063
  setTimeout(() => {
916
1064
  handleData();
917
- }, 0)
918
-
1065
+ }, 0);
919
1066
  }
920
- })
1067
+ });
921
1068
  },
922
1069
  closeExportFieldDialog() {
923
1070
  this.dialogClose2();
924
1071
  },
925
- confirmExportFieldDialog({columns, leafColumns}) {
1072
+ confirmExportFieldDialog({ columns, leafColumns }) {
926
1073
  this.columns = columns;
927
- this.leafColumns = leafColumns
928
- let flag = this.option.type === "selected" || this.option.type === "current";
1074
+ this.leafColumns = leafColumns;
1075
+ let flag =
1076
+ this.option.type === "selected" || this.option.type === "current";
929
1077
  if (!flag) {
930
1078
  this.showImportDialog2 = true;
931
1079
  }
@@ -936,13 +1084,23 @@ function getGrid(that, tableRef) {
936
1084
  if (this.option.type === "selected") {
937
1085
  datas = $grid.getCheckboxRecords(true);
938
1086
  if (!datas.length) {
939
- this.$baseAlert(this.$t2('请选择导出的数据', 'components.excelExport.warmMsg1'));
1087
+ this.$baseAlert(
1088
+ this.$t2(
1089
+ "请选择导出的数据",
1090
+ "components.excelExport.warmMsg1"
1091
+ )
1092
+ );
940
1093
  return;
941
1094
  }
942
1095
  } else if (this.option.type === "current") {
943
1096
  datas = $grid.getTableData().fullData;
944
1097
  if (!datas.length) {
945
- this.$baseAlert(this.$t2('不存在可导出的数据', 'components.excelExport.warmMsg2'));
1098
+ this.$baseAlert(
1099
+ this.$t2(
1100
+ "不存在可导出的数据",
1101
+ "components.excelExport.warmMsg2"
1102
+ )
1103
+ );
946
1104
  return;
947
1105
  }
948
1106
  }
@@ -952,34 +1110,32 @@ function getGrid(that, tableRef) {
952
1110
  }
953
1111
  });
954
1112
  },
955
- lockMenu(){
1113
+ lockMenu() {
956
1114
  let vueTarget = window.$vueRoot;
957
1115
  let path = vueTarget.$route.path;
958
- let visitedViews = vueTarget.$store.state.tagsView.visitedViews
959
- if(visitedViews){
960
- let currentItem = visitedViews.find(item=>item.path === path)
961
- if(currentItem && !currentItem.meta.affix){
962
- this.$set(currentItem.meta, "affix",true)
963
- this.$set(currentItem.meta, "user_affix",true)
1116
+ let visitedViews = vueTarget.$store.state.tagsView.visitedViews;
1117
+ if (visitedViews) {
1118
+ let currentItem = visitedViews.find((item) => item.path === path);
1119
+ if (currentItem && !currentItem.meta.affix) {
1120
+ this.$set(currentItem.meta, "affix", true);
1121
+ this.$set(currentItem.meta, "user_affix", true);
964
1122
  }
965
1123
  }
966
-
967
1124
  },
968
- unlockMenu(){
1125
+ unlockMenu() {
969
1126
  let vueTarget = window.$vueRoot;
970
1127
  let path = vueTarget.$route.path;
971
- let visitedViews = vueTarget.$store.state.tagsView.visitedViews
972
- if(visitedViews){
973
- let currentItem = visitedViews.find(item=>item.path === path)
974
- if(currentItem && currentItem.meta.user_affix){
975
- currentItem.meta.affix = false
976
- currentItem.meta.user_affix = false
1128
+ let visitedViews = vueTarget.$store.state.tagsView.visitedViews;
1129
+ if (visitedViews) {
1130
+ let currentItem = visitedViews.find((item) => item.path === path);
1131
+ if (currentItem && currentItem.meta.user_affix) {
1132
+ currentItem.meta.affix = false;
1133
+ currentItem.meta.user_affix = false;
977
1134
  }
978
1135
  }
979
1136
  },
980
- }
1137
+ },
981
1138
  };
982
1139
  })();
983
1140
 
984
- export const mixins = tmixins
985
-
1141
+ export const mixins = tmixins;