@guodun/antdv 1.4.4 → 1.4.6

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 (95) hide show
  1. package/dist/es/components/contract-signing-location/src/ContractSigningLocation.vue.mjs +85 -85
  2. package/dist/es/components/contract-signing-location/src/template-source.mjs +63 -4
  3. package/dist/es/components/dept-selector/src/dept.mjs +170 -142
  4. package/dist/es/components/index.mjs +1 -0
  5. package/dist/es/components/pro-contract-template-designer/index.mjs +1 -0
  6. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.mjs +372 -185
  7. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.mjs +59 -42
  8. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateRendererField.vue.mjs +218 -85
  9. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.mjs +5 -0
  10. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.vue.mjs +97 -0
  11. package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.mjs +914 -853
  12. package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.mjs +550 -245
  13. package/dist/es/components/pro-contract-template-designer/src/composables/use-template-designer.mjs +214 -139
  14. package/dist/es/components/pro-contract-template-designer/src/extensions/template-variable.mjs +53 -35
  15. package/dist/es/components/pro-contract-template-designer/src/types.mjs +15 -2
  16. package/dist/es/components/pro-contract-template-designer/src/utils/advanced-controls.mjs +91 -0
  17. package/dist/es/components/pro-contract-template-designer/src/utils/template-renderer.mjs +96 -65
  18. package/dist/es/components/pro-contract-template-designer/src/utils/template-tool-icons.mjs +23 -16
  19. package/dist/es/components/pro-contract-template-designer/style/index.css +1 -1
  20. package/dist/es/components/pro-selector/src/components/org-tree.mjs +130 -89
  21. package/dist/es/components/pro-selector/src/components/user.mjs +34 -26
  22. package/dist/es/components/pro-selector/src/pro-user.mjs +86 -72
  23. package/dist/es/components/pro-selector/src/types.mjs +4 -1
  24. package/dist/es/components/pro-selector/src/utils/orgTree.mjs +5 -2
  25. package/dist/es/components/pro-selector-group/src/compoents/dept-tree.vue.mjs +92 -65
  26. package/dist/es/components/pro-selector-group/src/compoents/dept.vue.mjs +3 -3
  27. package/dist/es/components/pro-selector-group/src/compoents/role.vue.mjs +98 -73
  28. package/dist/es/components/pro-selector-group/src/compoents/select-box.vue.mjs +12 -9
  29. package/dist/es/components/pro-selector-group/src/compoents/user.vue.mjs +101 -72
  30. package/dist/es/components/pro-selector-group/src/hooks/useApi.mjs +39 -22
  31. package/dist/es/components/pro-selector-group/src/index.vue.mjs +105 -83
  32. package/dist/es/components/pro-selector-group/src/utils/index.mjs +36 -0
  33. package/dist/es/components/role-selector/src/role.mjs +134 -120
  34. package/dist/es/index.mjs +50 -49
  35. package/dist/lib/components/contract-signing-location/src/ContractSigningLocation.vue.cjs +1 -1
  36. package/dist/lib/components/contract-signing-location/src/template-source.cjs +1 -1
  37. package/dist/lib/components/dept-selector/src/dept.cjs +1 -1
  38. package/dist/lib/components/index.cjs +1 -1
  39. package/dist/lib/components/pro-contract-template-designer/index.cjs +1 -1
  40. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.cjs +2 -1
  41. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.cjs +1 -1
  42. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateRendererField.vue.cjs +1 -1
  43. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.cjs +1 -0
  44. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.vue.cjs +1 -0
  45. package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.cjs +1 -1
  46. package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.cjs +1 -1
  47. package/dist/lib/components/pro-contract-template-designer/src/composables/use-template-designer.cjs +4 -4
  48. package/dist/lib/components/pro-contract-template-designer/src/extensions/template-variable.cjs +1 -1
  49. package/dist/lib/components/pro-contract-template-designer/src/types.cjs +1 -1
  50. package/dist/lib/components/pro-contract-template-designer/src/utils/advanced-controls.cjs +1 -0
  51. package/dist/lib/components/pro-contract-template-designer/src/utils/template-renderer.cjs +3 -3
  52. package/dist/lib/components/pro-contract-template-designer/src/utils/template-tool-icons.cjs +1 -1
  53. package/dist/lib/components/pro-contract-template-designer/style/index.css +1 -1
  54. package/dist/lib/components/pro-selector/src/components/org-tree.cjs +1 -1
  55. package/dist/lib/components/pro-selector/src/components/user.cjs +1 -1
  56. package/dist/lib/components/pro-selector/src/pro-user.cjs +1 -1
  57. package/dist/lib/components/pro-selector/src/types.cjs +1 -1
  58. package/dist/lib/components/pro-selector/src/utils/orgTree.cjs +1 -1
  59. package/dist/lib/components/pro-selector-group/src/compoents/dept-tree.vue.cjs +1 -1
  60. package/dist/lib/components/pro-selector-group/src/compoents/dept.vue.cjs +1 -1
  61. package/dist/lib/components/pro-selector-group/src/compoents/role.vue.cjs +1 -1
  62. package/dist/lib/components/pro-selector-group/src/compoents/select-box.vue.cjs +1 -1
  63. package/dist/lib/components/pro-selector-group/src/compoents/user.vue.cjs +1 -1
  64. package/dist/lib/components/pro-selector-group/src/hooks/useApi.cjs +1 -1
  65. package/dist/lib/components/pro-selector-group/src/index.vue.cjs +1 -1
  66. package/dist/lib/components/pro-selector-group/src/utils/index.cjs +1 -0
  67. package/dist/lib/components/role-selector/src/role.cjs +1 -1
  68. package/dist/lib/index.cjs +1 -1
  69. package/dist/theme/dept-selector.css +1 -1
  70. package/dist/theme/icon.css +1 -1
  71. package/dist/theme/index.css +1 -1
  72. package/dist/theme/pro-selector-group.css +1 -1
  73. package/dist/theme/pro-selector.css +1 -1
  74. package/dist/theme/role-selector.css +1 -1
  75. package/dist/types/components/contract-signing-location/src/ContractSigningLocation.vue.d.ts +3 -3
  76. package/dist/types/components/pro-contract-template-designer/index.d.ts +1 -0
  77. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.d.ts +1 -0
  78. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.d.ts +3 -0
  79. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateRendererField.vue.d.ts +7 -1
  80. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.vue.d.ts +14 -0
  81. package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.d.ts +13 -1
  82. package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.d.ts +11 -1
  83. package/dist/types/components/pro-contract-template-designer/src/composables/use-template-designer.d.ts +4 -0
  84. package/dist/types/components/pro-contract-template-designer/src/extensions/template-variable.d.ts +11 -1
  85. package/dist/types/components/pro-contract-template-designer/src/types.d.ts +131 -2
  86. package/dist/types/components/pro-contract-template-designer/src/utils/advanced-controls.d.ts +15 -0
  87. package/dist/types/components/pro-contract-template-designer/src/utils/template-renderer.d.ts +10 -2
  88. package/dist/types/components/pro-selector/index.d.ts +9 -0
  89. package/dist/types/components/pro-selector/src/components/user.d.ts +9 -0
  90. package/dist/types/components/pro-selector/src/types.d.ts +2 -0
  91. package/dist/types/components/pro-selector/src/utils/orgTree.d.ts +4 -1
  92. package/dist/types/components/pro-selector-group/src/compoents/select-box.vue.d.ts +4 -4
  93. package/dist/types/components/pro-selector-group/src/hooks/useApi.d.ts +6 -1
  94. package/dist/types/components/pro-selector-group/src/utils/index.d.ts +8 -0
  95. package/package.json +5 -3
@@ -1,95 +1,120 @@
1
1
  import { selectContextKey as e } from "../types.mjs";
2
2
  import { useApi as t } from "../hooks/useApi.mjs";
3
- import { Fragment as n, computed as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, createVNode as s, defineComponent as c, inject as l, onMounted as u, openBlock as d, reactive as f, ref as p, renderList as m, toDisplayString as h, unref as g, watch as _, watchEffect as v, withCtx as y } from "vue";
4
- import { Checkbox as b, CheckboxGroup as x, InputSearch as S } from "ant-design-vue";
3
+ import { Fragment as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, defineComponent as u, inject as d, onMounted as f, openBlock as p, reactive as m, ref as h, renderList as g, toDisplayString as _, unref as v, watch as y, withCtx as b } from "vue";
4
+ import { Alert as x, Button as S, Checkbox as C, CheckboxGroup as w, InputSearch as T, Spin as E } from "ant-design-vue";
5
5
  //#region src/components/pro-selector-group/src/compoents/role.vue?vue&type=script&setup=true&lang.ts
6
- var C = { class: "type-selector-box role-selector" }, w = { style: { width: "400px" } }, T = { style: { "margin-top": "12px" } }, E = { style: { "margin-top": "12px" } }, D = /* @__PURE__ */ c({
6
+ var D = { class: "type-selector-box role-selector" }, O = { class: "selector-pane" }, k = { class: "selector-toolbar" }, A = { class: "selector-toolbar__count" }, j = { class: "selector-option-list" }, M = { key: 0 }, N = {
7
+ key: 0,
8
+ class: "selector-empty"
9
+ }, P = /* @__PURE__ */ u({
7
10
  __name: "role",
8
- setup(c, { expose: D }) {
9
- let O = l(e), { getRole: k, roleList: A } = t(O.http, O.urlPrefix), j = p(""), M = r(() => j.value ? A.value.filter((e) => e.roleName && e.roleName.includes(j.value)) : A.value), N = f({
11
+ setup(u, { expose: P }) {
12
+ let F = d(e), { getRole: I, roleList: L, roleLoading: R, roleError: z } = t(F.http, F.urlPrefix), B = h(""), V = r(() => B.value ? L.value.filter((e) => e.roleName && e.roleName.includes(B.value)) : L.value), H = m({
10
13
  indeterminate: !1,
11
14
  checkAll: !1,
12
15
  checkedList: []
13
16
  });
14
- v(() => {
15
- if (A.value.length > 0) {
16
- N.checkAll = N.checkedList.length === M.value.length && N.checkedList.length > 0 && M.value.length > 0, N.indeterminate = N.checkedList.length > 0 && N.checkedList.length < M.value.length;
17
- let e = [];
18
- A.value.forEach((t) => {
19
- N.checkedList.forEach((n) => {
20
- t.id === n && e.push({
21
- label: t.roleName,
22
- value: n,
23
- type: "role"
24
- });
25
- });
26
- }), O.changeSelectData(e);
27
- }
28
- }), _(() => j.value, () => {
29
- let e = N.checkedList.filter((e) => M.value.some((t) => t.id === e));
30
- N.checkAll = e.length === M.value.length && M.value.length > 0, N.indeterminate = e.length > 0 && e.length < M.value.length;
17
+ function U() {
18
+ let e = H.checkedList.filter((e) => V.value.some((t) => t.id === e));
19
+ H.checkAll = e.length === V.value.length && V.value.length > 0, H.indeterminate = e.length > 0 && e.length < V.value.length, F.changeSelectData(L.value.filter((e) => H.checkedList.includes(e.id)).map((e) => ({
20
+ label: e.roleName,
21
+ value: e.id,
22
+ type: "role"
23
+ })));
24
+ }
25
+ y([
26
+ () => H.checkedList,
27
+ V,
28
+ L
29
+ ], U, {
30
+ deep: !0,
31
+ immediate: !0
31
32
  });
32
- function P(e) {
33
+ function W(e) {
33
34
  if (e.target.checked) {
34
- N.checkAll = !0, N.indeterminate = !1;
35
- let e = M.value.map((e) => e.id);
36
- N.checkedList = [...N.checkedList.filter((t) => !e.includes(t)), ...e];
35
+ H.checkAll = !0, H.indeterminate = !1;
36
+ let e = V.value.map((e) => e.id);
37
+ H.checkedList = [...H.checkedList.filter((t) => !e.includes(t)), ...e];
37
38
  } else {
38
- N.checkAll = !1, N.indeterminate = !1;
39
- let e = M.value.map((e) => e.id);
40
- N.checkedList = N.checkedList.filter((t) => !e.includes(t));
39
+ H.checkAll = !1, H.indeterminate = !1;
40
+ let e = V.value.map((e) => e.id);
41
+ H.checkedList = H.checkedList.filter((t) => !e.includes(t));
41
42
  }
42
43
  }
43
- function F(e) {
44
- j.value = e;
44
+ function G(e) {
45
+ B.value = e;
45
46
  }
46
- function I(e) {
47
- N.checkedList = N.checkedList.filter((t) => t !== e);
47
+ function K(e) {
48
+ H.checkedList = H.checkedList.filter((t) => t !== e);
48
49
  }
49
- function L(e) {
50
- N.checkedList = N.checkedList.filter((t) => !e.includes(t));
50
+ function q(e) {
51
+ H.checkedList = H.checkedList.filter((t) => !e.includes(t));
51
52
  }
52
- function R() {
53
- N.checkAll = !1, N.indeterminate = !1, N.checkedList = [];
53
+ function J() {
54
+ H.checkAll = !1, H.indeterminate = !1, H.checkedList = [];
54
55
  }
55
- u(() => {
56
- k();
56
+ f(() => {
57
+ I();
57
58
  });
58
- function z(e) {
59
- N.checkedList = e.map((e) => e.value);
59
+ function Y(e) {
60
+ H.checkedList = e.map((e) => e.value);
60
61
  }
61
- return D({
62
- delFn: I,
63
- deleteAll: L,
64
- reset: R,
65
- echo: z
66
- }), (e, t) => (d(), i("div", C, [a("div", w, [s(g(S), {
67
- value: j.value,
68
- "onUpdate:value": t[0] ||= (e) => j.value = e,
69
- placeholder: "请输入角色名称",
70
- onOnSearch: F
71
- }, null, 8, ["value"]), a("div", T, [s(g(b), {
72
- checked: N.checkAll,
73
- "onUpdate:checked": t[1] ||= (e) => N.checkAll = e,
74
- indeterminate: N.indeterminate,
75
- onChange: P
76
- }, {
77
- default: y(() => [...t[3] ||= [o(" 全选 ", -1)]]),
78
- _: 1
79
- }, 8, ["checked", "indeterminate"]), a("div", E, [s(g(x), {
80
- value: N.checkedList,
81
- "onUpdate:value": t[2] ||= (e) => N.checkedList = e
82
- }, {
83
- default: y(() => [a("div", null, [(d(!0), i(n, null, m(M.value, (e) => (d(), i("div", {
84
- key: e.id,
85
- style: { "margin-top": "4px" }
86
- }, [s(g(b), { value: e.id }, {
87
- default: y(() => [o(h(e.roleName), 1)]),
88
- _: 2
89
- }, 1032, ["value"])]))), 128))])]),
90
- _: 1
91
- }, 8, ["value"])])])])]));
62
+ return P({
63
+ delFn: K,
64
+ deleteAll: q,
65
+ reset: J,
66
+ echo: Y
67
+ }), (e, t) => (p(), o("div", D, [s("div", O, [
68
+ l(v(T), {
69
+ value: B.value,
70
+ "onUpdate:value": t[0] ||= (e) => B.value = e,
71
+ "allow-clear": "",
72
+ placeholder: "搜索角色",
73
+ onSearch: G
74
+ }, null, 8, ["value"]),
75
+ v(z) ? (p(), i(v(x), {
76
+ key: 0,
77
+ class: "selector-feedback",
78
+ type: "error",
79
+ message: v(z),
80
+ "show-icon": ""
81
+ }, {
82
+ action: b(() => [l(v(S), {
83
+ type: "link",
84
+ size: "small",
85
+ onClick: v(I)
86
+ }, {
87
+ default: b(() => [...t[3] ||= [c("重试", -1)]]),
88
+ _: 1
89
+ }, 8, ["onClick"])]),
90
+ _: 1
91
+ }, 8, ["message"])) : a("", !0),
92
+ l(v(E), { spinning: v(R) }, {
93
+ default: b(() => [s("div", k, [l(v(C), {
94
+ checked: H.checkAll,
95
+ "onUpdate:checked": t[1] ||= (e) => H.checkAll = e,
96
+ indeterminate: H.indeterminate,
97
+ onChange: W
98
+ }, {
99
+ default: b(() => [...t[4] ||= [c(" 全选搜索结果 ", -1)]]),
100
+ _: 1
101
+ }, 8, ["checked", "indeterminate"]), s("span", A, _(V.value.length) + " 个角色", 1)]), s("div", j, [l(v(w), {
102
+ value: H.checkedList,
103
+ "onUpdate:value": t[2] ||= (e) => H.checkedList = e
104
+ }, {
105
+ default: b(() => [V.value.length ? (p(), o("div", M, [(p(!0), o(n, null, g(V.value, (e) => (p(), o("div", {
106
+ key: e.id,
107
+ class: "selector-option-row"
108
+ }, [l(v(C), { value: e.id }, {
109
+ default: b(() => [c(_(e.roleName), 1)]),
110
+ _: 2
111
+ }, 1032, ["value"])]))), 128))])) : a("", !0)]),
112
+ _: 1
113
+ }, 8, ["value"]), !v(R) && !v(z) && V.value.length === 0 ? (p(), o("div", N, "暂无匹配角色")) : a("", !0)])]),
114
+ _: 1
115
+ }, 8, ["spinning"])
116
+ ])]));
92
117
  }
93
118
  });
94
119
  //#endregion
95
- export { D as default };
120
+ export { P as default };
@@ -1,10 +1,10 @@
1
1
  import { defaultNamespace as e } from "../../../../hooks/use-namespace/index.mjs";
2
- import t from "../../../icon/index.mjs";
2
+ import t from "../../../icon/src/icon.mjs";
3
3
  import { selectContextKey as n } from "../types.mjs";
4
4
  import { Fragment as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, inject as f, mergeModels as p, normalizeClass as m, normalizeStyle as h, openBlock as g, renderList as _, toDisplayString as v, unref as y, useModel as b, withCtx as x } from "vue";
5
5
  import { Button as S, Empty as C } from "ant-design-vue";
6
6
  //#region src/components/pro-selector-group/src/compoents/select-box.vue?vue&type=script&setup=true&lang.ts
7
- var w = { style: { width: "40px" } }, T = { key: 0 }, E = {
7
+ var w = { key: 0 }, T = ["aria-label", "onClick"], E = {
8
8
  key: 1,
9
9
  style: {
10
10
  display: "flex",
@@ -29,9 +29,9 @@ var w = { style: { width: "40px" } }, T = { key: 0 }, E = {
29
29
  D("delete", e);
30
30
  }
31
31
  function M() {
32
- D("deleteAll", k.value.map((e) => e.value));
32
+ D("deleteAll", k.value);
33
33
  }
34
- return (n, i) => (g(), s("div", { class: m(`${y(e)}-select-box`) }, [c("div", { class: m(`${y(e)}-select-box_title`) }, [c("div", { class: m(`${y(e)}-select-box_title_count`) }, "已选: " + v(k.value.length) + "个", 3), c("div", w, [k.value.length > 0 ? (g(), a(y(S), {
34
+ return (n, i) => (g(), s("div", { class: m(`${y(e)}-select-box`) }, [c("div", { class: m(`${y(e)}-select-box_title`) }, [c("div", { class: m(`${y(e)}-select-box_title_count`) }, "已选: " + v(k.value.length) + "个", 3), c("div", null, [k.value.length > 0 ? (g(), a(y(S), {
35
35
  key: 0,
36
36
  type: "link",
37
37
  size: "small",
@@ -39,17 +39,20 @@ var w = { style: { width: "40px" } }, T = { key: 0 }, E = {
39
39
  }, {
40
40
  default: x(() => [...i[0] ||= [l(" 清空 ", -1)]]),
41
41
  _: 1
42
- })) : o("", !0)])], 2), c("div", { class: m(`${y(e)}-select-box_content`) }, [k.value.length > 0 ? (g(), s("div", T, [(g(!0), s(r, null, _(k.value, (n) => (g(), s("div", {
42
+ })) : o("", !0)])], 2), c("div", { class: m(`${y(e)}-select-box_content`) }, [k.value.length > 0 ? (g(), s("div", w, [(g(!0), s(r, null, _(k.value, (n) => (g(), s("div", {
43
43
  key: n.value,
44
44
  class: m(`${y(e)}-select-box_content-item`)
45
45
  }, [c("div", {
46
46
  class: m(`${y(e)}-select-box_content-item_name`),
47
47
  style: h(A.value)
48
- }, v(n.label), 7), c("div", { class: m(`${y(e)}-select-box_content-item_close`) }, [u(y(t), {
48
+ }, v(n.label), 7), c("div", { class: m(`${y(e)}-select-box_content-item_close`) }, [c("button", {
49
+ type: "button",
50
+ "aria-label": `移除${n.label || "已选项"}`,
51
+ onClick: (e) => j(n)
52
+ }, [u(t, {
49
53
  name: "close-circle-o",
50
- size: 16,
51
- onClick: (e) => j(n.value)
52
- }, null, 8, ["onClick"])], 2)], 2))), 128))])) : (g(), s("div", E, [u(y(C), { image: y(C).PRESENTED_IMAGE_SIMPLE }, null, 8, ["image"])]))], 2)], 2));
54
+ size: 16
55
+ })], 8, T)], 2)], 2))), 128))])) : (g(), s("div", E, [u(y(C), { image: y(C).PRESENTED_IMAGE_SIMPLE }, null, 8, ["image"])]))], 2)], 2));
53
56
  }
54
57
  });
55
58
  //#endregion
@@ -1,120 +1,149 @@
1
- import { GdAntUserSelectorCheckbox as e } from "../../../pro-selector/index.mjs";
1
+ import e from "../../../pro-selector/src/components/user.mjs";
2
2
  import { selectContextKey as t } from "../types.mjs";
3
3
  import { useApi as n } from "../hooks/useApi.mjs";
4
4
  import r from "./dept-tree.mjs";
5
5
  import { Fragment as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, defineComponent as f, inject as p, openBlock as m, reactive as h, ref as g, renderList as _, unref as v, watch as y, withCtx as b } from "vue";
6
- import { Checkbox as x, Empty as S, InputSearch as C, Spin as w } from "ant-design-vue";
6
+ import { Alert as x, Button as S, Checkbox as C, Empty as w, InputSearch as T, Spin as E } from "ant-design-vue";
7
7
  //#region src/components/pro-selector-group/src/compoents/user.vue?vue&type=script&setup=true&lang.ts
8
- var T = { class: "type-selector-box user-selector" }, E = { style: { width: "280px" } }, D = { style: { "margin-top": "12px" } }, O = { key: 0 }, k = /* @__PURE__ */ f({
8
+ var D = { class: "type-selector-box user-selector" }, O = { class: "selector-pane user-list-pane" }, k = { style: { "margin-top": "12px" } }, A = { key: 0 }, j = /* @__PURE__ */ f({
9
9
  __name: "user",
10
- setup(f, { expose: k }) {
11
- let A = p(t), { getUserListByDeptId: j, userList: M, userLoading: N } = n(A.http, A.urlPrefix), P = a(() => F[I.value] || {
12
- indeterminate: !1,
13
- checkAll: !1
14
- }), F = h({}), I = g(""), L = g(""), R = g([]), z = a(() => L.value ? M.value.filter((e) => e.realName && e.realName.includes(L.value)) : M.value);
15
- y(() => I.value, async (e) => {
16
- e && (await j(e), F[e] = B());
17
- }, { immediate: !0 }), y(() => R.value, (e) => {
18
- A.changeSelectData(e);
19
- }, { deep: !0 }), y(() => L.value, () => {
20
- I.value && (F[I.value] = B());
10
+ setup(f, { expose: j }) {
11
+ let M = p(t), { getUserListByDeptId: N, userList: P, userLoading: F, userError: I } = n(M.http, M.urlPrefix);
12
+ function L(e = B.value) {
13
+ return R[e] || (R[e] = {
14
+ indeterminate: !1,
15
+ checkAll: !1
16
+ }), R[e];
17
+ }
18
+ let R = h({}), z = a(() => L()), B = g(""), V = g(""), H = g([]), U = a(() => V.value ? P.value.filter((e) => e.realName && e.realName.includes(V.value)) : P.value);
19
+ y(() => B.value, async (e) => {
20
+ if (e) {
21
+ if (await N(e), e !== B.value) return;
22
+ R[e] = W();
23
+ }
24
+ }, { immediate: !0 }), y(() => H.value, (e) => {
25
+ B.value && (R[B.value] = W()), M.changeSelectData(e);
26
+ }, { deep: !0 }), y(() => V.value, () => {
27
+ B.value && (R[B.value] = W());
21
28
  });
22
- function B() {
23
- R.value.forEach((e) => {
24
- M.value.forEach((t) => {
25
- e.value === t.id && (t.checked = !0);
26
- });
29
+ function W() {
30
+ let e = new Set(H.value.map((e) => e.value));
31
+ P.value.forEach((t) => {
32
+ t.checked = e.has(t.id);
27
33
  });
28
- let e = z.value.filter((e) => e.checked);
34
+ let t = U.value.filter((e) => e.checked);
29
35
  return {
30
- indeterminate: e.length > 0 && e.length < z.value.length,
31
- checkAll: e.length === z.value.length && z.value.length > 0
36
+ indeterminate: t.length > 0 && t.length < U.value.length,
37
+ checkAll: t.length === U.value.length && U.value.length > 0
32
38
  };
33
39
  }
34
- function V(e, t) {
40
+ function G(e, t) {
35
41
  return e.some((e) => e.value === t);
36
42
  }
37
- function H(e) {
38
- let t = F[I.value];
39
- t.checkAll = e.target.checked, t.indeterminate = !1, z.value.forEach((t) => {
40
- let n = M.value.find((e) => e.id === t.id);
43
+ function K(e) {
44
+ let t = L();
45
+ t.checkAll = e.target.checked, t.indeterminate = !1, U.value.forEach((t) => {
46
+ let n = P.value.find((e) => e.id === t.id);
41
47
  n && (n.checked = e.target.checked);
42
- }), e.target.checked ? z.value.forEach((e) => {
43
- V(R.value, e.id) || R.value.push({
48
+ }), e.target.checked ? U.value.forEach((e) => {
49
+ G(H.value, e.id) || H.value.push({
44
50
  value: e.id,
45
51
  label: e.realName || "",
46
52
  type: "user"
47
53
  });
48
- }) : z.value.forEach((e) => {
49
- V(R.value, e.id) && (R.value = R.value.filter((t) => t.value !== e.id));
54
+ }) : U.value.forEach((e) => {
55
+ G(H.value, e.id) && (H.value = H.value.filter((t) => t.value !== e.id));
50
56
  });
51
57
  }
52
- function U(e, t) {
53
- let n = F[I.value], r = z.value.filter((e) => e.checked);
54
- n.checkAll = r.length === z.value.length && z.value.length > 0, n.indeterminate = r.length > 0 && r.length < z.value.length, e ? V(R.value, t.id) || R.value.push({
58
+ function q(e, t) {
59
+ let n = L(), r = U.value.filter((e) => e.checked);
60
+ n.checkAll = r.length === U.value.length && U.value.length > 0, n.indeterminate = r.length > 0 && r.length < U.value.length, e ? G(H.value, t.id) || H.value.push({
55
61
  value: t.id,
56
62
  label: t.realName || "",
57
63
  type: "user"
58
- }) : V(R.value, t.id) && (R.value = R.value.filter((e) => e.value !== t.id));
64
+ }) : G(H.value, t.id) && (H.value = H.value.filter((e) => e.value !== t.id));
59
65
  }
60
- function W(e) {
61
- L.value = e;
66
+ function J(e) {
67
+ V.value = e;
62
68
  }
63
- function G(e) {
64
- R.value = R.value.filter((t) => t.value !== e), M.value.forEach((t) => {
69
+ function Y(e) {
70
+ H.value = H.value.filter((t) => t.value !== e), P.value.forEach((t) => {
65
71
  t.id === e && (t.checked = !1);
66
- }), I.value && (F[I.value] = B());
72
+ }), B.value && (R[B.value] = W());
67
73
  }
68
- function K(e) {
69
- R.value = R.value.filter((t) => !e.includes(t.value)), M.value.forEach((t) => {
74
+ function X(e) {
75
+ H.value = H.value.filter((t) => !e.includes(t.value)), P.value.forEach((t) => {
70
76
  e.includes(t.id) && (t.checked = !1);
71
- }), I.value && (F[I.value] = B());
77
+ }), B.value && (R[B.value] = W());
72
78
  }
73
- function q() {
74
- P.value.checkAll = !1, P.value.indeterminate = !1, R.value = [], M.value.forEach((e) => {
79
+ function Z() {
80
+ let e = L();
81
+ e.checkAll = !1, e.indeterminate = !1, H.value = [], P.value.forEach((e) => {
75
82
  e.checked = !1;
76
83
  });
77
84
  }
78
- function J(e) {
79
- R.value = e;
85
+ function Q(e) {
86
+ H.value = e.map((e) => ({
87
+ ...e,
88
+ type: "user"
89
+ }));
80
90
  }
81
- return k({
82
- delFn: G,
83
- reset: q,
84
- deleteAll: K,
85
- echo: J
86
- }), (t, n) => (m(), c("div", T, [d(r, {
87
- modelValue: I.value,
88
- "onUpdate:modelValue": n[0] ||= (e) => I.value = e,
91
+ return j({
92
+ delFn: Y,
93
+ reset: Z,
94
+ deleteAll: X,
95
+ echo: Q
96
+ }), (t, n) => (m(), c("div", D, [d(r, {
97
+ modelValue: B.value,
98
+ "onUpdate:modelValue": n[0] ||= (e) => B.value = e,
89
99
  style: { width: "280px" }
90
- }, null, 8, ["modelValue"]), l("div", E, [d(v(w), { spinning: v(N) }, {
100
+ }, null, 8, ["modelValue"]), l("div", O, [d(v(E), { spinning: v(F) }, {
91
101
  default: b(() => [
92
- d(v(C), {
93
- value: L.value,
94
- "onUpdate:value": n[1] ||= (e) => L.value = e,
95
- placeholder: "请输入用户名称",
96
- onSearch: W
102
+ d(v(T), {
103
+ value: V.value,
104
+ "onUpdate:value": n[1] ||= (e) => V.value = e,
105
+ "allow-clear": "",
106
+ placeholder: "搜索用户",
107
+ onSearch: J
97
108
  }, null, 8, ["value"]),
98
- z.value.length > 0 ? (m(), o(v(x), {
109
+ v(I) ? (m(), o(v(x), {
99
110
  key: 0,
100
- checked: P.value.checkAll,
101
- "onUpdate:checked": n[2] ||= (e) => P.value.checkAll = e,
111
+ class: "selector-feedback",
112
+ type: "error",
113
+ message: v(I),
114
+ "show-icon": ""
115
+ }, {
116
+ action: b(() => [d(v(S), {
117
+ type: "link",
118
+ size: "small",
119
+ onClick: n[2] ||= (e) => v(N)(B.value)
120
+ }, {
121
+ default: b(() => [...n[4] ||= [u("重试", -1)]]),
122
+ _: 1
123
+ })]),
124
+ _: 1
125
+ }, 8, ["message"])) : s("", !0),
126
+ U.value.length > 0 ? (m(), o(v(C), {
127
+ key: 1,
128
+ checked: z.value.checkAll,
129
+ "onUpdate:checked": n[3] ||= (e) => z.value.checkAll = e,
102
130
  style: {
103
131
  "margin-top": "12px",
104
132
  "margin-left": "6px"
105
133
  },
106
- indeterminate: P.value.indeterminate,
107
- onChange: H
134
+ indeterminate: z.value.indeterminate,
135
+ onChange: K
108
136
  }, {
109
- default: b(() => [...n[3] ||= [u(" 全选 ", -1)]]),
137
+ default: b(() => [...n[5] ||= [u(" 全选 ", -1)]]),
110
138
  _: 1
111
139
  }, 8, ["checked", "indeterminate"])) : s("", !0),
112
- l("div", D, [z.value.length > 0 ? (m(), c("div", O, [(m(!0), c(i, null, _(z.value, (t) => (m(), c("div", { key: t.id }, [d(v(e), {
140
+ l("div", k, [U.value.length > 0 ? (m(), c("div", A, [(m(!0), c(i, null, _(U.value, (t) => (m(), c("div", { key: t.id }, [d(v(e), {
113
141
  "user-info": t,
114
- onChangeChecked: U
115
- }, null, 8, ["user-info"])]))), 128))])) : (m(), o(v(S), {
142
+ onChangeChecked: q
143
+ }, null, 8, ["user-info"])]))), 128))])) : v(I) ? s("", !0) : (m(), o(v(w), {
116
144
  key: 1,
117
- image: v(S).PRESENTED_IMAGE_SIMPLE
145
+ image: v(w).PRESENTED_IMAGE_SIMPLE,
146
+ description: "暂无用户"
118
147
  }, null, 8, ["image"]))])
119
148
  ]),
120
149
  _: 1
@@ -122,4 +151,4 @@ var T = { class: "type-selector-box user-selector" }, E = { style: { width: "280
122
151
  }
123
152
  });
124
153
  //#endregion
125
- export { k as default };
154
+ export { j as default };
@@ -5,54 +5,71 @@ var t = /* @__PURE__ */ function(e) {
5
5
  }({});
6
6
  function n(n, r = "") {
7
7
  if (!n) throw Error("http is required");
8
- let i = e([]), a = e([]), o = e(!1), s = e([]);
8
+ let i = e([]), a = e([]), o = e(!1), s = e([]), c = e(!1), l = e(!1), u = e(""), d = e(""), f = e(""), p = 0;
9
9
  return {
10
10
  getDeptTree: async () => {
11
+ c.value = !0, u.value = "";
11
12
  try {
12
13
  let e = await n.get(`${r}${t.GET_DEPT}`);
13
- return e.status === 0 ? (i.value = e.data, e.data) : [];
14
- } catch (e) {
15
- return console.error(e), [];
14
+ return e.status === 0 ? (i.value = Array.isArray(e.data) ? e.data : [], i.value) : (u.value = "部门数据加载失败,请重试", []);
15
+ } catch {
16
+ return u.value = "部门数据加载失败,请重试", [];
17
+ } finally {
18
+ c.value = !1;
16
19
  }
17
20
  },
18
21
  getUserListByDeptId: async (e) => {
22
+ let i = ++p;
23
+ d.value = "";
19
24
  try {
20
25
  o.value = !0;
21
- let i = await n.get(`${r}${t.GET_USER_BY_DEPT_ID}?deptId=${e}&pageSIze=1000&pageNum=1`);
22
- return i.status === 0 ? (a.value = i.data.list.map((e) => ({
23
- ...e,
24
- id: e.userId,
25
- userId: e.userId,
26
- deptId: e.deptId,
27
- realName: e.userInfo?.realName || "",
28
- phone: e.userInfo?.phone || ""
29
- })), i.data) : [];
30
- } catch (e) {
31
- return console.error(e), [];
26
+ let s = await n.get(`${r}${t.GET_USER_BY_DEPT_ID}?deptId=${e}&pageSIze=1000&pageNum=1`);
27
+ if (s.status === 0) {
28
+ let e = (Array.isArray(s.data?.list) ? s.data.list : []).map((e) => ({
29
+ ...e,
30
+ id: e.userId,
31
+ userId: e.userId,
32
+ deptId: e.deptId,
33
+ realName: e.userInfo?.realName || "",
34
+ phone: e.userInfo?.phone || ""
35
+ }));
36
+ return i === p && (a.value = e), e;
37
+ }
38
+ return i === p && (d.value = "用户数据加载失败,请重试"), [];
39
+ } catch {
40
+ return i === p && (d.value = "用户数据加载失败,请重试"), [];
32
41
  } finally {
33
- o.value = !1;
42
+ i === p && (o.value = !1);
34
43
  }
35
44
  },
36
45
  getUser: async () => {
37
46
  try {
38
47
  let e = await n.get(`${r}${t.GET_USER}`);
39
48
  return e.status === 0 ? e.data : [];
40
- } catch (e) {
41
- return console.error(e), [];
49
+ } catch {
50
+ return [];
42
51
  }
43
52
  },
44
53
  getRole: async () => {
54
+ l.value = !0, f.value = "";
45
55
  try {
46
56
  let e = await n.get(`${r}${t.GET_ROLE}`);
47
- return e.status === 0 ? (s.value = e.data.list || [], e.data.list || []) : [];
48
- } catch (e) {
49
- return console.error(e), [];
57
+ return e.status === 0 ? (s.value = e.data.list || [], e.data.list || []) : (f.value = "角色数据加载失败,请重试", []);
58
+ } catch {
59
+ return f.value = "角色数据加载失败,请重试", [];
60
+ } finally {
61
+ l.value = !1;
50
62
  }
51
63
  },
52
64
  deptTree: i,
53
65
  userList: a,
54
66
  roleList: s,
55
- userLoading: o
67
+ userLoading: o,
68
+ deptLoading: c,
69
+ roleLoading: l,
70
+ deptError: u,
71
+ userError: d,
72
+ roleError: f
56
73
  };
57
74
  }
58
75
  //#endregion