hy-dispatch-ui-v3 0.2.31 → 0.2.33

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 (80) hide show
  1. package/dist/tailwind.css +174 -454
  2. package/es/components/hyAudioPlayer/audioPlayer.vue.mjs +4 -4
  3. package/es/components/hyAudioPlayer/style/audioPlayer.scss +11 -12
  4. package/es/components/hyButton/button.vue.mjs +112 -65
  5. package/es/components/hyButton/style/button.scss +291 -233
  6. package/es/components/hyConfirmDialog/confirmDialog.vue.mjs +1 -1
  7. package/es/components/hyForm/form.vue.mjs +2 -1
  8. package/es/components/hyForm/index.mjs +1 -1
  9. package/es/components/hyForm/js/useAppForm.mjs +1 -2
  10. package/es/components/hyForm/style/form.scss +56 -54
  11. package/es/components/hyIcon/style/icon.scss +1 -1
  12. package/es/components/hyIconBox/style/iconBox.scss +19 -18
  13. package/es/components/hyInput/input.vue.mjs +4 -1
  14. package/es/components/hyMenu/menu.vue.mjs +1 -1
  15. package/es/components/hyMenu/style/menu.scss +1 -1
  16. package/es/components/hySearch/index.mjs +1 -1
  17. package/es/components/hySearch/style/search.scss +50 -50
  18. package/es/components/hyTable/cpns/virtualTable.vue.mjs +342 -319
  19. package/es/components/hyTable/js/index.mjs +19 -3
  20. package/es/components/hyTable/js/useAppTable.mjs +1 -1
  21. package/es/components/hyTable/table.vue.mjs +31 -11
  22. package/es/components/hyTableForm/batchTableForm.vue.mjs +478 -0
  23. package/es/components/hyTableForm/index.mjs +4 -1
  24. package/es/components/hyTableForm/js/index.mjs +123 -0
  25. package/es/components/hyTableForm/js/useAppTableForm.mjs +47 -0
  26. package/es/components/hyTableForm/style/batchTableForm.scss +127 -0
  27. package/es/components/hyTableForm/style/tableForm.scss +42 -0
  28. package/es/components/hyTableForm/tableForm.vue.mjs +452 -7
  29. package/es/components/hyTooltip/tooltip.vue.mjs +2 -2
  30. package/es/components/hyVideoPlayer/cpns/mediaLoading.vue.mjs +1 -1
  31. package/es/components/hyVideoPlayer/style/mediaLoading.scss +5 -5
  32. package/es/components/hyVideoPlayer/style/videoPlayer.scss +7 -6
  33. package/es/components/hyVideoPlayer/videoPlayer.vue.mjs +6 -6
  34. package/es/components/index.mjs +4 -3
  35. package/es/index.mjs +4 -3
  36. package/es/static/hy-svg-icons/hy-icon-dispatch-linear-map-treelist.js +8 -0
  37. package/es/static/hy-svg-icons/hy-icon-dispatch-share-guidao.js +8 -0
  38. package/es/style/tailwind.scss +133 -1
  39. package/es/utils/handler.mjs +4 -4
  40. package/es/version.mjs +1 -1
  41. package/lib/components/hyAudioPlayer/audioPlayer.vue.js +4 -4
  42. package/lib/components/hyAudioPlayer/style/audioPlayer.scss +11 -12
  43. package/lib/components/hyButton/button.vue.js +111 -64
  44. package/lib/components/hyButton/style/button.scss +291 -233
  45. package/lib/components/hyConfirmDialog/confirmDialog.vue.js +1 -1
  46. package/lib/components/hyForm/form.vue.js +2 -1
  47. package/lib/components/hyForm/index.js +1 -0
  48. package/lib/components/hyForm/js/useAppForm.js +1 -2
  49. package/lib/components/hyForm/style/form.scss +56 -54
  50. package/lib/components/hyIcon/style/icon.scss +1 -1
  51. package/lib/components/hyIconBox/style/iconBox.scss +19 -18
  52. package/lib/components/hyInput/input.vue.js +4 -1
  53. package/lib/components/hyMenu/menu.vue.js +1 -1
  54. package/lib/components/hyMenu/style/menu.scss +1 -1
  55. package/lib/components/hySearch/index.js +1 -0
  56. package/lib/components/hySearch/style/search.scss +50 -50
  57. package/lib/components/hyTable/cpns/virtualTable.vue.js +340 -317
  58. package/lib/components/hyTable/js/index.js +19 -3
  59. package/lib/components/hyTable/js/useAppTable.js +1 -1
  60. package/lib/components/hyTable/table.vue.js +31 -11
  61. package/lib/components/hyTableForm/batchTableForm.vue.js +482 -0
  62. package/lib/components/hyTableForm/index.js +5 -0
  63. package/lib/components/hyTableForm/js/index.js +127 -0
  64. package/lib/components/hyTableForm/js/useAppTableForm.js +49 -0
  65. package/lib/components/hyTableForm/style/batchTableForm.scss +127 -0
  66. package/lib/components/hyTableForm/style/tableForm.scss +42 -0
  67. package/lib/components/hyTableForm/tableForm.vue.js +451 -6
  68. package/lib/components/hyTooltip/tooltip.vue.js +2 -2
  69. package/lib/components/hyVideoPlayer/cpns/mediaLoading.vue.js +1 -1
  70. package/lib/components/hyVideoPlayer/style/mediaLoading.scss +5 -5
  71. package/lib/components/hyVideoPlayer/style/videoPlayer.scss +7 -6
  72. package/lib/components/hyVideoPlayer/videoPlayer.vue.js +6 -6
  73. package/lib/components/index.js +35 -30
  74. package/lib/index.js +35 -30
  75. package/lib/static/hy-svg-icons/hy-icon-dispatch-linear-map-treelist.js +8 -0
  76. package/lib/static/hy-svg-icons/hy-icon-dispatch-share-guidao.js +8 -0
  77. package/lib/style/tailwind.scss +133 -1
  78. package/lib/utils/handler.js +4 -4
  79. package/lib/version.js +1 -1
  80. package/package.json +5 -3
@@ -261,9 +261,7 @@ const useAppTableWrapper = (hy) => {
261
261
  async function onTableRowClickHandler(row) {
262
262
  emits("row-click", row);
263
263
  if (props.rowClickExpand) {
264
- if (tableColumns.value.some((column) => column.type === "expand")) {
265
- tableRef.value.toggleRowExpansion(row);
266
- }
264
+ toggleRowExpansion(row);
267
265
  }
268
266
  if (props.rowClickSelect && isSelectable(row)) {
269
267
  if (tableColumns.value.some((column) => column.type === "selection")) {
@@ -311,6 +309,22 @@ const useAppTableWrapper = (hy) => {
311
309
  }
312
310
  return className.filter(Boolean).join(" ");
313
311
  }
312
+ function toggleRowExpansion(row) {
313
+ if (tableRef.value && tableColumns.value.some((column) => column.type === "expand")) {
314
+ tableRef.value.toggleRowExpansion(row);
315
+ }
316
+ }
317
+ function onTableRowExpandChangeHandler(row, expandedRows) {
318
+ if (isBoolean(expandedRows) || props.expandMode !== "accordion" || expandedRows.length <= 1) {
319
+ props.onExpandChange(row, expandedRows);
320
+ return;
321
+ } else {
322
+ expandedRows.forEach((item) => {
323
+ if (getRowKey(row) === getRowKey(item)) return;
324
+ toggleRowExpansion(item);
325
+ });
326
+ }
327
+ }
314
328
  const isSearchFocus = ref(false);
315
329
  function onSearchInputHandler() {
316
330
  isSearchFocus.value = true;
@@ -347,8 +361,10 @@ const useAppTableWrapper = (hy) => {
347
361
  getSelectedList,
348
362
  clearSelection,
349
363
  clearSelectedList,
364
+ toggleRowExpansion,
350
365
  onTableSelectHandler,
351
366
  onTableRowContextmenuHandler,
367
+ onTableRowExpandChangeHandler,
352
368
  onTableRowClickHandler,
353
369
  onTableColumnsSelectHandler,
354
370
  // 搜索选中
@@ -58,7 +58,7 @@ function getColumnEditable(column, index) {
58
58
  };
59
59
  }
60
60
  return {
61
- index,
61
+ index: type === "operator" ? 1e3 : index,
62
62
  lock: false,
63
63
  edit: !type || type === "default",
64
64
  checked: !type || type !== "default" || type === "operator",
@@ -173,6 +173,16 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
173
173
  type: Boolean,
174
174
  required: false,
175
175
  default: true
176
+ },
177
+ expandMode: {
178
+ // 展开模式,不支持树形展开
179
+ type: String,
180
+ default: "default"
181
+ // deafult-默认 accordion-手风琴
182
+ },
183
+ onExpandChange: {
184
+ // 展开回调
185
+ type: Function
176
186
  }
177
187
  },
178
188
  emits: [
@@ -207,8 +217,10 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
207
217
  setTableRowClassName,
208
218
  clearSelection,
209
219
  clearSelectedList,
220
+ toggleRowExpansion,
210
221
  onTableRowClickHandler,
211
222
  onTableRowContextmenuHandler,
223
+ onTableRowExpandChangeHandler,
212
224
  onTableSelectHandler,
213
225
  isSearchFocus,
214
226
  onSearchInputHandler,
@@ -249,7 +261,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
249
261
  getTotalElements,
250
262
  getTableDataSource,
251
263
  clearSelection,
252
- clearSelectedList
264
+ clearSelectedList,
265
+ toggleRowExpansion
253
266
  });
254
267
  return (_ctx, _cache) => {
255
268
  return openBlock(), createElementBlock(
@@ -316,8 +329,10 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
316
329
  "onUpdate:modelValue": ($event) => __props.filterModel.query = $event,
317
330
  class: "hy-table-search",
318
331
  placeholder: unref(t)("table.searchFor", [__props.controllerText || ""]),
332
+ clearable: "",
319
333
  onFocus: unref(onSearchInputHandler),
320
334
  onBlur: unref(onSearchBlurHandler),
335
+ onClear: unref(onSearchQueryHandler),
321
336
  onKeydown: withKeys(unref(onSearchQueryHandler), ["enter"])
322
337
  }, {
323
338
  append: withCtx(() => [
@@ -336,7 +351,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
336
351
  ]),
337
352
  _: 1
338
353
  /* STABLE */
339
- }, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "onFocus", "onBlur", "onKeydown"])
354
+ }, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "onFocus", "onBlur", "onClear", "onKeydown"])
340
355
  ],
341
356
  2
342
357
  /* CLASS */
@@ -397,7 +412,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
397
412
  __props.type === "default" ? (openBlock(), createBlock(unref(ElTable), mergeProps({
398
413
  key: 0,
399
414
  ref_key: "tableRef",
400
- ref: tableRef,
415
+ ref: tableRef
416
+ }, _ctx.$attrs, {
401
417
  "row-key": unref(getRowKey),
402
418
  data: unref(tableDataSource),
403
419
  "show-header": __props.showHeader,
@@ -410,8 +426,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
410
426
  onSelect: unref(onTableSelectHandler),
411
427
  onSelectAll: unref(onTableSelectHandler),
412
428
  onRowClick: unref(onTableRowClickHandler),
413
- onRowContextmenu: unref(onTableRowContextmenuHandler)
414
- }, _ctx.$attrs), {
429
+ onRowContextmenu: unref(onTableRowContextmenuHandler),
430
+ onExpandChange: unref(onTableRowExpandChangeHandler)
431
+ }), {
415
432
  empty: withCtx(() => [
416
433
  renderSlot(_ctx.$slots, "empty", {}, () => [
417
434
  createElementVNode(
@@ -651,15 +668,15 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
651
668
  ]),
652
669
  _: 3
653
670
  /* FORWARDED */
654
- }, 16, ["row-key", "data", "show-header", "row-class-name", "class", "style", "onSelect", "onSelectAll", "onRowClick", "onRowContextmenu"])) : createCommentVNode("v-if", true),
671
+ }, 16, ["row-key", "data", "show-header", "row-class-name", "class", "style", "onSelect", "onSelectAll", "onRowClick", "onRowContextmenu", "onExpandChange"])) : createCommentVNode("v-if", true),
655
672
  __props.type === "virtual" ? (openBlock(), createBlock(unref(ElAutoResizer), { key: 1 }, {
656
673
  default: withCtx(({ height, width }) => [
657
674
  createVNode(_sfc_main$3, mergeProps({
658
675
  ref_key: "tableRef",
659
- ref: tableRef,
676
+ ref: tableRef
677
+ }, _ctx.$attrs, {
660
678
  width,
661
679
  height,
662
- "row-key": __props.rowKey,
663
680
  data: unref(tableDataSource),
664
681
  columns: unref(tableColumnsList),
665
682
  "columns-editable": unref(tableColumnsEditablele),
@@ -669,13 +686,16 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
669
686
  style: {
670
687
  "font-size": `${unref(parseRem)(__props.fontSize)}rem`
671
688
  },
689
+ "row-key": __props.rowKey,
672
690
  "filter-model": __props.filterModel,
691
+ expandMode: __props.expandMode,
673
692
  onSearch: ($event) => unref(getData)(1),
674
693
  onSelect: unref(onTableSelectHandler),
675
694
  onSelectAll: unref(onTableSelectHandler),
676
695
  onRowClick: unref(onTableRowClickHandler),
677
- onRowContextmenu: unref(onTableRowContextmenuHandler)
678
- }, _ctx.$attrs), createSlots({
696
+ onRowContextmenu: unref(onTableRowContextmenuHandler),
697
+ onExpandChange: __props.onExpandChange
698
+ }), createSlots({
679
699
  empty: withCtx(() => [
680
700
  createElementVNode("div", { class: "w-full h-full flex items-center justify-center border-b border-border" }, [
681
701
  renderSlot(_ctx.$slots, "empty", {}, () => [
@@ -700,7 +720,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
700
720
  ])
701
721
  };
702
722
  })
703
- ]), 1040, ["width", "height", "row-key", "data", "columns", "columns-editable", "show-header", "row-class-name", "show-all-select", "style", "filter-model", "onSearch", "onSelect", "onSelectAll", "onRowClick", "onRowContextmenu"])
723
+ ]), 1040, ["width", "height", "data", "columns", "columns-editable", "show-header", "row-class-name", "show-all-select", "style", "row-key", "filter-model", "expandMode", "onSearch", "onSelect", "onSelectAll", "onRowClick", "onRowContextmenu", "onExpandChange"])
704
724
  ]),
705
725
  _: 3
706
726
  /* FORWARDED */
@@ -0,0 +1,478 @@
1
+ import { defineComponent, useTemplateRef, ref, openBlock, createElementBlock, createElementVNode, createVNode, unref as unref$1, withCtx, Fragment, renderList, createCommentVNode, toDisplayString, renderSlot, createBlock, createTextVNode, createSlots, normalizeProps, guardReactiveProps, normalizeStyle, nextTick } from 'vue';
2
+ import { ElUpload, ElMessage } from 'element-plus';
3
+ import _sfc_main$1 from './tableForm.vue.mjs';
4
+ import { downloadTemplateHandler, doReadExcel } from './js/index.mjs';
5
+ import { useApi } from '../../hooks/useApi.mjs';
6
+ import { useLocale } from '../../hooks/useLocale.mjs';
7
+ import { HyIcon } from '../hyIcon/index.mjs';
8
+ import { HyButton } from '../hyButton/index.mjs';
9
+ import { HyConfirmDialog } from '../hyConfirmDialog/index.mjs';
10
+
11
+ import "./style/batchTableForm.scss";
12
+
13
+ const __default__ = defineComponent({
14
+ name: "HyBatchTableForm"
15
+ });
16
+ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
17
+ props: {
18
+ // 表格配置项
19
+ tableColumns: {
20
+ // 表格的列
21
+ type: Array,
22
+ required: true,
23
+ default: () => []
24
+ },
25
+ formColumns: {
26
+ type: Array,
27
+ default: () => []
28
+ },
29
+ rules: {
30
+ type: Object,
31
+ default: () => ({})
32
+ },
33
+ emptyText: {
34
+ // 空数据时显示的文本内容
35
+ type: String
36
+ },
37
+ fontSize: {
38
+ // 字体大小
39
+ type: Number,
40
+ default: 14
41
+ },
42
+ rowClickExpand: {
43
+ // 点击行展开
44
+ type: Boolean,
45
+ required: false,
46
+ default: true
47
+ },
48
+ // 表单配置项
49
+ columnNum: {
50
+ type: Number,
51
+ default: 2
52
+ },
53
+ size: {
54
+ type: String,
55
+ default: "default"
56
+ // 'large' | 'default' | 'small'
57
+ },
58
+ // 其他配置项
59
+ beforeDataHandle: {
60
+ type: Function
61
+ },
62
+ templateConfig: {
63
+ type: Object,
64
+ default: () => ({
65
+ title: "\u4E0B\u8F7D\u6A21\u677F",
66
+ url: "",
67
+ fileName: ""
68
+ })
69
+ },
70
+ url: {
71
+ type: String
72
+ },
73
+ submitParams: {
74
+ type: Object
75
+ },
76
+ submitHandler: {
77
+ type: Function
78
+ }
79
+ },
80
+ emits: ["submitting", "submit"],
81
+ setup(__props, { expose: __expose, emit: __emit }) {
82
+ const props = __props;
83
+ const emits = __emit;
84
+ const { api } = useApi();
85
+ const { t } = useLocale();
86
+ const containerRef = useTemplateRef("containerRef");
87
+ const tableRef = useTemplateRef("tableRef");
88
+ const active = ref(1);
89
+ const stepList = [
90
+ {
91
+ title: "\u4E0A\u4F20\u5BFC\u5165\u6587\u4EF6",
92
+ description: "\u4E0A\u4F20\u5DF2\u586B\u5199\u5B8C\u6210\u7684<br/>\u6DFB\u52A0\u6A21\u677F\u6587\u4EF6"
93
+ },
94
+ {
95
+ title: "\u81EA\u52A8\u89E3\u6790\u4E0E\u6821\u9A8C",
96
+ description: "\u7CFB\u7EDF\u5C06\u81EA\u52A8\u89E3\u6790\u60A8<br/>\u4E0A\u4F20\u540E\u7684\u6587\u4EF6\u8FDB\u884C\u663E\u793A"
97
+ },
98
+ {
99
+ title: "\u652F\u6301\u4FEE\u6B63\u5F02\u5E38",
100
+ description: "\u5F02\u5E38\u6570\u636E\u5C06\u6807\u8BB0\u63D0\u793A<br/>\u652F\u6301\u4FEE\u6539\u5E76\u5373\u65F6\u6821\u9A8C"
101
+ },
102
+ {
103
+ title: "\u786E\u8BA4\u5BFC\u5165\u6570\u636E",
104
+ description: "\u4EE5\u5F53\u524D\u6570\u636E\u4E3A\u51C6<br/>\u6267\u884C\u6279\u91CF\u5BFC\u5165\u6DFB\u52A0\u6570\u636E"
105
+ }
106
+ ];
107
+ const templateFileName = ref("");
108
+ const submitNumber = ref(0);
109
+ const submitting = ref(false);
110
+ const submitProgress = ref(0);
111
+ function setData(data = []) {
112
+ if (!tableRef.value) return;
113
+ tableRef.value.setData(data);
114
+ }
115
+ function deleteData(data = []) {
116
+ if (!tableRef.value) return;
117
+ tableRef.value.deleteData(data);
118
+ }
119
+ function getTableDataSource() {
120
+ if (!tableRef.value) return [];
121
+ return tableRef.value.getTableDataSource();
122
+ }
123
+ function validate() {
124
+ if (!tableRef.value) return {};
125
+ return tableRef.value.validate();
126
+ }
127
+ async function onUploadChange(file) {
128
+ const type = file.raw.type;
129
+ if (file.raw.size > 1024 * 1024 * 10) {
130
+ ElMessage.error(`\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC710M\uFF01`);
131
+ return false;
132
+ } else {
133
+ if (type.indexOf("application") !== -1) {
134
+ const files = { 0: file.raw };
135
+ try {
136
+ const data = await doReadExcel(files, props);
137
+ if (!data) {
138
+ ElMessage.warning("\u8BFB\u53D6\u6587\u4EF6\u5931\u8D25");
139
+ return;
140
+ }
141
+ active.value++;
142
+ await nextTick();
143
+ setData(data);
144
+ templateFileName.value = file.name;
145
+ } catch (err) {
146
+ console.error(err);
147
+ return;
148
+ }
149
+ } else {
150
+ ElMessage.error("\u6587\u4EF6\u683C\u5F0F\u6709\u8BEF");
151
+ }
152
+ }
153
+ }
154
+ async function onResetUpload() {
155
+ if (tableRef.value) {
156
+ const { total } = tableRef.value.getStatistics();
157
+ if (total) {
158
+ try {
159
+ await new Promise((resolve, reject) => {
160
+ HyConfirmDialog.confirm({
161
+ content: submitNumber.value ? `\u672C\u6B21\u5DF2\u6210\u529F\u5BFC\u5165 ${submitNumber.value} \u6761\u6570\u636E\uFF0C\u91CD\u65B0\u4E0A\u4F20\u5C06\u4E0D\u4F1A\u64A4\u9500\u8FD9\u4E9B\u6570\u636E\u3002\u5269\u4F59\u672A\u5BFC\u5165\u6570\u636E\u5C06\u4F1A\u88AB\u6E05\u7A7A` : `\u91CD\u65B0\u4E0A\u4F20\u5C06\u6E05\u7A7A\u5F53\u524D ${total} \u6761\u6570\u636E, <br />\u662F\u5426\u786E\u8BA4\u91CD\u65B0\u4E0A\u4F20`,
162
+ onClose: reject,
163
+ onCancel: reject,
164
+ onSubmit: resolve
165
+ });
166
+ });
167
+ } catch {
168
+ return;
169
+ }
170
+ }
171
+ }
172
+ templateFileName.value = "";
173
+ active.value = 1;
174
+ submitNumber.value = 0;
175
+ }
176
+ async function submitDataSource() {
177
+ if (!props.url && !props.submitHandler) {
178
+ ElMessage.warning("\u8BF7\u914D\u7F6E\u63D0\u4EA4\u8868\u5355\u5730\u5740");
179
+ return Promise.reject();
180
+ }
181
+ if (submitting.value) {
182
+ HyConfirmDialog.tip({
183
+ content: `\u6570\u636E\u6B63\u5728\u5904\u7406\u4E2D\uFF0C<br/>\u8BF7\u7B49\u5F85\u6570\u636E\u5904\u7406\u5B8C\u6210\u540E\u518D\u5173\u95ED\u5F39\u7A97`
184
+ });
185
+ return Promise.reject();
186
+ }
187
+ const res = validate();
188
+ let { dataSource, total, success, failed } = res;
189
+ if (!total) {
190
+ ElMessage.warning("\u8BF7\u6DFB\u52A0\u6570\u636E");
191
+ return;
192
+ }
193
+ if (!success) {
194
+ ElMessage.warning("\u8BF7\u586B\u5199\u6709\u6548\u4E0A\u4F20\u6570\u636E");
195
+ return;
196
+ }
197
+ if (failed) {
198
+ try {
199
+ await new Promise((resolve, reject) => {
200
+ HyConfirmDialog.confirm({
201
+ content: `\u5F53\u524D\u5B58\u5728<span class="text-danger-2"> ${failed} \u6761\u6570\u636E\u5F02\u5E38</span>\uFF0C\u672C\u6B21\u5C06\u4EC5\u5BFC\u5165 ${success} \u6761\u5BFC\u5165\u5C31\u7EEA\u6570\u636E\uFF0C\u5F02\u5E38\u6570\u636E\u5C06\u88AB\u5FFD\u7565`,
202
+ onClose: reject,
203
+ onCancel: reject,
204
+ onSubmit: resolve
205
+ });
206
+ });
207
+ } catch {
208
+ return Promise.reject();
209
+ }
210
+ }
211
+ const submitList = [];
212
+ submitProgress.value = 0;
213
+ submitting.value = true;
214
+ emits("submitting");
215
+ for (let i = 0; i <= dataSource.length - 1; i++) {
216
+ const target = dataSource[i];
217
+ const { onlyId, errorMsg, errorMap, children, ...data } = target;
218
+ submitProgress.value = Math.floor((i + 1) / total * 100);
219
+ if (errorMsg) {
220
+ continue;
221
+ }
222
+ let res2;
223
+ try {
224
+ if (props.submitHandler) {
225
+ res2 = await props.submitHandler(data);
226
+ } else {
227
+ res2 = await unref(api).post(props.url, props.submitParams);
228
+ }
229
+ if (res2.code === 200) {
230
+ submitNumber.value++;
231
+ submitList.push(target);
232
+ } else {
233
+ target.errorMsg = {
234
+ prop: null,
235
+ message: res2.msg
236
+ };
237
+ }
238
+ } catch (err) {
239
+ target.errorMsg = {
240
+ prop: null,
241
+ message: err?.msg ? err.msg : err
242
+ };
243
+ console.error(err);
244
+ }
245
+ }
246
+ deleteData(submitList);
247
+ submitting.value = false;
248
+ const submitResult = {
249
+ total,
250
+ success: submitList.length,
251
+ failed: total - submitList.length,
252
+ result: submitList.length === total
253
+ };
254
+ if (submitResult.result) {
255
+ ElMessage.success(`${submitResult.total} \u6761\u6570\u636E\u5BFC\u5165\u5B8C\u6210\uFF0C\u5DF2\u66F4\u65B0`);
256
+ emits("submit", submitResult);
257
+ onResetUpload();
258
+ } else {
259
+ ElMessage.warning(
260
+ `${submitResult.success} \u6761\u6570\u636E\u5BFC\u5165\u6210\u529F\uFF0C ${submitResult.failed} \u6761\u6570\u636E\u5F02\u5E38\uFF0C\u8BF7\u8C03\u6574`
261
+ );
262
+ emits("submit", submitResult);
263
+ }
264
+ }
265
+ __expose({
266
+ setData,
267
+ deleteData,
268
+ getTableDataSource,
269
+ validate,
270
+ submitDataSource
271
+ });
272
+ return (_ctx, _cache) => {
273
+ return openBlock(), createElementBlock(
274
+ "div",
275
+ {
276
+ ref_key: "containerRef",
277
+ ref: containerRef,
278
+ class: "hy-batch-table-form"
279
+ },
280
+ [
281
+ active.value === 1 ? (openBlock(), createElementBlock("div", {
282
+ key: 0,
283
+ class: "max-h-full overflow-y-auto scroll-body"
284
+ }, [
285
+ createElementVNode("div", { class: "hy-batch-table-form-upload-box" }, [
286
+ createVNode(unref$1(ElUpload), {
287
+ accept: ".xls,.xlsx",
288
+ drag: "",
289
+ multiple: false,
290
+ "auto-upload": false,
291
+ "show-file-list": false,
292
+ class: "w-full h-full",
293
+ "on-change": onUploadChange
294
+ }, {
295
+ default: withCtx(() => [
296
+ createVNode(unref$1(HyIcon), {
297
+ "svg-name": "analytics-echarts-sos",
298
+ "class-name": "!w-[58px] !h-[66px] mb-4"
299
+ }),
300
+ createElementVNode("div", { class: "mb-1.5 text-main" }, [
301
+ createElementVNode("span", null, "\u70B9\u51FB\u6216\u5C06 \u6587\u4EF6 \u62D6\u62FD\u5230\u6B64\u5904\u4E0A\u4F20")
302
+ ]),
303
+ createElementVNode("div", { class: "text-auxiliary text-xs" }, "\u4E00\u6B21\u4EC5\u652F\u6301\u4E0A\u4F20\u4E00\u4E2A\u6587\u4EF6"),
304
+ createElementVNode("div", { class: "w-full text-main absolute left-1/2 bottom-4 transform -translate-x-1/2" }, [
305
+ createElementVNode("div", { class: "flex items-center justify-center text-xs text-auxiliary gap-2" }, [
306
+ createElementVNode("span", null, "\u6587\u4EF6\u652F\u6301\uFF1A"),
307
+ createElementVNode("div", { class: "border border-border rounded py-1 px-2.5 bg-background-4" }, " .xls "),
308
+ createElementVNode("div", { class: "border border-border rounded py-1 px-2.5 bg-background-4" }, " .xlsx "),
309
+ createElementVNode("span", null, "\u5355\u6587\u4EF6\u4E0D\u8D85\u8FC7 10 MB")
310
+ ])
311
+ ])
312
+ ]),
313
+ _: 1
314
+ /* STABLE */
315
+ })
316
+ ]),
317
+ createElementVNode("div", { class: "hy-batch-table-form-step-box" }, [
318
+ createElementVNode("div", { class: "text-auxiliary text-center mb-[30px]" }, [
319
+ createElementVNode("span", null, "\u6279\u91CF\u6DFB\u52A0\u5BFC\u5165\u6D41\u7A0B\u8BF4\u660E")
320
+ ]),
321
+ createElementVNode("div", { class: "w-full flex" }, [
322
+ (openBlock(), createElementBlock(
323
+ Fragment,
324
+ null,
325
+ renderList(stepList, (item, index) => {
326
+ return createElementVNode("div", {
327
+ key: index,
328
+ class: "w-0 flex-1 flex flex-col items-center relative"
329
+ }, [
330
+ index < stepList.length - 1 ? (openBlock(), createElementBlock("div", {
331
+ key: 0,
332
+ class: "w-3/4 absolute top-[19px] left-full transform -translate-x-1/2",
333
+ style: { "border-top": "2px dashed rgba(var(--hy-border))" }
334
+ })) : createCommentVNode("v-if", true),
335
+ createElementVNode("div", { class: "w-[38px] h-[38px] flex items-center justify-center border border-solid border-border rounded-full bg-background box-border" }, [
336
+ createElementVNode(
337
+ "span",
338
+ { class: "text-base text-main" },
339
+ toDisplayString(index + 1),
340
+ 1
341
+ /* TEXT */
342
+ )
343
+ ]),
344
+ createElementVNode(
345
+ "span",
346
+ { class: "text-main font-bold text-sm mt-3 mb-2" },
347
+ toDisplayString(item.title),
348
+ 1
349
+ /* TEXT */
350
+ ),
351
+ createElementVNode("div", {
352
+ innerHTML: item.description,
353
+ class: "text-auxiliary text-center mb-3 whitespace-nowrap"
354
+ }, null, 8, ["innerHTML"]),
355
+ renderSlot(_ctx.$slots, "template-down", {}, () => [
356
+ index === 0 ? (openBlock(), createBlock(unref$1(HyButton), {
357
+ key: 0,
358
+ type: "primary",
359
+ link: "",
360
+ onClick: () => unref$1(downloadTemplateHandler)(props)
361
+ }, {
362
+ default: withCtx(() => [
363
+ createTextVNode(
364
+ toDisplayString(__props.templateConfig ? __props.templateConfig.title : "\u4E0B\u8F7D\u6A21\u677F"),
365
+ 1
366
+ /* TEXT */
367
+ )
368
+ ]),
369
+ _: 1
370
+ /* STABLE */
371
+ }, 8, ["onClick"])) : createCommentVNode("v-if", true)
372
+ ])
373
+ ]);
374
+ }),
375
+ 64
376
+ /* STABLE_FRAGMENT */
377
+ ))
378
+ ])
379
+ ])
380
+ ])) : active.value === 2 ? (openBlock(), createElementBlock("div", {
381
+ key: 1,
382
+ class: "h-full flex flex-col"
383
+ }, [
384
+ createElementVNode("div", { class: "hy-batch-table-form-template-box" }, [
385
+ createElementVNode("div", { class: "flex items-center gap-2" }, [
386
+ createVNode(unref$1(HyIcon), {
387
+ "svg-name": "analytics-echarts-sos",
388
+ "class-name": "!w-[18px] !h-[22px]"
389
+ }),
390
+ createElementVNode(
391
+ "span",
392
+ { class: "text-theme" },
393
+ toDisplayString(templateFileName.value),
394
+ 1
395
+ /* TEXT */
396
+ ),
397
+ createElementVNode("span", { class: "text-auxiliary" }, "\u89E3\u6790\u5B8C\u6210")
398
+ ]),
399
+ createVNode(unref$1(HyButton), {
400
+ type: "primary",
401
+ link: "",
402
+ size: "small",
403
+ onClick: onResetUpload
404
+ }, {
405
+ default: withCtx(() => [
406
+ createTextVNode("\u91CD\u65B0\u4E0A\u4F20\u6587\u4EF6")
407
+ ]),
408
+ _: 1
409
+ /* STABLE */
410
+ })
411
+ ]),
412
+ createVNode(_sfc_main$1, {
413
+ ref_key: "tableRef",
414
+ ref: tableRef,
415
+ tableColumns: __props.tableColumns,
416
+ formColumns: __props.formColumns,
417
+ rules: __props.rules,
418
+ rowClickExpand: __props.rowClickExpand,
419
+ columnNum: __props.columnNum,
420
+ size: __props.size,
421
+ class: "h-0 flex-1"
422
+ }, createSlots({
423
+ _: 2
424
+ /* DYNAMIC */
425
+ }, [
426
+ renderList(_ctx.$slots, (_, slotName) => {
427
+ return {
428
+ name: slotName,
429
+ fn: withCtx((scope) => [
430
+ renderSlot(_ctx.$slots, slotName, normalizeProps(guardReactiveProps(scope)))
431
+ ])
432
+ };
433
+ })
434
+ ]), 1032, ["tableColumns", "formColumns", "rules", "rowClickExpand", "columnNum", "size"])
435
+ ])) : createCommentVNode("v-if", true),
436
+ submitting.value ? (openBlock(), createElementBlock("div", {
437
+ key: 2,
438
+ class: "absolute top-0 right-0 bottom-0 left-0 z-10 flex items-center justify-center"
439
+ }, [
440
+ createElementVNode("div", { class: "w-full h-full absolute bg-[rgba(var(--hy-background-4),0.9)] backdrop-blur-sm" }),
441
+ createElementVNode("div", { class: "flex flex-col items-center text-theme text-xs relative" }, [
442
+ createVNode(unref$1(HyIcon), {
443
+ "svg-name": "analytics-echarts-sos",
444
+ "class-name": "!w-[58px] !h-[66px] mb-[18px]"
445
+ }),
446
+ createElementVNode("div", { class: "flex items-center" }, [
447
+ createElementVNode("span", null, "\u6570\u636E\u6B63\u5728\u5BFC\u5165\u4E2D"),
448
+ createElementVNode(
449
+ "span",
450
+ { class: "ml-1 mr-3" },
451
+ toDisplayString(submitProgress.value) + "%",
452
+ 1
453
+ /* TEXT */
454
+ ),
455
+ createElementVNode("div", { class: "w-[68px] h-0.5 bg-auxiliary rounded-full" }, [
456
+ createElementVNode(
457
+ "div",
458
+ {
459
+ class: "h-full bg-theme rounded-full",
460
+ style: normalizeStyle({ width: `${submitProgress.value}%` })
461
+ },
462
+ null,
463
+ 4
464
+ /* STYLE */
465
+ )
466
+ ])
467
+ ])
468
+ ])
469
+ ])) : createCommentVNode("v-if", true)
470
+ ],
471
+ 512
472
+ /* NEED_PATCH */
473
+ );
474
+ };
475
+ }
476
+ });
477
+
478
+ export { _sfc_main as default };
@@ -1,6 +1,9 @@
1
1
  import _sfc_main from './tableForm.vue.mjs';
2
+ import _sfc_main$1 from './batchTableForm.vue.mjs';
3
+ export { useAppTableForm } from './js/useAppTableForm.mjs';
2
4
  import { withInstall } from '../../utils/handler.mjs';
3
5
 
4
6
  const HyTableForm = withInstall(_sfc_main);
7
+ const HyBatchTableForm = withInstall(_sfc_main$1);
5
8
 
6
- export { HyTableForm, HyTableForm as default };
9
+ export { HyBatchTableForm, HyTableForm, HyTableForm as default };