liyu-pc-base 1.0.694 → 1.0.709

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.
@@ -1,834 +0,0 @@
1
- import { i as e } from "./rolldown-runtime-CWhphoD1.js";
2
- import { N as t, O as n, g as r } from "./init-plugin-CvgtEpwY.js";
3
- import { r as i } from "./RemoteSelect-C9PN5B3f.js";
4
- import { t as a } from "./_plugin-vue_export-helper-B3ysoDQm.js";
5
- import { getApiData as o } from "./api/api-model.js";
6
- import { P as s, _ as c, h as l, n as u, p as d, w as f } from "./function-BPdgB84k.js";
7
- import { useFetchData as p } from "./utils/hooks/useFetchData.js";
8
- import { i as m, r as h } from "./RemoteModal-LBD1h5AF.js";
9
- import { useTableDynamicColumns as g } from "./utils/hooks/useTableColumn.js";
10
- import { t as _ } from "./modal-tools-CrXdI5sg.js";
11
- import { t as v } from "./md5-DPogoNfX.js";
12
- import { Fragment as y, computed as b, createBlock as x, createCommentVNode as S, createElementBlock as C, createSlots as w, createTextVNode as T, createVNode as E, defineAsyncComponent as D, defineComponent as O, onMounted as k, onUnmounted as A, openBlock as j, reactive as M, ref as N, renderList as P, resolveComponent as F, toDisplayString as I, watch as L, withCtx as R } from "vue";
13
- import { message as z } from "ant-design-vue";
14
- import { debounce as B, isEqual as V } from "lodash-es";
15
- import { useRoute as H } from "vue-router";
16
- //#region src/components/FormRender/RemoteTreeSelect/index.ts
17
- var U = {}, W = () => {
18
- if (Object.keys(U).length > 0) return;
19
- let e = /* #__PURE__ */ Object.assign({}), t = n("remoteTreeSelect");
20
- Object.assign(e, t), Object.keys(e).forEach((t) => {
21
- let n = t.split("/"), r = n[n.length - 1].replace(".ts", "");
22
- U[r] = e[t].default;
23
- });
24
- }, G = (e) => (W(), U[e] == null ? (console.error("remotetreeselect没有组件:" + e), {
25
- getData: void 0,
26
- searchConfig: void 0
27
- }) : { ...U[e](`remotetreeselect_${e}`) }), K = O({
28
- name: "RemoteTreeSelect",
29
- props: {
30
- field: {
31
- type: Object,
32
- required: !0
33
- },
34
- value: {
35
- type: [
36
- Array,
37
- Number,
38
- String
39
- ],
40
- required: !1,
41
- default: () => null
42
- },
43
- search_config: {
44
- type: Object,
45
- required: !1,
46
- default: () => {}
47
- },
48
- label: {
49
- type: [Array, String],
50
- required: !1
51
- },
52
- formModel: {
53
- type: Object,
54
- required: !0
55
- }
56
- },
57
- emits: ["update:value", "update:label"],
58
- setup(e, { emit: t }) {
59
- let n = M({
60
- selectedRows: [],
61
- datasource: []
62
- }), { searchConfig: r, getData: i } = G(e.field.modalType), a = M({ ...r.model });
63
- e.value && n.selectedRows.push(e.value);
64
- let o = (t) => {
65
- let r = [];
66
- return t.forEach((t) => {
67
- n.selectedRows instanceof Array && n.selectedRows.includes(t[e.field.valueKey]) && r.push(t[e.field.labelKey]), !(n.selectedRows instanceof Array) && n.selectedRows == t[e.field.valueKey] && r.push(t[e.field.labelKey]), t.children && t.children.length > 0 && o(t.children).forEach((e) => r.push(e));
68
- }), r;
69
- }, s = () => {
70
- t("update:value", n.selectedRows), t("update:label", o(n.datasource));
71
- };
72
- L(() => e.formModel[e.field.name], () => {
73
- e.field.mode === "default" ? e.formModel[e.field.name] ? n.selectedRows = [e.formModel[e.field.name]] : n.selectedRows = [] : e.formModel[e.field.name] && e.formModel[e.field.name].length > 0 && (n.selectedRows = e.formModel[e.field.name].map((e) => e)), t("update:label", o(n.datasource));
74
- });
75
- let c = (r) => {
76
- r && z.loading({
77
- content: "刷新数据……",
78
- key: e.field.modalType
79
- }), i({
80
- ...a,
81
- ...e.search_config
82
- }, r).then(function(i) {
83
- if (n.datasource = i.data, n.datasource.length > 0 && n.selectedRows.length > 0 && typeof n.datasource[0][e.field.valueKey] == "number" && typeof n.selectedRows[0] == "string") {
84
- let t = [];
85
- n.selectedRows.map((e) => {
86
- e.split(",").map((e) => {
87
- t.push(Number(e));
88
- });
89
- }), e.field.multiple || t.length > 1 && (t.length = 1), n.selectedRows = t;
90
- }
91
- t("update:label", o(n.datasource)), r && z.success({
92
- content: "刷新数据成功",
93
- key: e.field.modalType,
94
- duration: 2
95
- });
96
- }).catch(() => {
97
- z.destroy(), z.error("接口调用失败", 10);
98
- });
99
- };
100
- return c(), {
101
- props: e,
102
- modalRef: n,
103
- search_modelRef: a,
104
- handleChange: s,
105
- btnClick: c
106
- };
107
- },
108
- data() {
109
- return { model: this.value };
110
- }
111
- });
112
- //#endregion
113
- //#region src/components/FormRender/RemoteTreeSelect/RemoteTreeSelect.vue
114
- function q(e, t, n, r, i, a) {
115
- let o = F("a-tree-select"), s = F("a-layout-content"), c = F("reload-outlined"), l = F("a-button"), u = F("a-layout-sider"), d = F("a-layout");
116
- return j(), x(d, {
117
- width: "100%",
118
- style: { "min-width": "190px" }
119
- }, {
120
- default: R(() => [E(s, null, {
121
- default: R(() => [E(o, {
122
- value: e.modalRef.selectedRows,
123
- "onUpdate:value": t[0] ||= (t) => e.modalRef.selectedRows = t,
124
- size: "small",
125
- style: { "min-width": "150px" },
126
- placeholder: e.field.placeholder,
127
- dropdownMatchSelectWidth: !1,
128
- disabled: e.field.disabled,
129
- "default-value": e.field.defaultValue,
130
- "allow-clear": e.field.allowClear,
131
- "tree-data": e.modalRef.datasource,
132
- "tree-checkable": e.field.multiple,
133
- "tree-node-filter-prop": e.field.valueKey,
134
- "tree-label-prop": e.field.labelKey,
135
- dropdownStyle: { maxHeight: "400px" },
136
- onChange: e.handleChange
137
- }, null, 8, [
138
- "value",
139
- "placeholder",
140
- "disabled",
141
- "default-value",
142
- "allow-clear",
143
- "tree-data",
144
- "tree-checkable",
145
- "tree-node-filter-prop",
146
- "tree-label-prop",
147
- "onChange"
148
- ])]),
149
- _: 1
150
- }), E(u, {
151
- width: "30px",
152
- style: { background: "rgba(0, 0, 0, 0)" }
153
- }, {
154
- default: R(() => [E(l, {
155
- size: "small",
156
- style: { width: "30px" },
157
- onClick: t[1] ||= (t) => e.btnClick(!0),
158
- type: "text"
159
- }, {
160
- icon: R(() => [E(c)]),
161
- _: 1
162
- })]),
163
- _: 1
164
- })]),
165
- _: 1
166
- });
167
- }
168
- var J = /*#__PURE__*/ a(K, [["render", q]]), Y = O({
169
- name: "RemoteTable",
170
- props: {
171
- field: {
172
- type: Object,
173
- required: !0
174
- },
175
- modalType: {
176
- type: String,
177
- required: !0,
178
- default: () => ""
179
- },
180
- value: {
181
- type: Array,
182
- required: !0,
183
- default: () => []
184
- },
185
- init_model: {
186
- type: Object,
187
- default: () => {}
188
- },
189
- field_status: {
190
- type: Object,
191
- default: () => {}
192
- },
193
- watch: {
194
- type: Array,
195
- default: () => []
196
- },
197
- formModel: {
198
- type: Object,
199
- required: !0
200
- }
201
- },
202
- emits: ["update:value"],
203
- setup(e, { emit: t }) {
204
- let n = N(!1), { searchConfig: r, searchConfigOptions: i, getData: a, columns: o, slotList: s } = h(e.modalType), u = M({
205
- ...r.model,
206
- is_active: !0,
207
- ...e.init_model
208
- });
209
- for (let t of r.fields) e.field_status && e.field_status.hasOwnProperty(t.name) && (e.field_status[t.name] == 0 ? (t.disabled = !0, t.hidden = !1) : e.field_status[t.name] == 1 ? (t.disabled = !1, t.hidden = !0) : (t.disabled = !1, t.hidden = !1));
210
- let _ = {};
211
- k(() => {
212
- if (e.watch) for (let t of e.watch) e.formModel && (_[t] = e.formModel[t]);
213
- if (e.watch && e.formModel) for (let t of e.watch) u[t] = e.formModel[t], L(() => e.formModel[t], () => {
214
- if (e.watch && e.formModel) for (let t of e.watch) _[t] != e.formModel[t] && (u[t] = e.formModel[t]);
215
- }, { immediate: !0 });
216
- });
217
- let { state: v, dynamicColumns: y } = g(o, {
218
- checkAll: !1,
219
- needRowIndex: !1
220
- }), x = b(() => S.datasource.map((t) => ({
221
- value: t[e.field.valueKey ? e.field.valueKey : "id"],
222
- label: t[e.field.labelKey ? e.field.labelKey : "name"]
223
- }))), S = M({
224
- visible: !1,
225
- selectedRows: [],
226
- selectedRowsKey: [],
227
- selectedRowsTotal: [],
228
- datasource: []
229
- }), C = {
230
- type: e.field.mode == "default" ? "radio" : (e.field.mode, "checkbox"),
231
- columnWidth: "30px",
232
- selectedRowKeys: S.selectedRowsKey,
233
- onChange: (e, t) => {
234
- let n = S.selectedRowsKey.filter((t) => e.indexOf(Number(t)) == -1);
235
- S.selectedRowsTotal = S.selectedRowsTotal.filter((e) => n.indexOf(e.id) == -1), t.forEach((e) => {
236
- S.selectedRowsKey.indexOf(e.id) == -1 && S.selectedRowsTotal.push(e);
237
- }), S.selectedRowsKey.length = 0, t.forEach((e) => {
238
- S.selectedRowsKey.push(e.id), S.datasource.push(e);
239
- });
240
- }
241
- }, { reload: w, setPageInfo: T, context: E } = p(a, {
242
- current: 1,
243
- pageSize: 20,
244
- tableSize: "middle",
245
- stripe: !0,
246
- requestParams: { ...u }
247
- });
248
- L(() => E.dataSource, () => {
249
- let e = S.selectedRowsTotal.map((e) => e.id);
250
- E.dataSource.map((t) => {
251
- e.indexOf(t.id) > -1 && S.selectedRowsKey.push(t.id);
252
- });
253
- });
254
- let D = () => {
255
- let t = [];
256
- if (e.value instanceof Array ? e.value.length > 0 && (t = e.value) : e.value && t.push(e.value), t.length > 0) {
257
- let e = [], n = [];
258
- S.datasource.map((e) => n.push(e.id)), t.map((t) => {
259
- S.selectedRows.indexOf(Number(t)) == -1 && (S.selectedRows.push(Number(t)), S.selectedRowsKey.push(Number(t))), n.indexOf(t) == -1 && e.push(t);
260
- }), e.length > 0 && a({
261
- current: 1,
262
- ...u,
263
- pageSize: 2e3,
264
- ids: e.join(",")
265
- }).then(function(e) {
266
- e.data.forEach((e) => {
267
- t.indexOf(e.id) >= 0 && (S.datasource.push(e), S.selectedRowsTotal.push(e));
268
- });
269
- });
270
- } else S.selectedRows.length = 0, S.selectedRowsKey.length = 0, S.selectedRowsTotal.length = 0;
271
- };
272
- D(), L(() => e.value, () => {
273
- D();
274
- });
275
- let O = ({ current: e, pageSize: t }, n, r) => {
276
- console.log(r), T({
277
- current: e,
278
- pageSize: t,
279
- ...n,
280
- ...u
281
- }), w();
282
- }, { validateInfos: A } = m(u, {});
283
- return {
284
- props: e,
285
- modalRef: S,
286
- datasource: x,
287
- state: E,
288
- loading: n,
289
- getDateTime: l,
290
- getDate: d,
291
- getFullDate: c,
292
- getTime: f,
293
- search: () => {
294
- T({
295
- current: 1,
296
- ...u
297
- }), w();
298
- },
299
- handleTableChange: O,
300
- rowSelection: C,
301
- searchValidateInfos: A,
302
- search_modelRef: u,
303
- searchConfig: r,
304
- searchConfigOptions: i,
305
- getData: a,
306
- columnState: v,
307
- dynamicColumns: y,
308
- slotList: s
309
- };
310
- },
311
- data() {
312
- return { model: this.value };
313
- }
314
- }), X = { key: 0 }, Z = { key: 1 }, Q = { key: 2 }, $ = { key: 3 }, ee = { key: 4 }, te = { key: 5 };
315
- function ne(e, t, n, r, i, a) {
316
- let o = F("a-tag"), s = F("a-table");
317
- return j(), x(s, {
318
- bordered: !0,
319
- size: "small",
320
- loading: e.state.loading,
321
- scroll: {
322
- y: 400,
323
- x: e.columnState.tableWidth
324
- },
325
- "row-selection": e.rowSelection,
326
- columns: e.dynamicColumns,
327
- "row-key": "id",
328
- "data-source": e.state.dataSource,
329
- pagination: {
330
- current: e.state.current,
331
- pageSize: e.state.pageSize,
332
- total: e.state.total
333
- },
334
- onChange: e.handleTableChange
335
- }, w({ _: 2 }, [P(e.slotList, (t) => ({
336
- name: t.slotName,
337
- fn: R(({ index: n, text: r }) => [
338
- t.slotName === "index" ? (j(), C("span", X, I(n + 1 + e.state.pageSize * (e.state.current - 1)), 1)) : S("", !0),
339
- t.type === "custom" ? (j(), C("span", Z, I(t["field_" + r]), 1)) : S("", !0),
340
- t.type === "datetime" ? (j(), C("span", Q, I(e.getDateTime(r)), 1)) : S("", !0),
341
- t.type === "date" ? (j(), C("span", $, I(e.getDate(r)), 1)) : S("", !0),
342
- t.type === "full_date" ? (j(), C("span", ee, I(e.getFullDate(r)), 1)) : S("", !0),
343
- t.type === "time" ? (j(), C("span", te, I(e.getTime(r)), 1)) : S("", !0),
344
- r && t.type === "boolean" ? (j(), x(o, {
345
- key: 6,
346
- color: "green"
347
- }, {
348
- default: R(() => [T(I(t.name1), 1)]),
349
- _: 2
350
- }, 1024)) : S("", !0),
351
- !r && t.type === "boolean" ? (j(), x(o, {
352
- key: 7,
353
- color: "red"
354
- }, {
355
- default: R(() => [T(I(t.name2), 1)]),
356
- _: 2
357
- }, 1024)) : S("", !0),
358
- t.type === "list" ? (j(!0), C(y, { key: 8 }, P(r, (e) => (j(), x(o, {
359
- color: "#87d068",
360
- key: e.id,
361
- style: { "margin-bottom": "1px" }
362
- }, {
363
- default: R(() => [T(I(e.name), 1)]),
364
- _: 2
365
- }, 1024))), 128)) : S("", !0)
366
- ])
367
- }))]), 1032, [
368
- "loading",
369
- "scroll",
370
- "row-selection",
371
- "columns",
372
- "data-source",
373
- "pagination",
374
- "onChange"
375
- ]);
376
- }
377
- var re = /*#__PURE__*/ a(Y, [["render", ne]]), ie = /* @__PURE__ */ e(v(), 1), ae = O({
378
- name: "RemoteSelectPro",
379
- props: {
380
- field: {
381
- type: Object,
382
- required: !0
383
- },
384
- valueKey: { type: String },
385
- labelKeyType: {
386
- type: Number,
387
- default: () => 0
388
- },
389
- labelKey: { type: String },
390
- labelSpace: {
391
- type: String,
392
- default: "-"
393
- },
394
- labelKeyList: {
395
- type: Array,
396
- default: () => []
397
- },
398
- value: {
399
- type: [
400
- Array,
401
- Number,
402
- String
403
- ],
404
- required: !1,
405
- default: () => null
406
- },
407
- label: {
408
- type: [Array, String],
409
- required: !1,
410
- default: () => []
411
- },
412
- formModel: {
413
- type: Object,
414
- required: !0
415
- },
416
- outModel: {
417
- type: Object,
418
- default: () => {}
419
- },
420
- placeholder: { type: String },
421
- init_model: {
422
- type: Object,
423
- default: () => {}
424
- },
425
- is_input: {
426
- type: Boolean,
427
- default: () => !1
428
- },
429
- init_watch: {
430
- type: Object,
431
- default: () => {}
432
- },
433
- is_form_design: {
434
- type: Boolean,
435
- default: () => !1
436
- },
437
- innerModel: { default: null },
438
- globalInnerModel: { default: null },
439
- context: {
440
- type: Object,
441
- default: null
442
- }
443
- },
444
- emits: ["update:value", "update:label"],
445
- setup(e, { emit: n }) {
446
- let i = M({
447
- selectedRows: [],
448
- datasource: []
449
- }), a = H(), c = N("remoteSelectPro"), l = N(null), d = N(""), f = t(), p = (e, t, n) => {
450
- if (n.operator === "not_blank_not_null") t.push({
451
- field_name: n.field_name,
452
- operator: n.operator,
453
- value: [],
454
- format: n.format,
455
- class_name: n.class_name
456
- });
457
- else if (e instanceof Array) {
458
- let [r] = e;
459
- s(r) && t.push({
460
- field_name: n.field_name,
461
- operator: n.operator,
462
- value: u(e, n.class_name),
463
- format: n.format,
464
- class_name: n.class_name
465
- });
466
- } else if (s(e)) {
467
- let r = e;
468
- (n.operator === "in" || n.operator === "notin") && (e.includes("[") ? r = JSON.parse(e) : e.includes(",") && (r = e.split(",")), n.class_name === "int" && (r = r.map(Number))), t.push({
469
- field_name: n.field_name,
470
- operator: n.operator,
471
- value: u(r instanceof Array ? r : [r], n.class_name),
472
- format: n.format,
473
- class_name: n.class_name
474
- });
475
- }
476
- };
477
- function m(e, t) {
478
- return t.split(".").reduce((e, t) => e?.[t], e);
479
- }
480
- let h = (t = !0) => {
481
- let n = [], r = [[{
482
- searchType: 3,
483
- field_name: "is_active",
484
- operator: "eq",
485
- value: [!0],
486
- format: "choices",
487
- class_name: "bool"
488
- }]];
489
- if (e.field.searchConditions && (r = e.field.searchConditions), r.forEach((t) => {
490
- let r = [];
491
- t.forEach((t) => {
492
- t.searchType === 1 ? Object.keys(e.outModel ? e.outModel : e.formModel).forEach((n) => {
493
- t.select_name == n && p((e.outModel ? e.outModel : e.formModel)[n], r, t);
494
- }) : t.searchType === 2 ? Object.keys(e.formModel).forEach((n) => {
495
- t.select_name == n && p(e.formModel[n], r, t);
496
- }) : t.searchType === 3 ? p(t.value, r, t) : t.searchType === 4 ? p(m(e.context, t.select_name), r, t) : p(t.value, r, t);
497
- }), n.push(r);
498
- }), d.value && t) if (v.pageSize = 50, e?.labelKeyList && e?.labelKeyList?.length > 0) e.labelKeyList.forEach((e, t) => {
499
- let r = n[t];
500
- r || (r = [], n[t] = r), r.push({
501
- field_name: e,
502
- operator: "icontains",
503
- format: "input",
504
- value: [d.value],
505
- class_name: "str"
506
- });
507
- });
508
- else if (n.length === 0) n.push([{
509
- field_name: x(),
510
- operator: "icontains",
511
- format: "input",
512
- value: [d.value],
513
- class_name: "str"
514
- }]);
515
- else for (let e of n) e.push({
516
- field_name: x(),
517
- operator: "icontains",
518
- format: "input",
519
- value: [d.value],
520
- class_name: "str"
521
- });
522
- return n;
523
- }, g = (t = !0) => {
524
- let n = {};
525
- return e.field.simpleSearchConditions && e.field.simpleSearchConditions.forEach((t) => {
526
- t.searchType === 1 ? Object.keys(e.outModel ? e.outModel : e.formModel).forEach((r) => {
527
- if (t.select_name == r) {
528
- let i = (e.outModel ? e.outModel : e.formModel)[r];
529
- n[t.field_name] = i;
530
- }
531
- }) : t.searchType === 2 ? Object.keys(e.formModel).forEach((r) => {
532
- if (t.select_name == r) {
533
- let i = e.formModel[r];
534
- n[t.field_name] = i;
535
- }
536
- }) : t.searchType === 3 ? n[t.field_name] = t.value : t.searchType === 4 && (n[t.field_name] = m(e.context, t.select_name));
537
- }), d.value && t && (e?.labelKeyList && e?.labelKeyList?.length > 0 ? e.labelKeyList.forEach((e, t) => {
538
- n[e] = d.value;
539
- }) : n[x()] = d.value), n;
540
- }, v = {
541
- current: 1,
542
- pageSize: 200,
543
- is_pagination: !0,
544
- request_source: "strict",
545
- is_active: !0,
546
- ...e.init_model,
547
- column_fields: [],
548
- sort_fields: [],
549
- conditions: [],
550
- simpleSearchParams: {}
551
- }, y = () => e.valueKey || "id", x = () => e.labelKey || "name", S = () => {
552
- let t = [];
553
- return e?.labelKeyList && e?.labelKeyList?.length > 0 && e.labelKeyType !== 1 ? t.push(...e.labelKeyList) : t.push(x()), t;
554
- }, C = () => {
555
- let t = [];
556
- e?.labelKeyList && e?.labelKeyList?.length > 0 && e.labelKeyType !== 1 ? t.push(y(), ...e.labelKeyList) : t.push(y(), x()), e.field?.extendedFields && e.field?.extendedFields.length > 0 && t.push(...e.field.extendedFields);
557
- let n = [...new Set(t)];
558
- v.column_fields = [].concat(n);
559
- };
560
- C(), v.sort_fields = S(), e.init_model?.sort_fields && (v.sort_fields = e.init_model?.sort_fields);
561
- let w = (e) => {
562
- if (Array.isArray(i.selectedRows)) {
563
- if (i.selectedRows.includes(e)) return !0;
564
- } else if (i.selectedRows === e) return !0;
565
- return !1;
566
- }, T = b(() => i.datasource.map((t) => {
567
- if (e.labelKeyList && e.labelKeyList.length > 0 && e?.labelKeyType !== 1) {
568
- let n = [];
569
- for (let r of e.labelKeyList) n.push(t[r]);
570
- return {
571
- value: t[y()],
572
- label: n.join(e.labelSpace)
573
- };
574
- } else return {
575
- value: t[y()],
576
- label: t[x()]
577
- };
578
- })), E = (t) => {
579
- if (t && !Array.isArray(t) && (t = [t]), e.field.default && !e.formModel[e.field.name] && e.field.mode == "default" && t.length > 0) {
580
- e.formModel[e.field.name] = t[0];
581
- let r = i.datasource.find((e) => {
582
- if (e[y()] == t[0]) return !0;
583
- });
584
- r && n("update:label", r[x()]);
585
- }
586
- if (e.field.mode == "default") {
587
- let e = T.value.filter((e) => w(e.value)).map((e) => e.label);
588
- n("update:label", e.length > 0 ? e[0] : "");
589
- } else n("update:label", T.value.filter((e) => w(e.value)).map((e) => e.label));
590
- }, O = () => {
591
- if (e.field.mode === "default") {
592
- let t = i.datasource.filter((e) => w(e[y()]));
593
- e.innerModel && (e.innerModel[e.field.name] = t[0]);
594
- } else {
595
- let t = i.datasource.filter((e) => w(e[y()]));
596
- e.innerModel && (e.innerModel[e.field.name] = t);
597
- }
598
- }, j = {};
599
- L(() => [e.formModel, e.context], () => {
600
- let e = U(!1);
601
- V(j, e) || (j = e, G(!0));
602
- }, { deep: !0 }), L(() => e.formModel[e.field.name], () => {
603
- if (e.field.mode === "default") {
604
- e.formModel[e.field.name] || e.formModel[e.field.name] === 0 ? i.selectedRows = [e.formModel[e.field.name]] : i.selectedRows = [];
605
- let t = T.value.filter((e) => w(e.value)).map((e) => e.label);
606
- n("update:label", t.length > 0 ? t[0] : "");
607
- } else e.formModel[e.field.name] && e.formModel[e.field.name].length > 0 ? i.selectedRows = e.formModel[e.field.name] : i.selectedRows = [], n("update:label", T.value.filter((e) => w(e.value)).map((e) => e.label));
608
- }), L(() => e.value, () => {
609
- O();
610
- }, { deep: !0 });
611
- let P = (t) => {
612
- e.field.required_condition && e.field.required_condition.find((e) => e.key === t) && G(!0);
613
- };
614
- k(() => {
615
- c.value = "remoteselectpro:" + (0, ie.default)(`${a.path}_${e.field.name}_${e.field.postUrl}`), F(), r().on("required_condition_change", P), W();
616
- }), A(() => {
617
- r().off("required_condition_change", P);
618
- });
619
- let F = () => {
620
- e.field.mode === "default" ? (e.value || e.value === 0) && (y() === "id" ? isNaN(Number(e.value)) ? i.selectedRows.push(e.value) : i.selectedRows.push(Number(e.value)) : i.selectedRows.push(e.value)) : typeof e.value == "string" ? e.value.split(",").map((e) => {
621
- y() === "id" ? isNaN(Number(e)) ? i.selectedRows.push(e) : i.selectedRows.push(Number(e)) : i.selectedRows.push(e);
622
- }) : e.value instanceof Array ? e.value.forEach((e) => {
623
- y() === "id" ? isNaN(Number(e)) ? i.selectedRows.push(e) : i.selectedRows.push(Number(e)) : i.selectedRows.push(e);
624
- }) : e.value != null && i.selectedRows.push(e.value);
625
- }, I = () => {
626
- if (e.field.mode == "default") {
627
- n("update:value", i.selectedRows);
628
- let e = T.value.filter((e) => i.selectedRows == e.value).map((e) => e.label);
629
- n("update:label", e.length > 0 ? e[0] : "");
630
- } else i.selectedRows.length, n("update:value", i.selectedRows), n("update:label", T.value.filter((e) => w(e.value)).map((e) => e.label));
631
- }, R = () => {
632
- let t = e.field.required_condition, n = {};
633
- return t && t.forEach((e) => {
634
- let t = f.value_map[e.key];
635
- t != null && (n[e.field_name] = t);
636
- }), n;
637
- }, z = async (t, n) => {
638
- if (n && !Array.isArray(n) && (n = [n]), n && n.length > 0) {
639
- let r = [];
640
- if (n.forEach((e) => {
641
- i.datasource.some((t) => t[y()] === e) || r.push(e);
642
- }), r.length > 0) {
643
- let n = { ...t };
644
- if (e.field.queryType === "simple") {
645
- let e = r;
646
- e instanceof Array && e.length > 0 && (e = e.join(",")), n[y()] = e;
647
- } else n.conditions && n.conditions.length > 0 || (n.conditions = [[]]), n.conditions[0].push({
648
- class_name: "int",
649
- operator: "in",
650
- value: r,
651
- format: "remote",
652
- field_name: y()
653
- });
654
- let a = await o({ ...n }, e.field.postUrl, !1, { skip_error: !0 });
655
- i.datasource = i.datasource.concat(a?.data || []);
656
- }
657
- }
658
- }, U = (t = !0) => {
659
- let n = {};
660
- return e.field.queryType === "simple" ? (v.simpleSearchParams = g(t), n = {
661
- ...v,
662
- ...v.simpleSearchParams,
663
- required_condition: R()
664
- }, delete n.conditions, delete n.simpleSearchParams) : (v.conditions = h(t), n = {
665
- ...v,
666
- required_condition: R()
667
- }, delete n.simpleSearchParams), n;
668
- }, W = async (t = !1) => {
669
- if (e.field.postUrl) {
670
- t && (i.datasource.length = 0);
671
- let r = i.datasource.length === 0, a = U(), s = await o(a, e.field.postUrl, !1, { skip_error: !0 });
672
- if (s?.data?.length > 0) {
673
- let e = y(), t = s?.data.filter((t) => !i.datasource.find((n) => t[e] == n[e]));
674
- i.datasource = i.datasource.concat(t), r && await z(a, i.selectedRows), O();
675
- }
676
- if (e.field.defaultValueType === "first" && !e.is_form_design) e.formModel[e.field.name] || (e.field.mode === "default" || !e.field.mode ? (n("update:label", i.datasource[0][x()]), n("update:value", i.datasource[0][y()])) : (n("update:label", [i.datasource[0][x()]]), n("update:value", [i.datasource[0][y()]])));
677
- else if (e.field.defaultValueType === "global" && !e.is_form_design) {
678
- if (!e.formModel[e.field.name]) {
679
- let t = e.field.globalDefaultKey, r = e.field.globalDefaultField, a = f.value_map[t];
680
- if (a) {
681
- let t = i.datasource.find((e) => e[r] === a);
682
- t && (e.field.mode === "default" || !e.field.mode ? (n("update:label", t[x()]), n("update:value", t[y()])) : (n("update:label", [t[x()]]), n("update:value", [t[y()]])));
683
- }
684
- }
685
- } else E(i.selectedRows);
686
- }
687
- }, G = B((e = !1) => {
688
- W(e);
689
- }, 500);
690
- L(() => [
691
- e.labelKeyList,
692
- e.labelKey,
693
- e.labelKeyType,
694
- e.valueKey,
695
- e.labelSpace,
696
- e.field.postUrl
697
- ], (e, t) => {
698
- V(e, t) || (C(), v.sort_fields = S(), G(!0));
699
- }, { deep: !0 }), L(() => [
700
- e.field.searchConditions,
701
- e.field.queryType,
702
- e.field.simpleSearchConditions
703
- ], (e, t) => {
704
- V(e, t) || G(!0);
705
- }, { deep: !0 });
706
- let K = (e) => {
707
- d.value = e, G();
708
- }, q = D(() => import("./tableModal-CK36tg4I.js"));
709
- return {
710
- props: e,
711
- modalRef: i,
712
- searchText: d,
713
- datasource: T,
714
- handleChange: I,
715
- handleSearch: K,
716
- filterOption: (e, t) => {
717
- if (T.value instanceof Array) {
718
- let n = T.value.find((e) => e.value == t.key);
719
- return n ? String(n.label).toLowerCase().indexOf(e.toLowerCase()) >= 0 : !1;
720
- }
721
- },
722
- handleOpenTable: () => {
723
- let t = [];
724
- d.value = "";
725
- let r = "checkbox";
726
- e.field.mode === "default" && (r = "radio"), t = T.value ? T.value.filter((e) => w(e.value)) : [], l.value = {
727
- key: c.value,
728
- title: e.field.label || e.field.name,
729
- rowSelectionType: r,
730
- columns: e.field.table?.columns || [],
731
- search_config: e.field.table?.search_config || [],
732
- list_url: e.field.postUrl,
733
- is_selection: !0,
734
- is_pagination: !0,
735
- hide_header: !0
736
- };
737
- let a = e.init_model || {};
738
- if (e.field.queryType === "simple") l.value.query_params = {
739
- ...a,
740
- ...g()
741
- };
742
- else {
743
- let e = h();
744
- l.value.query_params = a, e.length > 0 && e[0].length > 0 && (l.value.base_conditions = e[0]);
745
- }
746
- let o = R();
747
- o && (l.value.query_params = {
748
- ...l.value.query_params,
749
- required_condition: o
750
- }), _(M({
751
- open: !0,
752
- loading: !1,
753
- component: q,
754
- isMultiple: e.field.mode !== "default",
755
- tableConfig: l.value,
756
- labelKey: e.labelKey || "name",
757
- value: t,
758
- labelKeyList: e.labelKeyList || [],
759
- labelKeyType: e.labelKeyType || 1,
760
- labelSpace: e.labelSpace || "-",
761
- valueKey: e.valueKey || "id",
762
- ok: async (t) => {
763
- let r = t.map((e) => e.value) || [], a = t.map((e) => e.label) || [], o = U();
764
- e.field.mode == "default" ? r.length == 0 ? (i.selectedRows = void 0, n("update:value", i.selectedRows), n("update:label", void 0)) : (i.selectedRows = r[0], await z(o, r[0]), n("update:value", i.selectedRows), n("update:label", a[0])) : (i.selectedRows = r, await z(o, r), n("update:value", i.selectedRows), n("update:label", a));
765
- },
766
- cancel: () => {
767
- console.log("cancel");
768
- }
769
- }));
770
- },
771
- tableConfig: l
772
- };
773
- },
774
- data() {
775
- return { model: this.value };
776
- },
777
- components: { BoldMatcher: i }
778
- }), oe = { class: "remote-select-pro" }, se = {
779
- key: 0,
780
- class: "table-search-icon",
781
- style: { "margin-right": "5px" }
782
- };
783
- function ce(e, t, n, r, i, a) {
784
- let o = F("bold-matcher"), s = F("a-select-option"), c = F("a-select"), l = F("FileSearchOutlined");
785
- return j(), C("div", oe, [E(c, {
786
- value: e.modalRef.selectedRows,
787
- "onUpdate:value": t[0] ||= (t) => e.modalRef.selectedRows = t,
788
- "allow-clear": e.field.allowClear !== !1,
789
- "default-value": e.field.defaultValue,
790
- disabled: e.field.disabled,
791
- "filter-option": e.filterOption,
792
- maxTagCount: e.field.maxTagCount ? e.field.maxTagCount : "responsive",
793
- mode: e.field.mode == "default" ? null : e.field.mode,
794
- placeholder: e.placeholder,
795
- "show-search": e.field.show_search !== !1,
796
- size: "small",
797
- autoClearSearchValue: !1,
798
- onChange: e.handleChange,
799
- onSearch: e.handleSearch,
800
- style: { "min-width": "120px" }
801
- }, {
802
- default: R(() => [(j(!0), C(y, null, P(e.datasource, (t) => (j(), x(s, {
803
- key: t.value,
804
- value: t.value
805
- }, {
806
- default: R(() => [E(o, {
807
- text: t.label,
808
- pattern: e.searchText,
809
- color: e.field.searchColor
810
- }, null, 8, [
811
- "text",
812
- "pattern",
813
- "color"
814
- ])]),
815
- _: 2
816
- }, 1032, ["value"]))), 128))]),
817
- _: 1
818
- }, 8, [
819
- "value",
820
- "allow-clear",
821
- "default-value",
822
- "disabled",
823
- "filter-option",
824
- "maxTagCount",
825
- "mode",
826
- "placeholder",
827
- "show-search",
828
- "onChange",
829
- "onSearch"
830
- ]), e.field.table?.enable ? (j(), C("div", se, [E(l, { onClick: e.handleOpenTable }, null, 8, ["onClick"])])) : S("", !0)]);
831
- }
832
- var le = /*#__PURE__*/ a(ae, [["render", ce], ["__scopeId", "data-v-eb9dcae8"]]);
833
- //#endregion
834
- export { re as n, J as r, le as t };