@skyfox2000/webui 1.0.14 → 1.2.1
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/lib/assets/modules/file-upload-CBUcsUnR.js +170 -0
- package/lib/assets/modules/form-validate-CgX7aR7T.js +297 -0
- package/lib/assets/modules/index-Civhd8xG.js +112 -0
- package/lib/assets/modules/index-DQMdt51R.js +726 -0
- package/lib/assets/modules/{index-BEWJ_qAH.js → index-DmWrkTXX.js} +1 -1
- package/lib/assets/modules/{menuTabs-BXdbFZor.js → menuTabs-BRYvFWA-.js} +131 -121
- package/lib/assets/modules/settingInfo-BZakNKIN.js +999 -0
- package/lib/assets/modules/uploadList-B7XoxGOh.js +278 -0
- package/lib/components/common/icon/index.vue.d.ts +1 -1
- package/lib/components/content/dialog/index.vue.d.ts +1 -1
- package/lib/components/content/drawer/index.vue.d.ts +1 -1
- package/lib/components/content/form/index.vue.d.ts +1 -1
- package/lib/components/content/search/index.vue.d.ts +1 -1
- package/lib/components/content/table/index.vue.d.ts +1 -1
- package/lib/components/content/table/tableOperate.vue.d.ts +1 -1
- package/lib/components/content/toolbar/icontool.vue.d.ts +1 -1
- package/lib/components/content/toolbar/index.vue.d.ts +1 -1
- package/lib/components/content/tree/index.vue.d.ts +1 -1
- package/lib/components/form/transfer/transferTable.vue.d.ts +1 -1
- package/lib/components/form/treeSelect/index.vue.d.ts +1 -1
- package/lib/components/form/upload/uploadList.vue.d.ts +1 -1
- package/lib/const/options.d.ts +32 -0
- package/lib/directives/enter-submit.d.ts +4 -0
- package/lib/directives/index.d.ts +2 -0
- package/lib/directives/permission.d.ts +5 -0
- package/lib/es/AceEditor/index.js +9 -8
- package/lib/es/BasicLayout/index.js +28 -24
- package/lib/es/Error403/index.js +15 -10
- package/lib/es/Error404/index.js +15 -10
- package/lib/es/ExcelForm/index.js +380 -175
- package/lib/es/UploadForm/index.js +23 -20
- package/lib/index.d.ts +43 -2
- package/lib/router/index.d.ts +16 -0
- package/lib/stores/appInfo.d.ts +34 -0
- package/lib/stores/hostInfo.d.ts +9 -0
- package/lib/stores/pageInfo.d.ts +18 -0
- package/lib/stores/pinia.d.ts +3 -0
- package/lib/stores/settingInfo.d.ts +8 -0
- package/lib/stores/userInfo.d.ts +21 -0
- package/lib/typings/data.d.ts +80 -0
- package/lib/typings/form.d.ts +171 -0
- package/lib/typings/menu.d.ts +7 -0
- package/lib/typings/option.d.ts +175 -0
- package/lib/typings/page.d.ts +69 -0
- package/lib/typings/table.d.ts +181 -0
- package/lib/typings/tools.d.ts +130 -0
- package/lib/typings/tree.d.ts +72 -0
- package/lib/typings/upload.d.ts +161 -0
- package/lib/typings/urls.d.ts +69 -0
- package/lib/utils/cache.d.ts +23 -0
- package/lib/utils/data.d.ts +6 -0
- package/lib/utils/download.d.ts +4 -0
- package/lib/utils/eventbus.d.ts +16 -0
- package/lib/utils/export-table.d.ts +12 -0
- package/lib/utils/file-upload.d.ts +15 -0
- package/lib/utils/form-excel.d.ts +30 -0
- package/lib/utils/form-validate.d.ts +29 -0
- package/lib/utils/form.d.ts +9 -0
- package/lib/utils/icon-loader.d.ts +125 -0
- package/lib/utils/isEmpty.d.ts +1 -0
- package/lib/utils/main-openapis.d.ts +9 -0
- package/lib/utils/menu.d.ts +6 -0
- package/lib/utils/options.d.ts +10 -0
- package/lib/utils/page.d.ts +25 -0
- package/lib/utils/table.d.ts +21 -0
- package/lib/utils/tools.d.ts +18 -0
- package/lib/utils/tree.d.ts +3 -0
- package/lib/vite-env.d.ts +8 -0
- package/lib/webui.css +1 -1
- package/lib/webui.es.js +890 -724
- package/package.json +7 -6
- package/src/components/common/icon/appicon.vue +1 -1
- package/src/components/common/icon/fullscreen.vue +2 -1
- package/src/components/common/icon/index.vue +1 -1
- package/src/components/common/icon/layoutIcon.vue +1 -1
- package/src/components/common/icon/projectIcon.vue +1 -1
- package/src/components/common/icon/toolIcon.vue +1 -1
- package/src/components/content/dialog/excelForm.vue +2 -2
- package/src/components/content/dialog/index.vue +1 -1
- package/src/components/content/dialog/uploadForm.vue +7 -6
- package/src/components/content/drawer/index.vue +43 -18
- package/src/components/content/form/formItem.vue +1 -1
- package/src/components/content/form/index.vue +1 -1
- package/src/components/content/search/index.vue +1 -1
- package/src/components/content/search/searchItem.vue +1 -1
- package/src/components/content/table/index.vue +3 -3
- package/src/components/content/table/tableOperate.vue +2 -2
- package/src/components/content/toolbar/icontool.vue +2 -2
- package/src/components/content/toolbar/index.vue +3 -2
- package/src/components/content/tree/index.vue +1 -1
- package/src/components/error/error403.vue +2 -2
- package/src/components/error/error404.vue +2 -2
- package/src/components/form/autoComplete/index.vue +1 -1
- package/src/components/form/cascader/index.vue +1 -2
- package/src/components/form/checkbox/index.vue +11 -5
- package/src/components/form/datePicker/index.vue +1 -1
- package/src/components/form/input/index.vue +1 -1
- package/src/components/form/input/inputNumber.vue +1 -1
- package/src/components/form/input/inputPassword.vue +1 -1
- package/src/components/form/radio/index.vue +1 -1
- package/src/components/form/radio/radioStatus.vue +1 -1
- package/src/components/form/rangePicker/index.vue +1 -1
- package/src/components/form/select/index.vue +1 -1
- package/src/components/form/switch/index.vue +7 -3
- package/src/components/form/textarea/index.vue +1 -1
- package/src/components/form/transfer/index.vue +1 -1
- package/src/components/form/transfer/transferTable.vue +42 -22
- package/src/components/form/treeSelect/index.vue +2 -3
- package/src/components/form/upload/uploadList.vue +1 -1
- package/src/components/layout/breadcrumb/index.vue +1 -1
- package/src/components/layout/header/headerExits.vue +1 -1
- package/src/components/layout/header/index.vue +1 -1
- package/src/components/layout/header/user.vue +2 -1
- package/src/components/layout/menu/index.vue +9 -3
- package/src/components/layout/menu/menuTabs.vue +10 -12
- package/src/components/layout/page/basicLayout.vue +1 -1
- package/src/const/options.ts +114 -0
- package/src/directives/enter-submit.ts +13 -0
- package/src/directives/index.ts +26 -0
- package/src/directives/permission.ts +144 -0
- package/src/index.ts +202 -0
- package/src/router/index.ts +196 -0
- package/src/stores/appInfo.ts +471 -0
- package/src/stores/hostInfo.ts +117 -0
- package/src/stores/pageInfo.ts +131 -0
- package/src/stores/pinia.ts +10 -0
- package/src/stores/settingInfo.ts +53 -0
- package/src/stores/userInfo.ts +392 -0
- package/src/typings/data.d.ts +81 -0
- package/src/typings/form.d.ts +172 -0
- package/src/typings/menu.d.ts +7 -0
- package/src/typings/option.d.ts +177 -0
- package/src/typings/page.d.ts +70 -0
- package/src/typings/table.d.ts +182 -0
- package/src/typings/tools.d.ts +131 -0
- package/src/typings/tree.d.ts +73 -0
- package/src/typings/upload.d.ts +162 -0
- package/src/typings/urls.d.ts +70 -0
- package/src/utils/cache.ts +175 -0
- package/src/utils/data.ts +189 -0
- package/src/utils/download.ts +80 -0
- package/src/utils/eventbus.ts +78 -0
- package/src/utils/export-table.ts +155 -0
- package/src/utils/file-upload.ts +304 -0
- package/src/utils/form-excel.ts +523 -0
- package/src/utils/form-validate.ts +368 -0
- package/src/utils/form.ts +188 -0
- package/src/utils/icon-loader.ts +412 -0
- package/src/utils/isEmpty.ts +18 -0
- package/src/utils/main-openapis.ts +72 -0
- package/src/utils/menu.ts +89 -0
- package/src/utils/options.ts +324 -0
- package/src/utils/page.ts +262 -0
- package/src/utils/table.ts +274 -0
- package/src/utils/tools.ts +362 -0
- package/src/utils/tree.ts +28 -0
- package/tsconfig.json +1 -8
- package/vite.config.ts +7 -4
- package/lib/assets/modules/index-BahGnrAq.js +0 -415
- package/lib/assets/modules/index-BoKIa2sr.js +0 -109
- package/lib/assets/modules/index-D47Ci-T3.js +0 -107
- package/lib/assets/modules/uploadList-Dzlg47V0.js +0 -182
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
var E = Object.defineProperty;
|
|
2
|
+
var m = (a, r, n) => r in a ? E(a, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[r] = n;
|
|
3
|
+
var d = (a, r, n) => m(a, typeof r != "symbol" ? r + "" : r, n);
|
|
4
|
+
import { hostUrl as b } from "@skyfox2000/fapi";
|
|
5
|
+
import { b as w } from "./settingInfo-BZakNKIN.js";
|
|
6
|
+
import { mainAppApis as f } from "@skyfox2000/microbase";
|
|
7
|
+
import y from "dayjs";
|
|
8
|
+
var c = /* @__PURE__ */ ((a) => (a.Pending = "pending", a.Uploading = "uploading", a.Success = "success", a.Error = "error", a.Online = "online", a.Offline = "offline", a))(c || {});
|
|
9
|
+
const g = () => f.value && f.value.getToken ? f.value.getToken() : w().getToken();
|
|
10
|
+
class v {
|
|
11
|
+
/**
|
|
12
|
+
* 连接路径参数,已判断 undefined 或 null 值
|
|
13
|
+
* @param args 路径参数数组
|
|
14
|
+
* @returns 连接后的路径字符串
|
|
15
|
+
*/
|
|
16
|
+
static join(...r) {
|
|
17
|
+
return r.filter((u) => u != null).join("/").replace(/[\/]+/, "/");
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
class F {
|
|
21
|
+
/**
|
|
22
|
+
* AsyncUploader 构造函数
|
|
23
|
+
* @param urlInfo 文件上传的 API 配置(IUrlInfo 对象)
|
|
24
|
+
* @param maxConcurrent 最大允许并发上传的文件数量
|
|
25
|
+
*/
|
|
26
|
+
constructor(r, n) {
|
|
27
|
+
/**
|
|
28
|
+
* 设置 API 端点和最大并发数,所有上传文件通过该类控制
|
|
29
|
+
*/
|
|
30
|
+
d(this, "urlInfo");
|
|
31
|
+
/**
|
|
32
|
+
* 最大并发上传数
|
|
33
|
+
*/
|
|
34
|
+
d(this, "maxConcurrent");
|
|
35
|
+
/**
|
|
36
|
+
* 控制上传任务的中断信号
|
|
37
|
+
*/
|
|
38
|
+
d(this, "abortController");
|
|
39
|
+
this.urlInfo = r, this.maxConcurrent = n;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 上传多个文件,控制并发数量
|
|
43
|
+
* @param files 文件列表(File[] 或 FileList)
|
|
44
|
+
* @param onProgress 上传进度回调
|
|
45
|
+
* @param onComplete 上传完成回调
|
|
46
|
+
*/
|
|
47
|
+
async uploadFiles(r, n, o) {
|
|
48
|
+
if (!r.length) return;
|
|
49
|
+
const u = Math.min(this.maxConcurrent, r.length), e = [];
|
|
50
|
+
for (const t of r)
|
|
51
|
+
switch (t.status) {
|
|
52
|
+
case c.Success:
|
|
53
|
+
case c.Online:
|
|
54
|
+
case c.Offline:
|
|
55
|
+
break;
|
|
56
|
+
default:
|
|
57
|
+
t.status = c.Pending, e.push(t);
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
const l = [];
|
|
61
|
+
this.abortController = new AbortController();
|
|
62
|
+
try {
|
|
63
|
+
for (; l.length < u && e.length > 0; ) {
|
|
64
|
+
const t = e.shift();
|
|
65
|
+
if (!t) break;
|
|
66
|
+
l.push(this.handleFileStatus(t, l, e, n));
|
|
67
|
+
}
|
|
68
|
+
await Promise.all(l), o == null || o(r);
|
|
69
|
+
} catch (t) {
|
|
70
|
+
console.error("上传失败:", t), r.forEach((h) => {
|
|
71
|
+
h.status = c.Error, h.error = t instanceof Error ? t : new Error("上传失败"), n == null || n(h);
|
|
72
|
+
}), o == null || o(r);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* 处理单个文件的上传逻辑
|
|
77
|
+
* @param file 当前上传的文件
|
|
78
|
+
* @param activeUploads 当前正在上传的文件列表
|
|
79
|
+
* @param pendingFiles 等待上传的文件列表
|
|
80
|
+
* @param onProgress 上传进度回调
|
|
81
|
+
*/
|
|
82
|
+
async handleFileStatus(r, n, o, u) {
|
|
83
|
+
try {
|
|
84
|
+
r.status = c.Uploading, await this.uploadFile(r, this.abortController.signal, (e) => {
|
|
85
|
+
r.percent = e, u == null || u(r);
|
|
86
|
+
}), r.status = c.Success;
|
|
87
|
+
} catch (e) {
|
|
88
|
+
r.status = c.Error, r.error = e instanceof Error ? e : new Error("上传失败"), console.error(r.error);
|
|
89
|
+
} finally {
|
|
90
|
+
if (o.length > 0) {
|
|
91
|
+
const e = o.shift();
|
|
92
|
+
e && n.push(this.handleFileStatus(e, n, o, u));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* 使用 XMLHttpRequest 上传文件
|
|
98
|
+
* @param file 文件对象
|
|
99
|
+
* @param signal 中断信号
|
|
100
|
+
* @param onProgress 上传进度回调
|
|
101
|
+
*/
|
|
102
|
+
async uploadFile(r, n, o) {
|
|
103
|
+
return new Promise((u, e) => {
|
|
104
|
+
const l = new FormData();
|
|
105
|
+
if (l.append("file", r.originFileObj), r.params)
|
|
106
|
+
for (const s in r.params)
|
|
107
|
+
l.append(s, r.params[s]);
|
|
108
|
+
const t = new XMLHttpRequest(), h = b(this.urlInfo);
|
|
109
|
+
if (h === !1) return Promise.resolve(null);
|
|
110
|
+
if (t.open("POST", h, !0), this.urlInfo.header && typeof this.urlInfo.header == "object" && Object.entries(this.urlInfo.header).forEach(([s, i]) => {
|
|
111
|
+
t.setRequestHeader(s, i);
|
|
112
|
+
}), this.urlInfo.authorize) {
|
|
113
|
+
const s = g();
|
|
114
|
+
if (!s) {
|
|
115
|
+
e(new Error("未授权或授权过期"));
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
t.setRequestHeader("Authorization", "Bearer " + s);
|
|
119
|
+
}
|
|
120
|
+
t.upload.addEventListener("progress", (s) => {
|
|
121
|
+
if (s.lengthComputable && s.total > 0) {
|
|
122
|
+
const i = Math.round(s.loaded / s.total * 100);
|
|
123
|
+
o(i);
|
|
124
|
+
}
|
|
125
|
+
}), t.addEventListener("load", () => {
|
|
126
|
+
if (t.status >= 200 && t.status < 300) {
|
|
127
|
+
const s = t.getResponseHeader("Content-Type");
|
|
128
|
+
if (!s || !s.includes("application/json")) {
|
|
129
|
+
e(new Error("返回的结果不是 JSON 格式"));
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
try {
|
|
133
|
+
const i = JSON.parse(t.response);
|
|
134
|
+
if (i.status === "success")
|
|
135
|
+
i.data && (r.minioFile = {
|
|
136
|
+
ETag: i.data.ETag,
|
|
137
|
+
Bucket: i.data.Bucket,
|
|
138
|
+
Key: i.data.Key,
|
|
139
|
+
Size: i.data.Size,
|
|
140
|
+
UpdateTime: y().format("YYYY-MM-DD HH:mm:ss"),
|
|
141
|
+
Status: c.Online
|
|
142
|
+
}), u(r);
|
|
143
|
+
else {
|
|
144
|
+
const p = i.msg;
|
|
145
|
+
e(new Error(p));
|
|
146
|
+
}
|
|
147
|
+
} catch (i) {
|
|
148
|
+
e(new Error("无法解析返回的 JSON 数据: " + i));
|
|
149
|
+
}
|
|
150
|
+
} else
|
|
151
|
+
e(new Error(`上传失败,状态码:${t.status}`));
|
|
152
|
+
}), t.addEventListener("error", () => {
|
|
153
|
+
e(new Error("上传失败,网络异常"));
|
|
154
|
+
}), t.send(l), n.addEventListener("abort", () => {
|
|
155
|
+
t.abort(), e(new Error("上传已取消"));
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* 取消当前所有的上传任务
|
|
161
|
+
*/
|
|
162
|
+
cancelUpload() {
|
|
163
|
+
this.abortController && this.abortController.abort();
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
export {
|
|
167
|
+
F as A,
|
|
168
|
+
c as U,
|
|
169
|
+
v as p
|
|
170
|
+
};
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import { defineComponent as A, useAttrs as _, createElementBlock as $, openBlock as R, createVNode as x, withCtx as b, unref as E, mergeProps as k, renderSlot as T, inject as h, ref as g, provide as S, watch as j, toRaw as K } from "vue";
|
|
2
|
+
import { Button as C } from "ant-design-vue";
|
|
3
|
+
import { a as M, _ as O } from "./index-DmWrkTXX.js";
|
|
4
|
+
import { httpPost as V, ResStatus as Q } from "@skyfox2000/fapi";
|
|
5
|
+
import d from "vue-m-message";
|
|
6
|
+
import F from "async-validator";
|
|
7
|
+
const W = /* @__PURE__ */ A({
|
|
8
|
+
inheritAttrs: !1,
|
|
9
|
+
__name: "index",
|
|
10
|
+
props: {
|
|
11
|
+
/**
|
|
12
|
+
* 提示标题
|
|
13
|
+
* @props
|
|
14
|
+
* @name content
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
17
|
+
tiptext: String,
|
|
18
|
+
/**
|
|
19
|
+
* 提示显示位置
|
|
20
|
+
* @props
|
|
21
|
+
* @name placement
|
|
22
|
+
* @type {string}
|
|
23
|
+
* @default 'top'
|
|
24
|
+
*/
|
|
25
|
+
placement: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: "top"
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* 内置图标属性设置
|
|
31
|
+
* @props
|
|
32
|
+
* @name iconProps
|
|
33
|
+
* @type {object}
|
|
34
|
+
* @summary 内置图标复杂属性设置,仅支持前置图标
|
|
35
|
+
*/
|
|
36
|
+
iconProps: Object,
|
|
37
|
+
/**
|
|
38
|
+
* 默认使用框架图标
|
|
39
|
+
* 其它图标请自定义
|
|
40
|
+
* @props
|
|
41
|
+
* @name icon
|
|
42
|
+
* @type {string}
|
|
43
|
+
*/
|
|
44
|
+
icon: String
|
|
45
|
+
// /**
|
|
46
|
+
// * 点击事件
|
|
47
|
+
// * @props
|
|
48
|
+
// * @name clickEvent
|
|
49
|
+
// * @summary 格式 "空间名#事件名",空间名和事件名用#分隔,事件名用.分隔
|
|
50
|
+
// * @type {string}
|
|
51
|
+
// */
|
|
52
|
+
// clickEvent: {
|
|
53
|
+
// type: String
|
|
54
|
+
// },
|
|
55
|
+
// /**
|
|
56
|
+
// * 点击传输数据
|
|
57
|
+
// * @props
|
|
58
|
+
// * @name data
|
|
59
|
+
// * @summary 点击事件传输的默认数据
|
|
60
|
+
// * @type {object|string}
|
|
61
|
+
// */
|
|
62
|
+
// data: {
|
|
63
|
+
// type: [Object, String]
|
|
64
|
+
// }
|
|
65
|
+
},
|
|
66
|
+
emits: [
|
|
67
|
+
/**
|
|
68
|
+
* 点击事件
|
|
69
|
+
* @emits
|
|
70
|
+
* @name click
|
|
71
|
+
* @summary 图标按钮点击时触发的事件
|
|
72
|
+
*/
|
|
73
|
+
"click"
|
|
74
|
+
],
|
|
75
|
+
setup(e, { emit: r }) {
|
|
76
|
+
const a = _(), s = e, t = r, n = () => {
|
|
77
|
+
s.iconProps && s.iconProps.icons && (s.iconProps.iconIndex = (s.iconProps.iconIndex + 1) % s.iconProps.icons.length), t("click");
|
|
78
|
+
};
|
|
79
|
+
return (l, i) => (R(), $("div", null, [
|
|
80
|
+
x(M, {
|
|
81
|
+
title: s.tiptext,
|
|
82
|
+
disabled: s.tiptext ? void 0 : "disabled",
|
|
83
|
+
placement: e.placement
|
|
84
|
+
}, {
|
|
85
|
+
default: b(() => [
|
|
86
|
+
x(E(C), k({ class: "px-[10px] py-[4px] flex items-center gap-1" }, E(a), { onClick: n }), {
|
|
87
|
+
icon: b(() => [
|
|
88
|
+
T(l.$slots, "icon", {}, () => [
|
|
89
|
+
x(O, k({
|
|
90
|
+
icon: s.icon,
|
|
91
|
+
class: [
|
|
92
|
+
E(a).type === "primary" ? "ant-btn-primary" : "",
|
|
93
|
+
"cursor-pointer w-[17px] h-[17px] mx-auto"
|
|
94
|
+
],
|
|
95
|
+
clickable: ""
|
|
96
|
+
}, s.iconProps), null, 16, ["icon", "class"])
|
|
97
|
+
])
|
|
98
|
+
]),
|
|
99
|
+
default: b(() => [
|
|
100
|
+
T(l.$slots, "default")
|
|
101
|
+
]),
|
|
102
|
+
_: 3
|
|
103
|
+
}, 16)
|
|
104
|
+
]),
|
|
105
|
+
_: 3
|
|
106
|
+
}, 8, ["title", "disabled", "placement"])
|
|
107
|
+
]));
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
var m = /* @__PURE__ */ ((e) => (e.PageControl = "Page.PageControl", e.EditorControl = "Page.EditorControl", e.GridControl = "Page.GridControl", e.LabelText = "FormItem.LabelText", e.RuleKey = "FormItem.RuleKey", e.ErrInfo = "FormItem.ErrInfo", e))(m || {});
|
|
111
|
+
const y = (e) => e == null || e === "" ? !0 : Array.isArray(e) ? e.length === 0 : typeof e == "object" ? Object.keys(e).length === 0 : !1, I = (e, r) => {
|
|
112
|
+
var t;
|
|
113
|
+
return {
|
|
114
|
+
url: "",
|
|
115
|
+
...(t = e.page.urls) == null ? void 0 : t[r.urlKey],
|
|
116
|
+
...e.url,
|
|
117
|
+
...r.url,
|
|
118
|
+
loadingText: r.loadingText
|
|
119
|
+
};
|
|
120
|
+
}, P = (e, r) => {
|
|
121
|
+
const a = e.page, s = r.url;
|
|
122
|
+
if (!s || !s.url) {
|
|
123
|
+
const n = `URL未设置: ${r.urlKey}`;
|
|
124
|
+
return console.warn(n), Promise.reject(new Error(n));
|
|
125
|
+
}
|
|
126
|
+
s.api || (s.api = a.api), s.authorize === void 0 && (s.authorize = a.authorize);
|
|
127
|
+
let t = JSON.parse(JSON.stringify(r.params));
|
|
128
|
+
return r.processParams && (t = r.processParams(t)), r.loadingState && (r.loadingState.value = !0), r.hideErrorToast && (s.hideErrorToast = !0), V(s, t).then((n) => (r.loadingState && (r.loadingState.value = !1), n)).catch((n) => (r.loadingState && (r.loadingState.value = !1), null));
|
|
129
|
+
}, H = (e, r) => {
|
|
130
|
+
r.params || (r.params = {}), r.params.Query || (r.params.Query = {});
|
|
131
|
+
const a = I(e, r);
|
|
132
|
+
return r.url = a, P(e, r);
|
|
133
|
+
}, X = (e, r = {}) => {
|
|
134
|
+
const a = r.primaryKey || "Id";
|
|
135
|
+
if (r.params || (r.params = {}), r.params.Query || (r.params.Query = {}), !r.params.Data)
|
|
136
|
+
return d.error("错误!无保存数据!"), Promise.resolve(null);
|
|
137
|
+
const s = {
|
|
138
|
+
...r,
|
|
139
|
+
urlKey: r.urlKey || "save",
|
|
140
|
+
loadingText: r.loadingText === !1 ? !1 : r.loadingText || "数据保存中..."
|
|
141
|
+
};
|
|
142
|
+
s.params.Query[a] = s.params.Data[a];
|
|
143
|
+
const t = I(e, s);
|
|
144
|
+
return s.url = t, P(e, s).then((n) => ((n == null ? void 0 : n.status) === Q.SUCCESS && (r.hideErrorToast || d.success("保存成功!")), n));
|
|
145
|
+
}, Y = (e, r, a = {}) => {
|
|
146
|
+
const s = a.primaryKey || "Id";
|
|
147
|
+
a.params || (a.params = {}), a.params.Query || (a.params.Query = {});
|
|
148
|
+
const t = {
|
|
149
|
+
...a,
|
|
150
|
+
urlKey: "delete",
|
|
151
|
+
loadingText: a.loadingText === !1 ? !1 : a.loadingText || "数据删除中..."
|
|
152
|
+
};
|
|
153
|
+
if (Array.isArray(r) ? t.params.Query[s] = r : t.params.Query[s] = r[s], y(t.params.Query) || y(t.params.Query[s]))
|
|
154
|
+
return d.error("错误!禁止无条件删除数据!"), Promise.resolve(null);
|
|
155
|
+
const n = I(e, t);
|
|
156
|
+
return t.url = n, P(e, t).then((l) => ((l == null ? void 0 : l.status) === Q.SUCCESS && (a.hideErrorToast || d.success("删除成功!")), l));
|
|
157
|
+
};
|
|
158
|
+
let w;
|
|
159
|
+
const Z = (e) => {
|
|
160
|
+
if (!e || y(e))
|
|
161
|
+
return [];
|
|
162
|
+
const r = [], a = w.messages(), s = (n, l, i) => {
|
|
163
|
+
const u = l.type;
|
|
164
|
+
if (u && a.types && u in a.types) {
|
|
165
|
+
const o = a.types[u];
|
|
166
|
+
t(o, n, { type: u }, i);
|
|
167
|
+
}
|
|
168
|
+
const c = ["string", "number", "array"];
|
|
169
|
+
for (const o of c)
|
|
170
|
+
if (u === o && a[o]) {
|
|
171
|
+
const f = a[o], v = ["len", "min", "max", "range"];
|
|
172
|
+
for (const p of v)
|
|
173
|
+
p === "range" && l.min != null && l.max != null && f.range ? t(f.range, n, { min: l.min, max: l.max }, i) : p !== "range" && l[p] != null && f[p] && t(f[p], n, { [p]: l[p] }, i);
|
|
174
|
+
}
|
|
175
|
+
if (l.required && a.required && t(a.required, n, {}, i), l.pattern && a.pattern && t(l.message, n, {}, i), l.enum && Array.isArray(l.enum) && a.enum) {
|
|
176
|
+
const o = l.enum.join(", ");
|
|
177
|
+
t(a.enum, n, { enum: o }, i);
|
|
178
|
+
}
|
|
179
|
+
}, t = (n, l, i, u) => {
|
|
180
|
+
if (n)
|
|
181
|
+
try {
|
|
182
|
+
let c;
|
|
183
|
+
if (typeof n == "function") {
|
|
184
|
+
const o = [l];
|
|
185
|
+
for (const f in i)
|
|
186
|
+
o.push(i[f]);
|
|
187
|
+
c = n.apply(null, o), c && u.push(c);
|
|
188
|
+
} else {
|
|
189
|
+
c = String(n);
|
|
190
|
+
for (const o in i)
|
|
191
|
+
c = c.replace(new RegExp(`\\$\\{${o}\\}`, "g"), i[o]);
|
|
192
|
+
c = c.replace(/\$\{label\}/g, ""), c && u.push(c);
|
|
193
|
+
}
|
|
194
|
+
} catch (c) {
|
|
195
|
+
console.error("格式化验证消息出错:", c);
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
return Object.keys(e).forEach((n) => {
|
|
199
|
+
const l = e[n], i = [];
|
|
200
|
+
try {
|
|
201
|
+
s(n, l, i), Array.isArray(l) && l.forEach((c) => {
|
|
202
|
+
c && typeof c == "object" && s(n, c, i);
|
|
203
|
+
}), l && typeof l == "object" && "fields" in l;
|
|
204
|
+
} catch (c) {
|
|
205
|
+
console.error("处理验证规则出错:", c);
|
|
206
|
+
}
|
|
207
|
+
const u = Array.from(new Set(i));
|
|
208
|
+
n && u.length > 0 && r.push({
|
|
209
|
+
field: n,
|
|
210
|
+
rules: u
|
|
211
|
+
});
|
|
212
|
+
}), r;
|
|
213
|
+
}, ee = async (e) => {
|
|
214
|
+
const r = e.formData.value, a = e.formRules.value;
|
|
215
|
+
y(a) || (D(e), e.ruleValidator || (e.ruleValidator = new F({}), e.ruleValidator.messages(w.messages()), e.ruleValidator.define(a)), e.ruleResults.value = await e.ruleValidator.validate(r).then(() => {
|
|
216
|
+
}).catch(({ fields: s }) => s));
|
|
217
|
+
}, D = (e) => {
|
|
218
|
+
e.ruleResults.value = void 0;
|
|
219
|
+
}, re = () => {
|
|
220
|
+
const e = h(m.EditorControl, void 0), r = g(h(m.LabelText, "")), a = g(h(m.RuleKey, "")), s = h(m.ErrInfo, void 0);
|
|
221
|
+
return {
|
|
222
|
+
editorCtrl: e,
|
|
223
|
+
labelText: r,
|
|
224
|
+
ruleKey: a,
|
|
225
|
+
errInfo: s
|
|
226
|
+
};
|
|
227
|
+
}, L = (e, r) => {
|
|
228
|
+
let a = g({
|
|
229
|
+
msg: "",
|
|
230
|
+
errClass: ""
|
|
231
|
+
});
|
|
232
|
+
if (!e.label || !e.rule)
|
|
233
|
+
return a;
|
|
234
|
+
const s = r == null ? void 0 : r.ruleResults;
|
|
235
|
+
return j(
|
|
236
|
+
() => s == null ? void 0 : s.value,
|
|
237
|
+
(t) => {
|
|
238
|
+
if (a.value.errClass = "", a.value.msg = "", !y(t)) {
|
|
239
|
+
const n = q(
|
|
240
|
+
{
|
|
241
|
+
label: e.label,
|
|
242
|
+
rule: e.rule
|
|
243
|
+
},
|
|
244
|
+
r == null ? void 0 : r.formRules.value,
|
|
245
|
+
K(t)
|
|
246
|
+
);
|
|
247
|
+
a.value.errClass = n.errClass.value, a.value.msg = n.msg.value;
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
{ deep: !0 }
|
|
251
|
+
), a;
|
|
252
|
+
}, q = (e, r, a) => {
|
|
253
|
+
const s = g([]), t = g(""), n = g("");
|
|
254
|
+
if (!e.rule || !r || !a)
|
|
255
|
+
return { msg: t, ruleErrors: s, errClass: n };
|
|
256
|
+
e.rule.split("|").forEach((u) => {
|
|
257
|
+
if (u = u.trim(), u)
|
|
258
|
+
if (a[u])
|
|
259
|
+
s.value.push(...a[u]);
|
|
260
|
+
else {
|
|
261
|
+
const c = [];
|
|
262
|
+
for (let o in a)
|
|
263
|
+
o !== u && o.startsWith(u + ".") && c.push(...a[o]);
|
|
264
|
+
c.length > 0 && s.value.push(...c);
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
const i = /\${\w+}/g;
|
|
268
|
+
return s.value.forEach((u) => {
|
|
269
|
+
t.value && (t.value += " / "), t.value += u.message.replace("${label}", e.label ?? "");
|
|
270
|
+
const c = r[u.field];
|
|
271
|
+
if (c) {
|
|
272
|
+
const o = t.value.match(i);
|
|
273
|
+
o && o.forEach((f) => {
|
|
274
|
+
const v = f.replace("${", "").replace("}", "");
|
|
275
|
+
t.value = t.value.replace(f, c[v] ?? "");
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
}), s.value.length > 0 && (n.value = "error"), { msg: t, ruleErrors: s, errClass: n };
|
|
279
|
+
}, ae = (e, r) => {
|
|
280
|
+
S(m.LabelText, e.label || ""), S(m.RuleKey, e.rule || "");
|
|
281
|
+
const a = L(e, r);
|
|
282
|
+
return S(m.ErrInfo, a), a;
|
|
283
|
+
};
|
|
284
|
+
export {
|
|
285
|
+
m as P,
|
|
286
|
+
W as _,
|
|
287
|
+
re as a,
|
|
288
|
+
X as b,
|
|
289
|
+
Y as c,
|
|
290
|
+
H as d,
|
|
291
|
+
ee as f,
|
|
292
|
+
Z as g,
|
|
293
|
+
y as i,
|
|
294
|
+
D as r,
|
|
295
|
+
ae as u,
|
|
296
|
+
w as v
|
|
297
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { defineComponent as A, provide as B, ref as S, watch as p, onMounted as F, createBlock as n, openBlock as r, unref as a, withCtx as l, createElementVNode as N, renderSlot as b, createVNode as V, createCommentVNode as d, createTextVNode as m, toDisplayString as u } from "vue";
|
|
2
|
+
import { P as E, _ as f } from "./form-validate-CgX7aR7T.js";
|
|
3
|
+
import { Modal as M, Space as P } from "ant-design-vue";
|
|
4
|
+
import "@skyfox2000/fapi";
|
|
5
|
+
import "./settingInfo-BZakNKIN.js";
|
|
6
|
+
import "@skyfox2000/microbase";
|
|
7
|
+
import "vue-m-message";
|
|
8
|
+
import "async-validator";
|
|
9
|
+
import { o as $, b as D, a as K } from "./index-DQMdt51R.js";
|
|
10
|
+
import "dayjs";
|
|
11
|
+
import "./index-DmWrkTXX.js";
|
|
12
|
+
const U = { class: "overflow-y-auto w-full h-full" }, W = /* @__PURE__ */ A({
|
|
13
|
+
__name: "index",
|
|
14
|
+
props: {
|
|
15
|
+
saveText: {},
|
|
16
|
+
saveAsText: {},
|
|
17
|
+
cancelText: {},
|
|
18
|
+
editorCtrl: {},
|
|
19
|
+
dialogSave: { type: Function },
|
|
20
|
+
width: {},
|
|
21
|
+
full: { type: Boolean },
|
|
22
|
+
open: { type: Boolean }
|
|
23
|
+
},
|
|
24
|
+
emits: ["update:open"],
|
|
25
|
+
setup(C, { emit: T }) {
|
|
26
|
+
const i = C, e = i.editorCtrl;
|
|
27
|
+
B(E.EditorControl, e);
|
|
28
|
+
const t = S(i.open ?? !1), h = T, k = S(i.width ?? 430);
|
|
29
|
+
p(
|
|
30
|
+
() => e == null ? void 0 : e.visible.value,
|
|
31
|
+
(o) => {
|
|
32
|
+
t.value = o ?? !1;
|
|
33
|
+
}
|
|
34
|
+
), p(
|
|
35
|
+
() => i.open,
|
|
36
|
+
(o) => {
|
|
37
|
+
t.value = o;
|
|
38
|
+
}
|
|
39
|
+
), p(
|
|
40
|
+
() => t.value,
|
|
41
|
+
(o) => {
|
|
42
|
+
h("update:open", o), o || v();
|
|
43
|
+
}
|
|
44
|
+
), F(() => {
|
|
45
|
+
t.value = (e == null ? void 0 : e.visible.value) ?? !1;
|
|
46
|
+
});
|
|
47
|
+
const x = () => {
|
|
48
|
+
i.dialogSave || e && D(e);
|
|
49
|
+
}, _ = () => {
|
|
50
|
+
e && K(e);
|
|
51
|
+
}, v = () => {
|
|
52
|
+
e ? $(e) : t.value = !1;
|
|
53
|
+
};
|
|
54
|
+
return (o, c) => (r(), n(a(M), {
|
|
55
|
+
open: t.value,
|
|
56
|
+
"onUpdate:open": c[0] || (c[0] = (s) => t.value = s),
|
|
57
|
+
wrapClassName: "modal mx-auto min-w-[430px] " + (o.full ? "full-modal w-full" : ""),
|
|
58
|
+
width: k.value
|
|
59
|
+
}, {
|
|
60
|
+
footer: l(() => [
|
|
61
|
+
V(a(P), null, {
|
|
62
|
+
default: l(() => {
|
|
63
|
+
var s, y, g, w;
|
|
64
|
+
return [
|
|
65
|
+
o.cancelText !== "" ? (r(), n(a(f), {
|
|
66
|
+
key: 0,
|
|
67
|
+
onClick: v
|
|
68
|
+
}, {
|
|
69
|
+
default: l(() => [
|
|
70
|
+
m(u(o.cancelText ?? "取消"), 1)
|
|
71
|
+
]),
|
|
72
|
+
_: 1
|
|
73
|
+
})) : d("", !0),
|
|
74
|
+
o.saveAsText !== "" && ((s = a(e)) == null ? void 0 : s.saveAsBtnVisible) !== !1 ? (r(), n(a(f), {
|
|
75
|
+
key: 1,
|
|
76
|
+
onClick: _,
|
|
77
|
+
type: "primary",
|
|
78
|
+
loading: (y = a(e)) == null ? void 0 : y.isFormSaving.value
|
|
79
|
+
}, {
|
|
80
|
+
default: l(() => [
|
|
81
|
+
m(u(o.saveAsText ?? "另存为"), 1)
|
|
82
|
+
]),
|
|
83
|
+
_: 1
|
|
84
|
+
}, 8, ["loading"])) : d("", !0),
|
|
85
|
+
o.saveText !== "" && ((g = a(e)) == null ? void 0 : g.saveBtnVisible) !== !1 ? (r(), n(a(f), {
|
|
86
|
+
key: 2,
|
|
87
|
+
onClick: x,
|
|
88
|
+
type: "primary",
|
|
89
|
+
loading: (w = a(e)) == null ? void 0 : w.isFormSaving.value
|
|
90
|
+
}, {
|
|
91
|
+
default: l(() => [
|
|
92
|
+
m(u(o.saveText ?? "保存"), 1)
|
|
93
|
+
]),
|
|
94
|
+
_: 1
|
|
95
|
+
}, 8, ["loading"])) : d("", !0)
|
|
96
|
+
];
|
|
97
|
+
}),
|
|
98
|
+
_: 1
|
|
99
|
+
})
|
|
100
|
+
]),
|
|
101
|
+
default: l(() => [
|
|
102
|
+
N("div", U, [
|
|
103
|
+
b(o.$slots, "default")
|
|
104
|
+
])
|
|
105
|
+
]),
|
|
106
|
+
_: 3
|
|
107
|
+
}, 8, ["open", "wrapClassName", "width"]));
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
export {
|
|
111
|
+
W as _
|
|
112
|
+
};
|