urit-qf-ui 0.2.6 → 0.2.7
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/index.d.ts +4 -4
- package/dist/index.js +730 -743
- package/dist/index.umd.cjs +2 -2
- package/dist/qf/http.d.ts +50 -28
- package/dist/qf/interface.d.ts +23 -4
- package/dist/qf/qf.d.ts +30 -6
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var C = (o, t, e) =>
|
|
4
|
-
import
|
|
1
|
+
var Be = Object.defineProperty;
|
|
2
|
+
var Fe = (o, t, e) => t in o ? Be(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
|
|
3
|
+
var C = (o, t, e) => Fe(o, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import Le, { ElMessage as Ve, ElMessageBox as Te } from "element-plus";
|
|
5
5
|
import "element-plus/dist/index.css";
|
|
6
|
-
import { ElInput as
|
|
6
|
+
import { ElInput as Ne, ElInputNumber as We, ElSelect as he, ElOption as ge, ElSwitch as ze, ElDatePicker as qe, ElMenu as Oe, ElSubMenu as je, ElMenuItem as Ye, ElIcon as ye, ElButton as X, ElDialog as Qe, ElForm as Ge, ElTable as Ke, ElTableColumn as He, ElPagination as Je, ElDrawer as Xe } from "element-plus/es";
|
|
7
7
|
import "element-plus/es/components/base/style/css";
|
|
8
8
|
import "element-plus/es/components/input/style/css";
|
|
9
|
-
import { defineComponent as
|
|
9
|
+
import { defineComponent as V, computed as b, openBlock as g, createElementBlock as v, normalizeClass as P, normalizeStyle as B, createTextVNode as F, toDisplayString as T, createElementVNode as x, createCommentVNode as D, createVNode as _, reactive as z, watch as L, withCtx as w, Fragment as I, renderList as E, createBlock as S, mergeProps as de, ref as Q, markRaw as se, onMounted as oe, renderSlot as k, resolveDynamicComponent as J, toRefs as Ze, unref as W, useSlots as ve, createSlots as Z, withModifiers as et, normalizeProps as q, guardReactiveProps as O, useAttrs as tt } from "vue";
|
|
10
10
|
import "element-plus/es/components/input-number/style/css";
|
|
11
11
|
import "element-plus/es/components/select/style/css";
|
|
12
12
|
import "element-plus/es/components/option/style/css";
|
|
13
|
-
import
|
|
13
|
+
import at from "axios";
|
|
14
|
+
import ot from "mitt";
|
|
15
|
+
import lt from "mqtt";
|
|
14
16
|
import "element-plus/es/components/switch/style/css";
|
|
15
17
|
import "element-plus/es/components/date-picker/style/css";
|
|
16
18
|
import "element-plus/es/components/button/style/css";
|
|
@@ -18,16 +20,15 @@ import "element-plus/es/components/menu/style/css";
|
|
|
18
20
|
import "element-plus/es/components/sub-menu/style/css";
|
|
19
21
|
import "element-plus/es/components/menu-item/style/css";
|
|
20
22
|
import "element-plus/es/components/icon/style/css";
|
|
23
|
+
import * as $e from "@element-plus/icons-vue";
|
|
24
|
+
import { Loading as Pe } from "@element-plus/icons-vue";
|
|
21
25
|
import "element-plus/es/components/form/style/css";
|
|
22
26
|
import "element-plus/es/components/dialog/style/css";
|
|
23
|
-
import { Loading as Ve } from "@element-plus/icons-vue";
|
|
24
27
|
import "element-plus/es/components/drawer/style/css";
|
|
25
28
|
import "element-plus/es/components/table/style/css";
|
|
26
29
|
import "element-plus/es/components/table-column/style/css";
|
|
27
30
|
import "element-plus/es/components/pagination/style/css";
|
|
28
|
-
|
|
29
|
-
import at from "mqtt";
|
|
30
|
-
const ot = /* @__PURE__ */ P({
|
|
31
|
+
const nt = /* @__PURE__ */ V({
|
|
31
32
|
__name: "UInput",
|
|
32
33
|
props: {
|
|
33
34
|
fieldLabel: {},
|
|
@@ -55,34 +56,34 @@ const ot = /* @__PURE__ */ P({
|
|
|
55
56
|
},
|
|
56
57
|
emits: ["update:modelValue"],
|
|
57
58
|
setup(o, { emit: t }) {
|
|
58
|
-
const e = o, i = t,
|
|
59
|
+
const e = o, i = t, s = b(() => {
|
|
59
60
|
const c = {};
|
|
60
61
|
return e.labelPosition === "left" && e.labelWidth && (c.width = typeof e.labelWidth == "number" ? `${e.labelWidth}px` : e.labelWidth), e.labelAlign && (c.textAlign = e.labelAlign), c;
|
|
61
|
-
}), d =
|
|
62
|
+
}), d = b(() => ({
|
|
62
63
|
"u-input-label-left": e.labelPosition === "left",
|
|
63
64
|
"u-input-label-top": e.labelPosition === "top"
|
|
64
|
-
})),
|
|
65
|
+
})), r = {
|
|
65
66
|
onInput(c) {
|
|
66
67
|
i("update:modelValue", c);
|
|
67
68
|
}
|
|
68
69
|
};
|
|
69
70
|
return (c, a) => {
|
|
70
|
-
const l =
|
|
71
|
-
return g(),
|
|
72
|
-
class:
|
|
71
|
+
const l = Ne;
|
|
72
|
+
return g(), v("div", {
|
|
73
|
+
class: P(["u-input", d.value])
|
|
73
74
|
}, [
|
|
74
|
-
o.fieldLabel ? (g(),
|
|
75
|
+
o.fieldLabel ? (g(), v("div", {
|
|
75
76
|
key: 0,
|
|
76
77
|
class: "u-input-label",
|
|
77
|
-
style: B(
|
|
78
|
+
style: B(s.value)
|
|
78
79
|
}, [
|
|
79
80
|
F(T(o.fieldLabel) + " ", 1),
|
|
80
81
|
x("span", {
|
|
81
|
-
class:
|
|
82
|
+
class: P(["required-star", { "required-star--visible": o.required }])
|
|
82
83
|
}, "*", 2)
|
|
83
84
|
], 4)) : D("", !0),
|
|
84
85
|
x("div", {
|
|
85
|
-
class:
|
|
86
|
+
class: P(["u-input-field", { "u-input-field--top": o.labelPosition === "top" }])
|
|
86
87
|
}, [
|
|
87
88
|
_(l, {
|
|
88
89
|
"model-value": o.modelValue,
|
|
@@ -91,7 +92,7 @@ const ot = /* @__PURE__ */ P({
|
|
|
91
92
|
disabled: o.disable,
|
|
92
93
|
readonly: o.readonly,
|
|
93
94
|
maxlength: o.maxlength,
|
|
94
|
-
"onUpdate:modelValue":
|
|
95
|
+
"onUpdate:modelValue": r.onInput
|
|
95
96
|
}, null, 8, ["model-value", "placeholder", "type", "disabled", "readonly", "maxlength", "onUpdate:modelValue"])
|
|
96
97
|
], 2)
|
|
97
98
|
], 2);
|
|
@@ -99,10 +100,10 @@ const ot = /* @__PURE__ */ P({
|
|
|
99
100
|
}
|
|
100
101
|
}), $ = (o, t) => {
|
|
101
102
|
const e = o.__vccOpts || o;
|
|
102
|
-
for (const [i,
|
|
103
|
-
e[i] =
|
|
103
|
+
for (const [i, s] of t)
|
|
104
|
+
e[i] = s;
|
|
104
105
|
return e;
|
|
105
|
-
}, te = /* @__PURE__ */ $(
|
|
106
|
+
}, te = /* @__PURE__ */ $(nt, [["__scopeId", "data-v-ecf5177c"]]), it = { class: "u-input-number-field" }, st = /* @__PURE__ */ V({
|
|
106
107
|
__name: "UInputNumber",
|
|
107
108
|
props: {
|
|
108
109
|
fieldLabel: {},
|
|
@@ -130,33 +131,33 @@ const ot = /* @__PURE__ */ P({
|
|
|
130
131
|
},
|
|
131
132
|
emits: ["update:modelValue"],
|
|
132
133
|
setup(o, { emit: t }) {
|
|
133
|
-
const e = o, i = t,
|
|
134
|
+
const e = o, i = t, s = b(() => {
|
|
134
135
|
const c = {};
|
|
135
136
|
return e.labelPosition === "left" && e.labelWidth && (c.width = typeof e.labelWidth == "number" ? `${e.labelWidth}px` : e.labelWidth), e.labelAlign && (c.textAlign = e.labelAlign), c;
|
|
136
|
-
}), d =
|
|
137
|
+
}), d = b(() => ({
|
|
137
138
|
"u-input-number-label-left": e.labelPosition === "left",
|
|
138
139
|
"u-input-number-label-top": e.labelPosition === "top"
|
|
139
|
-
})),
|
|
140
|
+
})), r = {
|
|
140
141
|
onUpdate(c) {
|
|
141
142
|
i("update:modelValue", c === void 0 ? 0 : c);
|
|
142
143
|
}
|
|
143
144
|
};
|
|
144
145
|
return (c, a) => {
|
|
145
|
-
const l =
|
|
146
|
-
return g(),
|
|
147
|
-
class:
|
|
146
|
+
const l = We;
|
|
147
|
+
return g(), v("div", {
|
|
148
|
+
class: P(["u-input-number", d.value])
|
|
148
149
|
}, [
|
|
149
|
-
o.fieldLabel ? (g(),
|
|
150
|
+
o.fieldLabel ? (g(), v("div", {
|
|
150
151
|
key: 0,
|
|
151
152
|
class: "u-input-number-label",
|
|
152
|
-
style: B(
|
|
153
|
+
style: B(s.value)
|
|
153
154
|
}, [
|
|
154
155
|
F(T(o.fieldLabel) + " ", 1),
|
|
155
156
|
x("span", {
|
|
156
|
-
class:
|
|
157
|
+
class: P(["required-star", { "required-star--visible": o.required }])
|
|
157
158
|
}, "*", 2)
|
|
158
159
|
], 4)) : D("", !0),
|
|
159
|
-
x("div",
|
|
160
|
+
x("div", it, [
|
|
160
161
|
_(l, {
|
|
161
162
|
"model-value": o.modelValue,
|
|
162
163
|
placeholder: o.placeholder || "请输入数值",
|
|
@@ -168,56 +169,255 @@ const ot = /* @__PURE__ */ P({
|
|
|
168
169
|
controls: !0,
|
|
169
170
|
"controls-position": "right",
|
|
170
171
|
style: { width: "100%" },
|
|
171
|
-
onChange:
|
|
172
|
+
onChange: r.onUpdate
|
|
172
173
|
}, null, 8, ["model-value", "placeholder", "disabled", "min", "max", "step", "precision", "onChange"])
|
|
173
174
|
])
|
|
174
175
|
], 2);
|
|
175
176
|
};
|
|
176
177
|
}
|
|
177
|
-
}), Ae = /* @__PURE__ */ $(
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
178
|
+
}), Ae = /* @__PURE__ */ $(st, [["__scopeId", "data-v-cb70bd5b"]]);
|
|
179
|
+
function rt() {
|
|
180
|
+
var o, t;
|
|
181
|
+
try {
|
|
182
|
+
if (typeof document < "u" && document.baseURI) {
|
|
183
|
+
const e = new URL(document.baseURI);
|
|
184
|
+
if (e.origin && e.origin !== "null") {
|
|
185
|
+
let i = e.pathname;
|
|
186
|
+
return i.slice(i.lastIndexOf("/") + 1).includes(".") && (i = i.slice(0, i.lastIndexOf("/") + 1)), i = i.replace(/\/+$/, ""), e.origin + i;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
} catch {
|
|
181
190
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
)
|
|
190
|
-
|
|
191
|
-
(
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
191
|
+
try {
|
|
192
|
+
const e = (t = (o = window == null ? void 0 : window.$wujie) == null ? void 0 : o.location) == null ? void 0 : t.origin;
|
|
193
|
+
if (typeof e == "string" && e) return e;
|
|
194
|
+
} catch {
|
|
195
|
+
}
|
|
196
|
+
return typeof window < "u" ? window.location.origin : "";
|
|
197
|
+
}
|
|
198
|
+
function dt(o, t) {
|
|
199
|
+
const e = (o ?? "").trim();
|
|
200
|
+
return e !== "" && e !== "." && e !== "./" ? e : (t.value === void 0 && (t.value = rt()), t.value);
|
|
201
|
+
}
|
|
202
|
+
class ct {
|
|
203
|
+
constructor(t) {
|
|
204
|
+
C(this, "axiosInstance");
|
|
205
|
+
// 免配基地址缓存(baseUrl 留空/"./" 时生效,见 pickBaseUrl)
|
|
206
|
+
C(this, "baseCache", {});
|
|
207
|
+
this.axiosInstance = at.create({
|
|
208
|
+
timeout: 1e4,
|
|
209
|
+
baseURL: ""
|
|
210
|
+
}), this.axiosInstance.defaults.headers["Content-Type"] = "application/json;charset=utf-8", this.axiosInstance.interceptors.request.use(
|
|
211
|
+
(e) => (e.headers.token = localStorage.getItem("token"), e.baseURL = dt(t.baseUrl, this.baseCache), e),
|
|
212
|
+
(e) => Promise.reject(e)
|
|
213
|
+
), this.axiosInstance.interceptors.response.use(
|
|
214
|
+
(e) => {
|
|
215
|
+
if (e.config.responseType === "blob")
|
|
216
|
+
return e;
|
|
217
|
+
const i = e.data;
|
|
218
|
+
if (i && typeof i == "object" && !Array.isArray(i) && i.status === void 0 && i.code !== void 0) {
|
|
219
|
+
const s = i.code, d = s === 0 || s === 200 || Number(s) === 0 || Number(s) === 200;
|
|
220
|
+
i.status = d ? 200 : Number(s);
|
|
221
|
+
}
|
|
222
|
+
return i;
|
|
223
|
+
},
|
|
224
|
+
(e) => Promise.reject(e)
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* GET 请求(params 会被 axios 序列化成 query string)
|
|
229
|
+
*/
|
|
230
|
+
Get(t, e) {
|
|
231
|
+
return this.axiosInstance.get(t, { params: e });
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* POST 请求(body 支持普通对象与 FormData;
|
|
235
|
+
* FormData 时 axios 会自动让浏览器设置带 boundary 的 Content-Type)
|
|
236
|
+
*/
|
|
237
|
+
Post(t, e) {
|
|
238
|
+
return this.axiosInstance.post(t, e);
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* DELETE 请求(参数走 query string,与后端路由约定一致)
|
|
242
|
+
*/
|
|
243
|
+
Delete(t, e) {
|
|
244
|
+
return this.axiosInstance.delete(t, { params: e });
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* PUT 请求
|
|
248
|
+
*/
|
|
249
|
+
Put(t, e) {
|
|
250
|
+
return this.axiosInstance.put(t, e);
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* 下载文件(GET + blob)—— 返回**完整 AxiosResponse**,调用方取 `res.data as Blob`
|
|
254
|
+
*/
|
|
255
|
+
Download(t, e) {
|
|
256
|
+
return this.axiosInstance.get(t, {
|
|
257
|
+
params: e,
|
|
258
|
+
responseType: "blob"
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* 下载文件(POST + blob,用于「按查询条件导出」这类接口)——
|
|
263
|
+
* 同样返回完整 AxiosResponse。
|
|
264
|
+
*/
|
|
265
|
+
PostDownload(t, e) {
|
|
266
|
+
return this.axiosInstance.post(t, e, {
|
|
267
|
+
responseType: "blob"
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
class ut {
|
|
272
|
+
//事件总线
|
|
273
|
+
constructor() {
|
|
274
|
+
C(this, "emitter");
|
|
275
|
+
this.emitter = ot();
|
|
276
|
+
}
|
|
277
|
+
On(t, e) {
|
|
278
|
+
this.emitter.on(t, e);
|
|
279
|
+
}
|
|
280
|
+
Emit(t, e) {
|
|
281
|
+
this.emitter.emit(t, e);
|
|
282
|
+
}
|
|
283
|
+
Off(t, e) {
|
|
284
|
+
this.emitter.off(t, e);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
class ft {
|
|
288
|
+
constructor(t, e) {
|
|
289
|
+
C(this, "mqttClient", null);
|
|
290
|
+
C(this, "eventBus");
|
|
291
|
+
this.eventBus = t, this.connect(e).then();
|
|
292
|
+
}
|
|
293
|
+
async connect(t) {
|
|
294
|
+
const e = {
|
|
295
|
+
username: t.userName,
|
|
296
|
+
password: t.password,
|
|
297
|
+
clientId: `${t.module}_${this.randomStr(10)}`,
|
|
298
|
+
clean: !0,
|
|
299
|
+
keepalive: 50,
|
|
300
|
+
connectTimeout: 5e3,
|
|
301
|
+
reconnectPeriod: 5e3
|
|
302
|
+
};
|
|
303
|
+
let i = t.mqttUrl || "ws://127.0.0.1:5002/ws";
|
|
304
|
+
if (console.log(`connect to mqtt... url=${i}`), this.mqttClient = lt.connect(i, e), !this.mqttClient) {
|
|
305
|
+
console.log("connect mqtt failed");
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
this.mqttClient.on("connect", () => {
|
|
309
|
+
console.log("=====> mqtt connect success!"), this.mqttClient.subscribe(ce, { qos: 0 }, (s) => {
|
|
310
|
+
console.log(s ? `mqtt subscribe [${ce}] failed` : `mqtt subscribe [${ce}] success`);
|
|
311
|
+
});
|
|
312
|
+
}), this.mqttClient.on("message", (s, d) => {
|
|
313
|
+
const r = d.toString();
|
|
314
|
+
if (!r) {
|
|
315
|
+
console.error("Received empty message", s);
|
|
316
|
+
return;
|
|
197
317
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
318
|
+
let c = null;
|
|
319
|
+
try {
|
|
320
|
+
c = JSON.parse(r);
|
|
321
|
+
} catch (a) {
|
|
322
|
+
console.error("Failed to parse message JSON", s, r, a);
|
|
323
|
+
return;
|
|
201
324
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
325
|
+
if (!c || c.Content === void 0 || c.Content === null || !c.PType) {
|
|
326
|
+
console.log("parse notice failed!", r);
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
c.PType == mt && this.eventBus.Emit(c.Route, c.Content);
|
|
330
|
+
}), this.mqttClient.on(ne.OffLine, () => {
|
|
331
|
+
console.log("mqtt offline...");
|
|
332
|
+
}), this.mqttClient.on(ne.Reconnect, () => {
|
|
333
|
+
console.log("mqtt reconnecting...");
|
|
334
|
+
}), this.mqttClient.on(ne.Close, () => {
|
|
335
|
+
console.log("mqtt close");
|
|
336
|
+
}), this.mqttClient.on(ne.Error, (s) => {
|
|
337
|
+
console.log("mqtt error");
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
// 生成随机字符串
|
|
341
|
+
randomStr(t) {
|
|
342
|
+
const e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
343
|
+
let i = "";
|
|
344
|
+
for (let s = 0; s < t; s++)
|
|
345
|
+
i += e.charAt(Math.floor(Math.random() * e.length));
|
|
346
|
+
return i;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
const ce = "Notice", mt = "NOTICE", ne = {
|
|
350
|
+
OffLine: "offline",
|
|
351
|
+
Close: "close",
|
|
352
|
+
Reconnect: "reconnect",
|
|
353
|
+
Error: "error"
|
|
354
|
+
};
|
|
355
|
+
let H, me = !1;
|
|
356
|
+
const bo = (o) => {
|
|
357
|
+
if (!o)
|
|
358
|
+
throw new Error("QfOptions is undefined");
|
|
359
|
+
if ((!H || me) && (H = new Re(o), me = !1), !H)
|
|
360
|
+
throw new Error("Qf not initialized, please call GetQf(options) first");
|
|
361
|
+
return H;
|
|
362
|
+
}, M = () => (H || (H = new Re({
|
|
363
|
+
module: "",
|
|
364
|
+
useMqtt: !1,
|
|
365
|
+
baseUrl: "",
|
|
366
|
+
mqttUrl: "",
|
|
367
|
+
userName: "",
|
|
368
|
+
password: ""
|
|
369
|
+
}), me = !0), H);
|
|
370
|
+
class Re {
|
|
371
|
+
constructor(t) {
|
|
372
|
+
C(this, "EventBus");
|
|
373
|
+
C(this, "WebApi");
|
|
374
|
+
C(this, "Mqtt");
|
|
375
|
+
C(this, "options");
|
|
376
|
+
this.initQf(t);
|
|
209
377
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}
|
|
218
|
-
//
|
|
219
|
-
|
|
220
|
-
|
|
378
|
+
/**
|
|
379
|
+
* 初始化 Qf
|
|
380
|
+
*/
|
|
381
|
+
initQf(t) {
|
|
382
|
+
if (!t)
|
|
383
|
+
throw new Error(`StartQf failed! options is ${t}`);
|
|
384
|
+
this.options = t, console.log("StartQf(), qfOptions=", t), this.EventBus = new ut(), this.WebApi = new ct(t), this.options.useMqtt && (this.Mqtt = new ft(this.EventBus, t));
|
|
385
|
+
}
|
|
386
|
+
// ==================== EventBus 相关 ====================
|
|
387
|
+
On(t, e) {
|
|
388
|
+
this.EventBus.On(t, e);
|
|
389
|
+
}
|
|
390
|
+
Emit(t, e) {
|
|
391
|
+
this.EventBus.Emit(t, e);
|
|
392
|
+
}
|
|
393
|
+
Off(t, e) {
|
|
394
|
+
this.EventBus.Off(t, e);
|
|
395
|
+
}
|
|
396
|
+
// ==================== Http 相关 ====================
|
|
397
|
+
Post(t, e) {
|
|
398
|
+
return this.WebApi.Post(t, e);
|
|
399
|
+
}
|
|
400
|
+
Get(t, e) {
|
|
401
|
+
return this.WebApi.Get(t, e);
|
|
402
|
+
}
|
|
403
|
+
Delete(t, e) {
|
|
404
|
+
return this.WebApi.Delete(t, e);
|
|
405
|
+
}
|
|
406
|
+
Put(t, e) {
|
|
407
|
+
return this.WebApi.Put(t, e);
|
|
408
|
+
}
|
|
409
|
+
Download(t, e) {
|
|
410
|
+
return this.WebApi.Download(t, e);
|
|
411
|
+
}
|
|
412
|
+
PostDownload(t, e) {
|
|
413
|
+
return this.WebApi.PostDownload(t, e);
|
|
414
|
+
}
|
|
415
|
+
// ==================== MQTT 通知 ====================
|
|
416
|
+
RegNotice(t, e) {
|
|
417
|
+
this.EventBus.On(t, e);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
const G = {
|
|
221
421
|
/**
|
|
222
422
|
* 获取表单配置:GET /api/form?type=<forms|tables|menus>&id=<配置文件名称>
|
|
223
423
|
* 后端读取 ./config/<type>/<id>.yaml
|
|
@@ -242,8 +442,8 @@ const E = {
|
|
|
242
442
|
cascaderApi(o, t = !0) {
|
|
243
443
|
return `/api/dict/tree-list?dict_type=${o}&children=${t}`;
|
|
244
444
|
}
|
|
245
|
-
}, j = {},
|
|
246
|
-
function
|
|
445
|
+
}, j = {}, ie = {};
|
|
446
|
+
function be(o) {
|
|
247
447
|
const { children: t, ...e } = o;
|
|
248
448
|
return {
|
|
249
449
|
label: o.label ?? o.dict_value ?? String(o.value ?? ""),
|
|
@@ -254,20 +454,20 @@ function ve(o) {
|
|
|
254
454
|
function we(o) {
|
|
255
455
|
return Array.isArray(o) ? o.map((t) => {
|
|
256
456
|
if (!t || typeof t != "object") return t;
|
|
257
|
-
const e =
|
|
457
|
+
const e = be(t), i = t.children;
|
|
258
458
|
return Array.isArray(i) && i.length > 0 && (e.children = we(i)), e;
|
|
259
459
|
}) : [];
|
|
260
460
|
}
|
|
261
461
|
function Ce(o) {
|
|
262
|
-
return Array.isArray(o) ? o.filter((t) => t && typeof t == "object").map((t) =>
|
|
462
|
+
return Array.isArray(o) ? o.filter((t) => t && typeof t == "object").map((t) => be(t)) : [];
|
|
263
463
|
}
|
|
264
|
-
function
|
|
464
|
+
function wo(o) {
|
|
265
465
|
if (!Array.isArray(o)) return [];
|
|
266
466
|
const t = [], e = (i) => {
|
|
267
|
-
for (const
|
|
268
|
-
if (!
|
|
269
|
-
const d =
|
|
270
|
-
t.push(
|
|
467
|
+
for (const s of i) {
|
|
468
|
+
if (!s || typeof s != "object") continue;
|
|
469
|
+
const d = s.children;
|
|
470
|
+
t.push(be(s)), Array.isArray(d) && d.length > 0 && e(d);
|
|
271
471
|
}
|
|
272
472
|
};
|
|
273
473
|
return e(o), t;
|
|
@@ -277,11 +477,11 @@ async function ae(o) {
|
|
|
277
477
|
return [];
|
|
278
478
|
if (j[o])
|
|
279
479
|
return j[o];
|
|
280
|
-
if (o in
|
|
281
|
-
return await
|
|
480
|
+
if (o in ie)
|
|
481
|
+
return await ie[o];
|
|
282
482
|
const t = (async () => {
|
|
283
483
|
try {
|
|
284
|
-
const e = await
|
|
484
|
+
const e = await M().Get(G.dictApi(o));
|
|
285
485
|
if (e.status === 200) {
|
|
286
486
|
const i = Ce(e.data);
|
|
287
487
|
return j[o] = i, i;
|
|
@@ -290,19 +490,19 @@ async function ae(o) {
|
|
|
290
490
|
} catch (e) {
|
|
291
491
|
return console.error(`[dict] 加载字典 ${o} 失败:`, e), [];
|
|
292
492
|
} finally {
|
|
293
|
-
delete
|
|
493
|
+
delete ie[o];
|
|
294
494
|
}
|
|
295
495
|
})();
|
|
296
|
-
return
|
|
496
|
+
return ie[o] = t, t;
|
|
297
497
|
}
|
|
298
|
-
async function
|
|
498
|
+
async function pt(o, t, e = "") {
|
|
299
499
|
if (t == null || t === "")
|
|
300
500
|
return e;
|
|
301
501
|
const i = j[o];
|
|
302
502
|
if (i && i.length > 0)
|
|
303
503
|
return pe(i, t);
|
|
304
|
-
const
|
|
305
|
-
return
|
|
504
|
+
const s = await ae(o);
|
|
505
|
+
return s && s.length > 0 ? pe(s, t) : e || String(t);
|
|
306
506
|
}
|
|
307
507
|
function pe(o, t) {
|
|
308
508
|
const e = o.find(
|
|
@@ -310,24 +510,24 @@ function pe(o, t) {
|
|
|
310
510
|
);
|
|
311
511
|
return e ? e.label : String(t);
|
|
312
512
|
}
|
|
313
|
-
function
|
|
513
|
+
function Co(o, t, e = "") {
|
|
314
514
|
if (t == null || t === "")
|
|
315
515
|
return e;
|
|
316
516
|
const i = j[o];
|
|
317
517
|
return i && i.length > 0 ? pe(i, t) : e || String(t);
|
|
318
518
|
}
|
|
319
|
-
async function
|
|
519
|
+
async function xo(o) {
|
|
320
520
|
await Promise.all(o.map((t) => ae(t)));
|
|
321
521
|
}
|
|
322
|
-
function
|
|
522
|
+
function _o(o) {
|
|
323
523
|
o ? delete j[o] : Object.keys(j).forEach((t) => {
|
|
324
524
|
delete j[t];
|
|
325
525
|
});
|
|
326
526
|
}
|
|
327
|
-
function
|
|
527
|
+
function So(o, t) {
|
|
328
528
|
j[o] = t;
|
|
329
529
|
}
|
|
330
|
-
const
|
|
530
|
+
const ht = { class: "u-dict-field" }, gt = /* @__PURE__ */ V({
|
|
331
531
|
__name: "UDict",
|
|
332
532
|
props: {
|
|
333
533
|
fieldLabel: {},
|
|
@@ -352,30 +552,30 @@ const st = { class: "u-dict-field" }, rt = /* @__PURE__ */ P({
|
|
|
352
552
|
},
|
|
353
553
|
emits: ["update:modelValue"],
|
|
354
554
|
setup(o, { emit: t }) {
|
|
355
|
-
const e = o, i = t,
|
|
555
|
+
const e = o, i = t, s = z({
|
|
356
556
|
excluded: ["fieldLabel", "labelPosition", "labelWidth", "labelAlign", "required", "modelValue", "dictType"],
|
|
357
557
|
options: [],
|
|
358
558
|
loading: !1
|
|
359
559
|
}), d = async () => {
|
|
360
560
|
if (e.dictType) {
|
|
361
|
-
|
|
561
|
+
s.loading = !0;
|
|
362
562
|
try {
|
|
363
|
-
const l = await
|
|
364
|
-
l.status === 200 ?
|
|
563
|
+
const l = await M().Get(G.dictApi(e.dictType));
|
|
564
|
+
l.status === 200 ? s.options = Ce(l.data) : (console.error("[UDict] 请求失败:", l.message), s.options = []);
|
|
365
565
|
} catch (l) {
|
|
366
|
-
console.error("[UDict] 加载字典失败:", l),
|
|
566
|
+
console.error("[UDict] 加载字典失败:", l), s.options = [];
|
|
367
567
|
} finally {
|
|
368
|
-
|
|
568
|
+
s.loading = !1;
|
|
369
569
|
}
|
|
370
570
|
}
|
|
371
571
|
};
|
|
372
572
|
L(() => e.dictType, () => {
|
|
373
573
|
d();
|
|
374
574
|
}, { immediate: !0 });
|
|
375
|
-
const
|
|
575
|
+
const r = b(() => {
|
|
376
576
|
const l = {};
|
|
377
577
|
return e.labelPosition === "left" && e.labelWidth && (l.width = typeof e.labelWidth == "number" ? `${e.labelWidth}px` : e.labelWidth), e.labelAlign && (l.textAlign = e.labelAlign), l;
|
|
378
|
-
}), c =
|
|
578
|
+
}), c = b(() => ({
|
|
379
579
|
"u-dict-label-left": e.labelPosition === "left",
|
|
380
580
|
"u-dict-label-top": e.labelPosition === "top"
|
|
381
581
|
})), a = {
|
|
@@ -385,30 +585,30 @@ const st = { class: "u-dict-field" }, rt = /* @__PURE__ */ P({
|
|
|
385
585
|
};
|
|
386
586
|
return (l, n) => {
|
|
387
587
|
const u = ge, m = he;
|
|
388
|
-
return g(),
|
|
389
|
-
class:
|
|
588
|
+
return g(), v("div", {
|
|
589
|
+
class: P(["u-dict", c.value])
|
|
390
590
|
}, [
|
|
391
|
-
o.fieldLabel ? (g(),
|
|
591
|
+
o.fieldLabel ? (g(), v("div", {
|
|
392
592
|
key: 0,
|
|
393
593
|
class: "u-dict-label",
|
|
394
|
-
style: B(
|
|
594
|
+
style: B(r.value)
|
|
395
595
|
}, [
|
|
396
596
|
F(T(o.fieldLabel) + " ", 1),
|
|
397
597
|
x("span", {
|
|
398
|
-
class:
|
|
598
|
+
class: P(["required-star", { "required-star--visible": o.required }])
|
|
399
599
|
}, "*", 2)
|
|
400
600
|
], 4)) : D("", !0),
|
|
401
|
-
x("div",
|
|
601
|
+
x("div", ht, [
|
|
402
602
|
_(m, {
|
|
403
603
|
"model-value": o.modelValue,
|
|
404
604
|
placeholder: o.placeholder || "请选择",
|
|
405
|
-
loading:
|
|
605
|
+
loading: s.loading,
|
|
406
606
|
disabled: o.disable,
|
|
407
607
|
style: { width: "100%" },
|
|
408
608
|
onChange: a.onUpdate
|
|
409
609
|
}, {
|
|
410
610
|
default: w(() => [
|
|
411
|
-
(g(!0),
|
|
611
|
+
(g(!0), v(I, null, E(s.options, (f) => (g(), S(u, {
|
|
412
612
|
key: f.value,
|
|
413
613
|
label: f.label,
|
|
414
614
|
value: f.value
|
|
@@ -420,7 +620,7 @@ const st = { class: "u-dict-field" }, rt = /* @__PURE__ */ P({
|
|
|
420
620
|
], 2);
|
|
421
621
|
};
|
|
422
622
|
}
|
|
423
|
-
}), ee = /* @__PURE__ */ $(
|
|
623
|
+
}), ee = /* @__PURE__ */ $(gt, [["__scopeId", "data-v-d0ae00fe"]]), yt = { class: "u-toggle-field" }, vt = /* @__PURE__ */ V({
|
|
424
624
|
__name: "UToggle",
|
|
425
625
|
props: {
|
|
426
626
|
fieldLabel: {},
|
|
@@ -444,41 +644,41 @@ const st = { class: "u-dict-field" }, rt = /* @__PURE__ */ P({
|
|
|
444
644
|
},
|
|
445
645
|
emits: ["update:modelValue"],
|
|
446
646
|
setup(o, { emit: t }) {
|
|
447
|
-
const e = o, i = t,
|
|
647
|
+
const e = o, i = t, s = z({
|
|
448
648
|
excluded: ["fieldLabel", "labelPosition", "labelWidth", "labelAlign", "required", "modelValue", "trueValue", "falseValue", "activeText", "inactiveText", "activeColor", "inactiveColor"]
|
|
449
649
|
}), d = () => {
|
|
450
650
|
const a = {};
|
|
451
651
|
return e.labelPosition === "left" && e.labelWidth && (a.width = typeof e.labelWidth == "number" ? `${e.labelWidth}px` : e.labelWidth), e.labelAlign && (a.textAlign = e.labelAlign), a;
|
|
452
|
-
},
|
|
652
|
+
}, r = b({
|
|
453
653
|
get: () => e.modelValue === e.trueValue,
|
|
454
654
|
set: (a) => {
|
|
455
655
|
i("update:modelValue", a ? e.trueValue : e.falseValue);
|
|
456
656
|
}
|
|
457
|
-
}), c =
|
|
657
|
+
}), c = b(() => {
|
|
458
658
|
const a = {};
|
|
459
659
|
for (const l in e)
|
|
460
|
-
!
|
|
660
|
+
!s.excluded.includes(l) && l !== "modelValue" && (a[l] = e[l]);
|
|
461
661
|
return a;
|
|
462
662
|
});
|
|
463
663
|
return (a, l) => {
|
|
464
|
-
const n =
|
|
465
|
-
return g(),
|
|
466
|
-
class:
|
|
664
|
+
const n = ze;
|
|
665
|
+
return g(), v("div", {
|
|
666
|
+
class: P(["u-toggle", { "u-toggle-label-left": o.labelPosition === "left" }])
|
|
467
667
|
}, [
|
|
468
|
-
o.fieldLabel ? (g(),
|
|
668
|
+
o.fieldLabel ? (g(), v("div", {
|
|
469
669
|
key: 0,
|
|
470
670
|
class: "u-toggle-label",
|
|
471
671
|
style: B(d())
|
|
472
672
|
}, [
|
|
473
673
|
F(T(o.fieldLabel) + " ", 1),
|
|
474
674
|
x("span", {
|
|
475
|
-
class:
|
|
675
|
+
class: P(["required-star", { "required-star--visible": o.required }])
|
|
476
676
|
}, "*", 2)
|
|
477
677
|
], 4)) : D("", !0),
|
|
478
|
-
x("div",
|
|
479
|
-
_(n,
|
|
480
|
-
modelValue:
|
|
481
|
-
"onUpdate:modelValue": l[0] || (l[0] = (u) =>
|
|
678
|
+
x("div", yt, [
|
|
679
|
+
_(n, de({
|
|
680
|
+
modelValue: r.value,
|
|
681
|
+
"onUpdate:modelValue": l[0] || (l[0] = (u) => r.value = u)
|
|
482
682
|
}, c.value, {
|
|
483
683
|
"active-text": o.activeText,
|
|
484
684
|
"inactive-text": o.inactiveText,
|
|
@@ -489,7 +689,7 @@ const st = { class: "u-dict-field" }, rt = /* @__PURE__ */ P({
|
|
|
489
689
|
], 2);
|
|
490
690
|
};
|
|
491
691
|
}
|
|
492
|
-
}),
|
|
692
|
+
}), Ie = /* @__PURE__ */ $(vt, [["__scopeId", "data-v-94c1fd38"]]), bt = { class: "u-cascader-levels" }, wt = /* @__PURE__ */ V({
|
|
493
693
|
__name: "UCascader",
|
|
494
694
|
props: {
|
|
495
695
|
fieldLabel: {},
|
|
@@ -503,10 +703,10 @@ const st = { class: "u-dict-field" }, rt = /* @__PURE__ */ P({
|
|
|
503
703
|
},
|
|
504
704
|
emits: ["update:modelValue"],
|
|
505
705
|
setup(o, { emit: t }) {
|
|
506
|
-
const e = o, i = t,
|
|
706
|
+
const e = o, i = t, s = () => {
|
|
507
707
|
const a = {};
|
|
508
708
|
return e.labelPosition === "left" && e.labelWidth && (a.width = typeof e.labelWidth == "number" ? `${e.labelWidth}px` : e.labelWidth), e.labelAlign && (a.textAlign = e.labelAlign), a;
|
|
509
|
-
}, d = Q([]),
|
|
709
|
+
}, d = Q([]), r = b(() => {
|
|
510
710
|
const a = [];
|
|
511
711
|
let l = e.options || [];
|
|
512
712
|
for (let n = 0; n < e.depth; n++)
|
|
@@ -529,34 +729,34 @@ const st = { class: "u-dict-field" }, rt = /* @__PURE__ */ P({
|
|
|
529
729
|
};
|
|
530
730
|
return (a, l) => {
|
|
531
731
|
const n = ge, u = he;
|
|
532
|
-
return g(),
|
|
533
|
-
class:
|
|
732
|
+
return g(), v("div", {
|
|
733
|
+
class: P(["u-cascader", { "u-cascader-label-left": o.labelPosition === "left" }])
|
|
534
734
|
}, [
|
|
535
|
-
o.fieldLabel ? (g(),
|
|
735
|
+
o.fieldLabel ? (g(), v("div", {
|
|
536
736
|
key: 0,
|
|
537
737
|
class: "u-cascader-label",
|
|
538
|
-
style: B(
|
|
738
|
+
style: B(s())
|
|
539
739
|
}, [
|
|
540
740
|
F(T(o.fieldLabel) + " ", 1),
|
|
541
741
|
x("span", {
|
|
542
|
-
class:
|
|
742
|
+
class: P(["required-star", { "required-star--visible": o.required }])
|
|
543
743
|
}, "*", 2)
|
|
544
744
|
], 4)) : D("", !0),
|
|
545
|
-
x("div",
|
|
546
|
-
(g(!0),
|
|
745
|
+
x("div", bt, [
|
|
746
|
+
(g(!0), v(I, null, E(o.depth, (m) => (g(), v("div", {
|
|
547
747
|
key: m - 1,
|
|
548
748
|
class: "u-cascader-level"
|
|
549
749
|
}, [
|
|
550
750
|
_(u, {
|
|
551
751
|
"model-value": d.value[m - 1],
|
|
552
|
-
options:
|
|
752
|
+
options: r.value[m - 1] || [],
|
|
553
753
|
disabled: m > 1 && d.value[m - 2] === void 0,
|
|
554
754
|
placeholder: `请选择${m}级`,
|
|
555
755
|
style: { width: "100%" },
|
|
556
756
|
onChange: (f) => c(m - 1, f)
|
|
557
757
|
}, {
|
|
558
758
|
default: w(() => [
|
|
559
|
-
(g(!0),
|
|
759
|
+
(g(!0), v(I, null, E(r.value[m - 1] || [], (f) => (g(), S(n, {
|
|
560
760
|
key: f.value,
|
|
561
761
|
label: f.label,
|
|
562
762
|
value: f.value
|
|
@@ -569,7 +769,7 @@ const st = { class: "u-dict-field" }, rt = /* @__PURE__ */ P({
|
|
|
569
769
|
], 2);
|
|
570
770
|
};
|
|
571
771
|
}
|
|
572
|
-
}),
|
|
772
|
+
}), Me = /* @__PURE__ */ $(wt, [["__scopeId", "data-v-d66c339c"]]), Ct = { class: "u-date-field" }, xt = /* @__PURE__ */ V({
|
|
573
773
|
__name: "UDate",
|
|
574
774
|
props: {
|
|
575
775
|
fieldLabel: {},
|
|
@@ -586,32 +786,32 @@ const st = { class: "u-dict-field" }, rt = /* @__PURE__ */ P({
|
|
|
586
786
|
},
|
|
587
787
|
emits: ["update:modelValue"],
|
|
588
788
|
setup(o, { emit: t }) {
|
|
589
|
-
const e = o, i = t,
|
|
789
|
+
const e = o, i = t, s = () => {
|
|
590
790
|
const a = {};
|
|
591
791
|
return e.labelPosition === "left" && e.labelWidth && (a.width = typeof e.labelWidth == "number" ? `${e.labelWidth}px` : e.labelWidth), e.labelAlign && (a.textAlign = e.labelAlign), a;
|
|
592
792
|
}, d = Q("");
|
|
593
793
|
L(() => e.modelValue, (a) => {
|
|
594
794
|
e.mode === "single" ? d.value = a || "" : e.mode === "multiple" ? d.value = Array.isArray(a) ? a : a ? [a] : [] : e.mode === "range" && (a && typeof a == "object" && a.from && a.to ? d.value = [a.from, a.to] : d.value = []);
|
|
595
795
|
}, { immediate: !0 });
|
|
596
|
-
const
|
|
796
|
+
const r = (a) => {
|
|
597
797
|
a && (e.mode === "single" || e.mode === "multiple" ? i("update:modelValue", a) : e.mode === "range" && a && a.length === 2 && i("update:modelValue", { from: a[0], to: a[1] }));
|
|
598
|
-
}, c =
|
|
798
|
+
}, c = b(() => e.mode === "range" ? "daterange" : e.mode === "multiple" ? "dates" : "date");
|
|
599
799
|
return (a, l) => {
|
|
600
|
-
const n =
|
|
601
|
-
return g(),
|
|
602
|
-
class:
|
|
800
|
+
const n = qe;
|
|
801
|
+
return g(), v("div", {
|
|
802
|
+
class: P(["u-date", { "u-date-label-left": o.labelPosition === "left" }])
|
|
603
803
|
}, [
|
|
604
|
-
o.fieldLabel ? (g(),
|
|
804
|
+
o.fieldLabel ? (g(), v("div", {
|
|
605
805
|
key: 0,
|
|
606
806
|
class: "u-date-label",
|
|
607
|
-
style: B(
|
|
807
|
+
style: B(s())
|
|
608
808
|
}, [
|
|
609
809
|
F(T(o.fieldLabel) + " ", 1),
|
|
610
810
|
x("span", {
|
|
611
|
-
class:
|
|
811
|
+
class: P(["required-star", { "required-star--visible": o.required }])
|
|
612
812
|
}, "*", 2)
|
|
613
813
|
], 4)) : D("", !0),
|
|
614
|
-
x("div",
|
|
814
|
+
x("div", Ct, [
|
|
615
815
|
_(n, {
|
|
616
816
|
modelValue: d.value,
|
|
617
817
|
"onUpdate:modelValue": l[0] || (l[0] = (u) => d.value = u),
|
|
@@ -622,15 +822,15 @@ const st = { class: "u-dict-field" }, rt = /* @__PURE__ */ P({
|
|
|
622
822
|
"end-placeholder": o.locale === "en-US" ? "End date" : "结束日期",
|
|
623
823
|
format: o.mask.replace("YYYY", "YYYY").replace("MM", "MM").replace("DD", "DD"),
|
|
624
824
|
"value-format": o.mask.replace("YYYY", "YYYY").replace("MM", "MM").replace("DD", "DD"),
|
|
625
|
-
onChange:
|
|
825
|
+
onChange: r
|
|
626
826
|
}, null, 8, ["modelValue", "type", "placeholder", "range-separator", "start-placeholder", "end-placeholder", "format", "value-format"])
|
|
627
827
|
])
|
|
628
828
|
], 2);
|
|
629
829
|
};
|
|
630
830
|
}
|
|
631
|
-
}),
|
|
831
|
+
}), re = /* @__PURE__ */ $(xt, [["__scopeId", "data-v-9cd05064"]]);
|
|
632
832
|
function le(o, t = "info") {
|
|
633
|
-
|
|
833
|
+
Ve({
|
|
634
834
|
message: o,
|
|
635
835
|
type: t,
|
|
636
836
|
duration: 1e3,
|
|
@@ -638,39 +838,39 @@ function le(o, t = "info") {
|
|
|
638
838
|
});
|
|
639
839
|
}
|
|
640
840
|
function U(o) {
|
|
641
|
-
|
|
841
|
+
Ve({
|
|
642
842
|
message: o,
|
|
643
843
|
type: "error",
|
|
644
844
|
duration: 2e3,
|
|
645
845
|
showClose: !1
|
|
646
846
|
});
|
|
647
847
|
}
|
|
648
|
-
function
|
|
848
|
+
function _t(o) {
|
|
649
849
|
le(o, "success");
|
|
650
850
|
}
|
|
651
|
-
function
|
|
851
|
+
function St(o) {
|
|
652
852
|
le(o, "error");
|
|
653
853
|
}
|
|
654
|
-
function
|
|
854
|
+
function Dt(o) {
|
|
655
855
|
le(o, "warning");
|
|
656
856
|
}
|
|
657
|
-
function
|
|
857
|
+
function kt(o) {
|
|
658
858
|
le(o, "info");
|
|
659
859
|
}
|
|
660
860
|
const N = {
|
|
661
861
|
notify: le,
|
|
662
|
-
success:
|
|
663
|
-
error:
|
|
664
|
-
warning:
|
|
665
|
-
info:
|
|
862
|
+
success: _t,
|
|
863
|
+
error: St,
|
|
864
|
+
warning: Dt,
|
|
865
|
+
info: kt,
|
|
666
866
|
alertError: U
|
|
667
|
-
},
|
|
867
|
+
}, Tt = {
|
|
668
868
|
key: 0,
|
|
669
869
|
class: "u-menu-brand"
|
|
670
|
-
},
|
|
870
|
+
}, Pt = ["src"], Vt = { class: "u-menu-brand-text" }, $t = {
|
|
671
871
|
key: 1,
|
|
672
872
|
class: "u-menu-logout"
|
|
673
|
-
},
|
|
873
|
+
}, At = /* @__PURE__ */ V({
|
|
674
874
|
__name: "UMenu",
|
|
675
875
|
props: {
|
|
676
876
|
menuId: { default: "menu" },
|
|
@@ -682,7 +882,7 @@ const N = {
|
|
|
682
882
|
},
|
|
683
883
|
emits: ["menu-click", "logout"],
|
|
684
884
|
setup(o, { expose: t, emit: e }) {
|
|
685
|
-
const i = o,
|
|
885
|
+
const i = o, s = e, d = z({
|
|
686
886
|
// 菜单配置
|
|
687
887
|
config: null,
|
|
688
888
|
// 实际渲染的菜单列表(静态配置或字典菜单)
|
|
@@ -693,7 +893,7 @@ const N = {
|
|
|
693
893
|
iconMap: {},
|
|
694
894
|
// 图标是否已加载
|
|
695
895
|
iconsLoaded: !1
|
|
696
|
-
}),
|
|
896
|
+
}), r = b(() => {
|
|
697
897
|
var a, l, n, u, m, f, p, h;
|
|
698
898
|
return {
|
|
699
899
|
// 项目名称:为空则不显示
|
|
@@ -728,7 +928,7 @@ const N = {
|
|
|
728
928
|
async loadConfig(a) {
|
|
729
929
|
if (a)
|
|
730
930
|
try {
|
|
731
|
-
const l = await
|
|
931
|
+
const l = await M().Get(G.formCfgApi(a, "menus"));
|
|
732
932
|
if (l.status !== 200) {
|
|
733
933
|
U(l.message || "获取菜单配置失败");
|
|
734
934
|
return;
|
|
@@ -742,7 +942,7 @@ const N = {
|
|
|
742
942
|
// 加载字典菜单(参考 UDict 的字典数据来源,字典树对应菜单的 1、2 级)
|
|
743
943
|
async loadDictMenus(a) {
|
|
744
944
|
try {
|
|
745
|
-
const l = await
|
|
945
|
+
const l = await M().Get(G.cascaderApi(a));
|
|
746
946
|
if (l.status !== 200) {
|
|
747
947
|
U(l.message || "获取菜单字典失败");
|
|
748
948
|
return;
|
|
@@ -844,24 +1044,24 @@ const N = {
|
|
|
844
1044
|
indexPath: n.indexPath,
|
|
845
1045
|
index: a
|
|
846
1046
|
};
|
|
847
|
-
|
|
1047
|
+
s("menu-click", m);
|
|
848
1048
|
},
|
|
849
1049
|
// 退出登录
|
|
850
1050
|
handleLogout() {
|
|
851
|
-
|
|
1051
|
+
s("logout");
|
|
852
1052
|
},
|
|
853
1053
|
// 设置激活项
|
|
854
1054
|
setActivePath(a) {
|
|
855
1055
|
d.activePath = a;
|
|
856
1056
|
},
|
|
857
|
-
//
|
|
1057
|
+
// 加载图标(静态引入见文件顶部;iconsLoaded 只保证转换一次的幂等)
|
|
858
1058
|
async ensureIcons() {
|
|
859
1059
|
if (!d.iconsLoaded) {
|
|
860
1060
|
d.iconsLoaded = !0;
|
|
861
1061
|
try {
|
|
862
|
-
const a =
|
|
1062
|
+
const a = $e, l = a != null && a.default ? { ...a.default, ...a } : { ...a }, n = {};
|
|
863
1063
|
for (const [u, m] of Object.entries(l))
|
|
864
|
-
n[u] =
|
|
1064
|
+
n[u] = se(m);
|
|
865
1065
|
d.iconMap = n;
|
|
866
1066
|
} catch (a) {
|
|
867
1067
|
console.warn("[UMenu] @element-plus/icons-vue 不可用,菜单图标将被忽略", a);
|
|
@@ -885,34 +1085,34 @@ const N = {
|
|
|
885
1085
|
loadConfig: c.loadConfig,
|
|
886
1086
|
setActivePath: c.setActivePath
|
|
887
1087
|
}), (a, l) => {
|
|
888
|
-
const n = ye, u =
|
|
889
|
-
return g(),
|
|
890
|
-
class:
|
|
891
|
-
style: B(
|
|
1088
|
+
const n = ye, u = Ye, m = je, f = Oe, p = X;
|
|
1089
|
+
return g(), v("div", {
|
|
1090
|
+
class: P(["u-menu", [`u-menu--${r.value.mode}`, { "u-menu--no-brand": !r.value.projectName }]]),
|
|
1091
|
+
style: B(r.value.isHorizontal ? {} : { width: r.value.width + "px" })
|
|
892
1092
|
}, [
|
|
893
|
-
|
|
1093
|
+
r.value.projectName ? (g(), v("div", Tt, [
|
|
894
1094
|
k(a.$slots, "brand", {
|
|
895
|
-
projectName:
|
|
896
|
-
mode:
|
|
1095
|
+
projectName: r.value.projectName,
|
|
1096
|
+
mode: r.value.mode
|
|
897
1097
|
}, () => [
|
|
898
|
-
|
|
1098
|
+
r.value.logo ? (g(), v("img", {
|
|
899
1099
|
key: 0,
|
|
900
1100
|
class: "u-menu-logo",
|
|
901
|
-
src:
|
|
1101
|
+
src: r.value.logo,
|
|
902
1102
|
alt: "logo"
|
|
903
|
-
}, null, 8,
|
|
904
|
-
x("span",
|
|
1103
|
+
}, null, 8, Pt)) : D("", !0),
|
|
1104
|
+
x("span", Vt, T(r.value.projectName), 1)
|
|
905
1105
|
], !0)
|
|
906
1106
|
])) : D("", !0),
|
|
907
1107
|
_(f, {
|
|
908
1108
|
class: "u-menu-list",
|
|
909
|
-
mode:
|
|
910
|
-
"default-active":
|
|
911
|
-
"unique-opened": !
|
|
1109
|
+
mode: r.value.elMode,
|
|
1110
|
+
"default-active": r.value.activeIndex,
|
|
1111
|
+
"unique-opened": !r.value.isHorizontal,
|
|
912
1112
|
onSelect: c.handleSelect
|
|
913
1113
|
}, {
|
|
914
1114
|
default: w(() => [
|
|
915
|
-
(g(!0),
|
|
1115
|
+
(g(!0), v(I, null, E(r.value.menus, (h, y) => (g(), v(I, {
|
|
916
1116
|
key: c.itemIndex(h, y)
|
|
917
1117
|
}, [
|
|
918
1118
|
c.hasChildren(h) ? (g(), S(m, {
|
|
@@ -930,7 +1130,7 @@ const N = {
|
|
|
930
1130
|
class: "u-menu-icon"
|
|
931
1131
|
}, {
|
|
932
1132
|
default: w(() => [
|
|
933
|
-
(g(), S(
|
|
1133
|
+
(g(), S(J(c.getIcon(h.icon))))
|
|
934
1134
|
]),
|
|
935
1135
|
_: 2
|
|
936
1136
|
}, 1024)) : D("", !0),
|
|
@@ -938,15 +1138,15 @@ const N = {
|
|
|
938
1138
|
], !0)
|
|
939
1139
|
]),
|
|
940
1140
|
default: w(() => [
|
|
941
|
-
(g(!0),
|
|
942
|
-
key: c.childIndex(h, y, A,
|
|
943
|
-
index: c.childIndex(h, y, A,
|
|
1141
|
+
(g(!0), v(I, null, E(h.children, (A, K) => (g(), S(u, {
|
|
1142
|
+
key: c.childIndex(h, y, A, K),
|
|
1143
|
+
index: c.childIndex(h, y, A, K)
|
|
944
1144
|
}, {
|
|
945
1145
|
default: w(() => [
|
|
946
1146
|
k(a.$slots, "menu-item", {
|
|
947
1147
|
item: A,
|
|
948
1148
|
level: 2,
|
|
949
|
-
index:
|
|
1149
|
+
index: K,
|
|
950
1150
|
parent: h
|
|
951
1151
|
}, () => [
|
|
952
1152
|
c.getIcon(A.icon) ? (g(), S(n, {
|
|
@@ -954,7 +1154,7 @@ const N = {
|
|
|
954
1154
|
class: "u-menu-icon"
|
|
955
1155
|
}, {
|
|
956
1156
|
default: w(() => [
|
|
957
|
-
(g(), S(
|
|
1157
|
+
(g(), S(J(c.getIcon(A.icon))))
|
|
958
1158
|
]),
|
|
959
1159
|
_: 2
|
|
960
1160
|
}, 1024)) : D("", !0),
|
|
@@ -981,7 +1181,7 @@ const N = {
|
|
|
981
1181
|
class: "u-menu-icon"
|
|
982
1182
|
}, {
|
|
983
1183
|
default: w(() => [
|
|
984
|
-
(g(), S(
|
|
1184
|
+
(g(), S(J(c.getIcon(h.icon))))
|
|
985
1185
|
]),
|
|
986
1186
|
_: 2
|
|
987
1187
|
}, 1024)) : D("", !0),
|
|
@@ -994,9 +1194,9 @@ const N = {
|
|
|
994
1194
|
]),
|
|
995
1195
|
_: 3
|
|
996
1196
|
}, 8, ["mode", "default-active", "unique-opened", "onSelect"]),
|
|
997
|
-
|
|
1197
|
+
r.value.showLogout ? (g(), v("div", $t, [
|
|
998
1198
|
k(a.$slots, "logout", {
|
|
999
|
-
mode:
|
|
1199
|
+
mode: r.value.mode
|
|
1000
1200
|
}, () => [
|
|
1001
1201
|
_(p, {
|
|
1002
1202
|
class: "u-menu-logout-btn",
|
|
@@ -1004,7 +1204,7 @@ const N = {
|
|
|
1004
1204
|
onClick: c.handleLogout
|
|
1005
1205
|
}, {
|
|
1006
1206
|
default: w(() => [
|
|
1007
|
-
F(T(
|
|
1207
|
+
F(T(r.value.logoutText), 1)
|
|
1008
1208
|
]),
|
|
1009
1209
|
_: 1
|
|
1010
1210
|
}, 8, ["onClick"])
|
|
@@ -1013,16 +1213,16 @@ const N = {
|
|
|
1013
1213
|
], 6);
|
|
1014
1214
|
};
|
|
1015
1215
|
}
|
|
1016
|
-
}),
|
|
1216
|
+
}), Rt = /* @__PURE__ */ $(At, [["__scopeId", "data-v-41cadcd8"]]), It = { class: "form-content" }, Mt = {
|
|
1017
1217
|
key: 1,
|
|
1018
1218
|
class: "form-layout"
|
|
1019
|
-
},
|
|
1219
|
+
}, Et = {
|
|
1020
1220
|
key: 0,
|
|
1021
1221
|
class: "form-header"
|
|
1022
|
-
},
|
|
1222
|
+
}, Ut = { class: "title" }, Bt = { class: "form-body" }, Ft = {
|
|
1023
1223
|
key: 1,
|
|
1024
1224
|
class: "form-footer"
|
|
1025
|
-
},
|
|
1225
|
+
}, Lt = /* @__PURE__ */ V({
|
|
1026
1226
|
__name: "FormContainer",
|
|
1027
1227
|
props: {
|
|
1028
1228
|
visible: { type: Boolean },
|
|
@@ -1032,7 +1232,7 @@ const N = {
|
|
|
1032
1232
|
},
|
|
1033
1233
|
emits: ["update:visible", "close", "closed"],
|
|
1034
1234
|
setup(o, { emit: t }) {
|
|
1035
|
-
const e = o, i = t, { visible:
|
|
1235
|
+
const e = o, i = t, { visible: s } = Ze(e), d = b(() => e.layout.open === "normal"), r = b(() => e.layout.width || 400), c = {
|
|
1036
1236
|
handleClose() {
|
|
1037
1237
|
i("update:visible", !1), i("close");
|
|
1038
1238
|
},
|
|
@@ -1044,31 +1244,31 @@ const N = {
|
|
|
1044
1244
|
}
|
|
1045
1245
|
};
|
|
1046
1246
|
return (a, l) => {
|
|
1047
|
-
const n = ye, u =
|
|
1048
|
-
return d.value ? W(
|
|
1049
|
-
o.title ? (g(),
|
|
1050
|
-
x("div",
|
|
1247
|
+
const n = ye, u = Qe;
|
|
1248
|
+
return d.value ? W(s) ? (g(), v("div", Mt, [
|
|
1249
|
+
o.title ? (g(), v("div", Et, [
|
|
1250
|
+
x("div", Ut, T(o.title), 1)
|
|
1051
1251
|
])) : D("", !0),
|
|
1052
|
-
x("div",
|
|
1252
|
+
x("div", Bt, [
|
|
1053
1253
|
o.loading ? (g(), S(n, {
|
|
1054
1254
|
key: 0,
|
|
1055
1255
|
class: "is-loading",
|
|
1056
1256
|
size: 40
|
|
1057
1257
|
}, {
|
|
1058
1258
|
default: w(() => [
|
|
1059
|
-
_(W(
|
|
1259
|
+
_(W(Pe))
|
|
1060
1260
|
]),
|
|
1061
1261
|
_: 1
|
|
1062
1262
|
})) : k(a.$slots, "default", {}, void 0, !0, 1)
|
|
1063
1263
|
]),
|
|
1064
|
-
a.$slots.actions ? (g(),
|
|
1264
|
+
a.$slots.actions ? (g(), v("div", Ft, [
|
|
1065
1265
|
k(a.$slots, "actions", {}, void 0, !0)
|
|
1066
1266
|
])) : D("", !0)
|
|
1067
1267
|
])) : D("", !0) : (g(), S(u, {
|
|
1068
1268
|
key: 0,
|
|
1069
|
-
"model-value": W(
|
|
1269
|
+
"model-value": W(s),
|
|
1070
1270
|
title: o.title,
|
|
1071
|
-
width:
|
|
1271
|
+
width: r.value,
|
|
1072
1272
|
"close-on-click-modal": !1,
|
|
1073
1273
|
"onUpdate:modelValue": c.updateVisible,
|
|
1074
1274
|
onClose: c.handleClose,
|
|
@@ -1078,14 +1278,14 @@ const N = {
|
|
|
1078
1278
|
k(a.$slots, "actions", {}, void 0, !0)
|
|
1079
1279
|
]),
|
|
1080
1280
|
default: w(() => [
|
|
1081
|
-
x("div",
|
|
1281
|
+
x("div", It, [
|
|
1082
1282
|
o.loading ? (g(), S(n, {
|
|
1083
1283
|
key: 0,
|
|
1084
1284
|
class: "is-loading",
|
|
1085
1285
|
size: 40
|
|
1086
1286
|
}, {
|
|
1087
1287
|
default: w(() => [
|
|
1088
|
-
_(W(
|
|
1288
|
+
_(W(Pe))
|
|
1089
1289
|
]),
|
|
1090
1290
|
_: 1
|
|
1091
1291
|
})) : k(a.$slots, "default", {}, void 0, !0, 1)
|
|
@@ -1095,7 +1295,7 @@ const N = {
|
|
|
1095
1295
|
}, 8, ["model-value", "title", "width", "onUpdate:modelValue", "onClose", "onClosed"]));
|
|
1096
1296
|
};
|
|
1097
1297
|
}
|
|
1098
|
-
}),
|
|
1298
|
+
}), Nt = /* @__PURE__ */ $(Lt, [["__scopeId", "data-v-83362259"]]), Wt = /* @__PURE__ */ V({
|
|
1099
1299
|
__name: "FormGrid",
|
|
1100
1300
|
props: {
|
|
1101
1301
|
fields: {},
|
|
@@ -1103,27 +1303,27 @@ const N = {
|
|
|
1103
1303
|
},
|
|
1104
1304
|
setup(o) {
|
|
1105
1305
|
const t = o, e = z({
|
|
1106
|
-
columns:
|
|
1306
|
+
columns: b(() => t.layout.columns || 1)
|
|
1107
1307
|
}), i = {
|
|
1108
|
-
getColSpan(
|
|
1109
|
-
const d =
|
|
1308
|
+
getColSpan(s) {
|
|
1309
|
+
const d = s.colSpan || 1;
|
|
1110
1310
|
return Math.min(d, e.columns);
|
|
1111
1311
|
}
|
|
1112
1312
|
};
|
|
1113
|
-
return (
|
|
1313
|
+
return (s, d) => (g(), v("div", {
|
|
1114
1314
|
class: "form-grid",
|
|
1115
1315
|
style: B({ "--grid-columns": e.columns })
|
|
1116
1316
|
}, [
|
|
1117
|
-
(g(!0),
|
|
1118
|
-
key:
|
|
1317
|
+
(g(!0), v(I, null, E(o.fields, (r) => (g(), v("div", {
|
|
1318
|
+
key: r.field,
|
|
1119
1319
|
class: "form-grid-item",
|
|
1120
|
-
style: B({ gridColumn: `span ${i.getColSpan(
|
|
1320
|
+
style: B({ gridColumn: `span ${i.getColSpan(r)}` })
|
|
1121
1321
|
}, [
|
|
1122
|
-
k(
|
|
1322
|
+
k(s.$slots, "default", { field: r }, void 0, !0)
|
|
1123
1323
|
], 4))), 128))
|
|
1124
1324
|
], 4));
|
|
1125
1325
|
}
|
|
1126
|
-
}),
|
|
1326
|
+
}), zt = /* @__PURE__ */ $(Wt, [["__scopeId", "data-v-90ed35a4"]]), qt = { class: "form-field" }, Ot = /* @__PURE__ */ V({
|
|
1127
1327
|
__name: "FormField",
|
|
1128
1328
|
props: {
|
|
1129
1329
|
field: {},
|
|
@@ -1134,29 +1334,29 @@ const N = {
|
|
|
1134
1334
|
},
|
|
1135
1335
|
emits: ["update:modelValue"],
|
|
1136
1336
|
setup(o, { emit: t }) {
|
|
1137
|
-
const e = o, i = t,
|
|
1138
|
-
componentMap:
|
|
1337
|
+
const e = o, i = t, s = z({
|
|
1338
|
+
componentMap: se({
|
|
1139
1339
|
input: te,
|
|
1140
1340
|
"input-number": Ae,
|
|
1141
1341
|
dict: ee,
|
|
1142
|
-
switch:
|
|
1143
|
-
cascader:
|
|
1144
|
-
date:
|
|
1342
|
+
switch: Ie,
|
|
1343
|
+
cascader: Me,
|
|
1344
|
+
date: re
|
|
1145
1345
|
}),
|
|
1146
1346
|
cascaderOptions: []
|
|
1147
1347
|
});
|
|
1148
1348
|
L(() => e.field.cascaderKey, () => {
|
|
1149
|
-
e.field.cascaderKey &&
|
|
1150
|
-
n.status === 200 && (
|
|
1349
|
+
e.field.cascaderKey && M().Get(G.cascaderApi(e.field.cascaderKey)).then((n) => {
|
|
1350
|
+
n.status === 200 && (s.cascaderOptions = we(n.data));
|
|
1151
1351
|
});
|
|
1152
1352
|
}, { immediate: !0 });
|
|
1153
|
-
const
|
|
1353
|
+
const r = b(() => s.componentMap[e.field.type] || te), c = b(() => {
|
|
1154
1354
|
if ((e.layout.labelPosition || "top") === "left") {
|
|
1155
1355
|
const u = e.layout.labelWidth || 0, m = typeof u == "number" ? u + 4 : u;
|
|
1156
1356
|
return { marginLeft: typeof m == "number" ? `${m}px` : m };
|
|
1157
1357
|
}
|
|
1158
1358
|
return {};
|
|
1159
|
-
}), a =
|
|
1359
|
+
}), a = b(() => {
|
|
1160
1360
|
const { field: n, modelValue: u, layout: m, disabled: f } = e;
|
|
1161
1361
|
let p = u;
|
|
1162
1362
|
n.type === "switch" && u == null && (p = !1);
|
|
@@ -1168,7 +1368,7 @@ const N = {
|
|
|
1168
1368
|
name: n.field,
|
|
1169
1369
|
required: n.required
|
|
1170
1370
|
};
|
|
1171
|
-
if (m.labelWidth && (h.labelWidth = m.labelWidth), m.labelAlign && (h.labelAlign = m.labelAlign), n.maxlength && (h.maxlength = n.maxlength), n.placeholder && (h.placeholder = n.placeholder), n.readonly && (h.readonly = n.readonly), n.lineCount && n.lineCount >= 2 ? (h.type = "textarea", h.rows = n.lineCount) : n.inputType && (h.type = n.inputType), n.type === "switch" && (n.activeText && (h.activeText = n.activeText), n.inactiveText && (h.inactiveText = n.inactiveText), n.activeColor && (h.activeColor = n.activeColor), n.inactiveColor && (h.inactiveColor = n.inactiveColor), n.trueValue !== void 0 && (h.trueValue = n.trueValue), n.falseValue !== void 0 && (h.falseValue = n.falseValue)), n.dictType && (h.dictType = n.dictType), n.cascaderKey && (h.options =
|
|
1371
|
+
if (m.labelWidth && (h.labelWidth = m.labelWidth), m.labelAlign && (h.labelAlign = m.labelAlign), n.maxlength && (h.maxlength = n.maxlength), n.placeholder && (h.placeholder = n.placeholder), n.readonly && (h.readonly = n.readonly), n.lineCount && n.lineCount >= 2 ? (h.type = "textarea", h.rows = n.lineCount) : n.inputType && (h.type = n.inputType), n.type === "switch" && (n.activeText && (h.activeText = n.activeText), n.inactiveText && (h.inactiveText = n.inactiveText), n.activeColor && (h.activeColor = n.activeColor), n.inactiveColor && (h.inactiveColor = n.inactiveColor), n.trueValue !== void 0 && (h.trueValue = n.trueValue), n.falseValue !== void 0 && (h.falseValue = n.falseValue)), n.dictType && (h.dictType = n.dictType), n.cascaderKey && (h.options = s.cascaderOptions, h.depth = n.cascaderDepth || 2), n.type === "date") {
|
|
1172
1372
|
n.mode && (h.mode = n.mode), n.locale && (h.locale = n.locale), n.format ? h.mask = n.format : n.mask && (h.mask = n.mask);
|
|
1173
1373
|
const y = n.dateMin ?? n.min, A = n.dateMax ?? n.max;
|
|
1174
1374
|
y != null && (h.min = y), A != null && (h.max = A);
|
|
@@ -1179,18 +1379,18 @@ const N = {
|
|
|
1179
1379
|
i("update:modelValue", n);
|
|
1180
1380
|
}
|
|
1181
1381
|
};
|
|
1182
|
-
return (n, u) => (g(),
|
|
1183
|
-
(g(), S(
|
|
1382
|
+
return (n, u) => (g(), v("div", qt, [
|
|
1383
|
+
(g(), S(J(r.value), de(a.value, {
|
|
1184
1384
|
"onUpdate:modelValue": l.handleUpdate
|
|
1185
1385
|
}), null, 16, ["onUpdate:modelValue"])),
|
|
1186
1386
|
x("div", {
|
|
1187
|
-
class:
|
|
1387
|
+
class: P(["field-error", { "field-error--visible": o.error }]),
|
|
1188
1388
|
style: B(c.value)
|
|
1189
1389
|
}, T(o.error || ""), 7)
|
|
1190
1390
|
]));
|
|
1191
1391
|
}
|
|
1192
|
-
}),
|
|
1193
|
-
class
|
|
1392
|
+
}), jt = /* @__PURE__ */ $(Ot, [["__scopeId", "data-v-96994a9a"]]);
|
|
1393
|
+
class Yt {
|
|
1194
1394
|
constructor() {
|
|
1195
1395
|
C(this, "formConfig", null);
|
|
1196
1396
|
C(this, "formData", {});
|
|
@@ -1202,38 +1402,38 @@ class Ft {
|
|
|
1202
1402
|
C(this, "currentQuery", {});
|
|
1203
1403
|
}
|
|
1204
1404
|
}
|
|
1205
|
-
let
|
|
1405
|
+
let Qt = class {
|
|
1206
1406
|
constructor() {
|
|
1207
1407
|
// 响应式数据
|
|
1208
|
-
C(this, "data", z(new
|
|
1408
|
+
C(this, "data", z(new Yt()));
|
|
1209
1409
|
}
|
|
1210
1410
|
// 解析 query 字符串
|
|
1211
1411
|
parseQuery(t) {
|
|
1212
1412
|
if (!t) return {};
|
|
1213
1413
|
const e = {}, i = t.split("&");
|
|
1214
|
-
for (const
|
|
1215
|
-
const [d,
|
|
1216
|
-
d && (e[d] =
|
|
1414
|
+
for (const s of i) {
|
|
1415
|
+
const [d, r] = s.split("=");
|
|
1416
|
+
d && (e[d] = r || "");
|
|
1217
1417
|
}
|
|
1218
1418
|
return e;
|
|
1219
1419
|
}
|
|
1220
1420
|
// 获取表单配置(type=forms,对应后端 config/forms/<formId>.yaml)
|
|
1221
1421
|
async fetchFormConfig(t) {
|
|
1222
|
-
const e = await
|
|
1422
|
+
const e = await M().Get(G.formCfgApi(t, "forms"));
|
|
1223
1423
|
if (e.status !== 200)
|
|
1224
1424
|
throw new Error(e.message || "获取表单配置失败");
|
|
1225
1425
|
return e.data;
|
|
1226
1426
|
}
|
|
1227
1427
|
// 获取表单数据
|
|
1228
1428
|
async fetchFormData(t, e) {
|
|
1229
|
-
const i = e ? `${t}?${e}` : t,
|
|
1230
|
-
if (
|
|
1231
|
-
throw new Error(
|
|
1232
|
-
return
|
|
1429
|
+
const i = e ? `${t}?${e}` : t, s = await M().Get(i);
|
|
1430
|
+
if (s.status !== 200)
|
|
1431
|
+
throw new Error(s.message || "获取表单数据失败");
|
|
1432
|
+
return s.data;
|
|
1233
1433
|
}
|
|
1234
1434
|
// 提交表单
|
|
1235
1435
|
async submitForm(t, e) {
|
|
1236
|
-
return await
|
|
1436
|
+
return await M().Post(t, e);
|
|
1237
1437
|
}
|
|
1238
1438
|
// 构建字段初始值
|
|
1239
1439
|
buildInitialData(t) {
|
|
@@ -1252,17 +1452,17 @@ let Lt = class {
|
|
|
1252
1452
|
this.data.errors = [];
|
|
1253
1453
|
const t = ((e = this.data.formConfig) == null ? void 0 : e.fields) || [];
|
|
1254
1454
|
for (const i of t) {
|
|
1255
|
-
const
|
|
1256
|
-
if (i.required && (
|
|
1455
|
+
const s = this.data.formData[i.field];
|
|
1456
|
+
if (i.required && (s == null || s === "")) {
|
|
1257
1457
|
this.data.errors.push({
|
|
1258
1458
|
field: i.field,
|
|
1259
1459
|
message: `${i.label}为必填项`
|
|
1260
1460
|
});
|
|
1261
1461
|
continue;
|
|
1262
1462
|
}
|
|
1263
|
-
if (i.rules && i.rules.length > 0 &&
|
|
1463
|
+
if (i.rules && i.rules.length > 0 && s) {
|
|
1264
1464
|
for (const d of i.rules)
|
|
1265
|
-
if (d.pattern && !new RegExp(d.pattern).test(
|
|
1465
|
+
if (d.pattern && !new RegExp(d.pattern).test(s)) {
|
|
1266
1466
|
this.data.errors.push({
|
|
1267
1467
|
field: i.field,
|
|
1268
1468
|
message: d.message || `${i.label}格式不正确`
|
|
@@ -1288,7 +1488,7 @@ let Lt = class {
|
|
|
1288
1488
|
try {
|
|
1289
1489
|
const i = await this.fetchFormConfig(t);
|
|
1290
1490
|
if (this.data.formConfig = i, this.data.isEditMode = this.checkIsEditMode(e || ""), this.data.formData = this.buildInitialData(i.fields), this.data.isEditMode && i.api.get && e) {
|
|
1291
|
-
const
|
|
1491
|
+
const s = await this.fetchFormData(i.api.get, e), d = this.nestedToFlat(s);
|
|
1292
1492
|
this.data.formData = { ...this.data.formData, ...d };
|
|
1293
1493
|
}
|
|
1294
1494
|
} catch (i) {
|
|
@@ -1309,10 +1509,10 @@ let Lt = class {
|
|
|
1309
1509
|
let i = { ...this.data.formData };
|
|
1310
1510
|
i = this.flattenToNested(i), this.data.isEditMode && this.data.currentQuery.id && (i.id = Number(this.data.currentQuery.id)), this.data.submitting = !0;
|
|
1311
1511
|
try {
|
|
1312
|
-
const
|
|
1313
|
-
if (
|
|
1314
|
-
return
|
|
1315
|
-
throw new Error(
|
|
1512
|
+
const s = await this.submitForm(e, i);
|
|
1513
|
+
if (s.status === 200)
|
|
1514
|
+
return s.data;
|
|
1515
|
+
throw new Error(s.message || "提交失败");
|
|
1316
1516
|
} finally {
|
|
1317
1517
|
this.data.submitting = !1;
|
|
1318
1518
|
}
|
|
@@ -1336,17 +1536,17 @@ let Lt = class {
|
|
|
1336
1536
|
flattenToNested(t) {
|
|
1337
1537
|
const e = {};
|
|
1338
1538
|
for (const i in t) {
|
|
1339
|
-
const
|
|
1539
|
+
const s = t[i];
|
|
1340
1540
|
if (i.includes(".")) {
|
|
1341
1541
|
const d = i.split(".");
|
|
1342
|
-
let
|
|
1542
|
+
let r = e;
|
|
1343
1543
|
for (let c = 0; c < d.length - 1; c++) {
|
|
1344
1544
|
const a = d[c];
|
|
1345
|
-
|
|
1545
|
+
r[a] || (r[a] = {}), r = r[a];
|
|
1346
1546
|
}
|
|
1347
|
-
|
|
1547
|
+
r[d[d.length - 1]] = s;
|
|
1348
1548
|
} else
|
|
1349
|
-
e[i] =
|
|
1549
|
+
e[i] = s;
|
|
1350
1550
|
}
|
|
1351
1551
|
return e;
|
|
1352
1552
|
}
|
|
@@ -1354,27 +1554,27 @@ let Lt = class {
|
|
|
1354
1554
|
// 注意:只展平 YAML 中配置的点号分隔字段(如 info.address),不展平已经是对象的字段(如 dateRange: { from, to })
|
|
1355
1555
|
nestedToFlat(t, e = "") {
|
|
1356
1556
|
const i = {};
|
|
1357
|
-
for (const
|
|
1358
|
-
const d = t[
|
|
1359
|
-
d && typeof d == "object" && !Array.isArray(d) ? Object.keys(d).length === 2 && "from" in d && "to" in d ? i[
|
|
1557
|
+
for (const s in t) {
|
|
1558
|
+
const d = t[s], r = e ? `${e}.${s}` : s;
|
|
1559
|
+
d && typeof d == "object" && !Array.isArray(d) ? Object.keys(d).length === 2 && "from" in d && "to" in d ? i[r] = d : Object.assign(i, this.nestedToFlat(d, r)) : i[r] = d;
|
|
1360
1560
|
}
|
|
1361
1561
|
return i;
|
|
1362
1562
|
}
|
|
1363
1563
|
};
|
|
1364
|
-
const
|
|
1564
|
+
const Gt = /* @__PURE__ */ V({
|
|
1365
1565
|
__name: "FormRender",
|
|
1366
1566
|
setup(o, { expose: t }) {
|
|
1367
|
-
const e = new
|
|
1567
|
+
const e = new Qt(), i = Q(null), s = z({
|
|
1368
1568
|
currentQuery: {},
|
|
1369
1569
|
submitResolve: null
|
|
1370
|
-
}), d =
|
|
1570
|
+
}), d = b(() => {
|
|
1371
1571
|
var f;
|
|
1372
1572
|
const m = {};
|
|
1373
|
-
if (!e.data.isEditMode || !
|
|
1573
|
+
if (!e.data.isEditMode || !s.currentQuery) return m;
|
|
1374
1574
|
for (const p of ((f = e.data.formConfig) == null ? void 0 : f.fields) || [])
|
|
1375
|
-
|
|
1575
|
+
s.currentQuery[p.field] !== void 0 && (m[p.field] = !0);
|
|
1376
1576
|
return m;
|
|
1377
|
-
}),
|
|
1577
|
+
}), r = b(() => {
|
|
1378
1578
|
var m;
|
|
1379
1579
|
return ((m = e.data.formConfig) == null ? void 0 : m.layout) || {
|
|
1380
1580
|
open: "dialog",
|
|
@@ -1382,36 +1582,36 @@ const Nt = /* @__PURE__ */ P({
|
|
|
1382
1582
|
labelPosition: "top",
|
|
1383
1583
|
buttonAlign: "right"
|
|
1384
1584
|
};
|
|
1385
|
-
}), c =
|
|
1585
|
+
}), c = b(() => {
|
|
1386
1586
|
var m;
|
|
1387
1587
|
return ((m = e.data.formConfig) == null ? void 0 : m.fields) || [];
|
|
1388
|
-
}), a =
|
|
1588
|
+
}), a = b(() => {
|
|
1389
1589
|
var m, f;
|
|
1390
1590
|
return ((f = (m = e.data.formConfig) == null ? void 0 : m.meta) == null ? void 0 : f.title) || "表单";
|
|
1391
|
-
}), l =
|
|
1591
|
+
}), l = b(() => r.value.buttonAlign || "right"), n = b(() => r.value.open === "normal"), u = {
|
|
1392
1592
|
async showForm(m, f) {
|
|
1393
|
-
|
|
1593
|
+
s.currentQuery = e.parseQuery(f || "");
|
|
1394
1594
|
try {
|
|
1395
1595
|
await e.openForm(m, f);
|
|
1396
1596
|
} catch (p) {
|
|
1397
1597
|
return U((p == null ? void 0 : p.message) || "打开表单失败"), null;
|
|
1398
1598
|
}
|
|
1399
1599
|
return new Promise((p) => {
|
|
1400
|
-
|
|
1600
|
+
s.submitResolve = p;
|
|
1401
1601
|
});
|
|
1402
1602
|
},
|
|
1403
1603
|
async handleSubmit() {
|
|
1404
1604
|
var m, f;
|
|
1405
1605
|
try {
|
|
1406
1606
|
const p = await e.doSubmit(), h = ((f = (m = e.data.formConfig) == null ? void 0 : m.meta) == null ? void 0 : f.title) + "保存成功";
|
|
1407
|
-
return N.success(h),
|
|
1607
|
+
return N.success(h), s.submitResolve && (s.submitResolve(p), s.submitResolve = null), n.value || e.closeForm(), p;
|
|
1408
1608
|
} catch (p) {
|
|
1409
|
-
return
|
|
1609
|
+
return s.submitResolve && (s.submitResolve(null), s.submitResolve = null), p != null && p.message && p.message !== "请完善表单信息" && U(p.message), null;
|
|
1410
1610
|
}
|
|
1411
1611
|
},
|
|
1412
1612
|
// 结束等待:把 submitResolve 以 null 收尾(取消/关闭时调用,避免 Promise 永远悬挂)
|
|
1413
1613
|
resolvePending() {
|
|
1414
|
-
|
|
1614
|
+
s.submitResolve && (s.submitResolve(null), s.submitResolve = null);
|
|
1415
1615
|
},
|
|
1416
1616
|
handleCancel() {
|
|
1417
1617
|
n.value || (u.resolvePending(), e.closeForm());
|
|
@@ -1432,11 +1632,11 @@ const Nt = /* @__PURE__ */ P({
|
|
|
1432
1632
|
return t({
|
|
1433
1633
|
showForm: u.showForm
|
|
1434
1634
|
}), (m, f) => {
|
|
1435
|
-
const p =
|
|
1436
|
-
return g(), S(
|
|
1635
|
+
const p = Ge, h = X;
|
|
1636
|
+
return g(), S(Nt, {
|
|
1437
1637
|
visible: W(e).data.visible,
|
|
1438
1638
|
"onUpdate:visible": f[0] || (f[0] = (y) => W(e).data.visible = y),
|
|
1439
|
-
layout:
|
|
1639
|
+
layout: r.value,
|
|
1440
1640
|
title: a.value,
|
|
1441
1641
|
loading: W(e).data.loading,
|
|
1442
1642
|
onClose: u.handleClose,
|
|
@@ -1444,7 +1644,7 @@ const Nt = /* @__PURE__ */ P({
|
|
|
1444
1644
|
}, {
|
|
1445
1645
|
actions: w(() => [
|
|
1446
1646
|
x("div", {
|
|
1447
|
-
class:
|
|
1647
|
+
class: P(["form-actions", l.value === "right" ? "justify-end" : "justify-start"])
|
|
1448
1648
|
}, [
|
|
1449
1649
|
_(h, {
|
|
1450
1650
|
onClick: u.handleCancel
|
|
@@ -1474,16 +1674,16 @@ const Nt = /* @__PURE__ */ P({
|
|
|
1474
1674
|
"label-position": "top"
|
|
1475
1675
|
}, {
|
|
1476
1676
|
default: w(() => [
|
|
1477
|
-
_(
|
|
1677
|
+
_(zt, {
|
|
1478
1678
|
fields: c.value,
|
|
1479
|
-
layout:
|
|
1679
|
+
layout: r.value
|
|
1480
1680
|
}, {
|
|
1481
1681
|
default: w(({ field: y }) => [
|
|
1482
|
-
_(
|
|
1682
|
+
_(jt, {
|
|
1483
1683
|
modelValue: W(e).data.formData[y.field],
|
|
1484
1684
|
"onUpdate:modelValue": (A) => W(e).data.formData[y.field] = A,
|
|
1485
1685
|
field: y,
|
|
1486
|
-
layout:
|
|
1686
|
+
layout: r.value,
|
|
1487
1687
|
disabled: d.value[y.field],
|
|
1488
1688
|
error: u.getFieldError(y.field)
|
|
1489
1689
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "field", "layout", "disabled", "error"])
|
|
@@ -1498,8 +1698,8 @@ const Nt = /* @__PURE__ */ P({
|
|
|
1498
1698
|
}, 8, ["visible", "layout", "title", "loading", "onClose", "onClosed"]);
|
|
1499
1699
|
};
|
|
1500
1700
|
}
|
|
1501
|
-
}), Ee = /* @__PURE__ */ $(
|
|
1502
|
-
class
|
|
1701
|
+
}), Ee = /* @__PURE__ */ $(Gt, [["__scopeId", "data-v-b3267c00"]]);
|
|
1702
|
+
class Kt {
|
|
1503
1703
|
constructor(t) {
|
|
1504
1704
|
this.config = t;
|
|
1505
1705
|
}
|
|
@@ -1511,15 +1711,15 @@ class Wt {
|
|
|
1511
1711
|
page: e.page,
|
|
1512
1712
|
pageSize: e.pageSize,
|
|
1513
1713
|
...t
|
|
1514
|
-
},
|
|
1714
|
+
}, s = {};
|
|
1515
1715
|
for (const a in i) {
|
|
1516
1716
|
const l = i[a];
|
|
1517
|
-
l !== "" && l !== null && l !== void 0 && (
|
|
1717
|
+
l !== "" && l !== null && l !== void 0 && (s[a] = l);
|
|
1518
1718
|
}
|
|
1519
1719
|
const d = new URLSearchParams();
|
|
1520
|
-
for (const a in
|
|
1521
|
-
d.append(a, String(
|
|
1522
|
-
const
|
|
1720
|
+
for (const a in s)
|
|
1721
|
+
d.append(a, String(s[a]));
|
|
1722
|
+
const r = `${this.config.api.list}${d.toString() ? "?" + d.toString() : ""}`, c = await M().Get(r);
|
|
1523
1723
|
if (c.status === 200) {
|
|
1524
1724
|
const a = c.data;
|
|
1525
1725
|
return Array.isArray(a) ? { rows: a, total: a.length } : a || { rows: [], total: 0 };
|
|
@@ -1532,7 +1732,7 @@ class Wt {
|
|
|
1532
1732
|
async deleteRow(t) {
|
|
1533
1733
|
if (!this.config.api.delete)
|
|
1534
1734
|
throw new Error("未配置删除API");
|
|
1535
|
-
const e = this.config.key || "id", i = t[e],
|
|
1735
|
+
const e = this.config.key || "id", i = t[e], s = `${this.config.api.delete}?${encodeURIComponent(e)}=${encodeURIComponent(String(i ?? ""))}`, d = await M().Post(s);
|
|
1536
1736
|
if (d.status !== 200)
|
|
1537
1737
|
throw new Error(d.message || "删除失败");
|
|
1538
1738
|
}
|
|
@@ -1542,7 +1742,7 @@ class Wt {
|
|
|
1542
1742
|
async batchDelete(t) {
|
|
1543
1743
|
if (!this.config.api.delete)
|
|
1544
1744
|
throw new Error("未配置删除API");
|
|
1545
|
-
const e = await
|
|
1745
|
+
const e = await M().Post(this.config.api.delete, t);
|
|
1546
1746
|
if (e.status !== 200)
|
|
1547
1747
|
throw new Error(e.message || "批量删除失败");
|
|
1548
1748
|
}
|
|
@@ -1552,10 +1752,8 @@ class Wt {
|
|
|
1552
1752
|
async exportData(t) {
|
|
1553
1753
|
if (!this.config.api.export)
|
|
1554
1754
|
throw new Error("未配置导出API");
|
|
1555
|
-
const i = (await
|
|
1556
|
-
|
|
1557
|
-
})).data, r = window.URL.createObjectURL(i), d = document.createElement("a");
|
|
1558
|
-
d.href = r, d.download = `export_${Date.now()}.xlsx`, d.click(), window.URL.revokeObjectURL(r);
|
|
1755
|
+
const i = (await M().PostDownload(this.config.api.export, t)).data, s = window.URL.createObjectURL(i), d = document.createElement("a");
|
|
1756
|
+
d.href = s, d.download = `export_${Date.now()}.xlsx`, d.click(), window.URL.revokeObjectURL(s);
|
|
1559
1757
|
}
|
|
1560
1758
|
/**
|
|
1561
1759
|
* 下载导入模板
|
|
@@ -1563,10 +1761,8 @@ class Wt {
|
|
|
1563
1761
|
async downloadTemplate() {
|
|
1564
1762
|
if (!this.config.api.import)
|
|
1565
1763
|
throw new Error("未配置导入API");
|
|
1566
|
-
const e = (await
|
|
1567
|
-
|
|
1568
|
-
})).data, i = window.URL.createObjectURL(e), r = document.createElement("a");
|
|
1569
|
-
r.href = i, r.download = `template_${Date.now()}.xlsx`, r.click(), window.URL.revokeObjectURL(i);
|
|
1764
|
+
const e = (await M().Download(`${this.config.api.import}/template`)).data, i = window.URL.createObjectURL(e), s = document.createElement("a");
|
|
1765
|
+
s.href = i, s.download = `template_${Date.now()}.xlsx`, s.click(), window.URL.revokeObjectURL(i);
|
|
1570
1766
|
}
|
|
1571
1767
|
/**
|
|
1572
1768
|
* 导入数据
|
|
@@ -1576,17 +1772,13 @@ class Wt {
|
|
|
1576
1772
|
throw new Error("未配置导入API");
|
|
1577
1773
|
const e = new FormData();
|
|
1578
1774
|
e.append("file", t);
|
|
1579
|
-
const i = await
|
|
1580
|
-
headers: {
|
|
1581
|
-
"Content-Type": "multipart/form-data"
|
|
1582
|
-
}
|
|
1583
|
-
});
|
|
1775
|
+
const i = await M().Post(this.config.api.import, e);
|
|
1584
1776
|
if (i.status !== 200)
|
|
1585
1777
|
throw new Error(i.message || "导入失败");
|
|
1586
1778
|
return i.data;
|
|
1587
1779
|
}
|
|
1588
1780
|
}
|
|
1589
|
-
class
|
|
1781
|
+
class Ht {
|
|
1590
1782
|
constructor() {
|
|
1591
1783
|
C(this, "tableConfig", null);
|
|
1592
1784
|
C(this, "rows", []);
|
|
@@ -1609,10 +1801,10 @@ class zt {
|
|
|
1609
1801
|
C(this, "previewRow", null);
|
|
1610
1802
|
}
|
|
1611
1803
|
}
|
|
1612
|
-
let
|
|
1804
|
+
let Jt = class {
|
|
1613
1805
|
constructor() {
|
|
1614
1806
|
// 响应式数据
|
|
1615
|
-
C(this, "data", z(new
|
|
1807
|
+
C(this, "data", z(new Ht()));
|
|
1616
1808
|
// 数据服务
|
|
1617
1809
|
C(this, "dataService", null);
|
|
1618
1810
|
}
|
|
@@ -1620,16 +1812,16 @@ let qt = class {
|
|
|
1620
1812
|
* 加载表格配置
|
|
1621
1813
|
*/
|
|
1622
1814
|
async loadConfig(t) {
|
|
1623
|
-
var
|
|
1624
|
-
const e =
|
|
1815
|
+
var s;
|
|
1816
|
+
const e = G.formCfgApi(t, "tables");
|
|
1625
1817
|
console.log("load config url =", e);
|
|
1626
|
-
const i = await
|
|
1818
|
+
const i = await M().Get(e);
|
|
1627
1819
|
if (console.log("---"), i.status !== 200)
|
|
1628
1820
|
throw new Error(i.message || "获取表格配置失败");
|
|
1629
|
-
this.data.tableConfig = i.data, this.dataService = new
|
|
1821
|
+
this.data.tableConfig = i.data, this.dataService = new Kt(i.data), this.data.currentRow = null, this.data.detailVisible = !1, this.data.detailData = null, this.data.previewVisible = !1, this.data.previewMounted = !1, this.data.previewRow = null, typeof console < "u" && console.log("[TableRender] loadConfig:", {
|
|
1630
1822
|
tableId: t,
|
|
1631
1823
|
hasDetail: this.hasDetail(),
|
|
1632
|
-
detail: (
|
|
1824
|
+
detail: (s = this.data.tableConfig) == null ? void 0 : s.detail
|
|
1633
1825
|
}), this.initSearchParams();
|
|
1634
1826
|
}
|
|
1635
1827
|
/**
|
|
@@ -1638,8 +1830,8 @@ let qt = class {
|
|
|
1638
1830
|
initSearchParams() {
|
|
1639
1831
|
var i;
|
|
1640
1832
|
const t = {}, e = ((i = this.data.tableConfig) == null ? void 0 : i.search) || [];
|
|
1641
|
-
for (const
|
|
1642
|
-
t[
|
|
1833
|
+
for (const s of e)
|
|
1834
|
+
t[s.field] = "";
|
|
1643
1835
|
this.data.searchParams = t;
|
|
1644
1836
|
}
|
|
1645
1837
|
/**
|
|
@@ -1666,8 +1858,8 @@ let qt = class {
|
|
|
1666
1858
|
syncRowRefs() {
|
|
1667
1859
|
const { currentRow: t, detailData: e } = this.data;
|
|
1668
1860
|
if (!t && !e) return;
|
|
1669
|
-
const i = this.getKeyField(),
|
|
1670
|
-
this.data.currentRow =
|
|
1861
|
+
const i = this.getKeyField(), s = (d) => d && this.data.rows.find((r) => r[i] === d[i]) || null;
|
|
1862
|
+
this.data.currentRow = s(t), this.data.detailData && (this.data.detailData = s(this.data.detailData), this.data.detailData || (this.data.detailVisible = !1));
|
|
1671
1863
|
}
|
|
1672
1864
|
/**
|
|
1673
1865
|
* 搜索
|
|
@@ -1949,7 +2141,7 @@ let qt = class {
|
|
|
1949
2141
|
return ((t = this.data.tableConfig) == null ? void 0 : t.pagination) || "page";
|
|
1950
2142
|
}
|
|
1951
2143
|
};
|
|
1952
|
-
const
|
|
2144
|
+
const Xt = { class: "table-search" }, Zt = { class: "search-fields" }, ea = { class: "search-actions" }, ta = /* @__PURE__ */ V({
|
|
1953
2145
|
__name: "TableSearch",
|
|
1954
2146
|
props: {
|
|
1955
2147
|
fields: {},
|
|
@@ -1957,46 +2149,46 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
1957
2149
|
},
|
|
1958
2150
|
emits: ["update:modelValue", "search", "reset"],
|
|
1959
2151
|
setup(o, { emit: t }) {
|
|
1960
|
-
const e = o, i = t,
|
|
2152
|
+
const e = o, i = t, s = {
|
|
1961
2153
|
input: te,
|
|
1962
2154
|
dict: ee,
|
|
1963
2155
|
dept: ee,
|
|
1964
2156
|
role: ee,
|
|
1965
|
-
date:
|
|
1966
|
-
daterange:
|
|
2157
|
+
date: re,
|
|
2158
|
+
daterange: re
|
|
1967
2159
|
}, d = {
|
|
1968
2160
|
// 组件映射
|
|
1969
|
-
getComponent(
|
|
1970
|
-
return r
|
|
2161
|
+
getComponent(r) {
|
|
2162
|
+
return s[r] || te;
|
|
1971
2163
|
},
|
|
1972
2164
|
// 更新搜索值
|
|
1973
|
-
updateValue(
|
|
1974
|
-
const a = { ...e.modelValue, [
|
|
2165
|
+
updateValue(r, c) {
|
|
2166
|
+
const a = { ...e.modelValue, [r]: c };
|
|
1975
2167
|
i("update:modelValue", a);
|
|
1976
2168
|
},
|
|
1977
2169
|
// 搜索(查询字段值自动去除首尾空格)
|
|
1978
2170
|
handleSearch() {
|
|
1979
|
-
const
|
|
2171
|
+
const r = {};
|
|
1980
2172
|
for (const c in e.modelValue) {
|
|
1981
2173
|
const a = e.modelValue[c];
|
|
1982
|
-
|
|
2174
|
+
r[c] = typeof a == "string" ? a.trim() : a;
|
|
1983
2175
|
}
|
|
1984
|
-
i("update:modelValue",
|
|
2176
|
+
i("update:modelValue", r), i("search");
|
|
1985
2177
|
},
|
|
1986
2178
|
// 重置
|
|
1987
2179
|
handleReset() {
|
|
1988
2180
|
i("reset");
|
|
1989
2181
|
}
|
|
1990
2182
|
};
|
|
1991
|
-
return (
|
|
1992
|
-
const a =
|
|
1993
|
-
return g(),
|
|
1994
|
-
x("div",
|
|
1995
|
-
(g(!0),
|
|
2183
|
+
return (r, c) => {
|
|
2184
|
+
const a = X;
|
|
2185
|
+
return g(), v("div", Xt, [
|
|
2186
|
+
x("div", Zt, [
|
|
2187
|
+
(g(!0), v(I, null, E(e.fields, (l) => (g(), v("div", {
|
|
1996
2188
|
key: l.field,
|
|
1997
2189
|
class: "search-field"
|
|
1998
2190
|
}, [
|
|
1999
|
-
(g(), S(
|
|
2191
|
+
(g(), S(J(d.getComponent(l.type)), {
|
|
2000
2192
|
"model-value": e.modelValue[l.field],
|
|
2001
2193
|
"field-label": l.label,
|
|
2002
2194
|
"dict-type": l.dictType,
|
|
@@ -2005,12 +2197,12 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2005
2197
|
"onUpdate:modelValue": (n) => d.updateValue(l.field, n)
|
|
2006
2198
|
}, null, 8, ["model-value", "field-label", "dict-type", "mode", "onUpdate:modelValue"]))
|
|
2007
2199
|
]))), 128)),
|
|
2008
|
-
k(
|
|
2200
|
+
k(r.$slots, "search-extra", {
|
|
2009
2201
|
params: e.modelValue,
|
|
2010
2202
|
update: d.updateValue
|
|
2011
2203
|
}, void 0, !0)
|
|
2012
2204
|
]),
|
|
2013
|
-
x("div",
|
|
2205
|
+
x("div", ea, [
|
|
2014
2206
|
_(a, {
|
|
2015
2207
|
type: "primary",
|
|
2016
2208
|
onClick: d.handleSearch
|
|
@@ -2028,7 +2220,7 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2028
2220
|
])]),
|
|
2029
2221
|
_: 1
|
|
2030
2222
|
}, 8, ["onClick"]),
|
|
2031
|
-
k(
|
|
2223
|
+
k(r.$slots, "search-actions", {
|
|
2032
2224
|
params: e.modelValue,
|
|
2033
2225
|
search: d.handleSearch,
|
|
2034
2226
|
reset: d.handleReset
|
|
@@ -2037,7 +2229,7 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2037
2229
|
]);
|
|
2038
2230
|
};
|
|
2039
2231
|
}
|
|
2040
|
-
}),
|
|
2232
|
+
}), aa = /* @__PURE__ */ $(ta, [["__scopeId", "data-v-0281d2ce"]]), oa = { class: "table-toolbar" }, la = { class: "toolbar-items" }, na = { key: 1 }, ia = /* @__PURE__ */ V({
|
|
2041
2233
|
__name: "TableToolbar",
|
|
2042
2234
|
props: {
|
|
2043
2235
|
items: {},
|
|
@@ -2045,13 +2237,13 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2045
2237
|
},
|
|
2046
2238
|
emits: ["action"],
|
|
2047
2239
|
setup(o, { emit: t }) {
|
|
2048
|
-
const e = o, i = t,
|
|
2240
|
+
const e = o, i = t, s = z({
|
|
2049
2241
|
// 图标组件缓存(@element-plus/icons-vue 按需加载)
|
|
2050
2242
|
iconMap: {}
|
|
2051
|
-
}), d =
|
|
2243
|
+
}), d = b(() => ({
|
|
2052
2244
|
// 是否有当前行
|
|
2053
2245
|
hasCurrentRow: !!e.currentRow
|
|
2054
|
-
})),
|
|
2246
|
+
})), r = {
|
|
2055
2247
|
// 需要目标行的动作
|
|
2056
2248
|
needRow(c) {
|
|
2057
2249
|
return c === "edit" || c === "delete" || c === "preview";
|
|
@@ -2078,11 +2270,11 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2078
2270
|
},
|
|
2079
2271
|
// 是否禁用
|
|
2080
2272
|
isDisabled(c) {
|
|
2081
|
-
return c.disabled ? !0 :
|
|
2273
|
+
return c.disabled ? !0 : r.needRow(c.action) && !d.value.hasCurrentRow;
|
|
2082
2274
|
},
|
|
2083
2275
|
// 图标组件
|
|
2084
2276
|
getIcon(c) {
|
|
2085
|
-
return c.icon ?
|
|
2277
|
+
return c.icon ? s.iconMap[c.icon] : null;
|
|
2086
2278
|
},
|
|
2087
2279
|
// 点击按钮:把 action 抛给父组件
|
|
2088
2280
|
handleClick(c) {
|
|
@@ -2092,41 +2284,41 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2092
2284
|
row: e.currentRow
|
|
2093
2285
|
});
|
|
2094
2286
|
},
|
|
2095
|
-
//
|
|
2287
|
+
// 从静态引入的图标包中挑出用到的图标(静态引入见文件顶部注释)
|
|
2096
2288
|
async ensureIcons() {
|
|
2097
2289
|
const c = [...new Set(e.items.map((n) => n.icon).filter(Boolean))];
|
|
2098
2290
|
if (c.length === 0) return;
|
|
2099
|
-
const a =
|
|
2291
|
+
const a = $e, l = { ...s.iconMap };
|
|
2100
2292
|
for (const n of c)
|
|
2101
|
-
a[n] && (l[n] =
|
|
2102
|
-
|
|
2293
|
+
a[n] && (l[n] = se(a[n]));
|
|
2294
|
+
s.iconMap = se(l);
|
|
2103
2295
|
}
|
|
2104
2296
|
};
|
|
2105
2297
|
return oe(() => {
|
|
2106
|
-
|
|
2298
|
+
r.ensureIcons();
|
|
2107
2299
|
}), L(() => e.items, () => {
|
|
2108
|
-
|
|
2300
|
+
r.ensureIcons();
|
|
2109
2301
|
}), (c, a) => {
|
|
2110
|
-
const l = ye, n =
|
|
2111
|
-
return g(),
|
|
2302
|
+
const l = ye, n = X;
|
|
2303
|
+
return g(), v("div", oa, [
|
|
2112
2304
|
k(c.$slots, "toolbar-left", {
|
|
2113
2305
|
currentRow: e.currentRow
|
|
2114
2306
|
}, void 0, !0),
|
|
2115
|
-
x("div",
|
|
2116
|
-
(g(!0),
|
|
2307
|
+
x("div", la, [
|
|
2308
|
+
(g(!0), v(I, null, E(e.items, (u, m) => (g(), S(n, {
|
|
2117
2309
|
key: m,
|
|
2118
|
-
type:
|
|
2119
|
-
disabled:
|
|
2120
|
-
onClick: (f) =>
|
|
2310
|
+
type: r.getButtonType(u),
|
|
2311
|
+
disabled: r.isDisabled(u),
|
|
2312
|
+
onClick: (f) => r.handleClick(u)
|
|
2121
2313
|
}, {
|
|
2122
2314
|
default: w(() => [
|
|
2123
|
-
|
|
2315
|
+
r.getIcon(u) ? (g(), S(l, { key: 0 }, {
|
|
2124
2316
|
default: w(() => [
|
|
2125
|
-
(g(), S(
|
|
2317
|
+
(g(), S(J(r.getIcon(u))))
|
|
2126
2318
|
]),
|
|
2127
2319
|
_: 2
|
|
2128
2320
|
}, 1024)) : D("", !0),
|
|
2129
|
-
|
|
2321
|
+
r.getText(u) ? (g(), v("span", na, T(r.getText(u)), 1)) : D("", !0)
|
|
2130
2322
|
]),
|
|
2131
2323
|
_: 2
|
|
2132
2324
|
}, 1032, ["type", "disabled", "onClick"]))), 128))
|
|
@@ -2137,7 +2329,7 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2137
2329
|
]);
|
|
2138
2330
|
};
|
|
2139
2331
|
}
|
|
2140
|
-
}),
|
|
2332
|
+
}), sa = /* @__PURE__ */ $(ia, [["__scopeId", "data-v-2a87e101"]]), ra = /* @__PURE__ */ V({
|
|
2141
2333
|
__name: "UInputShow",
|
|
2142
2334
|
props: {
|
|
2143
2335
|
modelValue: {},
|
|
@@ -2145,20 +2337,20 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2145
2337
|
maxLines: { default: 0 }
|
|
2146
2338
|
},
|
|
2147
2339
|
setup(o) {
|
|
2148
|
-
const t = o, e =
|
|
2149
|
-
`)),
|
|
2340
|
+
const t = o, e = b(() => t.modelValue === null || t.modelValue === void 0 ? "" : String(t.modelValue)), i = b(() => t.multiline || e.value.includes(`
|
|
2341
|
+
`)), s = b(() => t.maxLines > 0 && i.value ? {
|
|
2150
2342
|
display: "-webkit-box",
|
|
2151
2343
|
WebkitLineClamp: t.maxLines,
|
|
2152
2344
|
WebkitBoxOrient: "vertical",
|
|
2153
2345
|
overflow: "hidden",
|
|
2154
2346
|
textOverflow: "ellipsis"
|
|
2155
2347
|
} : {});
|
|
2156
|
-
return (d,
|
|
2157
|
-
class:
|
|
2158
|
-
style: B(
|
|
2348
|
+
return (d, r) => (g(), v("div", {
|
|
2349
|
+
class: P(["u-input-show", { "u-input-multiline": i.value }]),
|
|
2350
|
+
style: B(s.value)
|
|
2159
2351
|
}, T(e.value), 7));
|
|
2160
2352
|
}
|
|
2161
|
-
}),
|
|
2353
|
+
}), da = /* @__PURE__ */ $(ra, [["__scopeId", "data-v-c78b151e"]]), ca = /* @__PURE__ */ V({
|
|
2162
2354
|
__name: "UDictShow",
|
|
2163
2355
|
props: {
|
|
2164
2356
|
modelValue: {},
|
|
@@ -2166,7 +2358,7 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2166
2358
|
defaultText: { default: "" }
|
|
2167
2359
|
},
|
|
2168
2360
|
setup(o) {
|
|
2169
|
-
const t = o, e = Q(""), i = Q(!1),
|
|
2361
|
+
const t = o, e = Q(""), i = Q(!1), s = async () => {
|
|
2170
2362
|
if (t.modelValue === null || t.modelValue === void 0 || t.modelValue === "") {
|
|
2171
2363
|
e.value = t.defaultText;
|
|
2172
2364
|
return;
|
|
@@ -2177,7 +2369,7 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2177
2369
|
}
|
|
2178
2370
|
i.value = !0;
|
|
2179
2371
|
try {
|
|
2180
|
-
const d = await
|
|
2372
|
+
const d = await pt(t.dictType, t.modelValue, t.defaultText);
|
|
2181
2373
|
e.value = d;
|
|
2182
2374
|
} catch (d) {
|
|
2183
2375
|
console.error("[UDictShow] 翻译失败:", d), e.value = String(t.modelValue);
|
|
@@ -2185,15 +2377,15 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2185
2377
|
i.value = !1;
|
|
2186
2378
|
}
|
|
2187
2379
|
};
|
|
2188
|
-
return L(() => t.modelValue,
|
|
2189
|
-
t.dictType && ae(t.dictType).then(() =>
|
|
2380
|
+
return L(() => t.modelValue, s, { immediate: !0 }), L(() => t.dictType, () => {
|
|
2381
|
+
t.dictType && ae(t.dictType).then(() => s());
|
|
2190
2382
|
}), oe(() => {
|
|
2191
|
-
t.dictType ? ae(t.dictType).then(() =>
|
|
2192
|
-
}), (d,
|
|
2193
|
-
class:
|
|
2383
|
+
t.dictType ? ae(t.dictType).then(() => s()) : s();
|
|
2384
|
+
}), (d, r) => (g(), v("div", {
|
|
2385
|
+
class: P(["u-dict-show", { "u-dict-loading": i.value }])
|
|
2194
2386
|
}, T(e.value), 3));
|
|
2195
2387
|
}
|
|
2196
|
-
}),
|
|
2388
|
+
}), ua = /* @__PURE__ */ $(ca, [["__scopeId", "data-v-908045c4"]]), fa = /* @__PURE__ */ V({
|
|
2197
2389
|
__name: "UToggleShow",
|
|
2198
2390
|
props: {
|
|
2199
2391
|
modelValue: {},
|
|
@@ -2202,12 +2394,12 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2202
2394
|
useYesNo: { type: Boolean, default: !1 }
|
|
2203
2395
|
},
|
|
2204
2396
|
setup(o) {
|
|
2205
|
-
const t = o, e =
|
|
2206
|
-
return (
|
|
2207
|
-
class:
|
|
2208
|
-
}, T(
|
|
2397
|
+
const t = o, e = b(() => t.useYesNo ? "是" : t.trueText), i = b(() => t.useYesNo ? "否" : t.falseText), s = b(() => t.modelValue === !0 || t.modelValue === "true" ? e.value : t.modelValue === !1 || t.modelValue === "false" ? i.value : String(t.modelValue ?? "")), d = b(() => t.modelValue === !0 || t.modelValue === "true" ? "toggle-true" : t.modelValue === !1 || t.modelValue === "false" ? "toggle-false" : "toggle-default");
|
|
2398
|
+
return (r, c) => (g(), v("div", {
|
|
2399
|
+
class: P(["u-toggle-show", d.value])
|
|
2400
|
+
}, T(s.value), 3));
|
|
2209
2401
|
}
|
|
2210
|
-
}),
|
|
2402
|
+
}), ma = /* @__PURE__ */ $(fa, [["__scopeId", "data-v-bac05efc"]]), pa = /* @__PURE__ */ V({
|
|
2211
2403
|
__name: "UCascaderShow",
|
|
2212
2404
|
props: {
|
|
2213
2405
|
modelValue: {},
|
|
@@ -2216,7 +2408,7 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2216
2408
|
showRawValue: { type: Boolean, default: !0 }
|
|
2217
2409
|
},
|
|
2218
2410
|
setup(o) {
|
|
2219
|
-
const t = o, e = Q(""), i = Q(!1),
|
|
2411
|
+
const t = o, e = Q(""), i = Q(!1), s = async () => {
|
|
2220
2412
|
if (!t.modelValue || !Array.isArray(t.modelValue)) {
|
|
2221
2413
|
e.value = "";
|
|
2222
2414
|
return;
|
|
@@ -2225,26 +2417,26 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2225
2417
|
if (t.cascaderKey) {
|
|
2226
2418
|
i.value = !0;
|
|
2227
2419
|
try {
|
|
2228
|
-
const
|
|
2229
|
-
const n =
|
|
2420
|
+
const r = await ae(t.cascaderKey), a = d.map((l) => {
|
|
2421
|
+
const n = r.find((u) => u.value === l || String(u.value) === String(l));
|
|
2230
2422
|
return n ? n.label : t.showRawValue ? String(l) : "";
|
|
2231
2423
|
}).filter((l) => l !== "");
|
|
2232
2424
|
e.value = a.join(t.separator);
|
|
2233
|
-
} catch (
|
|
2234
|
-
console.error("[UCascaderShow] 翻译失败:",
|
|
2425
|
+
} catch (r) {
|
|
2426
|
+
console.error("[UCascaderShow] 翻译失败:", r), e.value = t.showRawValue ? d.join(t.separator) : "";
|
|
2235
2427
|
} finally {
|
|
2236
2428
|
i.value = !1;
|
|
2237
2429
|
}
|
|
2238
2430
|
} else
|
|
2239
2431
|
e.value = d.join(t.separator);
|
|
2240
2432
|
};
|
|
2241
|
-
return L(() => t.modelValue,
|
|
2242
|
-
|
|
2243
|
-
}), (d,
|
|
2244
|
-
class:
|
|
2433
|
+
return L(() => t.modelValue, s, { immediate: !0 }), oe(() => {
|
|
2434
|
+
s();
|
|
2435
|
+
}), (d, r) => (g(), v("div", {
|
|
2436
|
+
class: P(["u-cascader-show", { "u-cascader-loading": i.value }])
|
|
2245
2437
|
}, T(e.value), 3));
|
|
2246
2438
|
}
|
|
2247
|
-
}),
|
|
2439
|
+
}), ha = /* @__PURE__ */ $(pa, [["__scopeId", "data-v-5d84df67"]]), ga = /* @__PURE__ */ V({
|
|
2248
2440
|
__name: "UDateShow",
|
|
2249
2441
|
props: {
|
|
2250
2442
|
modelValue: {},
|
|
@@ -2255,19 +2447,19 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2255
2447
|
rangeSeparator: { default: " ~ " }
|
|
2256
2448
|
},
|
|
2257
2449
|
setup(o) {
|
|
2258
|
-
const t = o, e =
|
|
2259
|
-
const
|
|
2260
|
-
return t.mode === "single" ?
|
|
2450
|
+
const t = o, e = b(() => t.locale === "en-US" ? t.mode === "range" ? " - " : ", " : t.mode === "range" ? t.rangeSeparator : t.separator), i = b(() => {
|
|
2451
|
+
const r = t.modelValue;
|
|
2452
|
+
return t.mode === "single" ? r ? s(r, t.format) : "" : t.mode === "multiple" ? r ? Array.isArray(r) ? r.map((c) => s(c, t.format)).join(e.value) : String(r) : "" : t.mode === "range" ? r ? typeof r == "object" && r.from && r.to ? `${s(r.from, t.format)}${e.value}${s(r.to, t.format)}` : Array.isArray(r) && r.length >= 2 ? `${s(r[0], t.format)}${e.value}${s(r[1], t.format)}` : String(r) : "" : String(r ?? "");
|
|
2261
2453
|
});
|
|
2262
|
-
function r
|
|
2263
|
-
return
|
|
2454
|
+
function s(r, c) {
|
|
2455
|
+
return r || "";
|
|
2264
2456
|
}
|
|
2265
|
-
const d =
|
|
2266
|
-
return (
|
|
2267
|
-
class:
|
|
2457
|
+
const d = b(() => !i.value);
|
|
2458
|
+
return (r, c) => (g(), v("div", {
|
|
2459
|
+
class: P(["u-date-show", { "u-date-empty": d.value }])
|
|
2268
2460
|
}, T(i.value || (o.locale === "en-US" ? "Empty" : "暂无")), 3));
|
|
2269
2461
|
}
|
|
2270
|
-
}),
|
|
2462
|
+
}), ya = /* @__PURE__ */ $(ga, [["__scopeId", "data-v-930657df"]]), va = /* @__PURE__ */ V({
|
|
2271
2463
|
__name: "UFieldView",
|
|
2272
2464
|
props: {
|
|
2273
2465
|
type: { default: "text" },
|
|
@@ -2285,20 +2477,20 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2285
2477
|
defaultText: { default: "" }
|
|
2286
2478
|
},
|
|
2287
2479
|
setup(o) {
|
|
2288
|
-
const t = o, e =
|
|
2480
|
+
const t = o, e = b(() => {
|
|
2289
2481
|
if (!t.text) return null;
|
|
2290
|
-
const
|
|
2291
|
-
return
|
|
2292
|
-
trueText:
|
|
2293
|
-
falseText:
|
|
2482
|
+
const r = t.text.split("/");
|
|
2483
|
+
return r.length >= 2 ? {
|
|
2484
|
+
trueText: r[0].trim(),
|
|
2485
|
+
falseText: r[1].trim()
|
|
2294
2486
|
} : null;
|
|
2295
|
-
}), i =
|
|
2296
|
-
var
|
|
2297
|
-
return t.trueText || ((
|
|
2298
|
-
}),
|
|
2299
|
-
var
|
|
2300
|
-
return t.falseText || ((
|
|
2301
|
-
}), d =
|
|
2487
|
+
}), i = b(() => {
|
|
2488
|
+
var r;
|
|
2489
|
+
return t.trueText || ((r = e.value) == null ? void 0 : r.trueText) || "开启";
|
|
2490
|
+
}), s = b(() => {
|
|
2491
|
+
var r;
|
|
2492
|
+
return t.falseText || ((r = e.value) == null ? void 0 : r.falseText) || "关闭";
|
|
2493
|
+
}), d = b(() => {
|
|
2302
2494
|
switch (t.type) {
|
|
2303
2495
|
case "dict":
|
|
2304
2496
|
return "UDictShow";
|
|
@@ -2314,7 +2506,7 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2314
2506
|
return "UInputShow";
|
|
2315
2507
|
}
|
|
2316
2508
|
});
|
|
2317
|
-
return (
|
|
2509
|
+
return (r, c) => (g(), S(J(d.value === "UDictShow" ? ua : d.value === "UToggleShow" ? ma : d.value === "UCascaderShow" ? ha : d.value === "UDateShow" ? ya : da), {
|
|
2318
2510
|
"model-value": o.modelValue,
|
|
2319
2511
|
"dict-type": o.type === "dict" ? o.dictType : void 0,
|
|
2320
2512
|
"cascader-key": o.type === "cascader" ? o.cascaderKey : void 0,
|
|
@@ -2322,13 +2514,13 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2322
2514
|
locale: o.type === "date" ? o.locale : void 0,
|
|
2323
2515
|
format: o.type === "date" ? o.format : void 0,
|
|
2324
2516
|
"true-text": o.type === "switch" ? i.value : void 0,
|
|
2325
|
-
"false-text": o.type === "switch" ?
|
|
2517
|
+
"false-text": o.type === "switch" ? s.value : void 0,
|
|
2326
2518
|
"use-yes-no": o.type === "switch" ? o.useYesNo : void 0,
|
|
2327
2519
|
multiline: o.type === "input" || o.type === "text" ? o.multiline : void 0,
|
|
2328
2520
|
"default-text": o.type === "dict" ? o.defaultText : void 0
|
|
2329
2521
|
}, null, 8, ["model-value", "dict-type", "cascader-key", "mode", "locale", "format", "true-text", "false-text", "use-yes-no", "multiline", "default-text"]));
|
|
2330
2522
|
}
|
|
2331
|
-
}), xe = /* @__PURE__ */ $(
|
|
2523
|
+
}), xe = /* @__PURE__ */ $(va, [["__scopeId", "data-v-05ef52d9"]]), ba = { class: "table-grid" }, ue = "col-", wa = 160, Ca = /* @__PURE__ */ V({
|
|
2332
2524
|
// 属性/事件手动透传给 el-table,不再自动落到根节点
|
|
2333
2525
|
inheritAttrs: !1,
|
|
2334
2526
|
__name: "TableGrid",
|
|
@@ -2345,11 +2537,11 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2345
2537
|
},
|
|
2346
2538
|
emits: ["rowAction", "rowClick", "selectionChange"],
|
|
2347
2539
|
setup(o, { emit: t }) {
|
|
2348
|
-
const e = o, i =
|
|
2540
|
+
const e = o, i = ve(), s = t;
|
|
2349
2541
|
function d(l) {
|
|
2350
2542
|
return l === "actions" || l === "actions-extra" || l.startsWith(ue);
|
|
2351
2543
|
}
|
|
2352
|
-
const
|
|
2544
|
+
const r = b(() => {
|
|
2353
2545
|
var l, n;
|
|
2354
2546
|
return {
|
|
2355
2547
|
// 行操作按钮
|
|
@@ -2358,7 +2550,7 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2358
2550
|
// 1) 显式配了 actionsWidth 就用它(插槽接管操作列时用得上,见文件头)
|
|
2359
2551
|
// 2) 否则按 yaml actions 的文字长度估算
|
|
2360
2552
|
// 3) yaml 没配 actions、只有插槽时给个兜底宽度,不然列会被挤成一条缝
|
|
2361
|
-
actionColumnWidth: e.actionsWidth ?? ((l = e.actions) != null && l.length ? a.getActionColumnWidth() :
|
|
2553
|
+
actionColumnWidth: e.actionsWidth ?? ((l = e.actions) != null && l.length ? a.getActionColumnWidth() : wa),
|
|
2362
2554
|
// 用户自己提供了 empty 插槽就用用户的,否则用内置空状态
|
|
2363
2555
|
hasUserEmpty: !!i.empty,
|
|
2364
2556
|
// 透传给 el-table 的插槽(default 由 <slot name="default"/> 单独渲染,列插槽自己消费)
|
|
@@ -2372,7 +2564,7 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2372
2564
|
// 操作列要不要出现:yaml 配了 actions、或使用方开了插槽
|
|
2373
2565
|
showActionColumn: (((n = e.actions) == null ? void 0 : n.length) || 0) > 0 || !!i.actions || !!i["actions-extra"]
|
|
2374
2566
|
};
|
|
2375
|
-
}), c =
|
|
2567
|
+
}), c = b(() => {
|
|
2376
2568
|
const l = e.columns.map((n) => {
|
|
2377
2569
|
const u = {
|
|
2378
2570
|
prop: n.field,
|
|
@@ -2380,10 +2572,10 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2380
2572
|
};
|
|
2381
2573
|
return typeof n.width == "number" && (u.width = n.width), u;
|
|
2382
2574
|
});
|
|
2383
|
-
return
|
|
2575
|
+
return r.value.showActionColumn && l.push({
|
|
2384
2576
|
prop: "actions",
|
|
2385
2577
|
label: "操作",
|
|
2386
|
-
width:
|
|
2578
|
+
width: r.value.actionColumnWidth,
|
|
2387
2579
|
fixed: "right"
|
|
2388
2580
|
}), l;
|
|
2389
2581
|
}), a = {
|
|
@@ -2393,7 +2585,7 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2393
2585
|
},
|
|
2394
2586
|
/** 该列是否被使用方的插槽接管 */
|
|
2395
2587
|
hasColSlot(l) {
|
|
2396
|
-
return
|
|
2588
|
+
return r.value.colSlots.includes(a.colSlotName(l));
|
|
2397
2589
|
},
|
|
2398
2590
|
// 行操作按钮文字
|
|
2399
2591
|
actionText(l) {
|
|
@@ -2475,15 +2667,15 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2475
2667
|
},
|
|
2476
2668
|
// 选择变化
|
|
2477
2669
|
onSelectionChange(l) {
|
|
2478
|
-
|
|
2670
|
+
s("selectionChange", l);
|
|
2479
2671
|
},
|
|
2480
2672
|
// 行点击
|
|
2481
2673
|
onRowClick(l) {
|
|
2482
|
-
|
|
2674
|
+
s("rowClick", l);
|
|
2483
2675
|
},
|
|
2484
2676
|
// 行操作按钮点击
|
|
2485
2677
|
onRowAction(l, n) {
|
|
2486
|
-
|
|
2678
|
+
s("rowAction", {
|
|
2487
2679
|
action: l.action,
|
|
2488
2680
|
item: l,
|
|
2489
2681
|
row: n
|
|
@@ -2491,23 +2683,23 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2491
2683
|
}
|
|
2492
2684
|
};
|
|
2493
2685
|
return (l, n) => {
|
|
2494
|
-
const u = He, m =
|
|
2495
|
-
return g(),
|
|
2496
|
-
_(f,
|
|
2686
|
+
const u = He, m = X, f = Ke;
|
|
2687
|
+
return g(), v("div", ba, [
|
|
2688
|
+
_(f, de({ stripe: !0, border: !0, ...l.$attrs }, {
|
|
2497
2689
|
data: e.rows.length ? e.rows : [{}],
|
|
2498
2690
|
loading: e.loading,
|
|
2499
2691
|
"row-key": e.keyField || "id",
|
|
2500
2692
|
"row-class-name": a.rowClassName,
|
|
2501
2693
|
onSelectionChange: a.onSelectionChange,
|
|
2502
2694
|
onRowClick: n[0] || (n[0] = (p) => a.onRowClick(p))
|
|
2503
|
-
}),
|
|
2695
|
+
}), Z({
|
|
2504
2696
|
default: w(() => [
|
|
2505
2697
|
e.selection ? (g(), S(u, {
|
|
2506
2698
|
key: 0,
|
|
2507
2699
|
type: "selection",
|
|
2508
2700
|
width: "55"
|
|
2509
2701
|
})) : D("", !0),
|
|
2510
|
-
(g(!0),
|
|
2702
|
+
(g(!0), v(I, null, E(c.value, (p) => (g(), S(u, {
|
|
2511
2703
|
key: p.prop,
|
|
2512
2704
|
prop: p.prop,
|
|
2513
2705
|
label: p.label,
|
|
@@ -2515,18 +2707,18 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2515
2707
|
fixed: p.fixed
|
|
2516
2708
|
}, {
|
|
2517
2709
|
default: w(({ row: h }) => [
|
|
2518
|
-
Object.keys(h).length > 0 ? (g(),
|
|
2519
|
-
p.prop === "actions" ? (g(),
|
|
2520
|
-
|
|
2710
|
+
Object.keys(h).length > 0 ? (g(), v(I, { key: 0 }, [
|
|
2711
|
+
p.prop === "actions" ? (g(), v(I, { key: 0 }, [
|
|
2712
|
+
r.value.hasActionsSlot ? k(l.$slots, "actions", {
|
|
2521
2713
|
row: h,
|
|
2522
|
-
actions:
|
|
2523
|
-
}, void 0, !0, 1) : (g(!0),
|
|
2714
|
+
actions: r.value.actionList
|
|
2715
|
+
}, void 0, !0, 1) : (g(!0), v(I, { key: 0 }, E(r.value.actionList, (y, A) => (g(), S(m, {
|
|
2524
2716
|
key: A,
|
|
2525
2717
|
link: "",
|
|
2526
2718
|
type: a.actionType(y),
|
|
2527
2719
|
disabled: y.disabled === !0,
|
|
2528
2720
|
size: "small",
|
|
2529
|
-
onClick:
|
|
2721
|
+
onClick: et((K) => a.onRowAction(y, h), ["stop"])
|
|
2530
2722
|
}, {
|
|
2531
2723
|
default: w(() => [
|
|
2532
2724
|
F(T(a.actionText(y)), 1)
|
|
@@ -2538,7 +2730,7 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2538
2730
|
row: h,
|
|
2539
2731
|
value: a.getNestedValue(h, p.prop),
|
|
2540
2732
|
column: p
|
|
2541
|
-
}, void 0, !0, 1) : (g(!0),
|
|
2733
|
+
}, void 0, !0, 1) : (g(!0), v(I, { key: 2 }, E(e.columns, (y) => (g(), v(I, {
|
|
2542
2734
|
key: y.field
|
|
2543
2735
|
}, [
|
|
2544
2736
|
y.field === p.prop && a.useFieldView(y) ? (g(), S(xe, {
|
|
@@ -2556,9 +2748,9 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2556
2748
|
"cascader-key": y.cascaderKey,
|
|
2557
2749
|
multiline: y.multiline,
|
|
2558
2750
|
"default-text": y.defaultText
|
|
2559
|
-
}, null, 8, ["type", "model-value", "dict-type", "mode", "locale", "format", "text", "true-text", "false-text", "use-yes-no", "cascader-key", "multiline", "default-text"])) : y.field === p.prop ? (g(),
|
|
2751
|
+
}, null, 8, ["type", "model-value", "dict-type", "mode", "locale", "format", "text", "true-text", "false-text", "use-yes-no", "cascader-key", "multiline", "default-text"])) : y.field === p.prop ? (g(), v("span", {
|
|
2560
2752
|
key: 1,
|
|
2561
|
-
class:
|
|
2753
|
+
class: P({ "table-grid-format": y.format })
|
|
2562
2754
|
}, T(a.formatByType(a.getNestedValue(h, y.field), y.format || "")), 3)) : D("", !0)
|
|
2563
2755
|
], 64))), 128))
|
|
2564
2756
|
], 64)) : D("", !0)
|
|
@@ -2569,13 +2761,13 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2569
2761
|
]),
|
|
2570
2762
|
_: 2
|
|
2571
2763
|
}, [
|
|
2572
|
-
|
|
2764
|
+
E(r.value.forwardSlots, (p) => ({
|
|
2573
2765
|
name: p,
|
|
2574
2766
|
fn: w((h) => [
|
|
2575
2767
|
k(l.$slots, p, q(O(h || {})), void 0, !0)
|
|
2576
2768
|
])
|
|
2577
2769
|
})),
|
|
2578
|
-
|
|
2770
|
+
r.value.hasUserEmpty ? void 0 : {
|
|
2579
2771
|
name: "empty",
|
|
2580
2772
|
fn: w(() => [
|
|
2581
2773
|
n[1] || (n[1] = x("div", { class: "no-data" }, "暂无数据", -1))
|
|
@@ -2586,13 +2778,13 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2586
2778
|
]);
|
|
2587
2779
|
};
|
|
2588
2780
|
}
|
|
2589
|
-
}),
|
|
2781
|
+
}), xa = /* @__PURE__ */ $(Ca, [["__scopeId", "data-v-d3eed11d"]]), _a = { class: "table-pagination" }, Sa = { class: "page-size-select" }, Da = { class: "total-text" }, ka = {
|
|
2590
2782
|
key: 1,
|
|
2591
2783
|
class: "load-more"
|
|
2592
|
-
},
|
|
2784
|
+
}, Ta = {
|
|
2593
2785
|
key: 2,
|
|
2594
2786
|
class: "total-text"
|
|
2595
|
-
},
|
|
2787
|
+
}, Pa = /* @__PURE__ */ V({
|
|
2596
2788
|
__name: "TablePagination",
|
|
2597
2789
|
props: {
|
|
2598
2790
|
page: {},
|
|
@@ -2602,35 +2794,35 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2602
2794
|
},
|
|
2603
2795
|
emits: ["update:page", "update:pageSize"],
|
|
2604
2796
|
setup(o, { emit: t }) {
|
|
2605
|
-
const e = o, i = t,
|
|
2797
|
+
const e = o, i = t, s = b(() => ({
|
|
2606
2798
|
// 总页数
|
|
2607
2799
|
totalPages: Math.ceil(e.total / e.pageSize),
|
|
2608
2800
|
// 是否显示分页
|
|
2609
2801
|
showPagination: e.type === "page" && e.total > 0
|
|
2610
2802
|
})), d = {
|
|
2611
2803
|
// 页码变化
|
|
2612
|
-
onPageChange: (
|
|
2613
|
-
i("update:page",
|
|
2804
|
+
onPageChange: (r) => {
|
|
2805
|
+
i("update:page", r);
|
|
2614
2806
|
},
|
|
2615
2807
|
// 每页条数变化
|
|
2616
|
-
onPageSizeChange: (
|
|
2617
|
-
i("update:pageSize",
|
|
2808
|
+
onPageSizeChange: (r) => {
|
|
2809
|
+
i("update:pageSize", r);
|
|
2618
2810
|
}
|
|
2619
2811
|
};
|
|
2620
|
-
return (
|
|
2621
|
-
const a =
|
|
2622
|
-
return g(),
|
|
2623
|
-
|
|
2812
|
+
return (r, c) => {
|
|
2813
|
+
const a = Je, l = ge, n = he, u = X;
|
|
2814
|
+
return g(), v("div", _a, [
|
|
2815
|
+
s.value.showPagination ? (g(), v(I, { key: 0 }, [
|
|
2624
2816
|
_(a, {
|
|
2625
2817
|
"current-page": e.page,
|
|
2626
|
-
"page-count":
|
|
2818
|
+
"page-count": s.value.totalPages,
|
|
2627
2819
|
"page-sizes": [10, 20, 50, 100],
|
|
2628
2820
|
"page-size": e.pageSize,
|
|
2629
2821
|
layout: "total, prev, pager, next, jumper",
|
|
2630
2822
|
onCurrentChange: d.onPageChange,
|
|
2631
2823
|
onSizeChange: d.onPageSizeChange
|
|
2632
2824
|
}, null, 8, ["current-page", "page-count", "page-size", "onCurrentChange", "onSizeChange"]),
|
|
2633
|
-
x("div",
|
|
2825
|
+
x("div", Sa, [
|
|
2634
2826
|
_(n, {
|
|
2635
2827
|
"model-value": e.pageSize,
|
|
2636
2828
|
style: { width: "100px" },
|
|
@@ -2656,9 +2848,9 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2656
2848
|
]),
|
|
2657
2849
|
_: 1
|
|
2658
2850
|
}, 8, ["model-value", "onChange"]),
|
|
2659
|
-
x("span",
|
|
2851
|
+
x("span", Da, "共 " + T(e.total) + " 条", 1)
|
|
2660
2852
|
])
|
|
2661
|
-
], 64)) : e.type === "auto" ? (g(),
|
|
2853
|
+
], 64)) : e.type === "auto" ? (g(), v("div", ka, [
|
|
2662
2854
|
_(u, {
|
|
2663
2855
|
disabled: e.page * e.pageSize >= e.total
|
|
2664
2856
|
}, {
|
|
@@ -2667,23 +2859,23 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2667
2859
|
])]),
|
|
2668
2860
|
_: 1
|
|
2669
2861
|
}, 8, ["disabled"])
|
|
2670
|
-
])) : e.type === "all" ? (g(),
|
|
2862
|
+
])) : e.type === "all" ? (g(), v("div", Ta, "共 " + T(e.total) + " 条", 1)) : D("", !0)
|
|
2671
2863
|
]);
|
|
2672
2864
|
};
|
|
2673
2865
|
}
|
|
2674
|
-
}),
|
|
2866
|
+
}), Va = /* @__PURE__ */ $(Pa, [["__scopeId", "data-v-2ca77d18"]]), $a = { class: "table-detail" }, Aa = {
|
|
2675
2867
|
key: 0,
|
|
2676
2868
|
class: "detail-header"
|
|
2677
|
-
},
|
|
2869
|
+
}, Ra = { class: "detail-title" }, Ia = { class: "detail-body" }, Ma = {
|
|
2678
2870
|
key: 0,
|
|
2679
2871
|
class: "detail-status"
|
|
2680
|
-
},
|
|
2872
|
+
}, Ea = {
|
|
2681
2873
|
key: 1,
|
|
2682
2874
|
class: "detail-content"
|
|
2683
|
-
},
|
|
2875
|
+
}, Ua = { class: "detail-label" }, Ba = { class: "detail-value" }, Fa = {
|
|
2684
2876
|
key: 2,
|
|
2685
2877
|
class: "detail-status"
|
|
2686
|
-
},
|
|
2878
|
+
}, La = /* @__PURE__ */ V({
|
|
2687
2879
|
__name: "TableDetail",
|
|
2688
2880
|
props: {
|
|
2689
2881
|
showHeader: { type: Boolean },
|
|
@@ -2695,7 +2887,7 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2695
2887
|
extraMode: {}
|
|
2696
2888
|
},
|
|
2697
2889
|
setup(o) {
|
|
2698
|
-
const t = o, e =
|
|
2890
|
+
const t = o, e = ve(), i = b(() => !!e["detail-extra"]), s = b(() => i.value), d = b(() => !i.value || t.extraMode === "append"), r = b(() => ({
|
|
2699
2891
|
// 标题栏
|
|
2700
2892
|
showHeader: t.showHeader !== !1,
|
|
2701
2893
|
// 面板标题
|
|
@@ -2720,19 +2912,19 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2720
2912
|
return u;
|
|
2721
2913
|
}
|
|
2722
2914
|
};
|
|
2723
|
-
return (a, l) => (g(),
|
|
2724
|
-
|
|
2725
|
-
x("div",
|
|
2915
|
+
return (a, l) => (g(), v("div", $a, [
|
|
2916
|
+
r.value.showHeader ? (g(), v("div", Aa, [
|
|
2917
|
+
x("div", Ra, T(r.value.title), 1)
|
|
2726
2918
|
])) : D("", !0),
|
|
2727
|
-
x("div",
|
|
2728
|
-
d.value ? (g(),
|
|
2729
|
-
t.loading ? (g(),
|
|
2730
|
-
(g(!0),
|
|
2919
|
+
x("div", Ia, [
|
|
2920
|
+
d.value ? (g(), v(I, { key: 0 }, [
|
|
2921
|
+
t.loading ? (g(), v("div", Ma, "加载中...")) : r.value.hasRow ? (g(), v("div", Ea, [
|
|
2922
|
+
(g(!0), v(I, null, E(t.columns, (n) => (g(), v("div", {
|
|
2731
2923
|
key: n.field,
|
|
2732
2924
|
class: "detail-item"
|
|
2733
2925
|
}, [
|
|
2734
|
-
x("div",
|
|
2735
|
-
x("div",
|
|
2926
|
+
x("div", Ua, T(n.label), 1),
|
|
2927
|
+
x("div", Ba, [
|
|
2736
2928
|
_(xe, {
|
|
2737
2929
|
type: n.type,
|
|
2738
2930
|
"model-value": c.getNestedValue(t.rowData, n.field),
|
|
@@ -2750,16 +2942,16 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2750
2942
|
}, null, 8, ["type", "model-value", "dict-type", "mode", "locale", "format", "text", "true-text", "false-text", "use-yes-no", "cascader-key", "multiline", "default-text"])
|
|
2751
2943
|
])
|
|
2752
2944
|
]))), 128))
|
|
2753
|
-
])) : (g(),
|
|
2945
|
+
])) : (g(), v("div", Fa, T(r.value.emptyText), 1))
|
|
2754
2946
|
], 64)) : D("", !0),
|
|
2755
|
-
|
|
2947
|
+
s.value ? k(a.$slots, "detail-extra", {
|
|
2756
2948
|
rowData: t.rowData,
|
|
2757
2949
|
columns: t.columns
|
|
2758
2950
|
}, void 0, !0, 1) : D("", !0)
|
|
2759
2951
|
])
|
|
2760
2952
|
]));
|
|
2761
2953
|
}
|
|
2762
|
-
}), fe = /* @__PURE__ */ $(
|
|
2954
|
+
}), fe = /* @__PURE__ */ $(La, [["__scopeId", "data-v-7e47b0ba"]]), Na = { class: "table-body" }, Wa = { class: "table-container" }, za = /* @__PURE__ */ V({
|
|
2763
2955
|
// 属性/事件手动处理:class/style 留根节点,其余透传给 el-table
|
|
2764
2956
|
inheritAttrs: !1,
|
|
2765
2957
|
__name: "TableRender",
|
|
@@ -2769,7 +2961,7 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2769
2961
|
},
|
|
2770
2962
|
emits: ["back", "toolbar-action", "row-action"],
|
|
2771
2963
|
setup(o, { expose: t, emit: e }) {
|
|
2772
|
-
const i = ["search-extra", "search-actions", "toolbar-left", "toolbar-extra", "detail-extra"],
|
|
2964
|
+
const i = ["search-extra", "search-actions", "toolbar-left", "toolbar-extra", "detail-extra"], s = o, d = tt(), r = ve(), c = e, a = new Jt(), l = Q(null), n = z({
|
|
2773
2965
|
// 内部搜索参数
|
|
2774
2966
|
searchParams: {},
|
|
2775
2967
|
// 是否已加载配置
|
|
@@ -2778,9 +2970,9 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2778
2970
|
dictData: {}
|
|
2779
2971
|
});
|
|
2780
2972
|
oe(async () => {
|
|
2781
|
-
|
|
2973
|
+
s.formId && await m.loadConfig(s.formId);
|
|
2782
2974
|
});
|
|
2783
|
-
const u =
|
|
2975
|
+
const u = b(() => ({
|
|
2784
2976
|
// 表格配置
|
|
2785
2977
|
tableConfig: a.data.tableConfig,
|
|
2786
2978
|
// 表格数据
|
|
@@ -2838,7 +3030,7 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2838
3030
|
// 透传给 el-table 的插槽(本组件自己消费的插槽除外)
|
|
2839
3031
|
getTableSlots() {
|
|
2840
3032
|
const f = {};
|
|
2841
|
-
for (const p of Object.keys(
|
|
3033
|
+
for (const p of Object.keys(r))
|
|
2842
3034
|
i.includes(p) || (f[p] = !0);
|
|
2843
3035
|
return f;
|
|
2844
3036
|
},
|
|
@@ -2848,11 +3040,11 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2848
3040
|
// 认为「有插槽」→ replace 模式下详情区会变成空白。
|
|
2849
3041
|
// (返回类型必须显式写:否则与 slots 互相推导会触发 TS7022/TS7023)
|
|
2850
3042
|
getDetailSlots() {
|
|
2851
|
-
return
|
|
3043
|
+
return r["detail-extra"] ? ["detail-extra"] : [];
|
|
2852
3044
|
},
|
|
2853
3045
|
// 传给 TableDetail 的插槽/默认内容关系(页面没给插槽时无所谓,给了才生效)
|
|
2854
3046
|
getDetailExtraMode() {
|
|
2855
|
-
return
|
|
3047
|
+
return s.detailExtraMode === "append" ? "append" : "replace";
|
|
2856
3048
|
},
|
|
2857
3049
|
// ============ 配置与数据 ============
|
|
2858
3050
|
// 加载配置
|
|
@@ -2880,7 +3072,7 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
2880
3072
|
h.type === "dict" && h.dictType && p.add(h.dictType);
|
|
2881
3073
|
for (const h of p)
|
|
2882
3074
|
try {
|
|
2883
|
-
const y = await
|
|
3075
|
+
const y = await M().Get(G.dictApi(h));
|
|
2884
3076
|
y.status === 200 && (n.dictData[h] = Ce(y.data));
|
|
2885
3077
|
} catch (y) {
|
|
2886
3078
|
console.error(`[TableRender] 加载字典 ${h} 失败:`, y);
|
|
@@ -3062,7 +3254,7 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
3062
3254
|
return;
|
|
3063
3255
|
}
|
|
3064
3256
|
try {
|
|
3065
|
-
const y = await
|
|
3257
|
+
const y = await M().Post(p.url, h || {});
|
|
3066
3258
|
if (y.status !== 200)
|
|
3067
3259
|
throw new Error(y.message || "操作失败");
|
|
3068
3260
|
N.success(y.message || "操作成功"), await m.handleLoadData();
|
|
@@ -3074,13 +3266,13 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
3074
3266
|
return t({
|
|
3075
3267
|
loadConfig: m.loadConfig
|
|
3076
3268
|
}), (f, p) => {
|
|
3077
|
-
var y, A,
|
|
3078
|
-
const h =
|
|
3079
|
-
return g(),
|
|
3080
|
-
class:
|
|
3269
|
+
var y, A, K, _e, Se, De, ke;
|
|
3270
|
+
const h = Xe;
|
|
3271
|
+
return g(), v("div", {
|
|
3272
|
+
class: P(["table-render", f.$attrs.class]),
|
|
3081
3273
|
style: B(f.$attrs.style)
|
|
3082
3274
|
}, [
|
|
3083
|
-
u.value.hasSearch ? (g(), S(
|
|
3275
|
+
u.value.hasSearch ? (g(), S(aa, {
|
|
3084
3276
|
key: 0,
|
|
3085
3277
|
fields: u.value.searchFields,
|
|
3086
3278
|
modelValue: n.searchParams,
|
|
@@ -3096,9 +3288,9 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
3096
3288
|
]),
|
|
3097
3289
|
_: 3
|
|
3098
3290
|
}, 8, ["fields", "modelValue", "onSearch", "onReset"])) : D("", !0),
|
|
3099
|
-
x("div",
|
|
3100
|
-
x("div",
|
|
3101
|
-
_(
|
|
3291
|
+
x("div", Na, [
|
|
3292
|
+
x("div", Wa, [
|
|
3293
|
+
_(xa, de(m.getTableAttrs(), {
|
|
3102
3294
|
rows: u.value.rows,
|
|
3103
3295
|
columns: u.value.columns,
|
|
3104
3296
|
loading: u.value.loading,
|
|
@@ -3109,27 +3301,27 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
3109
3301
|
"active-key": u.value.currentKey,
|
|
3110
3302
|
onRowAction: m.handleRowAction,
|
|
3111
3303
|
onRowClick: m.handleRowClick
|
|
3112
|
-
}),
|
|
3113
|
-
|
|
3304
|
+
}), Z({ _: 2 }, [
|
|
3305
|
+
E(m.getTableSlots(), (R, Y) => ({
|
|
3114
3306
|
name: Y,
|
|
3115
|
-
fn: w((
|
|
3116
|
-
k(f.$slots, Y, q(O(
|
|
3307
|
+
fn: w((Ue) => [
|
|
3308
|
+
k(f.$slots, Y, q(O(Ue || {})), void 0, !0)
|
|
3117
3309
|
])
|
|
3118
3310
|
}))
|
|
3119
3311
|
]), 1040, ["rows", "columns", "loading", "actions", "actions-width", "key-field", "dict-data", "active-key", "onRowAction", "onRowClick"]),
|
|
3120
|
-
_(
|
|
3312
|
+
_(Va, {
|
|
3121
3313
|
class: "table-pagination",
|
|
3122
3314
|
page: u.value.pagination.page,
|
|
3123
3315
|
"page-size": u.value.pagination.pageSize,
|
|
3124
3316
|
total: u.value.total,
|
|
3125
|
-
type: (
|
|
3317
|
+
type: (K = u.value.tableConfig) == null ? void 0 : K.pagination,
|
|
3126
3318
|
"onUpdate:page": m.handlePageChange,
|
|
3127
3319
|
"onUpdate:pageSize": m.handlePageSizeChange
|
|
3128
3320
|
}, null, 8, ["page", "page-size", "total", "type", "onUpdate:page", "onUpdate:pageSize"])
|
|
3129
3321
|
]),
|
|
3130
3322
|
u.value.showDetail && u.value.detailMode === "inline" ? (g(), S(fe, {
|
|
3131
3323
|
key: 0,
|
|
3132
|
-
class:
|
|
3324
|
+
class: P(["table-detail-inline", `table-detail-inline-${u.value.detailSide}`]),
|
|
3133
3325
|
style: B({ width: u.value.detailWidth }),
|
|
3134
3326
|
title: (Se = (_e = u.value.tableConfig) == null ? void 0 : _e.meta) == null ? void 0 : Se.title,
|
|
3135
3327
|
loading: u.value.detailLoading,
|
|
@@ -3137,8 +3329,8 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
3137
3329
|
columns: u.value.columns,
|
|
3138
3330
|
"empty-text": u.value.detailSide === "left" ? "请点击右侧表格行查看详情" : "请点击左侧表格行查看详情",
|
|
3139
3331
|
"extra-mode": m.getDetailExtraMode()
|
|
3140
|
-
},
|
|
3141
|
-
|
|
3332
|
+
}, Z({ _: 2 }, [
|
|
3333
|
+
E(m.getDetailSlots(), (R) => ({
|
|
3142
3334
|
name: R,
|
|
3143
3335
|
fn: w((Y) => [
|
|
3144
3336
|
k(f.$slots, R, q(O(Y || {})), void 0, !0)
|
|
@@ -3162,8 +3354,8 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
3162
3354
|
"row-data": u.value.detailData,
|
|
3163
3355
|
columns: u.value.columns,
|
|
3164
3356
|
"extra-mode": m.getDetailExtraMode()
|
|
3165
|
-
},
|
|
3166
|
-
|
|
3357
|
+
}, Z({ _: 2 }, [
|
|
3358
|
+
E(m.getDetailSlots(), (R) => ({
|
|
3167
3359
|
name: R,
|
|
3168
3360
|
fn: w((Y) => [
|
|
3169
3361
|
k(f.$slots, R, q(O(Y || {})), void 0, !0)
|
|
@@ -3188,8 +3380,8 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
3188
3380
|
"row-data": u.value.previewRow,
|
|
3189
3381
|
columns: u.value.columns,
|
|
3190
3382
|
"extra-mode": m.getDetailExtraMode()
|
|
3191
|
-
},
|
|
3192
|
-
|
|
3383
|
+
}, Z({ _: 2 }, [
|
|
3384
|
+
E(m.getDetailSlots(), (R) => ({
|
|
3193
3385
|
name: R,
|
|
3194
3386
|
fn: w((Y) => [
|
|
3195
3387
|
k(f.$slots, R, q(O(Y || {})), void 0, !0)
|
|
@@ -3199,7 +3391,7 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
3199
3391
|
]),
|
|
3200
3392
|
_: 3
|
|
3201
3393
|
}, 8, ["model-value", "direction", "size", "onClose", "onClosed"])) : D("", !0),
|
|
3202
|
-
u.value.hasToolbar ? (g(), S(
|
|
3394
|
+
u.value.hasToolbar ? (g(), S(sa, {
|
|
3203
3395
|
key: 3,
|
|
3204
3396
|
class: "table-toolbar-bottom",
|
|
3205
3397
|
items: u.value.toolbar,
|
|
@@ -3221,255 +3413,50 @@ const Ot = { class: "table-search" }, jt = { class: "search-fields" }, Yt = { cl
|
|
|
3221
3413
|
], 6);
|
|
3222
3414
|
};
|
|
3223
3415
|
}
|
|
3224
|
-
}),
|
|
3225
|
-
function Ua() {
|
|
3226
|
-
var o, t;
|
|
3227
|
-
try {
|
|
3228
|
-
if (typeof document < "u" && document.baseURI) {
|
|
3229
|
-
const e = new URL(document.baseURI).origin;
|
|
3230
|
-
if (e && e !== "null") return e;
|
|
3231
|
-
}
|
|
3232
|
-
} catch {
|
|
3233
|
-
}
|
|
3234
|
-
try {
|
|
3235
|
-
const e = (t = (o = window == null ? void 0 : window.$wujie) == null ? void 0 : o.location) == null ? void 0 : t.origin;
|
|
3236
|
-
if (typeof e == "string" && e) return e;
|
|
3237
|
-
} catch {
|
|
3238
|
-
}
|
|
3239
|
-
return typeof window < "u" ? window.location.origin : "";
|
|
3240
|
-
}
|
|
3241
|
-
class Ba {
|
|
3242
|
-
constructor(t) {
|
|
3243
|
-
C(this, "axiosInstance");
|
|
3244
|
-
// 免配基地址:只解析一次并缓存(一个页面生命周期内不会变)
|
|
3245
|
-
C(this, "baseUrl", "");
|
|
3246
|
-
this.axiosInstance = $e.create({
|
|
3247
|
-
timeout: 1e4,
|
|
3248
|
-
baseURL: ""
|
|
3249
|
-
}), this.axiosInstance.defaults.headers["Content-Type"] = "application/json;charset=utf-8", this.axiosInstance.interceptors.request.use(
|
|
3250
|
-
(e) => (e.headers.token = localStorage.getItem("token"), t.baseUrl ? e.baseURL = t.baseUrl : (this.baseUrl || (this.baseUrl = Ua()), e.baseURL = this.baseUrl), e),
|
|
3251
|
-
(e) => Promise.reject(e)
|
|
3252
|
-
), this.axiosInstance.interceptors.response.use(
|
|
3253
|
-
(e) => e.config.responseType === "blob" ? e : e.data,
|
|
3254
|
-
(e) => Promise.reject(e)
|
|
3255
|
-
);
|
|
3256
|
-
}
|
|
3257
|
-
/**
|
|
3258
|
-
* POST 请求
|
|
3259
|
-
*/
|
|
3260
|
-
Post(t, e) {
|
|
3261
|
-
return this.axiosInstance.post(t, e);
|
|
3262
|
-
}
|
|
3263
|
-
/**
|
|
3264
|
-
* GET 请求
|
|
3265
|
-
*/
|
|
3266
|
-
Get(t, e) {
|
|
3267
|
-
return this.axiosInstance.get(t, { params: e });
|
|
3268
|
-
}
|
|
3269
|
-
/**
|
|
3270
|
-
* DELETE 请求
|
|
3271
|
-
*/
|
|
3272
|
-
Delete(t, e) {
|
|
3273
|
-
return this.axiosInstance.delete(t, { params: e });
|
|
3274
|
-
}
|
|
3275
|
-
/**
|
|
3276
|
-
* PUT 请求
|
|
3277
|
-
*/
|
|
3278
|
-
Put(t, e) {
|
|
3279
|
-
return this.axiosInstance.put(t, e);
|
|
3280
|
-
}
|
|
3281
|
-
/**
|
|
3282
|
-
* 下载文件
|
|
3283
|
-
*/
|
|
3284
|
-
Download(t, e) {
|
|
3285
|
-
return this.axiosInstance.get(t, {
|
|
3286
|
-
params: e,
|
|
3287
|
-
responseType: "blob"
|
|
3288
|
-
});
|
|
3289
|
-
}
|
|
3290
|
-
}
|
|
3291
|
-
class Fa {
|
|
3292
|
-
//事件总线
|
|
3293
|
-
constructor() {
|
|
3294
|
-
C(this, "emitter");
|
|
3295
|
-
this.emitter = tt();
|
|
3296
|
-
}
|
|
3297
|
-
On(t, e) {
|
|
3298
|
-
this.emitter.on(t, e);
|
|
3299
|
-
}
|
|
3300
|
-
Emit(t, e) {
|
|
3301
|
-
this.emitter.emit(t, e);
|
|
3302
|
-
}
|
|
3303
|
-
Off(t, e) {
|
|
3304
|
-
this.emitter.off(t, e);
|
|
3305
|
-
}
|
|
3306
|
-
}
|
|
3307
|
-
class La {
|
|
3308
|
-
constructor(t, e) {
|
|
3309
|
-
C(this, "mqttClient", null);
|
|
3310
|
-
C(this, "eventBus");
|
|
3311
|
-
this.eventBus = t, this.connect(e).then();
|
|
3312
|
-
}
|
|
3313
|
-
async connect(t) {
|
|
3314
|
-
const e = {
|
|
3315
|
-
username: t.userName,
|
|
3316
|
-
password: t.password,
|
|
3317
|
-
clientId: `${t.module}_${this.randomStr(10)}`,
|
|
3318
|
-
clean: !0,
|
|
3319
|
-
keepalive: 50,
|
|
3320
|
-
connectTimeout: 5e3,
|
|
3321
|
-
reconnectPeriod: 5e3
|
|
3322
|
-
};
|
|
3323
|
-
let i = t.mqttUrl || "ws://127.0.0.1:5002/ws";
|
|
3324
|
-
if (console.log("connect to mqtt..."), this.mqttClient = at.connect(i, e), !this.mqttClient) {
|
|
3325
|
-
console.log("connect mqtt failed");
|
|
3326
|
-
return;
|
|
3327
|
-
}
|
|
3328
|
-
this.mqttClient.on("connect", () => {
|
|
3329
|
-
console.log("=====> mqtt connect success!"), this.mqttClient.subscribe(me, { qos: 0 }, (r) => {
|
|
3330
|
-
console.log(r ? `mqtt subscribe [${me}] failed` : `mqtt subscribe [${me}] success`);
|
|
3331
|
-
});
|
|
3332
|
-
}), this.mqttClient.on("message", (r, d) => {
|
|
3333
|
-
const s = d.toString();
|
|
3334
|
-
if (!s) {
|
|
3335
|
-
console.error("Received empty message", r);
|
|
3336
|
-
return;
|
|
3337
|
-
}
|
|
3338
|
-
let c = null;
|
|
3339
|
-
try {
|
|
3340
|
-
c = JSON.parse(s);
|
|
3341
|
-
} catch (a) {
|
|
3342
|
-
console.error("Failed to parse message JSON", r, s, a);
|
|
3343
|
-
return;
|
|
3344
|
-
}
|
|
3345
|
-
if (!c || c.Content === void 0 || c.Content === null || !c.PType) {
|
|
3346
|
-
console.log("parse notice failed!", s);
|
|
3347
|
-
return;
|
|
3348
|
-
}
|
|
3349
|
-
c.PType == Na && this.eventBus.Emit(c.Route, c.Content);
|
|
3350
|
-
}), this.mqttClient.on(ie.OffLine, () => {
|
|
3351
|
-
console.log("mqtt offline...");
|
|
3352
|
-
}), this.mqttClient.on(ie.Reconnect, () => {
|
|
3353
|
-
console.log("mqtt reconnecting...");
|
|
3354
|
-
}), this.mqttClient.on(ie.Close, () => {
|
|
3355
|
-
console.log("mqtt close");
|
|
3356
|
-
}), this.mqttClient.on(ie.Error, (r) => {
|
|
3357
|
-
console.log("mqtt error");
|
|
3358
|
-
});
|
|
3359
|
-
}
|
|
3360
|
-
// 生成随机字符串
|
|
3361
|
-
randomStr(t) {
|
|
3362
|
-
const e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
3363
|
-
let i = "";
|
|
3364
|
-
for (let r = 0; r < t; r++)
|
|
3365
|
-
i += e.charAt(Math.floor(Math.random() * e.length));
|
|
3366
|
-
return i;
|
|
3367
|
-
}
|
|
3368
|
-
}
|
|
3369
|
-
const me = "Notice", Na = "NOTICE", ie = {
|
|
3370
|
-
OffLine: "offline",
|
|
3371
|
-
Close: "close",
|
|
3372
|
-
Reconnect: "reconnect",
|
|
3373
|
-
Error: "error"
|
|
3374
|
-
};
|
|
3375
|
-
let se;
|
|
3376
|
-
const So = (o) => {
|
|
3377
|
-
if (!o)
|
|
3378
|
-
throw new Error("QfOptions is undefined");
|
|
3379
|
-
if (!se && o && (se = new Wa(o)), !se)
|
|
3380
|
-
throw new Error("Qf not initialized, please call GetQf(options) first");
|
|
3381
|
-
return se;
|
|
3382
|
-
};
|
|
3383
|
-
class Wa {
|
|
3384
|
-
constructor(t) {
|
|
3385
|
-
C(this, "EventBus");
|
|
3386
|
-
C(this, "WebApi");
|
|
3387
|
-
C(this, "Mqtt");
|
|
3388
|
-
C(this, "options");
|
|
3389
|
-
this.initQf(t);
|
|
3390
|
-
}
|
|
3391
|
-
/**
|
|
3392
|
-
* 初始化 Qf
|
|
3393
|
-
*/
|
|
3394
|
-
initQf(t) {
|
|
3395
|
-
if (!t)
|
|
3396
|
-
throw new Error(`StartQf failed! options is ${t}`);
|
|
3397
|
-
this.options = t, console.log("StartQf(), qfOptions=", t), this.EventBus = new Fa(), this.WebApi = new Ba(t), this.options.useMqtt && (this.Mqtt = new La(this.EventBus, t));
|
|
3398
|
-
}
|
|
3399
|
-
// ==================== EventBus 相关 ====================
|
|
3400
|
-
On(t, e) {
|
|
3401
|
-
this.EventBus.On(t, e);
|
|
3402
|
-
}
|
|
3403
|
-
Emit(t, e) {
|
|
3404
|
-
this.EventBus.Emit(t, e);
|
|
3405
|
-
}
|
|
3406
|
-
Off(t, e) {
|
|
3407
|
-
this.EventBus.Off(t, e);
|
|
3408
|
-
}
|
|
3409
|
-
// ==================== Http 相关 ====================
|
|
3410
|
-
Post(t, e) {
|
|
3411
|
-
return this.WebApi.Post(t, e);
|
|
3412
|
-
}
|
|
3413
|
-
Get(t, e) {
|
|
3414
|
-
return this.WebApi.Get(t, e);
|
|
3415
|
-
}
|
|
3416
|
-
Delete(t, e) {
|
|
3417
|
-
return this.WebApi.Delete(t, e);
|
|
3418
|
-
}
|
|
3419
|
-
Put(t, e) {
|
|
3420
|
-
return this.WebApi.Put(t, e);
|
|
3421
|
-
}
|
|
3422
|
-
Download(t, e) {
|
|
3423
|
-
return this.WebApi.Download(t, e);
|
|
3424
|
-
}
|
|
3425
|
-
// ==================== MQTT 通知 ====================
|
|
3426
|
-
RegNotice(t, e) {
|
|
3427
|
-
this.EventBus.On(t, e);
|
|
3428
|
-
}
|
|
3429
|
-
}
|
|
3430
|
-
const za = {
|
|
3416
|
+
}), qa = /* @__PURE__ */ $(za, [["__scopeId", "data-v-1d0ae5e9"]]), Oa = {
|
|
3431
3417
|
UInput: te,
|
|
3432
3418
|
UInputNumber: Ae,
|
|
3433
3419
|
UDict: ee,
|
|
3434
|
-
UToggle:
|
|
3435
|
-
UCascader:
|
|
3436
|
-
UDate:
|
|
3437
|
-
UMenu:
|
|
3420
|
+
UToggle: Ie,
|
|
3421
|
+
UCascader: Me,
|
|
3422
|
+
UDate: re,
|
|
3423
|
+
UMenu: Rt,
|
|
3438
3424
|
FormRender: Ee,
|
|
3439
|
-
TableRender:
|
|
3425
|
+
TableRender: qa,
|
|
3440
3426
|
UFieldView: xe
|
|
3441
|
-
},
|
|
3427
|
+
}, To = {
|
|
3442
3428
|
install(o) {
|
|
3443
|
-
o.use(
|
|
3444
|
-
for (const [t, e] of Object.entries(
|
|
3429
|
+
o.use(Le);
|
|
3430
|
+
for (const [t, e] of Object.entries(Oa))
|
|
3445
3431
|
o.component(t, e);
|
|
3446
3432
|
}
|
|
3447
3433
|
};
|
|
3448
3434
|
export {
|
|
3449
3435
|
Ee as FormRender,
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3436
|
+
bo as GetQf,
|
|
3437
|
+
qa as TableRender,
|
|
3438
|
+
Me as UCascader,
|
|
3439
|
+
re as UDate,
|
|
3454
3440
|
ee as UDict,
|
|
3455
3441
|
xe as UFieldView,
|
|
3456
3442
|
te as UInput,
|
|
3457
3443
|
Ae as UInputNumber,
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3444
|
+
Rt as UMenu,
|
|
3445
|
+
Ie as UToggle,
|
|
3446
|
+
G as apis,
|
|
3447
|
+
_o as clearDictCache,
|
|
3448
|
+
To as default,
|
|
3449
|
+
wo as flattenDictTree,
|
|
3464
3450
|
ae as getDict,
|
|
3451
|
+
M as getQf,
|
|
3465
3452
|
we as mapDictTree,
|
|
3466
|
-
|
|
3453
|
+
be as normalizeDictNode,
|
|
3467
3454
|
N as notify,
|
|
3468
3455
|
le as notifyUtil,
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3456
|
+
xo as preloadDicts,
|
|
3457
|
+
rt as resolveAppBase,
|
|
3458
|
+
So as setDictCache,
|
|
3472
3459
|
Ce as toDictOptions,
|
|
3473
|
-
|
|
3474
|
-
|
|
3460
|
+
pt as translateDict,
|
|
3461
|
+
Co as translateDictSync
|
|
3475
3462
|
};
|