@dazhicheng/ui 1.5.218 → 1.5.219
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.
|
@@ -50,6 +50,8 @@ export interface UseFormSchemasLinkFieldConfig {
|
|
|
50
50
|
onChange?: (values: unknown, context: FieldOnChangeContext) => void;
|
|
51
51
|
/** 是否展示全部选项 */
|
|
52
52
|
showAll?: boolean;
|
|
53
|
+
/** “全部”选项的值,默认为 "all"。用于自定义“全部”选项对应的 value,与 TtPanelSelect 的 showAllField 对齐 */
|
|
54
|
+
showAllField?: string | number;
|
|
53
55
|
/**
|
|
54
56
|
* @description 自定义过滤数据源
|
|
55
57
|
* @param values 表单对象
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useDataPermissionOptions as
|
|
1
|
+
import { useDataPermissionOptions as J } from "./useDataPermissionOptions.js";
|
|
2
2
|
import "axios";
|
|
3
|
-
import { ElSelectV2 as
|
|
3
|
+
import { ElSelectV2 as K } from "element-plus";
|
|
4
4
|
import { isFunction as x } from "../packages/utils/src/is.js";
|
|
5
5
|
import "vue";
|
|
6
6
|
import "xe-utils";
|
|
@@ -12,163 +12,173 @@ import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
|
|
|
12
12
|
import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
|
|
13
13
|
import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
14
14
|
import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
15
|
-
import { omit as
|
|
16
|
-
const
|
|
15
|
+
import { omit as Q } from "lodash-es";
|
|
16
|
+
const U = "all", W = { label: "全部", value: U }, R = [
|
|
17
17
|
"platformId",
|
|
18
18
|
"shopId",
|
|
19
19
|
"purchasePlaceId",
|
|
20
20
|
"businessType",
|
|
21
21
|
"lockUserId",
|
|
22
22
|
"userId"
|
|
23
|
-
],
|
|
23
|
+
], X = {
|
|
24
24
|
platformId: "platformIds",
|
|
25
25
|
shopId: "shopIds",
|
|
26
26
|
purchasePlaceId: "purchasePlaceId",
|
|
27
27
|
businessType: "businessType",
|
|
28
28
|
lockUserId: "lockUserId"
|
|
29
|
-
},
|
|
29
|
+
}, Y = {
|
|
30
30
|
platformId: "平台",
|
|
31
31
|
shopId: "店铺",
|
|
32
32
|
purchasePlaceId: "采购地",
|
|
33
33
|
businessType: "业务线",
|
|
34
34
|
lockUserId: "锁单人"
|
|
35
35
|
};
|
|
36
|
-
function M(
|
|
37
|
-
return typeof
|
|
36
|
+
function M(e) {
|
|
37
|
+
return typeof e == "string" && e.toLowerCase() === U.toLowerCase();
|
|
38
38
|
}
|
|
39
|
-
function _(
|
|
40
|
-
return Array.isArray(
|
|
39
|
+
function _(e) {
|
|
40
|
+
return Array.isArray(e) ? e : e == null || e === "" ? [] : [e];
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
return [
|
|
42
|
+
function Z(e = []) {
|
|
43
|
+
return [W].concat(e);
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
return
|
|
45
|
+
function $(e, l, c, A) {
|
|
46
|
+
return e ? x(e) ? e(l, c, A) : e : {};
|
|
47
47
|
}
|
|
48
|
-
function B(
|
|
49
|
-
var
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
|
|
48
|
+
function B(e, l, c, A) {
|
|
49
|
+
var C;
|
|
50
|
+
l == null || l(e);
|
|
51
|
+
const g = A(), u = (C = g.values) == null ? void 0 : C[g.fieldName];
|
|
52
|
+
c == null || c(u, g);
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
const
|
|
56
|
-
(o, n) =>
|
|
54
|
+
function y(e = {}, l = R) {
|
|
55
|
+
const c = e.scene || "list", A = l.reduce(
|
|
56
|
+
(o, n) => {
|
|
57
|
+
if (n === "userId") return o;
|
|
58
|
+
const t = I(n), s = t.component === "TtPanelSelect";
|
|
59
|
+
return o[n] = s ? !1 : t.showAll ?? !1, o;
|
|
60
|
+
},
|
|
57
61
|
{}
|
|
58
|
-
), { dataSource:
|
|
59
|
-
codes:
|
|
60
|
-
dataSource:
|
|
61
|
-
showAll:
|
|
62
|
+
), { dataSource: g } = J({
|
|
63
|
+
codes: l,
|
|
64
|
+
dataSource: e.dataSource,
|
|
65
|
+
showAll: A
|
|
62
66
|
});
|
|
63
|
-
function
|
|
64
|
-
return
|
|
67
|
+
function u(o) {
|
|
68
|
+
return I(o).fieldName || X[o];
|
|
65
69
|
}
|
|
66
|
-
function
|
|
67
|
-
return
|
|
70
|
+
function C(o) {
|
|
71
|
+
return I(o).rules;
|
|
68
72
|
}
|
|
69
73
|
function F(o) {
|
|
70
|
-
return
|
|
74
|
+
return I(o).label || Y[o];
|
|
71
75
|
}
|
|
72
|
-
function
|
|
76
|
+
function I(o) {
|
|
73
77
|
var n;
|
|
74
|
-
return ((n =
|
|
78
|
+
return ((n = e.fieldConfigs) == null ? void 0 : n[o]) || {};
|
|
79
|
+
}
|
|
80
|
+
function b(o) {
|
|
81
|
+
return I(o).showAllField ?? U;
|
|
75
82
|
}
|
|
76
|
-
function
|
|
77
|
-
const
|
|
78
|
-
if (!n) return
|
|
79
|
-
if (!
|
|
83
|
+
function V(o, n) {
|
|
84
|
+
const t = I(o).dependencies;
|
|
85
|
+
if (!n) return t;
|
|
86
|
+
if (!t) return n;
|
|
80
87
|
const s = {
|
|
81
88
|
...n,
|
|
82
|
-
...
|
|
89
|
+
...t
|
|
83
90
|
};
|
|
84
|
-
if (n &&
|
|
85
|
-
const
|
|
86
|
-
s.triggerFields = r ??
|
|
91
|
+
if (n && t) {
|
|
92
|
+
const f = n.triggerFields, r = t.triggerFields;
|
|
93
|
+
s.triggerFields = r ?? f;
|
|
87
94
|
}
|
|
88
95
|
return s;
|
|
89
96
|
}
|
|
90
97
|
function O(o) {
|
|
91
|
-
return
|
|
98
|
+
return I(o).component || "TtApiComponent";
|
|
92
99
|
}
|
|
93
|
-
function
|
|
94
|
-
return
|
|
100
|
+
function S(o) {
|
|
101
|
+
return I(o).multiple ?? !0;
|
|
95
102
|
}
|
|
96
|
-
function
|
|
97
|
-
return
|
|
103
|
+
function w(o) {
|
|
104
|
+
return g.value[o] || [];
|
|
98
105
|
}
|
|
99
|
-
function
|
|
106
|
+
function j(o) {
|
|
100
107
|
return _(o).some((n) => M(n));
|
|
101
108
|
}
|
|
102
|
-
function
|
|
103
|
-
const n =
|
|
104
|
-
return
|
|
109
|
+
function N(o) {
|
|
110
|
+
const n = j(o), t = Array.isArray(o) ? o.length > 1 : !1;
|
|
111
|
+
return c === "action" && (n || t);
|
|
105
112
|
}
|
|
106
|
-
function
|
|
107
|
-
const n =
|
|
108
|
-
if (!
|
|
109
|
-
return
|
|
110
|
-
if (
|
|
111
|
-
const s = n.filter((r) =>
|
|
112
|
-
return !s.some((r) => M(r.value)) || s.length <= 1 ? s :
|
|
113
|
+
function q(o) {
|
|
114
|
+
const n = w("shopId"), t = _(o);
|
|
115
|
+
if (!t.length)
|
|
116
|
+
return c === "action" ? [] : n;
|
|
117
|
+
if (N(o)) return [];
|
|
118
|
+
const s = n.filter((r) => t.includes(r.platformId));
|
|
119
|
+
return !s.some((r) => M(r.value)) || s.length <= 1 ? s : Z(s.filter((r) => !M(r.value)));
|
|
113
120
|
}
|
|
114
|
-
function E(o, n,
|
|
115
|
-
const r =
|
|
116
|
-
var
|
|
117
|
-
return (
|
|
118
|
-
}) || [] : s.find((
|
|
121
|
+
function E(o, n, t, s, f) {
|
|
122
|
+
const r = u(o), P = f ? s.filter((i) => {
|
|
123
|
+
var m;
|
|
124
|
+
return (m = n[r]) == null ? void 0 : m.includes(i.value);
|
|
125
|
+
}) || [] : s.find((i) => i.value === n[r]);
|
|
119
126
|
return {
|
|
120
127
|
values: n,
|
|
121
|
-
actions:
|
|
128
|
+
actions: t,
|
|
122
129
|
fieldName: r,
|
|
123
130
|
dataType: o,
|
|
124
131
|
options: s,
|
|
125
|
-
currentOption:
|
|
132
|
+
currentOption: P
|
|
126
133
|
};
|
|
127
134
|
}
|
|
128
|
-
function
|
|
129
|
-
const r =
|
|
135
|
+
function L(o, n, t, s, f) {
|
|
136
|
+
const r = I(o), P = $(r.componentProps, n, t, s), i = S(o), { onChange: m, ...a } = P, p = x(r.customOptions) ? r.customOptions(n, s) : s;
|
|
130
137
|
return r.component === "TtPanelSelect" ? {
|
|
131
|
-
multiple:
|
|
138
|
+
multiple: i,
|
|
132
139
|
showAll: r.showAll ?? !1,
|
|
133
|
-
|
|
140
|
+
showAllField: b(o),
|
|
141
|
+
...a,
|
|
134
142
|
options: p,
|
|
135
|
-
onChange(
|
|
143
|
+
onChange(h) {
|
|
136
144
|
B(
|
|
137
|
-
|
|
138
|
-
|
|
145
|
+
h,
|
|
146
|
+
void 0,
|
|
139
147
|
r.onChange,
|
|
140
|
-
() => E(o, n,
|
|
148
|
+
() => E(o, n, t, p, i)
|
|
141
149
|
);
|
|
142
150
|
}
|
|
143
151
|
} : {
|
|
144
|
-
multiple:
|
|
145
|
-
component:
|
|
146
|
-
|
|
152
|
+
multiple: i,
|
|
153
|
+
component: K,
|
|
154
|
+
showOriginMode: !1,
|
|
155
|
+
showPinyinMode: !0,
|
|
156
|
+
...a,
|
|
147
157
|
options: p,
|
|
148
|
-
onChange(
|
|
158
|
+
onChange(h) {
|
|
149
159
|
B(
|
|
150
|
-
|
|
151
|
-
|
|
160
|
+
h,
|
|
161
|
+
f,
|
|
152
162
|
r.onChange,
|
|
153
|
-
() => E(o, n,
|
|
163
|
+
() => E(o, n, t, p, i)
|
|
154
164
|
);
|
|
155
165
|
}
|
|
156
166
|
};
|
|
157
167
|
}
|
|
158
|
-
function
|
|
159
|
-
const n =
|
|
168
|
+
function k(o) {
|
|
169
|
+
const n = u(o);
|
|
160
170
|
return {
|
|
161
171
|
component: O(o),
|
|
162
172
|
fieldName: n,
|
|
163
173
|
label: F(o),
|
|
164
|
-
rules:
|
|
165
|
-
dependencies:
|
|
166
|
-
componentProps: (
|
|
167
|
-
var
|
|
168
|
-
const
|
|
169
|
-
return
|
|
170
|
-
const
|
|
171
|
-
|
|
174
|
+
rules: C(o),
|
|
175
|
+
dependencies: V(o),
|
|
176
|
+
componentProps: (t, s) => {
|
|
177
|
+
var a;
|
|
178
|
+
const f = w(o), r = u(o), P = S(o), i = b(o), m = ((a = t[r]) == null ? void 0 : a.at(-1)) !== i;
|
|
179
|
+
return L(o, t, s, f, (p) => {
|
|
180
|
+
const d = t[r];
|
|
181
|
+
P && (m && (p == null ? void 0 : p.at(-1)) === i ? t[r] = [i] : t[r] = d == null ? void 0 : d.filter((h) => h !== i));
|
|
172
182
|
});
|
|
173
183
|
}
|
|
174
184
|
};
|
|
@@ -177,113 +187,113 @@ function Z(t = {}, c = R) {
|
|
|
177
187
|
// 平台
|
|
178
188
|
platformId: {
|
|
179
189
|
component: O("platformId"),
|
|
180
|
-
fieldName:
|
|
190
|
+
fieldName: u("platformId"),
|
|
181
191
|
label: F("platformId"),
|
|
182
|
-
rules:
|
|
192
|
+
rules: C("platformId"),
|
|
183
193
|
componentProps: (o, n) => {
|
|
184
|
-
var
|
|
185
|
-
const
|
|
186
|
-
return
|
|
187
|
-
const
|
|
188
|
-
r && (
|
|
194
|
+
var p;
|
|
195
|
+
const t = "platformId", s = u(t), f = u("shopId"), r = S(t), P = S("shopId"), i = w(t), m = b(t), a = ((p = o[s]) == null ? void 0 : p.at(-1)) !== m;
|
|
196
|
+
return L(t, o, n, i, (d) => {
|
|
197
|
+
const h = o[s];
|
|
198
|
+
r && (a && (d == null ? void 0 : d.at(-1)) === m ? o[s] = [m] : o[s] = h == null ? void 0 : h.filter((G) => G !== m)), o[f] = P ? [] : void 0;
|
|
189
199
|
});
|
|
190
200
|
}
|
|
191
201
|
},
|
|
192
202
|
// 店铺
|
|
193
203
|
shopId: {
|
|
194
204
|
component: O("shopId"),
|
|
195
|
-
fieldName:
|
|
205
|
+
fieldName: u("shopId"),
|
|
196
206
|
label: F("shopId"),
|
|
197
207
|
componentProps: (o, n) => {
|
|
198
|
-
var
|
|
199
|
-
const
|
|
200
|
-
return
|
|
201
|
-
const
|
|
202
|
-
|
|
208
|
+
var a;
|
|
209
|
+
const t = "shopId", s = u(t), f = o[u("platformId")], r = q(f), P = S(t), i = b(t), m = ((a = o[s]) == null ? void 0 : a.at(-1)) !== i;
|
|
210
|
+
return L(t, o, n, r, (p) => {
|
|
211
|
+
const d = o[s];
|
|
212
|
+
P && (m && (p == null ? void 0 : p.at(-1)) === i ? o[s] = [i] : o[s] = d == null ? void 0 : d.filter((h) => h !== i));
|
|
203
213
|
});
|
|
204
214
|
},
|
|
205
|
-
dependencies:
|
|
206
|
-
triggerFields: [
|
|
215
|
+
dependencies: V("shopId", {
|
|
216
|
+
triggerFields: [u("platformId")],
|
|
207
217
|
disabled(o) {
|
|
208
|
-
return
|
|
218
|
+
return N(o[u("platformId")]);
|
|
209
219
|
},
|
|
210
220
|
rules(o) {
|
|
211
|
-
return
|
|
221
|
+
return N(o[u("platformId")]) ? null : C("shopId") || null;
|
|
212
222
|
}
|
|
213
223
|
})
|
|
214
224
|
},
|
|
215
|
-
purchasePlaceId:
|
|
216
|
-
businessType:
|
|
217
|
-
lockUserId:
|
|
225
|
+
purchasePlaceId: k("purchasePlaceId"),
|
|
226
|
+
businessType: k("businessType"),
|
|
227
|
+
lockUserId: k("lockUserId")
|
|
218
228
|
};
|
|
219
|
-
function
|
|
229
|
+
function z() {
|
|
220
230
|
return Object.keys(D).reduce(
|
|
221
231
|
(o, n) => {
|
|
222
|
-
var
|
|
223
|
-
const
|
|
232
|
+
var f;
|
|
233
|
+
const t = D[n], s = (f = e.fieldConfigs) == null ? void 0 : f[n];
|
|
224
234
|
return o[n] = {
|
|
225
|
-
...
|
|
226
|
-
...
|
|
235
|
+
...t,
|
|
236
|
+
...Q(s, ["componentProps", "rules"])
|
|
227
237
|
}, o;
|
|
228
238
|
},
|
|
229
239
|
{}
|
|
230
240
|
);
|
|
231
241
|
}
|
|
232
242
|
return {
|
|
233
|
-
...
|
|
234
|
-
dataSource:
|
|
243
|
+
...z(),
|
|
244
|
+
dataSource: g
|
|
235
245
|
};
|
|
236
246
|
}
|
|
237
|
-
function
|
|
238
|
-
const
|
|
247
|
+
function mo() {
|
|
248
|
+
const e = {
|
|
239
249
|
options: {},
|
|
240
250
|
codes: [...R]
|
|
241
|
-
},
|
|
251
|
+
}, l = {
|
|
242
252
|
/**
|
|
243
253
|
* @description 渲染查询场景
|
|
244
254
|
*/
|
|
245
255
|
list() {
|
|
246
|
-
return
|
|
256
|
+
return e.options.scene = "list", l;
|
|
247
257
|
},
|
|
248
258
|
/**
|
|
249
259
|
* @description 渲染新增编辑场景
|
|
250
260
|
*/
|
|
251
261
|
action() {
|
|
252
|
-
return
|
|
262
|
+
return e.options.scene = "action", l;
|
|
253
263
|
},
|
|
254
264
|
/**
|
|
255
265
|
* @param scene 场景值 list为查询 action为新增编辑等操作
|
|
256
266
|
* @returns FormSchemasLinkBuilder
|
|
257
267
|
*/
|
|
258
|
-
scene(
|
|
259
|
-
return
|
|
268
|
+
scene(c) {
|
|
269
|
+
return e.options.scene = c, l;
|
|
260
270
|
},
|
|
261
271
|
/**
|
|
262
272
|
* @param codes 接口请求所需要的入参,需要什么数据源就传什么入参
|
|
263
273
|
* @returns FormSchemasLinkBuilder
|
|
264
274
|
*/
|
|
265
|
-
codes(
|
|
266
|
-
return
|
|
275
|
+
codes(c) {
|
|
276
|
+
return e.codes = [...c], l;
|
|
267
277
|
},
|
|
268
|
-
dataSource(
|
|
269
|
-
return
|
|
278
|
+
dataSource(c) {
|
|
279
|
+
return e.options.dataSource = c, l;
|
|
270
280
|
},
|
|
271
|
-
field(
|
|
272
|
-
var
|
|
273
|
-
return
|
|
274
|
-
...
|
|
275
|
-
[
|
|
276
|
-
...((
|
|
277
|
-
...
|
|
281
|
+
field(c, A) {
|
|
282
|
+
var g;
|
|
283
|
+
return e.options.fieldConfigs = {
|
|
284
|
+
...e.options.fieldConfigs,
|
|
285
|
+
[c]: {
|
|
286
|
+
...((g = e.options.fieldConfigs) == null ? void 0 : g[c]) || {},
|
|
287
|
+
...A
|
|
278
288
|
}
|
|
279
|
-
},
|
|
289
|
+
}, l;
|
|
280
290
|
},
|
|
281
291
|
build() {
|
|
282
|
-
return
|
|
292
|
+
return y(e.options, e.codes);
|
|
283
293
|
}
|
|
284
294
|
};
|
|
285
|
-
return
|
|
295
|
+
return l;
|
|
286
296
|
}
|
|
287
297
|
export {
|
|
288
|
-
|
|
298
|
+
mo as useFormSchemasLink
|
|
289
299
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dazhicheng/ui",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.219",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"vue-router": "^5.0.2",
|
|
68
68
|
"vxe-pc-ui": "^4.12.36",
|
|
69
69
|
"vxe-table": "^4.17.48",
|
|
70
|
-
"@dazhicheng/
|
|
71
|
-
"@dazhicheng/
|
|
70
|
+
"@dazhicheng/utils": "1.3.41",
|
|
71
|
+
"@dazhicheng/hooks": "1.4.44"
|
|
72
72
|
},
|
|
73
73
|
"files": [
|
|
74
74
|
"dist"
|