@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.
Files changed (93) hide show
  1. package/dist/es/components/contract-signing-location/src/ContractSigningLocation.vue.mjs +85 -85
  2. package/dist/es/components/dept-selector/src/dept.mjs +170 -142
  3. package/dist/es/components/index.mjs +1 -0
  4. package/dist/es/components/pro-contract-template-designer/index.mjs +1 -0
  5. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.mjs +372 -185
  6. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.mjs +59 -42
  7. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateRendererField.vue.mjs +218 -85
  8. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.mjs +5 -0
  9. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.vue.mjs +97 -0
  10. package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.mjs +914 -853
  11. package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.mjs +550 -245
  12. package/dist/es/components/pro-contract-template-designer/src/composables/use-template-designer.mjs +214 -139
  13. package/dist/es/components/pro-contract-template-designer/src/extensions/template-variable.mjs +53 -35
  14. package/dist/es/components/pro-contract-template-designer/src/types.mjs +15 -2
  15. package/dist/es/components/pro-contract-template-designer/src/utils/advanced-controls.mjs +91 -0
  16. package/dist/es/components/pro-contract-template-designer/src/utils/template-renderer.mjs +96 -65
  17. package/dist/es/components/pro-contract-template-designer/src/utils/template-tool-icons.mjs +23 -16
  18. package/dist/es/components/pro-contract-template-designer/style/index.css +1 -1
  19. package/dist/es/components/pro-selector/src/components/org-tree.mjs +130 -89
  20. package/dist/es/components/pro-selector/src/components/user.mjs +34 -26
  21. package/dist/es/components/pro-selector/src/pro-user.mjs +86 -72
  22. package/dist/es/components/pro-selector/src/types.mjs +4 -1
  23. package/dist/es/components/pro-selector/src/utils/orgTree.mjs +5 -2
  24. package/dist/es/components/pro-selector-group/src/compoents/dept-tree.vue.mjs +92 -65
  25. package/dist/es/components/pro-selector-group/src/compoents/dept.vue.mjs +3 -3
  26. package/dist/es/components/pro-selector-group/src/compoents/role.vue.mjs +98 -73
  27. package/dist/es/components/pro-selector-group/src/compoents/select-box.vue.mjs +12 -9
  28. package/dist/es/components/pro-selector-group/src/compoents/user.vue.mjs +101 -72
  29. package/dist/es/components/pro-selector-group/src/hooks/useApi.mjs +39 -22
  30. package/dist/es/components/pro-selector-group/src/index.vue.mjs +105 -83
  31. package/dist/es/components/pro-selector-group/src/utils/index.mjs +36 -0
  32. package/dist/es/components/role-selector/src/role.mjs +134 -120
  33. package/dist/es/index.mjs +50 -49
  34. package/dist/lib/components/contract-signing-location/src/ContractSigningLocation.vue.cjs +1 -1
  35. package/dist/lib/components/dept-selector/src/dept.cjs +1 -1
  36. package/dist/lib/components/index.cjs +1 -1
  37. package/dist/lib/components/pro-contract-template-designer/index.cjs +1 -1
  38. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.cjs +2 -1
  39. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.cjs +1 -1
  40. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateRendererField.vue.cjs +1 -1
  41. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.cjs +1 -0
  42. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.vue.cjs +1 -0
  43. package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.cjs +1 -1
  44. package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.cjs +1 -1
  45. package/dist/lib/components/pro-contract-template-designer/src/composables/use-template-designer.cjs +4 -4
  46. package/dist/lib/components/pro-contract-template-designer/src/extensions/template-variable.cjs +1 -1
  47. package/dist/lib/components/pro-contract-template-designer/src/types.cjs +1 -1
  48. package/dist/lib/components/pro-contract-template-designer/src/utils/advanced-controls.cjs +1 -0
  49. package/dist/lib/components/pro-contract-template-designer/src/utils/template-renderer.cjs +3 -3
  50. package/dist/lib/components/pro-contract-template-designer/src/utils/template-tool-icons.cjs +1 -1
  51. package/dist/lib/components/pro-contract-template-designer/style/index.css +1 -1
  52. package/dist/lib/components/pro-selector/src/components/org-tree.cjs +1 -1
  53. package/dist/lib/components/pro-selector/src/components/user.cjs +1 -1
  54. package/dist/lib/components/pro-selector/src/pro-user.cjs +1 -1
  55. package/dist/lib/components/pro-selector/src/types.cjs +1 -1
  56. package/dist/lib/components/pro-selector/src/utils/orgTree.cjs +1 -1
  57. package/dist/lib/components/pro-selector-group/src/compoents/dept-tree.vue.cjs +1 -1
  58. package/dist/lib/components/pro-selector-group/src/compoents/dept.vue.cjs +1 -1
  59. package/dist/lib/components/pro-selector-group/src/compoents/role.vue.cjs +1 -1
  60. package/dist/lib/components/pro-selector-group/src/compoents/select-box.vue.cjs +1 -1
  61. package/dist/lib/components/pro-selector-group/src/compoents/user.vue.cjs +1 -1
  62. package/dist/lib/components/pro-selector-group/src/hooks/useApi.cjs +1 -1
  63. package/dist/lib/components/pro-selector-group/src/index.vue.cjs +1 -1
  64. package/dist/lib/components/pro-selector-group/src/utils/index.cjs +1 -0
  65. package/dist/lib/components/role-selector/src/role.cjs +1 -1
  66. package/dist/lib/index.cjs +1 -1
  67. package/dist/theme/dept-selector.css +1 -1
  68. package/dist/theme/icon.css +1 -1
  69. package/dist/theme/index.css +1 -1
  70. package/dist/theme/pro-selector-group.css +1 -1
  71. package/dist/theme/pro-selector.css +1 -1
  72. package/dist/theme/role-selector.css +1 -1
  73. package/dist/types/components/contract-signing-location/src/ContractSigningLocation.vue.d.ts +3 -3
  74. package/dist/types/components/pro-contract-template-designer/index.d.ts +1 -0
  75. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.d.ts +1 -0
  76. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.d.ts +3 -0
  77. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateRendererField.vue.d.ts +7 -1
  78. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.vue.d.ts +14 -0
  79. package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.d.ts +13 -1
  80. package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.d.ts +11 -1
  81. package/dist/types/components/pro-contract-template-designer/src/composables/use-template-designer.d.ts +4 -0
  82. package/dist/types/components/pro-contract-template-designer/src/extensions/template-variable.d.ts +11 -1
  83. package/dist/types/components/pro-contract-template-designer/src/types.d.ts +131 -2
  84. package/dist/types/components/pro-contract-template-designer/src/utils/advanced-controls.d.ts +15 -0
  85. package/dist/types/components/pro-contract-template-designer/src/utils/template-renderer.d.ts +10 -2
  86. package/dist/types/components/pro-selector/index.d.ts +9 -0
  87. package/dist/types/components/pro-selector/src/components/user.d.ts +9 -0
  88. package/dist/types/components/pro-selector/src/types.d.ts +2 -0
  89. package/dist/types/components/pro-selector/src/utils/orgTree.d.ts +4 -1
  90. package/dist/types/components/pro-selector-group/src/compoents/select-box.vue.d.ts +4 -4
  91. package/dist/types/components/pro-selector-group/src/hooks/useApi.d.ts +6 -1
  92. package/dist/types/components/pro-selector-group/src/utils/index.d.ts +8 -0
  93. package/package.json +3 -1
@@ -1,114 +1,116 @@
1
1
  import { useNamespace as e } from "../../../hooks/use-namespace/index.mjs";
2
2
  import t from "../../pro-modal/index.mjs";
3
3
  import n from "../../icon/index.mjs";
4
- import { UserSelectorProps as r, selectUserContextKey as i, userSelectorEmits as a } from "./types.mjs";
5
- import o from "./components/user.mjs";
6
- import s from "./components/org-tree.mjs";
7
- import c from "../../pro-user-avatar/index.mjs";
8
- import { createTextVNode as l, createVNode as u, defineComponent as d, nextTick as f, provide as p, reactive as m, ref as h, watch as g } from "vue";
9
- import { Empty as _, FormItemRest as v, Input as y, message as b } from "ant-design-vue";
4
+ import { UserSelectorProps as r, resolveUserSelectorMaxCount as i, selectUserContextKey as a, userSelectorEmits as o } from "./types.mjs";
5
+ import s from "./components/user.mjs";
6
+ import c from "./components/org-tree.mjs";
7
+ import l from "../../pro-user-avatar/index.mjs";
8
+ import { createTextVNode as u, createVNode as d, defineComponent as f, nextTick as p, provide as m, reactive as h, ref as g, watch as _ } from "vue";
9
+ import { Empty as v, FormItemRest as y, Input as b, message as x } from "ant-design-vue";
10
10
  //#region src/components/pro-selector/src/pro-user.tsx
11
- var { b: x } = e("pro-user-selector"), S = e("user-selector-extermal"), C = /* @__PURE__ */ d({
11
+ var { b: S } = e("pro-user-selector"), C = e("user-selector-extermal"), w = /* @__PURE__ */ f({
12
12
  name: "ProUserSelector",
13
13
  props: r,
14
- emits: a,
15
- setup(e, { emit: r, slots: a, expose: d, attrs: C }) {
16
- let w = h(""), T = h([]), E = h(), D = h(null);
17
- p(i, m({
18
- maxCount: e.maxCount,
14
+ emits: o,
15
+ setup(e, { emit: r, slots: o, expose: f, attrs: w }) {
16
+ let T = g(""), E = g([]), D = g(), O = g(null);
17
+ m(a, h({
18
+ maxCount: i(e.type, e.maxCount),
19
19
  http: e.http,
20
20
  isBuiltInRequest: e.isBuiltInRequest,
21
21
  prefix: e.prefix,
22
- initData: e.initData
22
+ initData: e.initData,
23
+ type: e.type
23
24
  }));
24
- let O = h(e.modelValue || []), k = h(!1);
25
- g(() => e.modelValue, (e) => {
26
- console.log("watch 触发了...", k.value), k.value ? k.value = !1 : (O.value = JSON.parse(JSON.stringify(e)), f(() => {
27
- A(O.value);
28
- }));
25
+ let k = g(e.modelValue || []);
26
+ _(() => e.modelValue, (e) => {
27
+ k.value = Array.isArray(e) ? e.map((e) => ({ ...e })) : [], p(() => A(k.value));
29
28
  }, {
30
29
  deep: !0,
31
30
  immediate: !0
32
- }), g(T, (e, t) => {
33
- e.length > t.length && f(() => {
34
- D.value && (D.value.scrollTop = D.value.scrollHeight);
31
+ }), _(() => e.visible, (t) => {
32
+ t && (k.value = e.modelValue.map((e) => ({ ...e })), p(() => A(k.value)));
33
+ }), _(E, (e, t) => {
34
+ e.length > t.length && p(() => {
35
+ O.value && (O.value.scrollTop = O.value.scrollHeight);
35
36
  });
36
37
  }, { deep: !0 });
37
38
  async function A(e) {
38
- if (await f(), !E.value) {
39
- console.warn("OrgTree 组件还未就绪,跳过初始化");
40
- return;
41
- }
42
- let t = await E.value.dataLoadPromise;
43
- E.value.getInitData(e, t);
39
+ if (await p(), !D.value) return;
40
+ let t = await D.value.dataLoadPromise;
41
+ D.value.getInitData(e, t);
44
42
  }
45
43
  let j = (e) => {
46
- T.value = T.value.filter((t) => t.userId !== e), console.log("selectUserList.value =>", T.value), E.value?.deleteDeptUser(e);
44
+ E.value = E.value.filter((t) => (t.userId || t.id) !== e), D.value?.deleteDeptUser(e);
47
45
  };
48
46
  function M() {
49
- console.log("ready..."), O.value && A(O.value);
47
+ A(k.value);
50
48
  }
51
49
  let N = () => {
52
- r("update:visible", !1), r("cancel");
50
+ A(e.modelValue), r("update:visible", !1), r("cancel");
53
51
  }, P = (t) => {
54
- r("update:modelValue", e.modelValue.filter((e) => e.id !== t));
52
+ let n = e.modelValue.filter((e) => e.id !== t);
53
+ k.value = n.map((e) => ({ ...e })), r("update:modelValue", n);
55
54
  }, F = () => {
56
- if (T.value.length === 0) {
57
- b.warn("请选择用户");
55
+ if (E.value.length === 0) {
56
+ x.warn("请选择用户");
58
57
  return;
59
58
  }
60
- let e = T.value.map((e) => ({
61
- id: e.userId,
59
+ let e = E.value.map((e) => ({
60
+ id: e.userId || e.id,
62
61
  realName: e.realName || "",
63
62
  avatar: e.avatar
64
63
  }));
65
- r("update:visible", !1), k.value = !0, r("update:modelValue", e), r("confirm", e);
64
+ r("update:visible", !1), r("update:modelValue", e), r("confirm", e);
66
65
  };
67
- d({ deleteCheckedUser: P });
68
- let I = () => u(t, {
66
+ f({ deleteCheckedUser: P });
67
+ let I = () => d(t, {
69
68
  modelValue: e.visible,
70
- title: "选择联系人",
69
+ title: e.title || "选择联系人",
71
70
  modalProps: {
72
71
  cancelText: "取消",
73
72
  okText: "确定",
74
- ...C
73
+ ...w
75
74
  },
76
- onOnCancel: () => N(),
77
- onOnConfirm: () => F()
78
- }, { default: () => [u("div", { class: x() }, [u("div", { class: x("content-left") }, [u("div", { style: "padding: 16px 16px 0 16px" }, [u(y, {
79
- value: w.value,
80
- "onUpdate:value": (e) => w.value = e,
75
+ onOnCancel: N,
76
+ onOnConfirm: () => F(),
77
+ "onUpdate:modelValue": (t) => {
78
+ t || A(e.modelValue), r("update:visible", t);
79
+ }
80
+ }, { default: () => [d("div", { class: S() }, [d("div", { class: S("content-left") }, [d("div", { style: "padding: 16px 16px 0 16px" }, [d(b, {
81
+ value: T.value,
82
+ "onUpdate:value": (e) => T.value = e,
81
83
  size: "small",
82
84
  placeholder: "搜索",
83
85
  allowClear: !0
84
86
  }, {
85
- prefix: () => u(n, { name: "search" }, null),
87
+ prefix: () => d(n, { name: "search" }, null),
86
88
  _: 1
87
89
  }, 8, [
88
90
  "value",
89
91
  "onUpdate:value",
90
92
  "allowClear"
91
- ])]), u(s, {
92
- ref: E,
93
- selectUserList: T.value,
94
- "onUpdate:selectUserList": (e) => T.value = e,
95
- keyword: w.value,
93
+ ])]), d(c, {
94
+ ref: D,
95
+ selectUserList: E.value,
96
+ "onUpdate:selectUserList": (e) => E.value = e,
97
+ keyword: T.value,
96
98
  onReady: () => M()
97
99
  }, null, 8, [
98
100
  "selectUserList",
99
101
  "onUpdate:selectUserList",
100
102
  "keyword",
101
103
  "onReady"
102
- ])], 2), u("div", { class: x("content-right") }, [u("div", { class: x("content-right-title") }, [
103
- l("已选:"),
104
- T.value.length,
105
- l("/"),
106
- e.maxCount,
107
- l("人")
108
- ], 2), u("div", {
104
+ ])], 2), d("div", { class: S("content-right") }, [d("div", { class: S("content-right-title") }, [
105
+ u("已选:"),
106
+ E.value.length,
107
+ u("/"),
108
+ i(e.type, e.maxCount),
109
+ u("人")
110
+ ], 2), d("div", {
109
111
  class: "select-user-list",
110
- ref: D
111
- }, [u("div", { class: x("user-list") }, [T.value.length > 0 ? T.value.map((e) => u(o, {
112
+ ref: O
113
+ }, [d("div", { class: S("user-list") }, [E.value.length > 0 ? E.value.map((e) => d(s, {
112
114
  key: e.id,
113
115
  userInfo: e,
114
116
  isChecked: !1,
@@ -118,36 +120,48 @@ var { b: x } = e("pro-user-selector"), S = e("user-selector-extermal"), C = /* @
118
120
  "userInfo",
119
121
  "isDelete",
120
122
  "onDelete-user"
121
- ])) : u(_, {
122
- image: _.PRESENTED_IMAGE_SIMPLE,
123
+ ])) : d(v, {
124
+ image: v.PRESENTED_IMAGE_SIMPLE,
123
125
  description: "暂无数据"
124
126
  }, null, 8, ["image"])], 2)], 512)], 2)], 2)] }, 8, [
125
127
  "modelValue",
128
+ "title",
126
129
  "modalProps",
127
130
  "onOnCancel",
128
- "onOnConfirm"
129
- ]), L = () => u(v, null, { default: () => [u("div", { class: S.b() }, [e.hideSlot ? null : a.default ? a.default() : u("div", { class: S.b("list") }, [u("div", {
130
- class: S.b("icon"),
131
+ "onOnConfirm",
132
+ "onUpdate:modelValue"
133
+ ]), L = () => d(y, null, { default: () => [d("div", { class: C.b() }, [e.hideSlot ? null : o.default ? o.default() : d("div", { class: C.b("list") }, [d("button", {
134
+ type: "button",
135
+ class: C.b("icon"),
136
+ "aria-label": "选择用户",
131
137
  onClick: () => r("update:visible", !0)
132
- }, [u(n, {
138
+ }, [d(n, {
133
139
  name: "plus",
134
140
  size: 20,
135
141
  color: "var(--gdant-primary-500)"
136
- }, null)], 10, ["onClick"]), e.modelValue.map((e) => u("div", { class: S.b("item") }, [
137
- u(c, {
142
+ }, null)], 10, ["onClick"]), e.modelValue.map((e) => d("div", {
143
+ key: e.id,
144
+ class: C.b("item")
145
+ }, [
146
+ d(l, {
138
147
  name: e.realName,
139
148
  avatar: e.avatar,
140
149
  size: "small"
141
150
  }, null, 8, ["name", "avatar"]),
142
- u("span", { class: S.be("item", "name") }, [e.realName], 2),
143
- u("div", { onClick: () => P(e.id) }, [u(n, {
151
+ d("span", { class: C.be("item", "name") }, [e.realName], 2),
152
+ d("button", {
153
+ type: "button",
154
+ class: C.be("item", "remove"),
155
+ "aria-label": `移除${e.realName}`,
156
+ onClick: () => P(e.id)
157
+ }, [d(n, {
144
158
  name: "shanchu",
145
159
  size: 18,
146
160
  color: "var(--gdant-neutral-600)"
147
- }, null)], 8, ["onClick"])
161
+ }, null)], 10, ["aria-label", "onClick"])
148
162
  ], 2))], 2), I()], 2)] });
149
163
  return () => L();
150
164
  }
151
165
  });
152
166
  //#endregion
153
- export { C as default };
167
+ export { w as default };
@@ -44,5 +44,8 @@ var e = Symbol("selectUserContextKey"), t = {
44
44
  confirm: (e) => !0,
45
45
  cancel: () => !0
46
46
  };
47
+ function i(e, t) {
48
+ return e === "radio" ? 1 : !Number.isFinite(t) || t < 1 ? 25 : Math.floor(t);
49
+ }
47
50
  //#endregion
48
- export { n as GTE_ORGTREE_URL, t as UserSelectorProps, e as selectUserContextKey, r as userSelectorEmits };
51
+ export { n as GTE_ORGTREE_URL, t as UserSelectorProps, i as resolveUserSelectorMaxCount, e as selectUserContextKey, r as userSelectorEmits };
@@ -9,8 +9,11 @@ function e(e, t) {
9
9
  }, r;
10
10
  }
11
11
  function t(e) {
12
- let t = /* @__PURE__ */ new Map();
13
- return e.filter((e) => !e || e.id === void 0 || t.has(e.id) ? !1 : (t.set(e.id, !0), !0));
12
+ let t = /* @__PURE__ */ new Set();
13
+ return e.filter((e) => {
14
+ let n = e?.userId || e?.id;
15
+ return !n || t.has(n) ? !1 : (t.add(n), !0);
16
+ });
14
17
  }
15
18
  function n(e) {
16
19
  if (!(!e || e.length === 0)) for (let t of e) t.deptType === "department" && (t.checkedUserIds = []), t.members && t.members.length > 0 && t.members.forEach((e) => {
@@ -1,13 +1,13 @@
1
- import e from "../../../icon/index.mjs";
1
+ import e from "../../../icon/src/icon.mjs";
2
2
  import { selectContextKey as t } from "../types.mjs";
3
3
  import { useApi as n } from "../hooks/useApi.mjs";
4
- import { createBlock as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, createVNode as s, defineComponent as c, inject as l, mergeModels as u, onMounted as d, openBlock as f, ref as p, toDisplayString as m, unref as h, useModel as g, watch as _, withCtx as v } from "vue";
5
- import { Empty as y, InputSearch as b, Tree as x } from "ant-design-vue";
4
+ import { createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, createVNode as c, defineComponent as l, inject as u, mergeModels as d, onMounted as f, openBlock as p, ref as m, toDisplayString as h, unref as g, useModel as _, watch as v, withCtx as y } from "vue";
5
+ import { Alert as b, Button as x, Empty as S, InputSearch as C, Spin as w, Tree as T } from "ant-design-vue";
6
6
  //#region src/components/pro-selector-group/src/compoents/dept-tree.vue?vue&type=script&setup=true&lang.ts
7
- var S = {
7
+ var E = { class: "dept-tree-panel" }, D = {
8
8
  key: 0,
9
9
  class: "selector-tree"
10
- }, C = { class: "tree-title" }, w = { class: "tree-title_name" }, T = { key: 0 }, E = { style: { color: "#f50" } }, D = { key: 1 }, O = /* @__PURE__ */ c({
10
+ }, O = { class: "tree-title" }, k = { class: "tree-title_name" }, A = { key: 0 }, j = { class: "selector-highlight" }, M = { key: 1 }, N = /* @__PURE__ */ l({
11
11
  __name: "dept-tree",
12
12
  props: {
13
13
  modelValue: {
@@ -16,85 +16,112 @@ var S = {
16
16
  },
17
17
  modelModifiers: {}
18
18
  },
19
- emits: /* @__PURE__ */ u(["select"], ["update:modelValue"]),
20
- setup(c, { emit: u }) {
21
- let O = u, k = l(t), { getDeptTree: A, getUserListByDeptId: j, deptTree: M } = n(k.http, k.urlPrefix), N = g(c, "modelValue"), P = p(""), F = p([]), I = p([]), L = p(!0), R = p([]);
22
- function z(e) {
19
+ emits: /* @__PURE__ */ d(["select"], ["update:modelValue"]),
20
+ setup(l, { emit: d }) {
21
+ let N = d, P = u(t), { getDeptTree: F, getUserListByDeptId: I, deptTree: L, deptLoading: R, deptError: z } = n(P.http, P.urlPrefix), B = _(l, "modelValue"), V = m(""), H = m([]), U = m([]), W = m(!0), G = m([]);
22
+ function K(e) {
23
23
  let t = [];
24
24
  for (let n = 0; n < e.length; n++) {
25
25
  let r = e[n], i = r.id;
26
26
  t.push({
27
27
  key: i,
28
28
  title: r.deptName
29
- }), r.children && t.push(...z(r.children));
29
+ }), r.children && t.push(...K(r.children));
30
30
  }
31
31
  return t;
32
32
  }
33
- function B(e, t) {
33
+ function q(e, t) {
34
34
  let n;
35
35
  for (let r = 0; r < t.length; r++) {
36
36
  let i = t[r];
37
- i.children && (i.children.some((t) => t.id === e) ? n = i.id : B(e, i.children) && (n = B(e, i.children)));
37
+ i.children && (i.children.some((t) => t.id === e) ? n = i.id : q(e, i.children) && (n = q(e, i.children)));
38
38
  }
39
39
  return n;
40
40
  }
41
- _(P, (e) => {
42
- I.value = R.value.map((t) => t.title.includes(e) ? B(t.key, M.value) : null).filter((e, t, n) => e && n.indexOf(e) === t), L.value = !!e;
43
- }), d(async () => {
44
- if (await A(), M.value.length > 0) {
45
- R.value = z(M.value);
46
- let e = M.value[0];
47
- I.value = [e.id], F.value = [e.id], N.value = e.id, await j(e.id);
48
- }
41
+ v(V, (e) => {
42
+ U.value = G.value.map((t) => t.title.includes(e) ? q(t.key, L.value) : null).filter((e, t, n) => e && n.indexOf(e) === t), W.value = !!e;
43
+ });
44
+ async function J() {
45
+ await F(), G.value = K(L.value);
46
+ let e = L.value[0];
47
+ e && (U.value = [e.id], H.value = [e.id], B.value = e.id, await I(e.id));
48
+ }
49
+ f(() => {
50
+ J();
49
51
  });
50
- function V(e) {
51
- P.value = e;
52
+ function Y(e) {
53
+ V.value = e;
52
54
  }
53
- function H(e) {
54
- I.value = e.map((e) => String(e)), L.value = !1;
55
+ function X(e) {
56
+ U.value = e.map((e) => String(e)), W.value = !1;
55
57
  }
56
- function U(e, { node: t }) {
57
- N.value = t.id, O("select", t);
58
+ function Z(e, { node: t }) {
59
+ B.value = t.id, N("select", t);
58
60
  }
59
- return (t, n) => (f(), i("div", null, [s(h(b), {
60
- value: P.value,
61
- "onUpdate:value": n[0] ||= (e) => P.value = e,
62
- placeholder: "请输入部门名称",
63
- onSearch: V
64
- }, null, 8, ["value"]), h(M).length > 0 ? (f(), i("div", S, [s(h(x), {
65
- "selected-keys": F.value,
66
- "onUpdate:selectedKeys": n[1] ||= (e) => F.value = e,
67
- "expanded-keys": I.value,
68
- "onUpdate:expandedKeys": n[2] ||= (e) => I.value = e,
69
- "tree-data": h(M),
70
- "auto-expand-parent": L.value,
71
- "field-names": {
72
- key: "id",
73
- title: "deptName"
74
- },
75
- virtual: !1,
76
- onSelect: U,
77
- onExpand: H
78
- }, {
79
- title: v(({ data: t }) => [a("div", C, [s(h(e), {
80
- name: t.parentId === "root" ? "qiye" : "bumen",
81
- size: 16
82
- }, null, 8, ["name"]), a("span", w, [P.value && t.deptName.includes(P.value) ? (f(), i("span", T, [
83
- o(m(t.deptName.substring(0, t.deptName.indexOf(P.value))) + " ", 1),
84
- a("span", E, m(P.value), 1),
85
- o(" " + m(t.deptName.substring(t.deptName.indexOf(P.value) + P.value.length)), 1)
86
- ])) : (f(), i("span", D, m(t.deptName), 1))])])]),
87
- _: 1
88
- }, 8, [
89
- "selected-keys",
90
- "expanded-keys",
91
- "tree-data",
92
- "auto-expand-parent"
93
- ])])) : (f(), r(h(y), {
94
- key: 1,
95
- image: h(y).PRESENTED_IMAGE_SIMPLE
96
- }, null, 8, ["image"]))]));
61
+ return (t, n) => (p(), a("div", E, [
62
+ c(g(C), {
63
+ value: V.value,
64
+ "onUpdate:value": n[0] ||= (e) => V.value = e,
65
+ "allow-clear": "",
66
+ placeholder: "搜索部门",
67
+ onSearch: Y
68
+ }, null, 8, ["value"]),
69
+ g(z) ? (p(), r(g(b), {
70
+ key: 0,
71
+ class: "selector-feedback",
72
+ type: "error",
73
+ message: g(z),
74
+ "show-icon": ""
75
+ }, {
76
+ action: y(() => [c(g(x), {
77
+ type: "link",
78
+ size: "small",
79
+ onClick: J
80
+ }, {
81
+ default: y(() => [...n[3] ||= [s("重试", -1)]]),
82
+ _: 1
83
+ })]),
84
+ _: 1
85
+ }, 8, ["message"])) : i("", !0),
86
+ c(g(w), { spinning: g(R) }, {
87
+ default: y(() => [g(L).length > 0 ? (p(), a("div", D, [c(g(T), {
88
+ "selected-keys": H.value,
89
+ "onUpdate:selectedKeys": n[1] ||= (e) => H.value = e,
90
+ "expanded-keys": U.value,
91
+ "onUpdate:expandedKeys": n[2] ||= (e) => U.value = e,
92
+ "tree-data": g(L),
93
+ "auto-expand-parent": W.value,
94
+ "field-names": {
95
+ key: "id",
96
+ title: "deptName"
97
+ },
98
+ virtual: !1,
99
+ onSelect: Z,
100
+ onExpand: X
101
+ }, {
102
+ title: y(({ data: t }) => [o("div", O, [c(e, {
103
+ name: t.parentId === "root" ? "qiye" : "bumen",
104
+ size: 16
105
+ }, null, 8, ["name"]), o("span", k, [V.value && t.deptName.includes(V.value) ? (p(), a("span", A, [
106
+ s(h(t.deptName.substring(0, t.deptName.indexOf(V.value))) + " ", 1),
107
+ o("span", j, h(V.value), 1),
108
+ s(" " + h(t.deptName.substring(t.deptName.indexOf(V.value) + V.value.length)), 1)
109
+ ])) : (p(), a("span", M, h(t.deptName), 1))])])]),
110
+ _: 1
111
+ }, 8, [
112
+ "selected-keys",
113
+ "expanded-keys",
114
+ "tree-data",
115
+ "auto-expand-parent"
116
+ ])])) : g(z) ? i("", !0) : (p(), r(g(S), {
117
+ key: 1,
118
+ image: g(S).PRESENTED_IMAGE_SIMPLE,
119
+ description: "暂无部门"
120
+ }, null, 8, ["image"]))]),
121
+ _: 1
122
+ }, 8, ["spinning"])
123
+ ]));
97
124
  }
98
125
  });
99
126
  //#endregion
100
- export { O as default };
127
+ export { N as default };
@@ -23,13 +23,13 @@ var l = { class: "type-selector-box dept-selector" }, u = /* @__PURE__ */ i({
23
23
  h(e);
24
24
  }
25
25
  function _(e) {
26
- p.value = [];
26
+ p.value = p.value.filter((t) => !e.includes(t.value));
27
27
  }
28
28
  function v() {
29
29
  p.value = [];
30
30
  }
31
31
  function y(e) {
32
- console.log("dept =>", e), p.value = e.map((e) => ({
32
+ p.value = e.map((e) => ({
33
33
  value: e.value,
34
34
  label: e.label || "",
35
35
  type: "dept"
@@ -43,7 +43,7 @@ var l = { class: "type-selector-box dept-selector" }, u = /* @__PURE__ */ i({
43
43
  }), (e, i) => (o(), n("div", l, [r(t, {
44
44
  modelValue: f.value,
45
45
  "onUpdate:modelValue": i[0] ||= (e) => f.value = e,
46
- style: { width: "400px !important" },
46
+ class: "selector-pane",
47
47
  onSelect: m
48
48
  }, null, 8, ["modelValue"])]));
49
49
  }