@wuxiaolins/form 0.0.10

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 (118) hide show
  1. package/README.md +297 -0
  2. package/dist/es/_virtual/_plugin-vue_export-helper.js +1 -0
  3. package/dist/es/assets/UserAvatar.vue_vue_type_style_index_0_scoped_1f5ca2f1_lang-c84fa0dd.css +1 -0
  4. package/dist/es/assets/UserSelector.vue_vue_type_style_index_0_scoped_d1da15a2_lang-10fe93cf.css +1 -0
  5. package/dist/es/assets/UserSelector.vue_vue_type_style_index_0_scoped_e5931f05_lang-cc9e9617.css +1 -0
  6. package/dist/es/assets/index.vue_vue_type_style_index_0_scoped_20d7bb32_lang-1a84b608.css +1 -0
  7. package/dist/es/assets/index.vue_vue_type_style_index_0_scoped_2decce67_lang-3aa03f71.css +1 -0
  8. package/dist/es/assets/index.vue_vue_type_style_index_0_scoped_3bc314b8_lang-55157ef2.css +1 -0
  9. package/dist/es/assets/index.vue_vue_type_style_index_0_scoped_67c7d6a5_lang-8a12956d.css +1 -0
  10. package/dist/es/assets/index.vue_vue_type_style_index_0_scoped_95db6420_lang-9bcc3df8.css +1 -0
  11. package/dist/es/assets/index.vue_vue_type_style_index_0_scoped_b4ba048a_lang-d7e21de3.css +1 -0
  12. package/dist/es/assets/index.vue_vue_type_style_index_0_scoped_ceac5a29_lang-44bd119a.css +1 -0
  13. package/dist/es/assets/index.vue_vue_type_style_index_0_scoped_ef6eae82_lang-68f222b0.css +1 -0
  14. package/dist/es/assets/index.vue_vue_type_style_index_1_lang-14e3eb9c.css +1 -0
  15. package/dist/es/form/approval-flow/UserAvatar.vue.js +1 -0
  16. package/dist/es/form/approval-flow/UserAvatar.vue2.js +1 -0
  17. package/dist/es/form/approval-flow/UserSelector.vue.js +1 -0
  18. package/dist/es/form/approval-flow/UserSelector.vue2.js +1 -0
  19. package/dist/es/form/approval-flow/index.js +1 -0
  20. package/dist/es/form/approval-flow/src/index.vue.js +1 -0
  21. package/dist/es/form/approval-flow/src/index.vue2.js +1 -0
  22. package/dist/es/form/checkbox-field/index.js +1 -0
  23. package/dist/es/form/checkbox-field/src/index.vue.js +1 -0
  24. package/dist/es/form/checkbox-field/src/index.vue2.js +1 -0
  25. package/dist/es/form/date-field/index.js +1 -0
  26. package/dist/es/form/date-field/src/index.vue.js +1 -0
  27. package/dist/es/form/date-field/src/index.vue2.js +1 -0
  28. package/dist/es/form/date-range-field/index.js +1 -0
  29. package/dist/es/form/date-range-field/src/index.vue.js +1 -0
  30. package/dist/es/form/date-range-field/src/index.vue2.js +1 -0
  31. package/dist/es/form/department-field/index.js +1 -0
  32. package/dist/es/form/department-field/src/index.vue.js +1 -0
  33. package/dist/es/form/department-field/src/index.vue2.js +1 -0
  34. package/dist/es/form/dingtalk-form/index.js +1 -0
  35. package/dist/es/form/dingtalk-form/src/index.vue.js +1 -0
  36. package/dist/es/form/dingtalk-form/src/index.vue2.js +1 -0
  37. package/dist/es/form/form-render/index.js +1 -0
  38. package/dist/es/form/form-render/src/index.vue.js +1 -0
  39. package/dist/es/form/form-render/src/index.vue2.js +1 -0
  40. package/dist/es/form/input/index.js +1 -0
  41. package/dist/es/form/input/src/index.vue.js +1 -0
  42. package/dist/es/form/input/src/index.vue2.js +1 -0
  43. package/dist/es/form/number-field/index.js +1 -0
  44. package/dist/es/form/number-field/src/index.vue.js +1 -0
  45. package/dist/es/form/number-field/src/index.vue2.js +1 -0
  46. package/dist/es/form/radio-field/index.js +1 -0
  47. package/dist/es/form/radio-field/src/index.vue.js +1 -0
  48. package/dist/es/form/radio-field/src/index.vue2.js +1 -0
  49. package/dist/es/form/select-field/index.js +1 -0
  50. package/dist/es/form/select-field/src/index.vue.js +1 -0
  51. package/dist/es/form/select-field/src/index.vue2.js +1 -0
  52. package/dist/es/form/signature-field/index.js +1 -0
  53. package/dist/es/form/signature-field/src/index.vue.js +1 -0
  54. package/dist/es/form/signature-field/src/index.vue2.js +1 -0
  55. package/dist/es/form/switch-field/index.js +1 -0
  56. package/dist/es/form/switch-field/src/index.vue.js +1 -0
  57. package/dist/es/form/switch-field/src/index.vue2.js +1 -0
  58. package/dist/es/form/table-field/index.js +1 -0
  59. package/dist/es/form/table-field/src/index.vue.js +1 -0
  60. package/dist/es/form/table-field/src/index.vue2.js +1 -0
  61. package/dist/es/form/text-field/index.js +1 -0
  62. package/dist/es/form/text-field/src/index.vue.js +1 -0
  63. package/dist/es/form/text-field/src/index.vue2.js +1 -0
  64. package/dist/es/form/textarea-field/index.js +1 -0
  65. package/dist/es/form/textarea-field/src/index.vue.js +1 -0
  66. package/dist/es/form/textarea-field/src/index.vue2.js +1 -0
  67. package/dist/es/form/upload-field/index.js +1 -0
  68. package/dist/es/form/upload-field/src/index.vue.js +1 -0
  69. package/dist/es/form/upload-field/src/index.vue2.js +1 -0
  70. package/dist/es/index.js +1 -0
  71. package/dist/es/utils/dingtalk-adapter.js +3 -0
  72. package/dist/index.es.js +2431 -0
  73. package/dist/index.umd.js +3 -0
  74. package/dist/style.css +1 -0
  75. package/dist/types/form/approval-flow/index.d.ts +4 -0
  76. package/dist/types/form/approval-flow/index.d.ts.map +1 -0
  77. package/dist/types/form/approval-flow/types.d.ts +17 -0
  78. package/dist/types/form/approval-flow/types.d.ts.map +1 -0
  79. package/dist/types/form/checkbox-field/index.d.ts +2 -0
  80. package/dist/types/form/checkbox-field/index.d.ts.map +1 -0
  81. package/dist/types/form/date-field/index.d.ts +2 -0
  82. package/dist/types/form/date-field/index.d.ts.map +1 -0
  83. package/dist/types/form/date-range-field/index.d.ts +2 -0
  84. package/dist/types/form/date-range-field/index.d.ts.map +1 -0
  85. package/dist/types/form/department-field/index.d.ts +2 -0
  86. package/dist/types/form/department-field/index.d.ts.map +1 -0
  87. package/dist/types/form/dingtalk-form/index.d.ts +2 -0
  88. package/dist/types/form/dingtalk-form/index.d.ts.map +1 -0
  89. package/dist/types/form/form-render/index.d.ts +2 -0
  90. package/dist/types/form/form-render/index.d.ts.map +1 -0
  91. package/dist/types/form/input/index.d.ts +2 -0
  92. package/dist/types/form/input/index.d.ts.map +1 -0
  93. package/dist/types/form/number-field/index.d.ts +2 -0
  94. package/dist/types/form/number-field/index.d.ts.map +1 -0
  95. package/dist/types/form/radio-field/index.d.ts +2 -0
  96. package/dist/types/form/radio-field/index.d.ts.map +1 -0
  97. package/dist/types/form/select-field/index.d.ts +2 -0
  98. package/dist/types/form/select-field/index.d.ts.map +1 -0
  99. package/dist/types/form/signature-field/index.d.ts +2 -0
  100. package/dist/types/form/signature-field/index.d.ts.map +1 -0
  101. package/dist/types/form/switch-field/index.d.ts +2 -0
  102. package/dist/types/form/switch-field/index.d.ts.map +1 -0
  103. package/dist/types/form/table-field/index.d.ts +3 -0
  104. package/dist/types/form/table-field/index.d.ts.map +1 -0
  105. package/dist/types/form/text-field/index.d.ts +2 -0
  106. package/dist/types/form/text-field/index.d.ts.map +1 -0
  107. package/dist/types/form/textarea-field/index.d.ts +2 -0
  108. package/dist/types/form/textarea-field/index.d.ts.map +1 -0
  109. package/dist/types/form/upload-field/index.d.ts +2 -0
  110. package/dist/types/form/upload-field/index.d.ts.map +1 -0
  111. package/dist/types/index.d.ts +23 -0
  112. package/dist/types/index.d.ts.map +1 -0
  113. package/dist/types/types/form-types.d.ts +201 -0
  114. package/dist/types/types/form-types.d.ts.map +1 -0
  115. package/dist/types/utils/dingtalk-adapter.d.ts +359 -0
  116. package/dist/types/utils/dingtalk-adapter.d.ts.map +1 -0
  117. package/dist/uno.css +34 -0
  118. package/package.json +88 -0
@@ -0,0 +1,2431 @@
1
+ import { defineComponent as j, openBlock as p, createElementBlock as _, computed as O, createBlock as U, unref as v, ref as z, watch as Q, onMounted as De, onUnmounted as Ge, createElementVNode as m, toDisplayString as N, createVNode as T, withCtx as k, createTextVNode as J, createCommentVNode as x, Fragment as K, renderList as Z, resolveDynamicComponent as fe, mergeProps as oe, reactive as be, resolveComponent as ye, renderSlot as Ce, normalizeClass as He, createSlots as Qe, normalizeStyle as he, withModifiers as we, withDirectives as Ze, vModelCheckbox as ea } from "vue";
2
+ import { Input as Ae, InputNumber as aa, Select as la, Radio as ta, Checkbox as ke, DatePicker as Fe, RangePicker as oa, Switch as sa, Upload as ra, Button as H, message as X, TreeSelect as na, Modal as Ke, Space as ia, Row as _e, Col as Se, FormItem as da, Form as xe, Collapse as je, Spin as ua, Tabs as Pe, Tree as ca, Tag as pa, Empty as ma } from "ant-design-vue";
3
+ import W from "dayjs";
4
+ import { UploadOutlined as Je, EditOutlined as qe, DeleteOutlined as fa, PlusOutlined as ha, SearchOutlined as va, TeamOutlined as ga } from "@ant-design/icons-vue";
5
+ const ya = /* @__PURE__ */ j({
6
+ __name: "index",
7
+ setup(D) {
8
+ return (e, i) => (p(), _("div", null, "input"));
9
+ }
10
+ });
11
+ const le = (D, e) => {
12
+ const i = D.__vccOpts || D;
13
+ for (const [s, o] of e)
14
+ i[s] = o;
15
+ return i;
16
+ }, Kl = /* @__PURE__ */ le(ya, [["__scopeId", "data-v-20d7bb32"]]), se = /* @__PURE__ */ j({
17
+ __name: "index",
18
+ props: {
19
+ modelValue: { default: "" },
20
+ placeholder: { default: "请输入" },
21
+ disabled: { type: Boolean, default: !1 },
22
+ readonly: { type: Boolean, default: !1 },
23
+ maxLength: { default: void 0 },
24
+ showCount: { type: Boolean, default: !1 },
25
+ allowClear: { type: Boolean, default: !0 },
26
+ size: { default: "middle" },
27
+ prefix: { default: void 0 },
28
+ suffix: { default: void 0 }
29
+ },
30
+ emits: ["update:modelValue", "change", "blur", "focus"],
31
+ setup(D, { emit: e }) {
32
+ const i = D, s = e, o = O({
33
+ get: () => i.modelValue,
34
+ set: (n) => s("update:modelValue", n)
35
+ }), t = (n) => {
36
+ const r = n.target;
37
+ s("change", r.value);
38
+ }, a = (n) => {
39
+ s("blur", n);
40
+ }, l = (n) => {
41
+ s("focus", n);
42
+ };
43
+ return (n, r) => (p(), U(v(Ae), {
44
+ value: o.value,
45
+ "onUpdate:value": r[0] || (r[0] = (u) => o.value = u),
46
+ placeholder: n.placeholder,
47
+ disabled: n.disabled,
48
+ readonly: n.readonly,
49
+ maxlength: n.maxLength,
50
+ "show-count": n.showCount,
51
+ "allow-clear": n.allowClear,
52
+ size: n.size,
53
+ prefix: n.prefix,
54
+ suffix: n.suffix,
55
+ onChange: t,
56
+ onBlur: a,
57
+ onFocus: l
58
+ }, null, 8, ["value", "placeholder", "disabled", "readonly", "maxlength", "show-count", "allow-clear", "size", "prefix", "suffix"]));
59
+ }
60
+ }), Te = /* @__PURE__ */ j({
61
+ __name: "index",
62
+ props: {
63
+ modelValue: { default: "" },
64
+ placeholder: { default: "请输入" },
65
+ disabled: { type: Boolean, default: !1 },
66
+ readonly: { type: Boolean, default: !1 },
67
+ maxLength: { default: void 0 },
68
+ showCount: { type: Boolean, default: !1 },
69
+ allowClear: { type: Boolean, default: !0 },
70
+ rows: { default: 4 },
71
+ autoSize: { type: [Boolean, Object], default: !1 }
72
+ },
73
+ emits: ["update:modelValue", "change", "blur", "focus"],
74
+ setup(D, { emit: e }) {
75
+ const { TextArea: i } = Ae, s = D, o = e, t = O({
76
+ get: () => s.modelValue,
77
+ set: (r) => o("update:modelValue", r)
78
+ }), a = (r) => {
79
+ const u = r.target;
80
+ o("change", u.value);
81
+ }, l = (r) => {
82
+ o("blur", r);
83
+ }, n = (r) => {
84
+ o("focus", r);
85
+ };
86
+ return (r, u) => (p(), U(v(i), {
87
+ value: t.value,
88
+ "onUpdate:value": u[0] || (u[0] = ($) => t.value = $),
89
+ placeholder: r.placeholder,
90
+ disabled: r.disabled,
91
+ readonly: r.readonly,
92
+ maxlength: r.maxLength,
93
+ "show-count": r.showCount,
94
+ "allow-clear": r.allowClear,
95
+ rows: r.rows,
96
+ "auto-size": r.autoSize,
97
+ onChange: a,
98
+ onBlur: l,
99
+ onFocus: n
100
+ }, null, 8, ["value", "placeholder", "disabled", "readonly", "maxlength", "show-count", "allow-clear", "rows", "auto-size"]));
101
+ }
102
+ }), $e = /* @__PURE__ */ j({
103
+ __name: "index",
104
+ props: {
105
+ modelValue: { default: void 0 },
106
+ placeholder: { default: "请输入数字" },
107
+ disabled: { type: Boolean, default: !1 },
108
+ readonly: { type: Boolean, default: !1 },
109
+ min: { default: void 0 },
110
+ max: { default: void 0 },
111
+ step: { default: 1 },
112
+ precision: { default: void 0 },
113
+ size: { default: "middle" },
114
+ controls: { type: Boolean, default: !0 },
115
+ formatter: { type: Function, default: void 0 },
116
+ parser: { type: Function, default: void 0 }
117
+ },
118
+ emits: ["update:modelValue", "change", "blur", "focus"],
119
+ setup(D, { emit: e }) {
120
+ const i = D, s = e, o = O({
121
+ get: () => i.modelValue,
122
+ set: (n) => s("update:modelValue", n)
123
+ }), t = (n) => {
124
+ const r = typeof n == "string" ? Number(n) : n;
125
+ s("change", r ?? void 0);
126
+ }, a = (n) => {
127
+ s("blur", n);
128
+ }, l = (n) => {
129
+ s("focus", n);
130
+ };
131
+ return (n, r) => (p(), U(v(aa), {
132
+ value: o.value,
133
+ "onUpdate:value": r[0] || (r[0] = (u) => o.value = u),
134
+ placeholder: n.placeholder,
135
+ disabled: n.disabled,
136
+ readonly: n.readonly,
137
+ min: n.min,
138
+ max: n.max,
139
+ step: n.step,
140
+ precision: n.precision,
141
+ size: n.size,
142
+ controls: n.controls,
143
+ formatter: n.formatter,
144
+ parser: n.parser,
145
+ style: { width: "100%" },
146
+ onChange: t,
147
+ onBlur: a,
148
+ onFocus: l
149
+ }, null, 8, ["value", "placeholder", "disabled", "readonly", "min", "max", "step", "precision", "size", "controls", "formatter", "parser"]));
150
+ }
151
+ }), Ve = /* @__PURE__ */ j({
152
+ __name: "index",
153
+ props: {
154
+ modelValue: { default: void 0 },
155
+ options: { default: () => [] },
156
+ placeholder: { default: "请选择" },
157
+ disabled: { type: Boolean, default: !1 },
158
+ allowClear: { type: Boolean, default: !0 },
159
+ showSearch: { type: Boolean, default: !1 },
160
+ mode: { default: void 0 },
161
+ size: { default: "middle" },
162
+ maxTagCount: { default: void 0 },
163
+ filterOption: { type: [Boolean, Function], default: void 0 }
164
+ },
165
+ emits: ["update:modelValue", "change", "search"],
166
+ setup(D, { emit: e }) {
167
+ const i = D, s = e, o = O({
168
+ get: () => i.modelValue,
169
+ set: (l) => s("update:modelValue", l)
170
+ }), t = (l) => {
171
+ l !== void 0 && s("change", l);
172
+ }, a = (l) => {
173
+ s("search", l);
174
+ };
175
+ return (l, n) => (p(), U(v(la), {
176
+ value: o.value,
177
+ "onUpdate:value": n[0] || (n[0] = (r) => o.value = r),
178
+ options: l.options,
179
+ placeholder: l.placeholder,
180
+ disabled: l.disabled,
181
+ "allow-clear": l.allowClear,
182
+ "show-search": l.showSearch,
183
+ mode: l.mode,
184
+ size: l.size,
185
+ "max-tag-count": l.maxTagCount,
186
+ "filter-option": l.filterOption,
187
+ style: { width: "100%" },
188
+ onChange: t,
189
+ onSearch: a
190
+ }, null, 8, ["value", "options", "placeholder", "disabled", "allow-clear", "show-search", "mode", "size", "max-tag-count", "filter-option"]));
191
+ }
192
+ }), Be = /* @__PURE__ */ j({
193
+ __name: "index",
194
+ props: {
195
+ modelValue: { default: void 0 },
196
+ options: { default: () => [] },
197
+ disabled: { type: Boolean, default: !1 },
198
+ buttonStyle: { default: "outline" },
199
+ size: { default: "default" },
200
+ optionType: { default: "default" }
201
+ },
202
+ emits: ["update:modelValue", "change"],
203
+ setup(D, { emit: e }) {
204
+ const i = ta.Group, s = D, o = e, t = O({
205
+ get: () => s.modelValue,
206
+ set: (l) => {
207
+ l !== void 0 && o("update:modelValue", l);
208
+ }
209
+ }), a = (l) => {
210
+ o("change", l.target.value);
211
+ };
212
+ return (l, n) => (p(), U(v(i), {
213
+ value: t.value,
214
+ "onUpdate:value": n[0] || (n[0] = (r) => t.value = r),
215
+ disabled: l.disabled,
216
+ "button-style": l.buttonStyle,
217
+ size: l.size,
218
+ "option-type": l.optionType,
219
+ options: l.options,
220
+ onChange: a
221
+ }, null, 8, ["value", "disabled", "button-style", "size", "option-type", "options"]));
222
+ }
223
+ }), Ue = /* @__PURE__ */ j({
224
+ __name: "index",
225
+ props: {
226
+ modelValue: { default: () => [] },
227
+ options: { default: () => [] },
228
+ disabled: { type: Boolean, default: !1 }
229
+ },
230
+ emits: ["update:modelValue", "change"],
231
+ setup(D, { emit: e }) {
232
+ const i = ke.Group, s = D, o = e, t = O({
233
+ get: () => s.modelValue,
234
+ set: (l) => o("update:modelValue", l)
235
+ }), a = (l) => {
236
+ o("change", l);
237
+ };
238
+ return (l, n) => (p(), U(v(i), {
239
+ value: t.value,
240
+ "onUpdate:value": n[0] || (n[0] = (r) => t.value = r),
241
+ options: l.options,
242
+ disabled: l.disabled,
243
+ onChange: a
244
+ }, null, 8, ["value", "options", "disabled"]));
245
+ }
246
+ }), Re = /* @__PURE__ */ j({
247
+ __name: "index",
248
+ props: {
249
+ modelValue: { default: void 0 },
250
+ placeholder: { default: "请选择日期" },
251
+ disabled: { type: Boolean, default: !1 },
252
+ allowClear: { type: Boolean, default: !0 },
253
+ format: { default: "YYYY-MM-DD" },
254
+ valueFormat: { default: void 0 },
255
+ showTime: { type: Boolean, default: !1 },
256
+ showToday: { type: Boolean, default: !0 },
257
+ size: { default: "middle" },
258
+ picker: { default: "date" },
259
+ disabledDate: { type: Function, default: void 0 }
260
+ },
261
+ emits: ["update:modelValue", "change", "ok"],
262
+ setup(D, { emit: e }) {
263
+ const i = D, s = e, o = O({
264
+ get: () => i.modelValue,
265
+ set: (l) => s("update:modelValue", l)
266
+ }), t = (l) => {
267
+ s("change", l ?? void 0);
268
+ }, a = (l) => {
269
+ s("ok", l);
270
+ };
271
+ return (l, n) => {
272
+ var r;
273
+ return p(), U(v(Fe), {
274
+ value: o.value,
275
+ "onUpdate:value": n[0] || (n[0] = (u) => o.value = u),
276
+ placeholder: l.placeholder,
277
+ disabled: l.disabled,
278
+ "allow-clear": l.allowClear,
279
+ format: (r = l.format) == null ? void 0 : r.toUpperCase(),
280
+ "value-format": l.valueFormat,
281
+ "show-time": l.showTime,
282
+ "show-today": l.showToday,
283
+ size: l.size,
284
+ picker: l.picker,
285
+ "disabled-date": l.disabledDate,
286
+ style: { width: "100%" },
287
+ onChange: t,
288
+ onOk: a
289
+ }, null, 8, ["value", "placeholder", "disabled", "allow-clear", "format", "value-format", "show-time", "show-today", "size", "picker", "disabled-date"]);
290
+ };
291
+ }
292
+ }), ba = {
293
+ key: 0,
294
+ class: "date-range-field-mobile"
295
+ }, Ca = { class: "date-field-wrapper" }, wa = { class: "date-field-label" }, ka = { class: "date-field-separator" }, Fa = { class: "date-field-wrapper" }, _a = { class: "date-field-label" }, Sa = /* @__PURE__ */ j({
296
+ __name: "index",
297
+ props: {
298
+ modelValue: { default: void 0 },
299
+ placeholder: { default: () => ["开始日期", "结束日期"] },
300
+ disabled: { type: Boolean, default: !1 },
301
+ allowClear: { type: Boolean, default: !0 },
302
+ format: { default: "YYYY-MM-DD" },
303
+ valueFormat: { default: void 0 },
304
+ showTime: { type: Boolean, default: !1 },
305
+ size: { default: "middle" },
306
+ picker: { default: "date" },
307
+ disabledDate: { type: Function, default: void 0 },
308
+ separator: { default: "~" },
309
+ mobileMode: { type: Boolean, default: void 0 },
310
+ mobileBreakpoint: { default: 768 }
311
+ },
312
+ emits: ["update:modelValue", "change", "ok"],
313
+ setup(D, { emit: e }) {
314
+ const i = D, s = e, o = z(!1), t = z(0), a = z(), l = z(), n = () => {
315
+ t.value = window.innerWidth, o.value = t.value < i.mobileBreakpoint;
316
+ }, r = O(() => i.mobileMode !== void 0 ? i.mobileMode : o.value), u = O({
317
+ get: () => i.modelValue,
318
+ set: (f) => s("update:modelValue", f)
319
+ });
320
+ Q(
321
+ () => i.modelValue,
322
+ (f) => {
323
+ f && Array.isArray(f) && f.length === 2 ? (a.value = f[0], l.value = f[1]) : (a.value = void 0, l.value = void 0);
324
+ },
325
+ { immediate: !0 }
326
+ );
327
+ const $ = (f) => {
328
+ a.value = f ? W.isDayjs(f) ? f : W(f) : void 0, g();
329
+ }, y = (f) => {
330
+ l.value = f ? W.isDayjs(f) ? f : W(f) : void 0, g();
331
+ }, g = () => {
332
+ if (a.value && l.value) {
333
+ const f = [a.value, l.value];
334
+ s("update:modelValue", f), s("change", f);
335
+ } else
336
+ !a.value && !l.value && (s("update:modelValue", void 0), s("change", void 0));
337
+ }, I = (f) => {
338
+ s("change", f ?? void 0);
339
+ }, b = (f) => {
340
+ s("ok", f);
341
+ }, M = (f) => i.disabledDate && i.disabledDate(f) ? !0 : l.value ? f.isAfter(l.value, "day") : !1, E = (f) => i.disabledDate && i.disabledDate(f) ? !0 : a.value ? f.isBefore(a.value, "day") : !1;
342
+ return De(() => {
343
+ n(), window.addEventListener("resize", n);
344
+ }), Ge(() => {
345
+ window.removeEventListener("resize", n);
346
+ }), (f, Y) => r.value ? (p(), _("div", ba, [
347
+ m("div", Ca, [
348
+ m("label", wa, N(f.placeholder[0]), 1),
349
+ T(v(Fe), {
350
+ value: a.value,
351
+ "onUpdate:value": Y[0] || (Y[0] = (q) => a.value = q),
352
+ placeholder: f.placeholder[0],
353
+ disabled: f.disabled,
354
+ "allow-clear": f.allowClear,
355
+ format: f.format,
356
+ "value-format": f.valueFormat,
357
+ "show-time": f.showTime,
358
+ size: f.size,
359
+ picker: f.picker,
360
+ "disabled-date": M,
361
+ style: { width: "100%" },
362
+ onChange: $
363
+ }, null, 8, ["value", "placeholder", "disabled", "allow-clear", "format", "value-format", "show-time", "size", "picker"])
364
+ ]),
365
+ m("div", ka, [
366
+ m("span", null, N(f.separator), 1)
367
+ ]),
368
+ m("div", Fa, [
369
+ m("label", _a, N(f.placeholder[1]), 1),
370
+ T(v(Fe), {
371
+ value: l.value,
372
+ "onUpdate:value": Y[1] || (Y[1] = (q) => l.value = q),
373
+ placeholder: f.placeholder[1],
374
+ disabled: f.disabled,
375
+ "allow-clear": f.allowClear,
376
+ format: f.format,
377
+ "value-format": f.valueFormat,
378
+ "show-time": f.showTime,
379
+ size: f.size,
380
+ picker: f.picker,
381
+ "disabled-date": E,
382
+ style: { width: "100%" },
383
+ onChange: y
384
+ }, null, 8, ["value", "placeholder", "disabled", "allow-clear", "format", "value-format", "show-time", "size", "picker"])
385
+ ])
386
+ ])) : (p(), U(v(oa), {
387
+ key: 1,
388
+ value: u.value,
389
+ "onUpdate:value": Y[2] || (Y[2] = (q) => u.value = q),
390
+ placeholder: f.placeholder,
391
+ disabled: f.disabled,
392
+ "allow-clear": f.allowClear,
393
+ format: f.format,
394
+ "value-format": f.valueFormat,
395
+ "show-time": f.showTime,
396
+ size: f.size,
397
+ picker: f.picker,
398
+ "disabled-date": f.disabledDate,
399
+ separator: f.separator,
400
+ style: { width: "100%" },
401
+ onChange: I,
402
+ onOk: b
403
+ }, null, 8, ["value", "placeholder", "disabled", "allow-clear", "format", "value-format", "show-time", "size", "picker", "disabled-date", "separator"]));
404
+ }
405
+ });
406
+ const Ie = /* @__PURE__ */ le(Sa, [["__scopeId", "data-v-67c7d6a5"]]), Ne = /* @__PURE__ */ j({
407
+ __name: "index",
408
+ props: {
409
+ modelValue: { type: Boolean, default: !1 },
410
+ disabled: { type: Boolean, default: !1 },
411
+ loading: { type: Boolean, default: !1 },
412
+ size: { default: "default" },
413
+ checkedChildren: { default: void 0 },
414
+ unCheckedChildren: { default: void 0 },
415
+ checkedValue: { type: [Boolean, String, Number], default: !0 },
416
+ unCheckedValue: { type: [Boolean, String, Number], default: !1 }
417
+ },
418
+ emits: ["update:modelValue", "change"],
419
+ setup(D, { emit: e }) {
420
+ const i = D, s = e, o = O({
421
+ get: () => i.modelValue,
422
+ set: (a) => s("update:modelValue", a)
423
+ }), t = (a) => {
424
+ const l = a ? i.checkedValue : i.unCheckedValue;
425
+ s("change", l);
426
+ };
427
+ return (a, l) => (p(), U(v(sa), {
428
+ checked: o.value,
429
+ "onUpdate:checked": l[0] || (l[0] = (n) => o.value = n),
430
+ disabled: a.disabled,
431
+ loading: a.loading,
432
+ size: a.size,
433
+ "checked-children": a.checkedChildren,
434
+ "un-checked-children": a.unCheckedChildren,
435
+ "checked-value": a.checkedValue,
436
+ "un-checked-value": a.unCheckedValue,
437
+ onChange: t
438
+ }, null, 8, ["checked", "disabled", "loading", "size", "checked-children", "un-checked-children", "checked-value", "un-checked-value"]));
439
+ }
440
+ }), Da = { key: 1 }, Aa = { style: { "margin-top": "8px" } }, ze = /* @__PURE__ */ j({
441
+ __name: "index",
442
+ props: {
443
+ modelValue: { default: () => [] },
444
+ action: { default: "/upload" },
445
+ accept: { default: void 0 },
446
+ multiple: { type: Boolean, default: !1 },
447
+ maxCount: { default: 1 },
448
+ maxSize: { default: 10 },
449
+ disabled: { type: Boolean, default: !1 },
450
+ listType: { default: "text" },
451
+ buttonText: { default: "上传文件" },
452
+ headers: { default: void 0 },
453
+ data: { type: [Object, Function], default: void 0 }
454
+ },
455
+ emits: ["update:modelValue", "change", "success", "error"],
456
+ setup(D, { emit: e }) {
457
+ const i = D, s = e, o = O({
458
+ get: () => i.modelValue,
459
+ set: (r) => s("update:modelValue", r)
460
+ }), t = ({ fileList: r }) => {
461
+ o.value = r, s("change", r);
462
+ }, a = (r) => r.size / 1024 / 1024 < i.maxSize ? !0 : (X.error(`文件大小不能超过 ${i.maxSize}MB`), !1), l = (r, u) => {
463
+ s("success", u, r);
464
+ }, n = (r, u) => {
465
+ s("error", u, r), X.error(`${u.name} 上传失败`);
466
+ };
467
+ return (r, u) => (p(), U(v(ra), {
468
+ "file-list": o.value,
469
+ "onUpdate:fileList": u[0] || (u[0] = ($) => o.value = $),
470
+ action: r.action,
471
+ accept: r.accept,
472
+ multiple: r.multiple,
473
+ "max-count": r.maxCount,
474
+ disabled: r.disabled,
475
+ "list-type": r.listType,
476
+ headers: r.headers,
477
+ data: r.data,
478
+ "before-upload": a,
479
+ onChange: t,
480
+ onSuccess: l,
481
+ onError: n
482
+ }, {
483
+ default: k(() => [
484
+ r.listType !== "picture-card" ? (p(), U(v(H), {
485
+ key: 0,
486
+ disabled: r.disabled
487
+ }, {
488
+ default: k(() => [
489
+ T(v(Je)),
490
+ J(" " + N(r.buttonText), 1)
491
+ ]),
492
+ _: 1
493
+ }, 8, ["disabled"])) : (p(), _("div", Da, [
494
+ T(v(Je)),
495
+ m("div", Aa, N(r.buttonText), 1)
496
+ ]))
497
+ ]),
498
+ _: 1
499
+ }, 8, ["file-list", "action", "accept", "multiple", "max-count", "disabled", "list-type", "headers", "data"]));
500
+ }
501
+ }), Me = /* @__PURE__ */ j({
502
+ __name: "index",
503
+ props: {
504
+ modelValue: { default: void 0 },
505
+ placeholder: { default: "请选择部门" },
506
+ disabled: { type: Boolean, default: !1 },
507
+ allowClear: { type: Boolean, default: !0 },
508
+ showSearch: { type: Boolean, default: !0 },
509
+ treeDefaultExpandAll: { type: Boolean, default: !1 },
510
+ treeNodeFilterProp: { default: "label" },
511
+ mode: { default: void 0 },
512
+ apiUrl: { default: "/api/dingtalk/departments" },
513
+ useTreeSelect: { type: Boolean, default: !0 }
514
+ },
515
+ emits: ["update:modelValue", "change", "search"],
516
+ setup(D, { emit: e }) {
517
+ const i = D, s = e, o = O({
518
+ get: () => i.modelValue,
519
+ set: (u) => s("update:modelValue", u)
520
+ }), t = z([
521
+ {
522
+ value: 1,
523
+ label: "技术部",
524
+ children: [
525
+ {
526
+ value: 11,
527
+ label: "技术部A"
528
+ },
529
+ {
530
+ value: 12,
531
+ label: "技术部B"
532
+ }
533
+ ]
534
+ },
535
+ {
536
+ value: 2,
537
+ label: "产品部"
538
+ }
539
+ ]), a = z(!1), l = async () => {
540
+ }, n = (u) => {
541
+ s("change", u);
542
+ }, r = (u) => {
543
+ s("search", u);
544
+ };
545
+ return Q(
546
+ () => i.apiUrl,
547
+ () => {
548
+ l();
549
+ }
550
+ ), De(() => {
551
+ l();
552
+ }), (u, $) => (p(), U(v(na), {
553
+ value: o.value,
554
+ "onUpdate:value": $[0] || ($[0] = (y) => o.value = y),
555
+ "tree-data": t.value,
556
+ placeholder: u.placeholder,
557
+ disabled: u.disabled,
558
+ "allow-clear": u.allowClear,
559
+ "show-search": u.showSearch,
560
+ "tree-default-expand-all": u.treeDefaultExpandAll,
561
+ "tree-node-filter-prop": u.treeNodeFilterProp,
562
+ loading: a.value,
563
+ multiple: u.mode === "multiple",
564
+ "tree-checkable": u.mode === "multiple",
565
+ style: { width: "100%" },
566
+ onChange: n,
567
+ onSearch: r
568
+ }, null, 8, ["value", "tree-data", "placeholder", "disabled", "allow-clear", "show-search", "tree-default-expand-all", "tree-node-filter-prop", "loading", "multiple", "tree-checkable"]));
569
+ }
570
+ }), Ta = { class: "bsy-signature-field" }, $a = {
571
+ key: 0,
572
+ class: "signature-preview"
573
+ }, Va = ["src"], Ba = {
574
+ key: 0,
575
+ class: "signature-actions"
576
+ }, Ua = { class: "signature-modal-content" }, Ra = { class: "canvas-container" }, Ia = ["width", "height"], Na = { class: "signature-modal-actions" }, za = /* @__PURE__ */ j({
577
+ __name: "index",
578
+ props: {
579
+ modelValue: { default: void 0 },
580
+ placeholder: { default: "点击签名" },
581
+ disabled: { type: Boolean, default: !1 },
582
+ width: { default: 400 },
583
+ height: { default: 200 },
584
+ lineWidth: { default: 2 },
585
+ lineColor: { default: "#000000" },
586
+ backgroundColor: { default: "#ffffff" }
587
+ },
588
+ emits: ["update:modelValue", "change"],
589
+ setup(D, { emit: e }) {
590
+ const i = D, s = e, o = O({
591
+ get: () => i.modelValue,
592
+ set: (A) => s("update:modelValue", A)
593
+ }), t = z(), a = z(!1), l = z(!1), n = z(!1);
594
+ let r = null, u = 0, $ = 0;
595
+ const y = () => {
596
+ t.value && (r = t.value.getContext("2d"), r && (r.fillStyle = i.backgroundColor, r.fillRect(0, 0, i.width, i.height), r.strokeStyle = i.lineColor, r.lineWidth = i.lineWidth, r.lineCap = "round", r.lineJoin = "round"));
597
+ }, g = (A) => {
598
+ var C;
599
+ if (i.disabled)
600
+ return;
601
+ l.value = !0, n.value = !0;
602
+ const c = (C = t.value) == null ? void 0 : C.getBoundingClientRect();
603
+ if (c)
604
+ if (A instanceof MouseEvent)
605
+ u = A.clientX - c.left, $ = A.clientY - c.top;
606
+ else {
607
+ const V = A.touches[0];
608
+ u = V.clientX - c.left, $ = V.clientY - c.top;
609
+ }
610
+ }, I = (A) => {
611
+ var L;
612
+ if (!l.value || !r)
613
+ return;
614
+ const c = (L = t.value) == null ? void 0 : L.getBoundingClientRect();
615
+ if (!c)
616
+ return;
617
+ let C = 0, V = 0;
618
+ if (A instanceof MouseEvent)
619
+ C = A.clientX - c.left, V = A.clientY - c.top;
620
+ else {
621
+ A.preventDefault();
622
+ const ee = A.touches[0];
623
+ C = ee.clientX - c.left, V = ee.clientY - c.top;
624
+ }
625
+ r.beginPath(), r.moveTo(u, $), r.lineTo(C, V), r.stroke(), u = C, $ = V;
626
+ }, b = () => {
627
+ l.value = !1;
628
+ }, M = () => {
629
+ r && (r.fillStyle = i.backgroundColor, r.fillRect(0, 0, i.width, i.height), n.value = !1);
630
+ }, E = () => {
631
+ if (!n.value) {
632
+ X.warning("请先签名");
633
+ return;
634
+ }
635
+ if (t.value)
636
+ try {
637
+ const A = t.value.toDataURL("image/png");
638
+ o.value = A, s("change", A), a.value = !1, X.success("签名保存成功");
639
+ } catch (A) {
640
+ console.error("保存签名失败:", A), X.error("保存签名失败");
641
+ }
642
+ }, f = () => {
643
+ i.disabled || (a.value = !0, setTimeout(() => {
644
+ y(), o.value && Y(o.value);
645
+ }, 100));
646
+ }, Y = (A) => {
647
+ if (!r || !t.value)
648
+ return;
649
+ const c = new Image();
650
+ c.onload = () => {
651
+ r.drawImage(c, 0, 0), n.value = !0;
652
+ }, c.src = A;
653
+ }, q = () => {
654
+ o.value = void 0, s("change", void 0), X.success("签名已删除");
655
+ };
656
+ return Q(a, (A) => {
657
+ A || (l.value = !1);
658
+ }), (A, c) => (p(), _("div", Ta, [
659
+ o.value ? (p(), _("div", $a, [
660
+ m("img", {
661
+ src: o.value,
662
+ alt: "签名",
663
+ class: "signature-image"
664
+ }, null, 8, Va),
665
+ A.disabled ? x("", !0) : (p(), _("div", Ba, [
666
+ T(v(H), {
667
+ type: "link",
668
+ size: "small",
669
+ onClick: f
670
+ }, {
671
+ icon: k(() => [
672
+ T(v(qe))
673
+ ]),
674
+ default: k(() => [
675
+ c[2] || (c[2] = J(" 重新签名 "))
676
+ ]),
677
+ _: 1,
678
+ __: [2]
679
+ }),
680
+ T(v(H), {
681
+ type: "link",
682
+ danger: "",
683
+ size: "small",
684
+ onClick: q
685
+ }, {
686
+ icon: k(() => [
687
+ T(v(fa))
688
+ ]),
689
+ default: k(() => [
690
+ c[3] || (c[3] = J(" 删除 "))
691
+ ]),
692
+ _: 1,
693
+ __: [3]
694
+ })
695
+ ]))
696
+ ])) : (p(), U(v(H), {
697
+ key: 1,
698
+ type: "dashed",
699
+ block: "",
700
+ disabled: A.disabled,
701
+ onClick: f
702
+ }, {
703
+ icon: k(() => [
704
+ T(v(qe))
705
+ ]),
706
+ default: k(() => [
707
+ J(" " + N(A.placeholder), 1)
708
+ ]),
709
+ _: 1
710
+ }, 8, ["disabled"])),
711
+ T(v(Ke), {
712
+ open: a.value,
713
+ "onUpdate:open": c[1] || (c[1] = (C) => a.value = C),
714
+ title: "手写签名",
715
+ width: i.width + 80,
716
+ footer: null,
717
+ "mask-closable": !1
718
+ }, {
719
+ default: k(() => [
720
+ m("div", Ua, [
721
+ m("div", Ra, [
722
+ m("canvas", {
723
+ ref_key: "canvasRef",
724
+ ref: t,
725
+ width: i.width,
726
+ height: i.height,
727
+ class: "signature-canvas",
728
+ onMousedown: g,
729
+ onMousemove: I,
730
+ onMouseup: b,
731
+ onMouseleave: b,
732
+ onTouchstart: g,
733
+ onTouchmove: I,
734
+ onTouchend: b
735
+ }, null, 40, Ia)
736
+ ]),
737
+ m("div", Na, [
738
+ T(v(ia), null, {
739
+ default: k(() => [
740
+ T(v(H), {
741
+ type: "primary",
742
+ danger: "",
743
+ onClick: M
744
+ }, {
745
+ default: k(() => c[4] || (c[4] = [
746
+ J("清空")
747
+ ])),
748
+ _: 1,
749
+ __: [4]
750
+ }),
751
+ T(v(H), {
752
+ onClick: c[0] || (c[0] = (C) => a.value = !1)
753
+ }, {
754
+ default: k(() => c[5] || (c[5] = [
755
+ J(" 取消 ")
756
+ ])),
757
+ _: 1,
758
+ __: [5]
759
+ }),
760
+ T(v(H), {
761
+ type: "primary",
762
+ onClick: E
763
+ }, {
764
+ default: k(() => c[6] || (c[6] = [
765
+ J(" 保存 ")
766
+ ])),
767
+ _: 1,
768
+ __: [6]
769
+ })
770
+ ]),
771
+ _: 1
772
+ })
773
+ ])
774
+ ])
775
+ ]),
776
+ _: 1
777
+ }, 8, ["open", "width"])
778
+ ]));
779
+ }
780
+ });
781
+ const Oe = /* @__PURE__ */ le(za, [["__scopeId", "data-v-ef6eae82"]]), Ma = { class: "bsy-table-field" }, Oa = { class: "item-header" }, Ea = { class: "item-index" }, La = { class: "item-content" }, Ya = /* @__PURE__ */ j({
782
+ __name: "index",
783
+ props: {
784
+ modelValue: { default: () => [] },
785
+ children: { default: () => [] },
786
+ actionName: { default: "添加" },
787
+ maxRows: { default: void 0 },
788
+ minRows: { default: void 0 },
789
+ disabled: { type: Boolean, default: !1 },
790
+ labelCol: { default: () => ({ span: 6 }) },
791
+ wrapperCol: { default: () => ({ span: 18 }) }
792
+ },
793
+ emits: ["update:modelValue", "change"],
794
+ setup(D, { emit: e }) {
795
+ var $;
796
+ const i = D, s = e, o = z([]);
797
+ console.log("🎯 TableField 组件初始化"), console.log(" -> props.children:", JSON.stringify(i.children, null, 2)), console.log(" -> props.children 长度:", ($ = i.children) == null ? void 0 : $.length), console.log(" -> props.children 类型:", typeof i.children), console.log(" -> props.children 是数组:", Array.isArray(i.children)), console.log(" -> props.modelValue:", JSON.stringify(i.modelValue, null, 2)), console.log(" -> props.actionName:", i.actionName), Q(
798
+ () => i.modelValue,
799
+ (y) => {
800
+ if (console.log("🔍 TableField modelValue 变化:", y), console.log(" -> 类型:", typeof y), console.log(" -> 是数组:", Array.isArray(y)), console.log(" -> 长度:", y == null ? void 0 : y.length), Array.isArray(y) && y.length > 0)
801
+ console.log(" -> 第一行数据:", y[0]), console.log(" -> 第一行数据类型:", typeof y[0]), console.log(" -> 第一行是数组:", Array.isArray(y[0])), o.value = y.map((g, I) => (console.log(` -> 处理第 ${I + 1} 行:`, g), { ...g })), console.log(" -> tableData 设置为:", o.value);
802
+ else if (o.value.length === 0 && (console.log(" -> 没有初始数据,根据 minRows 添加空行"), i.minRows && i.minRows > 0)) {
803
+ for (let g = 0; g < i.minRows; g++)
804
+ o.value.push(a());
805
+ console.log(" -> 添加了", i.minRows, "个空行");
806
+ }
807
+ },
808
+ { immediate: !0 }
809
+ );
810
+ const t = (y) => ({
811
+ TextField: se,
812
+ TextareaField: Te,
813
+ NumberField: $e,
814
+ SelectField: Ve,
815
+ RadioField: Be,
816
+ CheckboxField: Ue,
817
+ DateField: Re,
818
+ DateRangeField: Ie,
819
+ SwitchField: Ne,
820
+ UploadField: ze,
821
+ DepartmentField: Me,
822
+ SignatureField: Oe
823
+ })[y] || se;
824
+ function a() {
825
+ const y = {};
826
+ return i.children && i.children.forEach((g) => {
827
+ y[g.id] = void 0;
828
+ }), y;
829
+ }
830
+ function l() {
831
+ i.maxRows && o.value.length >= i.maxRows || (o.value.push(a()), u());
832
+ }
833
+ function n(y) {
834
+ i.minRows && o.value.length <= i.minRows || (o.value.splice(y, 1), u());
835
+ }
836
+ function r(y, g, I) {
837
+ o.value[y][g] = I, u();
838
+ }
839
+ function u() {
840
+ const y = o.value.map((g) => ({ ...g }));
841
+ s("update:modelValue", y), s("change", y);
842
+ }
843
+ return (y, g) => (p(), _("div", Ma, [
844
+ (p(!0), _(K, null, Z(o.value, (I, b) => (p(), _("div", {
845
+ key: b,
846
+ class: "table-field-item"
847
+ }, [
848
+ m("div", Oa, [
849
+ m("span", Ea, N(b + 1), 1),
850
+ !y.disabled && !(y.minRows && o.value.length <= y.minRows) ? (p(), U(v(H), {
851
+ key: 0,
852
+ type: "link",
853
+ danger: "",
854
+ size: "small",
855
+ onClick: (M) => n(b)
856
+ }, {
857
+ default: k(() => g[0] || (g[0] = [
858
+ J(" 删除 ")
859
+ ])),
860
+ _: 2,
861
+ __: [0]
862
+ }, 1032, ["onClick"])) : x("", !0)
863
+ ]),
864
+ m("div", La, [
865
+ T(v(_e), { gutter: 16 }, {
866
+ default: k(() => [
867
+ (p(!0), _(K, null, Z(y.children, (M) => (p(), U(v(Se), {
868
+ key: M.id,
869
+ span: M.span || 24
870
+ }, {
871
+ default: k(() => [
872
+ T(v(da), {
873
+ label: M.label,
874
+ "label-col": i.labelCol,
875
+ "wrapper-col": i.wrapperCol,
876
+ required: M.required
877
+ }, {
878
+ default: k(() => [
879
+ (p(), U(fe(t(M.type)), oe({
880
+ "model-value": I[M.id]
881
+ }, { ref_for: !0 }, M.props || {}, {
882
+ disabled: y.disabled,
883
+ "onUpdate:modelValue": (E) => r(b, M.id, E)
884
+ }), null, 16, ["model-value", "disabled", "onUpdate:modelValue"]))
885
+ ]),
886
+ _: 2
887
+ }, 1032, ["label", "label-col", "wrapper-col", "required"])
888
+ ]),
889
+ _: 2
890
+ }, 1032, ["span"]))), 128))
891
+ ]),
892
+ _: 2
893
+ }, 1024)
894
+ ])
895
+ ]))), 128)),
896
+ T(v(H), {
897
+ type: "dashed",
898
+ block: "",
899
+ disabled: y.disabled || !!(y.maxRows && o.value.length >= y.maxRows),
900
+ onClick: l
901
+ }, {
902
+ icon: k(() => [
903
+ T(v(ha))
904
+ ]),
905
+ default: k(() => [
906
+ J(" " + N(y.actionName), 1)
907
+ ]),
908
+ _: 1
909
+ }, 8, ["disabled"])
910
+ ]));
911
+ }
912
+ });
913
+ const Xe = /* @__PURE__ */ le(Ya, [["__scopeId", "data-v-95db6420"]]), xa = {
914
+ key: 0,
915
+ class: "no-schema"
916
+ }, ja = {
917
+ key: 0,
918
+ class: "form-header"
919
+ }, Pa = { key: 0 }, Ja = { key: 1 }, qa = /* @__PURE__ */ j({
920
+ __name: "index",
921
+ props: {
922
+ schema: { default: void 0 },
923
+ modelValue: { default: () => ({}) },
924
+ labelCol: { default: () => ({ span: 6 }) },
925
+ wrapperCol: { default: () => ({ span: 18 }) },
926
+ layout: { default: "horizontal" }
927
+ },
928
+ emits: ["update:modelValue", "change", "submit"],
929
+ setup(D, { emit: e }) {
930
+ const i = D, s = e, o = be({ ...i.modelValue }), t = (r, u) => {
931
+ o[r] = u, s("update:modelValue", { ...o }), s("change", r, u);
932
+ }, a = (r) => ({
933
+ TextField: se,
934
+ TextareaField: Te,
935
+ NumberField: $e,
936
+ SelectField: Ve,
937
+ RadioField: Be,
938
+ CheckboxField: Ue,
939
+ DateField: Re,
940
+ DateRangeField: Ie,
941
+ SwitchField: Ne,
942
+ UploadField: ze,
943
+ TableField: Xe,
944
+ DepartmentField: Me,
945
+ SignatureField: Oe
946
+ })[r] || se, l = (r) => {
947
+ const u = [];
948
+ return r.required && u.push({
949
+ required: !0,
950
+ message: `请输入${r.label}`
951
+ }), r.rules && u.push(...r.rules), u;
952
+ }, n = () => {
953
+ s("submit", { ...o });
954
+ };
955
+ return (r, u) => {
956
+ const $ = ye("AFormItem"), y = ye("AButton"), g = ye("AForm");
957
+ return r.schema ? (p(), U(g, {
958
+ key: 1,
959
+ model: o,
960
+ "label-col": r.labelCol,
961
+ "wrapper-col": r.wrapperCol,
962
+ layout: r.layout,
963
+ onFinish: n
964
+ }, {
965
+ default: k(() => [
966
+ r.schema.title || r.schema.description ? (p(), _("div", ja, [
967
+ r.schema.title ? (p(), _("h3", Pa, N(r.schema.title), 1)) : x("", !0),
968
+ r.schema.description ? (p(), _("p", Ja, N(r.schema.description), 1)) : x("", !0)
969
+ ])) : x("", !0),
970
+ (p(!0), _(K, null, Z(r.schema.fields, (I) => (p(), U($, {
971
+ key: I.id,
972
+ label: I.label,
973
+ name: I.id,
974
+ rules: l(I)
975
+ }, {
976
+ default: k(() => [
977
+ (p(), U(fe(a(I.type)), oe({
978
+ "model-value": o[I.id],
979
+ children: I.children
980
+ }, { ref_for: !0 }, I.props || {}, {
981
+ "onUpdate:modelValue": (b) => t(I.id, b)
982
+ }), null, 16, ["model-value", "children", "onUpdate:modelValue"]))
983
+ ]),
984
+ _: 2
985
+ }, 1032, ["label", "name", "rules"]))), 128)),
986
+ Ce(r.$slots, "footer", { formData: o }, () => [
987
+ T($, {
988
+ "wrapper-col": { offset: r.labelCol.span, span: r.wrapperCol.span }
989
+ }, {
990
+ default: k(() => [
991
+ T(y, {
992
+ type: "primary",
993
+ "html-type": "submit"
994
+ }, {
995
+ default: k(() => u[1] || (u[1] = [
996
+ J("提交")
997
+ ])),
998
+ _: 1,
999
+ __: [1]
1000
+ }),
1001
+ T(y, { style: { "margin-left": "10px" } }, {
1002
+ default: k(() => u[2] || (u[2] = [
1003
+ J("取消")
1004
+ ])),
1005
+ _: 1,
1006
+ __: [2]
1007
+ })
1008
+ ]),
1009
+ _: 1
1010
+ }, 8, ["wrapper-col"])
1011
+ ], !0)
1012
+ ]),
1013
+ _: 3
1014
+ }, 8, ["model", "label-col", "wrapper-col", "layout"])) : (p(), _("div", xa, u[0] || (u[0] = [
1015
+ m("p", null, "暂无表单配置", -1)
1016
+ ])));
1017
+ };
1018
+ }
1019
+ });
1020
+ const Xl = /* @__PURE__ */ le(qa, [["__scopeId", "data-v-3bc314b8"]]);
1021
+ class ie {
1022
+ /**
1023
+ * 解析钉钉表单 Schema
1024
+ * @param response 钉钉 API 返回的 Schema 响应
1025
+ * @returns 标准化的表单 Schema
1026
+ */
1027
+ static parseSchema(e) {
1028
+ let i;
1029
+ try {
1030
+ i = typeof e.schemaContent == "string" ? JSON.parse(e.schemaContent) : e.schemaContent;
1031
+ } catch (o) {
1032
+ throw console.error("解析 Schema 失败:", o), new Error("无效的 Schema 格式");
1033
+ }
1034
+ const s = [];
1035
+ return i.items && Array.isArray(i.items) && (console.log("📋 Schema items 总数:", i.items.length), i.items.forEach((o, t) => {
1036
+ var l, n, r;
1037
+ console.log(`
1038
+ 处理 item ${t + 1}:`, {
1039
+ componentName: o.componentName,
1040
+ id: (l = o.props) == null ? void 0 : l.id,
1041
+ hasChildren: !!o.children,
1042
+ childrenCount: ((n = o.children) == null ? void 0 : n.length) || 0
1043
+ });
1044
+ const a = this.convertSchemaItem(o);
1045
+ a ? (console.log(` ✓ 添加字段: ${a.id} (${a.type}), children: ${((r = a.children) == null ? void 0 : r.length) || 0}`), s.push(a)) : console.log(" ✗ 字段转换失败或被跳过");
1046
+ }), console.log(`
1047
+ 📊 最终 fields 总数:`, s.length)), s.sort((o, t) => (o.order || 0) - (t.order || 0)), console.log("解析后的字段列表:", s), {
1048
+ title: e.name || i.title,
1049
+ description: e.description || i.description,
1050
+ fields: s,
1051
+ gutter: i.gutter,
1052
+ groups: i.groups
1053
+ };
1054
+ }
1055
+ /**
1056
+ * 转换 Schema 项为标准字段
1057
+ * @param item 钉钉 Schema 项
1058
+ * @returns 标准化的表单字段
1059
+ */
1060
+ static convertSchemaItem(e) {
1061
+ var u;
1062
+ const i = ((u = e.props) == null ? void 0 : u.id) || e.id, s = e.componentName;
1063
+ if (!i || !s)
1064
+ return console.warn("字段缺少 id 或 componentName:", e), null;
1065
+ const t = {
1066
+ TextField: "TextField",
1067
+ TextareaField: "TextareaField",
1068
+ NumberField: "NumberField",
1069
+ DDSelectField: "SelectField",
1070
+ DDMultiSelectField: "SelectField",
1071
+ RadioField: "RadioField",
1072
+ CheckboxField: "CheckboxField",
1073
+ DateField: "DateField",
1074
+ DateRangeField: "DateRangeField",
1075
+ DDDateField: "DateField",
1076
+ DDDateRangeField: "DateRangeField",
1077
+ SwitchField: "SwitchField",
1078
+ DDAttachmentField: "UploadField",
1079
+ DDPhotoField: "UploadField",
1080
+ // 图片上传组件
1081
+ PhoneField: "TextField",
1082
+ // 手机号字段
1083
+ EmailField: "TextField",
1084
+ // 邮箱字段
1085
+ DepartmentField: "DepartmentField",
1086
+ // 部门选择字段
1087
+ SignatureField: "SignatureField",
1088
+ // 手写签名字段
1089
+ TableField: "TableField"
1090
+ // 动态表格(明细)
1091
+ // TextNote 是说明文字组件,不是输入字段,跳过处理
1092
+ }[s];
1093
+ if (!t)
1094
+ return console.log(`跳过非输入组件: ${s}`), null;
1095
+ const a = e.props || {}, l = {
1096
+ placeholder: a.placeholder || `请输入${a.label || ""}`
1097
+ };
1098
+ t === "SelectField" ? (l.options = this.convertOptions(a.options || []), l.showSearch = a.showSearch ?? !0, l.allowClear = a.allowClear ?? !0, s === "DDMultiSelectField" && (l.mode = "multiple"), s === "DepartmentField" && (l.placeholder = a.placeholder || "请选择部门", console.warn(`DepartmentField (${i}) 需要从钉钉 API 获取部门列表`))) : t === "RadioField" || t === "CheckboxField" ? l.options = this.convertOptions(a.options || []) : t === "NumberField" ? (l.min = a.min, l.max = a.max, l.step = a.step ?? 1, l.precision = a.precision) : t === "DateField" ? (l.format = a.format || "YYYY-MM-DD", l.showTime = a.showTime ?? !1) : t === "DateRangeField" ? (l.format = a.format || "YYYY-MM-DD", l.showTime = a.showTime ?? !1, l.placeholder = ["开始日期", "结束日期"]) : t === "TextareaField" ? (l.rows = a.rows ?? 4, l.maxLength = a.maxLength, l.showCount = a.showCount ?? !1) : t === "TextField" ? (l.maxLength = a.maxLength, l.showCount = a.showCount ?? !1, s === "PhoneField" && (l.placeholder = a.placeholder || "请输入手机号", l.maxLength = a.maxLength || 11), s === "EmailField" && (l.placeholder = a.placeholder || "请输入邮箱")) : t === "UploadField" ? (l.action = a.action || "/api/upload", l.maxCount = a.maxCount ?? 9, l.maxSize = a.maxSize ?? 10, s === "DDPhotoField" ? (l.accept = a.accept || "image/*", l.listType = "picture-card") : l.accept = a.accept) : t === "TableField" ? (l.actionName = a.actionName || "添加", l.showIndex = a.showIndex ?? !0, l.maxRows = a.maxRows, l.minRows = a.minRows) : t === "DepartmentField" ? (l.placeholder = a.placeholder || "请选择部门", l.showSearch = a.showSearch ?? !0, l.allowClear = a.allowClear ?? !0, l.treeDefaultExpandAll = a.treeDefaultExpandAll ?? !1, l.apiUrl = a.apiUrl || "/api/dingtalk/departments", l.useTreeSelect = a.useTreeSelect ?? !0, (a.multiple || a.mode === "multiple") && (l.mode = "multiple")) : t === "SignatureField" && (l.placeholder = a.placeholder || "点击签名", l.width = a.width ?? 400, l.height = a.height ?? 200, l.lineWidth = a.lineWidth ?? 2, l.lineColor = a.lineColor || "#000000", l.backgroundColor = a.backgroundColor || "#ffffff"), a.disabled && (l.disabled = !0), a.behaviorLinkage && (l.behaviorLinkage = a.behaviorLinkage);
1099
+ let n;
1100
+ t === "TableField" && (console.log(`🔍 处理 TableField ${i}:`, JSON.stringify(e, null, 2)), e.children && Array.isArray(e.children) ? (console.log(` ✅ item.children 存在,数量: ${e.children.length}`), n = [], e.children.forEach(($, y) => {
1101
+ console.log(` -> 处理子字段 ${y + 1}:`, JSON.stringify($, null, 2));
1102
+ const g = this.convertSchemaItem($);
1103
+ g ? (console.log(` ✓ 成功转换: ${g.id} (${g.type})`), n.push(g)) : console.log(" ✗ 转换失败或被跳过");
1104
+ }), console.log(" -> 最终 children 数量:", n.length), console.log(" -> 最终 children 内容:", JSON.stringify(n, null, 2))) : (console.error(` ❌ TableField ${i} 没有 children 或 children 不是数组!`), console.error(" -> item.children:", e.children)));
1105
+ const r = {
1106
+ id: i,
1107
+ type: t,
1108
+ label: a.label || a.bizAlias || i,
1109
+ required: a.required ?? !1,
1110
+ props: l,
1111
+ children: n,
1112
+ // TableField 的子字段
1113
+ rules: a.rules || [],
1114
+ // 栅格布局
1115
+ span: e.span ?? a.span ?? 24,
1116
+ offset: e.offset ?? a.offset,
1117
+ order: e.order ?? a.order ?? 0,
1118
+ // 布局配置
1119
+ labelCol: e.labelCol ?? a.labelCol,
1120
+ wrapperCol: e.wrapperCol ?? a.wrapperCol,
1121
+ // 显示控制
1122
+ hidden: e.hidden ?? a.hidden ?? a.hiddenInApprovalDetail ?? !1,
1123
+ // 分组
1124
+ group: e.group ?? a.group
1125
+ };
1126
+ return t === "TableField" && console.log("📦 返回 TableField 配置:", JSON.stringify(r, null, 2)), r;
1127
+ }
1128
+ /**
1129
+ * 转换选项格式
1130
+ * 钉钉的选项格式可能是:
1131
+ * 1. JSON 字符串数组:["{\"value\":\"选项1\",\"key\":\"option_1\"}", ...]
1132
+ * 2. 对象数组:[{label: "选项1", value: "option1"}, ...]
1133
+ * 3. 对象数组:[{value: "选项1", key: "option1"}, ...]
1134
+ *
1135
+ * @param options 钉钉选项格式
1136
+ * @returns 标准选项格式 {label, value, disabled}
1137
+ */
1138
+ static convertOptions(e) {
1139
+ return Array.isArray(e) ? e.map((i) => {
1140
+ let s = i;
1141
+ if (typeof i == "string")
1142
+ try {
1143
+ s = JSON.parse(i);
1144
+ } catch (o) {
1145
+ return console.warn("解析选项 JSON 失败:", i, o), {
1146
+ label: i,
1147
+ value: i,
1148
+ disabled: !1
1149
+ };
1150
+ }
1151
+ return {
1152
+ label: s.value || s.label || s.text || s.key,
1153
+ value: s.key || s.value || s.label,
1154
+ disabled: s.disabled ?? !1
1155
+ };
1156
+ }) : [];
1157
+ }
1158
+ /**
1159
+ * 转换钉钉表单实例数据为表单值
1160
+ * @param instance 钉钉表单实例
1161
+ * @param schema 表单 Schema
1162
+ * @returns 表单值对象
1163
+ */
1164
+ static convertInstanceToFormData(e, i) {
1165
+ const s = {};
1166
+ if (!e.formComponentValues || !Array.isArray(e.formComponentValues))
1167
+ return console.warn("实例数据中没有 formComponentValues 或不是数组"), s;
1168
+ const o = /* @__PURE__ */ new Map();
1169
+ return i.fields.forEach((t) => {
1170
+ o.set(t.id, t);
1171
+ }), console.log("字段映射表:", Array.from(o.keys())), console.log(
1172
+ "实例数据字段:",
1173
+ e.formComponentValues.map((t) => t.name)
1174
+ ), e.formComponentValues.forEach((t) => {
1175
+ const a = o.get(t.name);
1176
+ if (!a) {
1177
+ console.warn(`未找到字段配置: ${t.name}`, t);
1178
+ return;
1179
+ }
1180
+ console.log(`转换字段 ${t.name}:`, {
1181
+ 原始值: t.value,
1182
+ 字段类型: a.type,
1183
+ 字段属性: a.props
1184
+ });
1185
+ const l = this.convertValueByType(t.value, a.type, a.props);
1186
+ console.log("转换后的值:", l), s[t.name] = l;
1187
+ }), console.log("最终表单数据:", s), s;
1188
+ }
1189
+ /**
1190
+ * 根据字段类型转换值
1191
+ * @param value 原始值
1192
+ * @param type 字段类型
1193
+ * @param props 字段属性
1194
+ * @returns 转换后的值
1195
+ */
1196
+ static convertValueByType(e, i, s) {
1197
+ if (!(e == null || e === ""))
1198
+ switch (console.log(`convertValueByType - 类型: ${i}, 原始值:`, e), i) {
1199
+ case "NumberField":
1200
+ if (typeof e == "number")
1201
+ return e;
1202
+ if (typeof e == "string") {
1203
+ const o = Number(e);
1204
+ return isNaN(o) ? void 0 : o;
1205
+ }
1206
+ return;
1207
+ case "DateField":
1208
+ if (typeof e == "string" || typeof e == "number") {
1209
+ const o = W(e);
1210
+ return o.isValid() ? o : void 0;
1211
+ }
1212
+ return W.isDayjs(e) ? e : void 0;
1213
+ case "DateRangeField":
1214
+ if (Array.isArray(e) && e.length === 2) {
1215
+ const o = W(e[0]), t = W(e[1]);
1216
+ if (o.isValid() && t.isValid())
1217
+ return [o, t];
1218
+ }
1219
+ return;
1220
+ case "CheckboxField":
1221
+ if (Array.isArray(e))
1222
+ return e;
1223
+ if (typeof e == "string")
1224
+ try {
1225
+ const o = JSON.parse(e);
1226
+ return Array.isArray(o) ? o : [e];
1227
+ } catch {
1228
+ return e.includes(",") ? e.split(",").map((o) => o.trim()) : [e];
1229
+ }
1230
+ return [];
1231
+ case "SelectField":
1232
+ if ((s == null ? void 0 : s.mode) === "multiple") {
1233
+ if (Array.isArray(e))
1234
+ return e;
1235
+ if (typeof e == "string")
1236
+ try {
1237
+ const o = JSON.parse(e);
1238
+ return Array.isArray(o) ? o : [e];
1239
+ } catch {
1240
+ return e.includes(",") ? e.split(",").map((o) => o.trim()) : [e];
1241
+ }
1242
+ return [];
1243
+ }
1244
+ return Array.isArray(e) ? e[0] : e;
1245
+ case "SwitchField":
1246
+ return typeof e == "boolean" ? e : typeof e == "string" ? e === "true" || e === "1" : typeof e == "number" ? e === 1 : !1;
1247
+ case "UploadField":
1248
+ if (Array.isArray(e))
1249
+ return e.map((o, t) => ({
1250
+ uid: o.fileId || o.spaceId || o.photoId || o.uid || `file-${t}`,
1251
+ name: o.fileName || o.name || "未命名文件",
1252
+ status: "done",
1253
+ url: o.fileUrl || o.url,
1254
+ size: o.fileSize || o.size,
1255
+ type: o.fileType || o.type
1256
+ }));
1257
+ if (typeof e == "string")
1258
+ try {
1259
+ const o = JSON.parse(e);
1260
+ return Array.isArray(o) ? this.convertValueByType(o, i, s) : [];
1261
+ } catch {
1262
+ return e.startsWith("http://") || e.startsWith("https://") ? [
1263
+ {
1264
+ uid: "file-0",
1265
+ name: "图片",
1266
+ status: "done",
1267
+ url: e
1268
+ }
1269
+ ] : [];
1270
+ }
1271
+ return [];
1272
+ case "TextField":
1273
+ case "TextareaField":
1274
+ return String(e);
1275
+ case "RadioField":
1276
+ return Array.isArray(e) ? e[0] : e;
1277
+ case "TableField":
1278
+ if (Array.isArray(e))
1279
+ return e.map((o) => {
1280
+ if (typeof o == "object" && !Array.isArray(o))
1281
+ return o;
1282
+ if (Array.isArray(o)) {
1283
+ const t = {};
1284
+ return o.forEach((a) => {
1285
+ a && a.name && (t[a.name] = a.value);
1286
+ }), t;
1287
+ }
1288
+ return o;
1289
+ });
1290
+ if (typeof e == "string")
1291
+ try {
1292
+ const o = JSON.parse(e);
1293
+ return Array.isArray(o) ? this.convertValueByType(o, i, s) : [];
1294
+ } catch {
1295
+ return [];
1296
+ }
1297
+ return [];
1298
+ case "DepartmentField":
1299
+ if ((s == null ? void 0 : s.mode) === "multiple") {
1300
+ if (Array.isArray(e))
1301
+ return e;
1302
+ if (typeof e == "string")
1303
+ try {
1304
+ const o = JSON.parse(e);
1305
+ return Array.isArray(o) ? o : [e];
1306
+ } catch {
1307
+ return e.includes(",") ? e.split(",").map((o) => o.trim()) : [e];
1308
+ }
1309
+ return [];
1310
+ }
1311
+ return Array.isArray(e) ? e[0] : e;
1312
+ case "SignatureField":
1313
+ return typeof e == "string" ? e : void 0;
1314
+ default:
1315
+ return e;
1316
+ }
1317
+ }
1318
+ /**
1319
+ * 转换表单数据为钉钉提交格式
1320
+ * @param formData 表单数据
1321
+ * @param schema 表单 Schema
1322
+ * @returns 钉钉表单组件值列表
1323
+ */
1324
+ static convertFormDataToInstance(e, i) {
1325
+ const s = [];
1326
+ return console.log("开始转换表单数据为钉钉格式:", e), i.fields.forEach((o) => {
1327
+ const t = e[o.id];
1328
+ if (t == null) {
1329
+ console.log(`跳过未填写的字段: ${o.id}`);
1330
+ return;
1331
+ }
1332
+ if (o.hidden) {
1333
+ console.log(`跳过隐藏字段: ${o.id}`);
1334
+ return;
1335
+ }
1336
+ const a = this.convertValueToComponent(t, o.type, o.id, o.label, o.props);
1337
+ a && (console.log(`字段 ${o.id} 转换结果:`, a), s.push(a));
1338
+ }), console.log("最终钉钉格式数据:", s), s;
1339
+ }
1340
+ /**
1341
+ * 创建完整的钉钉提交数据
1342
+ * 将表单数据转换为钉钉 API 所需的完整提交格式
1343
+ *
1344
+ * @param formData 表单数据对象,key 为字段 id,value 为字段值
1345
+ * @param schema 表单 Schema,包含字段定义和验证规则
1346
+ * @param options 提交选项配置
1347
+ * @param options.formUuid 表单UUID(必填),表单模板的唯一标识
1348
+ * @param options.originatorUserId 发起人userId(必填),表单发起人的钉钉用户ID
1349
+ * @param options.processCode 流程编码(可选),审批流程的唯一编码,审批流程必填
1350
+ * @param options.deptId 部门ID(可选),发起人所在部门的ID
1351
+ * @param options.approvers 审批人列表(可选),审批人的 userId 数组,按顺序审批
1352
+ * @param options.ccList 抄送人列表(可选),抄送人的 userId 数组
1353
+ * @param options.title 实例标题(可选),表单实例的显示标题
1354
+ * @param options.url 移动端打开地址(可选),在钉钉移动端打开的URL
1355
+ * @returns 完整的钉钉提交数据,可直接用于调用钉钉 API
1356
+ *
1357
+ * @example
1358
+ * ```typescript
1359
+ * const submitData = DingTalkFormAdapter.createSubmitData(
1360
+ * { name: '张三', days: 3 },
1361
+ * schema,
1362
+ * {
1363
+ * formUuid: 'PROC-XXXX-XXXX',
1364
+ * originatorUserId: 'user123',
1365
+ * processCode: 'PROC-LEAVE',
1366
+ * title: '张三的请假申请',
1367
+ * approvers: ['manager1', 'manager2'],
1368
+ * ccList: ['hr1']
1369
+ * }
1370
+ * );
1371
+ * ```
1372
+ */
1373
+ static createSubmitData(e, i, s) {
1374
+ const o = this.convertFormDataToInstance(e, i), t = {
1375
+ formUuid: s.formUuid,
1376
+ originatorUserId: s.originatorUserId,
1377
+ formComponentValues: o
1378
+ };
1379
+ return s.processCode && (t.processCode = s.processCode), s.deptId && (t.deptId = s.deptId), s.approvers && s.approvers.length > 0 && (t.approvers = s.approvers), s.ccList && s.ccList.length > 0 && (t.ccList = s.ccList), s.title && (t.title = s.title), s.url && (t.url = s.url), console.log("完整的钉钉提交数据:", t), t;
1380
+ }
1381
+ /**
1382
+ * 转换值为钉钉组件格式
1383
+ * @param value 表单值
1384
+ * @param type 字段类型
1385
+ * @param name 字段名称
1386
+ * @param props 字段属性
1387
+ * @returns 钉钉组件值
1388
+ */
1389
+ static convertValueToComponent(e, i, s, o, t) {
1390
+ let a = e, l;
1391
+ switch (console.log(`转换字段 ${o} ${s} (${i}):`, e), i) {
1392
+ case "TextField":
1393
+ case "TextareaField":
1394
+ a = String(e), l = a;
1395
+ break;
1396
+ case "NumberField":
1397
+ a = typeof e == "number" ? e : Number(e), l = String(a);
1398
+ break;
1399
+ case "DateField":
1400
+ if (W.isDayjs(e))
1401
+ a = e.valueOf(), l = e.format("YYYY-MM-DD HH:mm:ss");
1402
+ else if (e instanceof Date)
1403
+ a = e.getTime(), l = W(e).format("YYYY-MM-DD HH:mm:ss");
1404
+ else if (typeof e == "string" || typeof e == "number") {
1405
+ const n = W(e);
1406
+ a = n.valueOf(), l = n.format("YYYY-MM-DD HH:mm:ss");
1407
+ }
1408
+ break;
1409
+ case "DateRangeField":
1410
+ if (Array.isArray(e) && e.length === 2) {
1411
+ const n = W.isDayjs(e[0]) ? e[0] : W(e[0]), r = W.isDayjs(e[1]) ? e[1] : W(e[1]);
1412
+ a = [n.valueOf(), r.valueOf()], l = `${n.format("YYYY-MM-DD")} 至 ${r.format("YYYY-MM-DD")}`;
1413
+ }
1414
+ break;
1415
+ case "SelectField":
1416
+ if ((t == null ? void 0 : t.mode) === "multiple")
1417
+ a = Array.isArray(e) ? e : [e], t != null && t.options && Array.isArray(a) && (l = a.map((r) => {
1418
+ const u = t.options.find(($) => $.value === r);
1419
+ return (u == null ? void 0 : u.label) || r;
1420
+ }).join(","));
1421
+ else if (a = Array.isArray(e) ? e[0] : e, t != null && t.options) {
1422
+ const n = t.options.find((r) => r.value === a);
1423
+ l = (n == null ? void 0 : n.label) || String(a);
1424
+ }
1425
+ break;
1426
+ case "RadioField":
1427
+ if (a = Array.isArray(e) ? e[0] : e, t != null && t.options) {
1428
+ const n = t.options.find((r) => r.value === a);
1429
+ l = (n == null ? void 0 : n.label) || String(a);
1430
+ }
1431
+ break;
1432
+ case "CheckboxField":
1433
+ a = Array.isArray(e) ? e : [e], t != null && t.options && Array.isArray(a) && (l = a.map((r) => {
1434
+ const u = t.options.find(($) => $.value === r);
1435
+ return (u == null ? void 0 : u.label) || r;
1436
+ }).join(","));
1437
+ break;
1438
+ case "SwitchField":
1439
+ a = e ? 1 : 0, l = e ? "是" : "否";
1440
+ break;
1441
+ case "UploadField":
1442
+ Array.isArray(e) ? (a = e.map((n) => {
1443
+ const r = {
1444
+ fileId: n.uid || n.fileId || n.photoId,
1445
+ fileName: n.name || n.fileName,
1446
+ fileUrl: n.url || n.fileUrl,
1447
+ fileSize: n.size || n.fileSize,
1448
+ fileType: n.type || n.fileType
1449
+ };
1450
+ return n.photoId && (r.photoId = n.photoId), r;
1451
+ }), l = e.map((n) => n.name || n.fileName || "文件").join(",")) : (a = [], l = "");
1452
+ break;
1453
+ case "TableField":
1454
+ Array.isArray(e) ? (a = e.map((n) => Array.isArray(n) ? n : typeof n == "object" ? Object.keys(n).map((r) => ({
1455
+ name: r,
1456
+ value: n[r]
1457
+ })) : []), l = `${e.length} 条记录`) : (a = [], l = "0 条记录");
1458
+ break;
1459
+ default:
1460
+ a = e, l = String(e);
1461
+ break;
1462
+ }
1463
+ return {
1464
+ name: s,
1465
+ // 额外新增
1466
+ label: o,
1467
+ value: a,
1468
+ extValue: l
1469
+ };
1470
+ }
1471
+ /**
1472
+ * 批量转换钉钉表单实例列表
1473
+ * @param instances 表单实例列表
1474
+ * @param schema 表单 Schema
1475
+ * @returns 表单数据列表
1476
+ */
1477
+ static convertInstancesToFormDataList(e, i) {
1478
+ return e.map((s) => ({
1479
+ id: s.processInstanceId || s.formUuid,
1480
+ data: this.convertInstanceToFormData(s, i),
1481
+ meta: {
1482
+ createTime: s.createTime,
1483
+ modifyTime: s.modifyTime,
1484
+ originator: s.originator,
1485
+ title: s.title
1486
+ }
1487
+ }));
1488
+ }
1489
+ /**
1490
+ * 验证表单数据
1491
+ * @param formData 表单数据
1492
+ * @param schema 表单 Schema
1493
+ * @returns 验证结果
1494
+ */
1495
+ static validateFormData(e, i) {
1496
+ const s = [];
1497
+ return i.fields.forEach((o) => {
1498
+ const t = e[o.id];
1499
+ o.required && ((t == null || t === "") && s.push({
1500
+ field: o.id,
1501
+ message: `${o.label}不能为空`
1502
+ }), Array.isArray(t) && t.length === 0 && s.push({
1503
+ field: o.id,
1504
+ message: `${o.label}不能为空`
1505
+ })), o.rules && Array.isArray(o.rules) && o.rules.forEach((a) => {
1506
+ a.validator && typeof a.validator == "function" && a.validator(t) !== !0 && s.push({
1507
+ field: o.id,
1508
+ message: a.message || `${o.label}验证失败`
1509
+ });
1510
+ });
1511
+ }), {
1512
+ valid: s.length === 0,
1513
+ errors: s
1514
+ };
1515
+ }
1516
+ }
1517
+ const Wa = {
1518
+ key: 0,
1519
+ class: "no-schema"
1520
+ }, Ga = {
1521
+ key: 0,
1522
+ class: "form-header"
1523
+ }, Ha = { key: 0 }, Ka = { key: 1 }, Xa = { class: "group-description" }, Qa = /* @__PURE__ */ j({
1524
+ __name: "index",
1525
+ props: {
1526
+ schemaResponse: { default: void 0 },
1527
+ schema: { default: void 0 },
1528
+ instanceData: { default: void 0 },
1529
+ modelValue: { default: void 0 },
1530
+ labelCol: { default: () => ({ span: 6 }) },
1531
+ wrapperCol: { default: () => ({ span: 18 }) },
1532
+ layout: { default: "horizontal" },
1533
+ showSubmit: { type: Boolean, default: !0 },
1534
+ showReset: { type: Boolean, default: !1 },
1535
+ submitText: { default: "提交" },
1536
+ resetText: { default: "重置" },
1537
+ loading: { type: Boolean, default: !1 },
1538
+ disabled: { type: Boolean, default: !1 },
1539
+ readonly: { type: Boolean, default: !1 },
1540
+ responsive: { type: Boolean, default: !0 },
1541
+ mobileBreakpoint: { default: 768 }
1542
+ },
1543
+ emits: ["update:modelValue", "change", "submit", "reset", "schemaLoaded", "dataLoaded"],
1544
+ setup(D, { expose: e, emit: i }) {
1545
+ const s = xe.Item, o = je.Panel, t = D, a = i, l = z(), n = z(!1), r = z(null), u = be({}), $ = z({}), y = z([]), g = z(!1), I = z(0), b = O(() => t.schema ? t.schema : r.value ? r.value : null), M = O(() => t.loading || n.value), E = O(() => t.responsive ? g.value ? {
1546
+ layout: "vertical",
1547
+ labelCol: { span: 24 },
1548
+ wrapperCol: { span: 24 }
1549
+ } : {
1550
+ layout: t.layout,
1551
+ labelCol: t.labelCol,
1552
+ wrapperCol: t.wrapperCol
1553
+ } : {
1554
+ layout: t.layout,
1555
+ labelCol: t.labelCol,
1556
+ wrapperCol: t.wrapperCol
1557
+ }), f = O(() => {
1558
+ var d, h;
1559
+ return t.responsive ? g.value ? [8, 16] : ((h = b.value) == null ? void 0 : h.gutter) || 16 : ((d = b.value) == null ? void 0 : d.gutter) || 16;
1560
+ }), Y = be({}), q = () => {
1561
+ b.value && b.value.fields.forEach((d) => {
1562
+ Y[d.id] = !d.hidden, b.value.fields.some((w) => {
1563
+ var G;
1564
+ const R = (G = w.props) == null ? void 0 : G.behaviorLinkage;
1565
+ return !R || !Array.isArray(R) ? !1 : R.some((P) => {
1566
+ var ae;
1567
+ return (ae = P.targets) == null ? void 0 : ae.some((te) => te.fieldId === d.id);
1568
+ });
1569
+ }) && (Y[d.id] = !1);
1570
+ });
1571
+ }, A = (d) => Y[d] !== !1, c = (d, h) => {
1572
+ var G;
1573
+ const w = (G = d.props) == null ? void 0 : G.behaviorLinkage;
1574
+ if (!w || !Array.isArray(w))
1575
+ return;
1576
+ console.log(`🔗 处理字段联动: ${d.id}`, { value: h, linkage: w });
1577
+ const R = /* @__PURE__ */ new Set();
1578
+ w.forEach((P) => {
1579
+ (P.targets || []).forEach((te) => {
1580
+ R.add(te.fieldId);
1581
+ });
1582
+ }), R.forEach((P) => {
1583
+ var ae;
1584
+ Y[P] = !1, (ae = l.value) == null || ae.clearValidate(P), console.log(` -> 先隐藏字段: ${P}`);
1585
+ }), w.forEach((P) => {
1586
+ const ae = P.targets || [], te = h === P.value || Array.isArray(h) && h.includes(P.value);
1587
+ console.log(` 规则匹配: ${te}`, { ruleValue: P.value, currentValue: h }), te && ae.forEach((Le) => {
1588
+ const me = Le.fieldId, Ye = Le.behavior || "NORMAL";
1589
+ Ye === "NORMAL" ? (Y[me] = !0, console.log(` -> 显示字段 ${me}`)) : Ye === "HIDDEN" && (Y[me] = !1, console.log(` -> 隐藏字段 ${me}`));
1590
+ });
1591
+ });
1592
+ }, C = O(() => {
1593
+ if (!b.value)
1594
+ return {};
1595
+ const d = {
1596
+ default: []
1597
+ };
1598
+ return b.value.fields.forEach((h) => {
1599
+ if (h.hidden || !A(h.id))
1600
+ return;
1601
+ const w = h.group || "default";
1602
+ d[w] || (d[w] = []), d[w].push(h);
1603
+ }), d;
1604
+ }), V = (d) => t.responsive && g.value ? 24 : d.span || 24, L = (d) => ({
1605
+ TextField: se,
1606
+ TextareaField: Te,
1607
+ NumberField: $e,
1608
+ SelectField: Ve,
1609
+ RadioField: Be,
1610
+ CheckboxField: Ue,
1611
+ DateField: Re,
1612
+ DateRangeField: Ie,
1613
+ SwitchField: Ne,
1614
+ UploadField: ze,
1615
+ TableField: Xe,
1616
+ DepartmentField: Me,
1617
+ SignatureField: Oe
1618
+ })[d] || se, ee = (d) => {
1619
+ const h = [];
1620
+ return d.required && A(d.id) && h.push({
1621
+ required: !0,
1622
+ message: `请输入${d.label}`
1623
+ }), d.rules && A(d.id) && h.push(...d.rules), h;
1624
+ }, de = (d) => d.labelCol || d.wrapperCol ? {
1625
+ labelCol: d.labelCol || E.value.labelCol,
1626
+ wrapperCol: d.wrapperCol || E.value.wrapperCol
1627
+ } : {
1628
+ labelCol: E.value.labelCol,
1629
+ wrapperCol: E.value.wrapperCol
1630
+ }, ue = (d) => {
1631
+ const h = { ...d.props || {} };
1632
+ return d.type === "DateRangeField" && (h.mobileMode = g.value, h.mobileBreakpoint = t.mobileBreakpoint), d.type === "TableField" && (h.labelCol = E.value.labelCol, h.wrapperCol = E.value.wrapperCol), h;
1633
+ }, ce = (d, h) => {
1634
+ var R;
1635
+ u[d] = h, a("update:modelValue", { ...u }), a("change", d, h);
1636
+ const w = (R = b.value) == null ? void 0 : R.fields.find((G) => G.id === d);
1637
+ w && c(w, h);
1638
+ }, re = () => {
1639
+ I.value = window.innerWidth, g.value = I.value < t.mobileBreakpoint;
1640
+ }, ve = () => {
1641
+ if (t.schemaResponse)
1642
+ try {
1643
+ n.value = !0;
1644
+ const d = ie.parseSchema(t.schemaResponse);
1645
+ r.value = d, d.groups && (y.value = d.groups.filter((h) => !h.collapsed).map((h) => h.name)), q(), a("schemaLoaded", d);
1646
+ } catch (d) {
1647
+ console.error("解析 Schema 失败:", d), X.error("加载表单配置失败");
1648
+ } finally {
1649
+ n.value = !1;
1650
+ }
1651
+ }, ge = () => {
1652
+ if (t.instanceData && b.value)
1653
+ try {
1654
+ n.value = !0;
1655
+ const d = ie.convertInstanceToFormData(t.instanceData, b.value);
1656
+ Object.keys(d).forEach((h) => {
1657
+ u[h] = d[h];
1658
+ }), $.value = { ...d }, b.value.fields.forEach((h) => {
1659
+ var w;
1660
+ u[h.id] !== void 0 && ((w = h.props) != null && w.behaviorLinkage) && c(h, u[h.id]);
1661
+ }), a("dataLoaded", d), a("update:modelValue", d);
1662
+ } catch (d) {
1663
+ console.error("加载表单数据失败:", d), X.error("加载表单数据失败");
1664
+ } finally {
1665
+ n.value = !1;
1666
+ }
1667
+ }, pe = async () => {
1668
+ var d, h;
1669
+ try {
1670
+ if (b.value) {
1671
+ const w = b.value.fields.filter((R) => !A(R.id)).map((R) => R.id);
1672
+ w.length > 0 && ((d = l.value) == null || d.clearValidate(w));
1673
+ }
1674
+ if (await ((h = l.value) == null ? void 0 : h.validate()), b.value) {
1675
+ const w = b.value.fields.filter((P) => A(P.id)), R = { ...b.value, fields: w }, G = ie.validateFormData(u, R);
1676
+ if (!G.valid) {
1677
+ G.errors.forEach((P) => {
1678
+ X.error(P.message);
1679
+ });
1680
+ return;
1681
+ }
1682
+ }
1683
+ a("submit", { ...u });
1684
+ } catch (w) {
1685
+ console.error("表单验证失败:", w);
1686
+ }
1687
+ }, ne = () => {
1688
+ var d;
1689
+ (d = l.value) == null || d.resetFields(), Object.keys(u).forEach((h) => {
1690
+ delete u[h];
1691
+ }), Object.keys($.value).length > 0 && Object.assign(u, $.value), a("reset"), a("update:modelValue", { ...u });
1692
+ }, Ee = () => b.value ? ie.convertFormDataToInstance(u, b.value) : [], B = (d) => {
1693
+ var w;
1694
+ if (!b.value || !t.schemaResponse)
1695
+ throw new Error("Schema 未加载");
1696
+ let h = "";
1697
+ if ((w = t.instanceData) != null && w.formUuid ? h = t.instanceData.formUuid : t.schemaResponse && (h = (typeof t.schemaResponse.schemaContent == "string" ? JSON.parse(t.schemaResponse.schemaContent) : t.schemaResponse.schemaContent).formUuid || ""), !h)
1698
+ throw new Error("缺少 formUuid");
1699
+ return ie.createSubmitData(u, b.value, {
1700
+ formUuid: h,
1701
+ ...d
1702
+ });
1703
+ }, S = async () => {
1704
+ var d;
1705
+ try {
1706
+ return await ((d = l.value) == null ? void 0 : d.validate()), !0;
1707
+ } catch {
1708
+ return !1;
1709
+ }
1710
+ }, F = (d) => {
1711
+ var h;
1712
+ (h = l.value) == null || h.clearValidate(d);
1713
+ };
1714
+ return Q(
1715
+ () => t.schemaResponse,
1716
+ () => {
1717
+ ve();
1718
+ },
1719
+ { immediate: !0 }
1720
+ ), Q(
1721
+ () => t.instanceData,
1722
+ () => {
1723
+ ge();
1724
+ },
1725
+ { immediate: !0, deep: !0 }
1726
+ ), Q(
1727
+ () => t.modelValue,
1728
+ (d) => {
1729
+ d && Object.keys(d).length > 0 && Object.keys(d).forEach((h) => {
1730
+ u[h] = d[h];
1731
+ });
1732
+ },
1733
+ { immediate: !0, deep: !0 }
1734
+ ), De(() => {
1735
+ t.schema && (r.value = t.schema), t.modelValue && Object.assign(u, t.modelValue), t.responsive && (re(), window.addEventListener("resize", re));
1736
+ }), Ge(() => {
1737
+ t.responsive && window.removeEventListener("resize", re);
1738
+ }), e({
1739
+ validate: S,
1740
+ clearValidate: F,
1741
+ resetFields: ne,
1742
+ getDingTalkSubmitData: Ee,
1743
+ // 获取 formComponentValues
1744
+ getFullSubmitData: B,
1745
+ // 获取完整提交数据
1746
+ formData: u,
1747
+ schema: b,
1748
+ isMobile: g,
1749
+ screenWidth: I
1750
+ }), (d, h) => (p(), U(v(ua), {
1751
+ spinning: M.value,
1752
+ tip: "加载中..."
1753
+ }, {
1754
+ default: k(() => [
1755
+ b.value ? (p(), U(v(xe), {
1756
+ key: 1,
1757
+ ref_key: "formRef",
1758
+ ref: l,
1759
+ model: u,
1760
+ "label-col": E.value.labelCol,
1761
+ "wrapper-col": E.value.wrapperCol,
1762
+ layout: E.value.layout,
1763
+ disabled: d.disabled || d.readonly,
1764
+ class: He({ "mobile-form": g.value }),
1765
+ onFinish: pe
1766
+ }, {
1767
+ default: k(() => [
1768
+ b.value.title || b.value.description ? (p(), _("div", Ga, [
1769
+ b.value.title ? (p(), _("h3", Ha, N(b.value.title), 1)) : x("", !0),
1770
+ b.value.description ? (p(), _("p", Ka, N(b.value.description), 1)) : x("", !0)
1771
+ ])) : x("", !0),
1772
+ b.value.groups && b.value.groups.length > 0 ? (p(), U(v(je), {
1773
+ key: 1,
1774
+ "active-key": y.value,
1775
+ "onUpdate:activeKey": h[0] || (h[0] = (w) => y.value = w),
1776
+ bordered: !1,
1777
+ class: "form-groups"
1778
+ }, {
1779
+ default: k(() => [
1780
+ (p(!0), _(K, null, Z(b.value.groups, (w) => (p(), U(v(o), {
1781
+ key: w.name,
1782
+ header: w.title
1783
+ }, Qe({
1784
+ default: k(() => [
1785
+ T(v(_e), { gutter: f.value }, {
1786
+ default: k(() => [
1787
+ (p(!0), _(K, null, Z(C.value[w.name] || [], (R) => (p(), U(v(Se), {
1788
+ key: R.id,
1789
+ span: V(R),
1790
+ offset: g.value ? 0 : R.offset,
1791
+ order: R.order
1792
+ }, {
1793
+ default: k(() => [
1794
+ T(v(s), oe({
1795
+ label: R.label,
1796
+ name: R.id,
1797
+ rules: ee(R)
1798
+ }, { ref_for: !0 }, de(R)), {
1799
+ default: k(() => [
1800
+ (p(), U(fe(L(R.type)), oe({
1801
+ "model-value": u[R.id],
1802
+ children: R.children
1803
+ }, { ref_for: !0 }, ue(R), {
1804
+ disabled: d.disabled || d.readonly,
1805
+ "onUpdate:modelValue": (G) => ce(R.id, G)
1806
+ }), null, 16, ["model-value", "children", "disabled", "onUpdate:modelValue"]))
1807
+ ]),
1808
+ _: 2
1809
+ }, 1040, ["label", "name", "rules"])
1810
+ ]),
1811
+ _: 2
1812
+ }, 1032, ["span", "offset", "order"]))), 128))
1813
+ ]),
1814
+ _: 2
1815
+ }, 1032, ["gutter"])
1816
+ ]),
1817
+ _: 2
1818
+ }, [
1819
+ w.description ? {
1820
+ name: "extra",
1821
+ fn: k(() => [
1822
+ m("span", Xa, N(w.description), 1)
1823
+ ]),
1824
+ key: "0"
1825
+ } : void 0
1826
+ ]), 1032, ["header"]))), 128))
1827
+ ]),
1828
+ _: 1
1829
+ }, 8, ["active-key"])) : (p(), U(v(_e), {
1830
+ key: 2,
1831
+ gutter: f.value
1832
+ }, {
1833
+ default: k(() => [
1834
+ (p(!0), _(K, null, Z(C.value.default, (w) => (p(), U(v(Se), {
1835
+ key: w.id,
1836
+ span: V(w),
1837
+ offset: g.value ? 0 : w.offset,
1838
+ order: w.order
1839
+ }, {
1840
+ default: k(() => [
1841
+ T(v(s), oe({
1842
+ label: w.label,
1843
+ name: w.id,
1844
+ rules: ee(w)
1845
+ }, { ref_for: !0 }, de(w)), {
1846
+ default: k(() => [
1847
+ (p(), U(fe(L(w.type)), oe({
1848
+ "model-value": u[w.id],
1849
+ children: w.children
1850
+ }, { ref_for: !0 }, ue(w), {
1851
+ disabled: d.disabled || d.readonly,
1852
+ "onUpdate:modelValue": (R) => ce(w.id, R)
1853
+ }), null, 16, ["model-value", "children", "disabled", "onUpdate:modelValue"]))
1854
+ ]),
1855
+ _: 2
1856
+ }, 1040, ["label", "name", "rules"])
1857
+ ]),
1858
+ _: 2
1859
+ }, 1032, ["span", "offset", "order"]))), 128))
1860
+ ]),
1861
+ _: 1
1862
+ }, 8, ["gutter"])),
1863
+ d.$slots.approval ? (p(), U(v(s), {
1864
+ key: 3,
1865
+ label: "流程",
1866
+ "wrapper-col": g.value ? { span: 24 } : { span: d.wrapperCol.span }
1867
+ }, {
1868
+ default: k(() => [
1869
+ Ce(d.$slots, "approval", {}, void 0, !0)
1870
+ ]),
1871
+ _: 3
1872
+ }, 8, ["wrapper-col"])) : x("", !0),
1873
+ Ce(d.$slots, "footer", {
1874
+ formData: u,
1875
+ submit: pe,
1876
+ reset: ne
1877
+ }, () => [
1878
+ d.showSubmit || d.showReset ? (p(), U(v(s), {
1879
+ key: 0,
1880
+ "wrapper-col": g.value ? { span: 24 } : { offset: d.labelCol.span, span: d.wrapperCol.span },
1881
+ class: "form-footer"
1882
+ }, {
1883
+ default: k(() => [
1884
+ d.showSubmit ? (p(), U(v(H), {
1885
+ key: 0,
1886
+ type: "primary",
1887
+ "html-type": "submit",
1888
+ loading: M.value,
1889
+ disabled: d.disabled,
1890
+ block: g.value
1891
+ }, {
1892
+ default: k(() => [
1893
+ J(N(d.submitText), 1)
1894
+ ]),
1895
+ _: 1
1896
+ }, 8, ["loading", "disabled", "block"])) : x("", !0),
1897
+ d.showReset ? (p(), U(v(H), {
1898
+ key: 1,
1899
+ style: he(g.value ? "margin-top: 12px" : "margin-left: 10px"),
1900
+ disabled: d.disabled,
1901
+ block: g.value,
1902
+ onClick: ne
1903
+ }, {
1904
+ default: k(() => [
1905
+ J(N(d.resetText), 1)
1906
+ ]),
1907
+ _: 1
1908
+ }, 8, ["style", "disabled", "block"])) : x("", !0)
1909
+ ]),
1910
+ _: 1
1911
+ }, 8, ["wrapper-col"])) : x("", !0)
1912
+ ], !0)
1913
+ ]),
1914
+ _: 3
1915
+ }, 8, ["model", "label-col", "wrapper-col", "layout", "disabled", "class"])) : (p(), _("div", Wa, h[1] || (h[1] = [
1916
+ m("p", null, "暂无表单配置", -1)
1917
+ ])))
1918
+ ]),
1919
+ _: 3
1920
+ }, 8, ["spinning"]));
1921
+ }
1922
+ });
1923
+ const Ql = /* @__PURE__ */ le(Qa, [["__scopeId", "data-v-ceac5a29"]]), Za = { class: "user-selector" }, el = { class: "search-box" }, al = { class: "selector-content" }, ll = { class: "left-panel" }, tl = { class: "org-tree" }, ol = { class: "role-list" }, sl = ["onClick"], rl = { class: "right-panel" }, nl = { class: "user-list-header" }, il = { class: "title" }, dl = { class: "count" }, ul = { class: "user-list" }, cl = ["onClick"], pl = { class: "user-info" }, ml = { class: "user-details" }, fl = { class: "user-name" }, hl = { class: "user-dept" }, vl = { class: "selector-footer" }, gl = { class: "selected-info" }, yl = { class: "count" }, bl = {
1924
+ key: 0,
1925
+ class: "selected-tags"
1926
+ }, Cl = { class: "action-buttons" }, wl = /* @__PURE__ */ j({
1927
+ __name: "UserSelector",
1928
+ props: {
1929
+ modelValue: { type: Boolean, default: !1 },
1930
+ users: { default: () => [] },
1931
+ orgTree: { default: () => [] },
1932
+ roles: { default: () => [] },
1933
+ maxCount: { default: 50 },
1934
+ selectedUsers: { default: () => [] },
1935
+ multiple: { type: Boolean, default: !0 }
1936
+ },
1937
+ emits: ["update:modelValue", "confirm", "cancel"],
1938
+ setup(D, { expose: e, emit: i }) {
1939
+ const s = Ke, o = Ae, t = Pe, a = Pe.TabPane, l = ca, n = ke.Group, r = ke, u = pa, $ = H, y = ma, g = D, I = i, b = O({
1940
+ get: () => g.modelValue,
1941
+ set: (B) => I("update:modelValue", B)
1942
+ }), M = z(""), E = z("org"), f = z([]), Y = z([]), q = z(""), A = z(""), c = z([]), C = O(() => {
1943
+ const B = (S) => S.map((F) => ({
1944
+ ...F,
1945
+ key: F.value,
1946
+ title: F.label,
1947
+ children: F.children ? B(F.children) : void 0
1948
+ }));
1949
+ return B(g.orgTree);
1950
+ }), V = O(() => g.roles), L = O(() => g.users.filter((B) => c.value.includes(B.userId))), ee = O(() => {
1951
+ let B = g.users;
1952
+ if (M.value) {
1953
+ const S = M.value.toLowerCase();
1954
+ B = B.filter((F) => {
1955
+ var d, h;
1956
+ return F.userName.toLowerCase().includes(S) || ((d = F.mobile) == null ? void 0 : d.includes(S)) || ((h = F.deptName) == null ? void 0 : h.toLowerCase().includes(S));
1957
+ });
1958
+ }
1959
+ return E.value === "org" && Y.value.length > 0, E.value === "role" && A.value, B;
1960
+ });
1961
+ Q(
1962
+ () => g.selectedUsers,
1963
+ (B) => {
1964
+ B && B.length > 0 && (c.value = B.map((S) => S.userId));
1965
+ },
1966
+ { immediate: !0 }
1967
+ ), Q(b, (B) => {
1968
+ B && C.value.length > 0 && (f.value = [C.value[0].value]);
1969
+ });
1970
+ const de = (B, S) => {
1971
+ B.length > 0 ? q.value = S.node.label : q.value = "";
1972
+ }, ue = (B) => {
1973
+ A.value = B;
1974
+ }, ce = (B) => {
1975
+ const S = c.value.indexOf(B);
1976
+ if (S > -1)
1977
+ c.value.splice(S, 1);
1978
+ else {
1979
+ if (c.value.length >= g.maxCount) {
1980
+ X.warning(`最多只能选择${g.maxCount}人`);
1981
+ return;
1982
+ }
1983
+ g.multiple ? c.value.push(B) : c.value = [B];
1984
+ }
1985
+ }, re = (B) => {
1986
+ const S = c.value.indexOf(B);
1987
+ S > -1 && c.value.splice(S, 1);
1988
+ }, ve = () => {
1989
+ if (L.value.length === 0) {
1990
+ X.warning("请至少选择一个人员");
1991
+ return;
1992
+ }
1993
+ I("confirm", L.value), b.value = !1;
1994
+ }, ge = () => {
1995
+ I("cancel"), b.value = !1;
1996
+ }, pe = (B) => {
1997
+ const S = [
1998
+ "#f56a00",
1999
+ "#7265e6",
2000
+ "#ffbf00",
2001
+ "#00a2ae",
2002
+ "#87d068",
2003
+ "#108ee9",
2004
+ "#f50",
2005
+ "#2db7f5",
2006
+ "#52c41a",
2007
+ "#eb2f96",
2008
+ "#722ed1",
2009
+ "#fa8c16"
2010
+ ], F = B.charCodeAt(0) % S.length;
2011
+ return S[F];
2012
+ }, ne = (B) => B.charAt(0).toUpperCase();
2013
+ return e({
2014
+ reset: () => {
2015
+ M.value = "", Y.value = [], A.value = "", c.value = [], q.value = "";
2016
+ }
2017
+ }), (B, S) => (p(), U(v(s), {
2018
+ open: b.value,
2019
+ "onUpdate:open": S[6] || (S[6] = (F) => b.value = F),
2020
+ title: "选择联系人",
2021
+ width: 800,
2022
+ footer: null,
2023
+ "destroy-on-close": !0,
2024
+ class: "user-selector-modal"
2025
+ }, {
2026
+ default: k(() => [
2027
+ m("div", Za, [
2028
+ m("div", el, [
2029
+ T(v(o), {
2030
+ value: M.value,
2031
+ "onUpdate:value": S[0] || (S[0] = (F) => M.value = F),
2032
+ placeholder: "搜索名字、拼音、手机号...",
2033
+ "allow-clear": "",
2034
+ size: "large"
2035
+ }, {
2036
+ prefix: k(() => [
2037
+ T(v(va))
2038
+ ]),
2039
+ _: 1
2040
+ }, 8, ["value"])
2041
+ ]),
2042
+ m("div", al, [
2043
+ m("div", ll, [
2044
+ T(v(t), {
2045
+ "active-key": E.value,
2046
+ "onUpdate:activeKey": S[3] || (S[3] = (F) => E.value = F),
2047
+ size: "small"
2048
+ }, {
2049
+ default: k(() => [
2050
+ T(v(a), {
2051
+ key: "org",
2052
+ tab: "按组织架构选择"
2053
+ }, {
2054
+ default: k(() => [
2055
+ m("div", tl, [
2056
+ T(v(l), {
2057
+ "expanded-keys": f.value,
2058
+ "onUpdate:expandedKeys": S[1] || (S[1] = (F) => f.value = F),
2059
+ "selected-keys": Y.value,
2060
+ "onUpdate:selectedKeys": S[2] || (S[2] = (F) => Y.value = F),
2061
+ "tree-data": C.value,
2062
+ onSelect: de
2063
+ }, null, 8, ["expanded-keys", "selected-keys", "tree-data"])
2064
+ ])
2065
+ ]),
2066
+ _: 1
2067
+ }),
2068
+ T(v(a), {
2069
+ key: "role",
2070
+ tab: "按角色选择"
2071
+ }, {
2072
+ default: k(() => [
2073
+ m("div", ol, [
2074
+ (p(!0), _(K, null, Z(V.value, (F) => (p(), _("div", {
2075
+ key: F.value,
2076
+ class: He(["role-item", { active: A.value === F.value }]),
2077
+ onClick: (d) => ue(F.value)
2078
+ }, [
2079
+ T(v(ga)),
2080
+ m("span", null, N(F.label), 1)
2081
+ ], 10, sl))), 128))
2082
+ ])
2083
+ ]),
2084
+ _: 1
2085
+ })
2086
+ ]),
2087
+ _: 1
2088
+ }, 8, ["active-key"])
2089
+ ]),
2090
+ m("div", rl, [
2091
+ m("div", nl, [
2092
+ m("span", il, N(q.value || "全部人员"), 1),
2093
+ m("span", dl, N(ee.value.length) + "人", 1)
2094
+ ]),
2095
+ m("div", ul, [
2096
+ T(v(n), {
2097
+ value: c.value,
2098
+ "onUpdate:value": S[5] || (S[5] = (F) => c.value = F),
2099
+ style: { width: "100%" }
2100
+ }, {
2101
+ default: k(() => [
2102
+ (p(!0), _(K, null, Z(ee.value, (F) => (p(), _("div", {
2103
+ key: F.userId,
2104
+ class: "user-item",
2105
+ onClick: (d) => ce(F.userId)
2106
+ }, [
2107
+ T(v(r), {
2108
+ value: F.userId,
2109
+ onClick: S[4] || (S[4] = we(() => {
2110
+ }, ["stop"]))
2111
+ }, {
2112
+ default: k(() => [
2113
+ m("div", pl, [
2114
+ m("div", {
2115
+ class: "user-avatar",
2116
+ style: he({ backgroundColor: pe(F.userName) })
2117
+ }, N(ne(F.userName)), 5),
2118
+ m("div", ml, [
2119
+ m("div", fl, N(F.userName), 1),
2120
+ m("div", hl, N(F.deptName), 1)
2121
+ ])
2122
+ ])
2123
+ ]),
2124
+ _: 2
2125
+ }, 1032, ["value"])
2126
+ ], 8, cl))), 128))
2127
+ ]),
2128
+ _: 1
2129
+ }, 8, ["value"]),
2130
+ ee.value.length === 0 ? (p(), U(v(y), {
2131
+ key: 0,
2132
+ description: "暂无人员"
2133
+ })) : x("", !0)
2134
+ ])
2135
+ ])
2136
+ ]),
2137
+ m("div", vl, [
2138
+ m("div", gl, [
2139
+ S[7] || (S[7] = m("span", { class: "label" }, "已选择", -1)),
2140
+ m("span", yl, N(L.value.length) + "/" + N(B.maxCount), 1),
2141
+ L.value.length > 0 ? (p(), _("div", bl, [
2142
+ (p(!0), _(K, null, Z(L.value, (F) => (p(), U(v(u), {
2143
+ key: F.userId,
2144
+ closable: "",
2145
+ onClose: (d) => re(F.userId)
2146
+ }, {
2147
+ default: k(() => [
2148
+ J(N(F.userName), 1)
2149
+ ]),
2150
+ _: 2
2151
+ }, 1032, ["onClose"]))), 128))
2152
+ ])) : x("", !0)
2153
+ ]),
2154
+ m("div", Cl, [
2155
+ T(v($), {
2156
+ size: "large",
2157
+ onClick: ge
2158
+ }, {
2159
+ default: k(() => S[8] || (S[8] = [
2160
+ J("取消")
2161
+ ])),
2162
+ _: 1,
2163
+ __: [8]
2164
+ }),
2165
+ T(v($), {
2166
+ type: "primary",
2167
+ size: "large",
2168
+ disabled: L.value.length === 0,
2169
+ onClick: ve
2170
+ }, {
2171
+ default: k(() => [
2172
+ J(" 确定(" + N(L.value.length) + "/" + N(B.maxCount) + ") ", 1)
2173
+ ]),
2174
+ _: 1
2175
+ }, 8, ["disabled"])
2176
+ ])
2177
+ ])
2178
+ ])
2179
+ ]),
2180
+ _: 1
2181
+ }, 8, ["open"]));
2182
+ }
2183
+ });
2184
+ const We = /* @__PURE__ */ le(wl, [["__scopeId", "data-v-d1da15a2"]]), kl = { class: "bsy-approval-flow" }, Fl = { class: "approval-section" }, _l = { class: "item-content" }, Sl = { class: "item-label" }, Dl = {
2185
+ key: 0,
2186
+ class: "required-mark"
2187
+ }, Al = { class: "item-value" }, Tl = {
2188
+ key: 0,
2189
+ class: "placeholder"
2190
+ }, $l = {
2191
+ key: 1,
2192
+ class: "selected-users"
2193
+ }, Vl = { class: "user-name" }, Bl = ["onClick"], Ul = { class: "cc-section" }, Rl = { class: "item-content" }, Il = { class: "item-value" }, Nl = {
2194
+ key: 0,
2195
+ class: "placeholder"
2196
+ }, zl = {
2197
+ key: 1,
2198
+ class: "selected-users"
2199
+ }, Ml = { class: "user-name" }, Ol = ["onClick"], El = { class: "chat-section" }, Ll = { class: "section-item" }, Yl = { class: "item-content" }, xl = { class: "item-value" }, jl = { class: "switch" }, Pl = {
2200
+ key: 0,
2201
+ class: "chat-desc"
2202
+ }, Jl = /* @__PURE__ */ j({
2203
+ __name: "index",
2204
+ props: {
2205
+ modelValue: { default: () => ({
2206
+ approvers: [],
2207
+ ccUsers: [],
2208
+ sendToChat: !1
2209
+ }) },
2210
+ users: { default: () => [] },
2211
+ orgTree: { default: () => [] },
2212
+ roles: { default: () => [] }
2213
+ },
2214
+ emits: ["update:modelValue", "change", "show-approver-selector", "show-cc-selector"],
2215
+ setup(D, { expose: e, emit: i }) {
2216
+ const s = D, o = i, t = z(s.modelValue.approvers || []), a = z(s.modelValue.ccUsers || []), l = z(s.modelValue.sendToChat || !1), n = z(!1), r = z(!1);
2217
+ Q(
2218
+ () => s.modelValue,
2219
+ (c) => {
2220
+ c && (t.value = c.approvers || [], a.value = c.ccUsers || [], l.value = c.sendToChat || !1);
2221
+ },
2222
+ { deep: !0 }
2223
+ ), Q(
2224
+ [t, a, l],
2225
+ () => {
2226
+ const c = {
2227
+ approvers: t.value,
2228
+ ccUsers: a.value,
2229
+ sendToChat: l.value
2230
+ };
2231
+ o("update:modelValue", c), o("change", c);
2232
+ },
2233
+ { deep: !0 }
2234
+ );
2235
+ const u = () => {
2236
+ n.value = !0, o("show-approver-selector");
2237
+ }, $ = () => {
2238
+ r.value = !0, o("show-cc-selector");
2239
+ }, y = (c) => {
2240
+ t.value = c;
2241
+ }, g = (c) => {
2242
+ a.value = c;
2243
+ }, I = (c) => {
2244
+ t.value = t.value.filter((C) => C.userId !== c);
2245
+ }, b = (c) => {
2246
+ a.value = a.value.filter((C) => C.userId !== c);
2247
+ }, M = () => {
2248
+ }, E = (c) => {
2249
+ const C = [
2250
+ "#f56a00",
2251
+ "#7265e6",
2252
+ "#ffbf00",
2253
+ "#00a2ae",
2254
+ "#87d068",
2255
+ "#108ee9",
2256
+ "#f50",
2257
+ "#2db7f5",
2258
+ "#52c41a",
2259
+ "#eb2f96",
2260
+ "#722ed1",
2261
+ "#fa8c16"
2262
+ ], V = c.charCodeAt(0) % C.length;
2263
+ return C[V];
2264
+ }, f = (c) => c.charAt(0).toUpperCase(), Y = O(() => t.value.length > 0);
2265
+ return e({
2266
+ isValid: Y,
2267
+ getApprovers: () => t.value,
2268
+ getCCUsers: () => a.value,
2269
+ getSendToChat: () => l.value,
2270
+ addApprovers: (c) => {
2271
+ const C = new Set(t.value.map((L) => L.userId)), V = c.filter((L) => !C.has(L.userId));
2272
+ t.value = [...t.value, ...V];
2273
+ },
2274
+ addCCUsers: (c) => {
2275
+ const C = new Set(a.value.map((L) => L.userId)), V = c.filter((L) => !C.has(L.userId));
2276
+ a.value = [...a.value, ...V];
2277
+ },
2278
+ reset: () => {
2279
+ t.value = [], a.value = [], l.value = !1;
2280
+ }
2281
+ }), (c, C) => (p(), _(K, null, [
2282
+ m("div", kl, [
2283
+ m("div", Fl, [
2284
+ m("div", {
2285
+ class: "section-item",
2286
+ onClick: u
2287
+ }, [
2288
+ m("div", _l, [
2289
+ m("div", Sl, [
2290
+ C[3] || (C[3] = m("span", { class: "label-text" }, "审批人", -1)),
2291
+ t.value.length ? x("", !0) : (p(), _("span", Dl, "*"))
2292
+ ]),
2293
+ m("div", Al, [
2294
+ t.value.length === 0 ? (p(), _("div", Tl, "请选择审批人")) : (p(), _("div", $l, [
2295
+ (p(!0), _(K, null, Z(t.value, (V) => (p(), _("div", {
2296
+ key: V.userId,
2297
+ class: "user-tag"
2298
+ }, [
2299
+ m("div", {
2300
+ class: "user-avatar",
2301
+ style: he({ backgroundColor: E(V.userName) })
2302
+ }, N(f(V.userName)), 5),
2303
+ m("span", Vl, N(V.userName), 1),
2304
+ m("span", {
2305
+ class: "remove-icon",
2306
+ onClick: we((L) => I(V.userId), ["stop"])
2307
+ }, " ✕ ", 8, Bl)
2308
+ ]))), 128))
2309
+ ]))
2310
+ ])
2311
+ ]),
2312
+ C[4] || (C[4] = m("span", { class: "arrow-icon" }, "›", -1))
2313
+ ]),
2314
+ t.value.length > 0 ? (p(), _("div", {
2315
+ key: 0,
2316
+ class: "add-btn",
2317
+ onClick: u
2318
+ }, C[5] || (C[5] = [
2319
+ m("span", { class: "add-icon" }, "+", -1),
2320
+ m("span", null, "添加审批人", -1)
2321
+ ]))) : x("", !0)
2322
+ ]),
2323
+ m("div", Ul, [
2324
+ m("div", {
2325
+ class: "section-item",
2326
+ onClick: $
2327
+ }, [
2328
+ m("div", Rl, [
2329
+ C[6] || (C[6] = m("div", { class: "item-label" }, [
2330
+ m("span", { class: "label-text" }, "抄送人")
2331
+ ], -1)),
2332
+ m("div", Il, [
2333
+ a.value.length === 0 ? (p(), _("div", Nl, "请选择抄送人")) : (p(), _("div", zl, [
2334
+ (p(!0), _(K, null, Z(a.value, (V) => (p(), _("div", {
2335
+ key: V.userId,
2336
+ class: "user-tag cc-tag"
2337
+ }, [
2338
+ m("div", {
2339
+ class: "user-avatar",
2340
+ style: he({ backgroundColor: E(V.userName) })
2341
+ }, N(f(V.userName)), 5),
2342
+ m("span", Ml, N(V.userName), 1),
2343
+ m("span", {
2344
+ class: "remove-icon",
2345
+ onClick: we((L) => b(V.userId), ["stop"])
2346
+ }, " ✕ ", 8, Ol)
2347
+ ]))), 128))
2348
+ ]))
2349
+ ])
2350
+ ]),
2351
+ C[7] || (C[7] = m("span", { class: "arrow-icon" }, "›", -1))
2352
+ ]),
2353
+ a.value.length > 0 ? (p(), _("div", {
2354
+ key: 0,
2355
+ class: "add-btn",
2356
+ onClick: $
2357
+ }, C[8] || (C[8] = [
2358
+ m("span", { class: "add-icon" }, "+", -1),
2359
+ m("span", null, "添加抄送人", -1)
2360
+ ]))) : x("", !0)
2361
+ ]),
2362
+ m("div", El, [
2363
+ m("div", Ll, [
2364
+ m("div", Yl, [
2365
+ C[10] || (C[10] = m("div", { class: "item-label" }, [
2366
+ m("span", { class: "label-text" }, "发送到聊天"),
2367
+ m("span", {
2368
+ class: "info-icon",
2369
+ title: "通过聊天发送给审批人"
2370
+ }, "ⓘ")
2371
+ ], -1)),
2372
+ m("div", xl, [
2373
+ m("label", jl, [
2374
+ Ze(m("input", {
2375
+ "onUpdate:modelValue": C[0] || (C[0] = (V) => l.value = V),
2376
+ type: "checkbox",
2377
+ onChange: M
2378
+ }, null, 544), [
2379
+ [ea, l.value]
2380
+ ]),
2381
+ C[9] || (C[9] = m("span", { class: "slider" }, null, -1))
2382
+ ])
2383
+ ])
2384
+ ])
2385
+ ]),
2386
+ l.value ? (p(), _("div", Pl, "通过聊天发送给审批人")) : x("", !0)
2387
+ ])
2388
+ ]),
2389
+ T(We, {
2390
+ modelValue: n.value,
2391
+ "onUpdate:modelValue": C[1] || (C[1] = (V) => n.value = V),
2392
+ users: c.users,
2393
+ "org-tree": c.orgTree,
2394
+ roles: c.roles,
2395
+ "selected-users": t.value,
2396
+ onConfirm: y
2397
+ }, null, 8, ["modelValue", "users", "org-tree", "roles", "selected-users"]),
2398
+ T(We, {
2399
+ modelValue: r.value,
2400
+ "onUpdate:modelValue": C[2] || (C[2] = (V) => r.value = V),
2401
+ users: c.users,
2402
+ "org-tree": c.orgTree,
2403
+ roles: c.roles,
2404
+ "selected-users": a.value,
2405
+ onConfirm: g
2406
+ }, null, 8, ["modelValue", "users", "org-tree", "roles", "selected-users"])
2407
+ ], 64));
2408
+ }
2409
+ });
2410
+ const Zl = /* @__PURE__ */ le(Jl, [["__scopeId", "data-v-b4ba048a"]]);
2411
+ export {
2412
+ Zl as BsyApprovalFlow,
2413
+ Ue as BsyCheckboxField,
2414
+ Re as BsyDateField,
2415
+ Ie as BsyDateRangeField,
2416
+ Me as BsyDepartmentField,
2417
+ Ql as BsyDingTalkForm,
2418
+ Kl as BsyFormInput,
2419
+ Xl as BsyFormRender,
2420
+ $e as BsyNumberField,
2421
+ Be as BsyRadioField,
2422
+ Ve as BsySelectField,
2423
+ Oe as BsySignatureField,
2424
+ Ne as BsySwitchField,
2425
+ Xe as BsyTableField,
2426
+ se as BsyTextField,
2427
+ Te as BsyTextareaField,
2428
+ ze as BsyUploadField,
2429
+ We as BsyUserSelector,
2430
+ ie as DingTalkFormAdapter
2431
+ };