general-basic-form 1.2.0 → 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/dist/index.js CHANGED
@@ -1,34 +1,34 @@
1
- import { nextTick as m } from "vue";
2
- function u(t, e, a, r, s, i, f, h) {
3
- var n = typeof t == "function" ? t.options : t;
4
- e && (n.render = e, n.staticRenderFns = a, n._compiled = !0), r && (n.functional = !0), i && (n._scopeId = "data-v-" + i);
1
+ import { nextTick as te } from "vue";
2
+ function I(r, e, t, a, n, o, s, c) {
3
+ var i = typeof r == "function" ? r.options : r;
4
+ e && (i.render = e, i.staticRenderFns = t, i._compiled = !0), a && (i.functional = !0), o && (i._scopeId = "data-v-" + o);
5
5
  var l;
6
- if (f ? (l = function(o) {
7
- o = o || // cached call
6
+ if (s ? (l = function(u) {
7
+ u = u || // cached call
8
8
  this.$vnode && this.$vnode.ssrContext || // stateful
9
- this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !o && typeof __VUE_SSR_CONTEXT__ < "u" && (o = __VUE_SSR_CONTEXT__), s && s.call(this, o), o && o._registeredComponents && o._registeredComponents.add(f);
10
- }, n._ssrRegister = l) : s && (l = h ? function() {
11
- s.call(
9
+ this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !u && typeof __VUE_SSR_CONTEXT__ < "u" && (u = __VUE_SSR_CONTEXT__), n && n.call(this, u), u && u._registeredComponents && u._registeredComponents.add(s);
10
+ }, i._ssrRegister = l) : n && (l = c ? function() {
11
+ n.call(
12
12
  this,
13
- (n.functional ? this.parent : this).$root.$options.shadowRoot
13
+ (i.functional ? this.parent : this).$root.$options.shadowRoot
14
14
  );
15
- } : s), l)
16
- if (n.functional) {
17
- n._injectStyles = l;
18
- var _ = n.render;
19
- n.render = function(y, p) {
20
- return l.call(p), _(y, p);
15
+ } : n), l)
16
+ if (i.functional) {
17
+ i._injectStyles = l;
18
+ var d = i.render;
19
+ i.render = function(f, h) {
20
+ return l.call(h), d(f, h);
21
21
  };
22
22
  } else {
23
- var d = n.beforeCreate;
24
- n.beforeCreate = d ? [].concat(d, l) : [l];
23
+ var p = i.beforeCreate;
24
+ i.beforeCreate = p ? [].concat(p, l) : [l];
25
25
  }
26
26
  return {
27
- exports: t,
28
- options: n
27
+ exports: r,
28
+ options: i
29
29
  };
30
30
  }
31
- const g = {
31
+ const re = {
32
32
  props: {
33
33
  verificationSetting: {
34
34
  type: Object,
@@ -76,45 +76,616 @@ const g = {
76
76
  }
77
77
  }
78
78
  };
79
- var b = function() {
80
- var e = this, a = e._self._c;
81
- return a("el-button", { on: { click: e.buttonClick } }, [e._v(e._s(e.buttonType ? e.defaultText : e.buttonText + "s"))]);
82
- }, v = [], k = /* @__PURE__ */ u(
83
- g,
84
- b,
85
- v,
79
+ var ae = function() {
80
+ var e = this, t = e._self._c;
81
+ return t("el-button", { on: { click: e.buttonClick } }, [e._v(e._s(e.buttonType ? e.defaultText : e.buttonText + "s"))]);
82
+ }, ne = [], se = /* @__PURE__ */ I(
83
+ re,
84
+ ae,
85
+ ne,
86
86
  !1,
87
87
  null,
88
88
  null,
89
89
  null,
90
90
  null
91
91
  );
92
- const x = k.exports, S = (t = {}) => {
93
- for (const e in t)
94
- if (Object.prototype.hasOwnProperty.call(t, e)) {
95
- const a = t[e];
96
- Object.prototype.toString.call(a) === "[object Object]" && (t[e] = JSON.stringify(a));
92
+ const oe = se.exports, ie = (r = {}) => {
93
+ for (const e in r)
94
+ if (Object.prototype.hasOwnProperty.call(r, e)) {
95
+ const t = r[e];
96
+ Object.prototype.toString.call(t) === "[object Object]" && (r[e] = JSON.stringify(t));
97
97
  }
98
- return t;
99
- }, T = (t = {}) => {
100
- for (const e in t)
101
- if (Object.prototype.hasOwnProperty.call(t, e)) {
102
- const a = t[e];
98
+ return r;
99
+ }, ce = (r = {}) => {
100
+ for (const e in r)
101
+ if (Object.prototype.hasOwnProperty.call(r, e)) {
102
+ const t = r[e];
103
103
  try {
104
- /[{]+/g.test(a) && /[}]+/g.test(a) && (t[e] = JSON.parse(a));
104
+ /[{]+/g.test(t) && /[}]+/g.test(t) && (r[e] = JSON.parse(t));
105
105
  } catch {
106
106
  }
107
107
  }
108
- return t;
109
- }, P = { paramsToQuery: S, queryToData: T }, c = P;
110
- const $ = {
108
+ return r;
109
+ }, G = { paramsToQuery: ie, queryToData: ce }, D = K;
110
+ (function(r, e) {
111
+ const t = K, a = r();
112
+ for (; ; )
113
+ try {
114
+ if (parseInt(t(224)) / 1 * (-parseInt(t(262)) / 2) + parseInt(t(271)) / 3 * (-parseInt(t(273)) / 4) + -parseInt(t(281)) / 5 * (-parseInt(t(257)) / 6) + -parseInt(t(250)) / 7 * (-parseInt(t(253)) / 8) + -parseInt(t(261)) / 9 + -parseInt(t(247)) / 10 + -parseInt(t(276)) / 11 * (-parseInt(t(256)) / 12) === e)
115
+ break;
116
+ a.push(a.shift());
117
+ } catch {
118
+ a.push(a.shift());
119
+ }
120
+ })(j, 932279);
121
+ const g = {};
122
+ let T = null;
123
+ const H = async (r, e) => {
124
+ const t = K;
125
+ !window.indexedDB && window[t(252)](t(236));
126
+ const { DBName: a = "", DBVersion: n = 1 } = r;
127
+ let o, s = !1;
128
+ try {
129
+ const c = window[t(265)].open(a, n);
130
+ await new Promise((i, l) => {
131
+ const d = t;
132
+ c[d(231)] = async function(p) {
133
+ const u = d, f = p[u(286)][u(228)], { stores: h = [] } = r;
134
+ await Promise[u(269)](h[u(242)](async (y) => {
135
+ const m = u, { DBStoreName: b = "", properties: w = {} } = y;
136
+ try {
137
+ const x = {};
138
+ x[m(237)] = r[m(238)];
139
+ const N = p[m(234)].result[m(289)](b, x);
140
+ if (Object[m(241)](w)[m(282)] === 0) {
141
+ console[m(226)](b + m(275));
142
+ return;
143
+ }
144
+ for (const B in w)
145
+ if (w[m(223)][m(268)](w, B)) {
146
+ const $ = w[B], k = { ...$[m(258)] };
147
+ N[m(258)](B, B, k);
148
+ }
149
+ } catch (x) {
150
+ console.warn(x);
151
+ }
152
+ })), o = f, s = !0;
153
+ }, c[d(288)] = async function(p) {
154
+ const u = d;
155
+ if (o = this[u(228)], s) {
156
+ const { stores: f = [] } = r;
157
+ await Promise[u(269)](f[u(242)](async (h) => {
158
+ const y = u, { DBStoreName: m = "" } = h, b = o[y(246)]([m], y(251)), w = b[y(274)](m), x = {};
159
+ x[r[y(238)]] = e, w[y(285)](x);
160
+ try {
161
+ await new Promise((N, B) => {
162
+ const $ = y;
163
+ b.onabort = function(k) {
164
+ const C = K;
165
+ console[C(230)](C(254), k), B();
166
+ }, b[$(272)] = function(k) {
167
+ N();
168
+ }, b[$(260)] = function(k) {
169
+ const C = $;
170
+ console[C(230)](C(239), k), B();
171
+ };
172
+ });
173
+ } catch (N) {
174
+ console[y(226)](y(270), N);
175
+ }
176
+ }));
177
+ }
178
+ i();
179
+ }, c[d(260)] = function(p) {
180
+ l(p);
181
+ };
182
+ });
183
+ } catch (c) {
184
+ console.error(c, t(266));
185
+ }
186
+ return o;
187
+ };
188
+ function j() {
189
+ const r = ["1464mvMiei", "237864JBnTLr", "createIndex", "info", "onerror", "10438893QpczMy", "2762094YVzJZu", "update", "Database connection closed, reconnecting...", "indexedDB", "打开数据库报错,可能是数据库版本不对,或者储存容量不足等原因", "传入结构化克隆算法不支持的数据类型可能导致报错", "call", "all", "目前所有数据都在用户ID的主键下面,所以没有主键的话做重新载入页面处理", "4860399kEbqOd", "oncomplete", "4VdzWwr", "objectStore", "没有设置默认值", "235378QpXYjE", "deleteDB", "close", "事务失败", "数据库删除失败", "140VRAbTP", "length", "store不存在,请更新schema和DBVersion并重启前端服务", "getDB", "add", "target", "DBName", "onsuccess", "createObjectStore", "hasOwnProperty", "1UrIRyX", "updateStore", "warn", "openCursor", "result", "put", "error", "onupgradeneeded", "deleteStore", "主键查询结果:", "currentTarget", "mapDB", "您的浏览器不支持IndexedDB的稳定版本。离线数据功能将不可用。Your browser doesn't support a stable version of IndexedDB. offline data feature will not be available.", "keyPath", "primaryKey", "主键插入失败", "数据更新成功", "keys", "map", "delete", "get", "数据更新失败没有request", "transaction", "4043600olVeJQ", "数据更新失败", "addEventListener", "163681jsedKz", "readwrite", "alert", "608zfClSO", "主键插入中止", "continue"];
190
+ return j = function() {
191
+ return r;
192
+ }, j();
193
+ }
194
+ function K(r, e) {
195
+ const t = j();
196
+ return K = function(a, n) {
197
+ return a = a - 223, t[a];
198
+ }, K(r, e);
199
+ }
200
+ let z = !1;
201
+ g[D(284)] = async (r) => {
202
+ const e = D, { mapDB: t, primaryKey: a } = r;
203
+ return t ? a ? (z && await new Promise(async (n, o) => {
204
+ const s = () => {
205
+ z ? setTimeout(() => {
206
+ s();
207
+ }, 200) : n();
208
+ };
209
+ s();
210
+ }), !T && (z = !0, T = await H(t, a), T == null || T[e(249)](e(278), async () => {
211
+ const n = e;
212
+ console[n(259)](n(264)), T = await H(t, a);
213
+ }), z = !1), T) : (console[e(226)]("获取Database缺乏用户信息,请先传入对primaryKey的赋值"), !1) : (console[e(226)]("必须传入数据库配置信息"), !1);
214
+ }, g.getDataByKey = async (r, e) => {
215
+ const t = D, { mapDB: a, tableName: n, primaryKey: o } = r, s = {};
216
+ s[t(235)] = a, s[t(238)] = o;
217
+ const c = await g[t(284)](s);
218
+ if (!c)
219
+ return;
220
+ const i = c.transaction([n]), l = i[t(274)](n), d = l[t(244)](o);
221
+ return new Promise((p, u) => {
222
+ const f = t;
223
+ d[f(288)] = function(h) {
224
+ const y = f;
225
+ e(n + y(233) + d[y(228)]), p(d[y(228)]);
226
+ }, d[f(260)] = function(h) {
227
+ const y = f;
228
+ console[y(230)](n + y(279) + h), u();
229
+ };
230
+ });
231
+ }, g[D(225)] = async (r, e) => {
232
+ var t;
233
+ const a = D, { mapDB: n, tableName: o, updateData: s } = r;
234
+ !s[n == null ? void 0 : n[a(238)]] && console[a(226)]("请传入主键" + n[a(238)]);
235
+ const c = {};
236
+ c[a(235)] = n, c[a(238)] = s[n == null ? void 0 : n[a(238)]];
237
+ const i = await g.getDB(c);
238
+ if (!i)
239
+ return;
240
+ let l = null;
241
+ try {
242
+ l = i[a(246)]([o], "readwrite").objectStore(o);
243
+ } catch (f) {
244
+ console[a(230)](a(283), f);
245
+ }
246
+ let d = null, p = null;
247
+ const u = await new Promise((f, h) => {
248
+ const y = a, m = l[y(227)](s[n == null ? void 0 : n.primaryKey]);
249
+ m[y(288)] = (b) => {
250
+ f(b);
251
+ }, m.onerror = (b) => {
252
+ h(b);
253
+ };
254
+ });
255
+ p = (t = u == null ? void 0 : u[a(286)]) == null ? void 0 : t[a(228)];
256
+ try {
257
+ p && (p == null ? void 0 : p[a(238)]) === s[n == null ? void 0 : n.primaryKey] ? d = p[a(263)](s) : d = l[a(229)](s);
258
+ } catch (f) {
259
+ console[a(230)](a(267), f, s);
260
+ }
261
+ new Promise((f, h) => {
262
+ const y = a;
263
+ !d && (console[y(230)](o + y(245)), h()), d[y(288)] = function(m) {
264
+ e(o + y(240)), f();
265
+ }, d[y(260)] = function(m) {
266
+ const b = y;
267
+ console[b(230)](o + b(248), m), h();
268
+ };
269
+ }), p && p[a(255)]();
270
+ }, g[D(232)] = async (r, e) => {
271
+ const t = D, { mapDB: a, tableName: n, primaryKey: o } = r, s = {};
272
+ s[t(235)] = a, s[t(238)] = o;
273
+ const c = await g[t(284)](s);
274
+ if (!c)
275
+ return;
276
+ const i = c[t(246)]([n], t(251))[t(274)](n)[t(243)](o);
277
+ return new Promise((l, d) => {
278
+ const p = t;
279
+ i[p(288)] = function(u) {
280
+ e(n + "数据删除成功"), l();
281
+ }, i.onerror = function(u) {
282
+ console[p(230)](n + "数据删除失败" + u), d();
283
+ };
284
+ });
285
+ }, g[D(277)] = async (r, e) => {
286
+ const t = D, { mapDB: a } = r, n = window[t(265)].deleteDatabase(a[t(287)]);
287
+ return new Promise((o, s) => {
288
+ const c = t;
289
+ n[c(288)] = (i) => {
290
+ e(a[c(287)] + "数据库已删除"), o();
291
+ }, n[c(260)] = (i) => {
292
+ const l = c;
293
+ console[l(230)](a[l(287)] + l(280) + i), s();
294
+ };
295
+ });
296
+ };
297
+ const Q = P;
298
+ function E() {
299
+ const r = ["error", "18qzGcVH", "4682604GbULBa", "6016003SPdUIY", "20065atPLOQ", "updateStore", "65UvpzlD", "6700512ZDDSvv", "handleData", "为空,请先调用handleData", "mapDB", "13110xITriW", "primaryKey", "deleteStore", "getDataByKey", "clearData", "7689BMhWoa", "404ipIPIB", "22929dseKps", "426mZTQfR", "8660kGxzIL", "tableName", "9mGIzFA", "updateData"];
300
+ return E = function() {
301
+ return r;
302
+ }, E();
303
+ }
304
+ (function(r, e) {
305
+ const t = P, a = r();
306
+ for (; ; )
307
+ try {
308
+ if (parseInt(t(400)) / 1 * (-parseInt(t(405)) / 2) + parseInt(t(398)) / 3 * (-parseInt(t(397)) / 4) + parseInt(t(408)) / 5 * (parseInt(t(399)) / 6) + -parseInt(t(407)) / 7 + parseInt(t(387)) / 8 * (-parseInt(t(402)) / 9) + -parseInt(t(391)) / 10 * (-parseInt(t(396)) / 11) + parseInt(t(406)) / 12 * (parseInt(t(410)) / 13) === e)
309
+ break;
310
+ a.push(a.shift());
311
+ } catch {
312
+ a.push(a.shift());
313
+ }
314
+ })(E, 605521);
315
+ async function le(r, e) {
316
+ const t = P, { tableName: a, propertiesKey: n, parameter: o, primaryKey: s, mapDB: c } = r;
317
+ let i = null, l = { [c[t(392)]]: s };
318
+ const d = {};
319
+ d[t(390)] = c, d[t(401)] = a, d[t(392)] = s;
320
+ const p = await g[t(394)](d);
321
+ p && (l = { ...p, [c[t(392)]]: s }), l[n] = o;
322
+ const u = {};
323
+ return u[t(390)] = c, u[t(401)] = a, u.updateData = l, await g[t(409)](u), o && (i = o), e(i), i;
324
+ }
325
+ async function ue(r, e) {
326
+ const t = P, { tableName: a, propertiesKey: n, primaryKey: o, mapDB: s } = r;
327
+ let c = null;
328
+ const i = {};
329
+ i[t(390)] = s, i[t(401)] = a, i.primaryKey = o;
330
+ const l = await g[t(394)](i);
331
+ return l && (c = l[n]), e(c), c;
332
+ }
333
+ async function pe(r, e) {
334
+ const t = P, { tableName: a, propertiesKey: n, parameter: o, primaryKey: s, mapDB: c } = r;
335
+ let i = {};
336
+ const l = {};
337
+ l[t(390)] = c, l[t(401)] = a, l[t(392)] = s;
338
+ const d = await g.getDataByKey(l);
339
+ try {
340
+ if (d) {
341
+ i = { ...d[n], ...o };
342
+ const p = { [c[t(392)]]: s }, u = p;
343
+ u[n] = i;
344
+ const f = {};
345
+ f[t(390)] = c, f[t(401)] = a, f[t(403)] = u, await g[t(409)](f);
346
+ } else
347
+ console.warn(a + t(389));
348
+ } catch (p) {
349
+ console.error(p);
350
+ }
351
+ return e(i), i;
352
+ }
353
+ function P(r, e) {
354
+ const t = E();
355
+ return P = function(a, n) {
356
+ return a = a - 387, t[a];
357
+ }, P(r, e);
358
+ }
359
+ async function de(r, e) {
360
+ const t = P, { tableName: a, primaryKey: n, mapDB: o } = r;
361
+ let s = null;
362
+ try {
363
+ const c = {};
364
+ c[t(390)] = o, c.tableName = a, c.primaryKey = n, await g[t(393)](c);
365
+ } catch (c) {
366
+ console[t(404)](c);
367
+ }
368
+ return e(s), s;
369
+ }
370
+ const F = {};
371
+ F[Q(388)] = le, F.getData = ue, F[Q(403)] = pe, F[Q(395)] = de;
372
+ var v = L;
373
+ (function(r, e) {
374
+ for (var t = L, a = r(); ; )
375
+ try {
376
+ var n = -parseInt(t(195)) / 1 * (-parseInt(t(179)) / 2) + -parseInt(t(196)) / 3 * (-parseInt(t(194)) / 4) + -parseInt(t(197)) / 5 + parseInt(t(183)) / 6 * (-parseInt(t(191)) / 7) + -parseInt(t(190)) / 8 + -parseInt(t(202)) / 9 * (-parseInt(t(199)) / 10) + -parseInt(t(203)) / 11 * (-parseInt(t(201)) / 12);
377
+ if (n === e)
378
+ break;
379
+ a.push(a.shift());
380
+ } catch {
381
+ a.push(a.shift());
382
+ }
383
+ })(V, 291935);
384
+ var U = {};
385
+ function V() {
386
+ var r = ["mapDB-indexeddb-form-schema", "778390VHiMPL", "stores", "3383508RfiKTD", "63UERWuz", "22gvbCFO", "509514cRHqzj", "DBVersion", "formParams", "properties", "49908OxCuGa", "createIndex", "DBName", "primaryKey", "userId", "default", "unique", "562896ZFvrwm", "392gQpHIY", "DBStoreName", "queryParams", "8eQWvIE", "1FtIDQF", "5259FOfsNi", "2694745YrsVgs"];
387
+ return V = function() {
388
+ return r;
389
+ }, V();
390
+ }
391
+ U[v(189)] = !1;
392
+ var A = {};
393
+ function L(r, e) {
394
+ var t = V();
395
+ return L = function(a, n) {
396
+ a = a - 179;
397
+ var o = t[a];
398
+ return o;
399
+ }, L(r, e);
400
+ }
401
+ A[v(184)] = U, A[v(188)] = {};
402
+ var M = {};
403
+ M[v(193)] = A;
404
+ var W = {};
405
+ W[v(192)] = v(181), W[v(182)] = M;
406
+ var q = {};
407
+ q[v(186)] = v(187), q[v(185)] = v(198), q[v(180)] = 1, q[v(200)] = [W];
408
+ const fe = {
409
+ formSchema: q
410
+ }, ye = F, { handleData: me, getData: he } = ye, { formSchema: Y } = fe, be = async (r, e) => {
411
+ var t;
412
+ return e.parametersType === "url" && (r = {
413
+ ...G.queryToData((t = e.$route) == null ? void 0 : t.query),
414
+ ...r
415
+ }), e.parametersType === "indexDB" && (r = {
416
+ ...await he({
417
+ tableName: "formParams",
418
+ propertiesKey: e.$route.path || "defQueryParams",
419
+ primaryKey: e.DBPrimaryKey || "default",
420
+ mapDB: Y
421
+ }),
422
+ ...r
423
+ }), r;
424
+ }, ge = async (r, e) => {
425
+ e.parametersType === "url" && await e.$router.push({
426
+ query: G.paramsToQuery({ ...r })
427
+ }), e.parametersType === "indexDB" && await me({
428
+ tableName: "formParams",
429
+ propertiesKey: e.$route.path || "defQueryParams",
430
+ parameter: { ...r },
431
+ primaryKey: e.DBPrimaryKey || "default",
432
+ mapDB: Y
433
+ });
434
+ }, _e = {
435
+ makeParamsByType: be,
436
+ saveParamsByType: ge
437
+ }, Z = G, O = _e, _ = {};
438
+ let S = null;
439
+ const J = async (r, e) => {
440
+ window.indexedDB || window.alert(
441
+ "您的浏览器不支持IndexedDB的稳定版本。离线数据功能将不可用。Your browser doesn't support a stable version of IndexedDB. offline data feature will not be available."
442
+ );
443
+ const { DBName: t = "", DBVersion: a = 1 } = r;
444
+ let n, o = !1;
445
+ try {
446
+ const s = window.indexedDB.open(t, a);
447
+ await new Promise((c, i) => {
448
+ s.onupgradeneeded = async function(l) {
449
+ const d = l.target.result, { stores: p = [] } = r;
450
+ await Promise.all(
451
+ p.map(async (u) => {
452
+ const { DBStoreName: f = "", properties: h = {} } = u;
453
+ try {
454
+ const y = l.currentTarget.result.createObjectStore(
455
+ f,
456
+ {
457
+ keyPath: r.primaryKey
458
+ }
459
+ );
460
+ if (Object.keys(h).length === 0) {
461
+ console.warn(`${f}没有设置默认值`);
462
+ return;
463
+ }
464
+ for (const m in h)
465
+ if (h.hasOwnProperty.call(h, m)) {
466
+ const b = h[m];
467
+ y.createIndex(m, m, { ...b.createIndex });
468
+ }
469
+ } catch (y) {
470
+ console.warn(y);
471
+ }
472
+ })
473
+ ), n = d, o = !0;
474
+ }, s.onsuccess = async function(l) {
475
+ if (n = this.result, o) {
476
+ const { stores: d = [] } = r;
477
+ await Promise.all(
478
+ d.map(async (p) => {
479
+ const { DBStoreName: u = "" } = p, f = n.transaction(
480
+ [u],
481
+ "readwrite"
482
+ ), h = f.objectStore(u), y = {};
483
+ y[r.primaryKey] = e, h.add(y);
484
+ try {
485
+ await new Promise((m, b) => {
486
+ f.onabort = function(w) {
487
+ console.error("主键插入中止", w), b();
488
+ }, f.oncomplete = function(w) {
489
+ m();
490
+ }, f.onerror = function(w) {
491
+ console.error("主键插入失败", w), b();
492
+ };
493
+ });
494
+ } catch (m) {
495
+ console.warn(
496
+ "目前所有数据都在用户ID的主键下面,所以没有主键的话做重新载入页面处理",
497
+ m
498
+ );
499
+ }
500
+ })
501
+ );
502
+ }
503
+ c();
504
+ }, s.onerror = function(l) {
505
+ i(l);
506
+ };
507
+ });
508
+ } catch (s) {
509
+ console.error(
510
+ s,
511
+ "打开数据库报错,可能是数据库版本不对,或者储存容量不足等原因"
512
+ );
513
+ }
514
+ return n;
515
+ };
516
+ let R = !1;
517
+ _.getDB = async (r, e) => {
518
+ const { mapDB: t, primaryKey: a } = r;
519
+ return t ? a ? (R && await new Promise(async (n, o) => {
520
+ const s = () => {
521
+ R ? setTimeout(() => {
522
+ s();
523
+ }, 200) : n();
524
+ };
525
+ s();
526
+ }), S || (R = !0, S = await J(t, a), S == null || S.addEventListener("close", async () => {
527
+ console.info("Database connection closed, reconnecting..."), S = await J(t, a);
528
+ }), R = !1), e && e(S), S) : (console.warn("获取Database缺乏用户信息,请先传入对primaryKey的赋值"), !1) : (console.warn("必须传入数据库配置信息"), !1);
529
+ };
530
+ _.getDataByKey = async (r, e) => {
531
+ const { mapDB: t, tableName: a, primaryKey: n } = r, o = await _.getDB({ mapDB: t, primaryKey: n });
532
+ if (!o)
533
+ return;
534
+ const i = o.transaction([a]).objectStore(a).get(n);
535
+ return new Promise((l, d) => {
536
+ i.onsuccess = function(p) {
537
+ e && e(`${a}主键查询结果:${i.result}`), l(i.result);
538
+ }, i.onerror = function(p) {
539
+ console.error(`${a}事务失败` + p), d();
540
+ };
541
+ });
542
+ };
543
+ _.updateStore = async (r, e) => {
544
+ var d;
545
+ const { mapDB: t, tableName: a, updateData: n } = r;
546
+ n[t == null ? void 0 : t.primaryKey] || console.warn(`请传入主键${t.primaryKey}`);
547
+ const o = await _.getDB({
548
+ mapDB: t,
549
+ primaryKey: n[t == null ? void 0 : t.primaryKey]
550
+ });
551
+ if (!o)
552
+ return;
553
+ let s = null;
554
+ try {
555
+ s = o.transaction([a], "readwrite").objectStore(a);
556
+ } catch (p) {
557
+ console.error("store不存在,请更新schema和DBVersion并重启前端服务", p);
558
+ }
559
+ let c = null, i = null;
560
+ const l = await new Promise((p, u) => {
561
+ const f = s.openCursor(n[t == null ? void 0 : t.primaryKey]);
562
+ f.onsuccess = (h) => {
563
+ p(h);
564
+ }, f.onerror = (h) => {
565
+ u(h);
566
+ };
567
+ });
568
+ i = (d = l == null ? void 0 : l.target) == null ? void 0 : d.result;
569
+ try {
570
+ i && (i == null ? void 0 : i.primaryKey) === n[t == null ? void 0 : t.primaryKey] ? c = i.update(n) : c = s.put(n);
571
+ } catch (p) {
572
+ console.error(
573
+ "传入结构化克隆算法不支持的数据类型可能导致报错",
574
+ p,
575
+ n
576
+ );
577
+ }
578
+ new Promise((p, u) => {
579
+ c || (console.error(`${a}数据更新失败没有request`), u()), c.onsuccess = function(f) {
580
+ e && e(`${a}数据更新成功`), p();
581
+ }, c.onerror = function(f) {
582
+ console.error(`${a}数据更新失败`, f), u();
583
+ };
584
+ }), i && i.continue();
585
+ };
586
+ _.deleteStore = async (r, e) => {
587
+ const { mapDB: t, tableName: a, primaryKey: n } = r, o = await _.getDB({ mapDB: t, primaryKey: n });
588
+ if (!o)
589
+ return;
590
+ const s = o.transaction([a], "readwrite").objectStore(a).delete(n);
591
+ return new Promise((c, i) => {
592
+ s.onsuccess = function(l) {
593
+ e && e(`${a}数据删除成功`), c();
594
+ }, s.onerror = function(l) {
595
+ console.error(`${a}数据删除失败` + l), i();
596
+ };
597
+ });
598
+ };
599
+ _.deleteDB = async (r, e) => {
600
+ const { mapDB: t } = r, a = window.indexedDB.deleteDatabase(t.DBName);
601
+ return new Promise((n, o) => {
602
+ a.onsuccess = (s) => {
603
+ e && e(`${t.DBName}数据库已删除`), n();
604
+ }, a.onerror = (s) => {
605
+ console.error(`${t.DBName}数据库删除失败` + s), o();
606
+ };
607
+ });
608
+ };
609
+ async function ve(r, e) {
610
+ const { tableName: t, propertiesKey: a, parameter: n, primaryKey: o, mapDB: s } = r;
611
+ let c = null, i = {
612
+ [s.primaryKey]: o
613
+ };
614
+ const l = await _.getDataByKey({ mapDB: s, tableName: t, primaryKey: o });
615
+ return l && (i = {
616
+ ...l,
617
+ [s.primaryKey]: o
618
+ }), i[a] = n, await _.updateStore({ mapDB: s, tableName: t, updateData: i }), n && (c = n), e && e(c), c;
619
+ }
620
+ async function we(r, e) {
621
+ const { tableName: t, propertiesKey: a, primaryKey: n, mapDB: o } = r;
622
+ let s = null;
623
+ const c = await _.getDataByKey({ mapDB: o, tableName: t, primaryKey: n });
624
+ return c && (s = c[a]), e && e(s), s;
625
+ }
626
+ async function De(r, e) {
627
+ const { tableName: t, propertiesKey: a, parameter: n, primaryKey: o, mapDB: s } = r;
628
+ let c = {};
629
+ const i = await _.getDataByKey({ mapDB: s, tableName: t, primaryKey: o });
630
+ try {
631
+ if (i) {
632
+ c = { ...i[a], ...n };
633
+ const d = {
634
+ [s.primaryKey]: o
635
+ };
636
+ d[a] = c, await _.updateStore({ mapDB: s, tableName: t, updateData: d });
637
+ } else
638
+ console.warn(`${t}为空,请先调用handleData`);
639
+ } catch (l) {
640
+ console.error(l);
641
+ }
642
+ return e && e(c), c;
643
+ }
644
+ async function Se(r, e) {
645
+ const { tableName: t, primaryKey: a, mapDB: n } = r;
646
+ let o = null;
647
+ try {
648
+ await _.deleteStore({ mapDB: n, tableName: t, primaryKey: a });
649
+ } catch (s) {
650
+ console.error(s);
651
+ }
652
+ return e && e(o), o;
653
+ }
654
+ const Pe = {
655
+ handleData: ve,
656
+ getData: we,
657
+ updateData: De,
658
+ clearData: Se
659
+ }, xe = {
660
+ primaryKey: "userId",
661
+ DBName: "mapDB-indexeddb-form-schema",
662
+ DBVersion: 1,
663
+ // 更改了stores的内容后必须更新DBVersion以刷新数据库数据
664
+ stores: [
665
+ {
666
+ DBStoreName: "formParams",
667
+ properties: {
668
+ queryParams: { createIndex: { unique: !1 }, default: {} }
669
+ }
670
+ }
671
+ ]
672
+ // required: ["userId"],
673
+ // 设置加密的字段,除了primaryKey字段都加上
674
+ // encrypted: ['lngLat', 'drivingStartLnglat']
675
+ // attachments: {
676
+ // encrypted: true // 存入附件 if true, the attachment-data will be encrypted with the db-password
677
+ // }
678
+ }, X = {
679
+ formSchema: xe
680
+ }, ee = Pe;
681
+ const { getData: Be } = ee, { formSchema: ke } = X, Te = {
111
682
  name: "GeneralBasicForm",
112
683
  components: {
113
- InputArchive: (t) => {
114
- const { templateEle: e } = t;
684
+ InputArchive: (r) => {
685
+ const { templateEle: e } = r;
115
686
  return e();
116
687
  },
117
- VerificationButton: x
688
+ VerificationButton: oe
118
689
  },
119
690
  props: {
120
691
  showSearch: {
@@ -159,10 +730,13 @@ const $ = {
159
730
  type: String,
160
731
  default: "90px"
161
732
  },
162
- noUrlParameters: {
163
- // 不接受和不改变url的参数
164
- type: Boolean,
165
- default: () => !1
733
+ parametersType: {
734
+ type: String,
735
+ default: "url"
736
+ },
737
+ DBPrimaryKey: {
738
+ type: [String, Number],
739
+ required: !1
166
740
  },
167
741
  formData: {
168
742
  // 外部传入的表单数据,用于回填
@@ -190,14 +764,16 @@ const $ = {
190
764
  defPageSize: {
191
765
  type: Number,
192
766
  default: 10
767
+ },
768
+ queryWhenReady: {
769
+ // 初始化完成后自动触发查找数据函数
770
+ type: Boolean,
771
+ default: () => !1
193
772
  }
194
773
  },
195
774
  data() {
196
- var t;
197
775
  return {
198
- queryParams: {
199
- ...this.noUrlParameters ? {} : c.queryToData((t = this.$route) == null ? void 0 : t.query)
200
- },
776
+ queryParams: this.initQueryParams(),
201
777
  // form表单数据
202
778
  formLoading: this.loading || !1,
203
779
  selectSetting: {
@@ -239,198 +815,206 @@ const $ = {
239
815
  // },
240
816
  watch: {
241
817
  formData: {
242
- handler(t, e) {
243
- JSON.stringify(t) !== JSON.stringify(e) && (this.queryParams = {
818
+ handler(r, e) {
819
+ JSON.stringify(r) !== JSON.stringify(this.queryParams) && (this.queryParams = {
244
820
  ...this.queryParams,
245
- ...t
821
+ ...r
246
822
  });
247
823
  },
248
824
  // watch 默认是懒执行的:仅当数据源变化时,才会执行回调。但在某些场景中,我们希望在创建侦听器时,立即执行一遍回调。举例来说,我们想请求一些初始数据,然后在相关状态更改时重新请求数据。
249
825
  // https://cn.vuejs.org/guide/essentials/watchers.html#deep-watchers
250
- immediate: !0
251
- // deep: true,
826
+ immediate: !0,
827
+ deep: !0
252
828
  },
253
829
  queryParams: {
254
- handler(t) {
255
- this.$emit("update:formData", { ...t });
830
+ handler(r) {
831
+ this.$emit("update:formData", { ...r });
256
832
  },
257
833
  deep: !0
258
834
  },
259
835
  $attrs: {
260
- handler(t) {
836
+ handler(r) {
261
837
  this.attrs = {
262
838
  ...this.attrs,
263
- ...t
839
+ ...r
264
840
  };
265
841
  },
266
842
  immediate: !0,
267
843
  deep: !0
268
844
  },
269
- loading(t) {
270
- this.formLoading !== t && (this.formLoading = t);
845
+ loading(r) {
846
+ this.formLoading !== r && (this.formLoading = r);
271
847
  },
272
- formLoading(t) {
273
- this.loading !== t && this.$emit("update:loading", t);
848
+ formLoading(r) {
849
+ this.loading !== r && this.$emit("update:loading", r);
274
850
  }
275
851
  },
276
852
  methods: {
277
853
  /** 搜索按钮操作 */
278
- handleQuery(t = {}) {
279
- var r, s;
280
- t.defaultPageFirst ?? (t.defaultPageFirst = !0);
281
- const e = { [this.currentPageKey]: this.defCurrentPage, [this.pageSizeKey]: this.defPageSize }, a = c.paramsToQuery(
282
- t.defaultPageFirst ? {
283
- ...(r = this.$route) == null ? void 0 : r.query,
284
- ...this.queryParams,
285
- ...e
286
- } : {
287
- ...e,
288
- ...(s = this.$route) == null ? void 0 : s.query,
289
- ...this.queryParams
290
- }
291
- );
292
- this.noUrlParameters || this.$router.push({
293
- query: { ...a }
294
- }), this.getList({
295
- ...a
854
+ async handleQuery(r = {}) {
855
+ r.defaultPageFirst ?? (r.defaultPageFirst = !0);
856
+ const e = { [this.currentPageKey]: this.defCurrentPage };
857
+ let t = {
858
+ ...e,
859
+ ...this.queryParams
860
+ };
861
+ console.log(t, "searchParams1"), t = await O.makeParamsByType(t, this), console.log(t, "searchParams2"), r.defaultPageFirst && (t = {
862
+ ...t,
863
+ ...e
864
+ }), await O.saveParamsByType(t, this), this.getList({
865
+ ...t
296
866
  });
297
867
  },
298
868
  /** 重置按钮操作 */
299
869
  async resetQuery() {
300
- var e;
301
870
  this.$refs.queryFormRef.resetFields();
302
- const t = { [this.currentPageKey]: this.defCurrentPage };
303
- this.noUrlParameters || await this.$router.push({
304
- query: { ...t }
305
- }), this.queryParams = {
306
- ...this.noUrlParameters ? {} : c.queryToData((e = this.$route) == null ? void 0 : e.query)
307
- }, this.afterReset(), this.handleQuery();
871
+ const r = { [this.currentPageKey]: this.defCurrentPage };
872
+ await O.saveParamsByType(r, this), this.queryParams = { ...r }, this.afterReset(), this.handleQuery();
873
+ },
874
+ initQueryParams() {
875
+ var e;
876
+ let r = {
877
+ [this.pageSizeKey]: this.defPageSize
878
+ };
879
+ return this.parametersType === "url" && (r = { ...r, ...Z.queryToData((e = this.$route) == null ? void 0 : e.query) }), this.parametersType === "indexDB" && Be(
880
+ {
881
+ tableName: "formParams",
882
+ propertiesKey: this.$route.path || "defQueryParams",
883
+ primaryKey: this.DBPrimaryKey || "default",
884
+ mapDB: ke
885
+ },
886
+ (t) => {
887
+ this.queryParams = { ...r, ...t };
888
+ }
889
+ ), this.queryWhenReady && this.$nextTick(() => {
890
+ this.handleQuery({ defaultPageFirst: !1 });
891
+ }), r;
308
892
  },
309
893
  currentInputComponent() {
310
894
  return "input-archive";
311
895
  },
312
- getItemRules(t) {
313
- const { type: e, rules: a = [] } = t, r = [...a];
314
- return this.noInputBlank && e === "input" && r.push({
896
+ getItemRules(r) {
897
+ const { type: e, rules: t = [] } = r, a = [...t];
898
+ return this.noInputBlank && e === "input" && a.push({
315
899
  pattern: this.trimRegex,
316
900
  message: "请输入(不能仅输入空格)",
317
901
  trigger: "blur"
318
- }), r;
902
+ }), a;
319
903
  },
320
- getInputSetting(t) {
321
- const { inputSetting: e, setting: a } = t;
904
+ getInputSetting(r) {
905
+ const { inputSetting: e, setting: t } = r;
322
906
  return {
323
907
  ...this.inputSetting,
324
908
  ...e,
325
- ...a
909
+ ...t
326
910
  };
327
911
  },
328
912
  defaultFunction() {
329
913
  },
330
- getInputEvents(t) {
914
+ getInputEvents(r) {
331
915
  return {
332
- blur: t.blur || this.defaultFunction,
333
- focus: t.focus || this.defaultFunction,
334
- change: t.change || this.defaultFunction,
335
- input: t.input || this.defaultFunction,
336
- clear: t.clear || this.defaultFunction
916
+ blur: r.blur || this.defaultFunction,
917
+ focus: r.focus || this.defaultFunction,
918
+ change: r.change || this.defaultFunction,
919
+ input: r.input || this.defaultFunction,
920
+ clear: r.clear || this.defaultFunction
337
921
  };
338
922
  },
339
- getSelectSetting(t) {
340
- const { selectSetting: e, setting: a } = t;
923
+ getSelectSetting(r) {
924
+ const { selectSetting: e, setting: t } = r;
341
925
  return {
342
926
  ...this.selectSetting,
343
927
  ...e,
344
- ...a
928
+ ...t
345
929
  };
346
930
  },
347
- getSelectEvents(t) {
931
+ getSelectEvents(r) {
348
932
  return {
349
- change: t.change || this.defaultFunction,
350
- "visible-change": t["visible-change"] || this.defaultFunction,
351
- "remove-tag": t["remove-tag"] || this.defaultFunction,
352
- "expand-change": t["expand-change"] || this.defaultFunction,
353
- clear: t.clear || this.defaultFunction,
354
- blur: t.blur || this.defaultFunction,
355
- focus: t.focus || this.defaultFunction
933
+ change: r.change || this.defaultFunction,
934
+ "visible-change": r["visible-change"] || this.defaultFunction,
935
+ "remove-tag": r["remove-tag"] || this.defaultFunction,
936
+ "expand-change": r["expand-change"] || this.defaultFunction,
937
+ clear: r.clear || this.defaultFunction,
938
+ blur: r.blur || this.defaultFunction,
939
+ focus: r.focus || this.defaultFunction
356
940
  };
357
941
  },
358
- getDatePackerSetting(t) {
359
- const { datePackerSetting: e, setting: a } = t;
942
+ getDatePackerSetting(r) {
943
+ const { datePackerSetting: e, setting: t } = r;
360
944
  return {
361
945
  ...this.datePackerSetting,
362
946
  ...e,
363
- ...a
947
+ ...t
364
948
  };
365
949
  },
366
- getDatePackerEvents(t) {
950
+ getDatePackerEvents(r) {
367
951
  return {
368
- change: t.change || this.defaultFunction,
369
- blur: t.blur || this.defaultFunction,
370
- focus: t.focus || this.defaultFunction
952
+ change: r.change || this.defaultFunction,
953
+ blur: r.blur || this.defaultFunction,
954
+ focus: r.focus || this.defaultFunction
371
955
  };
372
956
  },
373
- getCheckboxGroupSetting(t) {
374
- const { checkboxGroupSetting: e, setting: a } = t;
957
+ getCheckboxGroupSetting(r) {
958
+ const { checkboxGroupSetting: e, setting: t } = r;
375
959
  return {
376
960
  ...e,
377
- ...a
961
+ ...t
378
962
  };
379
963
  },
380
- getCheckboxGroupEvents(t) {
964
+ getCheckboxGroupEvents(r) {
381
965
  return {
382
- change: t.change || this.defaultFunction
966
+ change: r.change || this.defaultFunction
383
967
  };
384
968
  }
385
969
  }
386
970
  };
387
- var C = function() {
388
- var e = this, a = e._self._c;
389
- return a("el-form", e._b({ directives: [{ name: "show", rawName: "v-show", value: e.showSearch, expression: "showSearch" }], ref: "queryFormRef", attrs: { model: e.queryParams, "label-width": e.labelWidth } }, "el-form", e.attrs, !1), [e._l(e.formItem, function(r) {
390
- return a("el-form-item", e._b({ key: r.prop, attrs: { rules: e.getItemRules(r) } }, "el-form-item", r, !1), [r.type === "input" ? a("el-input", e._g(e._b({ attrs: { size: e.size }, nativeOn: { keydown: function(s) {
391
- return !s.type.indexOf("key") && e._k(s.keyCode, "enter", 13, s.key, "Enter") ? null : e.getList.apply(null, arguments);
392
- } }, scopedSlots: e._u([e._l(r.template, function(s, i) {
393
- return { key: i, fn: function() {
394
- return [s ? a(e.currentInputComponent(), { key: i, tag: "component", attrs: { templateEle: s } }) : e._e()];
971
+ var Ke = function() {
972
+ var e = this, t = e._self._c;
973
+ return t("el-form", e._b({ directives: [{ name: "show", rawName: "v-show", value: e.showSearch, expression: "showSearch" }], ref: "queryFormRef", attrs: { model: e.queryParams, "label-width": e.labelWidth } }, "el-form", e.attrs, !1), [e._l(e.formItem, function(a) {
974
+ return t("el-form-item", e._b({ key: a.prop, attrs: { rules: e.getItemRules(a) } }, "el-form-item", a, !1), [a.type === "input" ? t("el-input", e._g(e._b({ attrs: { size: e.size }, nativeOn: { keydown: function(n) {
975
+ return !n.type.indexOf("key") && e._k(n.keyCode, "enter", 13, n.key, "Enter") ? null : e.getList.apply(null, arguments);
976
+ } }, scopedSlots: e._u([e._l(a.template, function(n, o) {
977
+ return { key: o, fn: function() {
978
+ return [n ? t(e.currentInputComponent(), { key: o, tag: "component", attrs: { templateEle: n } }) : e._e()];
395
979
  }, proxy: !0 };
396
- })], null, !0), model: { value: e.queryParams[r.prop], callback: function(s) {
397
- e.$set(e.queryParams, r.prop, s);
398
- }, expression: "queryParams[item.prop]" } }, "el-input", e.getInputSetting(r), !1), e.getInputEvents(r))) : r.type === "input-mobile-verification" ? a("el-input", e._g(e._b({ attrs: { size: e.size }, nativeOn: { keydown: function(s) {
399
- return !s.type.indexOf("key") && e._k(s.keyCode, "enter", 13, s.key, "Enter") ? null : e.getList.apply(null, arguments);
400
- } }, scopedSlots: e._u([e._l(r.template, function(s, i) {
401
- return { key: i, fn: function() {
402
- return [s ? a(e.currentInputComponent(), { key: i, tag: "component", attrs: { templateEle: s } }) : e._e()];
980
+ })], null, !0), model: { value: e.queryParams[a.prop], callback: function(n) {
981
+ e.$set(e.queryParams, a.prop, n);
982
+ }, expression: "queryParams[item.prop]" } }, "el-input", e.getInputSetting(a), !1), e.getInputEvents(a))) : a.type === "input-mobile-verification" ? t("el-input", e._g(e._b({ attrs: { size: e.size }, nativeOn: { keydown: function(n) {
983
+ return !n.type.indexOf("key") && e._k(n.keyCode, "enter", 13, n.key, "Enter") ? null : e.getList.apply(null, arguments);
984
+ } }, scopedSlots: e._u([e._l(a.template, function(n, o) {
985
+ return { key: o, fn: function() {
986
+ return [n ? t(e.currentInputComponent(), { key: o, tag: "component", attrs: { templateEle: n } }) : e._e()];
403
987
  }, proxy: !0 };
404
- })], null, !0), model: { value: e.queryParams[r.prop], callback: function(s) {
405
- e.$set(e.queryParams, r.prop, s);
406
- }, expression: "queryParams[item.prop]" } }, "el-input", e.getInputSetting(r), !1), e.getInputEvents(r)), [a("template", { slot: "append" }, [a("verification-button", { attrs: { verificationSetting: r.verificationSetting, getSmscode: r.getSmscode } })], 1)], 2) : r.type === "select" ? a("el-select", e._g(e._b({ attrs: { filterable: "", size: e.size }, model: { value: e.queryParams[r.prop], callback: function(s) {
407
- e.$set(e.queryParams, r.prop, s);
408
- }, expression: "queryParams[item.prop]" } }, "el-select", e.getSelectSetting(r), !1), e.getSelectEvents(r)), e._l(r.option || [], function(s) {
409
- return a("el-option", { key: s.key || s.value, attrs: { label: s.label, value: s.value } });
410
- }), 1) : r.type === "cascader" ? a("el-cascader", e._g(e._b({ attrs: { filterable: "", size: e.size, options: r.options || [] }, model: { value: e.queryParams[r.prop], callback: function(s) {
411
- e.$set(e.queryParams, r.prop, s);
412
- }, expression: "queryParams[item.prop]" } }, "el-cascader", e.getSelectSetting(r), !1), e.getSelectEvents(r))) : r.type === "date-picker" ? a("el-date-picker", e._g(e._b({ attrs: { size: e.size }, model: { value: e.queryParams[r.prop], callback: function(s) {
413
- e.$set(e.queryParams, r.prop, s);
414
- }, expression: "queryParams[item.prop]" } }, "el-date-picker", e.getDatePackerSetting(r), !1), e.getDatePackerEvents(r))) : e._e(), r.type === "input-number" ? a("el-input-number", e._g(e._b({ attrs: { size: e.size }, model: { value: e.queryParams[r.prop], callback: function(s) {
415
- e.$set(e.queryParams, r.prop, s);
416
- }, expression: "queryParams[item.prop]" } }, "el-input-number", e.getInputSetting(r), !1), e.getInputEvents(r))) : r.type === "checkbox" ? a("el-checkbox-group", e._g(e._b({ attrs: { size: e.size }, model: { value: e.queryParams[r.prop], callback: function(s) {
417
- e.$set(e.queryParams, r.prop, s);
418
- }, expression: "queryParams[item.prop]" } }, "el-checkbox-group", e.getCheckboxGroupSetting(r), !1), e.getCheckboxGroupEvents(r)), e._l(r.option || [], function(s) {
419
- return a("el-checkbox", e._b({ key: s.key || s.value || s.label }, "el-checkbox", s, !1));
420
- }), 1) : e._e(), /^form-item-slot$/i.test(r.type) ? e._t(r.name) : e._e()], 2);
421
- }), e._t("default"), e.formOnly ? e._e() : a("el-form-item", [a("el-button", { attrs: { type: "primary", icon: "el-icon-search", size: e.size, loading: e.formLoading }, on: { click: e.handleQuery } }, [e._v("查询")]), a("el-button", { attrs: { icon: "el-icon-refresh", size: e.size }, on: { click: e.resetQuery } }, [e._v("重置")])], 1), e._t("behind-the-button")], 2);
422
- }, F = [], q = /* @__PURE__ */ u(
423
- $,
424
- C,
425
- F,
988
+ })], null, !0), model: { value: e.queryParams[a.prop], callback: function(n) {
989
+ e.$set(e.queryParams, a.prop, n);
990
+ }, expression: "queryParams[item.prop]" } }, "el-input", e.getInputSetting(a), !1), e.getInputEvents(a)), [t("template", { slot: "append" }, [t("verification-button", { attrs: { verificationSetting: a.verificationSetting, getSmscode: a.getSmscode } })], 1)], 2) : a.type === "select" ? t("el-select", e._g(e._b({ attrs: { filterable: "", size: e.size }, model: { value: e.queryParams[a.prop], callback: function(n) {
991
+ e.$set(e.queryParams, a.prop, n);
992
+ }, expression: "queryParams[item.prop]" } }, "el-select", e.getSelectSetting(a), !1), e.getSelectEvents(a)), e._l(a.option || [], function(n) {
993
+ return t("el-option", { key: n.key || n.value, attrs: { label: n.label, value: n.value } });
994
+ }), 1) : a.type === "cascader" ? t("el-cascader", e._g(e._b({ attrs: { filterable: "", size: e.size, options: a.options || [] }, model: { value: e.queryParams[a.prop], callback: function(n) {
995
+ e.$set(e.queryParams, a.prop, n);
996
+ }, expression: "queryParams[item.prop]" } }, "el-cascader", e.getSelectSetting(a), !1), e.getSelectEvents(a))) : a.type === "date-picker" ? t("el-date-picker", e._g(e._b({ attrs: { size: e.size }, model: { value: e.queryParams[a.prop], callback: function(n) {
997
+ e.$set(e.queryParams, a.prop, n);
998
+ }, expression: "queryParams[item.prop]" } }, "el-date-picker", e.getDatePackerSetting(a), !1), e.getDatePackerEvents(a))) : e._e(), a.type === "input-number" ? t("el-input-number", e._g(e._b({ attrs: { size: e.size }, model: { value: e.queryParams[a.prop], callback: function(n) {
999
+ e.$set(e.queryParams, a.prop, n);
1000
+ }, expression: "queryParams[item.prop]" } }, "el-input-number", e.getInputSetting(a), !1), e.getInputEvents(a))) : a.type === "checkbox" ? t("el-checkbox-group", e._g(e._b({ attrs: { size: e.size }, model: { value: e.queryParams[a.prop], callback: function(n) {
1001
+ e.$set(e.queryParams, a.prop, n);
1002
+ }, expression: "queryParams[item.prop]" } }, "el-checkbox-group", e.getCheckboxGroupSetting(a), !1), e.getCheckboxGroupEvents(a)), e._l(a.option || [], function(n) {
1003
+ return t("el-checkbox", e._b({ key: n.key || n.value || n.label }, "el-checkbox", n, !1));
1004
+ }), 1) : e._e(), /^form-item-slot$/i.test(a.type) ? e._t(a.name) : e._e()], 2);
1005
+ }), e._t("default"), e.formOnly ? e._e() : t("el-form-item", [t("el-button", { attrs: { type: "primary", icon: "el-icon-search", size: e.size, loading: e.formLoading }, on: { click: e.handleQuery } }, [e._v("查询")]), t("el-button", { attrs: { icon: "el-icon-refresh", size: e.size }, on: { click: e.resetQuery } }, [e._v("重置")])], 1), e._t("behind-the-button")], 2);
1006
+ }, Ie = [], Ne = /* @__PURE__ */ I(
1007
+ Te,
1008
+ Ke,
1009
+ Ie,
426
1010
  !1,
427
1011
  null,
428
- "b0880d48",
1012
+ "1bb4e2ca",
429
1013
  null,
430
1014
  null
431
1015
  );
432
- const N = q.exports;
433
- const w = {
1016
+ const $e = Ne.exports;
1017
+ const Ce = {
434
1018
  components: {},
435
1019
  props: {
436
1020
  query: {
@@ -461,18 +1045,18 @@ const w = {
461
1045
  }
462
1046
  },
463
1047
  data() {
464
- var t, e;
1048
+ var r, e;
465
1049
  return {
466
- keyWord: ((e = (t = this.$route) == null ? void 0 : t.query) == null ? void 0 : e.keyWord) || "",
1050
+ keyWord: ((e = (r = this.$route) == null ? void 0 : r.query) == null ? void 0 : e.keyWord) || "",
467
1051
  attrs: {}
468
1052
  };
469
1053
  },
470
1054
  watch: {
471
1055
  $attrs: {
472
- handler(t) {
1056
+ handler(r) {
473
1057
  this.attrs = {
474
1058
  ...this.attrs,
475
- ...t
1059
+ ...r
476
1060
  };
477
1061
  },
478
1062
  immediate: !0,
@@ -481,33 +1065,33 @@ const w = {
481
1065
  },
482
1066
  methods: {
483
1067
  search() {
484
- const t = { path: this.routePath, query: { ...this.query, keyWord: this.keyWord } };
1068
+ const r = { path: this.routePath, query: { ...this.query, keyWord: this.keyWord } };
485
1069
  if (this.openHref) {
486
- const e = this.$router.resolve(t);
1070
+ const e = this.$router.resolve(r);
487
1071
  window.open(e.href, "_blank");
488
1072
  } else
489
- this.$router.push(t);
1073
+ this.$router.push(r);
490
1074
  }
491
1075
  }
492
1076
  };
493
- var O = function() {
494
- var e = this, a = e._self._c;
495
- return a("div", { staticClass: "search-box" }, [a("el-input", e._b({ style: { ...e.inputstyle }, attrs: { size: e.size }, nativeOn: { keydown: function(r) {
496
- return !r.type.indexOf("key") && e._k(r.keyCode, "enter", 13, r.key, "Enter") ? null : e.search.apply(null, arguments);
497
- } }, model: { value: e.keyWord, callback: function(r) {
498
- e.keyWord = r;
499
- }, expression: "keyWord" } }, "el-input", e.attrs, !1), [a("svg", { staticClass: "el-input__icon", attrs: { slot: "prefix", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, slot: "prefix" }, [a("path", { attrs: { d: "M9.51033 10.2186C8.69189 10.8814 7.64943 11.2784 6.51424 11.2784C3.88302 11.2784 1.75 9.14541 1.75 6.51421C1.75 3.88301 3.88302 1.75 6.51424 1.75C9.14545 1.75 11.2785 3.88301 11.2785 6.51421C11.2785 7.64942 10.8814 8.69189 10.2186 9.51034L13.75 13.0417L13.0417 13.75L9.51033 10.2186ZM10.2768 6.51421C10.2768 4.43623 8.59224 2.75168 6.51424 2.75168C4.43623 2.75168 2.75168 4.43623 2.75168 6.51421C2.75168 8.59219 4.43623 10.2767 6.51424 10.2767C8.59224 10.2767 10.2768 8.59219 10.2768 6.51421Z", fill: "#959A9F" } })])])], 1);
500
- }, D = [], z = /* @__PURE__ */ u(
501
- w,
502
- O,
503
- D,
1077
+ var Fe = function() {
1078
+ var e = this, t = e._self._c;
1079
+ return t("div", { staticClass: "search-box" }, [t("el-input", e._b({ style: { ...e.inputstyle }, attrs: { size: e.size }, nativeOn: { keydown: function(a) {
1080
+ return !a.type.indexOf("key") && e._k(a.keyCode, "enter", 13, a.key, "Enter") ? null : e.search.apply(null, arguments);
1081
+ } }, model: { value: e.keyWord, callback: function(a) {
1082
+ e.keyWord = a;
1083
+ }, expression: "keyWord" } }, "el-input", e.attrs, !1), [t("svg", { staticClass: "el-input__icon", attrs: { slot: "prefix", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, slot: "prefix" }, [t("path", { attrs: { d: "M9.51033 10.2186C8.69189 10.8814 7.64943 11.2784 6.51424 11.2784C3.88302 11.2784 1.75 9.14541 1.75 6.51421C1.75 3.88301 3.88302 1.75 6.51424 1.75C9.14545 1.75 11.2785 3.88301 11.2785 6.51421C11.2785 7.64942 10.8814 8.69189 10.2186 9.51034L13.75 13.0417L13.0417 13.75L9.51033 10.2186ZM10.2768 6.51421C10.2768 4.43623 8.59224 2.75168 6.51424 2.75168C4.43623 2.75168 2.75168 4.43623 2.75168 6.51421C2.75168 8.59219 4.43623 10.2767 6.51424 10.2767C8.59224 10.2767 10.2768 8.59219 10.2768 6.51421Z", fill: "#959A9F" } })])])], 1);
1084
+ }, qe = [], Oe = /* @__PURE__ */ I(
1085
+ Ce,
1086
+ Fe,
1087
+ qe,
504
1088
  !1,
505
1089
  null,
506
1090
  "ef706e31",
507
1091
  null,
508
1092
  null
509
1093
  );
510
- const I = z.exports, B = {
1094
+ const ze = Oe.exports, Re = {
511
1095
  functional: !0,
512
1096
  props: {
513
1097
  column: {
@@ -520,14 +1104,14 @@ const I = z.exports, B = {
520
1104
  type: Object
521
1105
  }
522
1106
  },
523
- render(t, e) {
524
- const { props: a } = e, { column: r, formData: s } = a;
525
- return r.render(s);
1107
+ render(r, e) {
1108
+ const { props: t } = e, { column: a, formData: n } = t;
1109
+ return a.render(n);
526
1110
  }
527
- }, K = {
1111
+ }, je = {
528
1112
  name: "Descriptions",
529
1113
  components: {
530
- DescriptionsColumn: B
1114
+ DescriptionsColumn: Re
531
1115
  },
532
1116
  data() {
533
1117
  return {
@@ -552,10 +1136,10 @@ const I = z.exports, B = {
552
1136
  },
553
1137
  watch: {
554
1138
  $attrs: {
555
- handler(t) {
1139
+ handler(r) {
556
1140
  this.attrs = {
557
1141
  ...this.attrs,
558
- ...t
1142
+ ...r
559
1143
  };
560
1144
  },
561
1145
  immediate: !0,
@@ -563,23 +1147,23 @@ const I = z.exports, B = {
563
1147
  }
564
1148
  }
565
1149
  };
566
- var L = function() {
567
- var e = this, a = e._self._c;
568
- return a("el-descriptions", e._b({}, "el-descriptions", e.attrs, !1), e._l(e.formItem, function(r, s) {
569
- return a("el-descriptions-item", e._b({ key: r.prop, attrs: { label: r.label } }, "el-descriptions-item", r.descriptionsItemProps, !1), [r.render ? a("DescriptionsColumn", { attrs: { column: r, formData: e.formData } }) : a("span", [e._v(e._s(e.formData[r.prop]))])], 1);
1150
+ var Ee = function() {
1151
+ var e = this, t = e._self._c;
1152
+ return t("el-descriptions", e._b({}, "el-descriptions", e.attrs, !1), e._l(e.formItem, function(a, n) {
1153
+ return t("el-descriptions-item", e._b({ key: a.prop, attrs: { label: a.label } }, "el-descriptions-item", a.descriptionsItemProps, !1), [a.render ? t("DescriptionsColumn", { attrs: { column: a, formData: e.formData } }) : t("span", [e._v(e._s(e.formData[a.prop]))])], 1);
570
1154
  }), 1);
571
- }, R = [], E = /* @__PURE__ */ u(
572
- K,
573
- L,
574
- R,
1155
+ }, Ve = [], Le = /* @__PURE__ */ I(
1156
+ je,
1157
+ Ee,
1158
+ Ve,
575
1159
  !1,
576
1160
  null,
577
1161
  null,
578
1162
  null,
579
1163
  null
580
1164
  );
581
- const A = E.exports;
582
- const U = {
1165
+ const Qe = Le.exports;
1166
+ const Ae = {
583
1167
  props: {
584
1168
  nodeKey: {
585
1169
  type: String,
@@ -599,15 +1183,15 @@ const U = {
599
1183
  }
600
1184
  },
601
1185
  watch: {
602
- sourceFilterText(t) {
603
- this.$refs.sourceTree.filter(t);
1186
+ sourceFilterText(r) {
1187
+ this.$refs.sourceTree.filter(r);
604
1188
  },
605
- selectedFilterText(t) {
606
- this.$refs.selectTree.filter(t);
1189
+ selectedFilterText(r) {
1190
+ this.$refs.selectTree.filter(r);
607
1191
  },
608
- checkedKeys(t) {
609
- this.$refs.sourceTree.setCheckedKeys(t), m(() => {
610
- this.getSelectedData(), this.$refs.selectTree.setCheckedKeys(t);
1192
+ checkedKeys(r) {
1193
+ this.$refs.sourceTree.setCheckedKeys(r), te(() => {
1194
+ this.getSelectedData(), this.$refs.selectTree.setCheckedKeys(r);
611
1195
  });
612
1196
  }
613
1197
  },
@@ -623,42 +1207,42 @@ const U = {
623
1207
  };
624
1208
  },
625
1209
  methods: {
626
- sourceFilterNode(t, e) {
627
- return t ? e.label.indexOf(t) !== -1 : !0;
1210
+ sourceFilterNode(r, e) {
1211
+ return r ? e.label.indexOf(r) !== -1 : !0;
628
1212
  },
629
1213
  getSelectedData() {
630
- let t = !0, e;
631
- const a = this.$refs.sourceTree.getCheckedNodes(t, e);
632
- this.selectedList = a;
1214
+ let r = !0, e;
1215
+ const t = this.$refs.sourceTree.getCheckedNodes(r, e);
1216
+ this.selectedList = t;
633
1217
  },
634
1218
  removeSelectedData() {
635
- let t, e;
636
- const a = this.$refs.selectTree.getCheckedNodes(t, e), r = {};
637
- a.forEach((s) => {
638
- r[s[this.nodeKey]] = s;
639
- }), this.selectedList = this.selectedList.filter((s) => !r[s[this.nodeKey]]);
1219
+ let r, e;
1220
+ const t = this.$refs.selectTree.getCheckedNodes(r, e), a = {};
1221
+ t.forEach((n) => {
1222
+ a[n[this.nodeKey]] = n;
1223
+ }), this.selectedList = this.selectedList.filter((n) => !a[n[this.nodeKey]]);
640
1224
  }
641
1225
  }
642
1226
  };
643
- var j = function() {
644
- var e = this, a = e._self._c;
645
- return a("div", { staticClass: "tree-box" }, [a("div", { staticClass: "left-box" }, [e.filterable ? a("el-input", { attrs: { placeholder: "输入关键字进行过滤" }, model: { value: e.sourceFilterText, callback: function(r) {
646
- e.sourceFilterText = r;
647
- }, expression: "sourceFilterText" } }) : e._e(), a("el-tree", e._b({ ref: "sourceTree", attrs: { data: e.dataSource, "filter-node-method": e.sourceFilterNode, nodeKey: e.nodeKey } }, "el-tree", { ...e.defaultTreeAttributes }, !1))], 1), a("div", { staticClass: "mid-box" }, [a("el-button", { attrs: { icon: "el-icon-arrow-right", circle: "" }, on: { click: e.getSelectedData } }), a("el-button", { attrs: { icon: "el-icon-arrow-left", circle: "" }, on: { click: e.removeSelectedData } })], 1), a("div", { staticClass: "right-box" }, [e.filterable ? a("el-input", { attrs: { placeholder: "输入关键字进行过滤" }, model: { value: e.selectedFilterText, callback: function(r) {
648
- e.selectedFilterText = r;
649
- }, expression: "selectedFilterText" } }) : e._e(), a("el-tree", e._b({ ref: "selectTree", attrs: { data: e.selectedList, "filter-node-method": e.sourceFilterNode, nodeKey: e.nodeKey } }, "el-tree", { ...e.defaultTreeAttributes }, !1))], 1)]);
650
- }, W = [], G = /* @__PURE__ */ u(
651
- U,
652
- j,
653
- W,
1227
+ var We = function() {
1228
+ var e = this, t = e._self._c;
1229
+ return t("div", { staticClass: "tree-box" }, [t("div", { staticClass: "left-box" }, [e.filterable ? t("el-input", { attrs: { placeholder: "输入关键字进行过滤" }, model: { value: e.sourceFilterText, callback: function(a) {
1230
+ e.sourceFilterText = a;
1231
+ }, expression: "sourceFilterText" } }) : e._e(), t("el-tree", e._b({ ref: "sourceTree", attrs: { data: e.dataSource, "filter-node-method": e.sourceFilterNode, nodeKey: e.nodeKey } }, "el-tree", { ...e.defaultTreeAttributes }, !1))], 1), t("div", { staticClass: "mid-box" }, [t("el-button", { attrs: { icon: "el-icon-arrow-right", circle: "" }, on: { click: e.getSelectedData } }), t("el-button", { attrs: { icon: "el-icon-arrow-left", circle: "" }, on: { click: e.removeSelectedData } })], 1), t("div", { staticClass: "right-box" }, [e.filterable ? t("el-input", { attrs: { placeholder: "输入关键字进行过滤" }, model: { value: e.selectedFilterText, callback: function(a) {
1232
+ e.selectedFilterText = a;
1233
+ }, expression: "selectedFilterText" } }) : e._e(), t("el-tree", e._b({ ref: "selectTree", attrs: { data: e.selectedList, "filter-node-method": e.sourceFilterNode, nodeKey: e.nodeKey } }, "el-tree", { ...e.defaultTreeAttributes }, !1))], 1)]);
1234
+ }, Ge = [], He = /* @__PURE__ */ I(
1235
+ Ae,
1236
+ We,
1237
+ Ge,
654
1238
  !1,
655
1239
  null,
656
1240
  "49dbad2a",
657
1241
  null,
658
1242
  null
659
1243
  );
660
- const V = G.exports;
661
- const Q = {
1244
+ const Je = He.exports;
1245
+ const { getData: Ue } = ee, { formSchema: Me } = X, Ye = {
662
1246
  name: "VTabs",
663
1247
  data() {
664
1248
  return {
@@ -671,10 +1255,13 @@ const Q = {
671
1255
  type: Array,
672
1256
  default: () => []
673
1257
  },
674
- noUrlParameters: {
675
- // 不接受和不改变url的参数
676
- type: Boolean,
677
- default: () => !1
1258
+ parametersType: {
1259
+ type: String,
1260
+ default: "url"
1261
+ },
1262
+ DBPrimaryKey: {
1263
+ type: [String, Number],
1264
+ required: !1
678
1265
  },
679
1266
  activeNameKey: {
680
1267
  type: String,
@@ -692,63 +1279,67 @@ const Q = {
692
1279
  },
693
1280
  watch: {
694
1281
  defActiveName: {
695
- handler(t, e) {
696
- JSON.stringify(t) !== JSON.stringify(e) && (this.activeName = t);
1282
+ handler(r, e) {
1283
+ JSON.stringify(r) !== JSON.stringify(this.activeName) && (this.activeName = r);
697
1284
  },
698
1285
  immediate: !0
699
1286
  },
700
1287
  activeName: {
701
- handler(t) {
702
- this.$emit(`update:${this.activeNameKey}`, t);
1288
+ handler(r) {
1289
+ this.$emit(`update:${this.activeNameKey}`, r);
703
1290
  }
704
1291
  }
705
1292
  },
706
1293
  methods: {
707
- handleClick(t, e) {
708
- var r;
709
- const a = c.paramsToQuery(
710
- {
711
- ...(r = this.$route) == null ? void 0 : r.query,
712
- [this.activeNameKey]: this.activeName
713
- }
714
- );
715
- this.noUrlParameters || this.$router.push({
716
- query: { ...a }
717
- }), this.getList({
718
- ...a
1294
+ async handleClick(r, e) {
1295
+ const t = await O.makeParamsByType({
1296
+ [this.activeNameKey]: this.activeName
1297
+ }, this);
1298
+ await O.saveParamsByType(t, this), this.getList({
1299
+ ...t
719
1300
  });
720
1301
  },
721
1302
  activeNameInit() {
722
- var a, r, s;
723
- let t = "";
724
- (a = this.tabPanes[0]) != null && a.name && (t = (r = this.tabPanes[0]) == null ? void 0 : r.name);
725
- const e = c.queryToData(Number((s = this.$route) == null ? void 0 : s.query[this.activeNameKey]));
726
- return !this.noUrlParameters && e && (t = e), this.defActiveName && (t = this.defActiveName), `${t}`;
1303
+ var t, a, n;
1304
+ let r = "";
1305
+ (t = this.tabPanes[0]) != null && t.name && (r = (a = this.tabPanes[0]) == null ? void 0 : a.name);
1306
+ const e = Z.queryToData(Number((n = this.$route) == null ? void 0 : n.query[this.activeNameKey]));
1307
+ return this.parametersType === "url" && e && (r = e), this.parametersType === "indexDB" && Ue(
1308
+ {
1309
+ tableName: "formParams",
1310
+ propertiesKey: this.$route.path || "defQueryParams",
1311
+ primaryKey: this.DBPrimaryKey || "default",
1312
+ mapDB: Me
1313
+ },
1314
+ (o) => {
1315
+ this.activeName = o == null ? void 0 : o[this.activeNameKey];
1316
+ }
1317
+ ), this.defActiveName && (r = this.defActiveName), `${r}`;
727
1318
  }
728
1319
  }
729
1320
  };
730
- var J = function() {
731
- var e = this, a = e._self._c;
732
- return a("el-tabs", e._b({ on: { "tab-click": e.handleClick }, model: { value: e.activeName, callback: function(r) {
733
- e.activeName = r;
734
- }, expression: "activeName" } }, "el-tabs", e.$attrs, !1), [e._l(e.tabPanes, function(r) {
735
- return a("el-tab-pane", e._b({ key: r.name }, "el-tab-pane", r, !1), [e._v(" " + e._s(r.render && r.render(r)) + " ")]);
1321
+ var Ze = function() {
1322
+ var e = this, t = e._self._c;
1323
+ return t("el-tabs", e._b({ on: { "tab-click": e.handleClick }, model: { value: e.activeName, callback: function(a) {
1324
+ e.activeName = a;
1325
+ }, expression: "activeName" } }, "el-tabs", e.$attrs, !1), [e._l(e.tabPanes, function(a) {
1326
+ return t("el-tab-pane", e._b({ key: a.name }, "el-tab-pane", a, !1), [e._v(" " + e._s(a.render && a.render(a)) + " ")]);
736
1327
  }), e._t("default")], 2);
737
- }, H = [], M = /* @__PURE__ */ u(
738
- Q,
739
- J,
740
- H,
1328
+ }, Xe = [], et = /* @__PURE__ */ I(
1329
+ Ye,
1330
+ Ze,
1331
+ Xe,
741
1332
  !1,
742
1333
  null,
743
- "91cf6f01",
1334
+ "27244d13",
744
1335
  null,
745
1336
  null
746
1337
  );
747
- const X = M.exports, Y = N, ee = I, te = A, re = V, ae = X;
1338
+ const tt = et.exports, at = $e, nt = ze, st = Qe, ot = Je, it = tt;
748
1339
  export {
749
- te as VDescriptions,
750
- Y as VGeneralBasicForm,
751
- ee as VSearchBox,
752
- ae as VTabs,
753
- re as VTreeTransfer
1340
+ st as VDescriptions,
1341
+ at as VGeneralBasicForm,
1342
+ nt as VSearchBox,
1343
+ it as VTabs,
1344
+ ot as VTreeTransfer
754
1345
  };