hy-dispatch-ui-v3 0.2.40 → 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/hyDialog/dialog.vue.mjs +2 -0
- package/es/components/hyTableForm/batchTableForm.vue.mjs +9 -2
- package/es/components/hyTableForm/tableForm.vue.mjs +3 -0
- 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/hyDialog/dialog.vue.js +2 -0
- package/lib/components/hyTableForm/batchTableForm.vue.js +9 -2
- package/lib/components/hyTableForm/tableForm.vue.js +3 -0
- 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
|
|
@@ -236,6 +236,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
236
236
|
]),
|
|
237
237
|
default: withCtx(() => [
|
|
238
238
|
createElementVNode("div", { class: "h-full flex flex-col text-main" }, [
|
|
239
|
+
renderSlot(_ctx.$slots, "before-content"),
|
|
239
240
|
renderSlot(_ctx.$slots, "content", {}, () => [
|
|
240
241
|
createElementVNode(
|
|
241
242
|
"div",
|
|
@@ -251,6 +252,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
251
252
|
/* CLASS */
|
|
252
253
|
)
|
|
253
254
|
]),
|
|
255
|
+
renderSlot(_ctx.$slots, "after-content"),
|
|
254
256
|
__props.showOperate ? (openBlock(), createElementBlock("div", {
|
|
255
257
|
key: 0,
|
|
256
258
|
class: "flex items-center flex-row-reverse justify-between p-5 pr-[26px] mt-auto box-border"
|
|
@@ -117,6 +117,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
117
117
|
const submitNumber = ref(0);
|
|
118
118
|
const submitting = ref(false);
|
|
119
119
|
const submitProgress = ref(0);
|
|
120
|
+
const submitModel = ref("default");
|
|
120
121
|
function setData(data = []) {
|
|
121
122
|
if (!tableRef.value) return;
|
|
122
123
|
tableRef.value.setData(data);
|
|
@@ -209,11 +210,11 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
209
210
|
let { dataSource, total, success, failed } = res;
|
|
210
211
|
if (!total) {
|
|
211
212
|
ElMessage.warning("\u8BF7\u6DFB\u52A0\u6570\u636E");
|
|
212
|
-
return;
|
|
213
|
+
return Promise.reject();
|
|
213
214
|
}
|
|
214
215
|
if (!success) {
|
|
215
216
|
ElMessage.warning("\u8BF7\u586B\u5199\u6709\u6548\u4E0A\u4F20\u6570\u636E");
|
|
216
|
-
return;
|
|
217
|
+
return Promise.reject();
|
|
217
218
|
}
|
|
218
219
|
if (failed) {
|
|
219
220
|
try {
|
|
@@ -255,6 +256,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
255
256
|
prop: null,
|
|
256
257
|
message: res2.msg
|
|
257
258
|
};
|
|
259
|
+
if (submitModel.value === "force") {
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
258
262
|
}
|
|
259
263
|
} catch (err) {
|
|
260
264
|
target.errorMsg = {
|
|
@@ -262,6 +266,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
262
266
|
message: err?.msg ? err.msg : err
|
|
263
267
|
};
|
|
264
268
|
console.error(err);
|
|
269
|
+
if (submitModel.value === "force") {
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
265
272
|
}
|
|
266
273
|
}
|
|
267
274
|
deleteData(submitList);
|
|
@@ -141,6 +141,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
141
141
|
function onDeleteRowHandler(params) {
|
|
142
142
|
const { $index } = params;
|
|
143
143
|
dataSource.value.splice($index, 1);
|
|
144
|
+
emits("validate", {
|
|
145
|
+
...statistics.value
|
|
146
|
+
});
|
|
144
147
|
}
|
|
145
148
|
async function onAddRowHandler() {
|
|
146
149
|
const data = resetAppFormValue(props.formColumns, {
|
package/es/components/index.mjs
CHANGED
|
@@ -22,6 +22,7 @@ export { ElInput, HyInput } from './hyInput/index.mjs';
|
|
|
22
22
|
export { ElTimePicker, HyTimePicker } from './hyTimePicker/index.mjs';
|
|
23
23
|
export { HyBatchTableForm, HyTableForm } from './hyTableForm/index.mjs';
|
|
24
24
|
export { HyTableActionButton } from './hyTableActionButton/index.mjs';
|
|
25
|
+
export { HyBatchUploadDialog } from './hyBatchUploadDialog/index.mjs';
|
|
25
26
|
export { resetAppFormValue, useAppForm } from './hyForm/js/useAppForm.mjs';
|
|
26
27
|
export { resetAppSearchValue, useAppSearch } from './hySearch/js/useAppSearch.mjs';
|
|
27
28
|
export { useAppTable } from './hyTable/js/useAppTable.mjs';
|
package/es/index.mjs
CHANGED
|
@@ -5,6 +5,7 @@ export { ElTimePicker, HyTimePicker } from './components/hyTimePicker/index.mjs'
|
|
|
5
5
|
export { ElTooltip, HyTooltip } from './components/hyTooltip/index.mjs';
|
|
6
6
|
export { HyAudioPlayer } from './components/hyAudioPlayer/index.mjs';
|
|
7
7
|
export { HyBatchTableForm, HyTableForm } from './components/hyTableForm/index.mjs';
|
|
8
|
+
export { HyBatchUploadDialog } from './components/hyBatchUploadDialog/index.mjs';
|
|
8
9
|
export { HyButton } from './components/hyButton/index.mjs';
|
|
9
10
|
export { HyConfigProvider } from './components/hyConfigProvider/index.mjs';
|
|
10
11
|
export { HyConfirmDialog } from './components/hyConfirmDialog/index.mjs';
|
|
@@ -23,6 +24,7 @@ export { HyTableActionButton } from './components/hyTableActionButton/index.mjs'
|
|
|
23
24
|
export { HyTree } from './components/hyTree/index.mjs';
|
|
24
25
|
export { HyUserAvatar } from './components/hyUserAvatar/index.mjs';
|
|
25
26
|
export { HyVideoPlayer } from './components/hyVideoPlayer/index.mjs';
|
|
27
|
+
export { PERMISSION } from './utils/permission.mjs';
|
|
26
28
|
export { base64Decrypt, encryptToBase64, generateRandomCode } from './utils/crypto.mjs';
|
|
27
29
|
export { blobToDataURL, fileFormUpload, fileJsonUplaod, fileUpload, presignedUrl, sizeToTextHandler } from './utils/file.mjs';
|
|
28
30
|
export { buildLocaleContext, buildTranslator, getLanguage, localeContextKey, translate, useLocale } from './hooks/useLocale.mjs';
|
package/es/utils/index.mjs
CHANGED
|
@@ -6,3 +6,4 @@ export { cloneDeep, copyText, createUniqueId, funRunHandler, mergeDeep, withInst
|
|
|
6
6
|
export { formatDuration, getDefaultValueFormatByType } from './date.mjs';
|
|
7
7
|
export { blobToDataURL, fileFormUpload, fileJsonUplaod, fileUpload, presignedUrl, sizeToTextHandler } from './file.mjs';
|
|
8
8
|
export { clearSpace, genValueByProp, getValueByProp, setValueByProp } from './form.mjs';
|
|
9
|
+
export { PERMISSION } from './permission.mjs';
|