china-mobile-international-custom-components 0.0.33 → 0.0.35

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.
@@ -0,0 +1,303 @@
1
+ import { w as B } from "./index.bCzIhWFw.js";
2
+ import { computed as u, createElementBlock as h, createCommentVNode as v, openBlock as i, Fragment as I, createElementVNode as E, toDisplayString as g, normalizeClass as M, createBlock as A, renderList as P, unref as y, withCtx as D, ref as C, watch as U, onMounted as z, createVNode as F, createTextVNode as _, nextTick as H } from "vue";
3
+ import { ElPopover as $, ElButton as O } from "element-plus";
4
+ import { _ as W } from "./_plugin-vue_export-helper.CHgC5LLL.js";
5
+ import '../assets/index3.css';const R = {
6
+ ALL: !0,
7
+ PARTIAL: !1
8
+ }, Y = [
9
+ {
10
+ value: R.ALL,
11
+ label: "全部成员"
12
+ },
13
+ {
14
+ value: R.PARTIAL,
15
+ label: "部分成员"
16
+ }
17
+ ], m = {
18
+ MEMBER: 1,
19
+ DEPARTMENT: 2
20
+ }, ne = {
21
+ label: "memberName",
22
+ children: "children",
23
+ value: "memberId"
24
+ }, S = {
25
+ one: 1,
26
+ two: 2
27
+ }, ae = {
28
+ UNPUBLISHED: 0,
29
+ // 未发布
30
+ UNDER_REVIEW: 1,
31
+ // 审核中
32
+ PUBLISHED: 2,
33
+ // 已发布
34
+ REJECTED: 3,
35
+ // 审核不通过
36
+ FAILED: 4
37
+ // 发布失败
38
+ }, q = {
39
+ key: 0,
40
+ class: "pd-l-16 text-dee0e3 pd-r-16"
41
+ }, G = { class: "fz-14 text-646a73 nowrap" }, J = { class: "tag-item nowrap fz-12 pd-l-8 pd-r-8 radius-4 bg-eaf0fe text-3271fe pointer" }, j = { class: "tag-list-popover overflow-y-auto flex gap-4 flex-wrap" }, K = {
42
+ __name: "TagList",
43
+ props: {
44
+ // 显示的标签
45
+ label: {
46
+ type: String,
47
+ required: !0
48
+ },
49
+ // 数据项列表
50
+ items: {
51
+ type: Array,
52
+ default: () => []
53
+ },
54
+ // 默认显示的数量
55
+ defaultShowCount: {
56
+ type: Number,
57
+ default: S.one
58
+ },
59
+ // 是否为只读模式
60
+ readonly: {
61
+ type: Boolean,
62
+ default: !1
63
+ }
64
+ },
65
+ setup(e) {
66
+ const t = e, n = u(() => t.readonly ? t.items : t.items.slice(0, t.defaultShowCount)), d = u(() => t.items.length > t.defaultShowCount), f = u(() => t.items.length - t.defaultShowCount), p = u(() => t.items.slice(t.defaultShowCount));
67
+ return (a, o) => e.items.length > 0 ? (i(), h(I, { key: 0 }, [
68
+ e.readonly ? v("", !0) : (i(), h("span", q, "|")),
69
+ E("span", G, g(e.label), 1),
70
+ E("div", {
71
+ class: M(["tag-list", { "flex items-center gap-4": !e.readonly }])
72
+ }, [
73
+ (i(!0), h(I, null, P(n.value, (s) => (i(), h("div", {
74
+ key: s.memberId,
75
+ class: M(["tag-item fz-12 pd-l-8 pd-r-8 radius-4 bg-eaf0fe text-3271fe nowrap", { "mg-r-4 mg-b-4": e.readonly }])
76
+ }, g(s.memberName), 3))), 128)),
77
+ !e.readonly && d.value ? (i(), A(y($), {
78
+ key: 0,
79
+ placement: "top",
80
+ trigger: "click",
81
+ width: "300",
82
+ "popper-class": "tag-list-popover-wrapper"
83
+ }, {
84
+ reference: D(() => [
85
+ E("span", J, " +" + g(f.value), 1)
86
+ ]),
87
+ default: D(() => [
88
+ E("div", j, [
89
+ (i(!0), h(I, null, P(p.value, (s) => (i(), h("span", {
90
+ key: s.memberId,
91
+ class: "tag-item nowrap fz-12 pd-l-8 pd-r-8 radius-4 bg-eaf0fe text-3271fe"
92
+ }, g(s.memberName), 1))), 128))
93
+ ])
94
+ ]),
95
+ _: 1
96
+ })) : v("", !0)
97
+ ], 2)
98
+ ], 64)) : v("", !0);
99
+ }
100
+ }, N = /* @__PURE__ */ W(K, [["__scopeId", "data-v-32a1fa42"]]), L = (e, t) => e?.filter(t) || [], w = (e, t) => L(e, (n) => n.memberType === t), x = (e, t) => {
101
+ if (e.children)
102
+ for (const n of e.children)
103
+ n.memberType === m.MEMBER ? t(n) : n.memberType === m.DEPARTMENT && x(n, t);
104
+ }, k = (e) => {
105
+ const t = [];
106
+ return x(e, (n) => t.push(n.memberId)), t;
107
+ };
108
+ function Q(e, t, n = !1) {
109
+ const d = u(() => {
110
+ if (!e.value) return [];
111
+ const a = [...e.value], o = w(
112
+ a,
113
+ m.DEPARTMENT
114
+ );
115
+ if (o.length > 0 && t.value && t.value.length > 0) {
116
+ const s = /* @__PURE__ */ new Set();
117
+ o.forEach((r) => {
118
+ const c = (b) => {
119
+ for (const T of b) {
120
+ if (T.memberType === m.DEPARTMENT && T.memberId === r.memberId)
121
+ return x(
122
+ T,
123
+ (V) => s.add(V)
124
+ ), !0;
125
+ if (T.children && c(T.children))
126
+ return !0;
127
+ }
128
+ return !1;
129
+ };
130
+ c(t.value);
131
+ });
132
+ const l = new Set(
133
+ w(a, m.MEMBER).map(
134
+ (r) => r.memberId
135
+ )
136
+ );
137
+ s.forEach((r) => {
138
+ l.has(r.memberId) || a.push(r);
139
+ });
140
+ }
141
+ return a;
142
+ }), f = u(() => {
143
+ if (n)
144
+ return w(
145
+ d.value,
146
+ m.MEMBER
147
+ );
148
+ {
149
+ const a = /* @__PURE__ */ new Set();
150
+ return p.value.forEach((o) => {
151
+ k(o).forEach((l) => a.add(l));
152
+ }), L(
153
+ d.value,
154
+ (o) => o.memberType === m.MEMBER && !a.has(o.memberId)
155
+ );
156
+ }
157
+ }), p = u(() => {
158
+ if (n)
159
+ return w(
160
+ d.value,
161
+ m.DEPARTMENT
162
+ );
163
+ {
164
+ const a = [], o = (l) => {
165
+ if (!l.children || l.children.length === 0) return !1;
166
+ const r = k(l);
167
+ return r.length === 0 ? !1 : r.every(
168
+ (c) => d.value.some(
169
+ (b) => b.memberType === m.MEMBER && b.memberId === c
170
+ )
171
+ );
172
+ }, s = (l, r = !1) => {
173
+ if (l.memberType === m.DEPARTMENT) {
174
+ const c = o(l);
175
+ if (c && !r) {
176
+ if (a.push({
177
+ memberId: l.memberId,
178
+ memberName: l.memberName,
179
+ memberType: m.DEPARTMENT,
180
+ children: l.children
181
+ }), l.children)
182
+ for (const b of l.children)
183
+ s(b, !0);
184
+ } else if (!c && l.children)
185
+ for (const b of l.children)
186
+ s(b, !1);
187
+ }
188
+ };
189
+ for (const l of t.value)
190
+ s(l, !1);
191
+ return a;
192
+ }
193
+ });
194
+ return {
195
+ selectedMembers: f,
196
+ selectedDepartments: p
197
+ };
198
+ }
199
+ const X = { class: "fz-14 text-1f2329" }, Z = {
200
+ __name: "layout",
201
+ props: {
202
+ // 当前选择的范围类型(是否全部可见)
203
+ allVisible: {
204
+ type: Boolean,
205
+ default: R.ALL
206
+ },
207
+ // 选中的项目列表(完整对象数组,由父组件根据ID从树中查找得到)
208
+ modelValue: {
209
+ type: Array,
210
+ default: () => []
211
+ },
212
+ // 完整的树形数据(用于判断部门成员是否全部选中)
213
+ treeList: {
214
+ type: Array,
215
+ default: () => []
216
+ },
217
+ // 是否为只读模式
218
+ readonly: {
219
+ type: Boolean,
220
+ default: !1
221
+ }
222
+ },
223
+ setup(e, { expose: t }) {
224
+ const n = C(null), d = () => {
225
+ n.value && H(() => {
226
+ n.value.scrollIntoView({
227
+ behavior: "smooth",
228
+ block: "center"
229
+ });
230
+ });
231
+ }, f = e, { selectedMembers: p, selectedDepartments: a } = Q(
232
+ u(() => f.modelValue),
233
+ u(() => f.treeList),
234
+ f.readonly
235
+ ), o = u(() => {
236
+ const l = p.value.length > 0, r = a.value.length > 0;
237
+ return l && !r || !l && r ? S.two : S.one;
238
+ }), s = u(() => [...p.value, ...a.value]);
239
+ return U(
240
+ () => [f.allVisible, f.modelValue],
241
+ () => {
242
+ d();
243
+ },
244
+ { immediate: !1, deep: !0 }
245
+ ), z(() => {
246
+ d();
247
+ }), t({
248
+ allSelectedItems: s
249
+ }), (l, r) => (i(), h("div", {
250
+ ref_key: "previewRef",
251
+ ref: n,
252
+ class: M(["available-range-preview w-full overflow-hidden", {
253
+ "flex items-center": !e.readonly
254
+ }])
255
+ }, [
256
+ e.readonly ? v("", !0) : (i(), h(I, { key: 0 }, [
257
+ r[2] || (r[2] = E("div", { class: "text-1f2329" }, "可用范围:", -1)),
258
+ E("span", X, g(y(Y).find((c) => c.value === e.allVisible)?.label), 1),
259
+ F(y(O), {
260
+ class: "mg-l-16",
261
+ type: "primary",
262
+ link: "",
263
+ onClick: r[0] || (r[0] = (c) => l.$emit("edit"))
264
+ }, {
265
+ default: D(() => [...r[1] || (r[1] = [
266
+ _(" 编辑 ", -1)
267
+ ])]),
268
+ _: 1
269
+ })
270
+ ], 64)),
271
+ e.allVisible === y(R).PARTIAL ? (i(), h("div", {
272
+ key: 1,
273
+ class: M(["flex-1 overflow-hidden", { "flex items-center": !e.readonly }])
274
+ }, [
275
+ y(p)?.length ? (i(), A(N, {
276
+ key: 0,
277
+ label: "成员:",
278
+ items: y(p),
279
+ "default-show-count": o.value,
280
+ readonly: e.readonly
281
+ }, null, 8, ["items", "default-show-count", "readonly"])) : v("", !0),
282
+ y(a)?.length ? (i(), A(N, {
283
+ key: 1,
284
+ label: "部门:",
285
+ items: y(a),
286
+ "default-show-count": o.value,
287
+ readonly: e.readonly
288
+ }, null, 8, ["items", "default-show-count", "readonly"])) : v("", !0)
289
+ ], 2)) : v("", !0)
290
+ ], 2));
291
+ }
292
+ }, se = B(Z), oe = B(N);
293
+ export {
294
+ se as A,
295
+ S as D,
296
+ m as M,
297
+ ae as P,
298
+ R,
299
+ oe as T,
300
+ ne as a,
301
+ Y as r,
302
+ Q as u
303
+ };
@@ -0,0 +1,254 @@
1
+ import { w as U } from "./index.bCzIhWFw.js";
2
+ import { ref as r, computed as w, createBlock as _, openBlock as V, unref as m, withCtx as g, createElementVNode as P, createVNode as R, createElementBlock as k, createCommentVNode as x, Fragment as M, renderList as $, createTextVNode as E, toDisplayString as G, getCurrentInstance as O, watch as D, onMounted as F } from "vue";
3
+ import { emitsMap as a } from "color-star-custom-methods";
4
+ import { R as S, u as j, r as q, a as H, A as Y } from "./index.CSPp4g5C.js";
5
+ import { ElDialog as z, ElRadioGroup as J, ElRadio as K, ElButton as N } from "element-plus";
6
+ import { TreeShowSelect as Q } from "color-star-custom-components";
7
+ import '../assets/index2.css';const W = { class: "dialog-content" }, X = {
8
+ key: 0,
9
+ class: "selection-area overflow-hidden"
10
+ }, Z = { class: "dialog-footer" }, ee = {
11
+ __name: "Dialog",
12
+ props: {
13
+ // 弹窗显示控制
14
+ visible: {
15
+ type: Boolean,
16
+ default: !1
17
+ },
18
+ // 当前选择的范围类型(是否全部可见)
19
+ allVisible: {
20
+ type: Boolean,
21
+ default: S.ALL
22
+ },
23
+ // 选中的项目列表
24
+ modelValue: {
25
+ type: Array,
26
+ default: () => []
27
+ },
28
+ // 树形数据
29
+ treeList: {
30
+ type: Array,
31
+ default: () => []
32
+ }
33
+ },
34
+ emits: [
35
+ a.updateVisible,
36
+ a.save,
37
+ a.cancel
38
+ ],
39
+ setup(p, { emit: y }) {
40
+ const b = p, v = y, L = r(!0), c = r(b.allVisible), t = r([...b.modelValue]), h = r(), { selectedMembers: A, selectedDepartments: u } = j(
41
+ t,
42
+ w(() => b.treeList),
43
+ !1
44
+ // 编辑模式
45
+ ), s = w(() => {
46
+ const i = [];
47
+ return u.value.forEach((e) => {
48
+ i.push({
49
+ ...e,
50
+ // TreeSelect列表模式不需要children
51
+ children: void 0
52
+ });
53
+ }), A.value.forEach((e) => {
54
+ i.push({
55
+ ...e,
56
+ children: void 0
57
+ });
58
+ }), i;
59
+ }), f = (i) => {
60
+ c.value = i, i === S.ALL && (t.value = []);
61
+ }, T = (i) => {
62
+ const { selectedNode: e } = i;
63
+ t.value = e || [];
64
+ }, I = () => {
65
+ v(a.cancel), v(a.updateVisible, !1);
66
+ }, C = () => {
67
+ v(a.save, {
68
+ type: c.value,
69
+ selectedItems: [...t.value]
70
+ }), v(a.updateVisible, !1);
71
+ };
72
+ return (i, e) => (V(), _(m(z), {
73
+ modelValue: L.value,
74
+ "onUpdate:modelValue": e[2] || (e[2] = (o) => L.value = o),
75
+ title: "可用范围设置",
76
+ "close-on-click-modal": !1,
77
+ "close-on-press-escape": !1,
78
+ "append-to-body": "",
79
+ onClose: I,
80
+ "modal-class": "available-range-setting-dialog"
81
+ }, {
82
+ footer: g(() => [
83
+ P("div", Z, [
84
+ R(m(N), {
85
+ onClick: I,
86
+ plain: ""
87
+ }, {
88
+ default: g(() => [...e[3] || (e[3] = [
89
+ E("取消", -1)
90
+ ])]),
91
+ _: 1
92
+ }),
93
+ R(m(N), {
94
+ type: "primary",
95
+ onClick: C
96
+ }, {
97
+ default: g(() => [...e[4] || (e[4] = [
98
+ E("保存", -1)
99
+ ])]),
100
+ _: 1
101
+ })
102
+ ])
103
+ ]),
104
+ default: g(() => [
105
+ P("div", W, [
106
+ R(m(J), {
107
+ class: "pd-b-16",
108
+ modelValue: c.value,
109
+ "onUpdate:modelValue": e[0] || (e[0] = (o) => c.value = o),
110
+ onChange: f
111
+ }, {
112
+ default: g(() => [
113
+ (V(!0), k(M, null, $(m(q), (o) => (V(), _(m(K), {
114
+ key: o.value,
115
+ value: o.value
116
+ }, {
117
+ default: g(() => [
118
+ E(G(o.label), 1)
119
+ ]),
120
+ _: 2
121
+ }, 1032, ["value"]))), 128))
122
+ ]),
123
+ _: 1
124
+ }, 8, ["modelValue"]),
125
+ c.value === m(S).PARTIAL ? (V(), k("div", X, [
126
+ R(m(Q), {
127
+ modelValue: t.value,
128
+ "onUpdate:modelValue": e[1] || (e[1] = (o) => t.value = o),
129
+ ref_key: "treeRef",
130
+ ref: h,
131
+ treeProps: m(H),
132
+ treeList: p.treeList,
133
+ hasFilter: !0,
134
+ rightTreeList: s.value,
135
+ style: { height: "500px" },
136
+ onGetCheckedNode: T
137
+ }, null, 8, ["modelValue", "treeProps", "treeList", "rightTreeList"])
138
+ ])) : x("", !0)
139
+ ])
140
+ ]),
141
+ _: 1
142
+ }, 8, ["modelValue"]));
143
+ }
144
+ }, le = () => O().appContext.config.globalProperties, ae = () => {
145
+ const { $request: p, $env: y } = le();
146
+ return {
147
+ availableRangeApi: () => p({
148
+ url: `${y.VITE_APP_AUTH_BASE_URL}/api/v1/admin/member/search`,
149
+ method: "get"
150
+ })
151
+ };
152
+ }, te = { class: "available-range-setting w-full" }, se = /* @__PURE__ */ Object.assign({
153
+ name: "AvailableRangeSetting"
154
+ }, {
155
+ __name: "layout",
156
+ props: {
157
+ // 当前选择的范围类型(是否全部可见)
158
+ allVisible: {
159
+ type: Boolean,
160
+ default: S.ALL
161
+ },
162
+ // 选中的项目列表
163
+ modelValue: {
164
+ type: Array,
165
+ default: () => []
166
+ }
167
+ },
168
+ emits: [
169
+ a.updateAllVisible,
170
+ a.updateModelValue,
171
+ a.change
172
+ ],
173
+ setup(p, { expose: y, emit: b }) {
174
+ const v = p, { availableRangeApi: L } = ae(), c = b, t = r(!1), h = r(!1), A = r([]), u = r(v.allVisible), s = r(v.modelValue), f = r(
175
+ new Set(s.value?.map((l) => l.memberId))
176
+ ), T = () => {
177
+ h.value = !0, L().then((l) => {
178
+ A.value = l?.data?.orgOptionSoList || [];
179
+ }).finally(() => {
180
+ h.value = !1;
181
+ });
182
+ }, I = () => {
183
+ t.value = !0;
184
+ }, C = (l) => {
185
+ u.value = l.type, s.value = l.selectedItems, f.value.clear(), s.value.forEach((n) => {
186
+ f.value.add(n.memberId);
187
+ }), c(a.updateAllVisible, u.value), c(a.updateModelValue, s.value), e();
188
+ }, i = () => {
189
+ t.value = !1;
190
+ }, e = () => {
191
+ const l = {
192
+ allVisible: u.value,
193
+ selectedItems: s.value
194
+ };
195
+ c(a.change, l);
196
+ }, o = r(null), B = () => {
197
+ const l = o.value?.allSelectedItems || [];
198
+ return {
199
+ allVisible: u.value,
200
+ visibleScope: l.map((d) => ({
201
+ memberId: d.memberId,
202
+ memberName: d.memberName,
203
+ memberType: d.memberType,
204
+ bnid: d.bnid
205
+ }))
206
+ };
207
+ };
208
+ return D(
209
+ () => v.allVisible,
210
+ (l) => {
211
+ u.value = l;
212
+ },
213
+ { immediate: !0 }
214
+ ), D(
215
+ () => v.modelValue,
216
+ (l) => {
217
+ s.value = l || [], f.value.clear(), s.value.forEach((n) => {
218
+ f.value.add(n.memberId);
219
+ });
220
+ },
221
+ { immediate: !0 }
222
+ ), F(() => {
223
+ T();
224
+ }), y({
225
+ getSelectedItems: B
226
+ }), (l, n) => (V(), k("div", te, [
227
+ R(m(Y), {
228
+ allVisible: u.value,
229
+ "model-value": s.value,
230
+ "tree-list": A.value,
231
+ onEdit: I,
232
+ ref_key: "previewRef",
233
+ ref: o
234
+ }, null, 8, ["allVisible", "model-value", "tree-list"]),
235
+ t.value ? (V(), _(ee, {
236
+ key: 0,
237
+ visible: t.value,
238
+ "onUpdate:visible": n[0] || (n[0] = (d) => t.value = d),
239
+ allVisible: u.value,
240
+ "onUpdate:allVisible": n[1] || (n[1] = (d) => u.value = d),
241
+ modelValue: s.value,
242
+ "onUpdate:modelValue": n[2] || (n[2] = (d) => s.value = d),
243
+ "tree-list": A.value,
244
+ loading: h.value,
245
+ onSave: C,
246
+ onCancel: i
247
+ }, null, 8, ["visible", "allVisible", "modelValue", "tree-list", "loading"])) : x("", !0)
248
+ ]));
249
+ }
250
+ }), me = U(se);
251
+ export {
252
+ me as A,
253
+ le as g
254
+ };