ss-component-new 1.3.659 → 1.3.660

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.
@@ -0,0 +1,1042 @@
1
+ import { createElementBlock as D, openBlock as $, createElementVNode as l, renderSlot as R, defineComponent as W, ref as C, resolveComponent as w, createVNode as t, withCtx as o, unref as O, reactive as se, computed as G, onMounted as fe, createBlock as J, resolveDirective as Ue, createCommentVNode as oe, withDirectives as ke, normalizeClass as ne, toDisplayString as x, Transition as Ve, watch as j, Fragment as Le, createTextVNode as M, onBeforeUnmount as $e } from "vue";
2
+ import { _ as H, u as te, p as ee, s as le, c as Ie, d as Fe, f as qe, e as ie, E as re, h as ve, i as Ae, b as De, l as xe, j as Re, v as Ne } from "./_plugin-vue_export-helper-BZ_eTSzz.js";
3
+ import { _ as Y } from "./index.vue_vue_type_script_setup_true_lang-DRzriV-s.js";
4
+ import { useRouter as Se } from "vue-router";
5
+ import { l as Ee } from "./index-p2dYw5GI.js";
6
+ const Me = {}, Pe = { class: "left-wrap" }, Be = { class: "left-bg" };
7
+ function Oe(f, U) {
8
+ return $(), D("div", Pe, [
9
+ l("div", Be, [
10
+ R(f.$slots, "img", {}, void 0, !0)
11
+ ])
12
+ ]);
13
+ }
14
+ const je = /* @__PURE__ */ H(Me, [["render", Oe], ["__scopeId", "data-v-b3dd4a82"]]), Z = {
15
+ ACCOUNT: "account",
16
+ FACE: "face"
17
+ }, He = { class: "right-wrap" }, Ke = { class: "tab-content" }, ze = { class: "tab-tips" }, Qe = { class: "tab-content" }, We = { class: "tab-tips" }, Xe = /* @__PURE__ */ W({
18
+ __name: "index",
19
+ props: {
20
+ tabList: {
21
+ type: Array,
22
+ default: []
23
+ },
24
+ loading: {
25
+ type: Boolean,
26
+ default: !1
27
+ }
28
+ },
29
+ emits: ["clickLogin", "handleTabChange"],
30
+ setup(f, { emit: U }) {
31
+ const g = C(Z.ACCOUNT), p = U, V = () => {
32
+ p("clickLogin", g.value);
33
+ }, e = (_) => {
34
+ p("handleTabChange", _);
35
+ };
36
+ return (_, T) => {
37
+ const v = w("el-button"), m = w("el-tab-pane"), y = w("el-tabs");
38
+ return $(), D("div", He, [
39
+ t(y, {
40
+ modelValue: g.value,
41
+ "onUpdate:modelValue": T[0] || (T[0] = (b) => g.value = b),
42
+ class: "right-tabs",
43
+ onTabChange: e
44
+ }, {
45
+ default: o(() => [
46
+ t(m, {
47
+ name: O(Z).ACCOUNT
48
+ }, {
49
+ label: o(() => [
50
+ R(_.$slots, "tabLabel1", {}, void 0, !0)
51
+ ]),
52
+ default: o(() => [
53
+ l("div", Ke, [
54
+ R(_.$slots, "tabContent1", {}, void 0, !0)
55
+ ]),
56
+ l("div", {
57
+ class: "tab-button special",
58
+ onClick: V
59
+ }, [
60
+ t(v, { loading: f.loading }, {
61
+ default: o(() => [
62
+ R(_.$slots, "tabButton1", {}, void 0, !0)
63
+ ]),
64
+ _: 3
65
+ }, 8, ["loading"])
66
+ ]),
67
+ l("div", ze, [
68
+ R(_.$slots, "tabTips1", {}, void 0, !0)
69
+ ])
70
+ ]),
71
+ _: 3
72
+ }, 8, ["name"]),
73
+ t(m, {
74
+ name: O(Z).FACE
75
+ }, {
76
+ label: o(() => [
77
+ R(_.$slots, "tabLabel2", {}, void 0, !0)
78
+ ]),
79
+ default: o(() => [
80
+ l("div", Qe, [
81
+ R(_.$slots, "tabContent2", {}, void 0, !0)
82
+ ]),
83
+ l("div", We, [
84
+ R(_.$slots, "tabTips2", {}, void 0, !0)
85
+ ])
86
+ ]),
87
+ _: 3
88
+ }, 8, ["name"])
89
+ ]),
90
+ _: 3
91
+ }, 8, ["modelValue"])
92
+ ]);
93
+ };
94
+ }
95
+ }), Ge = /* @__PURE__ */ H(Xe, [["__scopeId", "data-v-57780a32"]]), Je = /^[a-z][a-z0-9+.-]*:\/\//i, ce = (f) => Je.test(f);
96
+ function Ye(f) {
97
+ ce(f) || (f = `http://${f}`);
98
+ try {
99
+ const U = new URL(f);
100
+ return {
101
+ host: U.hostname,
102
+ // 域名:example.com
103
+ port: U.port || null
104
+ // 端口:8080(默认端口返回空字符串,转为 null)
105
+ };
106
+ } catch {
107
+ return {
108
+ host: null,
109
+ port: null
110
+ };
111
+ }
112
+ }
113
+ const Ze = () => ({ initUrlInfo: () => ({
114
+ host: null,
115
+ port: null
116
+ }), hasProtocol: ce, generateUrl: (g) => {
117
+ const { host: p, port: V } = g;
118
+ if (!p)
119
+ return null;
120
+ let e = `${p}`;
121
+ return ce(p) || (e = `http://${e}`), V && (e = `${e}:${V}`), e;
122
+ } }), et = { class: "body-wrapper" }, tt = { class: "api-form-wrapper" }, at = { class: "edit-footer" }, ot = { class: "footer-right" }, st = /* @__PURE__ */ W({
123
+ __name: "index",
124
+ emits: ["updateApiUrl"],
125
+ setup(f, { expose: U, emit: g }) {
126
+ const p = g, V = te(ee), { systemUrl: e } = le(V), { initUrlInfo: _, generateUrl: T } = Ze(), v = C(_()), m = C(), y = se({
127
+ host: [
128
+ { required: !0, message: "请输入职位名称", trigger: "blur" }
129
+ ]
130
+ }), b = G(() => e.value || "http://192.168.124.24:6007"), n = () => {
131
+ v.value = Ye(b.value);
132
+ };
133
+ fe(() => {
134
+ n();
135
+ });
136
+ const a = C(!1), i = () => {
137
+ n(), a.value = !0;
138
+ }, c = () => {
139
+ a.value = !1;
140
+ }, u = () => {
141
+ c();
142
+ }, I = async () => {
143
+ var d;
144
+ await ((d = m.value) == null ? void 0 : d.validate());
145
+ const L = T(v.value);
146
+ p("updateApiUrl", L), u();
147
+ };
148
+ return U({
149
+ openDialog: i,
150
+ handleClose: u
151
+ }), (L, d) => {
152
+ const r = w("el-input"), k = w("el-form-item"), q = w("el-col"), N = w("el-row"), K = w("el-form"), X = w("el-dialog");
153
+ return $(), J(X, {
154
+ class: "api-form-dialog",
155
+ modelValue: a.value,
156
+ "onUpdate:modelValue": d[2] || (d[2] = (E) => a.value = E),
157
+ "before-close": u,
158
+ "destroy-on-close": "",
159
+ "show-close": !1
160
+ }, {
161
+ header: o(() => d[3] || (d[3] = [])),
162
+ default: o(() => [
163
+ l("div", et, [
164
+ l("div", tt, [
165
+ t(K, {
166
+ class: "api-edit-form",
167
+ ref_key: "apiFormRef",
168
+ ref: m,
169
+ model: v.value,
170
+ rules: y
171
+ }, {
172
+ default: o(() => [
173
+ t(N, { gutter: 20 }, {
174
+ default: o(() => [
175
+ t(q, { span: 12 }, {
176
+ default: o(() => [
177
+ t(k, {
178
+ prop: "host",
179
+ label: "主机名",
180
+ "label-position": "top"
181
+ }, {
182
+ default: o(() => [
183
+ t(r, {
184
+ modelValue: v.value.host,
185
+ "onUpdate:modelValue": d[0] || (d[0] = (E) => v.value.host = E),
186
+ "aria-label": "主机名",
187
+ placeholder: "主机名"
188
+ }, null, 8, ["modelValue"])
189
+ ]),
190
+ _: 1
191
+ })
192
+ ]),
193
+ _: 1
194
+ }),
195
+ t(q, { span: 12 }, {
196
+ default: o(() => [
197
+ t(k, {
198
+ prop: "port",
199
+ label: "端口",
200
+ "label-position": "top"
201
+ }, {
202
+ default: o(() => [
203
+ t(r, {
204
+ modelValue: v.value.port,
205
+ "onUpdate:modelValue": d[1] || (d[1] = (E) => v.value.port = E),
206
+ "aria-label": "端口",
207
+ placeholder: "端口"
208
+ }, null, 8, ["modelValue"])
209
+ ]),
210
+ _: 1
211
+ })
212
+ ]),
213
+ _: 1
214
+ })
215
+ ]),
216
+ _: 1
217
+ })
218
+ ]),
219
+ _: 1
220
+ }, 8, ["model", "rules"])
221
+ ])
222
+ ])
223
+ ]),
224
+ footer: o(() => [
225
+ l("div", at, [
226
+ d[4] || (d[4] = l("div", { class: "footer-left" }, null, -1)),
227
+ l("div", ot, [
228
+ t(Y, {
229
+ class: "cancel",
230
+ emptyColor: !0,
231
+ onClickTrigger: u,
232
+ modelValue: "取消",
233
+ buttonType: "info"
234
+ }),
235
+ t(Y, {
236
+ class: "confirm",
237
+ emptyColor: !0,
238
+ onClickTrigger: I,
239
+ modelValue: "确定",
240
+ buttonType: "primary"
241
+ })
242
+ ])
243
+ ])
244
+ ]),
245
+ _: 1
246
+ }, 8, ["modelValue"]);
247
+ };
248
+ }
249
+ }), lt = /* @__PURE__ */ H(st, [["__scopeId", "data-v-a0901fa1"]]), nt = { class: "dialog-header" }, it = { class: "dialog-subtitle" }, rt = {
250
+ key: 0,
251
+ class: "restart-panel"
252
+ }, ct = { class: "restart-title" }, ut = { class: "restart-subtitle" }, dt = {
253
+ key: 1,
254
+ class: "dialog-body"
255
+ }, pt = { class: "db-type-selector" }, mt = { key: "sqlite" }, ft = { key: "pgsql" }, vt = {
256
+ key: 0,
257
+ class: "dialog-footer"
258
+ }, gt = 6e4, me = 2e3, _t = /* @__PURE__ */ W({
259
+ __name: "index",
260
+ setup(f, { expose: U }) {
261
+ const g = te(ee), { systemUrl: p } = le(g), V = G(() => p.value || "http://192.168.124.24:6007"), e = se({
262
+ databaseType: "sqlite",
263
+ sqliteDir: "sqlite-data",
264
+ user: "",
265
+ host: "",
266
+ database: "",
267
+ password: "",
268
+ port: "5432"
269
+ }), _ = G(() => e.databaseType === "sqlite" ? {
270
+ sqliteDir: [{ required: !0, message: "请输入数据库目录", trigger: "blur" }]
271
+ } : {
272
+ host: [{ required: !0, message: "请输入主机地址", trigger: "blur" }],
273
+ port: [{ required: !0, message: "请输入端口号", trigger: "blur" }],
274
+ database: [{ required: !0, message: "请输入数据库名", trigger: "blur" }],
275
+ user: [{ required: !0, message: "请输入用户名", trigger: "blur" }]
276
+ }), T = C(null), v = C(!1), m = C(!1), y = C(!1), b = C(!1), n = C(0), a = C("running"), i = C(1);
277
+ let c = null;
278
+ const u = G(() => a.value === "success" ? "重启成功!" : a.value === "timeout" ? "连接超时" : "正在应用配置并等待服务重新启动中..."), I = G(() => a.value === "success" ? "服务已恢复,配置已生效" : a.value === "timeout" ? "超过最大等待时间,请手动检查服务状态" : "请稍后" + ".".repeat(i.value));
279
+ let L = null, d = null;
280
+ const r = () => {
281
+ c && (clearInterval(c), c = null);
282
+ }, k = () => {
283
+ L && (clearInterval(L), L = null), d && (clearInterval(d), d = null), r();
284
+ }, q = () => {
285
+ n.value = 0;
286
+ let h = 0;
287
+ L = setInterval(() => {
288
+ h += 100;
289
+ const s = 90 * (1 - Math.exp(-h / 8e3));
290
+ n.value = Math.min(parseFloat(s.toFixed(1)), 90);
291
+ }, 100);
292
+ }, N = () => {
293
+ i.value = 1, c = setInterval(() => {
294
+ i.value = i.value >= 3 ? 1 : i.value + 1;
295
+ }, 500);
296
+ }, K = () => {
297
+ r();
298
+ const h = setInterval(() => {
299
+ n.value = Math.min(n.value + 3, 100), n.value >= 100 && (clearInterval(h), a.value = "success");
300
+ }, 30);
301
+ }, X = () => {
302
+ let h = 0;
303
+ d = setInterval(async () => {
304
+ if (h += me, h >= gt) {
305
+ k(), a.value = "timeout";
306
+ return;
307
+ }
308
+ try {
309
+ const { data: s } = await ie.get(V.value + "/platform/config/db", { timeout: 3e3 });
310
+ (s == null ? void 0 : s.code) === 200 && (k(), K());
311
+ } catch {
312
+ }
313
+ }, me);
314
+ }, E = async () => {
315
+ try {
316
+ m.value = !0;
317
+ const { data: h } = await ie.get(V.value + "/platform/config/db");
318
+ if ((h == null ? void 0 : h.code) === 200 && (h != null && h.data)) {
319
+ const s = h.data;
320
+ e.databaseType = s.databaseType === "pgsql" ? "pgsql" : "sqlite", e.sqliteDir = s.sqliteDir || "sqlite-data", e.user = s.user || "", e.host = s.host || "", e.database = s.database || "", e.password = s.password || "", e.port = String(s.port || 5432);
321
+ }
322
+ } catch {
323
+ } finally {
324
+ m.value = !1;
325
+ }
326
+ }, be = () => {
327
+ b.value = !1, a.value = "running", n.value = 0, i.value = 1, v.value = !0, E();
328
+ }, ue = () => {
329
+ k(), v.value = !1;
330
+ }, de = () => ue(), ye = (h) => {
331
+ b.value || h();
332
+ }, he = async () => {
333
+ var h, s, z;
334
+ await ((h = T.value) == null ? void 0 : h.validate());
335
+ try {
336
+ y.value = !0;
337
+ const A = { databaseType: e.databaseType };
338
+ e.databaseType === "sqlite" ? A.sqliteDir = e.sqliteDir.trim() : (A.user = e.user.trim(), A.host = e.host.trim(), A.database = e.database.trim(), A.password = e.password, A.port = Number(e.port)), await ie.post(V.value + "/platform/config/db", A), b.value = !0, a.value = "running", q(), N(), setTimeout(X, 1e3);
339
+ } catch (A) {
340
+ const S = ((z = (s = A == null ? void 0 : A.response) == null ? void 0 : s.data) == null ? void 0 : z.message) || "保存失败,请重试";
341
+ re.error(S);
342
+ } finally {
343
+ y.value = !1;
344
+ }
345
+ };
346
+ return U({ openDialog: be, handleClose: de }), (h, s) => {
347
+ const z = w("el-icon"), A = w("el-progress"), S = w("el-input"), Q = w("el-form-item"), ae = w("el-col"), pe = w("el-row"), Ce = w("el-form"), we = w("el-dialog"), Te = Ue("loading");
348
+ return $(), J(we, {
349
+ class: "db-config-dialog",
350
+ modelValue: v.value,
351
+ "onUpdate:modelValue": s[8] || (s[8] = (F) => v.value = F),
352
+ "before-close": ye,
353
+ "close-on-click-modal": !b.value,
354
+ "close-on-press-escape": !b.value,
355
+ "destroy-on-close": "",
356
+ "show-close": !1,
357
+ width: "480px"
358
+ }, {
359
+ header: o(() => [
360
+ l("div", nt, [
361
+ s[9] || (s[9] = l("span", { class: "dialog-title" }, "数据库配置", -1)),
362
+ l("span", it, x(b.value ? "" : "修改后服务将自动重启"), 1)
363
+ ])
364
+ ]),
365
+ default: o(() => [
366
+ b.value ? ($(), D("div", rt, [
367
+ a.value !== "running" ? ($(), D("div", {
368
+ key: 0,
369
+ class: ne(["restart-icon-wrap", { success: a.value === "success", error: a.value === "timeout" }])
370
+ }, [
371
+ a.value === "success" ? ($(), J(z, {
372
+ key: 0,
373
+ class: "restart-icon"
374
+ }, {
375
+ default: o(() => [
376
+ t(O(Ie))
377
+ ]),
378
+ _: 1
379
+ })) : ($(), J(z, {
380
+ key: 1,
381
+ class: "restart-icon"
382
+ }, {
383
+ default: o(() => [
384
+ t(O(Fe))
385
+ ]),
386
+ _: 1
387
+ }))
388
+ ], 2)) : oe("", !0),
389
+ l("div", ct, x(u.value), 1),
390
+ l("div", ut, x(I.value), 1),
391
+ t(A, {
392
+ class: "restart-progress",
393
+ percentage: Math.round(n.value),
394
+ status: a.value === "success" ? "success" : a.value === "timeout" ? "exception" : "",
395
+ "stroke-width": 10
396
+ }, null, 8, ["percentage", "status"]),
397
+ a.value === "success" || a.value === "timeout" ? ($(), J(Y, {
398
+ key: 1,
399
+ class: "restart-close-btn",
400
+ emptyColor: !0,
401
+ onClickTrigger: ue,
402
+ modelValue: a.value === "success" ? "确定" : "关闭",
403
+ buttonType: a.value === "success" ? "primary" : "info"
404
+ }, null, 8, ["modelValue", "buttonType"])) : oe("", !0)
405
+ ])) : ke(($(), D("div", dt, [
406
+ l("div", pt, [
407
+ l("div", {
408
+ class: ne(["db-type-card", { active: e.databaseType === "sqlite" }]),
409
+ onClick: s[0] || (s[0] = (F) => e.databaseType = "sqlite")
410
+ }, s[10] || (s[10] = [
411
+ l("span", { class: "db-label" }, "SQLite", -1),
412
+ l("span", { class: "db-desc" }, "本地文件数据库", -1)
413
+ ]), 2),
414
+ l("div", {
415
+ class: ne(["db-type-card", { active: e.databaseType === "pgsql" }]),
416
+ onClick: s[1] || (s[1] = (F) => e.databaseType = "pgsql")
417
+ }, s[11] || (s[11] = [
418
+ l("span", { class: "db-label" }, "PostgreSQL", -1),
419
+ l("span", { class: "db-desc" }, "远程关系型数据库", -1)
420
+ ]), 2)
421
+ ]),
422
+ t(Ce, {
423
+ ref_key: "formRef",
424
+ ref: T,
425
+ model: e,
426
+ rules: _.value,
427
+ "label-position": "top",
428
+ class: "config-form"
429
+ }, {
430
+ default: o(() => [
431
+ t(Ve, {
432
+ name: "fade-slide",
433
+ mode: "out-in"
434
+ }, {
435
+ default: o(() => [
436
+ e.databaseType === "sqlite" ? ($(), D("div", mt, [
437
+ t(Q, {
438
+ label: "数据库目录",
439
+ prop: "sqliteDir"
440
+ }, {
441
+ default: o(() => [
442
+ t(S, {
443
+ modelValue: e.sqliteDir,
444
+ "onUpdate:modelValue": s[2] || (s[2] = (F) => e.sqliteDir = F),
445
+ placeholder: "例如:sqlite-data",
446
+ clearable: ""
447
+ }, {
448
+ prefix: o(() => [
449
+ t(z, null, {
450
+ default: o(() => [
451
+ t(O(qe))
452
+ ]),
453
+ _: 1
454
+ })
455
+ ]),
456
+ _: 1
457
+ }, 8, ["modelValue"]),
458
+ s[12] || (s[12] = l("div", { class: "field-hint" }, "相对于后端 exe 所在目录的路径", -1))
459
+ ]),
460
+ _: 1,
461
+ __: [12]
462
+ })
463
+ ])) : ($(), D("div", ft, [
464
+ t(pe, { gutter: 16 }, {
465
+ default: o(() => [
466
+ t(ae, { span: 16 }, {
467
+ default: o(() => [
468
+ t(Q, {
469
+ label: "主机地址",
470
+ prop: "host"
471
+ }, {
472
+ default: o(() => [
473
+ t(S, {
474
+ modelValue: e.host,
475
+ "onUpdate:modelValue": s[3] || (s[3] = (F) => e.host = F),
476
+ placeholder: "127.0.0.1",
477
+ clearable: ""
478
+ }, null, 8, ["modelValue"])
479
+ ]),
480
+ _: 1
481
+ })
482
+ ]),
483
+ _: 1
484
+ }),
485
+ t(ae, { span: 8 }, {
486
+ default: o(() => [
487
+ t(Q, {
488
+ label: "端口",
489
+ prop: "port"
490
+ }, {
491
+ default: o(() => [
492
+ t(S, {
493
+ modelValue: e.port,
494
+ "onUpdate:modelValue": s[4] || (s[4] = (F) => e.port = F),
495
+ placeholder: "5432",
496
+ clearable: ""
497
+ }, null, 8, ["modelValue"])
498
+ ]),
499
+ _: 1
500
+ })
501
+ ]),
502
+ _: 1
503
+ })
504
+ ]),
505
+ _: 1
506
+ }),
507
+ t(Q, {
508
+ label: "数据库名",
509
+ prop: "database"
510
+ }, {
511
+ default: o(() => [
512
+ t(S, {
513
+ modelValue: e.database,
514
+ "onUpdate:modelValue": s[5] || (s[5] = (F) => e.database = F),
515
+ placeholder: "new_insofworks_admin",
516
+ clearable: ""
517
+ }, null, 8, ["modelValue"])
518
+ ]),
519
+ _: 1
520
+ }),
521
+ t(pe, { gutter: 16 }, {
522
+ default: o(() => [
523
+ t(ae, { span: 12 }, {
524
+ default: o(() => [
525
+ t(Q, {
526
+ label: "用户名",
527
+ prop: "user"
528
+ }, {
529
+ default: o(() => [
530
+ t(S, {
531
+ modelValue: e.user,
532
+ "onUpdate:modelValue": s[6] || (s[6] = (F) => e.user = F),
533
+ placeholder: "postgres",
534
+ clearable: ""
535
+ }, null, 8, ["modelValue"])
536
+ ]),
537
+ _: 1
538
+ })
539
+ ]),
540
+ _: 1
541
+ }),
542
+ t(ae, { span: 12 }, {
543
+ default: o(() => [
544
+ t(Q, {
545
+ label: "密码",
546
+ prop: "password"
547
+ }, {
548
+ default: o(() => [
549
+ t(S, {
550
+ modelValue: e.password,
551
+ "onUpdate:modelValue": s[7] || (s[7] = (F) => e.password = F),
552
+ type: "password",
553
+ "show-password": "",
554
+ clearable: ""
555
+ }, null, 8, ["modelValue"])
556
+ ]),
557
+ _: 1
558
+ })
559
+ ]),
560
+ _: 1
561
+ })
562
+ ]),
563
+ _: 1
564
+ })
565
+ ]))
566
+ ]),
567
+ _: 1
568
+ })
569
+ ]),
570
+ _: 1
571
+ }, 8, ["model", "rules"])
572
+ ])), [
573
+ [Te, m.value]
574
+ ])
575
+ ]),
576
+ footer: o(() => [
577
+ b.value ? oe("", !0) : ($(), D("div", vt, [
578
+ t(Y, {
579
+ emptyColor: !0,
580
+ onClickTrigger: de,
581
+ modelValue: "取消",
582
+ buttonType: "info"
583
+ }),
584
+ t(Y, {
585
+ emptyColor: !0,
586
+ loading: y.value,
587
+ onClickTrigger: he,
588
+ modelValue: "保存并重启",
589
+ buttonType: "primary"
590
+ }, null, 8, ["loading"])
591
+ ]))
592
+ ]),
593
+ _: 1
594
+ }, 8, ["modelValue", "close-on-click-modal", "close-on-press-escape"]);
595
+ };
596
+ }
597
+ }), bt = /* @__PURE__ */ H(_t, [["__scopeId", "data-v-36cdd580"]]), yt = { class: "account-wrap" }, ht = { class: "extra-operate" }, Ct = /* @__PURE__ */ W({
598
+ __name: "index",
599
+ props: {
600
+ activeTabName: {
601
+ type: String,
602
+ default: ""
603
+ },
604
+ isClickLogin: {
605
+ type: Boolean,
606
+ default: !1
607
+ }
608
+ },
609
+ emits: ["handleLoginFormChange", "updateApiUrl"],
610
+ setup(f, { emit: U }) {
611
+ const g = f, p = se({
612
+ account: "",
613
+ password: ""
614
+ }), V = se({
615
+ account: [
616
+ { required: !0, message: "请输入账号", trigger: "blur" }
617
+ ],
618
+ password: [
619
+ { required: !0, message: "请输入密码", trigger: "blur" }
620
+ ]
621
+ }), e = C(null), _ = U;
622
+ j(() => g.isClickLogin, (n) => {
623
+ var a;
624
+ n && (g == null ? void 0 : g.activeTabName) === "account" && ((a = e.value) == null || a.validate((i) => {
625
+ var c;
626
+ for (let u in p)
627
+ p.hasOwnProperty(u) && (p[u] = (c = p[u]) == null ? void 0 : c.trim());
628
+ _("handleLoginFormChange", i, i ? p : null);
629
+ }));
630
+ }, {
631
+ immediate: !0
632
+ }), j(() => g.activeTabName, (n) => {
633
+ var a;
634
+ n === "account" && ((a = e.value) == null || a.resetFields());
635
+ });
636
+ const T = C(), v = () => {
637
+ var n, a;
638
+ (a = (n = T.value) == null ? void 0 : n.openDialog) == null || a.call(n);
639
+ }, m = (n) => {
640
+ _("updateApiUrl", n);
641
+ }, y = C(), b = () => {
642
+ var n, a;
643
+ (a = (n = y.value) == null ? void 0 : n.openDialog) == null || a.call(n);
644
+ };
645
+ return (n, a) => {
646
+ const i = w("svg-icon"), c = w("el-input"), u = w("el-form-item"), I = w("el-form"), L = w("el-link");
647
+ return $(), D(Le, null, [
648
+ l("div", yt, [
649
+ t(I, {
650
+ model: p,
651
+ rules: V,
652
+ ref_key: "formRef",
653
+ ref: e
654
+ }, {
655
+ default: o(() => [
656
+ t(u, {
657
+ label: "",
658
+ prop: "account"
659
+ }, {
660
+ default: o(() => [
661
+ t(c, {
662
+ class: "account-input",
663
+ modelValue: p.account,
664
+ "onUpdate:modelValue": a[0] || (a[0] = (d) => p.account = d),
665
+ placeholder: "请输入账号",
666
+ clearable: ""
667
+ }, {
668
+ prefix: o(() => [
669
+ t(i, {
670
+ name: "account",
671
+ style: { width: "15px", height: "15px" }
672
+ })
673
+ ]),
674
+ _: 1
675
+ }, 8, ["modelValue"])
676
+ ]),
677
+ _: 1
678
+ }),
679
+ t(u, {
680
+ label: "",
681
+ prop: "password"
682
+ }, {
683
+ default: o(() => [
684
+ t(c, {
685
+ class: "account-input",
686
+ modelValue: p.password,
687
+ "onUpdate:modelValue": a[1] || (a[1] = (d) => p.password = d),
688
+ type: "password",
689
+ placeholder: "请输入密码",
690
+ "show-password": "",
691
+ clearable: ""
692
+ }, {
693
+ prefix: o(() => [
694
+ t(i, {
695
+ name: "password",
696
+ style: { width: "15px", height: "15px" }
697
+ })
698
+ ]),
699
+ _: 1
700
+ }, 8, ["modelValue"])
701
+ ]),
702
+ _: 1
703
+ })
704
+ ]),
705
+ _: 1
706
+ }, 8, ["model", "rules"]),
707
+ l("div", ht, [
708
+ t(L, {
709
+ class: "api-button",
710
+ type: "primary",
711
+ onClick: v
712
+ }, {
713
+ default: o(() => a[2] || (a[2] = [
714
+ M("接口地址")
715
+ ])),
716
+ _: 1,
717
+ __: [2]
718
+ }),
719
+ t(L, {
720
+ class: "db-button",
721
+ type: "primary",
722
+ onClick: b
723
+ }, {
724
+ default: o(() => a[3] || (a[3] = [
725
+ M("数据库配置")
726
+ ])),
727
+ _: 1,
728
+ __: [3]
729
+ })
730
+ ])
731
+ ]),
732
+ t(lt, {
733
+ ref_key: "apiFormDialogRef",
734
+ ref: T,
735
+ onUpdateApiUrl: m
736
+ }, null, 512),
737
+ t(bt, {
738
+ ref_key: "dbConfigDialogRef",
739
+ ref: y
740
+ }, null, 512)
741
+ ], 64);
742
+ };
743
+ }
744
+ }), wt = /* @__PURE__ */ H(Ct, [["__scopeId", "data-v-7ec7eefc"]]), Tt = te(ee), { systemUrl: P, extraUrl: B } = le(Tt);
745
+ let ge = P.value === "" || !P.value ? "http://192.168.124.24:6007" : P.value, _e = B.value === "" || !B.value ? "http://139.196.154.85:20015" : B.value;
746
+ j(
747
+ () => P.value,
748
+ () => {
749
+ ge = P.value === "" || !P.value ? "http://192.168.124.24:6007" : P.value;
750
+ },
751
+ { deep: !0, immediate: !0 }
752
+ );
753
+ j(
754
+ () => B.value,
755
+ () => {
756
+ _e = B.value === "" || !B.value ? "http://139.196.154.85:20015" : B.value;
757
+ },
758
+ { deep: !0, immediate: !0 }
759
+ );
760
+ function Ut(f) {
761
+ return ve({
762
+ url: _e + "/api/face/face-verify",
763
+ method: "post",
764
+ data: f
765
+ });
766
+ }
767
+ function kt(f) {
768
+ return ve({
769
+ url: ge + "/platform/updatedata_faceURL",
770
+ method: "post",
771
+ data: f
772
+ });
773
+ }
774
+ const Vt = () => {
775
+ const f = te(), { platId: U, userName: g, account: p, isSuperAdmin: V } = Ae(), e = async (m) => {
776
+ if (!m)
777
+ return;
778
+ const y = new FormData();
779
+ y.set("file", m);
780
+ const b = f.systemInfo.plat_id;
781
+ return y.set("systemKey", b), await Ut(y);
782
+ };
783
+ return { updateFacePhoto: async (m) => {
784
+ const y = f.loginUserInfo, { password: b } = y || {}, n = {
785
+ platId: U.value,
786
+ userName: g.value,
787
+ password: b,
788
+ faceURL: m
789
+ };
790
+ V.value && (n.platId = ""), await kt(n);
791
+ }, initVerifySelf: async (m) => {
792
+ var u;
793
+ const y = await e(m), { account: b, password: n } = ((u = y == null ? void 0 : y.data) == null ? void 0 : u.data) || {};
794
+ if (!p)
795
+ return !1;
796
+ const a = f.loginUserInfo, { password: i } = a || {};
797
+ return b === p.value && n === i;
798
+ }, initVerify: async (m) => await e(m) };
799
+ }, Lt = { class: "account-wrap" }, $t = { class: "video-wrap" }, It = /* @__PURE__ */ W({
800
+ __name: "index",
801
+ props: {
802
+ systemKey: { default: "" },
803
+ activeTabName: { default: "" },
804
+ isClickLogin: { type: Boolean, default: !1 }
805
+ },
806
+ emits: ["handleLoginFormChange"],
807
+ setup(f, { emit: U }) {
808
+ const g = f, p = U, { initVerify: V } = Vt(), e = C(null), _ = C(null);
809
+ let T = !1, v = null;
810
+ const m = async (i) => {
811
+ if (!i)
812
+ return;
813
+ const c = await V(i), { data: u } = c || {}, { account: I, password: L } = (u == null ? void 0 : u.data) || {}, d = u == null ? void 0 : u.msg;
814
+ if (!I) {
815
+ re.warning(d || "识别失败,请重新识别!");
816
+ return;
817
+ }
818
+ p("handleLoginFormChange", !0, {
819
+ account: I,
820
+ password: L
821
+ });
822
+ }, y = () => {
823
+ if (!_.value || !e.value)
824
+ return;
825
+ const i = _.value, c = i.getContext("2d"), u = e.value;
826
+ i.width = 200, i.height = 200;
827
+ const I = u.videoWidth || 640, L = u.videoHeight || 480, d = Math.min(200 / I, 200 / L), r = I * d, k = L * d, q = (200 - r) / 2, N = (200 - k) / 2;
828
+ c == null || c.drawImage(u, 0, 0, I, L, q, N, r, k), i.toBlob((K) => {
829
+ if (K) {
830
+ const X = new File([K], "face.png", { type: "image/png" });
831
+ m(X);
832
+ }
833
+ }, "image/png");
834
+ }, b = async () => {
835
+ if (!e.value || T)
836
+ return;
837
+ const i = e.value;
838
+ try {
839
+ if (v = await navigator.mediaDevices.getUserMedia({
840
+ video: { facingMode: "user" },
841
+ // 前置;后置用 'environment'
842
+ audio: !1
843
+ }), i) {
844
+ const c = i;
845
+ c.srcObject = v, T = !0;
846
+ }
847
+ } catch {
848
+ re.warning("摄像头启动失败");
849
+ }
850
+ };
851
+ function n(i) {
852
+ if (i && (i.getTracks().forEach((c) => c.stop()), e.value)) {
853
+ const c = e.value;
854
+ c.srcObject = null;
855
+ }
856
+ }
857
+ const a = () => {
858
+ n(v), T = !1;
859
+ };
860
+ return j(() => g.activeTabName, (i) => {
861
+ if (i !== Z.FACE) {
862
+ a();
863
+ return;
864
+ }
865
+ if (i === Z.FACE && !T) {
866
+ b();
867
+ return;
868
+ }
869
+ }), $e(() => {
870
+ a();
871
+ }), (i, c) => ($(), D("div", Lt, [
872
+ l("div", $t, [
873
+ l("video", {
874
+ class: "face-video",
875
+ ref_key: "videoRef",
876
+ ref: e,
877
+ id: "v",
878
+ autoplay: "",
879
+ playsinline: ""
880
+ }, null, 512)
881
+ ]),
882
+ R(i.$slots, "default", {}, () => [
883
+ l("button", {
884
+ class: "face-screenshot",
885
+ onClick: y
886
+ }, "人脸识别")
887
+ ], !0),
888
+ l("canvas", {
889
+ ref_key: "canvasRef",
890
+ ref: _,
891
+ id: "canvas"
892
+ }, null, 512)
893
+ ]));
894
+ }
895
+ }), Ft = /* @__PURE__ */ H(It, [["__scopeId", "data-v-94ec015b"]]), qt = { class: "login-wrap" }, At = { class: "login-body" }, Dt = { class: "login-body-item left" }, xt = { class: "title" }, Rt = { class: "first-level" }, Nt = {
896
+ key: 0,
897
+ class: "logo"
898
+ }, St = ["src"], Et = { class: "english-name" }, Mt = { class: "login-body-item right" }, Pt = /* @__PURE__ */ W({
899
+ __name: "index",
900
+ props: {
901
+ oldSystemKey: {},
902
+ loginContent: {}
903
+ },
904
+ emits: ["change", "projectLogin", "updateApiUrl", "systemContent"],
905
+ setup(f, { emit: U }) {
906
+ const g = f, p = De(ee), V = te(ee), { systemInfo: e } = le(V), _ = C(""), T = C("account"), v = C(!1), m = C(!1), y = Se(), b = U, n = async (r) => {
907
+ const k = await Re({
908
+ url: r
909
+ });
910
+ return URL.createObjectURL(k == null ? void 0 : k.data);
911
+ };
912
+ j(() => {
913
+ var r;
914
+ return (r = e.value) == null ? void 0 : r.logo;
915
+ }, async (r) => {
916
+ r ? _.value = await n(r) : _.value = xe;
917
+ }, { immediate: !0 });
918
+ const a = C({
919
+ // sysCTitle: 'INSOFWORKS',
920
+ sysCTitle: "",
921
+ sysETitle: "",
922
+ // sysETitle: 'Dynamic Test Information System',
923
+ loginTitle: "账户密码登录",
924
+ tabs: [
925
+ {
926
+ name: "密码登录",
927
+ btnLabel: "登录",
928
+ tips: "温馨提示:建议使用谷歌、Microsoft Edge,版本79.0.1072.62及以上浏览器,360浏览器请使用极速模式"
929
+ },
930
+ {
931
+ name: "人脸识别",
932
+ btnLabel: "人脸识别",
933
+ tips: "温馨提示:建议使用谷歌、Microsoft Edge,版本79.0.1072.62及以上浏览器,360浏览器请使用极速模式"
934
+ },
935
+ {
936
+ name: "刷卡登录",
937
+ btnLabel: "登录",
938
+ tips: "温馨提示:建议使用谷歌、Microsoft Edge,版本79.0.1072.62及以上浏览器,360浏览器请使用极速模式"
939
+ }
940
+ ]
941
+ }), i = () => {
942
+ v.value = !0;
943
+ }, c = (r, k) => {
944
+ v.value = !1, r && I(k);
945
+ }, u = async () => !0;
946
+ fe(async () => {
947
+ await u();
948
+ });
949
+ const I = async (r) => {
950
+ if (m.value = !0, await Ee(r)) {
951
+ b("projectLogin", r);
952
+ let q = await Ne();
953
+ b("systemContent", q == null ? void 0 : q.allMenuContents), y.push("/"), p.setHasClickEditComp(!1);
954
+ } else
955
+ m.value = !1;
956
+ m.value = !1;
957
+ };
958
+ j(
959
+ () => g == null ? void 0 : g.loginContent,
960
+ () => {
961
+ let r = g == null ? void 0 : g.loginContent;
962
+ r != null && r.account && (r != null && r.password) && I(r);
963
+ },
964
+ { deep: !0, immediate: !0 }
965
+ );
966
+ const L = (r) => {
967
+ T.value = r, v.value = !1, m.value = !1;
968
+ }, d = (r) => {
969
+ b("updateApiUrl", r);
970
+ };
971
+ return (r, k) => ($(), D("div", qt, [
972
+ l("div", At, [
973
+ l("div", Dt, [
974
+ t(je, { class: "login-left-bg" }, {
975
+ img: o(() => {
976
+ var q, N;
977
+ return [
978
+ l("div", xt, [
979
+ l("div", Rt, [
980
+ _.value ? ($(), D("div", Nt, [
981
+ l("img", {
982
+ src: _.value,
983
+ alt: ""
984
+ }, null, 8, St)
985
+ ])) : oe("", !0),
986
+ l("div", Et, x(((q = O(e)) == null ? void 0 : q.EnglishName) || "Insofworks"), 1)
987
+ ]),
988
+ l("div", null, x(((N = O(e)) == null ? void 0 : N.chineseName) || "工业软件建模与开发系统"), 1)
989
+ ]),
990
+ k[0] || (k[0] = l("div", { class: "divide-line" }, null, -1))
991
+ ];
992
+ }),
993
+ _: 1
994
+ })
995
+ ]),
996
+ l("div", Mt, [
997
+ t(Ge, {
998
+ loading: m.value,
999
+ onClickLogin: i,
1000
+ onHandleTabChange: L
1001
+ }, {
1002
+ title: o(() => [
1003
+ M(x(a.value.loginTitle), 1)
1004
+ ]),
1005
+ tabLabel1: o(() => [
1006
+ M(x(a.value.tabs[0].name), 1)
1007
+ ]),
1008
+ tabContent1: o(() => [
1009
+ t(wt, {
1010
+ activeTabName: T.value,
1011
+ isClickLogin: v.value,
1012
+ onHandleLoginFormChange: c,
1013
+ onUpdateApiUrl: d
1014
+ }, null, 8, ["activeTabName", "isClickLogin"])
1015
+ ]),
1016
+ tabButton1: o(() => [
1017
+ M(x(a.value.tabs[0].btnLabel), 1)
1018
+ ]),
1019
+ tabLabel2: o(() => [
1020
+ M(x(a.value.tabs[1].name), 1)
1021
+ ]),
1022
+ tabContent2: o(() => [
1023
+ t(Ft, {
1024
+ systemKey: r.oldSystemKey,
1025
+ activeTabName: T.value,
1026
+ isClickLogin: v.value,
1027
+ onHandleLoginFormChange: c
1028
+ }, null, 8, ["systemKey", "activeTabName", "isClickLogin"])
1029
+ ]),
1030
+ tabButton2: o(() => [
1031
+ M(x(a.value.tabs[1].btnLabel), 1)
1032
+ ]),
1033
+ _: 1
1034
+ }, 8, ["loading"])
1035
+ ])
1036
+ ])
1037
+ ]));
1038
+ }
1039
+ }), zt = /* @__PURE__ */ H(Pt, [["__scopeId", "data-v-8aacc6bf"]]);
1040
+ export {
1041
+ zt as default
1042
+ };