yahee-components 0.0.10 → 0.0.13
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/api/server.js +26 -10
- package/es/api/tool.js +10 -11
- package/es/country-platform-shop-condition/country-platform-shop-condition.vue.js +218 -0
- package/es/country-platform-shop-condition/country-platform-shop-condition.vue2.js +4 -0
- package/es/country-platform-shop-condition/index.js +7 -0
- package/es/country-platform-shop-condition/style/index.css +48 -0
- package/es/drop-down-condition/drop-down-condition.vue.js +216 -0
- package/es/drop-down-condition/drop-down-condition.vue2.js +4 -0
- package/es/drop-down-condition/index.js +7 -0
- package/es/drop-down-condition/style/index.css +45 -0
- package/es/index.js +23 -15
- package/es/installs.js +18 -10
- package/es/left-condition/index.js +7 -0
- package/es/left-condition/left-condition-sub.vue.js +95 -0
- package/es/left-condition/left-condition-sub.vue2.js +4 -0
- package/es/left-condition/left-condition.vue.js +216 -0
- package/es/left-condition/left-condition.vue2.js +4 -0
- package/es/left-condition/style/index.css +10 -0
- package/es/left-condition-enum/index.js +7 -0
- package/es/left-condition-enum/left-condition-enum.vue.js +80 -0
- package/es/left-condition-enum/left-condition-enum.vue2.js +4 -0
- package/es/left-condition-enum/style/index.css +10 -0
- package/es/operation-log/operation-log-form.vue.js +179 -5
- package/es/operation-log/operation-log-form.vue2.js +2 -179
- package/es/operation-log/operation-log.vue.js +30 -30
- package/es/packages/components/api/server.js +26 -13
- package/es/packages/components/api/tool.js +9 -10
- package/es/static/CommonObject.js +4 -0
- package/es/style.css +89 -194
- package/es/utils/style.js +28 -0
- package/es/utils/translate.js +39 -22
- package/lib/country-platform-shop-condition/style/index.css +48 -0
- package/lib/drop-down-condition/style/index.css +45 -0
- package/lib/left-condition/style/index.css +10 -0
- package/lib/left-condition-enum/style/index.css +10 -0
- package/lib/style.css +89 -194
- package/package.json +1 -1
- package/types/src/components.d.ts +4 -0
- package/types/src/country-platform-shop-condition/country-platform-shop-condition.d.ts +17 -0
- package/types/src/country-platform-shop-condition/country-platform-shop-condition.vue.d.ts +14 -0
- package/types/src/country-platform-shop-condition/index.d.ts +16 -0
- package/types/src/drop-down-condition/drop-down-condition.d.ts +6 -0
- package/types/src/drop-down-condition/drop-down-condition.vue.d.ts +40 -0
- package/types/src/drop-down-condition/index.d.ts +42 -0
- package/types/src/installs.d.ts +270 -2
- package/types/src/left-condition/index.d.ts +69 -0
- package/types/src/left-condition/left-condition-sub.vue.d.ts +47 -0
- package/types/src/left-condition/left-condition.d.ts +5 -0
- package/types/src/left-condition/left-condition.vue.d.ts +68 -0
- package/types/src/left-condition-enum/index.d.ts +162 -0
- package/types/src/left-condition-enum/left-condition-enum.d.ts +5 -0
- package/types/src/left-condition-enum/left-condition-enum.vue.d.ts +160 -0
- package/es/_virtual/_plugin-vue_export-helper.js +0 -9
package/es/api/server.js
CHANGED
|
@@ -1,13 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { handleChangeRequestHeader as
|
|
3
|
-
|
|
4
|
-
let
|
|
5
|
-
return
|
|
1
|
+
import n from "../node_modules/.pnpm/axios@1.7.7/node_modules/axios/lib/axios.js";
|
|
2
|
+
import { handleChangeRequestHeader as o, handleConfigureAuth as d, handleAuthError as u, handleGeneralError as i, handleNetworkError as h } from "./tool.js";
|
|
3
|
+
n.interceptors.request.use((t) => {
|
|
4
|
+
let e = o(t);
|
|
5
|
+
return e = d(e), e;
|
|
6
6
|
});
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
(
|
|
10
|
-
(
|
|
11
|
-
|
|
7
|
+
n.defaults.withCredentials = !0;
|
|
8
|
+
n.interceptors.response.use(
|
|
9
|
+
(t) => t.status !== 200 ? Promise.reject(t.data) : (u(t.data.errno), i(t.data.status, t.data.msg), t),
|
|
10
|
+
(t) => {
|
|
11
|
+
h(t.response.status), Promise.reject(t.response);
|
|
12
12
|
}
|
|
13
13
|
);
|
|
14
|
+
const g = (t, e = {}, c) => new Promise((s) => {
|
|
15
|
+
n.get(t, { params: e }).then((r) => {
|
|
16
|
+
let a;
|
|
17
|
+
a = r.data, s(a);
|
|
18
|
+
}).catch((r) => {
|
|
19
|
+
const a = {
|
|
20
|
+
msg: r.msg,
|
|
21
|
+
data: r.data
|
|
22
|
+
// 其他错误属性...
|
|
23
|
+
};
|
|
24
|
+
s(a);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
export {
|
|
28
|
+
g as Get
|
|
29
|
+
};
|
package/es/api/tool.js
CHANGED
|
@@ -7,11 +7,10 @@ import "element-plus/theme-chalk/src/button.scss";
|
|
|
7
7
|
import "element-plus/theme-chalk/src/input.scss";
|
|
8
8
|
import "element-plus/theme-chalk/src/overlay.scss";
|
|
9
9
|
import { AxiosHeaders as l } from "../node_modules/.pnpm/axios@1.7.7/node_modules/axios/index.js";
|
|
10
|
-
const
|
|
10
|
+
const w = (e) => ({
|
|
11
11
|
...e,
|
|
12
|
-
baseURL: i,
|
|
13
12
|
timeout: 2e4
|
|
14
|
-
}),
|
|
13
|
+
}), N = (e) => {
|
|
15
14
|
const o = new l(e.headers);
|
|
16
15
|
return {
|
|
17
16
|
...e,
|
|
@@ -19,7 +18,7 @@ const i = "https://plmerp.yaheecloud.com/api/plm/product-dev/", N = (e) => ({
|
|
|
19
18
|
};
|
|
20
19
|
};
|
|
21
20
|
let t = !1;
|
|
22
|
-
const
|
|
21
|
+
const R = (e) => {
|
|
23
22
|
const o = {
|
|
24
23
|
400: "错误的请求",
|
|
25
24
|
// token 失效
|
|
@@ -48,7 +47,7 @@ const U = (e) => {
|
|
|
48
47
|
}
|
|
49
48
|
};
|
|
50
49
|
var a = /* @__PURE__ */ ((e) => (e[e.AuthInvalid = 10031] = "AuthInvalid", e[e.AuthTooLong = 10032] = "AuthTooLong", e[e.UserHasNoRole = 10033] = "UserHasNoRole", e[e.UserNotRegistered = 10034] = "UserNotRegistered", e[e.ThirdPlatformUser = 10035] = "ThirdPlatformUser", e[e.NoRelatedEmployee = 10036] = "NoRelatedEmployee", e[e.CountInvalid = 10037] = "CountInvalid", e[e.CountNotFound = 10038] = "CountNotFound", e))(a || {});
|
|
51
|
-
const
|
|
50
|
+
const U = (e) => e in {
|
|
52
51
|
10031: "登录失效,需要重新登录",
|
|
53
52
|
// token 失效
|
|
54
53
|
10032: "您太久没登录,请重新登录~",
|
|
@@ -59,11 +58,11 @@ const C = (e) => e in {
|
|
|
59
58
|
10036: "该账户未关联员工,请联系管理员做关联",
|
|
60
59
|
10037: "账号已无效",
|
|
61
60
|
10038: "账号未找到"
|
|
62
|
-
} ? (n.error(a[e]), !1) : !0,
|
|
61
|
+
} ? (n.error(a[e]), !1) : !0, C = (e, o) => e !== 0 && o !== "OK" ? (n.error(o), !1) : !0;
|
|
63
62
|
export {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
U as handleAuthError,
|
|
64
|
+
w as handleChangeRequestHeader,
|
|
65
|
+
N as handleConfigureAuth,
|
|
66
|
+
C as handleGeneralError,
|
|
67
|
+
R as handleNetworkError
|
|
69
68
|
};
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { defineComponent as A, toRefs as I, reactive as z, ref as G, watch as ee, openBlock as s, createElementBlock as f, createVNode as E, unref as c, withCtx as V, createElementVNode as i, normalizeStyle as g, createTextVNode as L, toDisplayString as m, Fragment as C, renderList as k, createBlock as D } from "vue";
|
|
2
|
+
import { stylesUtils as le } from "../utils/style.js";
|
|
3
|
+
import { M2 as N } from "../utils/translate.js";
|
|
4
|
+
import R from "../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js";
|
|
5
|
+
import { ElPopover as oe, ElButton as U, ElCheckboxGroup as te, ElCheckbox as ue } from "element-plus";
|
|
6
|
+
import "element-plus/theme-chalk/src/base.scss";
|
|
7
|
+
import "element-plus/theme-chalk/src/button.scss";
|
|
8
|
+
import "element-plus/theme-chalk/src/checkbox.scss";
|
|
9
|
+
import "element-plus/theme-chalk/src/checkbox-group.scss";
|
|
10
|
+
import "element-plus/theme-chalk/src/popper.scss";
|
|
11
|
+
import "element-plus/theme-chalk/src/popover.scss";
|
|
12
|
+
const ae = { class: "yahee-country-platform-shop-condition" }, re = { class: "popover-table" }, ne = { id: "all" }, se = ["onClick"], ce = { id: "y" }, ie = ["onClick"], pe = { style: { display: "flex", "align-items": "center", outline: "none" } }, ke = /* @__PURE__ */ A({
|
|
13
|
+
name: "YaheeCountryPlatformShopCondition",
|
|
14
|
+
__name: "country-platform-shop-condition",
|
|
15
|
+
props: {
|
|
16
|
+
xyFilters: {},
|
|
17
|
+
filterKey: {}
|
|
18
|
+
},
|
|
19
|
+
emits: ["filterChange"],
|
|
20
|
+
setup(H, { emit: P }) {
|
|
21
|
+
const q = H, { filterKey: M, xyFilters: r } = I(q), Y = P, u = z({});
|
|
22
|
+
let w = z({});
|
|
23
|
+
const b = G({}), _ = G({}), y = G(!0), x = G({}), S = G({}), K = G();
|
|
24
|
+
r.value && (K.value = [...r.value.xGroup]);
|
|
25
|
+
function J(o, a) {
|
|
26
|
+
var e;
|
|
27
|
+
return (e = r.value) == null ? void 0 : e.items.filter((l) => l.xGroupValue === o && l.yGroupValue === a);
|
|
28
|
+
}
|
|
29
|
+
function F(o) {
|
|
30
|
+
var e;
|
|
31
|
+
const a = o.xGroupValue;
|
|
32
|
+
if (x.value[a]) {
|
|
33
|
+
for (const l in u)
|
|
34
|
+
l.startsWith(a) && delete u[l];
|
|
35
|
+
x.value[a] = !1;
|
|
36
|
+
} else {
|
|
37
|
+
for (const l of (e = r.value) == null ? void 0 : e.items)
|
|
38
|
+
if (l.xGroupValue === a) {
|
|
39
|
+
let t = u[`${l.xGroupValue}-${l.yGroupValue}`];
|
|
40
|
+
t ? (t.push(l.value), t = [...new Set(t)]) : t = [l.value], u[`${l.xGroupValue}-${l.yGroupValue}`] = t;
|
|
41
|
+
}
|
|
42
|
+
x.value[a] = !0;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const T = (o) => le.getBackgroundColor(o), Q = () => {
|
|
46
|
+
R.isEqual(w, u) || Y("filterChange", [
|
|
47
|
+
{
|
|
48
|
+
filterKey: M.value,
|
|
49
|
+
checkedValues: Object.values(Object.values(u)).flat()
|
|
50
|
+
}
|
|
51
|
+
]);
|
|
52
|
+
}, X = () => {
|
|
53
|
+
w = R.cloneDeep(u);
|
|
54
|
+
};
|
|
55
|
+
function j() {
|
|
56
|
+
if (y.value)
|
|
57
|
+
y.value = !1, Object.keys(u).forEach((o) => {
|
|
58
|
+
delete u[o];
|
|
59
|
+
});
|
|
60
|
+
else {
|
|
61
|
+
y.value = !0;
|
|
62
|
+
for (const o of r.value.items) {
|
|
63
|
+
let a = u[`${o.xGroupValue}-${o.yGroupValue}`];
|
|
64
|
+
a ? a.push(o.value) : a = [o.value], u[`${o.xGroupValue}-${o.yGroupValue}`] = a;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
console.log(u);
|
|
68
|
+
}
|
|
69
|
+
function Z(o) {
|
|
70
|
+
const a = o.yGroupValue;
|
|
71
|
+
if (S.value[a]) {
|
|
72
|
+
for (const e in u)
|
|
73
|
+
e.endsWith(a) && delete u[e];
|
|
74
|
+
S.value[a] = !1;
|
|
75
|
+
} else {
|
|
76
|
+
for (const e of r.value.items)
|
|
77
|
+
if (e.yGroupValue === a) {
|
|
78
|
+
let l = u[`${e.xGroupValue}-${e.yGroupValue}`];
|
|
79
|
+
l ? (l.push(e.value), l = [...new Set(l)]) : l = [e.value], u[`${e.xGroupValue}-${e.yGroupValue}`] = l;
|
|
80
|
+
}
|
|
81
|
+
S.value[a] = !0;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return ee(
|
|
85
|
+
u,
|
|
86
|
+
(o, a) => {
|
|
87
|
+
var p, B, O, W;
|
|
88
|
+
Object.keys(o).forEach((n) => {
|
|
89
|
+
Array.isArray(o[n]) && o[n].length === 0 && delete o[n];
|
|
90
|
+
}), console.log("新的数组:", o), console.log("旧的数组:", a);
|
|
91
|
+
const e = { backgroundColor: "#3366CC", color: "#fff", borderColor: "#3366CC" }, l = { backgroundColor: "#00bfff", borderColor: "#00bfff" }, t = {}, h = (p = r.value) == null ? void 0 : p.xGroup.length, v = (B = r.value) == null ? void 0 : B.yGroup.length;
|
|
92
|
+
(O = r.value) == null || O.xGroup.forEach((n) => {
|
|
93
|
+
let d = 0;
|
|
94
|
+
for (const $ in u)
|
|
95
|
+
$.startsWith(n.xGroupValue) && d++;
|
|
96
|
+
d === 0 ? b.value[n.xGroupValue] = t : d === v ? b.value[n.xGroupValue] = e : b.value[n.xGroupValue] = l;
|
|
97
|
+
}), (W = r.value) == null || W.yGroup.forEach((n) => {
|
|
98
|
+
let d = 0;
|
|
99
|
+
for (const $ in u)
|
|
100
|
+
$.endsWith(n.yGroupValue) && d++;
|
|
101
|
+
d === 0 ? _.value[n.yGroupValue] = t : d === h ? _.value[n.yGroupValue] = e : _.value[n.yGroupValue] = l;
|
|
102
|
+
}), y.value = Object.keys(o).length === h * v;
|
|
103
|
+
},
|
|
104
|
+
{ deep: !0 }
|
|
105
|
+
), (o, a) => (s(), f("div", ae, [
|
|
106
|
+
E(c(oe), {
|
|
107
|
+
placement: "bottom",
|
|
108
|
+
trigger: "hover",
|
|
109
|
+
width: "'auto'",
|
|
110
|
+
onHide: Q,
|
|
111
|
+
onShow: X
|
|
112
|
+
}, {
|
|
113
|
+
reference: V(() => [
|
|
114
|
+
i("div", pe, [
|
|
115
|
+
E(c(U), {
|
|
116
|
+
size: "small",
|
|
117
|
+
class: "el-button custom-total-button",
|
|
118
|
+
style: g(T(y.value)),
|
|
119
|
+
onClick: j
|
|
120
|
+
}, {
|
|
121
|
+
default: V(() => [
|
|
122
|
+
L(m(c(N)("全部")), 1)
|
|
123
|
+
]),
|
|
124
|
+
_: 1
|
|
125
|
+
}, 8, ["style"]),
|
|
126
|
+
(s(!0), f(C, null, k(K.value, (e) => (s(), D(c(U), {
|
|
127
|
+
key: e,
|
|
128
|
+
style: g(b.value[e.xGroupValue]),
|
|
129
|
+
class: "custom-button",
|
|
130
|
+
size: "small",
|
|
131
|
+
onClick: (l) => F(e)
|
|
132
|
+
}, {
|
|
133
|
+
default: V(() => [
|
|
134
|
+
L(m(c(N)(e.xGroupText)), 1)
|
|
135
|
+
]),
|
|
136
|
+
_: 2
|
|
137
|
+
}, 1032, ["style", "onClick"]))), 128))
|
|
138
|
+
])
|
|
139
|
+
]),
|
|
140
|
+
default: V(() => {
|
|
141
|
+
var e, l;
|
|
142
|
+
return [
|
|
143
|
+
i("table", re, [
|
|
144
|
+
i("thead", null, [
|
|
145
|
+
i("tr", null, [
|
|
146
|
+
i("th", ne, [
|
|
147
|
+
i("span", {
|
|
148
|
+
style: g(T(y.value)),
|
|
149
|
+
class: "el-button custom-button",
|
|
150
|
+
onClick: j
|
|
151
|
+
}, " 全部 ", 4)
|
|
152
|
+
]),
|
|
153
|
+
(s(!0), f(C, null, k((e = c(r)) == null ? void 0 : e.xGroup, (t) => (s(), f("th", {
|
|
154
|
+
id: "x",
|
|
155
|
+
key: t.xGroupValue
|
|
156
|
+
}, [
|
|
157
|
+
i("span", {
|
|
158
|
+
style: g({ ...b.value[t.xGroupValue], width: "100%" }),
|
|
159
|
+
class: "el-button custom-button",
|
|
160
|
+
onClick: (h) => F(t)
|
|
161
|
+
}, m(t.xGroupText), 13, se)
|
|
162
|
+
]))), 128))
|
|
163
|
+
])
|
|
164
|
+
]),
|
|
165
|
+
i("tbody", null, [
|
|
166
|
+
(s(!0), f(C, null, k((l = c(r)) == null ? void 0 : l.yGroup, (t) => {
|
|
167
|
+
var h;
|
|
168
|
+
return s(), f("tr", {
|
|
169
|
+
key: t.yGroupValue
|
|
170
|
+
}, [
|
|
171
|
+
i("th", ce, [
|
|
172
|
+
i("span", {
|
|
173
|
+
style: g({ ..._.value[t.yGroupValue], width: "100%" }),
|
|
174
|
+
class: "el-button custom-button",
|
|
175
|
+
onClick: (v) => Z(t)
|
|
176
|
+
}, m(t.yGroupText), 13, ie)
|
|
177
|
+
]),
|
|
178
|
+
(s(!0), f(C, null, k((h = c(r)) == null ? void 0 : h.xGroup, (v) => (s(), f("td", {
|
|
179
|
+
key: v.xGroupValue
|
|
180
|
+
}, [
|
|
181
|
+
E(c(te), {
|
|
182
|
+
modelValue: u[v.xGroupValue + "-" + t.yGroupValue],
|
|
183
|
+
"onUpdate:modelValue": (p) => u[v.xGroupValue + "-" + t.yGroupValue] = p
|
|
184
|
+
}, {
|
|
185
|
+
default: V(() => [
|
|
186
|
+
(s(!0), f(C, null, k(J(
|
|
187
|
+
v.xGroupValue,
|
|
188
|
+
t.yGroupValue
|
|
189
|
+
), (p) => (s(), D(c(ue), {
|
|
190
|
+
key: p.value,
|
|
191
|
+
border: "",
|
|
192
|
+
class: "el-button custom-button",
|
|
193
|
+
label: p.text,
|
|
194
|
+
value: p.value
|
|
195
|
+
}, {
|
|
196
|
+
default: V(() => [
|
|
197
|
+
L(m(p.text), 1)
|
|
198
|
+
]),
|
|
199
|
+
_: 2
|
|
200
|
+
}, 1032, ["label", "value"]))), 128))
|
|
201
|
+
]),
|
|
202
|
+
_: 2
|
|
203
|
+
}, 1032, ["modelValue", "onUpdate:modelValue"])
|
|
204
|
+
]))), 128))
|
|
205
|
+
]);
|
|
206
|
+
}), 128))
|
|
207
|
+
])
|
|
208
|
+
])
|
|
209
|
+
];
|
|
210
|
+
}),
|
|
211
|
+
_: 1
|
|
212
|
+
})
|
|
213
|
+
]));
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
export {
|
|
217
|
+
ke as default
|
|
218
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
.yahee-country-platform-shop-condition .popover-table {
|
|
2
|
+
width: auto;
|
|
3
|
+
border: 1px solid transparent;
|
|
4
|
+
border-collapse: separate;
|
|
5
|
+
}
|
|
6
|
+
.yahee-country-platform-shop-condition .popover-table tr,
|
|
7
|
+
.yahee-country-platform-shop-condition .popover-table td {
|
|
8
|
+
text-align: left;
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
min-height: 22px;
|
|
11
|
+
}
|
|
12
|
+
.yahee-country-platform-shop-condition .checkbox-group {
|
|
13
|
+
margin: 5px;
|
|
14
|
+
width: 100%;
|
|
15
|
+
}
|
|
16
|
+
.yahee-country-platform-shop-condition .popover-table th {
|
|
17
|
+
text-align: left;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
min-height: 22px;
|
|
20
|
+
border: 1px solid transparent;
|
|
21
|
+
}
|
|
22
|
+
.yahee-country-platform-shop-condition .popover-table td span {
|
|
23
|
+
display: block;
|
|
24
|
+
margin-bottom: 4px;
|
|
25
|
+
border: 1px solid transparent;
|
|
26
|
+
}
|
|
27
|
+
.yahee-country-platform-shop-condition .hover-trigger {
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
color: blue;
|
|
30
|
+
}
|
|
31
|
+
.yahee-country-platform-shop-condition .custom-total-button {
|
|
32
|
+
margin-right: 0;
|
|
33
|
+
padding: 1px 4px;
|
|
34
|
+
height: 22px;
|
|
35
|
+
}
|
|
36
|
+
.yahee-country-platform-shop-condition .custom-button {
|
|
37
|
+
width: 100%;
|
|
38
|
+
min-height: 22px;
|
|
39
|
+
min-width: 50px;
|
|
40
|
+
height: 22px;
|
|
41
|
+
margin: 3px;
|
|
42
|
+
}
|
|
43
|
+
.yahee-country-platform-shop-condition .custom-button.inner-el-button {
|
|
44
|
+
margin-top: 5px;
|
|
45
|
+
}
|
|
46
|
+
.yahee-country-platform-shop-condition ::v-deep(.el-checkbox-button__inner) {
|
|
47
|
+
width: 100%;
|
|
48
|
+
}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { defineComponent as ae, ref as x, reactive as V, toRefs as ce, watch as re, onMounted as ie, resolveComponent as w, openBlock as a, createElementBlock as v, createVNode as Y, normalizeStyle as j, withCtx as f, createTextVNode as y, toDisplayString as p, unref as r, createCommentVNode as S, createElementVNode as F, Fragment as _, renderList as K, createBlock as b } from "vue";
|
|
2
|
+
import s from "../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js";
|
|
3
|
+
import { Get as de } from "../api/server.js";
|
|
4
|
+
import { stylesUtils as M } from "../utils/style.js";
|
|
5
|
+
import { storage as H } from "../utils/storage.js";
|
|
6
|
+
import { M2 as k } from "../utils/translate.js";
|
|
7
|
+
const ve = { class: "yahee-drop-down-condition" }, fe = { key: 0 }, pe = { style: { display: "flex", "align-items": "center", outline: "none" } }, he = { key: 0 }, me = { style: { display: "flex", width: "auto", padding: "10px" } }, ge = ["onClick"], xe = { class: "scrollable-container" }, be = { key: 0 }, Ve = /* @__PURE__ */ ae({
|
|
8
|
+
name: "YaheeDropDownCondition",
|
|
9
|
+
__name: "drop-down-condition",
|
|
10
|
+
props: {
|
|
11
|
+
filterList: {},
|
|
12
|
+
totalCount: {},
|
|
13
|
+
level1Count: {},
|
|
14
|
+
level2Count: {},
|
|
15
|
+
filterKey: {},
|
|
16
|
+
enumEntity: {},
|
|
17
|
+
baseUrl: {},
|
|
18
|
+
noNeedRefreshNumFilterName: {}
|
|
19
|
+
},
|
|
20
|
+
emits: ["filterChange", "setNoNeedRefreshNumFilterName"],
|
|
21
|
+
setup(J, { emit: Q }) {
|
|
22
|
+
const X = x(), o = V({});
|
|
23
|
+
let O = V({});
|
|
24
|
+
const i = V({}), h = V({}), m = x(!0), C = J, T = Q, { filterKey: L, filterList: q, totalCount: N, level1Count: B, level2Count: U, noNeedRefreshNumFilterName: I } = ce(C), W = x(s.get(N, "value", 0)), A = x(s.get(B, "value", [])), R = x(s.get(U, "value", [])), d = x();
|
|
25
|
+
q.value && (d.value = [...q.value]);
|
|
26
|
+
function G(e) {
|
|
27
|
+
const { text: l, value: u } = e, n = o[l];
|
|
28
|
+
s.isNil(n) || s.isEmpty(n) ? o[l] = [u] : o[l] = [], h[l] = !h[l], h[l] ? (ne(l), i[l] = M.getBackgroundColor(!0), m.value = !1) : (se(l), i[e.text] = {}, m.value = !0), m.value = $(), z();
|
|
29
|
+
}
|
|
30
|
+
function $() {
|
|
31
|
+
const e = d.value.filter((n) => !s.isEmpty(n.subs)).flatMap((n) => n.subs).length, l = d.value.filter((n) => s.isEmpty(n.subs)).length;
|
|
32
|
+
return Object.values(o).map((n) => n.length).reduce((n, g) => n + g, 0) === e + l || s.isEmpty(Object.values(o).flat());
|
|
33
|
+
}
|
|
34
|
+
function Z(e) {
|
|
35
|
+
s.isEmpty(o[e.text]) ? (i[e.text] = {}, h[e.text] = !1) : o[e.text].length === s.get(e, "subs.length", 1) ? (i[e.text] = M.getBackgroundColor(!0), h[e.text] = !0) : i[e.text] = {
|
|
36
|
+
backgroundColor: "#0F7535",
|
|
37
|
+
color: "#fff",
|
|
38
|
+
borderColor: "#0F7535"
|
|
39
|
+
}, m.value = $(), z();
|
|
40
|
+
}
|
|
41
|
+
function ee() {
|
|
42
|
+
m.value = $(), z();
|
|
43
|
+
}
|
|
44
|
+
function z() {
|
|
45
|
+
T("setNoNeedRefreshNumFilterName", L.value);
|
|
46
|
+
}
|
|
47
|
+
function te() {
|
|
48
|
+
m.value = !0;
|
|
49
|
+
for (const e in i)
|
|
50
|
+
i[e] = {};
|
|
51
|
+
for (const e in o)
|
|
52
|
+
delete o[e];
|
|
53
|
+
for (const e in h)
|
|
54
|
+
delete h[e];
|
|
55
|
+
P();
|
|
56
|
+
}
|
|
57
|
+
const le = (e) => M.getBackgroundColor(e);
|
|
58
|
+
function oe(e) {
|
|
59
|
+
if (e)
|
|
60
|
+
O = s.cloneDeep(o);
|
|
61
|
+
else {
|
|
62
|
+
if (s.isEqual(O, o))
|
|
63
|
+
return;
|
|
64
|
+
P();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function P() {
|
|
68
|
+
T("filterChange", [
|
|
69
|
+
{
|
|
70
|
+
filterKey: L.value,
|
|
71
|
+
checkedValues: Object.values(o).flat()
|
|
72
|
+
}
|
|
73
|
+
]);
|
|
74
|
+
}
|
|
75
|
+
function ne(e) {
|
|
76
|
+
const l = d.value.find((u) => u.text === e);
|
|
77
|
+
l && l.subs && (o[e] = l.subs.map((u) => u.value));
|
|
78
|
+
}
|
|
79
|
+
function se(e) {
|
|
80
|
+
o[e] = [];
|
|
81
|
+
}
|
|
82
|
+
return re(
|
|
83
|
+
[() => N.value, () => B.value, () => U.value],
|
|
84
|
+
([e, l, u], [n, g, D]) => {
|
|
85
|
+
console.log(e, l, u), console.log(n, g, D), (!I.value || !s.eq(I.value, L.value)) && (W.value = N.value, A.value = B.value, R.value = U.value);
|
|
86
|
+
}
|
|
87
|
+
), ie(() => {
|
|
88
|
+
const e = `filter-key-${C.enumEntity}`, l = H.getWithExpireTime(e);
|
|
89
|
+
l ? d.value = l : de(`${C.baseUrl}/${C.enumEntity}`).then((u) => {
|
|
90
|
+
d.value = u.data, H.setWithExpireTime(e, d.value, 1200 * 1e3);
|
|
91
|
+
}).catch((u) => {
|
|
92
|
+
console.log(u);
|
|
93
|
+
});
|
|
94
|
+
}), (e, l) => {
|
|
95
|
+
const u = w("el-button"), n = w("el-checkbox"), g = w("el-checkbox-group"), D = w("el-dropdown");
|
|
96
|
+
return a(), v("div", ve, [
|
|
97
|
+
Y(u, {
|
|
98
|
+
size: "small",
|
|
99
|
+
class: "el-button custom-total-button",
|
|
100
|
+
style: j(le(m.value)),
|
|
101
|
+
onClick: te
|
|
102
|
+
}, {
|
|
103
|
+
default: f(() => [
|
|
104
|
+
y(p(r(k)("全部")) + " ", 1),
|
|
105
|
+
r(N) ? (a(), v("span", fe, "(" + p(W.value) + ")", 1)) : S("", !0)
|
|
106
|
+
]),
|
|
107
|
+
_: 1
|
|
108
|
+
}, 8, ["style"]),
|
|
109
|
+
Y(D, {
|
|
110
|
+
ref_key: "dropdown1",
|
|
111
|
+
ref: X,
|
|
112
|
+
onVisibleChange: oe
|
|
113
|
+
}, {
|
|
114
|
+
dropdown: f(() => [
|
|
115
|
+
F("div", me, [
|
|
116
|
+
(a(!0), v(_, null, K(d.value, (t) => (a(), b(g, {
|
|
117
|
+
key: t.value,
|
|
118
|
+
modelValue: o[t.text],
|
|
119
|
+
"onUpdate:modelValue": (c) => o[t.text] = c,
|
|
120
|
+
size: "small",
|
|
121
|
+
class: "checkbox-group inner-checkbox-group",
|
|
122
|
+
onChange: (c) => Z(t)
|
|
123
|
+
}, {
|
|
124
|
+
default: f(() => [
|
|
125
|
+
r(s).isNil(t.subs) ? (a(), b(n, {
|
|
126
|
+
key: 1,
|
|
127
|
+
value: t.value,
|
|
128
|
+
class: "checkbox custom-button",
|
|
129
|
+
border: ""
|
|
130
|
+
}, {
|
|
131
|
+
default: f(() => [
|
|
132
|
+
y(p(r(k)(t.text)), 1)
|
|
133
|
+
]),
|
|
134
|
+
_: 2
|
|
135
|
+
}, 1032, ["value"])) : (a(), v(_, { key: 0 }, [
|
|
136
|
+
F("span", {
|
|
137
|
+
class: "el-button custom-button el-button--small inner-el-button",
|
|
138
|
+
style: j(i[t.text]),
|
|
139
|
+
onClick: (c) => G(t)
|
|
140
|
+
}, p(r(k)(t.text)), 13, ge),
|
|
141
|
+
F("div", xe, [
|
|
142
|
+
(a(!0), v(_, null, K(t.subs, (c) => (a(), b(n, {
|
|
143
|
+
key: c.value,
|
|
144
|
+
class: "checkbox custom-button",
|
|
145
|
+
value: c.value,
|
|
146
|
+
border: ""
|
|
147
|
+
}, {
|
|
148
|
+
default: f(() => {
|
|
149
|
+
var E;
|
|
150
|
+
return [
|
|
151
|
+
y(p(r(k)(c.text)), 1),
|
|
152
|
+
r(s).isEmpty(R.value) ? S("", !0) : (a(), v("span", be, "(" + p((E = R.value.filter((ue) => ue.value == c.value)[0]) == null ? void 0 : E.count) + ")", 1))
|
|
153
|
+
];
|
|
154
|
+
}),
|
|
155
|
+
_: 2
|
|
156
|
+
}, 1032, ["value"]))), 128))
|
|
157
|
+
])
|
|
158
|
+
], 64))
|
|
159
|
+
]),
|
|
160
|
+
_: 2
|
|
161
|
+
}, 1032, ["modelValue", "onUpdate:modelValue", "onChange"]))), 128))
|
|
162
|
+
])
|
|
163
|
+
]),
|
|
164
|
+
default: f(() => [
|
|
165
|
+
F("div", pe, [
|
|
166
|
+
(a(!0), v(_, null, K(d.value, (t) => (a(), v(_, null, [
|
|
167
|
+
t.isCheckbox ? (a(), b(g, {
|
|
168
|
+
key: t.value,
|
|
169
|
+
modelValue: o[t.text],
|
|
170
|
+
"onUpdate:modelValue": (c) => o[t.text] = c,
|
|
171
|
+
class: "checkbox-group",
|
|
172
|
+
size: "small",
|
|
173
|
+
onChange: ee
|
|
174
|
+
}, {
|
|
175
|
+
default: f(() => [
|
|
176
|
+
t.isCheckbox ? (a(), b(n, {
|
|
177
|
+
key: 0,
|
|
178
|
+
class: "custom-button",
|
|
179
|
+
value: t.value,
|
|
180
|
+
border: ""
|
|
181
|
+
}, {
|
|
182
|
+
default: f(() => [
|
|
183
|
+
y(p(r(k)(t.text)), 1)
|
|
184
|
+
]),
|
|
185
|
+
_: 2
|
|
186
|
+
}, 1032, ["value"])) : S("", !0)
|
|
187
|
+
]),
|
|
188
|
+
_: 2
|
|
189
|
+
}, 1032, ["modelValue", "onUpdate:modelValue"])) : (a(), b(u, {
|
|
190
|
+
key: t.text,
|
|
191
|
+
style: j(i[t.text]),
|
|
192
|
+
class: "custom-button",
|
|
193
|
+
size: "small",
|
|
194
|
+
onClick: (c) => G(t)
|
|
195
|
+
}, {
|
|
196
|
+
default: f(() => {
|
|
197
|
+
var c;
|
|
198
|
+
return [
|
|
199
|
+
y(p(r(k)(t.text)), 1),
|
|
200
|
+
r(s).isEmpty(A.value) ? S("", !0) : (a(), v("span", he, "(" + p((c = A.value.filter((E) => E.value == t.value)[0]) == null ? void 0 : c.count) + ")", 1))
|
|
201
|
+
];
|
|
202
|
+
}),
|
|
203
|
+
_: 2
|
|
204
|
+
}, 1032, ["style", "onClick"]))
|
|
205
|
+
], 64))), 256))
|
|
206
|
+
])
|
|
207
|
+
]),
|
|
208
|
+
_: 1
|
|
209
|
+
}, 512)
|
|
210
|
+
]);
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
export {
|
|
215
|
+
Ve as default
|
|
216
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
.yahee-drop-down-condition {
|
|
3
|
+
/* 滚动槽 */
|
|
4
|
+
/* 滚动条滑块 */
|
|
5
|
+
}
|
|
6
|
+
.yahee-drop-down-condition .checkbox-group {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
}
|
|
10
|
+
.yahee-drop-down-condition .checkbox {
|
|
11
|
+
margin-top: 5px;
|
|
12
|
+
}
|
|
13
|
+
.yahee-drop-down-condition .custom-total-button {
|
|
14
|
+
margin-right: 0;
|
|
15
|
+
padding: 1px 4px;
|
|
16
|
+
height: 22px;
|
|
17
|
+
}
|
|
18
|
+
.yahee-drop-down-condition .custom-button {
|
|
19
|
+
margin-right: 0;
|
|
20
|
+
padding: 1px 4px;
|
|
21
|
+
min-height: 22px;
|
|
22
|
+
height: 22px;
|
|
23
|
+
margin-left: 5px;
|
|
24
|
+
}
|
|
25
|
+
.yahee-drop-down-condition .custom-button.inner-el-button {
|
|
26
|
+
margin-top: 5px;
|
|
27
|
+
}
|
|
28
|
+
.yahee-drop-down-condition .scrollable-container {
|
|
29
|
+
max-height: 700px;
|
|
30
|
+
overflow-y: auto;
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
}
|
|
34
|
+
.yahee-drop-down-condition .scrollable-container::-webkit-scrollbar {
|
|
35
|
+
width: 5px;
|
|
36
|
+
}
|
|
37
|
+
.yahee-drop-down-condition .scrollable-container::-webkit-scrollbar-track {
|
|
38
|
+
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
|
|
39
|
+
border-radius: 10px;
|
|
40
|
+
}
|
|
41
|
+
.yahee-drop-down-condition .scrollable-container::-webkit-scrollbar-thumb {
|
|
42
|
+
border-radius: 10px;
|
|
43
|
+
background: rgba(0, 0, 0, 0.1);
|
|
44
|
+
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.5);
|
|
45
|
+
}
|