@guodun/antdv 1.4.4 → 1.4.5
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/dist/es/components/contract-signing-location/src/ContractSigningLocation.vue.mjs +85 -85
- package/dist/es/components/dept-selector/src/dept.mjs +170 -142
- package/dist/es/components/index.mjs +1 -0
- package/dist/es/components/pro-contract-template-designer/index.mjs +1 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.mjs +372 -185
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.mjs +59 -42
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateRendererField.vue.mjs +218 -85
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.mjs +5 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.vue.mjs +97 -0
- package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.mjs +914 -853
- package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.mjs +550 -245
- package/dist/es/components/pro-contract-template-designer/src/composables/use-template-designer.mjs +214 -139
- package/dist/es/components/pro-contract-template-designer/src/extensions/template-variable.mjs +53 -35
- package/dist/es/components/pro-contract-template-designer/src/types.mjs +15 -2
- package/dist/es/components/pro-contract-template-designer/src/utils/advanced-controls.mjs +91 -0
- package/dist/es/components/pro-contract-template-designer/src/utils/template-renderer.mjs +96 -65
- package/dist/es/components/pro-contract-template-designer/src/utils/template-tool-icons.mjs +23 -16
- package/dist/es/components/pro-contract-template-designer/style/index.css +1 -1
- package/dist/es/components/pro-selector/src/components/org-tree.mjs +130 -89
- package/dist/es/components/pro-selector/src/components/user.mjs +34 -26
- package/dist/es/components/pro-selector/src/pro-user.mjs +86 -72
- package/dist/es/components/pro-selector/src/types.mjs +4 -1
- package/dist/es/components/pro-selector/src/utils/orgTree.mjs +5 -2
- package/dist/es/components/pro-selector-group/src/compoents/dept-tree.vue.mjs +92 -65
- package/dist/es/components/pro-selector-group/src/compoents/dept.vue.mjs +3 -3
- package/dist/es/components/pro-selector-group/src/compoents/role.vue.mjs +98 -73
- package/dist/es/components/pro-selector-group/src/compoents/select-box.vue.mjs +12 -9
- package/dist/es/components/pro-selector-group/src/compoents/user.vue.mjs +101 -72
- package/dist/es/components/pro-selector-group/src/hooks/useApi.mjs +39 -22
- package/dist/es/components/pro-selector-group/src/index.vue.mjs +105 -83
- package/dist/es/components/pro-selector-group/src/utils/index.mjs +36 -0
- package/dist/es/components/role-selector/src/role.mjs +134 -120
- package/dist/es/index.mjs +50 -49
- package/dist/lib/components/contract-signing-location/src/ContractSigningLocation.vue.cjs +1 -1
- package/dist/lib/components/dept-selector/src/dept.cjs +1 -1
- package/dist/lib/components/index.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/index.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.cjs +2 -1
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateRendererField.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.vue.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/composables/use-template-designer.cjs +4 -4
- package/dist/lib/components/pro-contract-template-designer/src/extensions/template-variable.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/types.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/utils/advanced-controls.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/utils/template-renderer.cjs +3 -3
- package/dist/lib/components/pro-contract-template-designer/src/utils/template-tool-icons.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/style/index.css +1 -1
- package/dist/lib/components/pro-selector/src/components/org-tree.cjs +1 -1
- package/dist/lib/components/pro-selector/src/components/user.cjs +1 -1
- package/dist/lib/components/pro-selector/src/pro-user.cjs +1 -1
- package/dist/lib/components/pro-selector/src/types.cjs +1 -1
- package/dist/lib/components/pro-selector/src/utils/orgTree.cjs +1 -1
- package/dist/lib/components/pro-selector-group/src/compoents/dept-tree.vue.cjs +1 -1
- package/dist/lib/components/pro-selector-group/src/compoents/dept.vue.cjs +1 -1
- package/dist/lib/components/pro-selector-group/src/compoents/role.vue.cjs +1 -1
- package/dist/lib/components/pro-selector-group/src/compoents/select-box.vue.cjs +1 -1
- package/dist/lib/components/pro-selector-group/src/compoents/user.vue.cjs +1 -1
- package/dist/lib/components/pro-selector-group/src/hooks/useApi.cjs +1 -1
- package/dist/lib/components/pro-selector-group/src/index.vue.cjs +1 -1
- package/dist/lib/components/pro-selector-group/src/utils/index.cjs +1 -0
- package/dist/lib/components/role-selector/src/role.cjs +1 -1
- package/dist/lib/index.cjs +1 -1
- package/dist/theme/dept-selector.css +1 -1
- package/dist/theme/icon.css +1 -1
- package/dist/theme/index.css +1 -1
- package/dist/theme/pro-selector-group.css +1 -1
- package/dist/theme/pro-selector.css +1 -1
- package/dist/theme/role-selector.css +1 -1
- package/dist/types/components/contract-signing-location/src/ContractSigningLocation.vue.d.ts +3 -3
- package/dist/types/components/pro-contract-template-designer/index.d.ts +1 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.d.ts +1 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.d.ts +3 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateRendererField.vue.d.ts +7 -1
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.vue.d.ts +14 -0
- package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.d.ts +13 -1
- package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.d.ts +11 -1
- package/dist/types/components/pro-contract-template-designer/src/composables/use-template-designer.d.ts +4 -0
- package/dist/types/components/pro-contract-template-designer/src/extensions/template-variable.d.ts +11 -1
- package/dist/types/components/pro-contract-template-designer/src/types.d.ts +131 -2
- package/dist/types/components/pro-contract-template-designer/src/utils/advanced-controls.d.ts +15 -0
- package/dist/types/components/pro-contract-template-designer/src/utils/template-renderer.d.ts +10 -2
- package/dist/types/components/pro-selector/index.d.ts +9 -0
- package/dist/types/components/pro-selector/src/components/user.d.ts +9 -0
- package/dist/types/components/pro-selector/src/types.d.ts +2 -0
- package/dist/types/components/pro-selector/src/utils/orgTree.d.ts +4 -1
- package/dist/types/components/pro-selector-group/src/compoents/select-box.vue.d.ts +4 -4
- package/dist/types/components/pro-selector-group/src/hooks/useApi.d.ts +6 -1
- package/dist/types/components/pro-selector-group/src/utils/index.d.ts +8 -0
- package/package.json +3 -1
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { useNamespace as e } from "../../../hooks/use-namespace/index.mjs";
|
|
2
|
-
import t from "../../pro-modal/
|
|
3
|
-
import
|
|
4
|
-
import r from "./
|
|
5
|
-
import i from "./compoents/
|
|
6
|
-
import a from "./compoents/
|
|
7
|
-
import o from "./compoents/
|
|
8
|
-
import s from "
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
2
|
+
import t from "../../pro-modal/src/ProModal.mjs";
|
|
3
|
+
import n from "../../pro-dynamic-tags/src/index.mjs";
|
|
4
|
+
import { selectContextKey as r } from "./types.mjs";
|
|
5
|
+
import i from "./compoents/dept.mjs";
|
|
6
|
+
import a from "./compoents/role.mjs";
|
|
7
|
+
import o from "./compoents/user.mjs";
|
|
8
|
+
import s from "./compoents/select-box.mjs";
|
|
9
|
+
import { normalizeSelectorOptions as c, removeSelectorOption as l, replaceSelectorOptionsForType as u } from "./utils/index.mjs";
|
|
10
|
+
import { Fragment as d, computed as f, createBlock as p, createCommentVNode as m, createElementBlock as h, createElementVNode as g, createVNode as _, defineComponent as v, mergeModels as y, nextTick as b, normalizeClass as x, normalizeStyle as S, openBlock as C, provide as w, ref as T, renderList as E, resolveDynamicComponent as D, unref as O, useModel as k, watch as A, withCtx as j } from "vue";
|
|
11
|
+
import { TabPane as M, Tabs as N } from "ant-design-vue";
|
|
11
12
|
//#region src/components/pro-selector-group/src/index.vue?vue&type=script&setup=true&lang.ts
|
|
12
|
-
var
|
|
13
|
+
var P = { key: 0 }, F = /* @__PURE__ */ v({
|
|
13
14
|
__name: "index",
|
|
14
|
-
props: /* @__PURE__ */
|
|
15
|
+
props: /* @__PURE__ */ y({
|
|
15
16
|
title: { default: "选择器" },
|
|
16
17
|
http: {},
|
|
17
18
|
urlPrefix: {},
|
|
@@ -37,121 +38,142 @@ var M = { key: 0 }, N = /* @__PURE__ */ h({
|
|
|
37
38
|
},
|
|
38
39
|
visibleModifiers: {}
|
|
39
40
|
}),
|
|
40
|
-
emits: /* @__PURE__ */
|
|
41
|
-
setup(
|
|
42
|
-
let
|
|
41
|
+
emits: /* @__PURE__ */ y(["confirm", "changeTab"], ["update:modelValue", "update:visible"]),
|
|
42
|
+
setup(v, { emit: y }) {
|
|
43
|
+
let F = v, I = y, L = [
|
|
43
44
|
{
|
|
44
45
|
key: "dept",
|
|
45
46
|
tab: "部门",
|
|
46
|
-
component:
|
|
47
|
+
component: i
|
|
47
48
|
},
|
|
48
49
|
{
|
|
49
50
|
key: "role",
|
|
50
51
|
tab: "角色",
|
|
51
|
-
component:
|
|
52
|
+
component: a
|
|
52
53
|
},
|
|
53
54
|
{
|
|
54
55
|
key: "user",
|
|
55
56
|
tab: "用户",
|
|
56
|
-
component:
|
|
57
|
+
component: o
|
|
57
58
|
}
|
|
58
|
-
],
|
|
59
|
+
], R = k(v, "modelValue"), z = k(v, "visible"), B = T([]), V = T(F.type || "dept"), H = T({}), U = f(() => R.value.map((e) => ({
|
|
59
60
|
label: e.label || "",
|
|
60
61
|
value: e.value,
|
|
61
62
|
type: e.type
|
|
62
|
-
}))),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
}))), W = f(() => F.isSingle ? L.filter((e) => e.key === F.type) : L);
|
|
64
|
+
A(() => F.type, (e) => {
|
|
65
|
+
e && (V.value = e);
|
|
66
|
+
}), A(z, async (e) => {
|
|
67
|
+
if (!e) {
|
|
68
|
+
B.value = c(R.value);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
B.value = c(R.value), await Q();
|
|
72
|
+
}, { immediate: !0 }), A(() => R.value, async (e) => {
|
|
73
|
+
z.value || (B.value = c(e)), z.value && await Q();
|
|
74
|
+
}, { deep: !0 });
|
|
75
|
+
async function G() {
|
|
76
|
+
await b();
|
|
77
|
+
let e = H.value[V.value];
|
|
78
|
+
e && typeof e.echo == "function" && e.echo(B.value.filter((e) => e.type === V.value));
|
|
79
|
+
}
|
|
80
|
+
function K(e) {
|
|
81
|
+
let t = V.value;
|
|
82
|
+
B.value = F.isSingle ? c(e).map((e) => ({
|
|
83
|
+
...e,
|
|
84
|
+
type: t
|
|
85
|
+
})) : u(B.value, t, e);
|
|
70
86
|
}
|
|
71
|
-
|
|
72
|
-
http:
|
|
73
|
-
urlPrefix:
|
|
74
|
-
selectedData:
|
|
75
|
-
currentTabKey:
|
|
76
|
-
changeSelectData:
|
|
87
|
+
w(r, {
|
|
88
|
+
http: F.http,
|
|
89
|
+
urlPrefix: F.urlPrefix || "",
|
|
90
|
+
selectedData: B,
|
|
91
|
+
currentTabKey: V,
|
|
92
|
+
changeSelectData: K
|
|
77
93
|
});
|
|
78
|
-
let { b:
|
|
79
|
-
function
|
|
80
|
-
e && (
|
|
94
|
+
let { b: q } = e("pro-selector-group");
|
|
95
|
+
function J(e, t) {
|
|
96
|
+
e && (H.value[t] = e);
|
|
81
97
|
}
|
|
82
|
-
let
|
|
83
|
-
function
|
|
84
|
-
|
|
98
|
+
let Y = f(() => ({ width: V.value === "user" ? "600px" : "450px" }));
|
|
99
|
+
function X() {
|
|
100
|
+
R.value = c(B.value), I("confirm"), z.value = !1;
|
|
85
101
|
}
|
|
86
|
-
function
|
|
87
|
-
|
|
102
|
+
function Z() {
|
|
103
|
+
z.value = !1;
|
|
88
104
|
}
|
|
89
|
-
function
|
|
90
|
-
|
|
91
|
-
|
|
105
|
+
async function Q() {
|
|
106
|
+
await b(), Object.entries(H.value).forEach(([e, t]) => {
|
|
107
|
+
t && typeof t.echo == "function" && t.echo(B.value.filter((t) => t.type === e));
|
|
108
|
+
});
|
|
92
109
|
}
|
|
93
|
-
function
|
|
94
|
-
|
|
110
|
+
function $(e) {
|
|
111
|
+
let t = H.value[e.type || V.value];
|
|
112
|
+
t && typeof t.delFn == "function" && t.delFn(e.value), B.value = l(B.value, e.value, e.type);
|
|
95
113
|
}
|
|
96
|
-
function
|
|
97
|
-
|
|
98
|
-
t && typeof t.delFn == "function" && t.delFn(e);
|
|
114
|
+
async function ee() {
|
|
115
|
+
I("changeTab", V.value), await G();
|
|
99
116
|
}
|
|
100
|
-
function
|
|
101
|
-
let t =
|
|
102
|
-
|
|
117
|
+
function te(e) {
|
|
118
|
+
let t = /* @__PURE__ */ new Map();
|
|
119
|
+
e.forEach((e) => {
|
|
120
|
+
let n = e.type;
|
|
121
|
+
n && t.set(n, [...t.get(n) || [], e.value]);
|
|
122
|
+
}), t.forEach((e, t) => {
|
|
123
|
+
H.value[t]?.deleteAll?.(e);
|
|
124
|
+
}), B.value = [];
|
|
103
125
|
}
|
|
104
|
-
function
|
|
105
|
-
|
|
126
|
+
async function ne() {
|
|
127
|
+
z.value = !0, await Q();
|
|
106
128
|
}
|
|
107
|
-
function
|
|
108
|
-
let t =
|
|
129
|
+
function re(e) {
|
|
130
|
+
let t = R.value.findIndex((t) => t.value === e.value && t.type === e.type);
|
|
109
131
|
if (t > -1) {
|
|
110
|
-
let e =
|
|
111
|
-
|
|
132
|
+
let e = R.value[t];
|
|
133
|
+
R.value = l(R.value, e.value, e.type), B.value = c(R.value), $(e);
|
|
112
134
|
}
|
|
113
135
|
}
|
|
114
|
-
return (e,
|
|
115
|
-
"model-value":
|
|
136
|
+
return (e, r) => (C(), h("div", { class: x(O(q)()) }, [v.hideSlot ? m("", !0) : (C(), h("div", P, [_(n, {
|
|
137
|
+
"model-value": U.value,
|
|
116
138
|
"add-text": "添加",
|
|
117
|
-
onAdd:
|
|
118
|
-
onClose:
|
|
119
|
-
}, null, 8, ["model-value"])])),
|
|
120
|
-
modelValue:
|
|
121
|
-
"onUpdate:modelValue":
|
|
122
|
-
title:
|
|
139
|
+
onAdd: ne,
|
|
140
|
+
onClose: re
|
|
141
|
+
}, null, 8, ["model-value"])])), _(t, {
|
|
142
|
+
modelValue: z.value,
|
|
143
|
+
"onUpdate:modelValue": r[2] ||= (e) => z.value = e,
|
|
144
|
+
title: v.title,
|
|
123
145
|
width: "950px",
|
|
124
|
-
onOnConfirm:
|
|
125
|
-
onOnCancel:
|
|
146
|
+
onOnConfirm: X,
|
|
147
|
+
onOnCancel: Z
|
|
126
148
|
}, {
|
|
127
|
-
default:
|
|
128
|
-
class:
|
|
129
|
-
style:
|
|
130
|
-
}, [
|
|
131
|
-
"active-key":
|
|
132
|
-
"onUpdate:activeKey":
|
|
133
|
-
onChange:
|
|
149
|
+
default: j(() => [g("div", { class: x(O(q)("content")) }, [g("div", {
|
|
150
|
+
class: x(O(q)("left")),
|
|
151
|
+
style: S(Y.value)
|
|
152
|
+
}, [_(O(N), {
|
|
153
|
+
"active-key": V.value,
|
|
154
|
+
"onUpdate:activeKey": r[0] ||= (e) => V.value = e,
|
|
155
|
+
onChange: ee
|
|
134
156
|
}, {
|
|
135
|
-
default:
|
|
157
|
+
default: j(() => [(C(!0), h(d, null, E(W.value, (e) => (C(), p(O(M), {
|
|
136
158
|
key: e.key,
|
|
137
159
|
tab: e.tab
|
|
138
160
|
}, {
|
|
139
|
-
default:
|
|
161
|
+
default: j(() => [(C(), p(D(e.component), {
|
|
140
162
|
ref_for: !0,
|
|
141
|
-
ref: (t) =>
|
|
163
|
+
ref: (t) => J(t, e.key)
|
|
142
164
|
}, null, 512))]),
|
|
143
165
|
_: 2
|
|
144
166
|
}, 1032, ["tab"]))), 128))]),
|
|
145
167
|
_: 1
|
|
146
|
-
}, 8, ["active-key"])], 6),
|
|
147
|
-
modelValue:
|
|
148
|
-
"onUpdate:modelValue":
|
|
149
|
-
onDelete:
|
|
150
|
-
onDeleteAll:
|
|
168
|
+
}, 8, ["active-key"])], 6), g("div", { class: x(O(q)("right")) }, [_(s, {
|
|
169
|
+
modelValue: B.value,
|
|
170
|
+
"onUpdate:modelValue": r[1] ||= (e) => B.value = e,
|
|
171
|
+
onDelete: $,
|
|
172
|
+
onDeleteAll: te
|
|
151
173
|
}, null, 8, ["modelValue"])], 2)], 2)]),
|
|
152
174
|
_: 1
|
|
153
175
|
}, 8, ["modelValue", "title"])], 2));
|
|
154
176
|
}
|
|
155
177
|
});
|
|
156
178
|
//#endregion
|
|
157
|
-
export {
|
|
179
|
+
export { F as default };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
//#region src/components/pro-selector-group/src/utils/index.ts
|
|
2
|
+
function e(t) {
|
|
3
|
+
return t.map((t) => ({
|
|
4
|
+
key: t.id,
|
|
5
|
+
title: t.deptName,
|
|
6
|
+
...t,
|
|
7
|
+
children: e(t.children || [])
|
|
8
|
+
}));
|
|
9
|
+
}
|
|
10
|
+
function t(e) {
|
|
11
|
+
if (!Array.isArray(e)) return [];
|
|
12
|
+
let t = /* @__PURE__ */ new Set();
|
|
13
|
+
return e.flatMap((e) => {
|
|
14
|
+
if (!e || typeof e != "object") return [];
|
|
15
|
+
let n = e;
|
|
16
|
+
if (typeof n.value != "string" || !n.value) return [];
|
|
17
|
+
let r = `${n.type || ""}:${n.value}`;
|
|
18
|
+
return t.has(r) ? [] : (t.add(r), [{
|
|
19
|
+
label: typeof n.label == "string" ? n.label : "",
|
|
20
|
+
value: n.value,
|
|
21
|
+
type: n.type
|
|
22
|
+
}]);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function n(e, n, r) {
|
|
26
|
+
let i = t(r).map((e) => ({
|
|
27
|
+
...e,
|
|
28
|
+
type: n || e.type
|
|
29
|
+
}));
|
|
30
|
+
return [...e.filter((e) => e.type !== n), ...i];
|
|
31
|
+
}
|
|
32
|
+
function r(e, t, n) {
|
|
33
|
+
return e.filter((e) => !(e.value === t && (!n || e.type === n)));
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { t as normalizeSelectorOptions, r as removeSelectorOption, n as replaceSelectorOptionsForType };
|
|
@@ -3,169 +3,181 @@ import t from "../../pro-modal/index.mjs";
|
|
|
3
3
|
import n from "../../icon/index.mjs";
|
|
4
4
|
import { GTE_OPTIONS_URL as r, roleSelectorEmits as i, roleSelectorProps as a } from "./types.mjs";
|
|
5
5
|
import o from "../../pro-dynamic-tags/index.mjs";
|
|
6
|
-
import { computed as s,
|
|
7
|
-
import { Checkbox as
|
|
6
|
+
import { computed as s, createTextVNode as c, createVNode as l, defineComponent as u, isVNode as d, mergeProps as f, onMounted as p, ref as m, watch as h } from "vue";
|
|
7
|
+
import { Alert as g, Button as _, Checkbox as v, CheckboxGroup as y, Empty as b, FormItemRest as x, InputSearch as S, Radio as C, RadioGroup as w, Spin as T, message as E } from "ant-design-vue";
|
|
8
8
|
//#region src/components/role-selector/src/role.tsx
|
|
9
|
-
function
|
|
10
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !
|
|
9
|
+
function D(e) {
|
|
10
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !d(e);
|
|
11
11
|
}
|
|
12
|
-
var
|
|
12
|
+
var O = e("role-selector"), k = /* @__PURE__ */ u({
|
|
13
13
|
name: "KRoleSelector",
|
|
14
14
|
props: a,
|
|
15
15
|
emits: i,
|
|
16
|
-
setup(e, { emit: i, attrs: a, slots:
|
|
17
|
-
let
|
|
16
|
+
setup(e, { emit: i, attrs: a, slots: u }) {
|
|
17
|
+
let d = m([]), k = m(""), A = m([]), j = m([]), M = m([]), N = m(""), P = m(e.options || []), F = m(!1), I = m(!1), L = m(""), R = (t) => t.filter((e) => e.enable !== !1).map((t) => ({
|
|
18
18
|
label: t.roleName,
|
|
19
19
|
value: t[e.valueField]
|
|
20
|
-
})),
|
|
21
|
-
let e =
|
|
22
|
-
e ?
|
|
23
|
-
},
|
|
24
|
-
if (!(!e.isBuiltInRequest ||
|
|
20
|
+
})), z = () => {
|
|
21
|
+
let e = k.value.trim();
|
|
22
|
+
e ? A.value = P.value.filter((t) => t.label?.includes(e) || t.value?.includes(e)) : A.value = [...P.value];
|
|
23
|
+
}, B = async () => {
|
|
24
|
+
if (!(!e.isBuiltInRequest || I.value)) {
|
|
25
25
|
if (!e.http) throw Error("请传入http实例");
|
|
26
|
-
|
|
26
|
+
F.value = !0, L.value = "";
|
|
27
27
|
try {
|
|
28
28
|
let t = await e.http.get(`${e.prefix}${r}`);
|
|
29
|
-
t.status === 0
|
|
30
|
-
} catch
|
|
31
|
-
|
|
29
|
+
t.status === 0 ? (P.value = R(Array.isArray(t.data) ? t.data : []), z(), I.value = !0, M.value = G(M.value), W(), V()) : L.value = "角色数据加载失败,请重试";
|
|
30
|
+
} catch {
|
|
31
|
+
L.value = "角色数据加载失败,请重试";
|
|
32
32
|
} finally {
|
|
33
|
-
|
|
33
|
+
F.value = !1;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
|
|
38
|
-
e.isBuiltInRequest &&
|
|
37
|
+
p(() => {
|
|
38
|
+
e.isBuiltInRequest && B();
|
|
39
39
|
});
|
|
40
|
-
let
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
}, z = () => {
|
|
40
|
+
let V = () => {
|
|
41
|
+
N.value = "";
|
|
42
|
+
let e = [];
|
|
43
|
+
P.value.forEach((t) => {
|
|
44
|
+
Array.isArray(d.value) ? d.value.includes(t.value) && e.push(t.label) : d.value === t.value && e.push(t.label);
|
|
45
|
+
}), N.value = e.join(",");
|
|
46
|
+
}, H = () => {
|
|
49
47
|
let e = [];
|
|
50
|
-
if (Array.isArray(
|
|
51
|
-
let n =
|
|
48
|
+
if (Array.isArray(d.value)) d.value.forEach((t) => {
|
|
49
|
+
let n = P.value.find((e) => e.value === t);
|
|
52
50
|
n && e.push(n);
|
|
53
51
|
});
|
|
54
52
|
else {
|
|
55
|
-
let t =
|
|
53
|
+
let t = P.value.find((e) => e.value === d.value);
|
|
56
54
|
t && e.push(t);
|
|
57
55
|
}
|
|
58
|
-
|
|
59
|
-
},
|
|
60
|
-
Array.isArray(e.modelValue) ?
|
|
61
|
-
},
|
|
62
|
-
let t =
|
|
56
|
+
j.value = e;
|
|
57
|
+
}, U = (e) => typeof e == "object" && !!e && "value" in e && e.value !== void 0 && e.value !== null, W = () => {
|
|
58
|
+
Array.isArray(e.modelValue) ? d.value = e.modelValue.map((e) => e.value) : e.type === "radio" ? U(e.modelValue) ? d.value = e.modelValue.value : d.value = "" : d.value = e.modelValue?.value || "";
|
|
59
|
+
}, G = (e) => e.length ? P.value.length === 0 ? e : e.map((e) => {
|
|
60
|
+
let t = P.value.find((t) => t.value === e.value);
|
|
63
61
|
return t ? {
|
|
64
62
|
...e,
|
|
65
63
|
label: t.label
|
|
66
64
|
} : e;
|
|
67
65
|
}) : [];
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
let t = [];
|
|
75
|
-
Array.isArray(e) ? t = [...e] : B(e) && (t = [e]), k.value = H(t);
|
|
76
|
-
}
|
|
66
|
+
h(() => e.visible, (e) => {
|
|
67
|
+
W(), e && H();
|
|
68
|
+
}), h(() => e.modelValue, (e) => {
|
|
69
|
+
W(), P.value.length > 0 && V();
|
|
70
|
+
let t = [];
|
|
71
|
+
Array.isArray(e) ? t = [...e] : U(e) && (t = [e]), M.value = G(t);
|
|
77
72
|
}, {
|
|
78
73
|
deep: !0,
|
|
79
74
|
immediate: !0
|
|
80
|
-
}),
|
|
81
|
-
e.isBuiltInRequest || (
|
|
75
|
+
}), h(() => e.options, (t) => {
|
|
76
|
+
e.isBuiltInRequest || (P.value = t || [], A.value = t || [], M.value = G(M.value), V(), H());
|
|
82
77
|
}, {
|
|
83
78
|
deep: !0,
|
|
84
79
|
immediate: !0
|
|
85
|
-
}),
|
|
86
|
-
|
|
80
|
+
}), h(d, () => {
|
|
81
|
+
H();
|
|
87
82
|
}, {
|
|
88
83
|
deep: !0,
|
|
89
84
|
immediate: !0
|
|
90
|
-
}),
|
|
91
|
-
|
|
85
|
+
}), h(k, () => {
|
|
86
|
+
z();
|
|
92
87
|
});
|
|
93
|
-
let
|
|
94
|
-
i("update:visible", !1), i("cancel");
|
|
95
|
-
},
|
|
96
|
-
if (e.type === "radio" && !
|
|
97
|
-
|
|
88
|
+
let K = () => {
|
|
89
|
+
W(), H(), i("update:visible", !1), i("cancel");
|
|
90
|
+
}, q = () => {
|
|
91
|
+
if (e.type === "radio" && !d.value) {
|
|
92
|
+
E.warn("请选择角色");
|
|
98
93
|
return;
|
|
99
94
|
}
|
|
100
|
-
if (Array.isArray(
|
|
101
|
-
|
|
95
|
+
if (Array.isArray(d.value) && d.value.length === 0) {
|
|
96
|
+
E.warn("请选择角色");
|
|
102
97
|
return;
|
|
103
98
|
}
|
|
104
|
-
|
|
105
|
-
},
|
|
106
|
-
Array.isArray(
|
|
107
|
-
},
|
|
99
|
+
M.value = [...j.value], Array.isArray(d.value) ? (N.value = j.value.map((e) => e.label).join(","), i("update:modelValue", j.value)) : (N.value = j.value[0]?.label || "", i("update:modelValue", j.value[0] || null)), i("update:visible", !1), i("confirm", j.value);
|
|
100
|
+
}, J = (e) => {
|
|
101
|
+
Array.isArray(d.value) ? d.value = d.value.filter((t) => t !== e.value) : d.value = "";
|
|
102
|
+
}, Y = s(() => M.value.map((e) => ({
|
|
108
103
|
label: e.label,
|
|
109
104
|
value: e.value,
|
|
110
105
|
closable: !0
|
|
111
|
-
}))),
|
|
112
|
-
let n =
|
|
113
|
-
if (n) if (
|
|
114
|
-
let e =
|
|
115
|
-
|
|
116
|
-
} else
|
|
117
|
-
},
|
|
106
|
+
}))), X = (e, t) => {
|
|
107
|
+
let n = M.value[t];
|
|
108
|
+
if (n) if (M.value = M.value.filter((e, n) => n !== t), J(n), Array.isArray(d.value)) {
|
|
109
|
+
let e = M.value;
|
|
110
|
+
N.value = e.map((e) => e.label).join(","), i("update:modelValue", e);
|
|
111
|
+
} else N.value = M.value[0]?.label || "", i("update:modelValue", M.value[0] || null);
|
|
112
|
+
}, Z = () => {
|
|
118
113
|
i("update:visible", !0);
|
|
119
|
-
},
|
|
114
|
+
}, Q = (e, t) => l("div", { class: [O.e("role-item"), t && O.is("active")] }, [l("div", { class: O.e("role-item-label") }, [l(n, {
|
|
120
115
|
name: "a-jiaoseguanli2",
|
|
121
116
|
size: 18,
|
|
122
117
|
color: "var(--gdant-neutral-600)"
|
|
123
|
-
}, null),
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
118
|
+
}, null), l("span", { class: O.e("label") }, [e.label], 2)], 2), l("div", { class: O.e("role-item-del") }, [t && l("button", {
|
|
119
|
+
type: "button",
|
|
120
|
+
"aria-label": `移除${e.label || "角色"}`,
|
|
121
|
+
onClick: () => J(e)
|
|
122
|
+
}, [l(n, {
|
|
127
123
|
name: "shanchu",
|
|
128
|
-
size:
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
124
|
+
size: 16
|
|
125
|
+
}, null)], 8, ["aria-label", "onClick"])], 2)], 2), $ = () => l("div", { class: O.b("left") }, [
|
|
126
|
+
l(S, {
|
|
127
|
+
allowClear: !0,
|
|
128
|
+
placeholder: "搜索角色",
|
|
129
|
+
value: k.value,
|
|
130
|
+
"onUpdate:value": (e) => k.value = e
|
|
131
|
+
}, null, 8, [
|
|
132
|
+
"allowClear",
|
|
133
|
+
"value",
|
|
134
|
+
"onUpdate:value"
|
|
135
|
+
]),
|
|
136
|
+
L.value && l(g, {
|
|
137
|
+
class: O.e("feedback"),
|
|
138
|
+
type: "error",
|
|
139
|
+
showIcon: !0,
|
|
140
|
+
message: L.value
|
|
141
|
+
}, { action: () => l(_, {
|
|
142
|
+
type: "link",
|
|
143
|
+
size: "small",
|
|
144
|
+
onClick: B
|
|
145
|
+
}, { default: () => [c("重试")] }, 8, ["onClick"]) }, 8, [
|
|
146
|
+
"class",
|
|
147
|
+
"showIcon",
|
|
148
|
+
"message"
|
|
149
|
+
]),
|
|
150
|
+
l(T, { spinning: F.value }, { default: () => [l("div", { class: O.e("role-list") }, [!F.value && !L.value && A.value.length === 0 && l(b, {
|
|
151
|
+
description: "暂无角色",
|
|
152
|
+
image: b.PRESENTED_IMAGE_SIMPLE
|
|
153
|
+
}, null, 8, ["image"]), e.type === "radio" ? l(w, {
|
|
154
|
+
value: d.value,
|
|
155
|
+
"onUpdate:value": (e) => d.value = e
|
|
156
|
+
}, { default: () => [l("div", { style: "width: 100%;" }, [A.value.map((e) => {
|
|
157
|
+
let t;
|
|
158
|
+
return l("div", { key: e.value }, [l(C, { value: e.value }, D(t = Q(e)) ? t : {
|
|
159
|
+
default: () => [t],
|
|
160
|
+
_: 1
|
|
161
|
+
}, 8, ["value"])]);
|
|
162
|
+
})])] }, 8, ["value", "onUpdate:value"]) : l(y, {
|
|
163
|
+
value: d.value,
|
|
164
|
+
"onUpdate:value": (e) => d.value = e
|
|
165
|
+
}, { default: () => [l("div", { style: "width: 100%;" }, [A.value.map((e) => {
|
|
166
|
+
let t;
|
|
167
|
+
return l("div", { key: e.value }, [l(v, { value: e.value }, D(t = Q(e)) ? t : {
|
|
168
|
+
default: () => [t],
|
|
169
|
+
_: 1
|
|
170
|
+
}, 8, ["value"])]);
|
|
171
|
+
})])] }, 8, ["value", "onUpdate:value"])], 2)] }, 8, ["spinning"])
|
|
172
|
+
], 2), ee = () => l("div", { class: O.b("right") }, [j.value.map((e) => l("div", { key: e.value }, [Q(e, !0)])), j.value.length === 0 && l(b, {
|
|
140
173
|
description: "暂无数据",
|
|
141
|
-
image:
|
|
142
|
-
}, null, 8, ["image"]),
|
|
143
|
-
value: u.value,
|
|
144
|
-
"onUpdate:value": (e) => u.value = e
|
|
145
|
-
}, { default: () => [c("div", { style: "width: 100%;" }, [D.value.map((e) => {
|
|
146
|
-
let t;
|
|
147
|
-
return c("div", { key: e.value }, [c(b, { value: e.value }, w(t = Y(e)) ? t : {
|
|
148
|
-
default: () => [t],
|
|
149
|
-
_: 1
|
|
150
|
-
}, 8, ["value"])]);
|
|
151
|
-
})])] }, 8, ["value", "onUpdate:value"]) : c(g, {
|
|
152
|
-
value: u.value,
|
|
153
|
-
"onUpdate:value": (e) => u.value = e
|
|
154
|
-
}, { default: () => [c("div", { style: "width: 100%;" }, [D.value.map((e) => {
|
|
155
|
-
let t;
|
|
156
|
-
return c("div", { key: e.value }, [c(h, { value: e.value }, w(t = Y(e)) ? t : {
|
|
157
|
-
default: () => [t],
|
|
158
|
-
_: 1
|
|
159
|
-
}, 8, ["value"])]);
|
|
160
|
-
})])] }, 8, ["value", "onUpdate:value"])], 2)] }, 8, ["spinning"])], 2), Z = () => c("div", { class: T.b("right") }, [O.value.map((e) => c("div", { key: e.value }, [Y(e, !0)])), O.value.length === 0 && c(_, {
|
|
161
|
-
description: "暂无数据",
|
|
162
|
-
image: _.PRESENTED_IMAGE_SIMPLE
|
|
163
|
-
}, null, 8, ["image"])], 2), Q = () => {
|
|
174
|
+
image: b.PRESENTED_IMAGE_SIMPLE
|
|
175
|
+
}, null, 8, ["image"])], 2), te = () => {
|
|
164
176
|
let n = {
|
|
165
|
-
onOnCancel:
|
|
166
|
-
onOnConfirm:
|
|
177
|
+
onOnCancel: K,
|
|
178
|
+
onOnConfirm: q
|
|
167
179
|
};
|
|
168
|
-
return
|
|
180
|
+
return l("div", null, [l(t, f({
|
|
169
181
|
modelValue: e.visible,
|
|
170
182
|
title: "选择角色",
|
|
171
183
|
modalProps: {
|
|
@@ -174,20 +186,22 @@ var T = e("role-selector"), E = /* @__PURE__ */ l({
|
|
|
174
186
|
width: "700px",
|
|
175
187
|
...a
|
|
176
188
|
},
|
|
177
|
-
"onUpdate:modelValue": (e) =>
|
|
178
|
-
|
|
189
|
+
"onUpdate:modelValue": (e) => {
|
|
190
|
+
e || (W(), H()), i("update:visible", e);
|
|
191
|
+
}
|
|
192
|
+
}, n), { default: () => [l("div", { class: O.b("modal") }, [$(), ee()], 2)] }, 16, [
|
|
179
193
|
"modelValue",
|
|
180
194
|
"modalProps",
|
|
181
195
|
"onUpdate:modelValue"
|
|
182
196
|
])]);
|
|
183
197
|
};
|
|
184
|
-
return () =>
|
|
185
|
-
modelValue:
|
|
198
|
+
return () => l(x, null, { default: () => [l("div", { class: O.b() }, [e.hideSlot ? null : u.default ? u.default() : l(o, {
|
|
199
|
+
modelValue: Y.value,
|
|
186
200
|
showAdd: !0,
|
|
187
201
|
addText: "选择角色",
|
|
188
202
|
closable: !0,
|
|
189
|
-
onClose:
|
|
190
|
-
onAdd:
|
|
203
|
+
onClose: X,
|
|
204
|
+
onAdd: Z,
|
|
191
205
|
customStyle: {
|
|
192
206
|
width: "100%",
|
|
193
207
|
minHeight: "30px"
|
|
@@ -196,8 +210,8 @@ var T = e("role-selector"), E = /* @__PURE__ */ l({
|
|
|
196
210
|
"modelValue",
|
|
197
211
|
"onClose",
|
|
198
212
|
"onAdd"
|
|
199
|
-
]),
|
|
213
|
+
]), te()], 2)] });
|
|
200
214
|
}
|
|
201
215
|
});
|
|
202
216
|
//#endregion
|
|
203
|
-
export {
|
|
217
|
+
export { k as default };
|