yahee-components 0.0.100 → 0.0.102
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/_virtual/_commonjs-dynamic-modules.js +6 -0
- package/es/_virtual/jszip.min.js +7 -0
- package/es/_virtual/jszip.min2.js +4 -0
- package/es/drop-down-condition/drop-down-condition.vue.js +34 -33
- package/es/file-download-wrapper/file-download-wrapper.vue.js +265 -0
- package/es/file-download-wrapper/file-download-wrapper.vue2.js +4 -0
- package/es/file-download-wrapper/index.js +7 -0
- package/es/file-download-wrapper/key.js +17 -0
- package/es/file-download-wrapper/props.js +12 -0
- package/es/file-download-wrapper/style/index.css +66 -0
- package/es/height-collapse/height-collapse.vue.js +53 -0
- package/es/height-collapse/height-collapse.vue2.js +4 -0
- package/es/height-collapse/index.js +7 -0
- package/es/height-collapse/props.js +11 -0
- package/es/height-collapse/style/index.css +32 -0
- package/es/index.js +56 -50
- package/es/installs.js +22 -20
- package/es/node_modules/.pnpm/jszip@3.10.1/node_modules/jszip/dist/jszip.min.js +2320 -0
- package/es/style.css +99 -4
- package/lib/file-download-wrapper/style/index.css +66 -0
- package/lib/height-collapse/style/index.css +32 -0
- package/lib/style.css +99 -4
- package/package.json +4 -3
- package/types/src/annex-upload/annex-upload.vue.d.ts +8 -8
- package/types/src/annex-upload/index.d.ts +4 -4
- package/types/src/components.d.ts +2 -1
- package/types/src/drop-down-condition/drop-down-condition.vue.d.ts +2 -2
- package/types/src/drop-down-condition/index.d.ts +2 -2
- package/types/src/drop-down-condition/props.d.ts +1 -1
- package/types/src/file-download-wrapper/file-download-wrapper.d.ts +11 -0
- package/types/src/file-download-wrapper/file-download-wrapper.vue.d.ts +4 -0
- package/types/src/file-download-wrapper/index.d.ts +8 -0
- package/types/src/file-download-wrapper/key.d.ts +20 -0
- package/types/src/file-download-wrapper/props.d.ts +21 -0
- package/types/src/filter-container/filter-container.d.ts +2 -0
- package/types/src/filter-container/props.d.ts +0 -2
- package/types/src/filter-wrapper/index.d.ts +2 -1
- package/types/src/height-collapse/height-collapse.vue.d.ts +32 -0
- package/types/src/height-collapse/index.d.ts +50 -0
- package/types/src/height-collapse/props.d.ts +11 -0
- package/types/src/help-tag/help-tag.vue.d.ts +5 -5
- package/types/src/help-tag/index.d.ts +5 -5
- package/types/src/help-tag/props.d.ts +5 -5
- package/types/src/installs.d.ts +65 -526
- package/types/src/operation-log/index.d.ts +2 -2
- package/types/src/operation-log/operation-log.vue.d.ts +2 -2
- package/types/src/operation-log/props.d.ts +1 -1
- package/types/src/scale-screen/props.d.ts +2 -2
- package/es/input/index.js +0 -7
- package/es/input/input.vue.js +0 -40
- package/es/input/input.vue2.js +0 -4
- package/es/input/style/index.css +0 -3
- package/lib/input/style/index.css +0 -3
- package/types/src/input/index.d.ts +0 -515
- package/types/src/input/input.d.ts +0 -18
- package/types/src/input/input.vue.d.ts +0 -513
- package/types/src/shared/hello.d.ts +0 -1
- package/types/src/shared/index.d.ts +0 -2
- package/types/src/shared/typeCheck.d.ts +0 -2
- package/types/src/shared/types/InferVueDefaults.d.ts +0 -7
- package/types/src/shared/types/index.d.ts +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
function r(o) {
|
|
2
|
+
throw new Error('Could not dynamically require "' + o + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
3
|
+
}
|
|
4
|
+
export {
|
|
5
|
+
r as commonjsRequire
|
|
6
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as se, ref as
|
|
1
|
+
import { defineComponent as se, ref as g, reactive as _, toRefs as ae, watch as ce, onMounted as re, createElementBlock as i, openBlock as a, createVNode as W, unref as u, normalizeStyle as R, withCtx as d, createTextVNode as k, createCommentVNode as N, toDisplayString as v, createElementVNode as E, Fragment as b, renderList as z, createBlock as y } from "vue";
|
|
2
2
|
import s from "../_virtual/lodash.js";
|
|
3
3
|
import { stylesUtils as U } from "../utils/style.js";
|
|
4
4
|
import { storage as G } from "../utils/storage.js";
|
|
5
|
-
import { M2 as
|
|
5
|
+
import { M2 as x } from "../utils/translate.js";
|
|
6
6
|
import { ElButton as P, ElDropdown as ie, ElCheckboxGroup as Y, ElCheckbox as j } from "element-plus";
|
|
7
7
|
import "element-plus/theme-chalk/src/base.scss";
|
|
8
8
|
import "element-plus/theme-chalk/src/button.scss";
|
|
@@ -27,20 +27,20 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
|
|
|
27
27
|
},
|
|
28
28
|
emits: ["filterChange", "setNoNeedRefreshNumFilterName"],
|
|
29
29
|
setup(H, { emit: J }) {
|
|
30
|
-
const Q =
|
|
30
|
+
const Q = g(), n = _({});
|
|
31
31
|
let K = _({});
|
|
32
|
-
const
|
|
33
|
-
M.value && (
|
|
32
|
+
const r = _({}), p = _({}), h = g(!0), m = H, $ = J, { filterKey: w, filterList: M, totalCount: C, level1Count: V, level2Count: F, noNeedRefreshNumFilterName: O } = ae(m), T = g(s.get(C, "value", 0)), S = g(s.get(V, "value", [])), B = g(s.get(F, "value", [])), c = g();
|
|
33
|
+
M.value && (c.value = [...M.value]);
|
|
34
34
|
function q(t) {
|
|
35
35
|
const { text: o, value: e } = t, l = n[o];
|
|
36
|
-
s.isNil(l) || s.isEmpty(l) ? n[o] = [e] : n[o] = [], p[o] = !p[o], p[o] ? (oe(o),
|
|
36
|
+
s.isNil(l) || s.isEmpty(l) ? n[o] = [e] : n[o] = [], p[o] = !p[o], p[o] ? (oe(o), r[o] = U.getBackgroundColor(!0), h.value = !1) : (ne(o), r[t.text] = {}, h.value = !0), h.value = L(), D();
|
|
37
37
|
}
|
|
38
38
|
function L() {
|
|
39
|
-
const t =
|
|
39
|
+
const t = c.value.filter((l) => !s.isEmpty(l.subs)).flatMap((l) => l.subs).length, o = c.value.filter((l) => s.isEmpty(l.subs)).length;
|
|
40
40
|
return Object.values(n).map((l) => l.length).reduce((l, f) => l + f, 0) === t + o || s.isEmpty(Object.values(n).flat());
|
|
41
41
|
}
|
|
42
42
|
function X(t) {
|
|
43
|
-
s.isEmpty(n[t.text]) ? (
|
|
43
|
+
s.isEmpty(n[t.text]) ? (r[t.text] = {}, p[t.text] = !1) : n[t.text].length === s.get(t, "subs.length", 1) ? (r[t.text] = U.getBackgroundColor(!0), p[t.text] = !0) : r[t.text] = {
|
|
44
44
|
backgroundColor: "#0F7535",
|
|
45
45
|
color: "#fff",
|
|
46
46
|
borderColor: "#0F7535"
|
|
@@ -54,8 +54,8 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
|
|
|
54
54
|
}
|
|
55
55
|
function ee() {
|
|
56
56
|
h.value = !0;
|
|
57
|
-
for (const t in
|
|
58
|
-
|
|
57
|
+
for (const t in r)
|
|
58
|
+
r[t] = {};
|
|
59
59
|
for (const t in n)
|
|
60
60
|
delete n[t];
|
|
61
61
|
for (const t in p)
|
|
@@ -81,26 +81,27 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
|
|
|
81
81
|
]);
|
|
82
82
|
}
|
|
83
83
|
function oe(t) {
|
|
84
|
-
const o =
|
|
84
|
+
const o = c.value.find((e) => e.text === t);
|
|
85
85
|
o && o.subs && (n[t] = o.subs.map((e) => e.value));
|
|
86
86
|
}
|
|
87
87
|
function ne(t) {
|
|
88
88
|
n[t] = [];
|
|
89
89
|
}
|
|
90
90
|
function ue() {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
var e;
|
|
92
|
+
const t = `filter-key-${m.enumEntity}`, o = G.getWithExpireTime(t);
|
|
93
|
+
o ? c.value = o : (console.log(m.enumEntity), (e = m == null ? void 0 : m.initFilters(m.enumEntity)) == null || e.then((l) => {
|
|
94
|
+
console.log(l), c.value = l.data, G.setWithExpireTime(t, c.value, 1200 * 1e3), console.log(c.value);
|
|
95
|
+
}).catch((l) => {
|
|
96
|
+
console.log(l);
|
|
96
97
|
}));
|
|
97
98
|
}
|
|
98
|
-
return
|
|
99
|
+
return ce(
|
|
99
100
|
[() => C.value, () => V.value, () => F.value],
|
|
100
101
|
([t, o, e], [l, f, A]) => {
|
|
101
102
|
console.log(t, o, e), console.log(l, f, A), (!O.value || !s.eq(O.value, w.value)) && (T.value = C.value, S.value = V.value, B.value = F.value);
|
|
102
103
|
}
|
|
103
|
-
),
|
|
104
|
+
), re(() => {
|
|
104
105
|
ue();
|
|
105
106
|
}), (t, o) => (a(), i("div", de, [
|
|
106
107
|
W(u(P), {
|
|
@@ -110,7 +111,7 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
|
|
|
110
111
|
onClick: ee
|
|
111
112
|
}, {
|
|
112
113
|
default: d(() => [
|
|
113
|
-
k(v(u(
|
|
114
|
+
k(v(u(x)("全部")) + " ", 1),
|
|
114
115
|
u(C) ? (a(), i("span", ve, "(" + v(T.value) + ")", 1)) : N("", !0)
|
|
115
116
|
]),
|
|
116
117
|
_: 1
|
|
@@ -123,7 +124,7 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
|
|
|
123
124
|
}, {
|
|
124
125
|
dropdown: d(() => [
|
|
125
126
|
E("div", he, [
|
|
126
|
-
(a(!0), i(b, null, z(
|
|
127
|
+
(a(!0), i(b, null, z(c.value, (e) => (a(), y(u(Y), {
|
|
127
128
|
key: e.value,
|
|
128
129
|
modelValue: n[e.text],
|
|
129
130
|
"onUpdate:modelValue": (l) => n[e.text] = l,
|
|
@@ -132,24 +133,24 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
|
|
|
132
133
|
onChange: (l) => X(e)
|
|
133
134
|
}, {
|
|
134
135
|
default: d(() => [
|
|
135
|
-
u(s).isNil(e.subs) ? (a(),
|
|
136
|
+
u(s).isNil(e.subs) ? (a(), y(u(j), {
|
|
136
137
|
key: 1,
|
|
137
138
|
value: e.value,
|
|
138
139
|
class: "checkbox custom-dropdown-button",
|
|
139
140
|
border: ""
|
|
140
141
|
}, {
|
|
141
142
|
default: d(() => [
|
|
142
|
-
k(v(u(
|
|
143
|
+
k(v(u(x)(e.text)), 1)
|
|
143
144
|
]),
|
|
144
145
|
_: 2
|
|
145
146
|
}, 1032, ["value"])) : (a(), i(b, { key: 0 }, [
|
|
146
147
|
E("span", {
|
|
147
148
|
class: "el-button custom-dropdown-button el-button--small inner-el-button",
|
|
148
|
-
style: R(
|
|
149
|
+
style: R(r[e.text]),
|
|
149
150
|
onClick: (l) => q(e)
|
|
150
|
-
}, v(u(
|
|
151
|
+
}, v(u(x)(e.text)), 13, me),
|
|
151
152
|
E("div", ge, [
|
|
152
|
-
(a(!0), i(b, null, z(e.subs, (l) => (a(),
|
|
153
|
+
(a(!0), i(b, null, z(e.subs, (l) => (a(), y(u(j), {
|
|
153
154
|
key: l.value,
|
|
154
155
|
class: "checkbox custom-dropdown-button",
|
|
155
156
|
value: l.value,
|
|
@@ -158,7 +159,7 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
|
|
|
158
159
|
default: d(() => {
|
|
159
160
|
var f;
|
|
160
161
|
return [
|
|
161
|
-
k(v(u(
|
|
162
|
+
k(v(u(x)(l.text)), 1),
|
|
162
163
|
u(s).isEmpty(B.value) ? N("", !0) : (a(), i("span", ye, "(" + v((f = B.value.filter((A) => A.value == l.value)[0]) == null ? void 0 : f.count) + ")", 1))
|
|
163
164
|
];
|
|
164
165
|
}),
|
|
@@ -173,8 +174,8 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
|
|
|
173
174
|
]),
|
|
174
175
|
default: d(() => [
|
|
175
176
|
E("div", fe, [
|
|
176
|
-
(a(!0), i(b, null, z(
|
|
177
|
-
e.isCheckbox ? (a(),
|
|
177
|
+
(a(!0), i(b, null, z(c.value, (e) => (a(), i(b, null, [
|
|
178
|
+
e.isCheckbox ? (a(), y(u(Y), {
|
|
178
179
|
key: e.value,
|
|
179
180
|
modelValue: n[e.text],
|
|
180
181
|
"onUpdate:modelValue": (l) => n[e.text] = l,
|
|
@@ -183,22 +184,22 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
|
|
|
183
184
|
onChange: Z
|
|
184
185
|
}, {
|
|
185
186
|
default: d(() => [
|
|
186
|
-
e.isCheckbox ? (a(),
|
|
187
|
+
e.isCheckbox ? (a(), y(u(j), {
|
|
187
188
|
key: 0,
|
|
188
189
|
class: "custom-dropdown-button",
|
|
189
190
|
value: e.value,
|
|
190
191
|
border: ""
|
|
191
192
|
}, {
|
|
192
193
|
default: d(() => [
|
|
193
|
-
k(v(u(
|
|
194
|
+
k(v(u(x)(e.text)), 1)
|
|
194
195
|
]),
|
|
195
196
|
_: 2
|
|
196
197
|
}, 1032, ["value"])) : N("", !0)
|
|
197
198
|
]),
|
|
198
199
|
_: 2
|
|
199
|
-
}, 1032, ["modelValue", "onUpdate:modelValue"])) : (a(),
|
|
200
|
+
}, 1032, ["modelValue", "onUpdate:modelValue"])) : (a(), y(u(P), {
|
|
200
201
|
key: e.text,
|
|
201
|
-
style: R(
|
|
202
|
+
style: R(r[e.text]),
|
|
202
203
|
class: "custom-dropdown-button",
|
|
203
204
|
size: "small",
|
|
204
205
|
onClick: (l) => q(e)
|
|
@@ -206,7 +207,7 @@ const de = { class: "yahee-drop-down-condition" }, ve = { key: 0 }, fe = { style
|
|
|
206
207
|
default: d(() => {
|
|
207
208
|
var l;
|
|
208
209
|
return [
|
|
209
|
-
k(v(u(
|
|
210
|
+
k(v(u(x)(e.text)) + " ", 1),
|
|
210
211
|
u(s).isEmpty(S.value) ? N("", !0) : (a(), i("span", pe, "(" + v((l = S.value.filter((f) => f.value == e.value)[0]) == null ? void 0 : l.count) + ")", 1))
|
|
211
212
|
];
|
|
212
213
|
}),
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { defineComponent as K, ref as R, watch as Q, onMounted as ee, computed as V, resolveComponent as F, createElementBlock as c, openBlock as s, createCommentVNode as B, createElementVNode as i, createVNode as k, withCtx as C, createTextVNode as D, toDisplayString as p, Fragment as te, renderList as le, createBlock as oe, unref as n, withModifiers as se } from "vue";
|
|
2
|
+
import { ElMessage as v } from "element-plus";
|
|
3
|
+
import "element-plus/theme-chalk/src/base.scss";
|
|
4
|
+
import "element-plus/theme-chalk/src/badge.scss";
|
|
5
|
+
import "element-plus/theme-chalk/src/message.scss";
|
|
6
|
+
import ie from "../_virtual/jszip.min.js";
|
|
7
|
+
import { Document as z } from "@element-plus/icons-vue";
|
|
8
|
+
import { FILE_TYPE_REGEX as g } from "./key.js";
|
|
9
|
+
import E from "../packages/components/hooks/useImgPath.js";
|
|
10
|
+
const ce = { class: "yahee-file-download-wrapper" }, ne = {
|
|
11
|
+
key: 0,
|
|
12
|
+
class: "batch-toolbar"
|
|
13
|
+
}, ae = { class: "file-list" }, re = { class: "file-item" }, de = {
|
|
14
|
+
key: 0,
|
|
15
|
+
class: "image-item"
|
|
16
|
+
}, me = {
|
|
17
|
+
key: 1,
|
|
18
|
+
class: "document-item"
|
|
19
|
+
}, fe = ["src"], he = ["href"], ue = {
|
|
20
|
+
key: 2,
|
|
21
|
+
class: "document-item"
|
|
22
|
+
}, _e = ["src"], pe = ["href"], ke = {
|
|
23
|
+
key: 3,
|
|
24
|
+
class: "document-item"
|
|
25
|
+
}, we = ["src"], ve = ["href"], ge = {
|
|
26
|
+
key: 4,
|
|
27
|
+
class: "document-item"
|
|
28
|
+
}, be = ["src"], ye = ["href"], Ne = {
|
|
29
|
+
key: 5,
|
|
30
|
+
class: "document-item"
|
|
31
|
+
}, Ue = ["onClick"], $e = {
|
|
32
|
+
key: 6,
|
|
33
|
+
class: "document-item"
|
|
34
|
+
}, Fe = ["href"], Ce = {
|
|
35
|
+
key: 7,
|
|
36
|
+
class: "file-name"
|
|
37
|
+
}, y = "[文件批量下载调试]", Pe = /* @__PURE__ */ K({
|
|
38
|
+
__name: "file-download-wrapper",
|
|
39
|
+
props: {
|
|
40
|
+
fileId: {},
|
|
41
|
+
fileName: {},
|
|
42
|
+
fileUrl: {},
|
|
43
|
+
files: {},
|
|
44
|
+
showBatchDownload: { type: Boolean }
|
|
45
|
+
},
|
|
46
|
+
setup(P) {
|
|
47
|
+
const a = P, o = (e, l) => {
|
|
48
|
+
l ? console.log(`${y} ${e}`, l) : console.log(`${y} ${e}`);
|
|
49
|
+
}, h = R([]), L = R(!1), x = () => {
|
|
50
|
+
var e;
|
|
51
|
+
if ((e = a.files) != null && e.length) {
|
|
52
|
+
h.value = a.files.map((l) => ({
|
|
53
|
+
...l,
|
|
54
|
+
checked: !1
|
|
55
|
+
})), o("初始化多文件列表:", h.value);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
a.fileName && (h.value = [
|
|
59
|
+
{
|
|
60
|
+
fileId: a.fileId,
|
|
61
|
+
fileName: a.fileName,
|
|
62
|
+
fileUrl: a.fileUrl,
|
|
63
|
+
checked: !1
|
|
64
|
+
}
|
|
65
|
+
], o("初始化单文件列表:", h.value));
|
|
66
|
+
};
|
|
67
|
+
Q(
|
|
68
|
+
() => [a.files, a.fileId, a.fileName, a.fileUrl],
|
|
69
|
+
() => x(),
|
|
70
|
+
{ deep: !0, immediate: !0 }
|
|
71
|
+
), ee(() => x());
|
|
72
|
+
const N = V(() => {
|
|
73
|
+
const e = h.value.filter((l) => l.checked);
|
|
74
|
+
return o("当前选中的文件:", e), e;
|
|
75
|
+
}), T = V(() => h.value.length > 1 && a.showBatchDownload), r = (e) => e.fileUrl ? e.fileUrl : e.fileId ? `https://imgs.yaheecloud.com/${e.fileId}` : "", M = {
|
|
76
|
+
isImageFile: (e) => g.image.test(e),
|
|
77
|
+
isWordFile: (e) => g.word.test(e),
|
|
78
|
+
isPdfFile: (e) => g.pdf.test(e),
|
|
79
|
+
isPptFile: (e) => g.ppt.test(e),
|
|
80
|
+
isExcelFile: (e) => g.excel.test(e),
|
|
81
|
+
isTxtFile: (e) => g.txt.test(e)
|
|
82
|
+
}, { isImageFile: O, isWordFile: j, isPdfFile: A, isPptFile: S, isExcelFile: G, isTxtFile: X } = M, J = () => {
|
|
83
|
+
L.value = h.value.every((e) => e.checked);
|
|
84
|
+
}, W = (e) => {
|
|
85
|
+
h.value.forEach((l) => {
|
|
86
|
+
l.checked = e;
|
|
87
|
+
});
|
|
88
|
+
}, Y = async (e) => {
|
|
89
|
+
try {
|
|
90
|
+
const l = r(e);
|
|
91
|
+
o("开始单个TXT文件下载,URL:", l), o("使用的文件名:", e.fileName);
|
|
92
|
+
const u = await fetch(l);
|
|
93
|
+
if (!u.ok) throw new Error("文件请求失败");
|
|
94
|
+
const w = await u.blob(), f = window.URL.createObjectURL(w), d = document.createElement("a");
|
|
95
|
+
d.href = f, d.download = e.fileName, document.body.appendChild(d), d.click(), document.body.removeChild(d), window.URL.revokeObjectURL(f), v.success("下载成功");
|
|
96
|
+
} catch (l) {
|
|
97
|
+
console.error(`${y} TXT文件下载失败:`, l), v.error("文件下载失败,请重试");
|
|
98
|
+
}
|
|
99
|
+
}, Z = async () => {
|
|
100
|
+
if (N.value.length === 0) {
|
|
101
|
+
v.warning("请先选择要下载的文件");
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
o("========== 开始批量下载流程 ==========");
|
|
105
|
+
const e = new ie(), l = [];
|
|
106
|
+
v.info("正在加载文件并打包,请稍候...");
|
|
107
|
+
try {
|
|
108
|
+
N.value.forEach((d, t) => {
|
|
109
|
+
const U = r(d), m = d.fileName;
|
|
110
|
+
o(`[文件 ${t + 1}] 开始处理`), o(`[文件 ${t + 1}] 请求URL:`, U), o(`[文件 ${t + 1}] 使用的文件名:`, m);
|
|
111
|
+
const q = fetch(U).then((_) => {
|
|
112
|
+
if (!_.ok) throw new Error(`【${m}】加载失败,状态码:${_.status}`);
|
|
113
|
+
return _.blob();
|
|
114
|
+
}).then((_) => {
|
|
115
|
+
let b = m, I = 1;
|
|
116
|
+
for (; e.files[b]; ) {
|
|
117
|
+
const $ = m.lastIndexOf("."), H = $ > -1 ? m.slice($) : "";
|
|
118
|
+
b = `${$ > -1 ? m.slice(0, $) : m}(${I})${H}`, I++;
|
|
119
|
+
}
|
|
120
|
+
b !== m && o(`[文件 ${t + 1}] 检测到重名,重命名为:`, b), e.file(b, _), o(`[文件 ${t + 1}] 已加入压缩包`);
|
|
121
|
+
}).catch((_) => {
|
|
122
|
+
throw console.error(`${y} [文件 ${t + 1}] 处理失败:`, _), _;
|
|
123
|
+
});
|
|
124
|
+
l.push(q);
|
|
125
|
+
}), o("等待所有文件加载完成..."), await Promise.all(l), o("所有文件加载完成,开始生成压缩包...");
|
|
126
|
+
const u = await e.generateAsync({ type: "blob" }), w = window.URL.createObjectURL(u), f = document.createElement("a");
|
|
127
|
+
f.href = w, f.download = `批量文件下载_${Date.now()}.zip`, document.body.appendChild(f), f.click(), document.body.removeChild(f), window.URL.revokeObjectURL(w), o("========== 批量下载流程完成 =========="), v.success("批量打包下载完成");
|
|
128
|
+
} catch (u) {
|
|
129
|
+
console.error(`${y} 批量下载失败:`, u), v.error("打包下载失败,请检查控制台日志");
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
return (e, l) => {
|
|
133
|
+
const u = F("el-checkbox"), w = F("el-button"), f = F("el-image"), d = F("el-icon");
|
|
134
|
+
return s(), c("div", ce, [
|
|
135
|
+
T.value ? (s(), c("div", ne, [
|
|
136
|
+
k(u, {
|
|
137
|
+
modelValue: L.value,
|
|
138
|
+
"onUpdate:modelValue": l[0] || (l[0] = (t) => L.value = t),
|
|
139
|
+
onChange: W
|
|
140
|
+
}, {
|
|
141
|
+
default: C(() => l[1] || (l[1] = [
|
|
142
|
+
D("全选")
|
|
143
|
+
])),
|
|
144
|
+
_: 1,
|
|
145
|
+
__: [1]
|
|
146
|
+
}, 8, ["modelValue"]),
|
|
147
|
+
k(w, {
|
|
148
|
+
type: "primary",
|
|
149
|
+
size: "small",
|
|
150
|
+
disabled: N.value.length === 0,
|
|
151
|
+
onClick: Z
|
|
152
|
+
}, {
|
|
153
|
+
default: C(() => [
|
|
154
|
+
D(" 下载选中文件(" + p(N.value.length) + ") ", 1)
|
|
155
|
+
]),
|
|
156
|
+
_: 1
|
|
157
|
+
}, 8, ["disabled"])
|
|
158
|
+
])) : B("", !0),
|
|
159
|
+
i("div", ae, [
|
|
160
|
+
(s(!0), c(te, null, le(h.value, (t, U) => (s(), c("div", {
|
|
161
|
+
key: `file-${U}`,
|
|
162
|
+
class: "file-row"
|
|
163
|
+
}, [
|
|
164
|
+
T.value ? (s(), oe(u, {
|
|
165
|
+
key: 0,
|
|
166
|
+
modelValue: t.checked,
|
|
167
|
+
"onUpdate:modelValue": (m) => t.checked = m,
|
|
168
|
+
class: "file-checkbox",
|
|
169
|
+
onChange: J
|
|
170
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"])) : B("", !0),
|
|
171
|
+
i("div", re, [
|
|
172
|
+
n(O)(r(t)) ? (s(), c("div", de, [
|
|
173
|
+
k(f, {
|
|
174
|
+
class: "file-image",
|
|
175
|
+
src: r(t),
|
|
176
|
+
"preview-src-list": [r(t)],
|
|
177
|
+
fit: "contain",
|
|
178
|
+
"preview-teleported": !0
|
|
179
|
+
}, null, 8, ["src", "preview-src-list"])
|
|
180
|
+
])) : n(j)(t.fileName) ? (s(), c("div", me, [
|
|
181
|
+
i("img", {
|
|
182
|
+
src: n(E)("file-word.png"),
|
|
183
|
+
class: "file-icon",
|
|
184
|
+
alt: "word"
|
|
185
|
+
}, null, 8, fe),
|
|
186
|
+
i("a", {
|
|
187
|
+
href: r(t),
|
|
188
|
+
target: "_blank",
|
|
189
|
+
class: "file-link"
|
|
190
|
+
}, p(t.fileName), 9, he)
|
|
191
|
+
])) : n(A)(t.fileName) ? (s(), c("div", ue, [
|
|
192
|
+
i("img", {
|
|
193
|
+
src: n(E)("pdf.png"),
|
|
194
|
+
class: "file-icon",
|
|
195
|
+
alt: "pdf"
|
|
196
|
+
}, null, 8, _e),
|
|
197
|
+
i("a", {
|
|
198
|
+
href: r(t),
|
|
199
|
+
target: "_blank",
|
|
200
|
+
class: "file-link"
|
|
201
|
+
}, p(t.fileName), 9, pe)
|
|
202
|
+
])) : n(S)(t.fileName) ? (s(), c("div", ke, [
|
|
203
|
+
i("img", {
|
|
204
|
+
src: n(E)("ppt.png"),
|
|
205
|
+
class: "file-icon",
|
|
206
|
+
alt: "ppt"
|
|
207
|
+
}, null, 8, we),
|
|
208
|
+
i("a", {
|
|
209
|
+
href: r(t),
|
|
210
|
+
target: "_blank",
|
|
211
|
+
class: "file-link"
|
|
212
|
+
}, p(t.fileName), 9, ve)
|
|
213
|
+
])) : n(G)(t.fileName) ? (s(), c("div", ge, [
|
|
214
|
+
i("img", {
|
|
215
|
+
src: n(E)("excel.png"),
|
|
216
|
+
class: "file-icon",
|
|
217
|
+
alt: "excel"
|
|
218
|
+
}, null, 8, be),
|
|
219
|
+
i("a", {
|
|
220
|
+
href: r(t),
|
|
221
|
+
target: "_blank",
|
|
222
|
+
class: "file-link"
|
|
223
|
+
}, p(t.fileName), 9, ye)
|
|
224
|
+
])) : n(X)(t.fileName) ? (s(), c("div", Ne, [
|
|
225
|
+
k(d, {
|
|
226
|
+
size: "24",
|
|
227
|
+
class: "file-icon"
|
|
228
|
+
}, {
|
|
229
|
+
default: C(() => [
|
|
230
|
+
k(n(z))
|
|
231
|
+
]),
|
|
232
|
+
_: 1
|
|
233
|
+
}),
|
|
234
|
+
i("a", {
|
|
235
|
+
class: "file-link",
|
|
236
|
+
onClick: se((m) => Y(t), ["prevent"])
|
|
237
|
+
}, p(t.fileName), 9, Ue)
|
|
238
|
+
])) : r(t) ? (s(), c("div", $e, [
|
|
239
|
+
k(d, {
|
|
240
|
+
size: "24",
|
|
241
|
+
class: "file-icon"
|
|
242
|
+
}, {
|
|
243
|
+
default: C(() => [
|
|
244
|
+
k(n(z))
|
|
245
|
+
]),
|
|
246
|
+
_: 1
|
|
247
|
+
}),
|
|
248
|
+
i("a", {
|
|
249
|
+
href: r(t),
|
|
250
|
+
target: "_blank",
|
|
251
|
+
class: "file-link"
|
|
252
|
+
}, p(t.fileName), 9, Fe)
|
|
253
|
+
])) : (s(), c("div", Ce, [
|
|
254
|
+
i("span", null, p(t.fileName), 1)
|
|
255
|
+
]))
|
|
256
|
+
])
|
|
257
|
+
]))), 128))
|
|
258
|
+
])
|
|
259
|
+
]);
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
export {
|
|
264
|
+
Pe as default
|
|
265
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const p = {
|
|
2
|
+
/** 图片文件 */
|
|
3
|
+
image: /\.(png|jpg|jpeg|gif|webp|svg|bmp)$/i,
|
|
4
|
+
/** Word文档 */
|
|
5
|
+
word: /\.(doc|docx|docm|dot|dotx)$/i,
|
|
6
|
+
/** PDF文档 */
|
|
7
|
+
pdf: /\.pdf$/i,
|
|
8
|
+
/** PPT演示文档 */
|
|
9
|
+
ppt: /\.(ppt|pptx|pptm|pot|potx)$/i,
|
|
10
|
+
/** Excel表格 */
|
|
11
|
+
excel: /\.(xls|xlsx|xlsm|csv|xlt|xltx)$/i,
|
|
12
|
+
/** TXT文本文件 */
|
|
13
|
+
txt: /\.txt$/i
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
p as FILE_TYPE_REGEX
|
|
17
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
.yahee-file-download-wrapper {
|
|
2
|
+
width: 100%;
|
|
3
|
+
padding: 8px 0;
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
}
|
|
6
|
+
.yahee-file-download-wrapper .batch-toolbar {
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
gap: 12px;
|
|
10
|
+
margin-bottom: 12px;
|
|
11
|
+
padding-bottom: 8px;
|
|
12
|
+
}
|
|
13
|
+
.yahee-file-download-wrapper .file-list {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
gap: 10px;
|
|
17
|
+
}
|
|
18
|
+
.yahee-file-download-wrapper .file-row {
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: flex-start;
|
|
21
|
+
gap: 8px;
|
|
22
|
+
width: 100%;
|
|
23
|
+
}
|
|
24
|
+
.yahee-file-download-wrapper .file-row .file-checkbox {
|
|
25
|
+
margin-top: 2px;
|
|
26
|
+
flex-shrink: 0;
|
|
27
|
+
}
|
|
28
|
+
.yahee-file-download-wrapper .file-item {
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
gap: 8px;
|
|
32
|
+
flex: 1;
|
|
33
|
+
min-width: 0;
|
|
34
|
+
}
|
|
35
|
+
.yahee-file-download-wrapper .file-item .image-item .file-image {
|
|
36
|
+
max-width: 200px;
|
|
37
|
+
max-height: 200px;
|
|
38
|
+
border: 1px solid #dcdfe6;
|
|
39
|
+
border-radius: 4px;
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
}
|
|
42
|
+
.yahee-file-download-wrapper .file-item .document-item {
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
gap: 8px;
|
|
46
|
+
}
|
|
47
|
+
.yahee-file-download-wrapper .file-item .document-item .file-icon {
|
|
48
|
+
width: 24px;
|
|
49
|
+
height: 24px;
|
|
50
|
+
flex-shrink: 0;
|
|
51
|
+
}
|
|
52
|
+
.yahee-file-download-wrapper .file-item .document-item .file-link {
|
|
53
|
+
color: #409eff;
|
|
54
|
+
text-decoration: none;
|
|
55
|
+
word-break: break-all;
|
|
56
|
+
flex: 1;
|
|
57
|
+
min-width: 0;
|
|
58
|
+
font-size: 12px;
|
|
59
|
+
}
|
|
60
|
+
.yahee-file-download-wrapper .file-item .document-item .file-link:hover {
|
|
61
|
+
text-decoration: underline;
|
|
62
|
+
}
|
|
63
|
+
.yahee-file-download-wrapper .file-item .file-name {
|
|
64
|
+
color: #606266;
|
|
65
|
+
word-break: break-all;
|
|
66
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { defineComponent as x, mergeDefaults as w, ref as s, watch as H, onMounted as y, onUnmounted as T, createElementBlock as u, openBlock as p, createElementVNode as k, createCommentVNode as E, normalizeStyle as v, renderSlot as _, normalizeClass as C, toDisplayString as z, nextTick as d } from "vue";
|
|
2
|
+
import { defaultHeightCollapseProps as B } from "./props.js";
|
|
3
|
+
const R = { class: "yahee-height-collapse-wrapper" }, S = ["title"], L = /* @__PURE__ */ x({
|
|
4
|
+
__name: "height-collapse",
|
|
5
|
+
props: /* @__PURE__ */ w({
|
|
6
|
+
maxHeight: {},
|
|
7
|
+
defaultExpand: { type: Boolean },
|
|
8
|
+
expandTitle: {},
|
|
9
|
+
collapseTitle: {}
|
|
10
|
+
}, B()),
|
|
11
|
+
emits: ["change"],
|
|
12
|
+
setup(m, { emit: h }) {
|
|
13
|
+
const l = m, f = h, e = s(l.defaultExpand), c = s(!1), t = s(null), i = s(l.maxHeight + 5);
|
|
14
|
+
let o = null;
|
|
15
|
+
const r = () => {
|
|
16
|
+
if (!t.value) {
|
|
17
|
+
i.value = l.maxHeight + 5;
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
e.value ? i.value = t.value.scrollHeight : i.value = Math.min(t.value.clientHeight, l.maxHeight);
|
|
21
|
+
}, n = async () => {
|
|
22
|
+
if (await d(), !t.value) return;
|
|
23
|
+
const { scrollHeight: a } = t.value;
|
|
24
|
+
c.value = a > l.maxHeight, r();
|
|
25
|
+
}, g = async () => {
|
|
26
|
+
e.value = !e.value, f("change", e.value), await d(), r();
|
|
27
|
+
};
|
|
28
|
+
return H(() => l.maxHeight, n), y(() => {
|
|
29
|
+
n(), t.value && (o = new ResizeObserver(n), o.observe(t.value)), window.addEventListener("resize", n);
|
|
30
|
+
}), T(() => {
|
|
31
|
+
o == null || o.disconnect(), window.removeEventListener("resize", n);
|
|
32
|
+
}), (a, $) => (p(), u("div", R, [
|
|
33
|
+
k("div", {
|
|
34
|
+
ref_key: "contentRef",
|
|
35
|
+
ref: t,
|
|
36
|
+
class: "height-collapse-content",
|
|
37
|
+
style: v(e.value ? {} : { maxHeight: `${a.maxHeight}px`, overflow: "hidden" })
|
|
38
|
+
}, [
|
|
39
|
+
_(a.$slots, "default")
|
|
40
|
+
], 4),
|
|
41
|
+
c.value ? (p(), u("div", {
|
|
42
|
+
key: 0,
|
|
43
|
+
title: e.value ? a.expandTitle : a.collapseTitle,
|
|
44
|
+
class: C(["show-filters", { more: !e.value }]),
|
|
45
|
+
style: v({ top: `${i.value}px` }),
|
|
46
|
+
onClick: g
|
|
47
|
+
}, z(e.value ? "∧" : "∨"), 15, S)) : E("", !0)
|
|
48
|
+
]));
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
export {
|
|
52
|
+
L as default
|
|
53
|
+
};
|