hy-dispatch-ui-v3 0.2.39 → 0.2.41
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.
- package/es/components/hyBatchUploadDialog/batchUploadDialog.vue.mjs +278 -0
- package/es/components/hyBatchUploadDialog/index.mjs +6 -0
- package/es/components/hyBatchUploadDialog/style/batchUploadDialog.scss +0 -0
- package/es/components/hyButton/style/button.scss +1 -1
- package/es/components/hyDialog/dialog.vue.mjs +10 -6
- package/es/components/hyTableActionButton/tableActionButton.vue.mjs +3 -4
- package/es/components/hyTableForm/batchTableForm.vue.mjs +93 -31
- package/es/components/hyTableForm/style/batchTableForm.scss +62 -0
- package/es/components/hyTableForm/tableForm.vue.mjs +3 -1
- package/es/components/index.mjs +1 -0
- package/es/index.mjs +2 -0
- package/es/utils/index.mjs +1 -0
- package/es/utils/permission.mjs +498 -0
- package/es/version.mjs +1 -1
- package/lib/components/hyBatchUploadDialog/batchUploadDialog.vue.js +282 -0
- package/lib/components/hyBatchUploadDialog/index.js +11 -0
- package/lib/components/hyBatchUploadDialog/style/batchUploadDialog.scss +0 -0
- package/lib/components/hyButton/style/button.scss +1 -1
- package/lib/components/hyDialog/dialog.vue.js +9 -5
- package/lib/components/hyTableActionButton/tableActionButton.vue.js +1 -2
- package/lib/components/hyTableForm/batchTableForm.vue.js +91 -29
- package/lib/components/hyTableForm/style/batchTableForm.scss +62 -0
- package/lib/components/hyTableForm/tableForm.vue.js +3 -1
- package/lib/components/index.js +38 -36
- package/lib/index.js +40 -36
- package/lib/utils/index.js +2 -0
- package/lib/utils/permission.js +500 -0
- package/lib/version.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { defineComponent, useTemplateRef, useModel, ref, openBlock, createBlock, unref, mergeProps, createSlots, withCtx, renderList, renderSlot, normalizeProps, guardReactiveProps, createCommentVNode, createVNode, createTextVNode, toDisplayString, createElementBlock, mergeModels } from 'vue';
|
|
2
|
+
import { ElIcon } from 'element-plus';
|
|
3
|
+
import { Warning } from '@element-plus/icons-vue';
|
|
4
|
+
import { HyDialog } from '../hyDialog/index.mjs';
|
|
5
|
+
import { HyBatchTableForm } from '../hyTableForm/index.mjs';
|
|
6
|
+
import { HyTooltip } from '../hyTooltip/index.mjs';
|
|
7
|
+
import { HyButton } from '../hyButton/index.mjs';
|
|
8
|
+
|
|
9
|
+
import "./style/batchUploadDialog.scss";
|
|
10
|
+
|
|
11
|
+
const __default__ = defineComponent({
|
|
12
|
+
name: "HyBatchUploadDialog"
|
|
13
|
+
});
|
|
14
|
+
const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
15
|
+
props: /* @__PURE__ */ mergeModels({
|
|
16
|
+
// 弹窗
|
|
17
|
+
title: {
|
|
18
|
+
type: String
|
|
19
|
+
},
|
|
20
|
+
width: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: "920"
|
|
23
|
+
},
|
|
24
|
+
dialogType: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: "right"
|
|
27
|
+
},
|
|
28
|
+
// 是否可缩小化
|
|
29
|
+
ifShrink: { type: Boolean, default: false },
|
|
30
|
+
// 是否拖拽
|
|
31
|
+
ifDraggable: { type: Boolean, default: true },
|
|
32
|
+
// 表格配置项
|
|
33
|
+
tableColumns: {
|
|
34
|
+
// 表格的列
|
|
35
|
+
type: Array,
|
|
36
|
+
required: true,
|
|
37
|
+
default: () => []
|
|
38
|
+
},
|
|
39
|
+
formColumns: {
|
|
40
|
+
type: Array,
|
|
41
|
+
default: () => []
|
|
42
|
+
},
|
|
43
|
+
rules: {
|
|
44
|
+
type: Object,
|
|
45
|
+
default: () => ({})
|
|
46
|
+
},
|
|
47
|
+
emptyText: {
|
|
48
|
+
// 空数据时显示的文本内容
|
|
49
|
+
type: String
|
|
50
|
+
},
|
|
51
|
+
fontSize: {
|
|
52
|
+
// 字体大小
|
|
53
|
+
type: Number,
|
|
54
|
+
default: 14
|
|
55
|
+
},
|
|
56
|
+
rowClickExpand: {
|
|
57
|
+
// 点击行展开
|
|
58
|
+
type: Boolean,
|
|
59
|
+
required: false,
|
|
60
|
+
default: true
|
|
61
|
+
},
|
|
62
|
+
// 表单配置项
|
|
63
|
+
columnNum: {
|
|
64
|
+
type: Number,
|
|
65
|
+
default: 2
|
|
66
|
+
},
|
|
67
|
+
size: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: "default"
|
|
70
|
+
// 'large' | 'default' | 'small'
|
|
71
|
+
},
|
|
72
|
+
// 其他配置项
|
|
73
|
+
beforeDataHandle: {
|
|
74
|
+
type: Function
|
|
75
|
+
},
|
|
76
|
+
submitHandler: {
|
|
77
|
+
type: Function
|
|
78
|
+
}
|
|
79
|
+
}, {
|
|
80
|
+
"modelValue": { type: Boolean, default: false },
|
|
81
|
+
"modelModifiers": {}
|
|
82
|
+
}),
|
|
83
|
+
emits: /* @__PURE__ */ mergeModels([
|
|
84
|
+
"uploading",
|
|
85
|
+
"uploaded",
|
|
86
|
+
"reset",
|
|
87
|
+
"validate",
|
|
88
|
+
"submitting",
|
|
89
|
+
"submit"
|
|
90
|
+
], ["update:modelValue"]),
|
|
91
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
92
|
+
const emits = __emit;
|
|
93
|
+
const batchTableFormRef = useTemplateRef("batchTableFormRef");
|
|
94
|
+
const visible = useModel(__props, "modelValue");
|
|
95
|
+
const showSubmit = ref(false);
|
|
96
|
+
const isSubmitting = ref(false);
|
|
97
|
+
const failedCount = ref(0);
|
|
98
|
+
const failedStatus = ref(null);
|
|
99
|
+
async function show() {
|
|
100
|
+
visible.value = true;
|
|
101
|
+
showSubmit.value = false;
|
|
102
|
+
failedCount.value = 0;
|
|
103
|
+
failedStatus.value = null;
|
|
104
|
+
}
|
|
105
|
+
function onTableUploadingHandler(...args) {
|
|
106
|
+
emits("uploading", ...args);
|
|
107
|
+
}
|
|
108
|
+
function onTableUploadedHandler(...args) {
|
|
109
|
+
showSubmit.value = true;
|
|
110
|
+
emits("uploaded", ...args);
|
|
111
|
+
}
|
|
112
|
+
function onTableResetHandler(...args) {
|
|
113
|
+
failedCount.value = 0;
|
|
114
|
+
failedStatus.value = null;
|
|
115
|
+
showSubmit.value = false;
|
|
116
|
+
emits("reset", ...args);
|
|
117
|
+
}
|
|
118
|
+
function onTableValidateHandler(params) {
|
|
119
|
+
const { row, prop, isValid, message, total, success, failed } = params;
|
|
120
|
+
failedCount.value = failed;
|
|
121
|
+
failedStatus.value = !failed ? null : failedStatus.value || "validate";
|
|
122
|
+
emits("validate", params);
|
|
123
|
+
}
|
|
124
|
+
function onTableSubmittingHandler(...args) {
|
|
125
|
+
isSubmitting.value = true;
|
|
126
|
+
emits("submitting", ...args);
|
|
127
|
+
}
|
|
128
|
+
function onTableSubmitHandler(params) {
|
|
129
|
+
const { total, success, failed, result } = params;
|
|
130
|
+
if (result) {
|
|
131
|
+
visible.value = false;
|
|
132
|
+
failedCount.value = null;
|
|
133
|
+
failedStatus.value = null;
|
|
134
|
+
} else {
|
|
135
|
+
failedCount.value = failed;
|
|
136
|
+
failedStatus.value = "submit";
|
|
137
|
+
}
|
|
138
|
+
isSubmitting.value = false;
|
|
139
|
+
emits("submit", params);
|
|
140
|
+
}
|
|
141
|
+
async function onSubmitHandler() {
|
|
142
|
+
await batchTableFormRef.value.validate();
|
|
143
|
+
batchTableFormRef.value.submitDataSource();
|
|
144
|
+
}
|
|
145
|
+
__expose({
|
|
146
|
+
show,
|
|
147
|
+
getTableDataSource: () => {
|
|
148
|
+
return batchTableFormRef.value.getTableDataSource();
|
|
149
|
+
},
|
|
150
|
+
validate: async () => {
|
|
151
|
+
return await batchTableFormRef.value.validate();
|
|
152
|
+
},
|
|
153
|
+
submitDataSource: () => {
|
|
154
|
+
return batchTableFormRef.value.submitDataSource();
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
return (_ctx, _cache) => {
|
|
158
|
+
return openBlock(), createBlock(unref(HyDialog), mergeProps({
|
|
159
|
+
modelValue: visible.value,
|
|
160
|
+
"onUpdate:modelValue": ($event) => visible.value = $event,
|
|
161
|
+
loading: isSubmitting.value,
|
|
162
|
+
"onUpdate:loading": ($event) => isSubmitting.value = $event,
|
|
163
|
+
title: __props.title,
|
|
164
|
+
width: __props.width,
|
|
165
|
+
"dialog-type": __props.dialogType,
|
|
166
|
+
"show-operate": true,
|
|
167
|
+
"show-submit": false,
|
|
168
|
+
"show-cancel": !isSubmitting.value,
|
|
169
|
+
ifShrink: __props.ifShrink,
|
|
170
|
+
ifDraggable: __props.ifDraggable
|
|
171
|
+
}, _ctx.$attrs), createSlots({
|
|
172
|
+
"operate-left-box": withCtx(() => [
|
|
173
|
+
failedCount.value ? (openBlock(), createElementBlock("div", {
|
|
174
|
+
key: 0,
|
|
175
|
+
class: "flex items-center gap-1.5 text-xs text-warning"
|
|
176
|
+
}, [
|
|
177
|
+
createVNode(unref(ElIcon), null, {
|
|
178
|
+
default: withCtx(() => [
|
|
179
|
+
createVNode(unref(Warning))
|
|
180
|
+
]),
|
|
181
|
+
_: 1
|
|
182
|
+
/* STABLE */
|
|
183
|
+
}),
|
|
184
|
+
failedStatus.value === "validate" ? (openBlock(), createElementBlock(
|
|
185
|
+
"span",
|
|
186
|
+
{ key: 0 },
|
|
187
|
+
"\u5F53\u524D " + toDisplayString(failedCount.value) + " \u6761\u5F02\u5E38\u6570\u636E\uFF0C\u70B9\u51FB\u5BFC\u5165\u5C06\u4EC5\u5BFC\u5165\u5C31\u7EEA\u6570\u636E\uFF0C\u5F02\u5E38\u6570\u636E\u5C06\u88AB\u5FFD\u7565\u3002",
|
|
188
|
+
1
|
|
189
|
+
/* TEXT */
|
|
190
|
+
)) : (openBlock(), createElementBlock(
|
|
191
|
+
"span",
|
|
192
|
+
{ key: 1 },
|
|
193
|
+
"\u5F53\u524D " + toDisplayString(failedCount.value) + " \u6761\u5F02\u5E38\u6570\u636E\uFF0C\u8BF7\u4FEE\u6B63\u5185\u5BB9",
|
|
194
|
+
1
|
|
195
|
+
/* TEXT */
|
|
196
|
+
))
|
|
197
|
+
])) : createCommentVNode("v-if", true)
|
|
198
|
+
]),
|
|
199
|
+
"operate-right-box": withCtx(() => [
|
|
200
|
+
showSubmit.value ? (openBlock(), createBlock(unref(HyTooltip), {
|
|
201
|
+
key: 0,
|
|
202
|
+
disabled: !isSubmitting.value,
|
|
203
|
+
content: "\u6570\u636E\u6B63\u5728\u5BFC\u5165\u4E2D\uFF0C\u8BF7\u7A0D\u7B49"
|
|
204
|
+
}, {
|
|
205
|
+
default: withCtx(() => [
|
|
206
|
+
createVNode(unref(HyButton), {
|
|
207
|
+
type: "primary",
|
|
208
|
+
loading: isSubmitting.value,
|
|
209
|
+
class: "!min-w-[120px]",
|
|
210
|
+
onClick: onSubmitHandler
|
|
211
|
+
}, {
|
|
212
|
+
default: withCtx(() => [
|
|
213
|
+
createTextVNode(
|
|
214
|
+
toDisplayString(isSubmitting.value ? "\u6B63\u5728\u5BFC\u5165" : "\u786E\u8BA4\u5BFC\u5165"),
|
|
215
|
+
1
|
|
216
|
+
/* TEXT */
|
|
217
|
+
)
|
|
218
|
+
]),
|
|
219
|
+
_: 1
|
|
220
|
+
/* STABLE */
|
|
221
|
+
}, 8, ["loading"])
|
|
222
|
+
]),
|
|
223
|
+
_: 1
|
|
224
|
+
/* STABLE */
|
|
225
|
+
}, 8, ["disabled"])) : createCommentVNode("v-if", true)
|
|
226
|
+
]),
|
|
227
|
+
default: withCtx(() => [
|
|
228
|
+
visible.value ? (openBlock(), createBlock(unref(HyBatchTableForm), {
|
|
229
|
+
key: 0,
|
|
230
|
+
ref_key: "batchTableFormRef",
|
|
231
|
+
ref: batchTableFormRef,
|
|
232
|
+
tableColumns: __props.tableColumns,
|
|
233
|
+
formColumns: __props.formColumns,
|
|
234
|
+
rules: __props.rules,
|
|
235
|
+
emptyText: __props.emptyText,
|
|
236
|
+
fontSize: __props.fontSize,
|
|
237
|
+
rowClickExpand: __props.rowClickExpand,
|
|
238
|
+
columnNum: __props.columnNum,
|
|
239
|
+
size: __props.size,
|
|
240
|
+
beforeDataHandle: __props.beforeDataHandle,
|
|
241
|
+
"submit-handler": __props.submitHandler,
|
|
242
|
+
onUploading: onTableUploadingHandler,
|
|
243
|
+
onUploaded: onTableUploadedHandler,
|
|
244
|
+
onReset: onTableResetHandler,
|
|
245
|
+
onValidate: onTableValidateHandler,
|
|
246
|
+
onSubmitting: onTableSubmittingHandler,
|
|
247
|
+
onSubmit: onTableSubmitHandler
|
|
248
|
+
}, createSlots({
|
|
249
|
+
_: 2
|
|
250
|
+
/* DYNAMIC */
|
|
251
|
+
}, [
|
|
252
|
+
renderList(_ctx.$slots, (_, slotName) => {
|
|
253
|
+
return {
|
|
254
|
+
name: slotName,
|
|
255
|
+
fn: withCtx((scope) => [
|
|
256
|
+
renderSlot(_ctx.$slots, slotName, normalizeProps(guardReactiveProps(scope)))
|
|
257
|
+
])
|
|
258
|
+
};
|
|
259
|
+
})
|
|
260
|
+
]), 1032, ["tableColumns", "formColumns", "rules", "emptyText", "fontSize", "rowClickExpand", "columnNum", "size", "beforeDataHandle", "submit-handler"])) : createCommentVNode("v-if", true)
|
|
261
|
+
]),
|
|
262
|
+
_: 2
|
|
263
|
+
/* DYNAMIC */
|
|
264
|
+
}, [
|
|
265
|
+
renderList(_ctx.$slots, (_, slotName) => {
|
|
266
|
+
return {
|
|
267
|
+
name: slotName,
|
|
268
|
+
fn: withCtx((scope) => [
|
|
269
|
+
renderSlot(_ctx.$slots, slotName, normalizeProps(guardReactiveProps(scope)))
|
|
270
|
+
])
|
|
271
|
+
};
|
|
272
|
+
})
|
|
273
|
+
]), 1040, ["modelValue", "onUpdate:modelValue", "loading", "onUpdate:loading", "title", "width", "dialog-type", "show-cancel", "ifShrink", "ifDraggable"]);
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
export { _sfc_main as default };
|
|
File without changes
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
.hy-button {
|
|
2
2
|
height: 32px;
|
|
3
|
-
border: 0;
|
|
4
3
|
outline: none;
|
|
5
4
|
appearance: none;
|
|
6
5
|
-webkit-appearance: none;
|
|
@@ -10,6 +9,7 @@
|
|
|
10
9
|
white-space: nowrap;
|
|
11
10
|
font-size: 14px;
|
|
12
11
|
padding: 2px;
|
|
12
|
+
border: 1px solid transparent;
|
|
13
13
|
box-sizing: border-box;
|
|
14
14
|
|
|
15
15
|
&:disabled,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useModel,
|
|
1
|
+
import { useModel, computed, ref, openBlock, createElementBlock, Fragment, createCommentVNode, createVNode, unref, mergeProps, withCtx, createElementVNode, renderSlot, normalizeClass, createBlock, withModifiers, createTextVNode, toDisplayString, mergeModels, defineComponent } from 'vue';
|
|
2
2
|
import { ElDialog } from 'element-plus';
|
|
3
3
|
import { useLocale } from '../../hooks/useLocale.mjs';
|
|
4
4
|
import { HyButton } from '../hyButton/index.mjs';
|
|
@@ -63,15 +63,17 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
63
63
|
onSubmit: Function
|
|
64
64
|
}, {
|
|
65
65
|
"modelValue": { type: Boolean, default: false },
|
|
66
|
-
"modelModifiers": {}
|
|
66
|
+
"modelModifiers": {},
|
|
67
|
+
"loading": { type: Boolean, default: false },
|
|
68
|
+
"loadingModifiers": {}
|
|
67
69
|
}),
|
|
68
|
-
emits: /* @__PURE__ */ mergeModels(["onMinimized", "onDialogMousedown"], ["update:modelValue"]),
|
|
70
|
+
emits: /* @__PURE__ */ mergeModels(["onMinimized", "onDialogMousedown"], ["update:modelValue", "update:loading"]),
|
|
69
71
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
70
72
|
const props = __props;
|
|
71
73
|
const emits = __emit;
|
|
72
74
|
const { t } = useLocale();
|
|
73
75
|
const visible = useModel(__props, "modelValue");
|
|
74
|
-
const loading =
|
|
76
|
+
const loading = useModel(__props, "loading");
|
|
75
77
|
const dialogTypeRight = computed(() => {
|
|
76
78
|
return props.dialogType === "right";
|
|
77
79
|
});
|
|
@@ -234,6 +236,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
234
236
|
]),
|
|
235
237
|
default: withCtx(() => [
|
|
236
238
|
createElementVNode("div", { class: "h-full flex flex-col text-main" }, [
|
|
239
|
+
renderSlot(_ctx.$slots, "before-content"),
|
|
237
240
|
renderSlot(_ctx.$slots, "content", {}, () => [
|
|
238
241
|
createElementVNode(
|
|
239
242
|
"div",
|
|
@@ -249,11 +252,11 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
249
252
|
/* CLASS */
|
|
250
253
|
)
|
|
251
254
|
]),
|
|
255
|
+
renderSlot(_ctx.$slots, "after-content"),
|
|
252
256
|
__props.showOperate ? (openBlock(), createElementBlock("div", {
|
|
253
257
|
key: 0,
|
|
254
258
|
class: "flex items-center flex-row-reverse justify-between p-5 pr-[26px] mt-auto box-border"
|
|
255
259
|
}, [
|
|
256
|
-
renderSlot(_ctx.$slots, "operate-left-box"),
|
|
257
260
|
createElementVNode("div", { class: "flex items-center" }, [
|
|
258
261
|
renderSlot(_ctx.$slots, "operate", {}, () => [
|
|
259
262
|
__props.showCancel ? (openBlock(), createBlock(unref(HyButton), {
|
|
@@ -294,7 +297,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
294
297
|
}, 8, ["type", "disabled"])) : createCommentVNode("v-if", true)
|
|
295
298
|
]),
|
|
296
299
|
renderSlot(_ctx.$slots, "operate-right-box")
|
|
297
|
-
])
|
|
300
|
+
]),
|
|
301
|
+
renderSlot(_ctx.$slots, "operate-left-box")
|
|
298
302
|
])) : createCommentVNode("v-if", true)
|
|
299
303
|
])
|
|
300
304
|
]),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent, ref, computed, watch,
|
|
1
|
+
import { defineComponent, ref, computed, watch, openBlock, createElementBlock, createBlock, unref, withCtx, createVNode, normalizeClass, createTextVNode, toDisplayString, createElementVNode, Fragment, renderList, createCommentVNode, normalizeStyle } from 'vue';
|
|
2
2
|
import { ElPopover, ElIcon } from 'element-plus';
|
|
3
|
-
import { Warning } from '@element-plus/icons-vue';
|
|
3
|
+
import { Warning, ArrowDown } from '@element-plus/icons-vue';
|
|
4
4
|
import { useLocale } from '../../hooks/useLocale.mjs';
|
|
5
5
|
import { HyTooltip } from '../hyTooltip/index.mjs';
|
|
6
6
|
import { HyButton } from '../hyButton/index.mjs';
|
|
@@ -119,7 +119,6 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
119
119
|
watch(() => props.operateList, setSelectedData, { deep: true, immediate: true });
|
|
120
120
|
__expose({});
|
|
121
121
|
return (_ctx, _cache) => {
|
|
122
|
-
const _component_ArrowDown = resolveComponent("ArrowDown");
|
|
123
122
|
return dataList.value.length ? (openBlock(), createElementBlock("div", {
|
|
124
123
|
key: 0,
|
|
125
124
|
class: "hy-table-action-button"
|
|
@@ -203,7 +202,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
203
202
|
}])
|
|
204
203
|
}, {
|
|
205
204
|
default: withCtx(() => [
|
|
206
|
-
createVNode(
|
|
205
|
+
createVNode(unref(ArrowDown))
|
|
207
206
|
]),
|
|
208
207
|
_: 1
|
|
209
208
|
/* STABLE */
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { defineComponent, useTemplateRef, ref, openBlock, createElementBlock, createElementVNode, createVNode, unref as unref$1, withCtx, Fragment, renderList, createCommentVNode, toDisplayString, renderSlot,
|
|
2
|
-
import { ElUpload, ElMessage } from 'element-plus';
|
|
1
|
+
import { defineComponent, useTemplateRef, ref, nextTick, openBlock, createElementBlock, createElementVNode, createVNode, unref as unref$1, withCtx, Fragment, renderList, createCommentVNode, toDisplayString, renderSlot, createTextVNode, mergeProps, createSlots, normalizeProps, guardReactiveProps, normalizeStyle } from 'vue';
|
|
2
|
+
import { ElUpload, ElIcon, ElMessage } from 'element-plus';
|
|
3
|
+
import { Loading } from '@element-plus/icons-vue';
|
|
3
4
|
import _sfc_main$1 from './tableForm.vue.mjs';
|
|
4
5
|
import { downloadTemplateHandler, doReadExcel } from './js/index.mjs';
|
|
5
6
|
import { useApi } from '../../hooks/useApi.mjs';
|
|
6
7
|
import { useLocale } from '../../hooks/useLocale.mjs';
|
|
8
|
+
import { isArray } from '../../utils/is.mjs';
|
|
7
9
|
import { HyIcon } from '../hyIcon/index.mjs';
|
|
8
10
|
import { HyButton } from '../hyButton/index.mjs';
|
|
9
11
|
import { HyConfirmDialog } from '../hyConfirmDialog/index.mjs';
|
|
@@ -77,7 +79,13 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
77
79
|
type: Function
|
|
78
80
|
}
|
|
79
81
|
},
|
|
80
|
-
emits: [
|
|
82
|
+
emits: [
|
|
83
|
+
"uploading",
|
|
84
|
+
"uploaded",
|
|
85
|
+
"reset",
|
|
86
|
+
"submitting",
|
|
87
|
+
"submit"
|
|
88
|
+
],
|
|
81
89
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
82
90
|
const props = __props;
|
|
83
91
|
const emits = __emit;
|
|
@@ -104,10 +112,12 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
104
112
|
description: "\u4EE5\u5F53\u524D\u6570\u636E\u4E3A\u51C6<br/>\u6267\u884C\u6279\u91CF\u5BFC\u5165\u6DFB\u52A0\u6570\u636E"
|
|
105
113
|
}
|
|
106
114
|
];
|
|
115
|
+
const isUploading = ref(false);
|
|
107
116
|
const templateFileName = ref("");
|
|
108
117
|
const submitNumber = ref(0);
|
|
109
118
|
const submitting = ref(false);
|
|
110
119
|
const submitProgress = ref(0);
|
|
120
|
+
const submitModel = ref("default");
|
|
111
121
|
function setData(data = []) {
|
|
112
122
|
if (!tableRef.value) return;
|
|
113
123
|
tableRef.value.setData(data);
|
|
@@ -133,16 +143,27 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
133
143
|
if (type.indexOf("application") !== -1) {
|
|
134
144
|
const files = { 0: file.raw };
|
|
135
145
|
try {
|
|
146
|
+
isUploading.value = true;
|
|
147
|
+
emits("uploading");
|
|
136
148
|
const data = await doReadExcel(files, props);
|
|
137
149
|
if (!data) {
|
|
138
150
|
ElMessage.warning("\u8BFB\u53D6\u6587\u4EF6\u5931\u8D25");
|
|
151
|
+
isUploading.value = false;
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (!data.length) {
|
|
155
|
+
ElMessage.warning("\u8BE5\u6587\u4EF6\u6CA1\u6709\u6570\u636E");
|
|
156
|
+
isUploading.value = false;
|
|
139
157
|
return;
|
|
140
158
|
}
|
|
141
159
|
active.value++;
|
|
160
|
+
isUploading.value = false;
|
|
161
|
+
emits("uploaded");
|
|
142
162
|
await nextTick();
|
|
143
163
|
setData(data);
|
|
144
164
|
templateFileName.value = file.name;
|
|
145
165
|
} catch (err) {
|
|
166
|
+
isUploading.value = false;
|
|
146
167
|
console.error(err);
|
|
147
168
|
return;
|
|
148
169
|
}
|
|
@@ -172,6 +193,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
172
193
|
templateFileName.value = "";
|
|
173
194
|
active.value = 1;
|
|
174
195
|
submitNumber.value = 0;
|
|
196
|
+
emits("reset");
|
|
175
197
|
}
|
|
176
198
|
async function submitDataSource() {
|
|
177
199
|
if (!props.url && !props.submitHandler) {
|
|
@@ -188,11 +210,11 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
188
210
|
let { dataSource, total, success, failed } = res;
|
|
189
211
|
if (!total) {
|
|
190
212
|
ElMessage.warning("\u8BF7\u6DFB\u52A0\u6570\u636E");
|
|
191
|
-
return;
|
|
213
|
+
return Promise.reject();
|
|
192
214
|
}
|
|
193
215
|
if (!success) {
|
|
194
216
|
ElMessage.warning("\u8BF7\u586B\u5199\u6709\u6548\u4E0A\u4F20\u6570\u636E");
|
|
195
|
-
return;
|
|
217
|
+
return Promise.reject();
|
|
196
218
|
}
|
|
197
219
|
if (failed) {
|
|
198
220
|
try {
|
|
@@ -234,6 +256,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
234
256
|
prop: null,
|
|
235
257
|
message: res2.msg
|
|
236
258
|
};
|
|
259
|
+
if (submitModel.value === "force") {
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
237
262
|
}
|
|
238
263
|
} catch (err) {
|
|
239
264
|
target.errorMsg = {
|
|
@@ -241,6 +266,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
241
266
|
message: err?.msg ? err.msg : err
|
|
242
267
|
};
|
|
243
268
|
console.error(err);
|
|
269
|
+
if (submitModel.value === "force") {
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
244
272
|
}
|
|
245
273
|
}
|
|
246
274
|
deleteData(submitList);
|
|
@@ -263,8 +291,18 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
263
291
|
}
|
|
264
292
|
}
|
|
265
293
|
__expose({
|
|
266
|
-
setData
|
|
294
|
+
setData: async (dataSource) => {
|
|
295
|
+
if (!isArray(dataSource) || !dataSource.length) return;
|
|
296
|
+
active.value = 2;
|
|
297
|
+
await nextTick();
|
|
298
|
+
setData(dataSource);
|
|
299
|
+
},
|
|
267
300
|
deleteData,
|
|
301
|
+
clearData: () => {
|
|
302
|
+
templateFileName.value = "";
|
|
303
|
+
active.value = 1;
|
|
304
|
+
submitNumber.value = 0;
|
|
305
|
+
},
|
|
268
306
|
getTableDataSource,
|
|
269
307
|
validate,
|
|
270
308
|
submitDataSource
|
|
@@ -297,18 +335,39 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
297
335
|
"svg-name": "analytics-echarts-sos",
|
|
298
336
|
"class-name": "!w-[58px] !h-[66px] mb-4"
|
|
299
337
|
}),
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
338
|
+
isUploading.value ? (openBlock(), createElementBlock("div", {
|
|
339
|
+
key: 0,
|
|
340
|
+
class: "flex items-center gap-2 text-auxiliary"
|
|
341
|
+
}, [
|
|
342
|
+
createElementVNode("span", { class: "text-xs" }, "\u6587\u4EF6\u4E0A\u4F20\u4E2D"),
|
|
343
|
+
createVNode(unref$1(ElIcon), { class: "is-loading" }, {
|
|
344
|
+
default: withCtx(() => [
|
|
345
|
+
createVNode(unref$1(Loading))
|
|
346
|
+
]),
|
|
347
|
+
_: 1
|
|
348
|
+
/* STABLE */
|
|
349
|
+
})
|
|
350
|
+
])) : (openBlock(), createElementBlock(
|
|
351
|
+
Fragment,
|
|
352
|
+
{ key: 1 },
|
|
353
|
+
[
|
|
354
|
+
createElementVNode("div", { class: "mb-1.5 text-main" }, [
|
|
355
|
+
createElementVNode("span", null, "\u70B9\u51FB\u6216\u5C06 \u6587\u4EF6 \u62D6\u62FD\u5230\u6B64\u5904\u4E0A\u4F20")
|
|
356
|
+
]),
|
|
357
|
+
createElementVNode("div", { class: "text-auxiliary text-xs" }, "\u4E00\u6B21\u4EC5\u652F\u6301\u4E0A\u4F20\u4E00\u4E2A\u6587\u4EF6"),
|
|
358
|
+
createElementVNode("div", { class: "w-full text-main absolute left-1/2 bottom-4 transform -translate-x-1/2" }, [
|
|
359
|
+
createElementVNode("div", { class: "flex items-center justify-center text-xs text-auxiliary gap-2" }, [
|
|
360
|
+
createElementVNode("span", null, "\u6587\u4EF6\u652F\u6301\uFF1A"),
|
|
361
|
+
createElementVNode("div", { class: "border border-border rounded py-1 px-2.5 bg-background-4" }, " .xls "),
|
|
362
|
+
createElementVNode("div", { class: "border border-border rounded py-1 px-2.5 bg-background-4" }, " .xlsx "),
|
|
363
|
+
createElementVNode("span", null, "\u5355\u6587\u4EF6\u4E0D\u8D85\u8FC7 10 MB")
|
|
364
|
+
])
|
|
365
|
+
])
|
|
366
|
+
],
|
|
367
|
+
64
|
|
368
|
+
/* STABLE_FRAGMENT */
|
|
369
|
+
)),
|
|
370
|
+
createElementVNode("div", { class: "hy-batch-table-form-upload-bg" })
|
|
312
371
|
]),
|
|
313
372
|
_: 1
|
|
314
373
|
/* STABLE */
|
|
@@ -352,9 +411,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
352
411
|
innerHTML: item.description,
|
|
353
412
|
class: "text-auxiliary text-center mb-3 whitespace-nowrap"
|
|
354
413
|
}, null, 8, ["innerHTML"]),
|
|
355
|
-
renderSlot(_ctx.$slots, "template-down", {}, () => [
|
|
356
|
-
|
|
357
|
-
key: 0,
|
|
414
|
+
index === 0 ? renderSlot(_ctx.$slots, "template-down", {}, () => [
|
|
415
|
+
createVNode(unref$1(HyButton), {
|
|
358
416
|
type: "primary",
|
|
359
417
|
link: "",
|
|
360
418
|
onClick: () => unref$1(downloadTemplateHandler)(props)
|
|
@@ -368,8 +426,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
368
426
|
]),
|
|
369
427
|
_: 1
|
|
370
428
|
/* STABLE */
|
|
371
|
-
}, 8, ["onClick"])
|
|
372
|
-
])
|
|
429
|
+
}, 8, ["onClick"])
|
|
430
|
+
], void 0, 1) : createCommentVNode("v-if", true)
|
|
373
431
|
]);
|
|
374
432
|
}),
|
|
375
433
|
64
|
|
@@ -381,19 +439,22 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
381
439
|
key: 1,
|
|
382
440
|
class: "h-full flex flex-col"
|
|
383
441
|
}, [
|
|
384
|
-
createElementVNode("div", { class: "hy-batch-table-form-template-box" }, [
|
|
442
|
+
createElementVNode("div", { class: "hy-batch-table-form-template-box mb-4" }, [
|
|
385
443
|
createElementVNode("div", { class: "flex items-center gap-2" }, [
|
|
386
444
|
createVNode(unref$1(HyIcon), {
|
|
387
445
|
"svg-name": "analytics-echarts-sos",
|
|
388
446
|
"class-name": "!w-[18px] !h-[22px]"
|
|
389
447
|
}),
|
|
390
|
-
|
|
448
|
+
templateFileName.value ? (openBlock(), createElementBlock(
|
|
391
449
|
"span",
|
|
392
|
-
{
|
|
450
|
+
{
|
|
451
|
+
key: 0,
|
|
452
|
+
class: "text-theme"
|
|
453
|
+
},
|
|
393
454
|
toDisplayString(templateFileName.value),
|
|
394
455
|
1
|
|
395
456
|
/* TEXT */
|
|
396
|
-
),
|
|
457
|
+
)) : createCommentVNode("v-if", true),
|
|
397
458
|
createElementVNode("span", { class: "text-auxiliary" }, "\u89E3\u6790\u5B8C\u6210")
|
|
398
459
|
]),
|
|
399
460
|
createVNode(unref$1(HyButton), {
|
|
@@ -409,9 +470,10 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
409
470
|
/* STABLE */
|
|
410
471
|
})
|
|
411
472
|
]),
|
|
412
|
-
createVNode(_sfc_main$1, {
|
|
473
|
+
createVNode(_sfc_main$1, mergeProps({
|
|
413
474
|
ref_key: "tableRef",
|
|
414
|
-
ref: tableRef
|
|
475
|
+
ref: tableRef
|
|
476
|
+
}, _ctx.$attrs, {
|
|
415
477
|
tableColumns: __props.tableColumns,
|
|
416
478
|
formColumns: __props.formColumns,
|
|
417
479
|
rules: __props.rules,
|
|
@@ -419,7 +481,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
419
481
|
columnNum: __props.columnNum,
|
|
420
482
|
size: __props.size,
|
|
421
483
|
class: "h-0 flex-1"
|
|
422
|
-
}, createSlots({
|
|
484
|
+
}), createSlots({
|
|
423
485
|
_: 2
|
|
424
486
|
/* DYNAMIC */
|
|
425
487
|
}, [
|
|
@@ -431,7 +493,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
431
493
|
])
|
|
432
494
|
};
|
|
433
495
|
})
|
|
434
|
-
]),
|
|
496
|
+
]), 1040, ["tableColumns", "formColumns", "rules", "rowClickExpand", "columnNum", "size"])
|
|
435
497
|
])) : createCommentVNode("v-if", true),
|
|
436
498
|
submitting.value ? (openBlock(), createElementBlock("div", {
|
|
437
499
|
key: 2,
|