vome-core 0.0.91 → 0.0.93
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.
- package/dist/admin/config/plugin-dev.js +1 -67
- package/dist/admin/crud/components/vm-switch.vue +1 -1
- package/dist/admin/crud/config.js +1 -33
- package/dist/admin/crud/confirm.js +1 -97
- package/dist/admin/crud/dict.js +1 -67
- package/dist/admin/crud/index.js +1 -81
- package/dist/admin/crud/key.js +1 -20
- package/dist/admin/crud/mitt.js +1 -21
- package/dist/admin/crud/plugins.js +1 -278
- package/dist/admin/crud/span.js +1 -35
- package/dist/admin/crud/style.js +1 -132
- package/dist/admin/crud/validate.js +1 -92
- package/dist/admin/crud/vm-search.vue +4 -4
- package/dist/admin/crud/vm-table.vue +2 -2
- package/dist/admin/crud/vm-upsert.vue +1 -1
- package/dist/admin/directives/perm.js +1 -14
- package/dist/admin/hooks/useUpload.js +1 -63
- package/dist/admin/lib/browser.js +1 -24
- package/dist/admin/lib/cn.js +1 -5
- package/dist/admin/lib/dialog-float.js +1 -13
- package/dist/admin/lib/export-excel.js +1 -64
- package/dist/admin/lib/import-excel.js +1 -61
- package/dist/admin/lib/json.js +1 -42
- package/dist/admin/lib/menu.js +1 -11
- package/dist/admin/lib/tree.js +1 -1
- package/dist/admin/lib/upload.js +1 -88
- package/dist/admin/lib/video-frame.js +1 -80
- package/dist/client/dict.d.ts +1 -4
- package/dist/client/dict.js +1 -8
- package/dist/index.js +1 -28215
- package/dist/server/index.js +1 -36228
- package/dist/shared/excel.js +1 -93
- package/dist/shared/index.js +1 -20
- package/dist/shared/locale-json.js +1 -68
- package/dist/shared/tree.js +1 -39
- package/package.json +1 -1
|
@@ -1,278 +1 @@
|
|
|
1
|
-
import { findEpsEntity } from "../lib/eps";
|
|
2
|
-
import { getCrudStyle } from "./style";
|
|
3
|
-
export function toTree(options = {}) {
|
|
4
|
-
return {
|
|
5
|
-
__plugin: "toTree",
|
|
6
|
-
tree: true,
|
|
7
|
-
lazy: options.lazy ?? false
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
export function setFocus(prop) {
|
|
11
|
-
return {
|
|
12
|
-
__plugin: "setFocus",
|
|
13
|
-
prop: prop ?? ""
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export function setRules() {
|
|
17
|
-
return {
|
|
18
|
-
__plugin: "setRules"
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export function setAuto(options = { hideLabel: true }) {
|
|
22
|
-
return {
|
|
23
|
-
__plugin: "setAuto",
|
|
24
|
-
...options
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
export const Plugins = {
|
|
28
|
-
Table: { toTree },
|
|
29
|
-
Form: { setFocus, setRules },
|
|
30
|
-
Search: { setAuto }
|
|
31
|
-
};
|
|
32
|
-
export function applyTablePlugins(options) {
|
|
33
|
-
const style = getCrudStyle().table;
|
|
34
|
-
const base = {
|
|
35
|
-
border: style.border,
|
|
36
|
-
autoHeight: style.autoHeight,
|
|
37
|
-
contextMenu: style.contextMenu,
|
|
38
|
-
...options
|
|
39
|
-
};
|
|
40
|
-
const plugins = [
|
|
41
|
-
...style.plugins,
|
|
42
|
-
...options?.plugins || []
|
|
43
|
-
];
|
|
44
|
-
const next = { ...base };
|
|
45
|
-
delete next.plugins;
|
|
46
|
-
for (const p of plugins) {
|
|
47
|
-
if (!p || typeof p !== "object")
|
|
48
|
-
continue;
|
|
49
|
-
if (p.__plugin === "toTree") {
|
|
50
|
-
next.tree = true;
|
|
51
|
-
next.treeLazy = Boolean(p.lazy);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return next;
|
|
55
|
-
}
|
|
56
|
-
function stripAlias(name) {
|
|
57
|
-
return name.includes(".") ? name.split(".").pop() : name;
|
|
58
|
-
}
|
|
59
|
-
function toSource(column) {
|
|
60
|
-
const expr = column.trim().replace(/\s+as\s+[a-zA-Z_]\w*$/i, "").trim();
|
|
61
|
-
return expr.includes(".") ? expr : `a.${expr}`;
|
|
62
|
-
}
|
|
63
|
-
function parseRef(ref) {
|
|
64
|
-
const AS_RE = /^(.+?)\s+as\s+([a-zA-Z_]\w*)$/i;
|
|
65
|
-
const splitAs = (input) => {
|
|
66
|
-
const raw = input.trim();
|
|
67
|
-
const m = raw.match(AS_RE);
|
|
68
|
-
if (m)
|
|
69
|
-
return { expr: m[1].trim(), asName: m[2] };
|
|
70
|
-
return { expr: raw, asName: undefined };
|
|
71
|
-
};
|
|
72
|
-
if (typeof ref === "string") {
|
|
73
|
-
const { expr, asName } = splitAs(ref);
|
|
74
|
-
const source = toSource(expr);
|
|
75
|
-
const column = stripAlias(source);
|
|
76
|
-
return {
|
|
77
|
-
column,
|
|
78
|
-
source,
|
|
79
|
-
param: asName ?? column,
|
|
80
|
-
multiple: true,
|
|
81
|
-
none: false
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
if (!ref || typeof ref !== "object")
|
|
85
|
-
return null;
|
|
86
|
-
const o = ref;
|
|
87
|
-
if (!o.column)
|
|
88
|
-
return null;
|
|
89
|
-
const { expr, asName } = splitAs(o.column);
|
|
90
|
-
const source = toSource(expr);
|
|
91
|
-
const column = stripAlias(source);
|
|
92
|
-
return {
|
|
93
|
-
column,
|
|
94
|
-
source,
|
|
95
|
-
param: asName ?? column,
|
|
96
|
-
label: o.label,
|
|
97
|
-
dict: o.dict,
|
|
98
|
-
multiple: o.multiple !== false,
|
|
99
|
-
none: Boolean(o.none)
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
function displayName(ref, meta) {
|
|
103
|
-
return ref.label || meta?.comment || ref.column;
|
|
104
|
-
}
|
|
105
|
-
function fieldKeyOf(ref, meta) {
|
|
106
|
-
const table = meta?.table?.trim();
|
|
107
|
-
const prop = (meta?.propertyName || ref.column || "").trim();
|
|
108
|
-
if (!table || !prop)
|
|
109
|
-
return;
|
|
110
|
-
return `${table}.${prop}`;
|
|
111
|
-
}
|
|
112
|
-
export function buildAutoSearchItems(service, options = {}) {
|
|
113
|
-
const ignore = new Set(options.ignoreFields || []);
|
|
114
|
-
const search = service.search || {};
|
|
115
|
-
let fieldEq = search.fieldEq || [];
|
|
116
|
-
let fieldLike = search.fieldLike || [];
|
|
117
|
-
let fieldArray = search.fieldArray || [];
|
|
118
|
-
let fieldRange = search.fieldRange || [];
|
|
119
|
-
let keyWordLikeFields = search.keyWordLikeFields || [];
|
|
120
|
-
let cols = [];
|
|
121
|
-
const entity = service.namespace ? findEpsEntity(`/${service.namespace}`) : undefined;
|
|
122
|
-
if (entity) {
|
|
123
|
-
cols = [
|
|
124
|
-
...entity.columns || [],
|
|
125
|
-
...entity.pageColumns || []
|
|
126
|
-
];
|
|
127
|
-
if (!service.search) {
|
|
128
|
-
const op = entity.pageQueryOp;
|
|
129
|
-
if (op) {
|
|
130
|
-
fieldEq = op.fieldEq || [];
|
|
131
|
-
fieldLike = op.fieldLike || [];
|
|
132
|
-
fieldArray = op.fieldArray || [];
|
|
133
|
-
fieldRange = op.fieldRange || [];
|
|
134
|
-
keyWordLikeFields = op.keyWordLikeFields || [];
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
const colOf = (sourceOrName, short) => {
|
|
139
|
-
const source = sourceOrName.includes(".") ? sourceOrName : `a.${sourceOrName}`;
|
|
140
|
-
const leaf = short ?? stripAlias(source);
|
|
141
|
-
return cols.find((c) => c.source === source) || cols.find((c) => c.propertyName === leaf && (!c.source || c.source.startsWith("a."))) || cols.find((c) => c.propertyName === leaf);
|
|
142
|
-
};
|
|
143
|
-
const items = [];
|
|
144
|
-
const usedProps = new Set;
|
|
145
|
-
const pushItem = (item) => {
|
|
146
|
-
if (!item.prop || usedProps.has(item.prop))
|
|
147
|
-
return;
|
|
148
|
-
usedProps.add(item.prop);
|
|
149
|
-
items.push(item);
|
|
150
|
-
};
|
|
151
|
-
for (const raw of fieldLike) {
|
|
152
|
-
const ref = parseRef(raw);
|
|
153
|
-
if (!ref || ref.none || ignore.has(ref.param))
|
|
154
|
-
continue;
|
|
155
|
-
const meta = colOf(ref.source, ref.column);
|
|
156
|
-
const name = displayName(ref, meta);
|
|
157
|
-
const fieldKey = fieldKeyOf(ref, meta);
|
|
158
|
-
pushItem({
|
|
159
|
-
prop: ref.param,
|
|
160
|
-
label: options.hideLabel ? "" : name,
|
|
161
|
-
nameFallback: name,
|
|
162
|
-
fieldKey,
|
|
163
|
-
phMode: "search",
|
|
164
|
-
placeholder: `搜索${name}`,
|
|
165
|
-
type: "input"
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
for (const raw of fieldArray) {
|
|
169
|
-
const ref = parseRef(raw);
|
|
170
|
-
if (!ref || ref.none || ignore.has(ref.param))
|
|
171
|
-
continue;
|
|
172
|
-
const meta = colOf(ref.source, ref.column);
|
|
173
|
-
const name = displayName(ref, meta);
|
|
174
|
-
const fieldKey = fieldKeyOf(ref, meta);
|
|
175
|
-
pushItem({
|
|
176
|
-
prop: ref.param,
|
|
177
|
-
label: options.hideLabel ? "" : name,
|
|
178
|
-
nameFallback: name,
|
|
179
|
-
fieldKey,
|
|
180
|
-
phMode: "search",
|
|
181
|
-
placeholder: `搜索${name}`,
|
|
182
|
-
type: "input"
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
for (const raw of fieldEq) {
|
|
186
|
-
const ref = parseRef(raw);
|
|
187
|
-
if (!ref || ref.none || ignore.has(ref.param))
|
|
188
|
-
continue;
|
|
189
|
-
const meta = colOf(ref.source, ref.column);
|
|
190
|
-
const dictKey = ref.dict || (typeof meta?.dict === "string" ? meta.dict : Array.isArray(meta?.dict) ? meta.dict[0] : undefined);
|
|
191
|
-
const name = displayName(ref, meta);
|
|
192
|
-
const fieldKey = fieldKeyOf(ref, meta);
|
|
193
|
-
const label = options.hideLabel ? "" : name;
|
|
194
|
-
if (dictKey) {
|
|
195
|
-
pushItem({
|
|
196
|
-
prop: ref.param,
|
|
197
|
-
label,
|
|
198
|
-
nameFallback: name,
|
|
199
|
-
fieldKey,
|
|
200
|
-
phMode: "select",
|
|
201
|
-
placeholder: `选择${name}`,
|
|
202
|
-
type: "select",
|
|
203
|
-
dict: dictKey,
|
|
204
|
-
multiple: ref.multiple
|
|
205
|
-
});
|
|
206
|
-
} else {
|
|
207
|
-
pushItem({
|
|
208
|
-
prop: ref.param,
|
|
209
|
-
label,
|
|
210
|
-
nameFallback: name,
|
|
211
|
-
fieldKey,
|
|
212
|
-
phMode: "search",
|
|
213
|
-
placeholder: `搜索${name}`,
|
|
214
|
-
type: "input"
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
for (const r of fieldRange) {
|
|
219
|
-
if (!r?.column || r.none)
|
|
220
|
-
continue;
|
|
221
|
-
if (ignore.has(r.min) || ignore.has(r.max))
|
|
222
|
-
continue;
|
|
223
|
-
const source = toSource(r.column);
|
|
224
|
-
const col = stripAlias(r.column);
|
|
225
|
-
const meta = colOf(source, col);
|
|
226
|
-
const name = r.label || meta?.comment || col;
|
|
227
|
-
const fieldKey = fieldKeyOf({ column: col }, meta);
|
|
228
|
-
const label = options.hideLabel ? "" : name;
|
|
229
|
-
const isNum = r.type === "int" || r.type === "float";
|
|
230
|
-
const startHint = isNum ? "最小值" : "开始";
|
|
231
|
-
const endHint = isNum ? "最大值" : "结束";
|
|
232
|
-
pushItem({
|
|
233
|
-
prop: `__range_${r.min}_${r.max}`,
|
|
234
|
-
label,
|
|
235
|
-
nameFallback: name,
|
|
236
|
-
fieldKey,
|
|
237
|
-
phMode: "range",
|
|
238
|
-
placeholder: name || "区间",
|
|
239
|
-
type: isNum ? "number-range" : "daterange",
|
|
240
|
-
range: { min: r.min, max: r.max, rangeType: r.type },
|
|
241
|
-
component: {
|
|
242
|
-
name: isNum ? "vm-number-range" : "vm-date-range",
|
|
243
|
-
props: isNum ? {
|
|
244
|
-
mode: r.type,
|
|
245
|
-
startPlaceholder: `${name}${startHint}`,
|
|
246
|
-
endPlaceholder: `${name}${endHint}`
|
|
247
|
-
} : {
|
|
248
|
-
precision: r.type,
|
|
249
|
-
startPlaceholder: `${name}${startHint}`,
|
|
250
|
-
endPlaceholder: `${name}${endHint}`
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
if (keyWordLikeFields.length) {
|
|
256
|
-
const parts = [];
|
|
257
|
-
const names = keyWordLikeFields.map((raw) => {
|
|
258
|
-
const ref = parseRef(raw);
|
|
259
|
-
if (!ref)
|
|
260
|
-
return typeof raw === "string" ? stripAlias(raw) : "";
|
|
261
|
-
const meta = colOf(ref.source, ref.column);
|
|
262
|
-
const fk = fieldKeyOf(ref, meta);
|
|
263
|
-
if (fk)
|
|
264
|
-
parts.push(fk);
|
|
265
|
-
return displayName(ref, meta);
|
|
266
|
-
}).filter(Boolean);
|
|
267
|
-
pushItem({
|
|
268
|
-
prop: "keyWord",
|
|
269
|
-
label: options.hideLabel ? "" : "关键字",
|
|
270
|
-
nameFallback: names.join("、") || "关键字",
|
|
271
|
-
phMode: "keyword",
|
|
272
|
-
keywordParts: parts,
|
|
273
|
-
placeholder: `搜索${names.join("、") || "关键字"}`,
|
|
274
|
-
type: "input"
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
return items;
|
|
278
|
-
}
|
|
1
|
+
(function(_0x38c966,_0x2d69bd){const _0xb3ec2=_0x977f,_0x15984e=_0x38c966();while(!![]){try{const _0x4896f4=parseInt(_0xb3ec2(0x188))/0x1*(parseInt(_0xb3ec2(0x165))/0x2)+parseInt(_0xb3ec2(0x189))/0x3*(parseInt(_0xb3ec2(0x163))/0x4)+-parseInt(_0xb3ec2(0x192))/0x5*(-parseInt(_0xb3ec2(0x164))/0x6)+-parseInt(_0xb3ec2(0x16a))/0x7+-parseInt(_0xb3ec2(0x158))/0x8+-parseInt(_0xb3ec2(0x194))/0x9+parseInt(_0xb3ec2(0x186))/0xa;if(_0x4896f4===_0x2d69bd)break;else _0x15984e['push'](_0x15984e['shift']());}catch(_0x34449e){_0x15984e['push'](_0x15984e['shift']());}}}(_0x31b1,0x88dac));import{findEpsEntity}from'../lib/eps';import{getCrudStyle}from'./style';export function toTree(_0x2fc030={}){const _0x4f5700=_0x977f;return{'__plugin':_0x4f5700(0x183),'tree':!![],'lazy':_0x2fc030[_0x4f5700(0x180)]??![]};}export function setFocus(_0x4b03a6){const _0x55b5e8=_0x977f;return{'__plugin':_0x55b5e8(0x17b),'prop':_0x4b03a6??''};}export function setRules(){const _0x2985c3=_0x977f;return{'__plugin':_0x2985c3(0x184)};}export function setAuto(_0x56e204={'hideLabel':!![]}){const _0x3eb05d=_0x977f;return{'__plugin':_0x3eb05d(0x16e),..._0x56e204};}export const Plugins={'Table':{'toTree':toTree},'Form':{'setFocus':setFocus,'setRules':setRules},'Search':{'setAuto':setAuto}};export function applyTablePlugins(_0x18ce2f){const _0x49e690=_0x977f,_0x3d7265=getCrudStyle()['table'],_0x5d7a1b={'border':_0x3d7265[_0x49e690(0x198)],'autoHeight':_0x3d7265['autoHeight'],'contextMenu':_0x3d7265['contextMenu'],..._0x18ce2f},_0x5c1c29=[..._0x3d7265[_0x49e690(0x179)],..._0x18ce2f?.[_0x49e690(0x179)]||[]],_0x48bd9f={..._0x5d7a1b};delete _0x48bd9f['plugins'];for(const _0x5bd0da of _0x5c1c29){if(!_0x5bd0da||typeof _0x5bd0da!==_0x49e690(0x197))continue;_0x5bd0da[_0x49e690(0x199)]===_0x49e690(0x183)&&(_0x48bd9f[_0x49e690(0x15e)]=!![],_0x48bd9f['treeLazy']=Boolean(_0x5bd0da[_0x49e690(0x180)]));}return _0x48bd9f;}function stripAlias(_0xf68f05){const _0x24f128=_0x977f;return _0xf68f05[_0x24f128(0x159)]('.')?_0xf68f05['split']('.')[_0x24f128(0x160)]():_0xf68f05;}function toSource(_0x19e7ba){const _0x3c84d5=_0x977f,_0x29b184=_0x19e7ba[_0x3c84d5(0x18f)]()[_0x3c84d5(0x17e)](/\s+as\s+[a-zA-Z_]\w*$/i,'')[_0x3c84d5(0x18f)]();return _0x29b184[_0x3c84d5(0x159)]('.')?_0x29b184:'a.'+_0x29b184;}function _0x977f(_0x213cae,_0xa932ec){_0x213cae=_0x213cae-0x156;const _0x31b1cb=_0x31b1();let _0x977fd6=_0x31b1cb[_0x213cae];if(_0x977f['GkTbJy']===undefined){var _0x37cf73=function(_0x1d413e){const _0x445b9a='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2fc030='',_0x4b03a6='';for(let _0x56e204=0x0,_0x18ce2f,_0x3d7265,_0x5d7a1b=0x0;_0x3d7265=_0x1d413e['charAt'](_0x5d7a1b++);~_0x3d7265&&(_0x18ce2f=_0x56e204%0x4?_0x18ce2f*0x40+_0x3d7265:_0x3d7265,_0x56e204++%0x4)?_0x2fc030+=String['fromCharCode'](0xff&_0x18ce2f>>(-0x2*_0x56e204&0x6)):0x0){_0x3d7265=_0x445b9a['indexOf'](_0x3d7265);}for(let _0x5c1c29=0x0,_0x48bd9f=_0x2fc030['length'];_0x5c1c29<_0x48bd9f;_0x5c1c29++){_0x4b03a6+='%'+('00'+_0x2fc030['charCodeAt'](_0x5c1c29)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x4b03a6);};_0x977f['EdVKad']=_0x37cf73,_0x977f['sMrNrt']={},_0x977f['GkTbJy']=!![];}const _0x5a7daf=_0x31b1cb[0x0],_0x1a908d=_0x213cae+_0x5a7daf,_0x5e0c36=_0x977f['sMrNrt'][_0x1a908d];return!_0x5e0c36?(_0x977fd6=_0x977f['EdVKad'](_0x977fd6),_0x977f['sMrNrt'][_0x1a908d]=_0x977fd6):_0x977fd6=_0x5e0c36,_0x977fd6;}function parseRef(_0x5f17e4){const _0x3e56bb=_0x977f,_0x2cd47f=/^(.+?)\s+as\s+([a-zA-Z_]\w*)$/i,_0x50b4e6=_0x141152=>{const _0x4e71fe=_0x977f,_0x35880b=_0x141152['trim'](),_0x3da7e9=_0x35880b[_0x4e71fe(0x176)](_0x2cd47f);if(_0x3da7e9)return{'expr':_0x3da7e9[0x1][_0x4e71fe(0x18f)](),'asName':_0x3da7e9[0x2]};return{'expr':_0x35880b,'asName':undefined};};if(typeof _0x5f17e4===_0x3e56bb(0x190)){const {expr:_0x22b7ce,asName:_0x1186cc}=_0x50b4e6(_0x5f17e4),_0x302781=toSource(_0x22b7ce),_0x4fda01=stripAlias(_0x302781);return{'column':_0x4fda01,'source':_0x302781,'param':_0x1186cc??_0x4fda01,'multiple':!![],'none':![]};}if(!_0x5f17e4||typeof _0x5f17e4!=='object')return null;const _0x376932=_0x5f17e4;if(!_0x376932[_0x3e56bb(0x191)])return null;const {expr:_0x1cf6c2,asName:_0x3ac0ff}=_0x50b4e6(_0x376932[_0x3e56bb(0x191)]),_0x1db1ab=toSource(_0x1cf6c2),_0x252e74=stripAlias(_0x1db1ab);return{'column':_0x252e74,'source':_0x1db1ab,'param':_0x3ac0ff??_0x252e74,'label':_0x376932['label'],'dict':_0x376932[_0x3e56bb(0x15a)],'multiple':_0x376932[_0x3e56bb(0x182)]!==![],'none':Boolean(_0x376932[_0x3e56bb(0x19a)])};}function displayName(_0x1e0555,_0x236ce0){const _0x54efc0=_0x977f;return _0x1e0555['label']||_0x236ce0?.[_0x54efc0(0x193)]||_0x1e0555[_0x54efc0(0x191)];}function fieldKeyOf(_0x3a6ad6,_0x3af6fd){const _0x317063=_0x977f,_0xd9a178=_0x3af6fd?.['table']?.[_0x317063(0x18f)](),_0x521baa=(_0x3af6fd?.['propertyName']||_0x3a6ad6[_0x317063(0x191)]||'')[_0x317063(0x18f)]();if(!_0xd9a178||!_0x521baa)return;return _0xd9a178+'.'+_0x521baa;}function _0x31b1(){const _0x3e3e05=['5ywZ6zsU5A2x','Bgf6Eq','A2v5D29Yza','BxvSDgLWBgu','Dg9uCMvL','C2v0uNvSzxm','zMLSDgvY','nZy3odi3mffgyLzvva','5PYa5AsN5yc8','odi5ntHiEenYuwK','mtu2qLzlz0zb','DM0Tzgf0zs1Yyw5Nzq','BgfIzwW','zgf0zxjHBMDL','Aw5WDxq','C2vSzwn0','DhjPBq','C3rYAw5N','y29SDw1U','nw1xuNnJva','y29TBwvUDa','ntmYmdm4nLPSzejsva','zMLLBgrsyw5Nzq','AxnbCNjHEq','B2jQzwn0','yM9YzgvY','x19WBhvNAw4','BM9Uzq','AM9PBG','BwLU','nJGYnJiYnhnADvLguW','Aw5JBhvKzxm','zgLJDa','A2v5v29Yza','zMLLBgrbCNjHEq','ChjVCa','DhjLzq','AgLKzuXHyMvS','Cg9W','zMLUza','AgfZ','nta1odrfDNLvEum','mZy5mJy1mMH5thLuBG','mJryzMjmAgK','ChvZAa','C291CMnL','zMLLBgrfCq','C2vHCMnO','nZiXotu4m09byMXYtG','CgfNzvf1zxj5t3a','DhLWzq','CgfYyw0','C2v0qxv0BW','CgfNzunVBhvTBNm','Aw50','ChjVCgvYDhLoyw1L','BwfW','BMfTzxnWywnL','x19Yyw5Nzv8','C3rHCNrZv2L0Aa','Bwf0y2G','Bwf4','BgvUz3rO','CgX1z2LUCW','BNvTyMvYlxjHBMDL','C2v0rM9JDxm','A2v5v29YzeXPA2vgAwvSzhm','ywrK','CMvWBgfJzq'];_0x31b1=function(){return _0x3e3e05;};return _0x31b1();}export function buildAutoSearchItems(_0x335b3b,_0x5da93c={}){const _0x4b240b=_0x977f,_0x1d51c7=new Set(_0x5da93c['ignoreFields']||[]),_0x16d89d=_0x335b3b[_0x4b240b(0x169)]||{};let _0x555c94=_0x16d89d['fieldEq']||[],_0x4d5fce=_0x16d89d['fieldLike']||[],_0xb7a2c1=_0x16d89d[_0x4b240b(0x15c)]||[],_0x11e26b=_0x16d89d[_0x4b240b(0x195)]||[],_0x3d027d=_0x16d89d['keyWordLikeFields']||[],_0x5668e1=[];const _0x1c5eb1=_0x335b3b['namespace']?findEpsEntity('/'+_0x335b3b[_0x4b240b(0x173)]):undefined;if(_0x1c5eb1){_0x5668e1=[..._0x1c5eb1['columns']||[],..._0x1c5eb1[_0x4b240b(0x16f)]||[]];if(!_0x335b3b[_0x4b240b(0x169)]){const _0x1bd168=_0x1c5eb1[_0x4b240b(0x16b)];_0x1bd168&&(_0x555c94=_0x1bd168[_0x4b240b(0x168)]||[],_0x4d5fce=_0x1bd168['fieldLike']||[],_0xb7a2c1=_0x1bd168['fieldArray']||[],_0x11e26b=_0x1bd168['fieldRange']||[],_0x3d027d=_0x1bd168[_0x4b240b(0x17c)]||[]);}}const _0xdd2cd4=(_0x8abba5,_0x243c4b)=>{const _0x3796e6=_0x4b240b,_0x41b61e=_0x8abba5[_0x3796e6(0x159)]('.')?_0x8abba5:'a.'+_0x8abba5,_0x2ca6a3=_0x243c4b??stripAlias(_0x41b61e);return _0x5668e1[_0x3796e6(0x161)](_0x8b42f0=>_0x8b42f0['source']===_0x41b61e)||_0x5668e1[_0x3796e6(0x161)](_0x50b88b=>_0x50b88b[_0x3796e6(0x171)]===_0x2ca6a3&&(!_0x50b88b[_0x3796e6(0x167)]||_0x50b88b[_0x3796e6(0x167)][_0x3796e6(0x175)]('a.')))||_0x5668e1[_0x3796e6(0x161)](_0xeb8b56=>_0xeb8b56['propertyName']===_0x2ca6a3);},_0x5ccbb4=[],_0x73019c=new Set(),_0x15deed=_0xd9253=>{const _0x1b058e=_0x4b240b;if(!_0xd9253[_0x1b058e(0x15d)]||_0x73019c['has'](_0xd9253['prop']))return;_0x73019c[_0x1b058e(0x17d)](_0xd9253[_0x1b058e(0x15d)]),_0x5ccbb4['push'](_0xd9253);};for(const _0x419ddb of _0x4d5fce){const _0x14d973=parseRef(_0x419ddb);if(!_0x14d973||_0x14d973['none']||_0x1d51c7[_0x4b240b(0x162)](_0x14d973[_0x4b240b(0x16d)]))continue;const _0x19d4ab=_0xdd2cd4(_0x14d973['source'],_0x14d973[_0x4b240b(0x191)]),_0x31b1fc=displayName(_0x14d973,_0x19d4ab),_0x26fae9=fieldKeyOf(_0x14d973,_0x19d4ab);_0x15deed({'prop':_0x14d973[_0x4b240b(0x16d)],'label':_0x5da93c[_0x4b240b(0x15f)]?'':_0x31b1fc,'nameFallback':_0x31b1fc,'fieldKey':_0x26fae9,'phMode':_0x4b240b(0x169),'placeholder':'搜索'+_0x31b1fc,'type':'input'});}for(const _0x5de5ac of _0xb7a2c1){const _0x273950=parseRef(_0x5de5ac);if(!_0x273950||_0x273950[_0x4b240b(0x19a)]||_0x1d51c7[_0x4b240b(0x162)](_0x273950[_0x4b240b(0x16d)]))continue;const _0x41f499=_0xdd2cd4(_0x273950[_0x4b240b(0x167)],_0x273950[_0x4b240b(0x191)]),_0x1d9467=displayName(_0x273950,_0x41f499),_0x232e90=fieldKeyOf(_0x273950,_0x41f499);_0x15deed({'prop':_0x273950[_0x4b240b(0x16d)],'label':_0x5da93c[_0x4b240b(0x15f)]?'':_0x1d9467,'nameFallback':_0x1d9467,'fieldKey':_0x232e90,'phMode':_0x4b240b(0x169),'placeholder':'搜索'+_0x1d9467,'type':_0x4b240b(0x18d)});}for(const _0x2f1bd2 of _0x555c94){const _0x430b7e=parseRef(_0x2f1bd2);if(!_0x430b7e||_0x430b7e[_0x4b240b(0x19a)]||_0x1d51c7[_0x4b240b(0x162)](_0x430b7e[_0x4b240b(0x16d)]))continue;const _0x52bb6e=_0xdd2cd4(_0x430b7e[_0x4b240b(0x167)],_0x430b7e['column']),_0x4eab79=_0x430b7e['dict']||(typeof _0x52bb6e?.[_0x4b240b(0x15a)]==='string'?_0x52bb6e[_0x4b240b(0x15a)]:Array[_0x4b240b(0x196)](_0x52bb6e?.[_0x4b240b(0x15a)])?_0x52bb6e[_0x4b240b(0x15a)][0x0]:undefined),_0x32ddf7=displayName(_0x430b7e,_0x52bb6e),_0x30bfb9=fieldKeyOf(_0x430b7e,_0x52bb6e),_0x5e48de=_0x5da93c[_0x4b240b(0x15f)]?'':_0x32ddf7;_0x4eab79?_0x15deed({'prop':_0x430b7e['param'],'label':_0x5e48de,'nameFallback':_0x32ddf7,'fieldKey':_0x30bfb9,'phMode':_0x4b240b(0x18e),'placeholder':'选择'+_0x32ddf7,'type':_0x4b240b(0x18e),'dict':_0x4eab79,'multiple':_0x430b7e['multiple']}):_0x15deed({'prop':_0x430b7e[_0x4b240b(0x16d)],'label':_0x5e48de,'nameFallback':_0x32ddf7,'fieldKey':_0x30bfb9,'phMode':_0x4b240b(0x169),'placeholder':'搜索'+_0x32ddf7,'type':_0x4b240b(0x18d)});}for(const _0x5e87c2 of _0x11e26b){if(!_0x5e87c2?.[_0x4b240b(0x191)]||_0x5e87c2['none'])continue;if(_0x1d51c7[_0x4b240b(0x162)](_0x5e87c2[_0x4b240b(0x157)])||_0x1d51c7[_0x4b240b(0x162)](_0x5e87c2[_0x4b240b(0x177)]))continue;const _0x58e3bf=toSource(_0x5e87c2[_0x4b240b(0x191)]),_0x31c6ac=stripAlias(_0x5e87c2[_0x4b240b(0x191)]),_0x22d19a=_0xdd2cd4(_0x58e3bf,_0x31c6ac),_0x3921a7=_0x5e87c2[_0x4b240b(0x18b)]||_0x22d19a?.[_0x4b240b(0x193)]||_0x31c6ac,_0x2e5822=fieldKeyOf({'column':_0x31c6ac},_0x22d19a),_0xeeb9c9=_0x5da93c[_0x4b240b(0x15f)]?'':_0x3921a7,_0x4d8f77=_0x5e87c2['type']===_0x4b240b(0x170)||_0x5e87c2[_0x4b240b(0x16c)]==='float',_0x2e99df=_0x4d8f77?'最小值':'开始',_0x570748=_0x4d8f77?_0x4b240b(0x187):'结束';_0x15deed({'prop':_0x4b240b(0x174)+_0x5e87c2['min']+'_'+_0x5e87c2['max'],'label':_0xeeb9c9,'nameFallback':_0x3921a7,'fieldKey':_0x2e5822,'phMode':'range','placeholder':_0x3921a7||'区间','type':_0x4d8f77?_0x4b240b(0x17a):_0x4b240b(0x18c),'range':{'min':_0x5e87c2[_0x4b240b(0x157)],'max':_0x5e87c2[_0x4b240b(0x177)],'rangeType':_0x5e87c2[_0x4b240b(0x16c)]},'component':{'name':_0x4d8f77?'vm-number-range':_0x4b240b(0x18a),'props':_0x4d8f77?{'mode':_0x5e87c2[_0x4b240b(0x16c)],'startPlaceholder':''+_0x3921a7+_0x2e99df,'endPlaceholder':''+_0x3921a7+_0x570748}:{'precision':_0x5e87c2[_0x4b240b(0x16c)],'startPlaceholder':''+_0x3921a7+_0x2e99df,'endPlaceholder':''+_0x3921a7+_0x570748}}});}if(_0x3d027d[_0x4b240b(0x178)]){const _0x35ac3b=[],_0x1603e4=_0x3d027d[_0x4b240b(0x172)](_0x2c6c69=>{const _0x22af1b=_0x4b240b,_0x573c56=parseRef(_0x2c6c69);if(!_0x573c56)return typeof _0x2c6c69===_0x22af1b(0x190)?stripAlias(_0x2c6c69):'';const _0x48c539=_0xdd2cd4(_0x573c56[_0x22af1b(0x167)],_0x573c56[_0x22af1b(0x191)]),_0x42bb2a=fieldKeyOf(_0x573c56,_0x48c539);if(_0x42bb2a)_0x35ac3b[_0x22af1b(0x166)](_0x42bb2a);return displayName(_0x573c56,_0x48c539);})[_0x4b240b(0x185)](Boolean);_0x15deed({'prop':_0x4b240b(0x15b),'label':_0x5da93c[_0x4b240b(0x15f)]?'':_0x4b240b(0x17f),'nameFallback':_0x1603e4[_0x4b240b(0x156)]('、')||_0x4b240b(0x17f),'phMode':_0x4b240b(0x181),'keywordParts':_0x35ac3b,'placeholder':'搜索'+(_0x1603e4[_0x4b240b(0x156)]('、')||_0x4b240b(0x17f)),'type':'input'});}return _0x5ccbb4;}
|
package/dist/admin/crud/span.js
CHANGED
|
@@ -1,35 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { getCrudStyle } from "./style";
|
|
3
|
-
export const FORM_COLS_DESKTOP = 24;
|
|
4
|
-
export const FORM_COLS_MOBILE = 12;
|
|
5
|
-
export const FORM_SPAN_FULL = 24;
|
|
6
|
-
export const FORM_MQ_MOBILE = "(max-width: 768px)";
|
|
7
|
-
export function getFormCols() {
|
|
8
|
-
if (typeof window !== "undefined" && window.matchMedia(FORM_MQ_MOBILE).matches) {
|
|
9
|
-
return FORM_COLS_MOBILE;
|
|
10
|
-
}
|
|
11
|
-
return FORM_COLS_DESKTOP;
|
|
12
|
-
}
|
|
13
|
-
export function resolveFormSpan(span, cols = getFormCols()) {
|
|
14
|
-
const raw = span ?? getCrudStyle().form.span ?? FORM_SPAN_FULL;
|
|
15
|
-
const normalized = Math.min(FORM_SPAN_FULL, Math.max(1, raw));
|
|
16
|
-
if (cols === FORM_COLS_DESKTOP)
|
|
17
|
-
return normalized;
|
|
18
|
-
return Math.max(1, Math.round(normalized / FORM_COLS_DESKTOP * FORM_COLS_MOBILE));
|
|
19
|
-
}
|
|
20
|
-
export function useFormCols() {
|
|
21
|
-
const cols = ref(getFormCols());
|
|
22
|
-
let mql = null;
|
|
23
|
-
const sync = () => {
|
|
24
|
-
cols.value = getFormCols();
|
|
25
|
-
};
|
|
26
|
-
onMounted(() => {
|
|
27
|
-
mql = window.matchMedia(FORM_MQ_MOBILE);
|
|
28
|
-
mql.addEventListener("change", sync);
|
|
29
|
-
sync();
|
|
30
|
-
});
|
|
31
|
-
onUnmounted(() => {
|
|
32
|
-
mql?.removeEventListener("change", sync);
|
|
33
|
-
});
|
|
34
|
-
return cols;
|
|
35
|
-
}
|
|
1
|
+
const _0x40f295=_0x4f48;(function(_0x5146f0,_0x37bc65){const _0x51fc40=_0x4f48,_0xf6db6c=_0x5146f0();while(!![]){try{const _0x7f87d1=parseInt(_0x51fc40(0x1e3))/0x1+parseInt(_0x51fc40(0x1e6))/0x2*(parseInt(_0x51fc40(0x1e7))/0x3)+parseInt(_0x51fc40(0x1e0))/0x4*(parseInt(_0x51fc40(0x1d9))/0x5)+parseInt(_0x51fc40(0x1df))/0x6*(parseInt(_0x51fc40(0x1db))/0x7)+-parseInt(_0x51fc40(0x1da))/0x8+-parseInt(_0x51fc40(0x1ea))/0x9+-parseInt(_0x51fc40(0x1e2))/0xa;if(_0x7f87d1===_0x37bc65)break;else _0xf6db6c['push'](_0xf6db6c['shift']());}catch(_0x188209){_0xf6db6c['push'](_0xf6db6c['shift']());}}}(_0x4686,0xbbf61));import{onMounted,onUnmounted,ref}from'vue';function _0x4f48(_0x3e83d5,_0x32fcdd){_0x3e83d5=_0x3e83d5-0x1d6;const _0x468610=_0x4686();let _0x4f4821=_0x468610[_0x3e83d5];if(_0x4f48['kNrAKW']===undefined){var _0x4aa224=function(_0x43f9da){const _0x2e7c3a='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x72dd0='',_0x55217f='';for(let _0x2a7cb6=0x0,_0x5b54b6,_0x242215,_0x31e8e9=0x0;_0x242215=_0x43f9da['charAt'](_0x31e8e9++);~_0x242215&&(_0x5b54b6=_0x2a7cb6%0x4?_0x5b54b6*0x40+_0x242215:_0x242215,_0x2a7cb6++%0x4)?_0x72dd0+=String['fromCharCode'](0xff&_0x5b54b6>>(-0x2*_0x2a7cb6&0x6)):0x0){_0x242215=_0x2e7c3a['indexOf'](_0x242215);}for(let _0x50061d=0x0,_0x46fc81=_0x72dd0['length'];_0x50061d<_0x46fc81;_0x50061d++){_0x55217f+='%'+('00'+_0x72dd0['charCodeAt'](_0x50061d)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x55217f);};_0x4f48['dmwnXa']=_0x4aa224,_0x4f48['YmMRzD']={},_0x4f48['kNrAKW']=!![];}const _0x1cb654=_0x468610[0x0],_0x46a13a=_0x3e83d5+_0x1cb654,_0x415675=_0x4f48['YmMRzD'][_0x46a13a];return!_0x415675?(_0x4f4821=_0x4f48['dmwnXa'](_0x4f4821),_0x4f48['YmMRzD'][_0x46a13a]=_0x4f4821):_0x4f4821=_0x415675,_0x4f4821;}import{getCrudStyle}from'./style';export const FORM_COLS_DESKTOP=0x18;export const FORM_COLS_MOBILE=0xc;export const FORM_SPAN_FULL=0x18;export const FORM_MQ_MOBILE=_0x40f295(0x1d6);export function getFormCols(){const _0x5ba85f=_0x40f295;if(typeof window!==_0x5ba85f(0x1e9)&&window[_0x5ba85f(0x1e4)](FORM_MQ_MOBILE)[_0x5ba85f(0x1dc)])return FORM_COLS_MOBILE;return FORM_COLS_DESKTOP;}function _0x4686(){const _0x2a9644=['ywrKrxzLBNrmAxn0zw5LCG','Dw5KzwzPBMvK','ndiYnZaZmeHqCgjzrG','kg1HEc13Awr0AdOGnZy4ChGP','DMfSDwu','y2HHBMDL','mZmYndeXmgjlrxD5Ea','otCZotyWDhvsAKfv','nJuZotaWmvbUuM9SAq','Bwf0y2HLCW','Bwf4','zM9YBq','nK9qDLbMBq','nezRvxPSyG','CMvTB3zLrxzLBNrmAxn0zw5LCG','mJqXndi0mdbutejAEhi','mtaYmtmZnereveD1qW','Bwf0y2HnzwrPyq','C3bHBG','mJuZotbPCLH4yLy','mJCZChP4whvT'];_0x4686=function(){return _0x2a9644;};return _0x4686();}export function resolveFormSpan(_0x72dd0,_0x55217f=getFormCols()){const _0x530955=_0x40f295,_0x2a7cb6=_0x72dd0??getCrudStyle()[_0x530955(0x1de)][_0x530955(0x1e5)]??FORM_SPAN_FULL,_0x5b54b6=Math['min'](FORM_SPAN_FULL,Math[_0x530955(0x1dd)](0x1,_0x2a7cb6));if(_0x55217f===FORM_COLS_DESKTOP)return _0x5b54b6;return Math[_0x530955(0x1dd)](0x1,Math['round'](_0x5b54b6/FORM_COLS_DESKTOP*FORM_COLS_MOBILE));}export function useFormCols(){const _0x242215=ref(getFormCols());let _0x31e8e9=null;const _0x50061d=()=>{const _0xfa3ce9=_0x4f48;_0x242215[_0xfa3ce9(0x1d7)]=getFormCols();};return onMounted(()=>{const _0x26db25=_0x4f48;_0x31e8e9=window['matchMedia'](FORM_MQ_MOBILE),_0x31e8e9[_0x26db25(0x1e8)](_0x26db25(0x1d8),_0x50061d),_0x50061d();}),onUnmounted(()=>{const _0x57711c=_0x4f48;_0x31e8e9?.[_0x57711c(0x1e1)]('change',_0x50061d);}),_0x242215;}
|
package/dist/admin/crud/style.js
CHANGED
|
@@ -1,132 +1 @@
|
|
|
1
|
-
import { ref }
|
|
2
|
-
import { CRUD_LABELS, DEFAULT_CRUD_DICT } from "./dict";
|
|
3
|
-
export const DEFAULT_CRUD_STYLE = {
|
|
4
|
-
form: {
|
|
5
|
-
labelPosition: "top",
|
|
6
|
-
labelWidth: "100px",
|
|
7
|
-
span: 24,
|
|
8
|
-
plugins: []
|
|
9
|
-
},
|
|
10
|
-
table: {
|
|
11
|
-
border: false,
|
|
12
|
-
highlightCurrentRow: true,
|
|
13
|
-
autoHeight: true,
|
|
14
|
-
contextMenu: ["refresh", "check", "edit", "delete", "order-asc", "order-desc"],
|
|
15
|
-
column: {
|
|
16
|
-
align: "left",
|
|
17
|
-
opWidth: 180
|
|
18
|
-
},
|
|
19
|
-
plugins: []
|
|
20
|
-
},
|
|
21
|
-
search: {
|
|
22
|
-
plugins: []
|
|
23
|
-
},
|
|
24
|
-
colors: [
|
|
25
|
-
"#4E5DFF",
|
|
26
|
-
"#06b31c",
|
|
27
|
-
"#e93f4d",
|
|
28
|
-
"#d57121",
|
|
29
|
-
"#6d17c3",
|
|
30
|
-
"#04c273",
|
|
31
|
-
"#aa7a24",
|
|
32
|
-
"#1c109d"
|
|
33
|
-
]
|
|
34
|
-
};
|
|
35
|
-
let globalConfig = {
|
|
36
|
-
dict: { ...DEFAULT_CRUD_DICT, label: { ...CRUD_LABELS } },
|
|
37
|
-
style: structuredClone(DEFAULT_CRUD_STYLE)
|
|
38
|
-
};
|
|
39
|
-
export const crudLocaleRev = ref(0);
|
|
40
|
-
let translateFn = null;
|
|
41
|
-
export function setCrudTranslator(fn) {
|
|
42
|
-
translateFn = fn;
|
|
43
|
-
crudLocaleRev.value++;
|
|
44
|
-
}
|
|
45
|
-
export function crudT(key, fallback) {
|
|
46
|
-
if (translateFn) {
|
|
47
|
-
const v = translateFn(key, fallback);
|
|
48
|
-
if (v != null && v !== "" && v !== key)
|
|
49
|
-
return v;
|
|
50
|
-
}
|
|
51
|
-
return fallback ?? key;
|
|
52
|
-
}
|
|
53
|
-
export function crudLabel(name, localLabel) {
|
|
54
|
-
crudLocaleRev.value;
|
|
55
|
-
const fb = localLabel?.[name] ?? globalConfig.dict.label[name] ?? CRUD_LABELS[name] ?? name;
|
|
56
|
-
return crudT(`crud.${name}`, fb);
|
|
57
|
-
}
|
|
58
|
-
export function crudFormat(tpl, ...args) {
|
|
59
|
-
let out = String(tpl ?? "");
|
|
60
|
-
for (let i = 0;i < args.length; i++) {
|
|
61
|
-
out = out.replace(new RegExp(`\\{${i}\\}`, "g"), String(args[i]));
|
|
62
|
-
}
|
|
63
|
-
return out;
|
|
64
|
-
}
|
|
65
|
-
export function resolveSearchPlaceholder(item) {
|
|
66
|
-
crudLocaleRev.value;
|
|
67
|
-
const fieldName = (key, fb) => key ? crudT(`field.${key}`, fb || key) : fb || "";
|
|
68
|
-
if (item.phMode === "keyword") {
|
|
69
|
-
const names = (item.keywordParts || []).map((k) => fieldName(k, k.split(".").pop())).filter(Boolean);
|
|
70
|
-
const joined = names.join("、") || item.nameFallback || crudLabel("keyword");
|
|
71
|
-
return crudFormat(crudLabel("searchNamed"), joined);
|
|
72
|
-
}
|
|
73
|
-
const name = fieldName(item.fieldKey, item.nameFallback || item.label) || item.nameFallback || item.label || "";
|
|
74
|
-
if (item.phMode === "select") {
|
|
75
|
-
return crudFormat(crudLabel("selectNamed"), name);
|
|
76
|
-
}
|
|
77
|
-
if (item.phMode === "range") {
|
|
78
|
-
return name || crudLabel("range");
|
|
79
|
-
}
|
|
80
|
-
if (item.phMode === "search" || item.fieldKey) {
|
|
81
|
-
return crudFormat(crudLabel("searchNamed"), name);
|
|
82
|
-
}
|
|
83
|
-
return item.placeholder || item.label || "";
|
|
84
|
-
}
|
|
85
|
-
export function resolveRangePlaceholders(item) {
|
|
86
|
-
crudLocaleRev.value;
|
|
87
|
-
const name = (item.fieldKey ? crudT(`field.${item.fieldKey}`, item.nameFallback || item.label || "") : item.nameFallback || item.label || "") || "";
|
|
88
|
-
const isNum = item.type === "number-range" || item.range?.rangeType === "int" || item.range?.rangeType === "float";
|
|
89
|
-
const startHint = isNum ? crudLabel("min") : crudLabel("start");
|
|
90
|
-
const endHint = isNum ? crudLabel("max") : crudLabel("end");
|
|
91
|
-
return {
|
|
92
|
-
startPlaceholder: `${name}${startHint}`,
|
|
93
|
-
endPlaceholder: `${name}${endHint}`
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
export function setCrudConfig(partial) {
|
|
97
|
-
if (!partial)
|
|
98
|
-
return globalConfig;
|
|
99
|
-
globalConfig = {
|
|
100
|
-
dict: {
|
|
101
|
-
...globalConfig.dict,
|
|
102
|
-
...partial.dict,
|
|
103
|
-
api: { ...globalConfig.dict.api, ...partial.dict?.api },
|
|
104
|
-
pagination: { ...globalConfig.dict.pagination, ...partial.dict?.pagination },
|
|
105
|
-
search: { ...globalConfig.dict.search, ...partial.dict?.search },
|
|
106
|
-
sort: { ...globalConfig.dict.sort, ...partial.dict?.sort },
|
|
107
|
-
label: { ...globalConfig.dict.label, ...partial.dict?.label }
|
|
108
|
-
},
|
|
109
|
-
style: {
|
|
110
|
-
...globalConfig.style,
|
|
111
|
-
...partial.style,
|
|
112
|
-
form: { ...globalConfig.style.form, ...partial.style?.form },
|
|
113
|
-
table: {
|
|
114
|
-
...globalConfig.style.table,
|
|
115
|
-
...partial.style?.table,
|
|
116
|
-
column: {
|
|
117
|
-
...globalConfig.style.table.column,
|
|
118
|
-
...partial.style?.table?.column
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
search: { ...globalConfig.style.search, ...partial.style?.search },
|
|
122
|
-
colors: partial.style?.colors || globalConfig.style.colors
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
return globalConfig;
|
|
126
|
-
}
|
|
127
|
-
export function getCrudConfig() {
|
|
128
|
-
return globalConfig;
|
|
129
|
-
}
|
|
130
|
-
export function getCrudStyle() {
|
|
131
|
-
return globalConfig.style;
|
|
132
|
-
}
|
|
1
|
+
const _0x336ab5=_0x2013;function _0x2013(_0x14f566,_0x395435){_0x14f566=_0x14f566-0x174;const _0xd3eafb=_0xd3ea();let _0x20138b=_0xd3eafb[_0x14f566];if(_0x2013['eNNVba']===undefined){var _0x452a67=function(_0x444937){const _0x8851b='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x1b267f='',_0x1b9685='';for(let _0x1bd399=0x0,_0x532362,_0x5a6efe,_0x3852aa=0x0;_0x5a6efe=_0x444937['charAt'](_0x3852aa++);~_0x5a6efe&&(_0x532362=_0x1bd399%0x4?_0x532362*0x40+_0x5a6efe:_0x5a6efe,_0x1bd399++%0x4)?_0x1b267f+=String['fromCharCode'](0xff&_0x532362>>(-0x2*_0x1bd399&0x6)):0x0){_0x5a6efe=_0x8851b['indexOf'](_0x5a6efe);}for(let _0x5ad2e1=0x0,_0x11fba7=_0x1b267f['length'];_0x5ad2e1<_0x11fba7;_0x5ad2e1++){_0x1b9685+='%'+('00'+_0x1b267f['charCodeAt'](_0x5ad2e1)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x1b9685);};_0x2013['DQKEEk']=_0x452a67,_0x2013['gcYjGy']={},_0x2013['eNNVba']=!![];}const _0x2723e7=_0xd3eafb[0x0],_0x124b09=_0x14f566+_0x2723e7,_0x42dbe4=_0x2013['gcYjGy'][_0x124b09];return!_0x42dbe4?(_0x20138b=_0x2013['DQKEEk'](_0x20138b),_0x2013['gcYjGy'][_0x124b09]=_0x20138b):_0x20138b=_0x42dbe4,_0x20138b;}(function(_0x56d78a,_0xc221c8){const _0x32d87e=_0x2013,_0x33ce7f=_0x56d78a();while(!![]){try{const _0xe84ef1=parseInt(_0x32d87e(0x192))/0x1*(-parseInt(_0x32d87e(0x183))/0x2)+-parseInt(_0x32d87e(0x191))/0x3+parseInt(_0x32d87e(0x184))/0x4*(parseInt(_0x32d87e(0x195))/0x5)+-parseInt(_0x32d87e(0x17a))/0x6+-parseInt(_0x32d87e(0x176))/0x7*(parseInt(_0x32d87e(0x193))/0x8)+-parseInt(_0x32d87e(0x1a9))/0x9*(-parseInt(_0x32d87e(0x199))/0xa)+-parseInt(_0x32d87e(0x186))/0xb*(-parseInt(_0x32d87e(0x179))/0xc);if(_0xe84ef1===_0xc221c8)break;else _0x33ce7f['push'](_0x33ce7f['shift']());}catch(_0x4957d4){_0x33ce7f['push'](_0x33ce7f['shift']());}}}(_0xd3ea,0x1abf8));import{ref}from'vue';import{CRUD_LABELS,DEFAULT_CRUD_DICT}from'./dict';export const DEFAULT_CRUD_STYLE={'form':{'labelPosition':_0x336ab5(0x177),'labelWidth':_0x336ab5(0x1a8),'span':0x18,'plugins':[]},'table':{'border':![],'highlightCurrentRow':!![],'autoHeight':!![],'contextMenu':[_0x336ab5(0x1a2),_0x336ab5(0x17e),'edit','delete',_0x336ab5(0x17b),'order-desc'],'column':{'align':_0x336ab5(0x178),'opWidth':0xb4},'plugins':[]},'search':{'plugins':[]},'colors':['#4E5DFF','#06b31c',_0x336ab5(0x1a5),_0x336ab5(0x197),_0x336ab5(0x19b),_0x336ab5(0x182),_0x336ab5(0x188),'#1c109d']};let globalConfig={'dict':{...DEFAULT_CRUD_DICT,'label':{...CRUD_LABELS}},'style':structuredClone(DEFAULT_CRUD_STYLE)};export const crudLocaleRev=ref(0x0);let translateFn=null;export function setCrudTranslator(_0x1b267f){const _0x2236bf=_0x336ab5;translateFn=_0x1b267f,crudLocaleRev[_0x2236bf(0x1a3)]++;}export function crudT(_0x1b9685,_0x1bd399){if(translateFn){const _0x532362=translateFn(_0x1b9685,_0x1bd399);if(_0x532362!=null&&_0x532362!==''&&_0x532362!==_0x1b9685)return _0x532362;}return _0x1bd399??_0x1b9685;}function _0xd3ea(){const _0x55382e=['AM9PBG','y3j1zc4','zM9YBq','CMvMCMvZAa','DMfSDwu','zgLJDa','i2u5m2y0za','C3bSAxq','CMfUz2u','mtaWChG','mtiWmtq5muDQAxzJvq','BMfTzuzHBgXIywnR','y29SDw1U','BgfIzwW','mZvurhr0ugS','Dg9W','BgvMDa','mty4nZuXmNDOwMrwCq','nZe3nda4vg1IvNHl','B3jKzxiTyxnJ','C3r5Bgu','C2vHCMnO','y2HLy2S','zMLLBgrlzxK','Aw50','A2v5D29Yza','iZa0yZi3mW','mZKXnZriANvPyuC','mJu0ogTwCfvkwG','CMfUz2vuExbL','mZnHB1f1BLe','C29YDa','i2fHn2eYna','C3rHCNq','CgHnB2rL','CMvWBgfJzq','zMLLBgqU','Cg9W','zMXVyxq','DgfIBgu','CgXHy2vOB2XKzxi','mZCXoty3EufWshDP','oxfcv2PqvG','mJa4nZeYtw1uChj2','BwfW','odiWvwDqz1rJ','C2vSzwn0tMfTzwq','i2q1nZeYmq','A2v5D29YzfbHCNrZ','mtbnswnky2u','zMLSDgvY','iZzKmtDJmW','BNvTyMvYlxjHBMDL','CgfNAw5HDgLVBG','C2vHCMnOtMfTzwq'];_0xd3ea=function(){return _0x55382e;};return _0xd3ea();}export function crudLabel(_0x5a6efe,_0x3852aa){const _0x555160=_0x336ab5;crudLocaleRev[_0x555160(0x1a3)];const _0x5ad2e1=_0x3852aa?.[_0x5a6efe]??globalConfig[_0x555160(0x1a4)][_0x555160(0x175)][_0x5a6efe]??CRUD_LABELS[_0x5a6efe]??_0x5a6efe;return crudT(_0x555160(0x1a0)+_0x5a6efe,_0x5ad2e1);}export function crudFormat(_0x11fba7,..._0x2c29be){const _0x46a536=_0x336ab5;let _0x1e877b=String(_0x11fba7??'');for(let _0x2a60d0=0x0;_0x2a60d0<_0x2c29be['length'];_0x2a60d0++){_0x1e877b=_0x1e877b[_0x46a536(0x18b)](new RegExp('\x5c{'+_0x2a60d0+'\x5c}','g'),String(_0x2c29be[_0x2a60d0]));}return _0x1e877b;}export function resolveSearchPlaceholder(_0x2d6ace){const _0x1d8d46=_0x336ab5;crudLocaleRev[_0x1d8d46(0x1a3)];const _0x187562=(_0x421810,_0x271f2b)=>_0x421810?crudT(_0x1d8d46(0x18c)+_0x421810,_0x271f2b||_0x421810):_0x271f2b||'';if(_0x2d6ace['phMode']===_0x1d8d46(0x181)){const _0x4fb5c2=(_0x2d6ace[_0x1d8d46(0x198)]||[])[_0x1d8d46(0x194)](_0x4af399=>_0x187562(_0x4af399,_0x4af399[_0x1d8d46(0x1a6)]('.')[_0x1d8d46(0x18d)]()))[_0x1d8d46(0x19a)](Boolean),_0xcc870a=_0x4fb5c2[_0x1d8d46(0x19f)]('、')||_0x2d6ace[_0x1d8d46(0x1aa)]||crudLabel(_0x1d8d46(0x181));return crudFormat(crudLabel(_0x1d8d46(0x19e)),_0xcc870a);}const _0x4516c2=_0x187562(_0x2d6ace[_0x1d8d46(0x17f)],_0x2d6ace[_0x1d8d46(0x1aa)]||_0x2d6ace[_0x1d8d46(0x175)])||_0x2d6ace[_0x1d8d46(0x1aa)]||_0x2d6ace['label']||'';if(_0x2d6ace[_0x1d8d46(0x18a)]==='select')return crudFormat(crudLabel(_0x1d8d46(0x196)),_0x4516c2);if(_0x2d6ace[_0x1d8d46(0x18a)]===_0x1d8d46(0x1a7))return _0x4516c2||crudLabel(_0x1d8d46(0x1a7));if(_0x2d6ace[_0x1d8d46(0x18a)]===_0x1d8d46(0x17d)||_0x2d6ace[_0x1d8d46(0x17f)])return crudFormat(crudLabel(_0x1d8d46(0x19e)),_0x4516c2);return _0x2d6ace[_0x1d8d46(0x190)]||_0x2d6ace[_0x1d8d46(0x175)]||'';}export function resolveRangePlaceholders(_0x468e16){const _0x19026d=_0x336ab5;crudLocaleRev[_0x19026d(0x1a3)];const _0x1c832f=(_0x468e16['fieldKey']?crudT(_0x19026d(0x18c)+_0x468e16['fieldKey'],_0x468e16['nameFallback']||_0x468e16['label']||''):_0x468e16[_0x19026d(0x1aa)]||_0x468e16[_0x19026d(0x175)]||'')||'',_0x4300a9=_0x468e16['type']===_0x19026d(0x19c)||_0x468e16[_0x19026d(0x1a7)]?.[_0x19026d(0x185)]===_0x19026d(0x180)||_0x468e16[_0x19026d(0x1a7)]?.[_0x19026d(0x185)]===_0x19026d(0x18e),_0xa79791=_0x4300a9?crudLabel('min'):crudLabel(_0x19026d(0x189)),_0x5f4100=_0x4300a9?crudLabel('max'):crudLabel('end');return{'startPlaceholder':''+_0x1c832f+_0xa79791,'endPlaceholder':''+_0x1c832f+_0x5f4100};}export function setCrudConfig(_0x259150){const _0x2c61e3=_0x336ab5;if(!_0x259150)return globalConfig;return globalConfig={'dict':{...globalConfig[_0x2c61e3(0x1a4)],..._0x259150[_0x2c61e3(0x1a4)],'api':{...globalConfig[_0x2c61e3(0x1a4)]['api'],..._0x259150[_0x2c61e3(0x1a4)]?.['api']},'pagination':{...globalConfig[_0x2c61e3(0x1a4)][_0x2c61e3(0x19d)],..._0x259150[_0x2c61e3(0x1a4)]?.[_0x2c61e3(0x19d)]},'search':{...globalConfig['dict'][_0x2c61e3(0x17d)],..._0x259150['dict']?.[_0x2c61e3(0x17d)]},'sort':{...globalConfig[_0x2c61e3(0x1a4)][_0x2c61e3(0x187)],..._0x259150[_0x2c61e3(0x1a4)]?.[_0x2c61e3(0x187)]},'label':{...globalConfig[_0x2c61e3(0x1a4)]['label'],..._0x259150[_0x2c61e3(0x1a4)]?.[_0x2c61e3(0x175)]}},'style':{...globalConfig['style'],..._0x259150[_0x2c61e3(0x17c)],'form':{...globalConfig['style']['form'],..._0x259150[_0x2c61e3(0x17c)]?.[_0x2c61e3(0x1a1)]},'table':{...globalConfig['style'][_0x2c61e3(0x18f)],..._0x259150[_0x2c61e3(0x17c)]?.['table'],'column':{...globalConfig[_0x2c61e3(0x17c)][_0x2c61e3(0x18f)]['column'],..._0x259150[_0x2c61e3(0x17c)]?.['table']?.[_0x2c61e3(0x174)]}},'search':{...globalConfig['style']['search'],..._0x259150[_0x2c61e3(0x17c)]?.[_0x2c61e3(0x17d)]},'colors':_0x259150[_0x2c61e3(0x17c)]?.['colors']||globalConfig[_0x2c61e3(0x17c)]['colors']}},globalConfig;}export function getCrudConfig(){return globalConfig;}export function getCrudStyle(){const _0x559724=_0x336ab5;return globalConfig[_0x559724(0x17c)];}
|
|
@@ -1,92 +1 @@
|
|
|
1
|
-
function isEmpty(
|
|
2
|
-
if (v == null || v === "")
|
|
3
|
-
return true;
|
|
4
|
-
if (typeof v === "string" && v.trim() === "")
|
|
5
|
-
return true;
|
|
6
|
-
if (Array.isArray(v) && v.length === 0)
|
|
7
|
-
return true;
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
10
|
-
function normalizeRules(item) {
|
|
11
|
-
const rules = [];
|
|
12
|
-
if (item.required) {
|
|
13
|
-
rules.push({
|
|
14
|
-
required: true,
|
|
15
|
-
message: `${item.label}不能为空`
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
const raw = item.rules;
|
|
19
|
-
if (!raw)
|
|
20
|
-
return rules;
|
|
21
|
-
if (Array.isArray(raw)) {
|
|
22
|
-
for (const r of raw) {
|
|
23
|
-
if (r && typeof r === "object")
|
|
24
|
-
rules.push(r);
|
|
25
|
-
}
|
|
26
|
-
} else if (typeof raw === "object") {
|
|
27
|
-
rules.push(raw);
|
|
28
|
-
}
|
|
29
|
-
return rules;
|
|
30
|
-
}
|
|
31
|
-
function isItemHidden(item, form) {
|
|
32
|
-
if (typeof item.hidden === "function")
|
|
33
|
-
return item.hidden(form);
|
|
34
|
-
return Boolean(item.hidden);
|
|
35
|
-
}
|
|
36
|
-
async function validateItem(item, form) {
|
|
37
|
-
const value = form[item.prop];
|
|
38
|
-
for (const rule of normalizeRules(item)) {
|
|
39
|
-
if (rule.required && isEmpty(value)) {
|
|
40
|
-
return rule.message || `${item.label}不能为空`;
|
|
41
|
-
}
|
|
42
|
-
if (isEmpty(value))
|
|
43
|
-
continue;
|
|
44
|
-
const str = String(value);
|
|
45
|
-
if (rule.min != null && str.length < rule.min) {
|
|
46
|
-
return rule.message || `${item.label}至少 ${rule.min} 个字符`;
|
|
47
|
-
}
|
|
48
|
-
if (rule.max != null && str.length > rule.max) {
|
|
49
|
-
return rule.message || `${item.label}最多 ${rule.max} 个字符`;
|
|
50
|
-
}
|
|
51
|
-
if (rule.pattern && !rule.pattern.test(str)) {
|
|
52
|
-
return rule.message || `${item.label}格式不正确`;
|
|
53
|
-
}
|
|
54
|
-
if (rule.validator) {
|
|
55
|
-
const r = await rule.validator(value, form);
|
|
56
|
-
if (r !== true)
|
|
57
|
-
return r || `${item.label}校验失败`;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
export async function validateFormItems(items, form) {
|
|
63
|
-
for (const item of items) {
|
|
64
|
-
if (isItemHidden(item, form))
|
|
65
|
-
continue;
|
|
66
|
-
const err = await validateItem(item, form);
|
|
67
|
-
if (err)
|
|
68
|
-
return err;
|
|
69
|
-
}
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
export async function validateFormFields(items, form) {
|
|
73
|
-
const errors = {};
|
|
74
|
-
for (const item of items) {
|
|
75
|
-
if (isItemHidden(item, form))
|
|
76
|
-
continue;
|
|
77
|
-
const err = await validateItem(item, form);
|
|
78
|
-
if (err)
|
|
79
|
-
errors[item.prop] = err;
|
|
80
|
-
}
|
|
81
|
-
return errors;
|
|
82
|
-
}
|
|
83
|
-
export function applySetRules(items) {
|
|
84
|
-
return items.map((it) => {
|
|
85
|
-
if (!it.required || it.rules)
|
|
86
|
-
return it;
|
|
87
|
-
return {
|
|
88
|
-
...it,
|
|
89
|
-
rules: [{ required: true, message: `${it.label}不能为空` }]
|
|
90
|
-
};
|
|
91
|
-
});
|
|
92
|
-
}
|
|
1
|
+
function _0x88fc(_0x5eeb24,_0x535136){_0x5eeb24=_0x5eeb24-0xc1;const _0x5f1cb5=_0x5f1c();let _0x88fc85=_0x5f1cb5[_0x5eeb24];if(_0x88fc['ZBEEkz']===undefined){var _0x52c994=function(_0x594ed1){const _0x4bf694='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4eb7bc='',_0x8e372='';for(let _0x7db496=0x0,_0x50a98a,_0x4dd9ed,_0x1dd373=0x0;_0x4dd9ed=_0x594ed1['charAt'](_0x1dd373++);~_0x4dd9ed&&(_0x50a98a=_0x7db496%0x4?_0x50a98a*0x40+_0x4dd9ed:_0x4dd9ed,_0x7db496++%0x4)?_0x4eb7bc+=String['fromCharCode'](0xff&_0x50a98a>>(-0x2*_0x7db496&0x6)):0x0){_0x4dd9ed=_0x4bf694['indexOf'](_0x4dd9ed);}for(let _0x595bca=0x0,_0x314227=_0x4eb7bc['length'];_0x595bca<_0x314227;_0x595bca++){_0x8e372+='%'+('00'+_0x4eb7bc['charCodeAt'](_0x595bca)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x8e372);};_0x88fc['oxbiZg']=_0x52c994,_0x88fc['bJJItR']={},_0x88fc['ZBEEkz']=!![];}const _0x287ecd=_0x5f1cb5[0x0],_0x179c7a=_0x5eeb24+_0x287ecd,_0x3a7220=_0x88fc['bJJItR'][_0x179c7a];return!_0x3a7220?(_0x88fc85=_0x88fc['oxbiZg'](_0x88fc85),_0x88fc['bJJItR'][_0x179c7a]=_0x88fc85):_0x88fc85=_0x3a7220,_0x88fc85;}(function(_0x5cc6b8,_0x2dde75){const _0x5dfe79=_0x88fc,_0x317f42=_0x5cc6b8();while(!![]){try{const _0x2e485b=-parseInt(_0x5dfe79(0xd6))/0x1*(parseInt(_0x5dfe79(0xda))/0x2)+parseInt(_0x5dfe79(0xe2))/0x3+-parseInt(_0x5dfe79(0xde))/0x4*(parseInt(_0x5dfe79(0xce))/0x5)+-parseInt(_0x5dfe79(0xd1))/0x6*(-parseInt(_0x5dfe79(0xcb))/0x7)+parseInt(_0x5dfe79(0xcf))/0x8*(-parseInt(_0x5dfe79(0xe0))/0x9)+parseInt(_0x5dfe79(0xcd))/0xa+parseInt(_0x5dfe79(0xc8))/0xb*(parseInt(_0x5dfe79(0xc7))/0xc);if(_0x2e485b===_0x2dde75)break;else _0x317f42['push'](_0x317f42['shift']());}catch(_0x2831d4){_0x317f42['push'](_0x317f42['shift']());}}}(_0x5f1c,0xa4f78));function isEmpty(_0x4eb7bc){const _0xe747d=_0x88fc;if(_0x4eb7bc==null||_0x4eb7bc==='')return!![];if(typeof _0x4eb7bc===_0xe747d(0xdd)&&_0x4eb7bc[_0xe747d(0xd5)]()==='')return!![];if(Array[_0xe747d(0xd7)](_0x4eb7bc)&&_0x4eb7bc[_0xe747d(0xca)]===0x0)return!![];return![];}function normalizeRules(_0x8e372){const _0x7ce17d=_0x88fc,_0x7db496=[];_0x8e372[_0x7ce17d(0xd2)]&&_0x7db496[_0x7ce17d(0xd0)]({'required':!![],'message':_0x8e372[_0x7ce17d(0xc2)]+_0x7ce17d(0xc4)});const _0x50a98a=_0x8e372[_0x7ce17d(0xc3)];if(!_0x50a98a)return _0x7db496;if(Array['isArray'](_0x50a98a))for(const _0x4dd9ed of _0x50a98a){if(_0x4dd9ed&&typeof _0x4dd9ed===_0x7ce17d(0xdf))_0x7db496[_0x7ce17d(0xd0)](_0x4dd9ed);}else typeof _0x50a98a===_0x7ce17d(0xdf)&&_0x7db496[_0x7ce17d(0xd0)](_0x50a98a);return _0x7db496;}function isItemHidden(_0x1dd373,_0x595bca){const _0x25df8f=_0x88fc;if(typeof _0x1dd373[_0x25df8f(0xcc)]==='function')return _0x1dd373['hidden'](_0x595bca);return Boolean(_0x1dd373[_0x25df8f(0xcc)]);}function _0x5f1c(){const _0x29dd52=['mtqXnffSCNHMCa','AgLKzgvU','mtiYnJG3mZbUDLDRrvm','ndm4otvOywTyDhG','ogj5we5ozq','ChvZAa','mZeWmdjIwxv2wNG','CMvXDwLYzwq','DgvZDa','BwLU','DhjPBq','mtaWmdzOAMXhA2W','AxnbCNjHEq','5Qc85BYp5lIn5Q2J56gU','5PYa5AsAia','mJeYD3DMC0vq','DMfSAwrHDg9Y','Cgf0DgvYBG','C3rYAw5N','mJeYCKPswLbh','B2jQzwn0','odqXmZK0n2HXEeHWqq','ChjVCa','ndu2otm2BfrPtu5e','Bwf4','ios4QUwTL+ESPG','BgfIzwW','CNvSzxm','5lIn6io95lI656M6','BwfW','5QcH6AQm5AsX6lsL','mJaWnfHltvrKzq','ndCWmdnVzMzZAha','BwvZC2fNzq','BgvUz3rO'];_0x5f1c=function(){return _0x29dd52;};return _0x5f1c();}async function validateItem(_0x314227,_0x57dc9b){const _0x1f1361=_0x88fc,_0x270298=_0x57dc9b[_0x314227[_0x1f1361(0xe1)]];for(const _0x42f6ec of normalizeRules(_0x314227)){if(_0x42f6ec[_0x1f1361(0xd2)]&&isEmpty(_0x270298))return _0x42f6ec[_0x1f1361(0xc9)]||_0x314227[_0x1f1361(0xc2)]+_0x1f1361(0xc4);if(isEmpty(_0x270298))continue;const _0x3cfca5=String(_0x270298);if(_0x42f6ec['min']!=null&&_0x3cfca5[_0x1f1361(0xca)]<_0x42f6ec[_0x1f1361(0xd4)])return _0x42f6ec['message']||_0x314227['label']+'至少\x20'+_0x42f6ec[_0x1f1361(0xd4)]+'\x20个字符';if(_0x42f6ec[_0x1f1361(0xe3)]!=null&&_0x3cfca5[_0x1f1361(0xca)]>_0x42f6ec['max'])return _0x42f6ec[_0x1f1361(0xc9)]||_0x314227[_0x1f1361(0xc2)]+_0x1f1361(0xd9)+_0x42f6ec[_0x1f1361(0xe3)]+_0x1f1361(0xc1);if(_0x42f6ec[_0x1f1361(0xdc)]&&!_0x42f6ec[_0x1f1361(0xdc)][_0x1f1361(0xd3)](_0x3cfca5))return _0x42f6ec['message']||_0x314227['label']+_0x1f1361(0xd8);if(_0x42f6ec[_0x1f1361(0xdb)]){const _0x2342d9=await _0x42f6ec[_0x1f1361(0xdb)](_0x270298,_0x57dc9b);if(_0x2342d9!==!![])return _0x2342d9||_0x314227[_0x1f1361(0xc2)]+_0x1f1361(0xc6);}}return null;}export async function validateFormItems(_0x532972,_0x1af4f8){for(const _0x137d68 of _0x532972){if(isItemHidden(_0x137d68,_0x1af4f8))continue;const _0xbd61d6=await validateItem(_0x137d68,_0x1af4f8);if(_0xbd61d6)return _0xbd61d6;}return null;}export async function validateFormFields(_0x431b9c,_0x34eadd){const _0x17a0f6={};for(const _0x4f1315 of _0x431b9c){if(isItemHidden(_0x4f1315,_0x34eadd))continue;const _0x54c92a=await validateItem(_0x4f1315,_0x34eadd);if(_0x54c92a)_0x17a0f6[_0x4f1315['prop']]=_0x54c92a;}return _0x17a0f6;}export function applySetRules(_0x54e8d4){const _0x488207=_0x88fc;return _0x54e8d4[_0x488207(0xc5)](_0x5e7690=>{const _0x57d52a=_0x488207;if(!_0x5e7690['required']||_0x5e7690[_0x57d52a(0xc3)])return _0x5e7690;return{..._0x5e7690,'rules':[{'required':!![],'message':_0x5e7690[_0x57d52a(0xc2)]+_0x57d52a(0xc4)}]};});}
|
|
@@ -65,7 +65,7 @@ import {
|
|
|
65
65
|
resolveRangePlaceholders,
|
|
66
66
|
} from './style'
|
|
67
67
|
import { resolveCrudComponent } from './registry'
|
|
68
|
-
import {
|
|
68
|
+
import { getDict } from '../../client/dict'
|
|
69
69
|
defineOptions({ name: 'vm-search' })
|
|
70
70
|
|
|
71
71
|
const props = withDefaults(
|
|
@@ -131,15 +131,15 @@ function resolveOptions(
|
|
|
131
131
|
return Array.isArray(list) ? list : []
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
/** 筛选项 options:优先 EPS
|
|
134
|
+
/** 筛选项 options:优先 EPS 本地一级字典,禁止请求 /data */
|
|
135
135
|
function optionsOf(item: CrudSearchItem) {
|
|
136
136
|
if (item.dict) {
|
|
137
|
-
return
|
|
137
|
+
return getDict(item.dict).map((row) => {
|
|
138
138
|
let value: string | number | boolean = row.value as string | number | boolean
|
|
139
139
|
if (typeof row.value === 'string' && /^-?\d+(\.\d+)?$/.test(row.value)) {
|
|
140
140
|
value = Number(row.value)
|
|
141
141
|
}
|
|
142
|
-
return { label: String(row.label ?? row.value ?? ''), value }
|
|
142
|
+
return { label: String(row.label ?? row.name ?? row.value ?? ''), value }
|
|
143
143
|
})
|
|
144
144
|
}
|
|
145
145
|
return resolveOptions(item.options)
|
|
@@ -597,13 +597,13 @@ function cellComp(col: CrudColumn) {
|
|
|
597
597
|
return resolveCrudComponent(col.component?.name)
|
|
598
598
|
}
|
|
599
599
|
|
|
600
|
-
/** dict: dict.options('x') →
|
|
600
|
+
/** dict: dict.options('x') → 彩色标签;props 可为 dict.get(...) → switch 等 */
|
|
601
601
|
function resolveDict(col: CrudColumn) {
|
|
602
602
|
const list = col.dict == null ? [] : toValue(col.dict)
|
|
603
603
|
return Array.isArray(list) ? list : []
|
|
604
604
|
}
|
|
605
605
|
|
|
606
|
-
/** props 可为 dict.
|
|
606
|
+
/** props 可为 dict.get(...)(ComputedRef / 数组)→ 作 options */
|
|
607
607
|
function resolveCellOptions(col: CrudColumn) {
|
|
608
608
|
const fromDict = resolveDict(col)
|
|
609
609
|
if (fromDict.length) return fromDict
|
|
@@ -342,7 +342,7 @@ function resolveField(item: CrudFormItem) {
|
|
|
342
342
|
function fieldProps(item: CrudFormItem) {
|
|
343
343
|
const raw = item.component?.props
|
|
344
344
|
const unwrapped = toValue(raw)
|
|
345
|
-
// props: dict.
|
|
345
|
+
// props: dict.get('status') → 直接作 options(switch 等)
|
|
346
346
|
if (Array.isArray(unwrapped)) {
|
|
347
347
|
return {
|
|
348
348
|
options: unwrapped,
|