act-plus 1.1.56 → 1.1.58
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/act-plus.js +2 -4
- package/act-plus.umd.cjs +61 -146
- package/lib/dialogAddField-8dac5d06.js +939 -0
- package/lib/dialogConfigBtn-02cbe1c8.js +808 -0
- package/lib/dialogSiteComponentsParams-2ed0ff35.js +71 -0
- package/lib/index-160e64fa.js +407 -0
- package/lib/index-210e9bd6.js +147 -0
- package/lib/index-2cbc7b22.js +289 -0
- package/lib/index-76d79944.js +293 -0
- package/lib/index-7a420913.js +378 -0
- package/lib/index-98567fac.js +65 -0
- package/lib/index-a685fc26.js +106 -0
- package/lib/index-b8e2d056.js +20475 -0
- package/lib/index-c7522ec4.js +5929 -0
- package/lib/index-d1c6a777.js +103 -0
- package/lib/index-e2f2023d.js +35 -0
- package/package.json +1 -1
- package/style.css +1 -0
- package/lib/dialogAddField-6b06ab7c.js.gz +0 -0
- package/lib/dialogConfigBtn-d1568216.js.gz +0 -0
- package/lib/dialogSiteComponentsParams-3dcdc659.js.gz +0 -0
- package/lib/index-101b5643.js.gz +0 -0
- package/lib/index-208cc48a.js.gz +0 -0
- package/lib/index-2212d587.js.gz +0 -0
- package/lib/index-4e254a44.js.gz +0 -0
- package/lib/index-59fb9e5c.js.gz +0 -0
- package/lib/index-6933655a.js.gz +0 -0
- package/lib/index-93d2f191.js.gz +0 -0
- package/style.css.gz +0 -0
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import { defineAsyncComponent as re, inject as C, ref as U, watch as ne, resolveComponent as f, resolveDirective as se, unref as t, openBlock as n, createElementBlock as V, createVNode as ue, normalizeStyle as de, withCtx as g, Fragment as q, renderList as L, createBlock as d, mergeProps as _, withKeys as I, withModifiers as B, createCommentVNode as h, resolveDynamicComponent as pe, createElementVNode as ie, toDisplayString as S, createTextVNode as M, withDirectives as ce } from "vue";
|
|
2
|
+
import { _ as fe, u as ye, P as me, a as be, b as Ve } from "./index-c7522ec4.js";
|
|
3
|
+
import "vue-router";
|
|
4
|
+
import "element-plus";
|
|
5
|
+
const _e = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "search-module-container"
|
|
8
|
+
}, Ce = { class: "no-config-field" }, he = {
|
|
9
|
+
__name: "index",
|
|
10
|
+
props: {
|
|
11
|
+
data: { type: Object, default: () => ({}) }
|
|
12
|
+
},
|
|
13
|
+
emits: ["reset", "search"],
|
|
14
|
+
setup(j, { emit: H }) {
|
|
15
|
+
const K = re(() => import("./index-e2f2023d.js")), { t: p } = ye(), W = C("request"), O = C("globalProps"), G = C("loadComponents"), y = C("getFieldUiProps"), x = C("formatDataType"), z = C("disposeDate"), J = C("getDefaultQueryValues"), A = H, m = j, X = U({});
|
|
16
|
+
let b = U([]), Y = U([]), T = U(!0);
|
|
17
|
+
const Z = (s) => m.data.tableConfig.isExpandQuery && T.value ? m.data.tableConfig.tableQueryRowWidth > s + 1 : !0, ee = async (s) => {
|
|
18
|
+
b.value = await Promise.all(
|
|
19
|
+
s.filter((l) => l.useScenes.includes("tableSearch")).map(async (l) => {
|
|
20
|
+
l.tableQueryDefaultValue && (["date", "dateRange"].includes(l.fieldType) ? l.queryValue = z(l) : l.queryValue = l.tableQueryDefaultValue ? l.tableQueryDefaultValue : void 0), O.defaultParams.some((o) => {
|
|
21
|
+
o.field == l.fieldKey && o.operate === l.tableQueryCondition && (l.queryValue = o.value);
|
|
22
|
+
});
|
|
23
|
+
const u = (l.formCustomComponentes ?? []).find((o) => o.permissionCode === "tableSearch");
|
|
24
|
+
if (l.isQueryFieldCustom = !1, u && u.isFieldCustom) {
|
|
25
|
+
const { isFieldCustom: o, customComponentName: k, customComponentUrl: P } = u;
|
|
26
|
+
if (l.isQueryFieldCustom = !0, o && !l.customQueryComponent) {
|
|
27
|
+
const $ = await G(P, k);
|
|
28
|
+
l.customQueryComponent = $;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return l;
|
|
32
|
+
})
|
|
33
|
+
);
|
|
34
|
+
}, le = (s) => {
|
|
35
|
+
const l = (s || []).filter((u) => u.permissionCode === 1001).map((u) => ({ ...u, loading: !1 }));
|
|
36
|
+
Y.value = [...l, { btnName: p("act.reset"), permissionCode: "9999", btnColor: "info", btnIcon: "btn-reset", loading: !1 }];
|
|
37
|
+
}, ae = async ({ node: s, resolve: l }, u) => {
|
|
38
|
+
const o = y(u), { label: k, value: P, children: $, isLeaf: w } = { ...Ve, ...o.treeProps || {} };
|
|
39
|
+
if (s[w])
|
|
40
|
+
return l([]);
|
|
41
|
+
const Q = u.postRequestParams.filter((r) => r.submitType === "default").reduce((r, e) => (r[e.submitName] = x(e.paramsType, e.submitValue), r), {}), D = u.postRequestParams.filter((r) => r.submitType === "match").reduce((r, e) => (r[e.submitName] = x(e.paramsType, O.matchData[e.submitValue][e.submitName]), r), {}), R = u.postRequestParams.filter((r) => r.submitType === "dynamic").map((r) => ({
|
|
42
|
+
field: r.submitName,
|
|
43
|
+
operate: r.submitMatchType,
|
|
44
|
+
value: o.loadCode ? s == null ? void 0 : s.data.value : x(r.paramsType, r.submitValue)
|
|
45
|
+
}));
|
|
46
|
+
let c = {};
|
|
47
|
+
Object.keys(Q).length && (c = { ...c, ...Q }), Object.keys(D).length && (c = { ...c, ...D }), R.length && (c.dynamicFilters = R), o.loadCode && Reflect.has(c, o.loadCode) && (c[o.loadCode] = s == null ? void 0 : s.data.value);
|
|
48
|
+
const { data: E } = await W({
|
|
49
|
+
url: u.fieldRequestUrl,
|
|
50
|
+
method: u.fieldRequestType || "GET",
|
|
51
|
+
data: c
|
|
52
|
+
}), v = (E || []).map((r) => ({ label: r[k], value: r[P], children: [], isLeaf: r[w] }));
|
|
53
|
+
l(v);
|
|
54
|
+
};
|
|
55
|
+
ne(
|
|
56
|
+
() => m.data,
|
|
57
|
+
(s, l) => {
|
|
58
|
+
ee(s.fields), le(s.buttons);
|
|
59
|
+
},
|
|
60
|
+
{ immediate: !0, deep: !0 }
|
|
61
|
+
);
|
|
62
|
+
const i = (s) => {
|
|
63
|
+
switch (s.loading = !0, s.permissionCode) {
|
|
64
|
+
case "9999":
|
|
65
|
+
b.value.forEach((o) => {
|
|
66
|
+
o.tableQueryDefaultValue ? ["date", "dateRange"].includes(o.fieldType) ? o.queryValue = z(o) : o.queryValue = o.tableQueryDefaultValue ? o.tableQueryDefaultValue : void 0 : o.fieldType.includes("&") ? o.queryValue = [] : o.queryValue = void 0;
|
|
67
|
+
});
|
|
68
|
+
const l = J();
|
|
69
|
+
A("reset", l, () => {
|
|
70
|
+
s.loading = !1;
|
|
71
|
+
});
|
|
72
|
+
break;
|
|
73
|
+
default:
|
|
74
|
+
const u = b.value.filter((o) => Array.isArray(o.queryValue) ? o.queryValue.length : !!o.queryValue);
|
|
75
|
+
A("search", u, () => {
|
|
76
|
+
s.loading = !1;
|
|
77
|
+
});
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}, te = () => {
|
|
81
|
+
T.value = !T.value;
|
|
82
|
+
}, oe = () => {
|
|
83
|
+
i({ permissionCode: 1001 });
|
|
84
|
+
};
|
|
85
|
+
return (s, l) => {
|
|
86
|
+
var r;
|
|
87
|
+
const u = f("el-input"), o = f("el-option"), k = f("el-select"), P = f("el-select-v2"), $ = f("el-cascader"), w = f("el-tree-select"), Q = f("el-date-picker"), D = f("el-form-item"), R = f("a-svg-icon"), c = f("el-button"), E = f("el-form"), v = se("debounce");
|
|
88
|
+
return t(b) && t(b).length ? (n(), V("div", _e, [
|
|
89
|
+
ue(E, {
|
|
90
|
+
style: de({ "--table-query-row": m.data.tableConfig.tableQueryRowWidth }),
|
|
91
|
+
class: "form-content",
|
|
92
|
+
ref: "elForm",
|
|
93
|
+
"label-suffix": ":",
|
|
94
|
+
"label-position": "right"
|
|
95
|
+
}, {
|
|
96
|
+
default: g(() => [
|
|
97
|
+
(n(!0), V(q, null, L(t(b), (e, N) => (n(), V(q, { key: N }, [
|
|
98
|
+
Z(N) ? (n(), V(q, { key: 0 }, [
|
|
99
|
+
e.isQueryFieldCustom ? (n(), V(q, { key: 1 }, [
|
|
100
|
+
e.customQueryComponent ? (n(), d(pe(e.customQueryComponent), {
|
|
101
|
+
key: 0,
|
|
102
|
+
class: "custom-btn",
|
|
103
|
+
ref_for: !0,
|
|
104
|
+
ref: (a) => X.value.customQueryComponent = a,
|
|
105
|
+
queryItem: e,
|
|
106
|
+
data: m.data,
|
|
107
|
+
onRefresh: (a) => i(e)
|
|
108
|
+
}, null, 40, ["queryItem", "data", "onRefresh"])) : (n(), V("div", {
|
|
109
|
+
class: "no-config",
|
|
110
|
+
key: N
|
|
111
|
+
}, [
|
|
112
|
+
ie("span", Ce, "【" + S(e.fieldName) + "】", 1),
|
|
113
|
+
M(S(t(p)("act.fieldCustom")), 1)
|
|
114
|
+
]))
|
|
115
|
+
], 64)) : (n(), d(D, {
|
|
116
|
+
key: 0,
|
|
117
|
+
class: "search-form-item",
|
|
118
|
+
"label-width": m.data.tableConfig.tableQueryLabelWidth,
|
|
119
|
+
label: e.fieldName
|
|
120
|
+
}, {
|
|
121
|
+
default: g(() => [
|
|
122
|
+
e.fieldType === "input" || e.fieldType === "editor" ? (n(), d(u, _({
|
|
123
|
+
key: 0,
|
|
124
|
+
modelValue: e.queryValue,
|
|
125
|
+
"onUpdate:modelValue": (a) => e.queryValue = a,
|
|
126
|
+
placeholder: `${t(p)("act.inputPlaceholder")}${e.fieldName}`,
|
|
127
|
+
clearable: "",
|
|
128
|
+
ref_for: !0
|
|
129
|
+
}, t(y)(e), {
|
|
130
|
+
onKeyup: l[0] || (l[0] = I(B((a) => i({ permissionCode: 1001 }), ["prevent"]), ["enter", "native"])),
|
|
131
|
+
onClear: oe
|
|
132
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "placeholder"])) : h("", !0),
|
|
133
|
+
e.fieldType === "inputNumber" ? (n(), d(t(K), _({
|
|
134
|
+
key: 1,
|
|
135
|
+
modelValue: e.queryValue,
|
|
136
|
+
"onUpdate:modelValue": (a) => e.queryValue = a,
|
|
137
|
+
placeholder: `${t(p)("act.inputPlaceholder")}${e.fieldName}`,
|
|
138
|
+
clearable: "",
|
|
139
|
+
onKeyup: l[1] || (l[1] = I(B((a) => i({ permissionCode: 1001 }), ["prevent"]), ["enter", "native"])),
|
|
140
|
+
ref_for: !0
|
|
141
|
+
}, t(y)(e)), null, 16, ["modelValue", "onUpdate:modelValue", "placeholder"])) : ["select", "switch", "multipleSelect"].includes(e.fieldType) ? (n(), d(k, _({
|
|
142
|
+
key: 2,
|
|
143
|
+
modelValue: e.queryValue,
|
|
144
|
+
"onUpdate:modelValue": (a) => e.queryValue = a,
|
|
145
|
+
placeholder: `${t(p)("act.selectPlaceholder")}${e.fieldName}`,
|
|
146
|
+
clearable: "",
|
|
147
|
+
filterable: "",
|
|
148
|
+
ref_for: !0
|
|
149
|
+
}, t(y)(e), {
|
|
150
|
+
multiple: e.fieldType === "multipleSelect",
|
|
151
|
+
"collapse-tags": e.fieldType === "multipleSelect",
|
|
152
|
+
"collapse-tags-tooltip": e.fieldType === "multipleSelect",
|
|
153
|
+
onChange: l[2] || (l[2] = (a) => i({ permissionCode: 1001 }))
|
|
154
|
+
}), {
|
|
155
|
+
default: g(() => [
|
|
156
|
+
(n(!0), V(q, null, L(e.dataList, (a, F) => (n(), d(o, {
|
|
157
|
+
key: F,
|
|
158
|
+
label: a.key,
|
|
159
|
+
value: a.value
|
|
160
|
+
}, null, 8, ["label", "value"]))), 128))
|
|
161
|
+
]),
|
|
162
|
+
_: 2
|
|
163
|
+
}, 1040, ["modelValue", "onUpdate:modelValue", "placeholder", "multiple", "collapse-tags", "collapse-tags-tooltip"])) : ["virtualizedSelect", "virtualizedMultipleSelect"].includes(e.fieldType) ? (n(), d(P, _({
|
|
164
|
+
key: 3,
|
|
165
|
+
modelValue: e.queryValue,
|
|
166
|
+
"onUpdate:modelValue": (a) => e.queryValue = a,
|
|
167
|
+
options: e.dataList,
|
|
168
|
+
props: { ...t(me) },
|
|
169
|
+
placeholder: `${t(p)("act.selectPlaceholder")}${e.fieldName}`,
|
|
170
|
+
clearable: "",
|
|
171
|
+
filterable: "",
|
|
172
|
+
ref_for: !0
|
|
173
|
+
}, t(y)(e), {
|
|
174
|
+
"collapse-tags": e.fieldType === "virtualizedMultipleSelect",
|
|
175
|
+
"collapse-tags-tooltip": e.fieldType === "virtualizedMultipleSelect",
|
|
176
|
+
multiple: e.fieldType === "virtualizedMultipleSelect",
|
|
177
|
+
onChange: l[3] || (l[3] = (a) => i({ permissionCode: 1001 }))
|
|
178
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "options", "props", "placeholder", "collapse-tags", "collapse-tags-tooltip", "multiple"])) : e.fieldType === "provinceCascade" ? (n(), d($, _({
|
|
179
|
+
key: 4,
|
|
180
|
+
modelValue: e.queryValue,
|
|
181
|
+
"onUpdate:modelValue": (a) => e.queryValue = a,
|
|
182
|
+
options: e.dataList,
|
|
183
|
+
props: { ...t(be) },
|
|
184
|
+
clearable: "",
|
|
185
|
+
filterable: "",
|
|
186
|
+
placeholder: `${t(p)("act.selectPlaceholder")}${e.fieldName}`,
|
|
187
|
+
ref_for: !0
|
|
188
|
+
}, t(y)(e), {
|
|
189
|
+
onChange: l[4] || (l[4] = (a) => i({ permissionCode: 1001 }))
|
|
190
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "options", "props", "placeholder"])) : e.fieldType === "treeSelect" ? (n(), d(w, _({
|
|
191
|
+
key: 5,
|
|
192
|
+
modelValue: e.queryValue,
|
|
193
|
+
"onUpdate:modelValue": (a) => e.queryValue = a,
|
|
194
|
+
placeholder: `请选择${e.fieldName}`,
|
|
195
|
+
props: { isLeaf: "isLeaf" },
|
|
196
|
+
"render-after-expand": !1,
|
|
197
|
+
"collapse-tags": "",
|
|
198
|
+
"collapse-tags-tooltip": "",
|
|
199
|
+
multiple: "",
|
|
200
|
+
"show-checkbox": "",
|
|
201
|
+
clearable: "",
|
|
202
|
+
filterable: "",
|
|
203
|
+
lazy: "",
|
|
204
|
+
load: (a, F) => ae({ node: a, resolve: F }, e),
|
|
205
|
+
ref_for: !0
|
|
206
|
+
}, t(y)(e), {
|
|
207
|
+
onChange: l[5] || (l[5] = (a) => i({ permissionCode: 1001 }))
|
|
208
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "placeholder", "load"])) : e.fieldType === "date" ? (n(), d(Q, _({
|
|
209
|
+
key: 6,
|
|
210
|
+
modelValue: e.queryValue,
|
|
211
|
+
"onUpdate:modelValue": (a) => e.queryValue = a,
|
|
212
|
+
type: "date",
|
|
213
|
+
placeholder: `${t(p)("act.selectPlaceholder")}${t(p)("act.time")}`,
|
|
214
|
+
"value-format": "YYYY-MM-DD HH:mm:ss",
|
|
215
|
+
clearable: "",
|
|
216
|
+
ref_for: !0
|
|
217
|
+
}, t(y)(e), {
|
|
218
|
+
onChange: l[6] || (l[6] = (a) => i({ permissionCode: 1001 }))
|
|
219
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "placeholder"])) : e.fieldType === "dateRange" ? (n(), d(Q, _({
|
|
220
|
+
key: 7,
|
|
221
|
+
modelValue: e.queryValue,
|
|
222
|
+
"onUpdate:modelValue": (a) => e.queryValue = a,
|
|
223
|
+
type: "daterange",
|
|
224
|
+
"start-placeholder": t(p)("act.startTime"),
|
|
225
|
+
"end-placeholder": t(p)("act.endTime"),
|
|
226
|
+
"value-format": "YYYY-MM-DD HH:mm:ss",
|
|
227
|
+
clearable: "",
|
|
228
|
+
ref_for: !0
|
|
229
|
+
}, t(y)(e), {
|
|
230
|
+
onChange: l[7] || (l[7] = (a) => i({ permissionCode: 1001 }))
|
|
231
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "start-placeholder", "end-placeholder"])) : h("", !0)
|
|
232
|
+
]),
|
|
233
|
+
_: 2
|
|
234
|
+
}, 1032, ["label-width", "label"]))
|
|
235
|
+
], 64)) : h("", !0)
|
|
236
|
+
], 64))), 128)),
|
|
237
|
+
t(b).length ? (n(), d(D, {
|
|
238
|
+
key: 0,
|
|
239
|
+
class: "search-form-btn",
|
|
240
|
+
"label-width": "0"
|
|
241
|
+
}, {
|
|
242
|
+
default: g(() => [
|
|
243
|
+
(n(!0), V(q, null, L(t(Y), (e, N) => ce((n(), d(c, {
|
|
244
|
+
key: N,
|
|
245
|
+
type: e.btnColor,
|
|
246
|
+
loading: e.loading,
|
|
247
|
+
onClick: (a) => i(e)
|
|
248
|
+
}, {
|
|
249
|
+
default: g(() => [
|
|
250
|
+
e.btnIcon ? (n(), d(R, {
|
|
251
|
+
key: 0,
|
|
252
|
+
class: "mr6",
|
|
253
|
+
name: e.btnIcon,
|
|
254
|
+
width: "12",
|
|
255
|
+
height: "12",
|
|
256
|
+
color: "#fff"
|
|
257
|
+
}, null, 8, ["name"])) : h("", !0),
|
|
258
|
+
M(" " + S(e.btnName), 1)
|
|
259
|
+
]),
|
|
260
|
+
_: 2
|
|
261
|
+
}, 1032, ["type", "loading", "onClick"])), [
|
|
262
|
+
[v]
|
|
263
|
+
])), 128))
|
|
264
|
+
]),
|
|
265
|
+
_: 1
|
|
266
|
+
})) : h("", !0)
|
|
267
|
+
]),
|
|
268
|
+
_: 1
|
|
269
|
+
}, 8, ["style"]),
|
|
270
|
+
m.data.tableConfig.isExpandQuery && ((r = t(b)) == null ? void 0 : r.length) > m.data.tableConfig.tableQueryRowWidth ? (n(), d(c, {
|
|
271
|
+
key: 0,
|
|
272
|
+
class: "expand",
|
|
273
|
+
text: "",
|
|
274
|
+
size: "small",
|
|
275
|
+
icon: t(T) ? "ArrowDown" : "ArrowUp",
|
|
276
|
+
onClick: te
|
|
277
|
+
}, {
|
|
278
|
+
default: g(() => [
|
|
279
|
+
M(S(t(T) ? t(p)("act.expand") : t(p)("act.retract")), 1)
|
|
280
|
+
]),
|
|
281
|
+
_: 1
|
|
282
|
+
}, 8, ["icon"])) : h("", !0)
|
|
283
|
+
])) : h("", !0);
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
}, Pe = /* @__PURE__ */ fe(he, [["__scopeId", "data-v-3c6eb654"]]);
|
|
287
|
+
export {
|
|
288
|
+
Pe as default
|
|
289
|
+
};
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { defineComponent as L, openBlock as d, createElementBlock as T, createElementVNode as _, ref as D, computed as oe, resolveComponent as F, resolveDirective as ne, withDirectives as ie, createBlock as U, mergeProps as se, unref as p, withCtx as z, renderSlot as j, toDisplayString as I, createCommentVNode as A, createVNode as $, createTextVNode as re, Fragment as ce, renderList as ue, normalizeClass as pe, nextTick as de } from "vue";
|
|
2
|
+
import { ElNotification as E } from "element-plus";
|
|
3
|
+
import { _ as me, u as _e, n as fe } from "./index-c7522ec4.js";
|
|
4
|
+
import "vue-router";
|
|
5
|
+
/*! Element Plus Icons Vue v2.3.1 */
|
|
6
|
+
var ge = /* @__PURE__ */ L({
|
|
7
|
+
name: "Delete",
|
|
8
|
+
__name: "delete",
|
|
9
|
+
setup(l) {
|
|
10
|
+
return (a, f) => (d(), T("svg", {
|
|
11
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
+
viewBox: "0 0 1024 1024"
|
|
13
|
+
}, [
|
|
14
|
+
_("path", {
|
|
15
|
+
fill: "currentColor",
|
|
16
|
+
d: "M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"
|
|
17
|
+
})
|
|
18
|
+
]));
|
|
19
|
+
}
|
|
20
|
+
}), ve = ge, he = /* @__PURE__ */ L({
|
|
21
|
+
name: "Download",
|
|
22
|
+
__name: "download",
|
|
23
|
+
setup(l) {
|
|
24
|
+
return (a, f) => (d(), T("svg", {
|
|
25
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
26
|
+
viewBox: "0 0 1024 1024"
|
|
27
|
+
}, [
|
|
28
|
+
_("path", {
|
|
29
|
+
fill: "currentColor",
|
|
30
|
+
d: "M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64m384-253.696 236.288-236.352 45.248 45.248L508.8 704 192 387.2l45.248-45.248L480 584.704V128h64z"
|
|
31
|
+
})
|
|
32
|
+
]));
|
|
33
|
+
}
|
|
34
|
+
}), ye = he, we = /* @__PURE__ */ L({
|
|
35
|
+
name: "ZoomIn",
|
|
36
|
+
__name: "zoom-in",
|
|
37
|
+
setup(l) {
|
|
38
|
+
return (a, f) => (d(), T("svg", {
|
|
39
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
40
|
+
viewBox: "0 0 1024 1024"
|
|
41
|
+
}, [
|
|
42
|
+
_("path", {
|
|
43
|
+
fill: "currentColor",
|
|
44
|
+
d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704m-32-384v-96a32 32 0 0 1 64 0v96h96a32 32 0 0 1 0 64h-96v96a32 32 0 0 1-64 0v-96h-96a32 32 0 0 1 0-64z"
|
|
45
|
+
})
|
|
46
|
+
]));
|
|
47
|
+
}
|
|
48
|
+
}), xe = we;
|
|
49
|
+
let S;
|
|
50
|
+
const Fe = new Uint8Array(16);
|
|
51
|
+
function Te() {
|
|
52
|
+
if (!S && (S = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !S))
|
|
53
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
54
|
+
return S(Fe);
|
|
55
|
+
}
|
|
56
|
+
const n = [];
|
|
57
|
+
for (let l = 0; l < 256; ++l)
|
|
58
|
+
n.push((l + 256).toString(16).slice(1));
|
|
59
|
+
function Ve(l, a = 0) {
|
|
60
|
+
return n[l[a + 0]] + n[l[a + 1]] + n[l[a + 2]] + n[l[a + 3]] + "-" + n[l[a + 4]] + n[l[a + 5]] + "-" + n[l[a + 6]] + n[l[a + 7]] + "-" + n[l[a + 8]] + n[l[a + 9]] + "-" + n[l[a + 10]] + n[l[a + 11]] + n[l[a + 12]] + n[l[a + 13]] + n[l[a + 14]] + n[l[a + 15]];
|
|
61
|
+
}
|
|
62
|
+
const ke = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), H = {
|
|
63
|
+
randomUUID: ke
|
|
64
|
+
};
|
|
65
|
+
function $e(l, a, f) {
|
|
66
|
+
if (H.randomUUID && !a && !l)
|
|
67
|
+
return H.randomUUID();
|
|
68
|
+
l = l || {};
|
|
69
|
+
const g = l.random || (l.rng || Te)();
|
|
70
|
+
if (g[6] = g[6] & 15 | 64, g[8] = g[8] & 63 | 128, a) {
|
|
71
|
+
f = f || 0;
|
|
72
|
+
for (let x = 0; x < 16; ++x)
|
|
73
|
+
a[f + x] = g[x];
|
|
74
|
+
return a;
|
|
75
|
+
}
|
|
76
|
+
return Ve(g);
|
|
77
|
+
}
|
|
78
|
+
const be = { class: "upload-container" }, Ce = { class: "el-upload__text" }, Pe = { class: "tip-text" }, De = { class: "file-list-l" }, Ue = ["onMouseenter", "onMouseleave"], ze = { class: "el-file-operate" }, Ie = {
|
|
79
|
+
__name: "index",
|
|
80
|
+
props: {
|
|
81
|
+
request: { type: Function, required: !0, default: null },
|
|
82
|
+
modelValue: { type: [Array, String], default: [] },
|
|
83
|
+
action: { type: String, default: "/api/v1/utils/uploadFiles" },
|
|
84
|
+
data: { type: Object, default: () => ({ uploadFileType: 1 }) },
|
|
85
|
+
name: { type: String, default: "files" },
|
|
86
|
+
multiple: { type: Boolean, default: !0 },
|
|
87
|
+
limit: { type: Number, default: 9 },
|
|
88
|
+
accept: { type: String, default: "*" },
|
|
89
|
+
tipText: { type: String, default: "" },
|
|
90
|
+
fileMaxSize: { type: Number, default: 100 },
|
|
91
|
+
autoUpload: { type: Boolean, default: !0 }
|
|
92
|
+
},
|
|
93
|
+
emits: ["update:modelValue", "delete"],
|
|
94
|
+
setup(l, { expose: a, emit: f }) {
|
|
95
|
+
const { getAssetsFileName: g, getAssetsFilePath: x, downloadFile: O } = fe(), { t: h } = _e(), b = f, s = l, R = {
|
|
96
|
+
image: /(gif|jpg|jpeg|png|pdf|bmp|webp|GIF|JPG|PDF|PNG|JPEG)$/,
|
|
97
|
+
word: /(doc|docx)$/,
|
|
98
|
+
pdf: /(pdf)$/,
|
|
99
|
+
excel: /(xls|xlsx)$/
|
|
100
|
+
};
|
|
101
|
+
let C = D(!1), M = D({}), B = D(!1), y = D(null), P = null, w = oe({
|
|
102
|
+
get() {
|
|
103
|
+
return J(s.modelValue);
|
|
104
|
+
},
|
|
105
|
+
set(e) {
|
|
106
|
+
b("update:modelValue", e);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
const q = (e) => {
|
|
110
|
+
const t = (w.value || []).map((c) => c.filePath);
|
|
111
|
+
if (e == 0)
|
|
112
|
+
return t;
|
|
113
|
+
let o = t.splice(e), i = t.splice(0, e);
|
|
114
|
+
return o.concat(i);
|
|
115
|
+
}, G = (e) => {
|
|
116
|
+
const t = e.substring(e.lastIndexOf(".") + 1);
|
|
117
|
+
let o = null;
|
|
118
|
+
return Object.keys(R).some((i) => {
|
|
119
|
+
if (R[i].test(t))
|
|
120
|
+
return o = i, !0;
|
|
121
|
+
}), o === null && (o = "file"), o;
|
|
122
|
+
}, W = (e) => e.map((t) => ({ uid: t.uid ?? $e(), name: g(t), filePath: t, fileType: G(t), status: "success" })), J = (e) => {
|
|
123
|
+
const t = Array.isArray(e) ? e.map((o) => o.filePath) : e ? e.split(";") : [];
|
|
124
|
+
return W(t || []);
|
|
125
|
+
}, Z = ({ name: e }) => {
|
|
126
|
+
const t = e.lastIndexOf("."), o = e.slice(t), i = s.accept.trim().split(",");
|
|
127
|
+
let c = !1;
|
|
128
|
+
return i.includes(o) && (c = !0), c = i.some((m) => m == "image/*" ? R.image.test(o) : m.startsWith(".") ? e.endsWith(m) : m === o), c || E({
|
|
129
|
+
title: `${h("act.tip")}`,
|
|
130
|
+
message: `【${e}】${h("act.uploadErrorTip")}`,
|
|
131
|
+
type: "warning",
|
|
132
|
+
duration: 2500
|
|
133
|
+
}), c;
|
|
134
|
+
}, K = (e, t, o) => {
|
|
135
|
+
P && (clearTimeout(P), P = null), P = setTimeout(() => {
|
|
136
|
+
e.call(this, t);
|
|
137
|
+
}, o);
|
|
138
|
+
}, Q = (e) => s.request({ url: s.action, method: "POST", data: e, headers: { "Content-Type": "application/x-www-form-urlencoded" } }), X = async (e) => {
|
|
139
|
+
try {
|
|
140
|
+
const t = e.filter((r) => r.status == "ready" && Z(r)), o = w.value.length + t.length;
|
|
141
|
+
if (t.length === 0) {
|
|
142
|
+
y.value.clearFiles();
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (o > s.limit) {
|
|
146
|
+
E({
|
|
147
|
+
title: `${h("act.tip")}`,
|
|
148
|
+
message: `${h("act.uploadLimitTip")}`,
|
|
149
|
+
type: "warning",
|
|
150
|
+
duration: 2500
|
|
151
|
+
}), y.value.clearFiles();
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (!s.autoUpload) {
|
|
155
|
+
const r = t.map((V) => ({ ...V, filePath: null, status: "success" }));
|
|
156
|
+
b("update:modelValue", r), y.value.clearFiles();
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
C.value = !0;
|
|
160
|
+
const i = new FormData();
|
|
161
|
+
Object.keys(s.data).forEach((r) => {
|
|
162
|
+
i.append(r, s.data[r]);
|
|
163
|
+
}), t.forEach((r) => {
|
|
164
|
+
i.append(s.name, r.raw);
|
|
165
|
+
});
|
|
166
|
+
let { data: c } = await Q(i);
|
|
167
|
+
const m = s.multiple ? [...w.value.map((r) => r.filePath), ...c.filePaths || []].join(";") : [...c.filePaths || []].join(";");
|
|
168
|
+
y.value.clearFiles(), b("update:modelValue", m), C.value = !1;
|
|
169
|
+
} catch (t) {
|
|
170
|
+
y.value.clearFiles(), C.value = !1, console.error(t);
|
|
171
|
+
}
|
|
172
|
+
}, Y = (e, t) => {
|
|
173
|
+
K(X, t, 500);
|
|
174
|
+
}, N = (e, t) => {
|
|
175
|
+
const o = M.value[`tooltipRef${t}`];
|
|
176
|
+
B.value = o.scrollWidth <= Math.round(o.getBoundingClientRect().width);
|
|
177
|
+
}, ee = ({ filePath: e, name: t, uid: o }, i) => {
|
|
178
|
+
de(() => {
|
|
179
|
+
document.querySelector(`.previewImage_${o}`).children[0].click();
|
|
180
|
+
});
|
|
181
|
+
}, te = ({ filePath: e, name: t }) => {
|
|
182
|
+
O(s.request, e);
|
|
183
|
+
}, le = (e, t) => {
|
|
184
|
+
w.value = w.value.filter((o, i) => i !== t), b("delete", { data: e });
|
|
185
|
+
};
|
|
186
|
+
return a({ clearFiles: () => {
|
|
187
|
+
w.value = [], y.value.clearFiles();
|
|
188
|
+
} }), (e, t) => {
|
|
189
|
+
const o = F("upload-filled"), i = F("el-icon"), c = F("el-upload"), m = F("el-image"), r = F("el-tooltip"), V = F("el-button"), ae = ne("loading");
|
|
190
|
+
return d(), T("div", be, [
|
|
191
|
+
ie((d(), U(c, se({
|
|
192
|
+
ref_key: "uploadRef",
|
|
193
|
+
ref: y,
|
|
194
|
+
action: "#",
|
|
195
|
+
drag: "",
|
|
196
|
+
accept: s.accept,
|
|
197
|
+
multiple: s.multiple,
|
|
198
|
+
"auto-upload": !1,
|
|
199
|
+
"show-file-list": !1,
|
|
200
|
+
"on-change": Y
|
|
201
|
+
}, e.$attrs, {
|
|
202
|
+
"element-loading-text": p(h)("act.uploadLoading")
|
|
203
|
+
}), {
|
|
204
|
+
tip: z(() => [
|
|
205
|
+
s.tipText ? j(e.$slots, "default", { key: 0 }, () => [
|
|
206
|
+
_("p", Pe, I(s.tipText), 1)
|
|
207
|
+
], !0) : A("", !0)
|
|
208
|
+
]),
|
|
209
|
+
default: z(() => [
|
|
210
|
+
$(i, { class: "el-icon--upload" }, {
|
|
211
|
+
default: z(() => [
|
|
212
|
+
$(o)
|
|
213
|
+
]),
|
|
214
|
+
_: 1
|
|
215
|
+
}),
|
|
216
|
+
_("div", Ce, [
|
|
217
|
+
re(I(p(h)("act.uploadText")), 1),
|
|
218
|
+
_("em", null, I(p(h)("act.clickUpload")), 1)
|
|
219
|
+
])
|
|
220
|
+
]),
|
|
221
|
+
_: 3
|
|
222
|
+
}, 16, ["accept", "multiple", "element-loading-text"])), [
|
|
223
|
+
[ae, p(C)]
|
|
224
|
+
]),
|
|
225
|
+
j(e.$slots, "default", {}, () => [
|
|
226
|
+
(d(!0), T(ce, null, ue(p(w), (u, k) => (d(), T("div", {
|
|
227
|
+
class: "file-list",
|
|
228
|
+
key: u.uid
|
|
229
|
+
}, [
|
|
230
|
+
_("div", De, [
|
|
231
|
+
u.fileType === "image" ? (d(), U(m, {
|
|
232
|
+
key: 0,
|
|
233
|
+
class: pe(["file-list-image", { [`previewImage_${u.uid}`]: !0 }]),
|
|
234
|
+
fit: "cover",
|
|
235
|
+
"preview-src-list": q(k),
|
|
236
|
+
"preview-teleported": "",
|
|
237
|
+
src: u.filePath
|
|
238
|
+
}, null, 8, ["class", "preview-src-list", "src"])) : (d(), U(m, {
|
|
239
|
+
key: 1,
|
|
240
|
+
class: "file-list-icon",
|
|
241
|
+
src: p(x)(`images/upload-${u.fileType}.png`)
|
|
242
|
+
}, null, 8, ["src"])),
|
|
243
|
+
$(r, {
|
|
244
|
+
effect: "dark",
|
|
245
|
+
content: u.name,
|
|
246
|
+
placement: "bottom-start",
|
|
247
|
+
disabled: p(B)
|
|
248
|
+
}, {
|
|
249
|
+
default: z(() => [
|
|
250
|
+
_("div", {
|
|
251
|
+
class: "el-file-name",
|
|
252
|
+
ref_for: !0,
|
|
253
|
+
ref: (v) => p(M)[`tooltipRef${k}`] = v,
|
|
254
|
+
onMouseenter: (v) => N(v, k),
|
|
255
|
+
onMouseleave: (v) => N(v, k)
|
|
256
|
+
}, I(u.name), 41, Ue)
|
|
257
|
+
]),
|
|
258
|
+
_: 2
|
|
259
|
+
}, 1032, ["content", "disabled"])
|
|
260
|
+
]),
|
|
261
|
+
_("div", ze, [
|
|
262
|
+
u.fileType === "image" ? (d(), U(V, {
|
|
263
|
+
key: 0,
|
|
264
|
+
type: "primary",
|
|
265
|
+
size: "small",
|
|
266
|
+
icon: p(xe),
|
|
267
|
+
circle: "",
|
|
268
|
+
onClick: (v) => ee(u)
|
|
269
|
+
}, null, 8, ["icon", "onClick"])) : A("", !0),
|
|
270
|
+
$(V, {
|
|
271
|
+
type: "primary",
|
|
272
|
+
size: "small",
|
|
273
|
+
icon: p(ye),
|
|
274
|
+
circle: "",
|
|
275
|
+
onClick: (v) => te(u)
|
|
276
|
+
}, null, 8, ["icon", "onClick"]),
|
|
277
|
+
$(V, {
|
|
278
|
+
type: "danger",
|
|
279
|
+
size: "small",
|
|
280
|
+
icon: p(ve),
|
|
281
|
+
circle: "",
|
|
282
|
+
onClick: (v) => le(u, k)
|
|
283
|
+
}, null, 8, ["icon", "onClick"])
|
|
284
|
+
])
|
|
285
|
+
]))), 128))
|
|
286
|
+
], !0)
|
|
287
|
+
]);
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
}, Ne = /* @__PURE__ */ me(Ie, [["__scopeId", "data-v-f839bee6"]]);
|
|
291
|
+
export {
|
|
292
|
+
Ne as default
|
|
293
|
+
};
|