joy-admin-components 0.1.38 → 0.1.40

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.
@@ -6,7 +6,7 @@ import Je, { dayjs as qe } from "dayjs";
6
6
  import { createI18n as kt, useI18n as de } from "vue-i18n";
7
7
  import { debounce as We, cloneDeep as Qe, isArray as Pe } from "lodash";
8
8
  import ee from "crypto-js";
9
- import { createNamespacedHelpers as Fe, useStore as Xe, mapState as _t, mapGetters as $t, mapActions as St } from "vuex";
9
+ import { createNamespacedHelpers as Le, useStore as Xe, mapState as _t, mapGetters as $t, mapActions as St } from "vuex";
10
10
  import { VxeUI as me } from "vxe-pc-ui";
11
11
  import { useRouter as Et } from "vue-router";
12
12
  const gn = Ye({
@@ -75,9 +75,9 @@ var nt = { exports: {} };
75
75
  var $ = this.$utils().u;
76
76
  if ($(u))
77
77
  return this.$u ? 0 : $(this.$offset) ? k.call(this) : this.$offset;
78
- if (typeof u == "string" && (u = function(F) {
79
- F === void 0 && (F = "");
80
- var Y = F.match(l);
78
+ if (typeof u == "string" && (u = function(L) {
79
+ L === void 0 && (L = "");
80
+ var Y = L.match(l);
81
81
  if (!Y)
82
82
  return null;
83
83
  var _ = ("" + Y[0]).match(o) || ["-", 0, 0], y = _[0], g = 60 * +_[1] + +_[2];
@@ -134,8 +134,8 @@ var ot = { exports: {} };
134
134
  b === void 0 && (b = {});
135
135
  var u = new Date(x), f = function($, h) {
136
136
  h === void 0 && (h = {});
137
- var m = h.timeZoneName || "short", E = $ + "|" + m, F = l[E];
138
- return F || (F = new Intl.DateTimeFormat("en-US", { hour12: !1, timeZone: $, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZoneName: m }), l[E] = F), F;
137
+ var m = h.timeZoneName || "short", E = $ + "|" + m, L = l[E];
138
+ return L || (L = new Intl.DateTimeFormat("en-US", { hour12: !1, timeZone: $, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZoneName: m }), l[E] = L), L;
139
139
  }(w, b);
140
140
  return f.formatToParts(u);
141
141
  }, v = function(x, w) {
@@ -143,7 +143,7 @@ var ot = { exports: {} };
143
143
  var $ = b[f], h = $.type, m = $.value, E = t[h];
144
144
  E >= 0 && (u[E] = parseInt(m, 10));
145
145
  }
146
- var F = u[3], Y = F === 24 ? 0 : F, _ = u[0] + "-" + u[1] + "-" + u[2] + " " + Y + ":" + u[4] + ":" + u[5] + ":000", y = +x;
146
+ var L = u[3], Y = L === 24 ? 0 : L, _ = u[0] + "-" + u[1] + "-" + u[2] + " " + Y + ":" + u[4] + ":" + u[5] + ":000", y = +x;
147
147
  return (a.utc(_).valueOf() - (y -= y % 1e3)) / 6e4;
148
148
  }, p = r.prototype;
149
149
  p.tz = function(x, w) {
@@ -178,8 +178,8 @@ var ot = { exports: {} };
178
178
  return [g, _];
179
179
  var z = v(g -= 60 * (P - _) * 1e3, y);
180
180
  return P === z ? [g, P] : [Y - 60 * Math.min(P, z) * 1e3, Math.max(P, z)];
181
- }(a.utc(x, u).valueOf(), $, f), m = h[0], E = h[1], F = a(m).utcOffset(E);
182
- return F.$x.$timezone = f, F;
181
+ }(a.utc(x, u).valueOf(), $, f), m = h[0], E = h[1], L = a(m).utcOffset(E);
182
+ return L.$x.$timezone = f, L;
183
183
  }, a.tz.guess = function() {
184
184
  return Intl.DateTimeFormat().resolvedOptions().timeZone;
185
185
  }, a.tz.setDefault = function(x) {
@@ -188,8 +188,8 @@ var ot = { exports: {} };
188
188
  };
189
189
  });
190
190
  })(ot);
191
- var Ft = ot.exports;
192
- const Lt = /* @__PURE__ */ tt(Ft), Ee = {
191
+ var Lt = ot.exports;
192
+ const Ft = /* @__PURE__ */ tt(Lt), Ee = {
193
193
  // 组件通用文本
194
194
  "dao-ru": "导入",
195
195
  "quan-xuan": "全选",
@@ -208,7 +208,8 @@ const Lt = /* @__PURE__ */ tt(Ft), Ee = {
208
208
  fieldsMappingRequired: "请输入列字段映射",
209
209
  invalidInput: "非法输入",
210
210
  invalidOption: "请输入有效选项!",
211
- copyFailed: "复制失败"
211
+ copyFailed: "复制失败",
212
+ sheetNameTooLong: 'Sheet名称 "{0}" 长度超过31个字符,已自动截断为 "{1}"'
212
213
  },
213
214
  // 表单验证相关
214
215
  validate: {
@@ -237,7 +238,8 @@ const Lt = /* @__PURE__ */ tt(Ft), Ee = {
237
238
  fieldsMappingRequired: "Please enter column field mapping",
238
239
  invalidInput: "Invalid input",
239
240
  invalidOption: "Please enter a valid option!",
240
- copyFailed: "Copy failed"
241
+ copyFailed: "Copy failed",
242
+ sheetNameTooLong: 'Sheet name "{0}" exceeds 31 characters, automatically truncated to "{1}"'
241
243
  },
242
244
  // Form validation
243
245
  validate: {
@@ -267,15 +269,15 @@ function Dt(n = null) {
267
269
  function lt() {
268
270
  return ce || Dt();
269
271
  }
270
- function Le() {
272
+ function Fe() {
271
273
  return lt().global.t;
272
274
  }
273
275
  Je.extend(Tt);
274
- Je.extend(Lt);
276
+ Je.extend(Ft);
275
277
  async function vn(n, e) {
276
278
  const { fields: t, range: l = 1 } = e;
277
279
  if (!t) {
278
- const a = Le();
280
+ const a = Fe();
279
281
  throw new Error(a("excel.fieldsMappingRequired"));
280
282
  }
281
283
  let o = new Ge.Workbook();
@@ -455,7 +457,7 @@ function xn(n, e = [], t = "i18nName") {
455
457
  if (n.length == 0)
456
458
  return new Be([]);
457
459
  if (e.length < 2) {
458
- const o = Le();
460
+ const o = Fe();
459
461
  throw new Error(o("tools.keysLengthError"));
460
462
  }
461
463
  let l = n.map((o) => {
@@ -537,14 +539,14 @@ const ge = (n, e) => {
537
539
  const t = n, l = vt(), { t: o, locale: r } = de(), a = bt(n, "modelValue"), c = q(""), s = ue(() => {
538
540
  if (l.remote !== void 0)
539
541
  return t.data;
540
- const h = rt(c.value), { data: m, labelValue: E } = t, F = m || k.value;
542
+ const h = rt(c.value), { data: m, labelValue: E } = t, L = m || k.value;
541
543
  if (h.length == 0)
542
- return F;
544
+ return L;
543
545
  const { label: Y, labelEn: _ } = E;
544
546
  let y = r.value == "en_us" ? _ || "i18nName" : Y;
545
- return h.length == 1 ? F.filter(
547
+ return h.length == 1 ? L.filter(
546
548
  (P) => P[y].toLowerCase().includes(h[0].toLowerCase())
547
- ) : F.filter((P) => {
549
+ ) : L.filter((P) => {
548
550
  let z = !1;
549
551
  return z = h.some((fe) => P[y].toLowerCase() == fe.toLowerCase()), z;
550
552
  });
@@ -583,7 +585,7 @@ const ge = (n, e) => {
583
585
  return a.value.length >= t.maxLimit && !a.value.includes(h[t.labelValue.value]);
584
586
  }
585
587
  return (h, m) => {
586
- const E = O("el-checkbox"), F = O("el-option"), Y = O("el-select");
588
+ const E = O("el-checkbox"), L = O("el-option"), Y = O("el-select");
587
589
  return T(), U(Y, pe({
588
590
  modelValue: a.value,
589
591
  "onUpdate:modelValue": m[1] || (m[1] = (_) => a.value = _),
@@ -607,7 +609,7 @@ const ge = (n, e) => {
607
609
  _: 1
608
610
  }, 8, ["modelValue"])
609
611
  ], !0) : ie("", !0),
610
- (T(!0), re(_e, null, Ne(s.value, (_, y) => (T(), U(F, {
612
+ (T(!0), re(_e, null, Ne(s.value, (_, y) => (T(), U(L, {
611
613
  key: y,
612
614
  label: b(_),
613
615
  disabled: K(l).multiple != null && n.maxLimit > 0 ? $(_) : !1,
@@ -765,7 +767,7 @@ const Zt = { key: 0 }, Gt = { class: "btns" }, Jt = { class: "left" }, Wt = { cl
765
767
  });
766
768
  }
767
769
  return e({ getPrm: w, reset: u }), (f, $) => {
768
- const h = O("el-input"), m = O("el-date-picker"), E = O("el-form-item"), F = O("el-form"), Y = O("el-link"), _ = O("el-button");
770
+ const h = O("el-input"), m = O("el-date-picker"), E = O("el-form-item"), L = O("el-form"), Y = O("el-link"), _ = O("el-button");
769
771
  return T(), re("div", {
770
772
  class: "searchBar-container mgt10 mgb10",
771
773
  onKeydown: yt(v, ["enter"])
@@ -774,7 +776,7 @@ const Zt = { key: 0 }, Gt = { class: "btns" }, Jt = { class: "left" }, Wt = { cl
774
776
  class: "searchBar",
775
777
  style: Ct({ height: r.value ? "auto" : "42px" })
776
778
  }, [
777
- G(F, {
779
+ G(L, {
778
780
  inline: "",
779
781
  model: n.form.data
780
782
  }, {
@@ -982,7 +984,7 @@ const en = { class: "center" }, tn = {
982
984
  }), m();
983
985
  }
984
986
  o.api && o.immediate && m();
985
- function F() {
987
+ function L() {
986
988
  return { ...v, ...Te(o.searchForm.items) };
987
989
  }
988
990
  const Y = () => {
@@ -1019,8 +1021,8 @@ const en = { class: "center" }, tn = {
1019
1021
  if (Z != null)
1020
1022
  R = parseInt(Z, 10);
1021
1023
  else {
1022
- const L = C.parentElement;
1023
- R = Array.from(L.querySelectorAll(".vxe-body--row")).indexOf(C);
1024
+ const F = C.parentElement;
1025
+ R = Array.from(F.querySelectorAll(".vxe-body--row")).indexOf(C);
1024
1026
  }
1025
1027
  if (R < 0)
1026
1028
  return null;
@@ -1083,10 +1085,10 @@ const en = { class: "center" }, tn = {
1083
1085
  }
1084
1086
  const d = g.startCell.rowIndex, i = g.endCell.rowIndex, C = g.startCell.colIndex, I = g.endCell.colIndex, R = Math.min(d, i), Z = Math.max(d, i), V = Math.min(C, I), X = Math.max(C, I);
1085
1087
  g.selectedCells = [];
1086
- for (let L = R; L <= Z; L++)
1088
+ for (let F = R; F <= Z; F++)
1087
1089
  for (let S = V; S <= X; S++)
1088
1090
  g.selectedCells.push({
1089
- rowIndex: L,
1091
+ rowIndex: F,
1090
1092
  colIndex: S
1091
1093
  });
1092
1094
  }, ze = () => {
@@ -1107,7 +1109,7 @@ const en = { class: "center" }, tn = {
1107
1109
  );
1108
1110
  }), g.selectedCells.length === 0)
1109
1111
  return;
1110
- const C = d.getColumns(), I = g.selectedCells.map((j) => j.rowIndex), R = g.selectedCells.map((j) => j.colIndex), Z = Math.min(...I), V = Math.max(...I), X = Math.min(...R), L = Math.max(...R), S = [
1112
+ const C = d.getColumns(), I = g.selectedCells.map((j) => j.rowIndex), R = g.selectedCells.map((j) => j.colIndex), Z = Math.min(...I), V = Math.max(...I), X = Math.min(...R), F = Math.max(...R), S = [
1111
1113
  i.querySelector(".vxe-table--body-wrapper tbody"),
1112
1114
  i.querySelector(".vxe-table--fixed-left-wrapper tbody"),
1113
1115
  i.querySelector(".vxe-table--fixed-right-wrapper tbody")
@@ -1134,7 +1136,7 @@ const en = { class: "center" }, tn = {
1134
1136
  D = oe[Q + le];
1135
1137
  }
1136
1138
  if (D && !D.classList.contains("col--checkbox") && !D.classList.contains("col--seq")) {
1137
- D.classList.add("cell-selected"), j === Z && D.classList.add("cell-border-top"), j === V && D.classList.add("cell-border-bottom"), H === X && D.classList.add("cell-border-left"), H === L && D.classList.add("cell-border-right");
1139
+ D.classList.add("cell-selected"), j === Z && D.classList.add("cell-border-top"), j === V && D.classList.add("cell-border-bottom"), H === X && D.classList.add("cell-border-left"), H === F && D.classList.add("cell-border-right");
1138
1140
  break;
1139
1141
  }
1140
1142
  }
@@ -1146,16 +1148,16 @@ const en = { class: "center" }, tn = {
1146
1148
  const d = p.value;
1147
1149
  if (!d)
1148
1150
  return;
1149
- const i = d.$el, C = d.getColumns(), I = [...new Set(g.selectedCells.map((L) => L.rowIndex))].sort(
1150
- (L, S) => L - S
1151
- ), R = [...new Set(g.selectedCells.map((L) => L.colIndex))].sort(
1152
- (L, S) => L - S
1151
+ const i = d.$el, C = d.getColumns(), I = [...new Set(g.selectedCells.map((F) => F.rowIndex))].sort(
1152
+ (F, S) => F - S
1153
+ ), R = [...new Set(g.selectedCells.map((F) => F.colIndex))].sort(
1154
+ (F, S) => F - S
1153
1155
  ), Z = [
1154
1156
  i.querySelector(".vxe-table--body-wrapper tbody"),
1155
1157
  i.querySelector(".vxe-table--fixed-left-wrapper tbody"),
1156
1158
  i.querySelector(".vxe-table--fixed-right-wrapper tbody")
1157
1159
  ].filter(Boolean), V = [];
1158
- I.forEach((L) => {
1160
+ I.forEach((F) => {
1159
1161
  const S = [];
1160
1162
  R.forEach((j) => {
1161
1163
  const H = C[j];
@@ -1166,7 +1168,7 @@ const en = { class: "center" }, tn = {
1166
1168
  const A = H.fixed === "left", N = H.fixed === "right";
1167
1169
  let B = "";
1168
1170
  for (const J of Z) {
1169
- const he = J.querySelectorAll(".vxe-body--row")[L];
1171
+ const he = J.querySelectorAll(".vxe-body--row")[F];
1170
1172
  if (!he)
1171
1173
  continue;
1172
1174
  const oe = Array.from(he.querySelectorAll(".vxe-body--column"));
@@ -1193,8 +1195,8 @@ const en = { class: "center" }, tn = {
1193
1195
  `);
1194
1196
  try {
1195
1197
  await navigator.clipboard.writeText(X);
1196
- } catch (L) {
1197
- console.error(t("excel.copyFailed"), L);
1198
+ } catch (F) {
1199
+ console.error(t("excel.copyFailed"), F);
1198
1200
  }
1199
1201
  }, Ae = (d) => {
1200
1202
  o.searchForm.enableCellCopy && ((d.ctrlKey || d.metaKey) && d.key === "c" ? (d.preventDefault(), it()) : d.key === "Escape" && Oe());
@@ -1233,8 +1235,8 @@ const en = { class: "center" }, tn = {
1233
1235
  o.searchForm.selections = C;
1234
1236
  }
1235
1237
  };
1236
- return e({ tableRef: p, getList: m, getPrm: F, clearSort: Y, calculateTableHeight: w }), (d, i) => {
1237
- var L;
1238
+ return e({ tableRef: p, getList: m, getPrm: L, clearSort: Y, calculateTableHeight: w }), (d, i) => {
1239
+ var F;
1238
1240
  const C = O("el-button"), I = O("el-checkbox"), R = O("el-text"), Z = O("vxe-column"), V = O("VxeTable"), X = O("el-pagination");
1239
1241
  return T(), re("div", {
1240
1242
  class: Se({ box: n.searchForm.showShadow })
@@ -1276,7 +1278,7 @@ const en = { class: "center" }, tn = {
1276
1278
  height: f.value,
1277
1279
  onCheckboxChange: Re,
1278
1280
  onCheckboxAll: Re,
1279
- onSortChange: (L = ye.value["sort-config"]) == null ? void 0 : L.sortChange
1281
+ onSortChange: (F = ye.value["sort-config"]) == null ? void 0 : F.sortChange
1280
1282
  }), {
1281
1283
  default: M(() => [
1282
1284
  n.searchForm.showCheckBox == null || n.searchForm.showCheckBox ? (T(), U(Z, {
@@ -1335,7 +1337,7 @@ const en = { class: "center" }, tn = {
1335
1337
  ], 2);
1336
1338
  };
1337
1339
  }
1338
- }, Fn = /* @__PURE__ */ ge(tn, [["__scopeId", "data-v-7c7c0598"]]), Ln = {
1340
+ }, Ln = /* @__PURE__ */ ge(tn, [["__scopeId", "data-v-7c7c0598"]]), Fn = {
1339
1341
  __name: "index",
1340
1342
  props: {
1341
1343
  sheetsConfig: {
@@ -1367,7 +1369,7 @@ const en = { class: "center" }, tn = {
1367
1369
  }
1368
1370
  };
1369
1371
  function On(n, e = {}) {
1370
- const t = Le(), l = {
1372
+ const t = Fe(), l = {
1371
1373
  inForm: !0,
1372
1374
  required: !0,
1373
1375
  ...e
@@ -1670,7 +1672,7 @@ function Vn(n, e = []) {
1670
1672
  l.value = n();
1671
1673
  },
1672
1674
  { immediate: !0 }
1673
- ), [l];
1675
+ ), l;
1674
1676
  }
1675
1677
  function Un(n, e = "zh_cn", t = "en_us") {
1676
1678
  if (!n)
@@ -1680,15 +1682,15 @@ function Un(n, e = "zh_cn", t = "en_us") {
1680
1682
  }
1681
1683
  function jn(n, e) {
1682
1684
  let t = _t;
1683
- return typeof n == "string" && n.length > 0 && (t = Fe(n).mapState), st(e, t);
1685
+ return typeof n == "string" && n.length > 0 && (t = Le(n).mapState), st(e, t);
1684
1686
  }
1685
1687
  function qn(n, e) {
1686
1688
  let t = $t;
1687
- return typeof n == "string" && n.length > 0 && (t = Fe(n).mapGetters), st(e, t);
1689
+ return typeof n == "string" && n.length > 0 && (t = Le(n).mapGetters), st(e, t);
1688
1690
  }
1689
1691
  function Pn(n, e) {
1690
1692
  let t = St;
1691
- return typeof n == "string" && n.length > 0 && (t = Fe(n).mapActions), nn(e, t);
1693
+ return typeof n == "string" && n.length > 0 && (t = Le(n).mapActions), nn(e, t);
1692
1694
  }
1693
1695
  function st(n, e) {
1694
1696
  const t = Xe(), l = e(n), o = {};
@@ -1801,10 +1803,10 @@ export {
1801
1803
  Bt as CmpDictionary,
1802
1804
  at as CmpIcon,
1803
1805
  In as ConfrimButton,
1804
- Ln as DownExcelTemp,
1806
+ Fn as DownExcelTemp,
1805
1807
  Tn as ImportButton,
1806
1808
  gn as LayOutForm,
1807
- Fn as ListPage,
1809
+ Ln as ListPage,
1808
1810
  zn as OnePortalCasSDK,
1809
1811
  Xt as SearchBar,
1810
1812
  Be as StatusMap,
@@ -1820,7 +1822,7 @@ export {
1820
1822
  Ie as en,
1821
1823
  At as exportExcel,
1822
1824
  lt as getI18n,
1823
- Le as getI18nT,
1825
+ Fe as getI18nT,
1824
1826
  Un as getLocaleValue,
1825
1827
  En as getValueBykey,
1826
1828
  vn as importExcel,
@@ -1,2 +1,2 @@
1
- (function(h,Y){typeof exports=="object"&&typeof module<"u"?Y(exports,require("element-plus"),require("vue"),require("file-saver"),require("exceljs"),require("dayjs"),require("vue-i18n"),require("lodash"),require("crypto-js"),require("vuex"),require("vxe-pc-ui"),require("vue-router")):typeof define=="function"&&define.amd?define(["exports","element-plus","vue","file-saver","exceljs","dayjs","vue-i18n","lodash","crypto-js","vuex","vxe-pc-ui","vue-router"],Y):(h=typeof globalThis<"u"?globalThis:h||self,Y(h.JoyAdminComponents={},h.ElementPlus,h.Vue,h.fileSaver,h.ExcelJS,h.dayjs,h.VueI18n,h._,h.CryptoJS,h.Vuex,h.VxeUI,h.VueRouter))})(this,function(h,Y,e,Me,we,se,X,te,G,Q,oe,Re){"use strict";const Ne=e.defineComponent({name:"LayOutForm",setup(o,{slots:t,attrs:n,emit:r}){const l=e.ref(null),a=()=>t.default?t.default().filter(u=>u.type!==Symbol.for("v-cmt")).map(u=>u.type===Symbol.for("v-fgt")?u.children:u).flat().map(u=>{var i;return e.h(Y.ElCol,{span:((i=u.props)==null?void 0:i.span)||24},{default:()=>u})}):null;e.onMounted(()=>{r("ref",l.value)});function s(){return e.h(Y.ElForm,{...n,ref:l},()=>e.h(Y.ElRow,{gutter:n.gutter??20},{default:()=>a()}))}return s}});var xe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ke(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var _e={exports:{}};(function(o,t){(function(n,r){o.exports=r()})(xe,function(){var n="minute",r=/[+-]\d\d(?::?\d\d)?/g,l=/([+-]|\d\d)/g;return function(a,s,u){var i=s.prototype;u.utc=function(d){var m={date:d,utc:!0,args:arguments};return new s(m)},i.utc=function(d){var m=u(this.toDate(),{locale:this.$L,utc:!0});return d?m.add(this.utcOffset(),n):m},i.local=function(){return u(this.toDate(),{locale:this.$L,utc:!1})};var b=i.parse;i.parse=function(d){d.utc&&(this.$u=!0),this.$utils().u(d.$offset)||(this.$offset=d.$offset),b.call(this,d)};var C=i.init;i.init=function(){if(this.$u){var d=this.$d;this.$y=d.getUTCFullYear(),this.$M=d.getUTCMonth(),this.$D=d.getUTCDate(),this.$W=d.getUTCDay(),this.$H=d.getUTCHours(),this.$m=d.getUTCMinutes(),this.$s=d.getUTCSeconds(),this.$ms=d.getUTCMilliseconds()}else C.call(this)};var $=i.utcOffset;i.utcOffset=function(d,m){var I=this.$utils().u;if(I(d))return this.$u?0:I(this.$offset)?$.call(this):this.$offset;if(typeof d=="string"&&(d=function(F){F===void 0&&(F="");var q=F.match(r);if(!q)return null;var E=(""+q[0]).match(l)||["-",0,0],x=E[0],y=60*+E[1]+ +E[2];return y===0?0:x==="+"?y:-y}(d),d===null))return this;var p=Math.abs(d)<=16?60*d:d;if(p===0)return this.utc(m);var g=this.clone();if(m)return g.$offset=p,g.$u=!1,g;var v=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(g=this.local().add(p+v,n)).$offset=p,g.$x.$localOffset=v,g};var _=i.format;i.format=function(d){var m=d||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return _.call(this,m)},i.valueOf=function(){var d=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*d},i.isUTC=function(){return!!this.$u},i.toISOString=function(){return this.toDate().toISOString()},i.toString=function(){return this.toDate().toUTCString()};var S=i.toDate;i.toDate=function(d){return d==="s"&&this.$offset?u(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():S.call(this)};var w=i.diff;i.diff=function(d,m,I){if(d&&this.$u===d.$u)return w.call(this,d,m,I);var p=this.local(),g=u(d).local();return w.call(p,g,m,I)}}})})(_e);var qe=_e.exports;const je=ke(qe);var Se={exports:{}};(function(o,t){(function(n,r){o.exports=r()})(xe,function(){var n={year:0,month:1,day:2,hour:3,minute:4,second:5},r={};return function(l,a,s){var u,i=function(_,S,w){w===void 0&&(w={});var d=new Date(_),m=function(I,p){p===void 0&&(p={});var g=p.timeZoneName||"short",v=I+"|"+g,F=r[v];return F||(F=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:I,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:g}),r[v]=F),F}(S,w);return m.formatToParts(d)},b=function(_,S){for(var w=i(_,S),d=[],m=0;m<w.length;m+=1){var I=w[m],p=I.type,g=I.value,v=n[p];v>=0&&(d[v]=parseInt(g,10))}var F=d[3],q=F===24?0:F,E=d[0]+"-"+d[1]+"-"+d[2]+" "+q+":"+d[4]+":"+d[5]+":000",x=+_;return(s.utc(E).valueOf()-(x-=x%1e3))/6e4},C=a.prototype;C.tz=function(_,S){_===void 0&&(_=u);var w,d=this.utcOffset(),m=this.toDate(),I=m.toLocaleString("en-US",{timeZone:_}),p=Math.round((m-new Date(I))/1e3/60),g=15*-Math.round(m.getTimezoneOffset()/15)-p;if(!Number(g))w=this.utcOffset(0,S);else if(w=s(I,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(g,!0),S){var v=w.utcOffset();w=w.add(d-v,"minute")}return w.$x.$timezone=_,w},C.offsetName=function(_){var S=this.$x.$timezone||s.tz.guess(),w=i(this.valueOf(),S,{timeZoneName:_}).find(function(d){return d.type.toLowerCase()==="timezonename"});return w&&w.value};var $=C.startOf;C.startOf=function(_,S){if(!this.$x||!this.$x.$timezone)return $.call(this,_,S);var w=s(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return $.call(w,_,S).tz(this.$x.$timezone,!0)},s.tz=function(_,S,w){var d=w&&S,m=w||S||u,I=b(+s(),m);if(typeof _!="string")return s(_).tz(m);var p=function(q,E,x){var y=q-60*E*1e3,R=b(y,x);if(E===R)return[y,E];var B=b(y-=60*(R-E)*1e3,x);return R===B?[y,R]:[q-60*Math.min(R,B)*1e3,Math.max(R,B)]}(s.utc(_,d).valueOf(),I,m),g=p[0],v=p[1],F=s(g).utcOffset(v);return F.$x.$timezone=m,F},s.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},s.tz.setDefault=function(_){u=_}}})})(Se);var Ue=Se.exports;const Pe=ke(Ue),ie={"dao-ru":"导入","quan-xuan":"全选","xia-zai-dao-ru-mo-ban":"下载导入模板","xu-hao":"序号","qing-shu-ru":"请输入","qing-xuan-ze":"请选择","kai-shi-shi-jian":"开始时间","jie-shu-shi-jian":"结束时间","shai-xuan":"筛选","chong-zhi":"重置","guan-bi":"关闭","zhan-kai":"展开",excel:{fieldsMappingRequired:"请输入列字段映射",invalidInput:"非法输入",invalidOption:"请输入有效选项!",copyFailed:"复制失败"},validate:{invalidInput:"请输入正确内容"},tools:{keysLengthError:"keys 长度必须大于2 默认前两位为 label value"}},ce={"dao-ru":"Import","quan-xuan":"Select All","xia-zai-dao-ru-mo-ban":"Download Import Template","xu-hao":"No.","qing-shu-ru":"Please enter","qing-xuan-ze":"Please select","kai-shi-shi-jian":"Start Time","jie-shu-shi-jian":"End Time","shai-xuan":"Filter","chong-zhi":"Reset","guan-bi":"Collapse","zhan-kai":"Expand",excel:{fieldsMappingRequired:"Please enter column field mapping",invalidInput:"Invalid input",invalidOption:"Please enter a valid option!",copyFailed:"Copy failed"},validate:{invalidInput:"Please enter valid content"},tools:{keysLengthError:"Keys length must be greater than 2, default first two are label and value"}},$e={zh_cn:ie,en:ce};let ne=null;function Ee(o=null){if(o){const{global:t}=o;return t.messages.value.zh_cn?t.mergeLocaleMessage("zh_cn",ie):t.setLocaleMessage("zh_cn",ie),t.messages.value.en?t.mergeLocaleMessage("en",ce):t.setLocaleMessage("en",ce),ne=o,o}return ne||(ne=X.createI18n({legacy:!1,locale:"zh_cn",fallbackLocale:"zh_cn",messages:$e})),ne}function de(){return ne||Ee()}function ue(){return de().global.t}se.extend(je),se.extend(Pe);async function Ye(o,t){const{fields:n,range:r=1}=t;if(!n){const s=ue();throw new Error(s("excel.fieldsMappingRequired"))}let l=new we.Workbook;await l.xlsx.load(o);const a={};return l.eachSheet(function(s,u){const i=[];s.eachRow(function(b,C){if(C>r){let $={},_=!0;Object.keys(n).forEach(S=>{const w=b.getCell(n[S]).value;$[S]=w,w&&(_=!1)}),_||i.push($)}}),a[s._name]=i}),l=null,a}const He={columnWidth:30};async function Ie(o,t,n=[],r={}){if(!o||!t)return;const{columnStyle:l}=r,{columnWidth:a}=He;t.forEach(i=>{i.width=i.width?i.width:a});const{workbook:s,worksheet:u}=Ke();u.columns=t,u.addRows(n),l&&await Ze(s,u,l);try{const i=await s.xlsx.writeBuffer(),b=new File([i],o,{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});Me.saveAs(b)}catch(i){console.log(i)}}function Ke(){const o=new we.Workbook;o.creator="distributor System",o.lastModifiedBy="distributor System",o.created=new Date,o.modified=new Date,o.lastPrinted=new Date;const t=o.addWorksheet("Sheet1");return{workbook:o,worksheet:t}}async function Ze(o,t,n){const r=Object.keys(n);for(const l of r){const a=n[l],{type:s}=a;switch(s){case"IMG":await Ge(o,t,l);break}}}async function Ge(o,t,n,r){const l=t.getColumn(n),a=l.values;t.getColumn(n).width=20,t.eachRow((s,u)=>{u>1&&(s.height=40)});for(let s=0,u=a.length;s<u;s++){if(s<2)continue;let i=a[s];i&&(t.getCell(l.letter+s).value="",await We(o,t,i,{width:100,height:50,col:l._number-1,row:s-1}))}}async function We(o,t,n,r){const{col:l,row:a,width:s,height:u}=r,{success:i,base64:b}=await Qe(n,.3);if(i){const C=o.addImage({base64:b,extension:"jpeg"});t.addImage(C,{tl:{col:l,row:a},ext:{width:s,height:u}})}}function Qe(o,t=1){const n=new Image;return n.setAttribute("crossOrigin","anonymous"),n.crossOrigin="anonymous",n.src=o,new Promise((r,l)=>{n.onload=()=>{const a=document.createElement("canvas");a.width=n.width,a.height=n.height,a.getContext("2d").drawImage(n,0,0,a.width,a.height),r({success:!0,base64:a.toDataURL("image/jpeg",t)})},n.onerror=()=>{r({success:!1})}})}function Xe(o){if(o<26)return String.fromCharCode(65+o);{const t=String.fromCharCode(65+Math.floor((o-26)/26)),n=String.fromCharCode(65+(o-26)%26);return t+n}}function Je(o){return new Promise(t=>{setTimeout(()=>{t()},o)})}function et(o){return JSON.parse(JSON.stringify(o))}function tt(o){let t=[],n={},r=(l,a)=>Object.prototype.hasOwnProperty.call(l,a);for(const l of o){n[l.id]={...l,children:r(n,l.id)?n[l.id].children:[]};const a=n[l.id];l.pid==-1?t.push(a):(r(n,l.pid)||(n[l.pid]={children:[]}),n[l.pid].children.push(a))}return t}function fe(o,t=" "){return o?o.split(t).filter(n=>n.trim()):[]}class he{constructor(t,n=["label","value","labelEn"]){this.list=t,this.map=new Map(t.map(r=>{let l={...r,label:r[n[0]],value:r[n[1]]};return n[2]&&(l.labelEn=r[n[2]]),[r[n[1]],l]}))}getName(t,n){if(!this.has(t))return"-";const{label:r,labelEn:l}=this.map.get(t);return(n=="zh_cn"?r:l)||r||"-"}getTag(t){if(!this.has(t))return"info";const{tag:n="info"}=this.map.get(t);return n}getItem(t){return this.has(t)?this.map.get(t):null}getColor(t){if(!this.has(t))return null;const{color:n}=this.map.get(t);return n}has(t){return this.map.has(t)}}function nt(o,t=[],n="i18nName"){if(o.length==0)return new he([]);if(t.length<2){const l=ue();throw new Error(l("tools.keysLengthError"))}let r=o.map(l=>{let a={};return n&&(a.labelEn=l[n]),t.forEach((s,u)=>{u===0?a.label=l[s]:u===1?a.value=l[s]:a[s]=l[s]}),a});return new he(r)}function ot(o){return o?o.replace(/<[^>]+>/g,""):""}function lt(o){return o?(o.includes("\\\\u")&&(o=o.replace(/\\/g,"")),o.replace(/\\u[\dA-F]{4}/gi,t=>String.fromCharCode(parseInt(t.replace(/\\u/g,""),16)))):""}function rt(o,t=10){let n=1048576*t;return!(o.size>n)}function at(o){return Array.from(10).fill(0).map((n,r)=>o+"_"+r)}function st(o){let t={};return o.map((n,r)=>{let{key:l,option:a,type:s}=n,u=Xe(r);a?t[l]=`${u}---option`:s==="image"?t[l]=`${u}---image`:t[l]=u}),t}function it(o,t){return t.split(".").reduce((n,r)=>n&&n[r],o)}const Rt="",le=(o,t)=>{const n=o.__vccOpts||o;for(const[r,l]of t)n[r]=l;return n},Te=le({__name:"index",props:e.mergeModels({api:{type:Function},showCheckAll:{type:Boolean,default:!0},maxLimit:{type:Number,default:void 0},optionClick:{type:Function,default:()=>{}},data:{type:Array},labelValue:{type:Object,default:()=>({label:"label",labelEn:"labelEn",value:"value"})},changeLocal:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["success","change"],["update:modelValue"]),setup(o,{emit:t}){const n=o,r=e.useAttrs(),{t:l,locale:a}=X.useI18n(),s=e.useModel(o,"modelValue"),u=e.ref(""),i=e.computed(()=>{if(r.remote!==void 0)return n.data;const p=fe(u.value),{data:g,labelValue:v}=n,F=g||$.value;if(p.length==0)return F;const{label:q,labelEn:E}=v;let x=a.value=="en_us"?E||"i18nName":q;return p.length==1?F.filter(R=>R[x].toLowerCase().includes(p[0].toLowerCase())):F.filter(R=>{let B=!1;return B=p.some(re=>R[x].toLowerCase()==re.toLowerCase()),B})}),b=e.computed({get(){return r.multiple==null||s.value==null?!1:s.value.length==i.value.length},set(p){return p}}),C=t,$=e.ref([]),_=async()=>{const{data:p}=await n.api();$.value=[...p],C("success",$)};n.api&&_();const S=n.labelValue.label.split("-"),w=p=>{if(S.length==1){if(n.changeLocal)return l(p[n.labelValue.label]);let g=a.value=="en_us"?p[n.labelValue.labelEn||"i18nName"]:p[n.labelValue.label];return g=g||p[n.labelValue.label],g}else{let g=[];return S.forEach(v=>{g.push(p[v])}),g.join("-")}};function d(p){s.value=p?i.value.map(g=>g[n.labelValue.value]):[],C("change",s.value)}function m(p){n.optionClick(p),C("change",r["value-key"]?p:p[n.labelValue.value])}function I(p){return s.value.length>=n.maxLimit&&!s.value.includes(p[n.labelValue.value])}return(p,g)=>{const v=e.resolveComponent("el-checkbox"),F=e.resolveComponent("el-option"),q=e.resolveComponent("el-select");return e.openBlock(),e.createBlock(q,e.mergeProps({modelValue:s.value,"onUpdate:modelValue":g[1]||(g[1]=E=>s.value=E),filterable:"","collapse-tags":"","collapse-tags-tooltip":"","filter-method":e.unref(r).remote!=null?void 0:E=>u.value=E,clearable:""},e.unref(r),{onClear:o.optionClick}),{default:e.withCtx(()=>[e.unref(r).multiple!=null&&o.showCheckAll&&o.maxLimit==null?e.renderSlot(p.$slots,"header",{key:0},()=>[e.createVNode(v,{class:"mgl20",modelValue:b.value,"onUpdate:modelValue":g[0]||(g[0]=E=>b.value=E),onChange:d},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.$t("quan-xuan")),1)]),_:1},8,["modelValue"])],!0):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(E,x)=>(e.openBlock(),e.createBlock(F,{key:x,label:w(E),disabled:e.unref(r).multiple!=null&&o.maxLimit>0?I(E):!1,onClick:e.withModifiers(y=>m(E),["stop"]),value:e.unref(r)["value-key"]?E:E[o.labelValue.value]},null,8,["label","disabled","onClick","value"]))),128))]),_:3},16,["modelValue","filter-method","onClear"])}}},[["__scopeId","data-v-34eb8641"]]),qt="",ct=e.defineComponent({props:{name:{tyepe:String,required:!0}}});function ut(o,t,n,r,l,a){const s=e.resolveComponent("el-icon");return e.openBlock(),e.createBlock(s,{class:"cmp-icon"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.name)))]),_:1})}const me=le(ct,[["render",ut],["__scopeId","data-v-733f9daa"]]),dt={__name:"index",emits:["ok","no"],setup(o,{emit:t}){const n=t,r=te.debounce(()=>{n("ok")},500);function l(){n("no")}return(a,s)=>{const u=e.resolveComponent("el-link"),i=e.resolveComponent("el-popconfirm");return e.openBlock(),e.createBlock(i,e.mergeProps(a.$attrs,{onConfirm:e.unref(r),onCancel:l}),{reference:e.withCtx(()=>[e.createVNode(u,{underline:"never",type:a.$attrs.type},{default:e.withCtx(()=>[e.renderSlot(a.$slots,"default")]),_:3},8,["type"])]),_:3},16,["onConfirm"])}}},jt="",ft=["accept"],ht=le({__name:"index",props:{accept:{type:String,default:".xlsx,.xls"},loading:{type:Boolean,default:!1}},emits:["fileChange"],setup(o,{emit:t}){const n=t,r=e.ref(null);function l(a){let s=a.target.files[0];n("fileChange",s),r.value.value=null}return(a,s)=>{const u=e.resolveComponent("el-button");return e.openBlock(),e.createElementBlock("span",null,[e.createVNode(u,{loading:o.loading,class:"mgr10",onClick:s[0]||(s[0]=i=>r.value.click())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.$t("dao-ru")),1)]),_:1},8,["loading"]),e.createElementVNode("input",{onChange:l,ref_key:"input",ref:r,accept:o.accept,style:{position:"absolute",width:"0px",height:"0px",opacity:"0"},type:"file"},null,40,ft)])}}},[["__scopeId","data-v-5f1449ad"]]);function pe(o){let t={};return o.forEach(n=>{const{key:r,type:l,option:a={},value:s,dateType:u}=n;if(r)if(l=="input"&&(a!=null&&a.multiple))t[r]=fe(s);else if(l=="date")if(u.includes("range")){const[i,b]=r;let[C,$]=s||[];C&&u=="daterange"&&(C=se.dayjs(C).format("YYYY-MM-DD 00:00:00"),$=se.dayjs($).format("YYYY-MM-DD 23:59:59")),t[i]=C,t[b]=$}else t[r]=s;else t[r]=s}),t}const Pt="",mt={key:0},pt={class:"btns"},gt={class:"left"},Ct={class:"right"},ve=le({__name:"index",props:{form:{type:Object,required:!0}},emits:["confirm","reset","visibleChange"],setup(o,{expose:t,emit:n}){const r=o,l=n,a=e.ref(!0),s=e.ref(null),{t:u}=X.useI18n(),i=e.computed(()=>a.value?u("guan-bi"):u("zhan-kai"));function b(){l("confirm")}function C(m){m.option.onClear&&m.option.onClear(),l("confirm")}function $(){l("reset")}function _(){l("confirm")}function S(){return pe(r.form.items)}const w=te.cloneDeep(r.form.items);function d(){r.form.items.forEach(m=>{const I=w.find(p=>p.key==m.key);I&&(m.value=I.value)})}return t({getPrm:S,reset:d}),(m,I)=>{const p=e.resolveComponent("el-input"),g=e.resolveComponent("el-date-picker"),v=e.resolveComponent("el-form-item"),F=e.resolveComponent("el-form"),q=e.resolveComponent("el-link"),E=e.resolveComponent("el-button");return e.openBlock(),e.createElementBlock("div",{class:"searchBar-container mgt10 mgb10",onKeydown:e.withKeys(b,["enter"])},[e.createElementVNode("div",{class:"searchBar",style:e.normalizeStyle({height:a.value?"auto":"42px"})},[e.createVNode(F,{inline:"",model:o.form.data},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.form.items.filter(x=>!x.hidden),x=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:x.key},[x.type=="br"?(e.openBlock(),e.createElementBlock("br",mt)):(e.openBlock(),e.createBlock(v,{key:1,label:x.name},{default:e.withCtx(()=>{var y,R;return[x.type==="input"?(e.openBlock(),e.createBlock(p,{key:0,modelValue:x.value,"onUpdate:modelValue":B=>x.value=B,class:e.normalizeClass(((y=x.option)==null?void 0:y.class)||"w150"),placeholder:m.$t("qing-shu-ru"),clearable:""},null,8,["modelValue","onUpdate:modelValue","class","placeholder"])):x.type==="custom"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(x.render),{key:1})):e.createCommentVNode("",!0),x.type==="select"?(e.openBlock(),e.createBlock(Te,e.mergeProps({key:2,class:((R=x.option)==null?void 0:R.class)||"w150",modelValue:x.value,"onUpdate:modelValue":B=>x.value=B},{ref_for:!0},x.option,{onChange:b,onClear:B=>C(x)}),null,16,["class","modelValue","onUpdate:modelValue","onClear"])):e.createCommentVNode("",!0),x.type==="date"?(e.openBlock(),e.createBlock(g,{key:3,class:e.normalizeClass({datetimerange:"w300",daterange:"w200"}[x.dateType]||"w100"),modelValue:x.value,"onUpdate:modelValue":B=>x.value=B,"value-format":{datetimerange:"YYYY-MM-DD HH:mm:ss",daterange:"YYYY-MM-DD"}[x.dateType]||"YYYY-MM-DD",type:x.dateType||"date",onFocus:B=>s.value=x,onChange:B=>_(),placeholder:m.$t("qing-xuan-ze"),"start-placeholder":m.$t("kai-shi-shi-jian"),"end-placeholder":m.$t("jie-shu-shi-jian")},null,8,["class","modelValue","onUpdate:modelValue","value-format","type","onFocus","onChange","placeholder","start-placeholder","end-placeholder"])):e.createCommentVNode("",!0)]}),_:2},1032,["label"]))],64))),128))]),_:1},8,["model"])],4),e.createElementVNode("div",pt,[e.createElementVNode("div",gt,[e.renderSlot(m.$slots,"table-header-left",{},void 0,!0)]),e.createElementVNode("div",Ct,[e.createVNode(q,{underline:"never",class:"mgr10",onClick:I[0]||(I[0]=()=>{l("visibleChange",!a.value),a.value=!a.value})},{default:e.withCtx(()=>[e.createVNode(me,{name:a.value?"ArrowUp":"ArrowDown"},null,8,["name"]),e.createTextVNode(" "+e.toDisplayString(i.value),1)]),_:1}),e.createVNode(E,{type:"primary",onClick:b},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.$t("shai-xuan")),1)]),_:1}),e.createVNode(E,{type:"primary",onClick:$},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.$t("chong-zhi")),1)]),_:1}),e.renderSlot(m.$slots,"btn",{},void 0,!0)])])],32)}}},[["__scopeId","data-v-32ac9990"]]),Ht="",yt={class:"center"},bt=le({__name:"index",props:{id:{type:String,required:!0},loading:{type:Boolean,default:!1},immediate:{type:Boolean,default:!0},searchForm:{type:Object,default:()=>({items:[],selections:[],showSearch:!1,showPage:!1,showShadow:!1,showCheckBox:!1,enableCellCopy:!0})},api:{type:Function},data:{type:Array},tableConfig:{type:Object,default:()=>({})}},setup(o,{expose:t}){const{t:n,locale:r}=X.useI18n(),l=o,a=e.ref(!1),s=e.ref([]);l.searchForm.selections=[],l.searchForm.enableCellCopy==null&&(l.searchForm.enableCellCopy=!0);const u=te.cloneDeep(l.searchForm.items),i=l.searchForm.pageNoKey||"pageNo",b=e.reactive({[i]:1,pageSize:10,total:0}),C=e.ref(null),$=e.ref(null),_=e.ref(450),S=te.debounce(()=>{e.nextTick(()=>{if(!$.value)return;const c=$.value.getBoundingClientRect(),k=window.innerHeight,V=c.top,z=100,P=k-V-z,A=200;_.value=Math.max(P,A)})},100),w=()=>{S()},d=()=>{if(!l.searchForm.enableCellCopy)return!1;const f=C.value;if(!f||!f.$el)return!1;const c=f.$el;return c.classList.add("cell-copy-enabled"),c.removeEventListener("mousedown",B),c.removeEventListener("mousemove",re),c.removeEventListener("mouseup",Ce),c.addEventListener("mousedown",B),c.addEventListener("mousemove",re),c.addEventListener("mouseup",Ce),!0};e.onMounted(()=>{S(),window.addEventListener("resize",w),l.searchForm.enableCellCopy&&(document.addEventListener("keydown",Be),document.addEventListener("mouseup",Oe),setTimeout(()=>{d()},500))}),e.onUnmounted(()=>{if(window.removeEventListener("resize",w),l.searchForm.enableCellCopy){document.removeEventListener("keydown",Be),document.removeEventListener("mouseup",Oe);const f=C.value;if(f&&f.$el){const c=f.$el;c.removeEventListener("mousedown",B),c.removeEventListener("mousemove",re),c.removeEventListener("mouseup",Ce)}}});const m=e.computed(()=>ye.value.height||_.value);let I;async function p(f){const{dataFormat:c}=l.tableConfig;f.pageNo!=1&&(f.nextSearchAfter=I),a.value=!0;const{code:k,data:V={}}=await l.api(f).finally(()=>{a.value=!1,l.searchForm.selections=[]});if(k==200){let z=V.rows||V.records||[];s.value=c?c(z):z,b.total=V.totalRows||V.total||0,I=V.nextSearchAfter,l.searchForm.enableCellCopy&&e.nextTick(()=>{setTimeout(()=>{d()},100)})}}function g(f={}){const{searchData:c=()=>({})}=l.tableConfig,k=c();p({...b,...pe(l.searchForm.items),...f,...k})}function v(){const{reset:f}=l.tableConfig;f&&f(),l.searchForm.items.forEach(c=>{const k=u.find(V=>te.isArray(c.key)&&te.isArray(V.key)?c.key.join(",")==V.key.join(","):V.key==c.key);k&&(c.value=k.value)}),g()}l.api&&l.immediate&&g();function F(){return{...b,...pe(l.searchForm.items)}}const q=()=>{const f=C.value;f&&f.clearSort()},E=e.reactive({storage:!0}),x=e.reactive({width:"auto",drag:!0,resizable:!0,maxFixedSize:0}),y=e.reactive({isSelecting:!1,startCell:null,endCell:null,selectedCells:[]}),R=f=>{const c=f.closest(".vxe-body--column");if(!c||c.classList.contains("col--checkbox")||c.classList.contains("col--seq"))return null;const k=c.closest(".vxe-body--row");if(!k)return null;const V=C.value;if(!V)return null;let z=-1;const P=k.getAttribute("data-rowid");if(P!=null)z=parseInt(P,10);else{const L=k.parentElement;z=Array.from(L.querySelectorAll(".vxe-body--row")).indexOf(k)}if(z<0)return null;let A=-1;const W=c.getAttribute("data-colid");if(W&&(A=V.getColumns().findIndex(T=>T.id===W)),A<0){const T=Array.from(k.querySelectorAll(".vxe-body--column")).indexOf(c),M=!!c.closest(".vxe-table--fixed-left-wrapper"),j=!!c.closest(".vxe-table--fixed-right-wrapper"),O=V.getColumns();if(M){const U=O.filter(N=>N.fixed==="left");T<U.length&&(A=O.indexOf(U[T]))}else if(j){const U=O.filter(N=>N.fixed==="right");T<U.length&&(A=O.indexOf(U[T]))}else{const U=l.searchForm.showCheckBox?1:0;A=O.filter(H=>H.fixed==="left").length+T-U}}return A<0?null:{rowIndex:z,colIndex:A,cell:c}},B=f=>{const c=R(f.target);if(!c){Fe();return}y.isSelecting=!0,y.startCell={rowIndex:c.rowIndex,colIndex:c.colIndex},y.endCell={...y.startCell},Le(),De()},re=f=>{if(!y.isSelecting)return;const c=R(f.target);c&&(y.endCell={rowIndex:c.rowIndex,colIndex:c.colIndex},Le(),De())},Ce=()=>{y.isSelecting=!1},Fe=()=>{y.selectedCells=[],y.startCell=null,y.endCell=null;const f=C.value;if(!f)return;f.$el.querySelectorAll(".cell-selected, .cell-border-top, .cell-border-right, .cell-border-bottom, .cell-border-left").forEach(k=>{k.classList.remove("cell-selected","cell-border-top","cell-border-right","cell-border-bottom","cell-border-left")})},Le=()=>{if(!y.startCell||!y.endCell){y.selectedCells=[];return}const f=y.startCell.rowIndex,c=y.endCell.rowIndex,k=y.startCell.colIndex,V=y.endCell.colIndex,z=Math.min(f,c),P=Math.max(f,c),A=Math.min(k,V),W=Math.max(k,V);y.selectedCells=[];for(let L=z;L<=P;L++)for(let T=A;T<=W;T++)y.selectedCells.push({rowIndex:L,colIndex:T})},De=()=>{e.nextTick(()=>{const f=C.value;if(!f)return;const c=f.$el;if(c.querySelectorAll(".cell-selected, .cell-border-top, .cell-border-right, .cell-border-bottom, .cell-border-left").forEach(M=>{M.classList.remove("cell-selected","cell-border-top","cell-border-right","cell-border-bottom","cell-border-left")}),y.selectedCells.length===0)return;const k=f.getColumns(),V=y.selectedCells.map(M=>M.rowIndex),z=y.selectedCells.map(M=>M.colIndex),P=Math.min(...V),A=Math.max(...V),W=Math.min(...z),L=Math.max(...z),T=[c.querySelector(".vxe-table--body-wrapper tbody"),c.querySelector(".vxe-table--fixed-left-wrapper tbody"),c.querySelector(".vxe-table--fixed-right-wrapper tbody")].filter(Boolean);y.selectedCells.forEach(({rowIndex:M,colIndex:j})=>{const O=k[j];if(!O)return;const U=O.fixed==="left",N=O.fixed==="right";for(const H of T){const ae=H.querySelectorAll(".vxe-body--row")[M];if(!ae)continue;const J=Array.from(ae.querySelectorAll(".vxe-body--column"));let D=null;if(U&&H.closest(".vxe-table--fixed-left-wrapper")){const K=k.filter(Z=>Z.fixed==="left").indexOf(O);D=J[K]}else if(N&&H.closest(".vxe-table--fixed-right-wrapper")){const K=k.filter(Z=>Z.fixed==="right").indexOf(O);D=J[K]}else if(!U&&!N&&H.closest(".vxe-table--body-wrapper")){const ee=l.searchForm.showCheckBox?1:0,K=k.filter(be=>be.fixed==="left").length,Z=j-K;D=J[Z+ee]}if(D&&!D.classList.contains("col--checkbox")&&!D.classList.contains("col--seq")){D.classList.add("cell-selected"),M===P&&D.classList.add("cell-border-top"),M===A&&D.classList.add("cell-border-bottom"),j===W&&D.classList.add("cell-border-left"),j===L&&D.classList.add("cell-border-right");break}}})})},Ot=async()=>{if(y.selectedCells.length===0)return;const f=C.value;if(!f)return;const c=f.$el,k=f.getColumns(),V=[...new Set(y.selectedCells.map(L=>L.rowIndex))].sort((L,T)=>L-T),z=[...new Set(y.selectedCells.map(L=>L.colIndex))].sort((L,T)=>L-T),P=[c.querySelector(".vxe-table--body-wrapper tbody"),c.querySelector(".vxe-table--fixed-left-wrapper tbody"),c.querySelector(".vxe-table--fixed-right-wrapper tbody")].filter(Boolean),A=[];V.forEach(L=>{const T=[];z.forEach(M=>{const j=k[M];if(!j){T.push("");return}const O=j.fixed==="left",U=j.fixed==="right";let N="";for(const H of P){const ae=H.querySelectorAll(".vxe-body--row")[L];if(!ae)continue;const J=Array.from(ae.querySelectorAll(".vxe-body--column"));let D=null;if(O&&H.closest(".vxe-table--fixed-left-wrapper")){const K=k.filter(Z=>Z.fixed==="left").indexOf(j);D=J[K]}else if(U&&H.closest(".vxe-table--fixed-right-wrapper")){const K=k.filter(Z=>Z.fixed==="right").indexOf(j);D=J[K]}else if(!O&&!U&&H.closest(".vxe-table--body-wrapper")){const ee=l.searchForm.showCheckBox?1:0,K=k.filter(be=>be.fixed==="left").length,Z=M-K;D=J[Z+ee]}if(D&&!D.classList.contains("col--checkbox")&&!D.classList.contains("col--seq")){N=D.innerText||D.textContent||"",N=N.trim(),N=N.replace(/\n/g," ").replace(/\s+/g," ");break}}T.push(N)}),A.push(T.join(" "))});const W=A.join(`
2
- `);try{await navigator.clipboard.writeText(W)}catch(L){console.error(n("excel.copyFailed"),L)}},Be=f=>{l.searchForm.enableCellCopy&&((f.ctrlKey||f.metaKey)&&f.key==="c"?(f.preventDefault(),Ot()):f.key==="Escape"&&Fe())},Oe=()=>{y.isSelecting=!1},ye=e.computed(()=>{const{customConfig:f,columnConfig:c,...k}=l.tableConfig;return{headerAlign:"left",align:"center",customConfig:{...E,...f},columnConfig:{...x,...c},"virtual-x-config":{enabled:!1,scrollToLeftOnChange:!1},"virtual-y-config":{enabled:!0,gt:100},...k}}),zt=f=>{b.pageNo=f,g()},At=f=>{b.pageSize=f,b[i]=1,g()};function ze(){const f=C.value.getCheckboxRecords();l.searchForm.selections=f}const Ae=f=>{const c=C.value;if(c){c.toggleCheckboxRow(f);const k=C.value.getCheckboxRecords();l.searchForm.selections=k}};return t({tableRef:C,getList:g,getPrm:F,clearSort:q,calculateTableHeight:S}),(f,c)=>{var L;const k=e.resolveComponent("el-button"),V=e.resolveComponent("el-checkbox"),z=e.resolveComponent("el-text"),P=e.resolveComponent("vxe-column"),A=e.resolveComponent("VxeTable"),W=e.resolveComponent("el-pagination");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({box:o.searchForm.showShadow})},[o.searchForm.showSearch?(e.openBlock(),e.createBlock(ve,{key:0,form:o.searchForm,onReset:v,onConfirm:c[1]||(c[1]=T=>g()),onVisibleChange:e.unref(S)},{btn:e.withCtx(()=>[e.renderSlot(f.$slots,"search-bar-btn",{},void 0,!0),e.createVNode(k,{round:"",onClick:c[0]||(c[0]=T=>C.value.openCustom())},{default:e.withCtx(()=>[e.createVNode(me,{name:"Tools"})]),_:1})]),_:3},8,["form","onVisibleChange"])):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"table-header-left",{},void 0,!0),e.createElementVNode("div",{ref_key:"tableContentRef",ref:$},[e.createVNode(A,e.mergeProps({id:o.id,ref_key:"tableRef",ref:C,loading:o.loading||a.value,data:o.api?s.value:o.data,border:""},ye.value,{height:m.value,onCheckboxChange:ze,onCheckboxAll:ze,onSortChange:(L=ye.value["sort-config"])==null?void 0:L.sortChange}),{default:e.withCtx(()=>[o.searchForm.showCheckBox==null||o.searchForm.showCheckBox?(e.openBlock(),e.createBlock(P,{key:0,type:"checkbox",width:e.unref(r)=="zh_cn"?80:150,title:f.$t("xu-hao"),fixed:"left"},{checkbox:e.withCtx(({rowIndex:T,row:M,checked:j,disabled:O,indeterminate:U})=>[e.createElementVNode("div",yt,[j?(e.openBlock(),e.createBlock(V,{key:0,checked:!0,disabled:O,size:"default",onClick:e.withModifiers(N=>!O&&Ae(M),["stop"])},null,8,["disabled","onClick"])):(e.openBlock(),e.createBlock(V,{key:1,disabled:O,checked:!1,size:"default",onClick:e.withModifiers(N=>!O&&Ae(M),["stop"])},null,8,["disabled","onClick"])),e.createVNode(z,{type:"info",class:"mgl5"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(T+1),1)]),_:2},1024)])]),_:1},8,["width","title"])):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"default",{},void 0,!0)]),_:3},16,["id","loading","data","height","onSortChange"])],512),o.searchForm.showPage?(e.openBlock(),e.createBlock(W,{key:1,"current-page":b[e.unref(i)],"onUpdate:currentPage":c[2]||(c[2]=T=>b[e.unref(i)]=T),class:"myPagination mgt10",background:"",layout:"total, sizes, prev, pager, next",total:b.total,"page-size":b.pageSize,"page-sizes":[10,50,100,500],onCurrentChange:zt,onSizeChange:At},null,8,["current-page","total","page-size"])):e.createCommentVNode("",!0)],2)}}},[["__scopeId","data-v-7c7c0598"]]),wt={__name:"index",props:{sheetsConfig:{type:Object,required:!0},fileName:{type:String,required:!0}},setup(o){const t=o;function n(){Ie(t.fileName,t.sheetsConfig)}return(r,l)=>{const a=e.resolveComponent("el-link");return e.openBlock(),e.createBlock(a,e.mergeProps({type:"primary",underline:"never"},r.$attrs,{onClick:n}),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.$t("xia-zai-dao-ru-mo-ban")),1)]),_:1},16)}}};function xt(o,t={}){const n=ue(),r={inForm:!0,required:!0,...t},l={phone:/^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/,password:/(?=.*\d)(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{8,12}/,email:/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/}[o],{inForm:a,value:s,required:u,msg:i=n("validate.invalidInput")}=r;return a?function(b,C,$){if(u){l.test(C)?$():$(new Error(i));return}C&&!l.test(C)?$(new Error(i)):$()}:l.test(s)}const kt={encrypt(o,t){t=t||"1CFEC667A1E6D42DC12565AAAA460494";var n=G.enc.Utf8.parse(t),r=G.enc.Utf8.parse(o),l=G.AES.encrypt(r,n,{mode:G.mode.ECB,padding:G.pad.Pkcs7});return l.toString()},decrypt(o,t){t=t||"1CFEC667A1E6D42DC12565AAAA460494";var n=G.enc.Utf8.parse(t),r=G.AES.decrypt(o,n,{mode:G.mode.ECB,padding:G.pad.Pkcs7});return G.enc.Utf8.stringify(r).toString()}};class _t{constructor(t={}){this.config={clientCode:t.clientCode||"one-portal",casServerUrl:`https://one-portal${t.isTest?"-test":""}.joy-group.com/api`,casPortalUrl:`https://one-portal${t.isTest?"-test":""}.joy-group.com`,serviceUrl:t.serviceUrl||window.location.origin+"/cas/callback",tokenKey:t.tokenKey||"one_portal_token",userKey:t.userKey||"one_portal_user",debug:t.debug||!1,autoLogin:t.autoLogin!==!1,loginCallback:t.loginCallback||null,logoutCallback:t.logoutCallback||null,errorCallback:t.errorCallback||null},this.token=null,this.user=null,this.init()}init(){this.log("OnePortal CAS SDK 初始化中..."),this.loadFromStorage();const n=new URLSearchParams(window.location.search).get("ticket");this.isLoggedIn()&&this.config.loginCallback?this.config.loginCallback(this.user,this.token):n?(this.log("检测到ST票据:",n),this.validateTicket(n)):this.config.autoLogin&&!this.isLoggedIn()&&(this.log("用户未登录,准备跳转到CAS登录页面"),this.login())}loadFromStorage(){try{this.token=localStorage.getItem(this.config.tokenKey);const t=localStorage.getItem(this.config.userKey);t&&(this.user=JSON.parse(t)),this.log("从本地存储加载数据:",{token:!!this.token,user:!!this.user})}catch(t){this.log("加载本地存储数据失败:",t)}}saveToStorage(){try{this.token&&localStorage.setItem(this.config.tokenKey,this.token),this.user&&localStorage.setItem(this.config.userKey,JSON.stringify(this.user)),this.log("数据已保存到本地存储")}catch(t){this.log("保存到本地存储失败:",t)}}clearStorage(){try{localStorage.removeItem(this.config.tokenKey),localStorage.removeItem(this.config.userKey),this.log("本地存储已清除")}catch(t){this.log("清除本地存储失败:",t)}}isLoggedIn(){return!!(this.token&&this.user)}getUser(){return this.user}getToken(){return this.token}login(){const t=`${this.config.casPortalUrl}?appCode=${this.config.clientCode}&redirectUrl=${encodeURIComponent(this.config.serviceUrl)}`;this.log("跳转到CAS登录页面:",t),window.location.href=t}async validateTicket(t){try{this.log("验证ST票据:",t);const n=await fetch(`${this.config.casServerUrl}/auth/validateST?ticket=${t}`,{method:"GET",headers:{"Content-Type":"application/json"}});if(!n.ok)throw new Error(`HTTP ${n.status}: ${n.statusText}`);const r=await n.json();if(r.success&&r.data)return this.token=r.data.token,this.user=r.data.user,this.saveToStorage(),this.clearTicketFromUrl(),this.log("ST票据验证成功,用户登录成功:",this.user),this.config.loginCallback&&this.config.loginCallback(this.user,this.token),!0;throw new Error(r.message||"ST票据验证失败")}catch(n){return this.log("ST票据验证失败:",n),this.handleError(n),!1}}clearTicketFromUrl(){const t=new URL(window.location);t.searchParams.delete("ticket"),window.history.replaceState({},document.title,t.toString())}async logout(t=!0){try{if(this.log("用户登出"),this.token)try{await fetch(`${this.config.casServerUrl}/auth/logout`,{method:"POST",headers:{AppId:this.config.clientCode,Authorization:`Bearer ${this.token}`,"Content-Type":"application/json"}})}catch(n){this.log("调用服务端登出接口失败:",n)}this.token=null,this.user=null,this.clearStorage(),this.config.logoutCallback&&this.config.logoutCallback(),t&&this.login()}catch(n){this.log("登出失败:",n),this.handleError(n)}}async request(t,n={}){const r={headers:{"Content-Type":"application/json",...n.headers},...n};r.headers.appId=this.config.clientCode,this.token&&(r.headers.Authorization=`Bearer ${this.token}`);try{const l=await fetch(t,r);return l.status===401?(this.log("Token已过期,需要重新登录"),this.logout(),null):l}catch(l){throw this.log("请求失败:",l),l}}async fetchUserInfo(){try{const t=await this.request(`${this.config.casServerUrl}/auth/user`);if(t&&t.ok){const n=await t.json();if(n.success&&n.data)return this.user=n.data,this.saveToStorage(),this.user}return null}catch(t){return this.log("获取用户信息失败:",t),null}}async refreshToken(){this.log("Token刷新功能暂未实现")}handleError(t){this.log("发生错误:",t),this.config.errorCallback&&this.config.errorCallback(t)}log(...t){this.config.debug&&console.log("[OnePortal CAS SDK]",...t)}checkLoginStatus(){return!this.isLoggedIn()&&this.config.autoLogin?(this.login(),!1):this.isLoggedIn()}setConfig(t,n){this.config[t]=n}getConfig(t){return this.config[t]}}function St(o,t={}){const r=Object.assign({manual:!1,log:!1,params:null,format:null},t),{manual:l,log:a,params:s={},cb:u,format:i}=r,b=e.ref([]),C=e.ref(!1),$=_=>{const S=_||s;C.value=!0,o(S).then(w=>{const{code:d,data:m,msg:I}=w;if(u){const{records:p,rows:g}=m||{},v=p||g?p||g:m;b.value=ge(v,i),u(w)}if(m){if(m.records!=null||m.rows!=null){const{records:p,rows:g,total:v=0}=m||{};S&&S.total!=null&&(s.total=parseInt(v)),b.value=ge(p||g||[],i)}else b.value=ge(m,i);a&&console.log("useRequest-res",b.value)}}).catch(w=>{u&&(console.log("useRequestErr",w),u({code:500}))}).finally(()=>{C.value=!1})};return l||$(),[C,b,$]}function $t(o){const t=e.ref(o),n=e.ref(""),r=e.ref("");return e.watch(t,l=>{const a=l||["",""];n.value=a[0],r.value=a[1]}),[t,n,r]}function Et(o){return Object.prototype.toString.call(o).slice(8,-1).toLowerCase()}function ge(o,t){if(!t)return o;if(o instanceof Array)return o.map(r=>{let l={};return t.forEach(a=>l[a]=r[a]),l});let n={};return t.forEach(r=>n[r]=o[r]),n}function It(o,t=[]){const{locale:n}=X.useI18n(),r=e.ref(o());return e.watch([n,...t],()=>{r.value=o()},{immediate:!0}),[r]}function Tt(o,t="zh_cn",n="en_us"){if(!o)return"-";const r={en_us:n,zh_cn:t},a=de().global.locale.value;return o[r[a]]||o[t]||"-"}function vt(o,t){let n=Q.mapState;return typeof o=="string"&&o.length>0&&(n=Q.createNamespacedHelpers(o).mapState),Ve(t,n)}function Vt(o,t){let n=Q.mapGetters;return typeof o=="string"&&o.length>0&&(n=Q.createNamespacedHelpers(o).mapGetters),Ve(t,n)}function Ft(o,t){let n=Q.mapActions;return typeof o=="string"&&o.length>0&&(n=Q.createNamespacedHelpers(o).mapActions),Lt(t,n)}function Ve(o,t){const n=Q.useStore(),r=t(o),l={};return Object.keys(r).forEach(a=>{const s=r[a].bind({$store:n});l[a]=e.computed(s)}),l}function Lt(o,t){const n=Q.useStore(),r=t(o),l={};return Object.keys(r).forEach(a=>{l[a]=r[a].bind({$store:n})}),l}const Dt={__name:"EnumRender",props:{renderOpts:{type:Object,default:()=>({enum:{}})},params:{type:Object}},setup(o){const t=o,n=t.params.row[t.params.column.field];return(r,l)=>{const a=e.resolveComponent("el-text");return o.renderOpts.text?(e.openBlock(),e.createBlock(a,{key:0},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.renderOpts.enum.getName(e.unref(n))),1)]),_:1})):(e.openBlock(),e.createBlock(a,{key:1,type:o.renderOpts.enum.getTag(e.unref(n))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.renderOpts.enum.getName(e.unref(n))),1)]),_:1},8,["type"]))}}};function Bt(){oe.VxeUI.renderer.add("Enum",{renderTableDefault(o,t){return[null,void 0].includes(t.row[t.column.field])?"-":React.createElement(Dt,{renderOpts:o,params:t})}}),oe.VxeUI.renderer.add("InputNumber",{renderTableDefault(o,t){return React.createElement(Y.ElInputNumber,{"v-model":t.row[t.column.field],...o.props,"step-strictly":!0,"value-on-clear":0})}}),oe.VxeUI.renderer.add("TrueFalse",{renderTableDefault(o,t){const{locale:n}=X.useI18n();let r=n.value=="zh_cn";return React.createElement(Y.ElText,{type:t.row[t.column.field]?"success":"danger"},t.row[t.column.field]?r?"是":"YES":r?"否":"NO")}}),oe.VxeUI.renderer.add("I18n",{renderTableDefault(o,t){const{locale:n}=X.useI18n();let r=n.value=="zh_cn"?t.column.field:o.fieldEn;return t.row[r]||t.row[t.column.field]}}),oe.VxeUI.renderer.add("Link",{renderTableDefault(o,t){var u;let n=t.column.field;const r=Re.useRouter(),{multiple:l,to:a}=o;if(!l)return React.createElement(Y.ElLink,{underline:"never",type:"primary",onclick:()=>r.push({path:a,query:{[n]:t.row[n]}})},t.row[n]);const s=((u=t.row[n])==null?void 0:u.split(","))||[];return s.map((i,b)=>React.createElement("span",null,React.createElement(Y.ElLink,{underline:"never",type:"primary",onclick:()=>r.push({path:a,query:{[n]:i}})},i),b<s.length-1?",":""))}})}h.CmpDictionary=Te,h.CmpIcon=me,h.ConfrimButton=dt,h.DownExcelTemp=wt,h.ImportButton=ht,h.LayOutForm=Ne,h.ListPage=bt,h.OnePortalCasSDK=_t,h.SearchBar=ve,h.StatusMap=he,h._toRaw=et,h._typeOf=Et,h.arrToStatusMap=nt,h.arrayToTree=tt,h.checkFileSize=rt,h.creatValidator=xt,h.createImportFields=st,h.createListPageId=at,h.crypto=kt,h.en=ce,h.exportExcel=Ie,h.getI18n=de,h.getI18nT=ue,h.getLocaleValue=Tt,h.getValueBykey=it,h.importExcel=Ye,h.messages=$e,h.registerVxeRenderers=Bt,h.setupI18n=Ee,h.sleep=Je,h.stringToArray=fe,h.stripHtmlTags=ot,h.unicode2Str=lt,h.useActions=Ft,h.useDatePicker=$t,h.useGetters=Vt,h.useI18nReState=It,h.useRequest=St,h.useState=vt,h.zhCn=ie,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
1
+ (function(h,Y){typeof exports=="object"&&typeof module<"u"?Y(exports,require("element-plus"),require("vue"),require("file-saver"),require("exceljs"),require("dayjs"),require("vue-i18n"),require("lodash"),require("crypto-js"),require("vuex"),require("vxe-pc-ui"),require("vue-router")):typeof define=="function"&&define.amd?define(["exports","element-plus","vue","file-saver","exceljs","dayjs","vue-i18n","lodash","crypto-js","vuex","vxe-pc-ui","vue-router"],Y):(h=typeof globalThis<"u"?globalThis:h||self,Y(h.JoyAdminComponents={},h.ElementPlus,h.Vue,h.fileSaver,h.ExcelJS,h.dayjs,h.VueI18n,h._,h.CryptoJS,h.Vuex,h.VxeUI,h.VueRouter))})(this,function(h,Y,e,Me,we,se,X,te,G,Q,oe,Ne){"use strict";const Re=e.defineComponent({name:"LayOutForm",setup(o,{slots:t,attrs:n,emit:r}){const l=e.ref(null),a=()=>t.default?t.default().filter(u=>u.type!==Symbol.for("v-cmt")).map(u=>u.type===Symbol.for("v-fgt")?u.children:u).flat().map(u=>{var i;return e.h(Y.ElCol,{span:((i=u.props)==null?void 0:i.span)||24},{default:()=>u})}):null;e.onMounted(()=>{r("ref",l.value)});function s(){return e.h(Y.ElForm,{...n,ref:l},()=>e.h(Y.ElRow,{gutter:n.gutter??20},{default:()=>a()}))}return s}});var xe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ke(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var _e={exports:{}};(function(o,t){(function(n,r){o.exports=r()})(xe,function(){var n="minute",r=/[+-]\d\d(?::?\d\d)?/g,l=/([+-]|\d\d)/g;return function(a,s,u){var i=s.prototype;u.utc=function(d){var m={date:d,utc:!0,args:arguments};return new s(m)},i.utc=function(d){var m=u(this.toDate(),{locale:this.$L,utc:!0});return d?m.add(this.utcOffset(),n):m},i.local=function(){return u(this.toDate(),{locale:this.$L,utc:!1})};var b=i.parse;i.parse=function(d){d.utc&&(this.$u=!0),this.$utils().u(d.$offset)||(this.$offset=d.$offset),b.call(this,d)};var C=i.init;i.init=function(){if(this.$u){var d=this.$d;this.$y=d.getUTCFullYear(),this.$M=d.getUTCMonth(),this.$D=d.getUTCDate(),this.$W=d.getUTCDay(),this.$H=d.getUTCHours(),this.$m=d.getUTCMinutes(),this.$s=d.getUTCSeconds(),this.$ms=d.getUTCMilliseconds()}else C.call(this)};var $=i.utcOffset;i.utcOffset=function(d,m){var I=this.$utils().u;if(I(d))return this.$u?0:I(this.$offset)?$.call(this):this.$offset;if(typeof d=="string"&&(d=function(L){L===void 0&&(L="");var q=L.match(r);if(!q)return null;var E=(""+q[0]).match(l)||["-",0,0],x=E[0],y=60*+E[1]+ +E[2];return y===0?0:x==="+"?y:-y}(d),d===null))return this;var p=Math.abs(d)<=16?60*d:d;if(p===0)return this.utc(m);var g=this.clone();if(m)return g.$offset=p,g.$u=!1,g;var v=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(g=this.local().add(p+v,n)).$offset=p,g.$x.$localOffset=v,g};var _=i.format;i.format=function(d){var m=d||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return _.call(this,m)},i.valueOf=function(){var d=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*d},i.isUTC=function(){return!!this.$u},i.toISOString=function(){return this.toDate().toISOString()},i.toString=function(){return this.toDate().toUTCString()};var S=i.toDate;i.toDate=function(d){return d==="s"&&this.$offset?u(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():S.call(this)};var w=i.diff;i.diff=function(d,m,I){if(d&&this.$u===d.$u)return w.call(this,d,m,I);var p=this.local(),g=u(d).local();return w.call(p,g,m,I)}}})})(_e);var qe=_e.exports;const je=ke(qe);var Se={exports:{}};(function(o,t){(function(n,r){o.exports=r()})(xe,function(){var n={year:0,month:1,day:2,hour:3,minute:4,second:5},r={};return function(l,a,s){var u,i=function(_,S,w){w===void 0&&(w={});var d=new Date(_),m=function(I,p){p===void 0&&(p={});var g=p.timeZoneName||"short",v=I+"|"+g,L=r[v];return L||(L=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:I,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:g}),r[v]=L),L}(S,w);return m.formatToParts(d)},b=function(_,S){for(var w=i(_,S),d=[],m=0;m<w.length;m+=1){var I=w[m],p=I.type,g=I.value,v=n[p];v>=0&&(d[v]=parseInt(g,10))}var L=d[3],q=L===24?0:L,E=d[0]+"-"+d[1]+"-"+d[2]+" "+q+":"+d[4]+":"+d[5]+":000",x=+_;return(s.utc(E).valueOf()-(x-=x%1e3))/6e4},C=a.prototype;C.tz=function(_,S){_===void 0&&(_=u);var w,d=this.utcOffset(),m=this.toDate(),I=m.toLocaleString("en-US",{timeZone:_}),p=Math.round((m-new Date(I))/1e3/60),g=15*-Math.round(m.getTimezoneOffset()/15)-p;if(!Number(g))w=this.utcOffset(0,S);else if(w=s(I,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(g,!0),S){var v=w.utcOffset();w=w.add(d-v,"minute")}return w.$x.$timezone=_,w},C.offsetName=function(_){var S=this.$x.$timezone||s.tz.guess(),w=i(this.valueOf(),S,{timeZoneName:_}).find(function(d){return d.type.toLowerCase()==="timezonename"});return w&&w.value};var $=C.startOf;C.startOf=function(_,S){if(!this.$x||!this.$x.$timezone)return $.call(this,_,S);var w=s(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return $.call(w,_,S).tz(this.$x.$timezone,!0)},s.tz=function(_,S,w){var d=w&&S,m=w||S||u,I=b(+s(),m);if(typeof _!="string")return s(_).tz(m);var p=function(q,E,x){var y=q-60*E*1e3,N=b(y,x);if(E===N)return[y,E];var B=b(y-=60*(N-E)*1e3,x);return N===B?[y,N]:[q-60*Math.min(N,B)*1e3,Math.max(N,B)]}(s.utc(_,d).valueOf(),I,m),g=p[0],v=p[1],L=s(g).utcOffset(v);return L.$x.$timezone=m,L},s.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},s.tz.setDefault=function(_){u=_}}})})(Se);var Ue=Se.exports;const Pe=ke(Ue),ie={"dao-ru":"导入","quan-xuan":"全选","xia-zai-dao-ru-mo-ban":"下载导入模板","xu-hao":"序号","qing-shu-ru":"请输入","qing-xuan-ze":"请选择","kai-shi-shi-jian":"开始时间","jie-shu-shi-jian":"结束时间","shai-xuan":"筛选","chong-zhi":"重置","guan-bi":"关闭","zhan-kai":"展开",excel:{fieldsMappingRequired:"请输入列字段映射",invalidInput:"非法输入",invalidOption:"请输入有效选项!",copyFailed:"复制失败",sheetNameTooLong:'Sheet名称 "{0}" 长度超过31个字符,已自动截断为 "{1}"'},validate:{invalidInput:"请输入正确内容"},tools:{keysLengthError:"keys 长度必须大于2 默认前两位为 label value"}},ce={"dao-ru":"Import","quan-xuan":"Select All","xia-zai-dao-ru-mo-ban":"Download Import Template","xu-hao":"No.","qing-shu-ru":"Please enter","qing-xuan-ze":"Please select","kai-shi-shi-jian":"Start Time","jie-shu-shi-jian":"End Time","shai-xuan":"Filter","chong-zhi":"Reset","guan-bi":"Collapse","zhan-kai":"Expand",excel:{fieldsMappingRequired:"Please enter column field mapping",invalidInput:"Invalid input",invalidOption:"Please enter a valid option!",copyFailed:"Copy failed",sheetNameTooLong:'Sheet name "{0}" exceeds 31 characters, automatically truncated to "{1}"'},validate:{invalidInput:"Please enter valid content"},tools:{keysLengthError:"Keys length must be greater than 2, default first two are label and value"}},$e={zh_cn:ie,en:ce};let ne=null;function Ee(o=null){if(o){const{global:t}=o;return t.messages.value.zh_cn?t.mergeLocaleMessage("zh_cn",ie):t.setLocaleMessage("zh_cn",ie),t.messages.value.en?t.mergeLocaleMessage("en",ce):t.setLocaleMessage("en",ce),ne=o,o}return ne||(ne=X.createI18n({legacy:!1,locale:"zh_cn",fallbackLocale:"zh_cn",messages:$e})),ne}function de(){return ne||Ee()}function ue(){return de().global.t}se.extend(je),se.extend(Pe);async function Ye(o,t){const{fields:n,range:r=1}=t;if(!n){const s=ue();throw new Error(s("excel.fieldsMappingRequired"))}let l=new we.Workbook;await l.xlsx.load(o);const a={};return l.eachSheet(function(s,u){const i=[];s.eachRow(function(b,C){if(C>r){let $={},_=!0;Object.keys(n).forEach(S=>{const w=b.getCell(n[S]).value;$[S]=w,w&&(_=!1)}),_||i.push($)}}),a[s._name]=i}),l=null,a}const He={columnWidth:30};async function Ie(o,t,n=[],r={}){if(!o||!t)return;const{columnStyle:l}=r,{columnWidth:a}=He;t.forEach(i=>{i.width=i.width?i.width:a});const{workbook:s,worksheet:u}=Ke();u.columns=t,u.addRows(n),l&&await Ze(s,u,l);try{const i=await s.xlsx.writeBuffer(),b=new File([i],o,{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});Me.saveAs(b)}catch(i){console.log(i)}}function Ke(){const o=new we.Workbook;o.creator="distributor System",o.lastModifiedBy="distributor System",o.created=new Date,o.modified=new Date,o.lastPrinted=new Date;const t=o.addWorksheet("Sheet1");return{workbook:o,worksheet:t}}async function Ze(o,t,n){const r=Object.keys(n);for(const l of r){const a=n[l],{type:s}=a;switch(s){case"IMG":await Ge(o,t,l);break}}}async function Ge(o,t,n,r){const l=t.getColumn(n),a=l.values;t.getColumn(n).width=20,t.eachRow((s,u)=>{u>1&&(s.height=40)});for(let s=0,u=a.length;s<u;s++){if(s<2)continue;let i=a[s];i&&(t.getCell(l.letter+s).value="",await We(o,t,i,{width:100,height:50,col:l._number-1,row:s-1}))}}async function We(o,t,n,r){const{col:l,row:a,width:s,height:u}=r,{success:i,base64:b}=await Qe(n,.3);if(i){const C=o.addImage({base64:b,extension:"jpeg"});t.addImage(C,{tl:{col:l,row:a},ext:{width:s,height:u}})}}function Qe(o,t=1){const n=new Image;return n.setAttribute("crossOrigin","anonymous"),n.crossOrigin="anonymous",n.src=o,new Promise((r,l)=>{n.onload=()=>{const a=document.createElement("canvas");a.width=n.width,a.height=n.height,a.getContext("2d").drawImage(n,0,0,a.width,a.height),r({success:!0,base64:a.toDataURL("image/jpeg",t)})},n.onerror=()=>{r({success:!1})}})}function Xe(o){if(o<26)return String.fromCharCode(65+o);{const t=String.fromCharCode(65+Math.floor((o-26)/26)),n=String.fromCharCode(65+(o-26)%26);return t+n}}function Je(o){return new Promise(t=>{setTimeout(()=>{t()},o)})}function et(o){return JSON.parse(JSON.stringify(o))}function tt(o){let t=[],n={},r=(l,a)=>Object.prototype.hasOwnProperty.call(l,a);for(const l of o){n[l.id]={...l,children:r(n,l.id)?n[l.id].children:[]};const a=n[l.id];l.pid==-1?t.push(a):(r(n,l.pid)||(n[l.pid]={children:[]}),n[l.pid].children.push(a))}return t}function fe(o,t=" "){return o?o.split(t).filter(n=>n.trim()):[]}class he{constructor(t,n=["label","value","labelEn"]){this.list=t,this.map=new Map(t.map(r=>{let l={...r,label:r[n[0]],value:r[n[1]]};return n[2]&&(l.labelEn=r[n[2]]),[r[n[1]],l]}))}getName(t,n){if(!this.has(t))return"-";const{label:r,labelEn:l}=this.map.get(t);return(n=="zh_cn"?r:l)||r||"-"}getTag(t){if(!this.has(t))return"info";const{tag:n="info"}=this.map.get(t);return n}getItem(t){return this.has(t)?this.map.get(t):null}getColor(t){if(!this.has(t))return null;const{color:n}=this.map.get(t);return n}has(t){return this.map.has(t)}}function nt(o,t=[],n="i18nName"){if(o.length==0)return new he([]);if(t.length<2){const l=ue();throw new Error(l("tools.keysLengthError"))}let r=o.map(l=>{let a={};return n&&(a.labelEn=l[n]),t.forEach((s,u)=>{u===0?a.label=l[s]:u===1?a.value=l[s]:a[s]=l[s]}),a});return new he(r)}function ot(o){return o?o.replace(/<[^>]+>/g,""):""}function lt(o){return o?(o.includes("\\\\u")&&(o=o.replace(/\\/g,"")),o.replace(/\\u[\dA-F]{4}/gi,t=>String.fromCharCode(parseInt(t.replace(/\\u/g,""),16)))):""}function rt(o,t=10){let n=1048576*t;return!(o.size>n)}function at(o){return Array.from(10).fill(0).map((n,r)=>o+"_"+r)}function st(o){let t={};return o.map((n,r)=>{let{key:l,option:a,type:s}=n,u=Xe(r);a?t[l]=`${u}---option`:s==="image"?t[l]=`${u}---image`:t[l]=u}),t}function it(o,t){return t.split(".").reduce((n,r)=>n&&n[r],o)}const Nt="",le=(o,t)=>{const n=o.__vccOpts||o;for(const[r,l]of t)n[r]=l;return n},Te=le({__name:"index",props:e.mergeModels({api:{type:Function},showCheckAll:{type:Boolean,default:!0},maxLimit:{type:Number,default:void 0},optionClick:{type:Function,default:()=>{}},data:{type:Array},labelValue:{type:Object,default:()=>({label:"label",labelEn:"labelEn",value:"value"})},changeLocal:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["success","change"],["update:modelValue"]),setup(o,{emit:t}){const n=o,r=e.useAttrs(),{t:l,locale:a}=X.useI18n(),s=e.useModel(o,"modelValue"),u=e.ref(""),i=e.computed(()=>{if(r.remote!==void 0)return n.data;const p=fe(u.value),{data:g,labelValue:v}=n,L=g||$.value;if(p.length==0)return L;const{label:q,labelEn:E}=v;let x=a.value=="en_us"?E||"i18nName":q;return p.length==1?L.filter(N=>N[x].toLowerCase().includes(p[0].toLowerCase())):L.filter(N=>{let B=!1;return B=p.some(re=>N[x].toLowerCase()==re.toLowerCase()),B})}),b=e.computed({get(){return r.multiple==null||s.value==null?!1:s.value.length==i.value.length},set(p){return p}}),C=t,$=e.ref([]),_=async()=>{const{data:p}=await n.api();$.value=[...p],C("success",$)};n.api&&_();const S=n.labelValue.label.split("-"),w=p=>{if(S.length==1){if(n.changeLocal)return l(p[n.labelValue.label]);let g=a.value=="en_us"?p[n.labelValue.labelEn||"i18nName"]:p[n.labelValue.label];return g=g||p[n.labelValue.label],g}else{let g=[];return S.forEach(v=>{g.push(p[v])}),g.join("-")}};function d(p){s.value=p?i.value.map(g=>g[n.labelValue.value]):[],C("change",s.value)}function m(p){n.optionClick(p),C("change",r["value-key"]?p:p[n.labelValue.value])}function I(p){return s.value.length>=n.maxLimit&&!s.value.includes(p[n.labelValue.value])}return(p,g)=>{const v=e.resolveComponent("el-checkbox"),L=e.resolveComponent("el-option"),q=e.resolveComponent("el-select");return e.openBlock(),e.createBlock(q,e.mergeProps({modelValue:s.value,"onUpdate:modelValue":g[1]||(g[1]=E=>s.value=E),filterable:"","collapse-tags":"","collapse-tags-tooltip":"","filter-method":e.unref(r).remote!=null?void 0:E=>u.value=E,clearable:""},e.unref(r),{onClear:o.optionClick}),{default:e.withCtx(()=>[e.unref(r).multiple!=null&&o.showCheckAll&&o.maxLimit==null?e.renderSlot(p.$slots,"header",{key:0},()=>[e.createVNode(v,{class:"mgl20",modelValue:b.value,"onUpdate:modelValue":g[0]||(g[0]=E=>b.value=E),onChange:d},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.$t("quan-xuan")),1)]),_:1},8,["modelValue"])],!0):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(E,x)=>(e.openBlock(),e.createBlock(L,{key:x,label:w(E),disabled:e.unref(r).multiple!=null&&o.maxLimit>0?I(E):!1,onClick:e.withModifiers(y=>m(E),["stop"]),value:e.unref(r)["value-key"]?E:E[o.labelValue.value]},null,8,["label","disabled","onClick","value"]))),128))]),_:3},16,["modelValue","filter-method","onClear"])}}},[["__scopeId","data-v-34eb8641"]]),qt="",ct=e.defineComponent({props:{name:{tyepe:String,required:!0}}});function ut(o,t,n,r,l,a){const s=e.resolveComponent("el-icon");return e.openBlock(),e.createBlock(s,{class:"cmp-icon"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.name)))]),_:1})}const me=le(ct,[["render",ut],["__scopeId","data-v-733f9daa"]]),dt={__name:"index",emits:["ok","no"],setup(o,{emit:t}){const n=t,r=te.debounce(()=>{n("ok")},500);function l(){n("no")}return(a,s)=>{const u=e.resolveComponent("el-link"),i=e.resolveComponent("el-popconfirm");return e.openBlock(),e.createBlock(i,e.mergeProps(a.$attrs,{onConfirm:e.unref(r),onCancel:l}),{reference:e.withCtx(()=>[e.createVNode(u,{underline:"never",type:a.$attrs.type},{default:e.withCtx(()=>[e.renderSlot(a.$slots,"default")]),_:3},8,["type"])]),_:3},16,["onConfirm"])}}},jt="",ft=["accept"],ht=le({__name:"index",props:{accept:{type:String,default:".xlsx,.xls"},loading:{type:Boolean,default:!1}},emits:["fileChange"],setup(o,{emit:t}){const n=t,r=e.ref(null);function l(a){let s=a.target.files[0];n("fileChange",s),r.value.value=null}return(a,s)=>{const u=e.resolveComponent("el-button");return e.openBlock(),e.createElementBlock("span",null,[e.createVNode(u,{loading:o.loading,class:"mgr10",onClick:s[0]||(s[0]=i=>r.value.click())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.$t("dao-ru")),1)]),_:1},8,["loading"]),e.createElementVNode("input",{onChange:l,ref_key:"input",ref:r,accept:o.accept,style:{position:"absolute",width:"0px",height:"0px",opacity:"0"},type:"file"},null,40,ft)])}}},[["__scopeId","data-v-5f1449ad"]]);function pe(o){let t={};return o.forEach(n=>{const{key:r,type:l,option:a={},value:s,dateType:u}=n;if(r)if(l=="input"&&(a!=null&&a.multiple))t[r]=fe(s);else if(l=="date")if(u.includes("range")){const[i,b]=r;let[C,$]=s||[];C&&u=="daterange"&&(C=se.dayjs(C).format("YYYY-MM-DD 00:00:00"),$=se.dayjs($).format("YYYY-MM-DD 23:59:59")),t[i]=C,t[b]=$}else t[r]=s;else t[r]=s}),t}const Pt="",mt={key:0},pt={class:"btns"},gt={class:"left"},Ct={class:"right"},ve=le({__name:"index",props:{form:{type:Object,required:!0}},emits:["confirm","reset","visibleChange"],setup(o,{expose:t,emit:n}){const r=o,l=n,a=e.ref(!0),s=e.ref(null),{t:u}=X.useI18n(),i=e.computed(()=>a.value?u("guan-bi"):u("zhan-kai"));function b(){l("confirm")}function C(m){m.option.onClear&&m.option.onClear(),l("confirm")}function $(){l("reset")}function _(){l("confirm")}function S(){return pe(r.form.items)}const w=te.cloneDeep(r.form.items);function d(){r.form.items.forEach(m=>{const I=w.find(p=>p.key==m.key);I&&(m.value=I.value)})}return t({getPrm:S,reset:d}),(m,I)=>{const p=e.resolveComponent("el-input"),g=e.resolveComponent("el-date-picker"),v=e.resolveComponent("el-form-item"),L=e.resolveComponent("el-form"),q=e.resolveComponent("el-link"),E=e.resolveComponent("el-button");return e.openBlock(),e.createElementBlock("div",{class:"searchBar-container mgt10 mgb10",onKeydown:e.withKeys(b,["enter"])},[e.createElementVNode("div",{class:"searchBar",style:e.normalizeStyle({height:a.value?"auto":"42px"})},[e.createVNode(L,{inline:"",model:o.form.data},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.form.items.filter(x=>!x.hidden),x=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:x.key},[x.type=="br"?(e.openBlock(),e.createElementBlock("br",mt)):(e.openBlock(),e.createBlock(v,{key:1,label:x.name},{default:e.withCtx(()=>{var y,N;return[x.type==="input"?(e.openBlock(),e.createBlock(p,{key:0,modelValue:x.value,"onUpdate:modelValue":B=>x.value=B,class:e.normalizeClass(((y=x.option)==null?void 0:y.class)||"w150"),placeholder:m.$t("qing-shu-ru"),clearable:""},null,8,["modelValue","onUpdate:modelValue","class","placeholder"])):x.type==="custom"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(x.render),{key:1})):e.createCommentVNode("",!0),x.type==="select"?(e.openBlock(),e.createBlock(Te,e.mergeProps({key:2,class:((N=x.option)==null?void 0:N.class)||"w150",modelValue:x.value,"onUpdate:modelValue":B=>x.value=B},{ref_for:!0},x.option,{onChange:b,onClear:B=>C(x)}),null,16,["class","modelValue","onUpdate:modelValue","onClear"])):e.createCommentVNode("",!0),x.type==="date"?(e.openBlock(),e.createBlock(g,{key:3,class:e.normalizeClass({datetimerange:"w300",daterange:"w200"}[x.dateType]||"w100"),modelValue:x.value,"onUpdate:modelValue":B=>x.value=B,"value-format":{datetimerange:"YYYY-MM-DD HH:mm:ss",daterange:"YYYY-MM-DD"}[x.dateType]||"YYYY-MM-DD",type:x.dateType||"date",onFocus:B=>s.value=x,onChange:B=>_(),placeholder:m.$t("qing-xuan-ze"),"start-placeholder":m.$t("kai-shi-shi-jian"),"end-placeholder":m.$t("jie-shu-shi-jian")},null,8,["class","modelValue","onUpdate:modelValue","value-format","type","onFocus","onChange","placeholder","start-placeholder","end-placeholder"])):e.createCommentVNode("",!0)]}),_:2},1032,["label"]))],64))),128))]),_:1},8,["model"])],4),e.createElementVNode("div",pt,[e.createElementVNode("div",gt,[e.renderSlot(m.$slots,"table-header-left",{},void 0,!0)]),e.createElementVNode("div",Ct,[e.createVNode(q,{underline:"never",class:"mgr10",onClick:I[0]||(I[0]=()=>{l("visibleChange",!a.value),a.value=!a.value})},{default:e.withCtx(()=>[e.createVNode(me,{name:a.value?"ArrowUp":"ArrowDown"},null,8,["name"]),e.createTextVNode(" "+e.toDisplayString(i.value),1)]),_:1}),e.createVNode(E,{type:"primary",onClick:b},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.$t("shai-xuan")),1)]),_:1}),e.createVNode(E,{type:"primary",onClick:$},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.$t("chong-zhi")),1)]),_:1}),e.renderSlot(m.$slots,"btn",{},void 0,!0)])])],32)}}},[["__scopeId","data-v-32ac9990"]]),Ht="",yt={class:"center"},bt=le({__name:"index",props:{id:{type:String,required:!0},loading:{type:Boolean,default:!1},immediate:{type:Boolean,default:!0},searchForm:{type:Object,default:()=>({items:[],selections:[],showSearch:!1,showPage:!1,showShadow:!1,showCheckBox:!1,enableCellCopy:!0})},api:{type:Function},data:{type:Array},tableConfig:{type:Object,default:()=>({})}},setup(o,{expose:t}){const{t:n,locale:r}=X.useI18n(),l=o,a=e.ref(!1),s=e.ref([]);l.searchForm.selections=[],l.searchForm.enableCellCopy==null&&(l.searchForm.enableCellCopy=!0);const u=te.cloneDeep(l.searchForm.items),i=l.searchForm.pageNoKey||"pageNo",b=e.reactive({[i]:1,pageSize:10,total:0}),C=e.ref(null),$=e.ref(null),_=e.ref(450),S=te.debounce(()=>{e.nextTick(()=>{if(!$.value)return;const c=$.value.getBoundingClientRect(),k=window.innerHeight,V=c.top,z=100,P=k-V-z,A=200;_.value=Math.max(P,A)})},100),w=()=>{S()},d=()=>{if(!l.searchForm.enableCellCopy)return!1;const f=C.value;if(!f||!f.$el)return!1;const c=f.$el;return c.classList.add("cell-copy-enabled"),c.removeEventListener("mousedown",B),c.removeEventListener("mousemove",re),c.removeEventListener("mouseup",Ce),c.addEventListener("mousedown",B),c.addEventListener("mousemove",re),c.addEventListener("mouseup",Ce),!0};e.onMounted(()=>{S(),window.addEventListener("resize",w),l.searchForm.enableCellCopy&&(document.addEventListener("keydown",Be),document.addEventListener("mouseup",Oe),setTimeout(()=>{d()},500))}),e.onUnmounted(()=>{if(window.removeEventListener("resize",w),l.searchForm.enableCellCopy){document.removeEventListener("keydown",Be),document.removeEventListener("mouseup",Oe);const f=C.value;if(f&&f.$el){const c=f.$el;c.removeEventListener("mousedown",B),c.removeEventListener("mousemove",re),c.removeEventListener("mouseup",Ce)}}});const m=e.computed(()=>ye.value.height||_.value);let I;async function p(f){const{dataFormat:c}=l.tableConfig;f.pageNo!=1&&(f.nextSearchAfter=I),a.value=!0;const{code:k,data:V={}}=await l.api(f).finally(()=>{a.value=!1,l.searchForm.selections=[]});if(k==200){let z=V.rows||V.records||[];s.value=c?c(z):z,b.total=V.totalRows||V.total||0,I=V.nextSearchAfter,l.searchForm.enableCellCopy&&e.nextTick(()=>{setTimeout(()=>{d()},100)})}}function g(f={}){const{searchData:c=()=>({})}=l.tableConfig,k=c();p({...b,...pe(l.searchForm.items),...f,...k})}function v(){const{reset:f}=l.tableConfig;f&&f(),l.searchForm.items.forEach(c=>{const k=u.find(V=>te.isArray(c.key)&&te.isArray(V.key)?c.key.join(",")==V.key.join(","):V.key==c.key);k&&(c.value=k.value)}),g()}l.api&&l.immediate&&g();function L(){return{...b,...pe(l.searchForm.items)}}const q=()=>{const f=C.value;f&&f.clearSort()},E=e.reactive({storage:!0}),x=e.reactive({width:"auto",drag:!0,resizable:!0,maxFixedSize:0}),y=e.reactive({isSelecting:!1,startCell:null,endCell:null,selectedCells:[]}),N=f=>{const c=f.closest(".vxe-body--column");if(!c||c.classList.contains("col--checkbox")||c.classList.contains("col--seq"))return null;const k=c.closest(".vxe-body--row");if(!k)return null;const V=C.value;if(!V)return null;let z=-1;const P=k.getAttribute("data-rowid");if(P!=null)z=parseInt(P,10);else{const F=k.parentElement;z=Array.from(F.querySelectorAll(".vxe-body--row")).indexOf(k)}if(z<0)return null;let A=-1;const W=c.getAttribute("data-colid");if(W&&(A=V.getColumns().findIndex(T=>T.id===W)),A<0){const T=Array.from(k.querySelectorAll(".vxe-body--column")).indexOf(c),M=!!c.closest(".vxe-table--fixed-left-wrapper"),j=!!c.closest(".vxe-table--fixed-right-wrapper"),O=V.getColumns();if(M){const U=O.filter(R=>R.fixed==="left");T<U.length&&(A=O.indexOf(U[T]))}else if(j){const U=O.filter(R=>R.fixed==="right");T<U.length&&(A=O.indexOf(U[T]))}else{const U=l.searchForm.showCheckBox?1:0;A=O.filter(H=>H.fixed==="left").length+T-U}}return A<0?null:{rowIndex:z,colIndex:A,cell:c}},B=f=>{const c=N(f.target);if(!c){Le();return}y.isSelecting=!0,y.startCell={rowIndex:c.rowIndex,colIndex:c.colIndex},y.endCell={...y.startCell},Fe(),De()},re=f=>{if(!y.isSelecting)return;const c=N(f.target);c&&(y.endCell={rowIndex:c.rowIndex,colIndex:c.colIndex},Fe(),De())},Ce=()=>{y.isSelecting=!1},Le=()=>{y.selectedCells=[],y.startCell=null,y.endCell=null;const f=C.value;if(!f)return;f.$el.querySelectorAll(".cell-selected, .cell-border-top, .cell-border-right, .cell-border-bottom, .cell-border-left").forEach(k=>{k.classList.remove("cell-selected","cell-border-top","cell-border-right","cell-border-bottom","cell-border-left")})},Fe=()=>{if(!y.startCell||!y.endCell){y.selectedCells=[];return}const f=y.startCell.rowIndex,c=y.endCell.rowIndex,k=y.startCell.colIndex,V=y.endCell.colIndex,z=Math.min(f,c),P=Math.max(f,c),A=Math.min(k,V),W=Math.max(k,V);y.selectedCells=[];for(let F=z;F<=P;F++)for(let T=A;T<=W;T++)y.selectedCells.push({rowIndex:F,colIndex:T})},De=()=>{e.nextTick(()=>{const f=C.value;if(!f)return;const c=f.$el;if(c.querySelectorAll(".cell-selected, .cell-border-top, .cell-border-right, .cell-border-bottom, .cell-border-left").forEach(M=>{M.classList.remove("cell-selected","cell-border-top","cell-border-right","cell-border-bottom","cell-border-left")}),y.selectedCells.length===0)return;const k=f.getColumns(),V=y.selectedCells.map(M=>M.rowIndex),z=y.selectedCells.map(M=>M.colIndex),P=Math.min(...V),A=Math.max(...V),W=Math.min(...z),F=Math.max(...z),T=[c.querySelector(".vxe-table--body-wrapper tbody"),c.querySelector(".vxe-table--fixed-left-wrapper tbody"),c.querySelector(".vxe-table--fixed-right-wrapper tbody")].filter(Boolean);y.selectedCells.forEach(({rowIndex:M,colIndex:j})=>{const O=k[j];if(!O)return;const U=O.fixed==="left",R=O.fixed==="right";for(const H of T){const ae=H.querySelectorAll(".vxe-body--row")[M];if(!ae)continue;const J=Array.from(ae.querySelectorAll(".vxe-body--column"));let D=null;if(U&&H.closest(".vxe-table--fixed-left-wrapper")){const K=k.filter(Z=>Z.fixed==="left").indexOf(O);D=J[K]}else if(R&&H.closest(".vxe-table--fixed-right-wrapper")){const K=k.filter(Z=>Z.fixed==="right").indexOf(O);D=J[K]}else if(!U&&!R&&H.closest(".vxe-table--body-wrapper")){const ee=l.searchForm.showCheckBox?1:0,K=k.filter(be=>be.fixed==="left").length,Z=j-K;D=J[Z+ee]}if(D&&!D.classList.contains("col--checkbox")&&!D.classList.contains("col--seq")){D.classList.add("cell-selected"),M===P&&D.classList.add("cell-border-top"),M===A&&D.classList.add("cell-border-bottom"),j===W&&D.classList.add("cell-border-left"),j===F&&D.classList.add("cell-border-right");break}}})})},Ot=async()=>{if(y.selectedCells.length===0)return;const f=C.value;if(!f)return;const c=f.$el,k=f.getColumns(),V=[...new Set(y.selectedCells.map(F=>F.rowIndex))].sort((F,T)=>F-T),z=[...new Set(y.selectedCells.map(F=>F.colIndex))].sort((F,T)=>F-T),P=[c.querySelector(".vxe-table--body-wrapper tbody"),c.querySelector(".vxe-table--fixed-left-wrapper tbody"),c.querySelector(".vxe-table--fixed-right-wrapper tbody")].filter(Boolean),A=[];V.forEach(F=>{const T=[];z.forEach(M=>{const j=k[M];if(!j){T.push("");return}const O=j.fixed==="left",U=j.fixed==="right";let R="";for(const H of P){const ae=H.querySelectorAll(".vxe-body--row")[F];if(!ae)continue;const J=Array.from(ae.querySelectorAll(".vxe-body--column"));let D=null;if(O&&H.closest(".vxe-table--fixed-left-wrapper")){const K=k.filter(Z=>Z.fixed==="left").indexOf(j);D=J[K]}else if(U&&H.closest(".vxe-table--fixed-right-wrapper")){const K=k.filter(Z=>Z.fixed==="right").indexOf(j);D=J[K]}else if(!O&&!U&&H.closest(".vxe-table--body-wrapper")){const ee=l.searchForm.showCheckBox?1:0,K=k.filter(be=>be.fixed==="left").length,Z=M-K;D=J[Z+ee]}if(D&&!D.classList.contains("col--checkbox")&&!D.classList.contains("col--seq")){R=D.innerText||D.textContent||"",R=R.trim(),R=R.replace(/\n/g," ").replace(/\s+/g," ");break}}T.push(R)}),A.push(T.join(" "))});const W=A.join(`
2
+ `);try{await navigator.clipboard.writeText(W)}catch(F){console.error(n("excel.copyFailed"),F)}},Be=f=>{l.searchForm.enableCellCopy&&((f.ctrlKey||f.metaKey)&&f.key==="c"?(f.preventDefault(),Ot()):f.key==="Escape"&&Le())},Oe=()=>{y.isSelecting=!1},ye=e.computed(()=>{const{customConfig:f,columnConfig:c,...k}=l.tableConfig;return{headerAlign:"left",align:"center",customConfig:{...E,...f},columnConfig:{...x,...c},"virtual-x-config":{enabled:!1,scrollToLeftOnChange:!1},"virtual-y-config":{enabled:!0,gt:100},...k}}),zt=f=>{b.pageNo=f,g()},At=f=>{b.pageSize=f,b[i]=1,g()};function ze(){const f=C.value.getCheckboxRecords();l.searchForm.selections=f}const Ae=f=>{const c=C.value;if(c){c.toggleCheckboxRow(f);const k=C.value.getCheckboxRecords();l.searchForm.selections=k}};return t({tableRef:C,getList:g,getPrm:L,clearSort:q,calculateTableHeight:S}),(f,c)=>{var F;const k=e.resolveComponent("el-button"),V=e.resolveComponent("el-checkbox"),z=e.resolveComponent("el-text"),P=e.resolveComponent("vxe-column"),A=e.resolveComponent("VxeTable"),W=e.resolveComponent("el-pagination");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({box:o.searchForm.showShadow})},[o.searchForm.showSearch?(e.openBlock(),e.createBlock(ve,{key:0,form:o.searchForm,onReset:v,onConfirm:c[1]||(c[1]=T=>g()),onVisibleChange:e.unref(S)},{btn:e.withCtx(()=>[e.renderSlot(f.$slots,"search-bar-btn",{},void 0,!0),e.createVNode(k,{round:"",onClick:c[0]||(c[0]=T=>C.value.openCustom())},{default:e.withCtx(()=>[e.createVNode(me,{name:"Tools"})]),_:1})]),_:3},8,["form","onVisibleChange"])):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"table-header-left",{},void 0,!0),e.createElementVNode("div",{ref_key:"tableContentRef",ref:$},[e.createVNode(A,e.mergeProps({id:o.id,ref_key:"tableRef",ref:C,loading:o.loading||a.value,data:o.api?s.value:o.data,border:""},ye.value,{height:m.value,onCheckboxChange:ze,onCheckboxAll:ze,onSortChange:(F=ye.value["sort-config"])==null?void 0:F.sortChange}),{default:e.withCtx(()=>[o.searchForm.showCheckBox==null||o.searchForm.showCheckBox?(e.openBlock(),e.createBlock(P,{key:0,type:"checkbox",width:e.unref(r)=="zh_cn"?80:150,title:f.$t("xu-hao"),fixed:"left"},{checkbox:e.withCtx(({rowIndex:T,row:M,checked:j,disabled:O,indeterminate:U})=>[e.createElementVNode("div",yt,[j?(e.openBlock(),e.createBlock(V,{key:0,checked:!0,disabled:O,size:"default",onClick:e.withModifiers(R=>!O&&Ae(M),["stop"])},null,8,["disabled","onClick"])):(e.openBlock(),e.createBlock(V,{key:1,disabled:O,checked:!1,size:"default",onClick:e.withModifiers(R=>!O&&Ae(M),["stop"])},null,8,["disabled","onClick"])),e.createVNode(z,{type:"info",class:"mgl5"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(T+1),1)]),_:2},1024)])]),_:1},8,["width","title"])):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"default",{},void 0,!0)]),_:3},16,["id","loading","data","height","onSortChange"])],512),o.searchForm.showPage?(e.openBlock(),e.createBlock(W,{key:1,"current-page":b[e.unref(i)],"onUpdate:currentPage":c[2]||(c[2]=T=>b[e.unref(i)]=T),class:"myPagination mgt10",background:"",layout:"total, sizes, prev, pager, next",total:b.total,"page-size":b.pageSize,"page-sizes":[10,50,100,500],onCurrentChange:zt,onSizeChange:At},null,8,["current-page","total","page-size"])):e.createCommentVNode("",!0)],2)}}},[["__scopeId","data-v-7c7c0598"]]),wt={__name:"index",props:{sheetsConfig:{type:Object,required:!0},fileName:{type:String,required:!0}},setup(o){const t=o;function n(){Ie(t.fileName,t.sheetsConfig)}return(r,l)=>{const a=e.resolveComponent("el-link");return e.openBlock(),e.createBlock(a,e.mergeProps({type:"primary",underline:"never"},r.$attrs,{onClick:n}),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.$t("xia-zai-dao-ru-mo-ban")),1)]),_:1},16)}}};function xt(o,t={}){const n=ue(),r={inForm:!0,required:!0,...t},l={phone:/^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/,password:/(?=.*\d)(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{8,12}/,email:/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/}[o],{inForm:a,value:s,required:u,msg:i=n("validate.invalidInput")}=r;return a?function(b,C,$){if(u){l.test(C)?$():$(new Error(i));return}C&&!l.test(C)?$(new Error(i)):$()}:l.test(s)}const kt={encrypt(o,t){t=t||"1CFEC667A1E6D42DC12565AAAA460494";var n=G.enc.Utf8.parse(t),r=G.enc.Utf8.parse(o),l=G.AES.encrypt(r,n,{mode:G.mode.ECB,padding:G.pad.Pkcs7});return l.toString()},decrypt(o,t){t=t||"1CFEC667A1E6D42DC12565AAAA460494";var n=G.enc.Utf8.parse(t),r=G.AES.decrypt(o,n,{mode:G.mode.ECB,padding:G.pad.Pkcs7});return G.enc.Utf8.stringify(r).toString()}};class _t{constructor(t={}){this.config={clientCode:t.clientCode||"one-portal",casServerUrl:`https://one-portal${t.isTest?"-test":""}.joy-group.com/api`,casPortalUrl:`https://one-portal${t.isTest?"-test":""}.joy-group.com`,serviceUrl:t.serviceUrl||window.location.origin+"/cas/callback",tokenKey:t.tokenKey||"one_portal_token",userKey:t.userKey||"one_portal_user",debug:t.debug||!1,autoLogin:t.autoLogin!==!1,loginCallback:t.loginCallback||null,logoutCallback:t.logoutCallback||null,errorCallback:t.errorCallback||null},this.token=null,this.user=null,this.init()}init(){this.log("OnePortal CAS SDK 初始化中..."),this.loadFromStorage();const n=new URLSearchParams(window.location.search).get("ticket");this.isLoggedIn()&&this.config.loginCallback?this.config.loginCallback(this.user,this.token):n?(this.log("检测到ST票据:",n),this.validateTicket(n)):this.config.autoLogin&&!this.isLoggedIn()&&(this.log("用户未登录,准备跳转到CAS登录页面"),this.login())}loadFromStorage(){try{this.token=localStorage.getItem(this.config.tokenKey);const t=localStorage.getItem(this.config.userKey);t&&(this.user=JSON.parse(t)),this.log("从本地存储加载数据:",{token:!!this.token,user:!!this.user})}catch(t){this.log("加载本地存储数据失败:",t)}}saveToStorage(){try{this.token&&localStorage.setItem(this.config.tokenKey,this.token),this.user&&localStorage.setItem(this.config.userKey,JSON.stringify(this.user)),this.log("数据已保存到本地存储")}catch(t){this.log("保存到本地存储失败:",t)}}clearStorage(){try{localStorage.removeItem(this.config.tokenKey),localStorage.removeItem(this.config.userKey),this.log("本地存储已清除")}catch(t){this.log("清除本地存储失败:",t)}}isLoggedIn(){return!!(this.token&&this.user)}getUser(){return this.user}getToken(){return this.token}login(){const t=`${this.config.casPortalUrl}?appCode=${this.config.clientCode}&redirectUrl=${encodeURIComponent(this.config.serviceUrl)}`;this.log("跳转到CAS登录页面:",t),window.location.href=t}async validateTicket(t){try{this.log("验证ST票据:",t);const n=await fetch(`${this.config.casServerUrl}/auth/validateST?ticket=${t}`,{method:"GET",headers:{"Content-Type":"application/json"}});if(!n.ok)throw new Error(`HTTP ${n.status}: ${n.statusText}`);const r=await n.json();if(r.success&&r.data)return this.token=r.data.token,this.user=r.data.user,this.saveToStorage(),this.clearTicketFromUrl(),this.log("ST票据验证成功,用户登录成功:",this.user),this.config.loginCallback&&this.config.loginCallback(this.user,this.token),!0;throw new Error(r.message||"ST票据验证失败")}catch(n){return this.log("ST票据验证失败:",n),this.handleError(n),!1}}clearTicketFromUrl(){const t=new URL(window.location);t.searchParams.delete("ticket"),window.history.replaceState({},document.title,t.toString())}async logout(t=!0){try{if(this.log("用户登出"),this.token)try{await fetch(`${this.config.casServerUrl}/auth/logout`,{method:"POST",headers:{AppId:this.config.clientCode,Authorization:`Bearer ${this.token}`,"Content-Type":"application/json"}})}catch(n){this.log("调用服务端登出接口失败:",n)}this.token=null,this.user=null,this.clearStorage(),this.config.logoutCallback&&this.config.logoutCallback(),t&&this.login()}catch(n){this.log("登出失败:",n),this.handleError(n)}}async request(t,n={}){const r={headers:{"Content-Type":"application/json",...n.headers},...n};r.headers.appId=this.config.clientCode,this.token&&(r.headers.Authorization=`Bearer ${this.token}`);try{const l=await fetch(t,r);return l.status===401?(this.log("Token已过期,需要重新登录"),this.logout(),null):l}catch(l){throw this.log("请求失败:",l),l}}async fetchUserInfo(){try{const t=await this.request(`${this.config.casServerUrl}/auth/user`);if(t&&t.ok){const n=await t.json();if(n.success&&n.data)return this.user=n.data,this.saveToStorage(),this.user}return null}catch(t){return this.log("获取用户信息失败:",t),null}}async refreshToken(){this.log("Token刷新功能暂未实现")}handleError(t){this.log("发生错误:",t),this.config.errorCallback&&this.config.errorCallback(t)}log(...t){this.config.debug&&console.log("[OnePortal CAS SDK]",...t)}checkLoginStatus(){return!this.isLoggedIn()&&this.config.autoLogin?(this.login(),!1):this.isLoggedIn()}setConfig(t,n){this.config[t]=n}getConfig(t){return this.config[t]}}function St(o,t={}){const r=Object.assign({manual:!1,log:!1,params:null,format:null},t),{manual:l,log:a,params:s={},cb:u,format:i}=r,b=e.ref([]),C=e.ref(!1),$=_=>{const S=_||s;C.value=!0,o(S).then(w=>{const{code:d,data:m,msg:I}=w;if(u){const{records:p,rows:g}=m||{},v=p||g?p||g:m;b.value=ge(v,i),u(w)}if(m){if(m.records!=null||m.rows!=null){const{records:p,rows:g,total:v=0}=m||{};S&&S.total!=null&&(s.total=parseInt(v)),b.value=ge(p||g||[],i)}else b.value=ge(m,i);a&&console.log("useRequest-res",b.value)}}).catch(w=>{u&&(console.log("useRequestErr",w),u({code:500}))}).finally(()=>{C.value=!1})};return l||$(),[C,b,$]}function $t(o){const t=e.ref(o),n=e.ref(""),r=e.ref("");return e.watch(t,l=>{const a=l||["",""];n.value=a[0],r.value=a[1]}),[t,n,r]}function Et(o){return Object.prototype.toString.call(o).slice(8,-1).toLowerCase()}function ge(o,t){if(!t)return o;if(o instanceof Array)return o.map(r=>{let l={};return t.forEach(a=>l[a]=r[a]),l});let n={};return t.forEach(r=>n[r]=o[r]),n}function It(o,t=[]){const{locale:n}=X.useI18n(),r=e.ref(o());return e.watch([n,...t],()=>{r.value=o()},{immediate:!0}),r}function Tt(o,t="zh_cn",n="en_us"){if(!o)return"-";const r={en_us:n,zh_cn:t},a=de().global.locale.value;return o[r[a]]||o[t]||"-"}function vt(o,t){let n=Q.mapState;return typeof o=="string"&&o.length>0&&(n=Q.createNamespacedHelpers(o).mapState),Ve(t,n)}function Vt(o,t){let n=Q.mapGetters;return typeof o=="string"&&o.length>0&&(n=Q.createNamespacedHelpers(o).mapGetters),Ve(t,n)}function Lt(o,t){let n=Q.mapActions;return typeof o=="string"&&o.length>0&&(n=Q.createNamespacedHelpers(o).mapActions),Ft(t,n)}function Ve(o,t){const n=Q.useStore(),r=t(o),l={};return Object.keys(r).forEach(a=>{const s=r[a].bind({$store:n});l[a]=e.computed(s)}),l}function Ft(o,t){const n=Q.useStore(),r=t(o),l={};return Object.keys(r).forEach(a=>{l[a]=r[a].bind({$store:n})}),l}const Dt={__name:"EnumRender",props:{renderOpts:{type:Object,default:()=>({enum:{}})},params:{type:Object}},setup(o){const t=o,n=t.params.row[t.params.column.field];return(r,l)=>{const a=e.resolveComponent("el-text");return o.renderOpts.text?(e.openBlock(),e.createBlock(a,{key:0},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.renderOpts.enum.getName(e.unref(n))),1)]),_:1})):(e.openBlock(),e.createBlock(a,{key:1,type:o.renderOpts.enum.getTag(e.unref(n))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.renderOpts.enum.getName(e.unref(n))),1)]),_:1},8,["type"]))}}};function Bt(){oe.VxeUI.renderer.add("Enum",{renderTableDefault(o,t){return[null,void 0].includes(t.row[t.column.field])?"-":React.createElement(Dt,{renderOpts:o,params:t})}}),oe.VxeUI.renderer.add("InputNumber",{renderTableDefault(o,t){return React.createElement(Y.ElInputNumber,{"v-model":t.row[t.column.field],...o.props,"step-strictly":!0,"value-on-clear":0})}}),oe.VxeUI.renderer.add("TrueFalse",{renderTableDefault(o,t){const{locale:n}=X.useI18n();let r=n.value=="zh_cn";return React.createElement(Y.ElText,{type:t.row[t.column.field]?"success":"danger"},t.row[t.column.field]?r?"是":"YES":r?"否":"NO")}}),oe.VxeUI.renderer.add("I18n",{renderTableDefault(o,t){const{locale:n}=X.useI18n();let r=n.value=="zh_cn"?t.column.field:o.fieldEn;return t.row[r]||t.row[t.column.field]}}),oe.VxeUI.renderer.add("Link",{renderTableDefault(o,t){var u;let n=t.column.field;const r=Ne.useRouter(),{multiple:l,to:a}=o;if(!l)return React.createElement(Y.ElLink,{underline:"never",type:"primary",onclick:()=>r.push({path:a,query:{[n]:t.row[n]}})},t.row[n]);const s=((u=t.row[n])==null?void 0:u.split(","))||[];return s.map((i,b)=>React.createElement("span",null,React.createElement(Y.ElLink,{underline:"never",type:"primary",onclick:()=>r.push({path:a,query:{[n]:i}})},i),b<s.length-1?",":""))}})}h.CmpDictionary=Te,h.CmpIcon=me,h.ConfrimButton=dt,h.DownExcelTemp=wt,h.ImportButton=ht,h.LayOutForm=Re,h.ListPage=bt,h.OnePortalCasSDK=_t,h.SearchBar=ve,h.StatusMap=he,h._toRaw=et,h._typeOf=Et,h.arrToStatusMap=nt,h.arrayToTree=tt,h.checkFileSize=rt,h.creatValidator=xt,h.createImportFields=st,h.createListPageId=at,h.crypto=kt,h.en=ce,h.exportExcel=Ie,h.getI18n=de,h.getI18nT=ue,h.getLocaleValue=Tt,h.getValueBykey=it,h.importExcel=Ye,h.messages=$e,h.registerVxeRenderers=Bt,h.setupI18n=Ee,h.sleep=Je,h.stringToArray=fe,h.stripHtmlTags=ot,h.unicode2Str=lt,h.useActions=Lt,h.useDatePicker=$t,h.useGetters=Vt,h.useI18nReState=It,h.useRequest=St,h.useState=vt,h.zhCn=ie,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "joy-admin-components",
3
- "version": "0.1.38",
3
+ "version": "0.1.40",
4
4
  "main": "./dist/joy-admin-components.umd.js",
5
5
  "module": "./dist/joy-admin-components.es.js",
6
6
  "types": "./src/index.d.ts",
@@ -246,19 +246,80 @@ export function _typeOf(value: any): string;
246
246
  * @param otherWatch 其他需要监听的值数组
247
247
  * @returns [data] 响应式数据
248
248
  */
249
- export function useI18nReState<T>(state: () => T, otherWatch?: any[]): [Ref<T>];
249
+ export function useI18nReState<T>(state: () => T, otherWatch?: any[]): Ref<T>;
250
250
 
251
251
  /**
252
- * 后端数据国际化
253
- * @param sourceData 源数据对象,包含不同语言的值
254
- * @param locale 语言环境,如 'zh_cn' 或 'en_us'(可以是 Ref)
255
- * @param defaultProp 默认语言属性,默认 'zh_cn'
256
- * @returns 当前语言的值,找不到则返回默认语言或 '-'
252
+ * 根据当前语言环境获取对应字段的值
253
+ *
254
+ * 用于处理后端返回的多语言数据对象,自动根据当前 i18n 语言环境返回对应的字段值
255
+ *
256
+ * @param sourceData - 包含多语言字段的源数据对象
257
+ * @param zh - 中文字段名,指定 sourceData 中哪个字段是中文内容,默认 'zh_cn'
258
+ * @param en - 英文字段名,指定 sourceData 中哪个字段是英文内容,默认 'en_us'
259
+ * @returns 返回当前语言对应的字段值,找不到则返回中文字段值,都没有则返回 '-'
260
+ *
261
+ * @description
262
+ * 该函数会自动检测当前 i18n 的语言环境(zh_cn 或 en_us),并返回 sourceData 中对应的字段值。
263
+ *
264
+ * **工作原理:**
265
+ * 1. 根据 zh 和 en 参数确定字段映射关系
266
+ * 2. 获取当前 i18n 语言环境
267
+ * 3. 返回对应语言的字段值
268
+ * 4. 如果找不到当前语言字段,回退到中文字段
269
+ * 5. 如果中文字段也不存在,返回 '-'
270
+ *
271
+ * **回退机制:**
272
+ * sourceData[当前语言字段] → sourceData[中文字段] → '-'
273
+ *
274
+ * @example
275
+ * ```ts
276
+ * // 示例 1:标准用法(字段名为 zh_cn 和 en_us)
277
+ * const data = { zh_cn: '产品A', en_us: 'Product A' };
278
+ * getLocaleValue(data);
279
+ * // 当前语言为中文时返回 '产品A'
280
+ * // 当前语言为英文时返回 'Product A'
281
+ * ```
282
+ *
283
+ * @example
284
+ * ```ts
285
+ * // 示例 2:自定义字段名
286
+ * const data = { nameCn: '产品B', nameEn: 'Product B' };
287
+ * getLocaleValue(data, 'nameCn', 'nameEn');
288
+ * // 当前语言为中文时返回 '产品B'
289
+ * // 当前语言为英文时返回 'Product B'
290
+ * ```
291
+ *
292
+ * @example
293
+ * ```ts
294
+ * // 示例 3:只有中文字段(回退机制)
295
+ * const data = { nameCn: '产品C' };
296
+ * getLocaleValue(data, 'nameCn', 'nameEn');
297
+ * // 即使当前语言为英文,也会返回 '产品C'(回退到中文)
298
+ * ```
299
+ *
300
+ * @example
301
+ * ```ts
302
+ * // 示例 4:空数据
303
+ * getLocaleValue(null); // 返回 '-'
304
+ * getLocaleValue(undefined); // 返回 '-'
305
+ * ```
306
+ *
307
+ * @example
308
+ * ```ts
309
+ * // 示例 5:在列表渲染中使用
310
+ * const products = [
311
+ * { id: 1, nameCn: '苹果', nameEn: 'Apple' },
312
+ * { id: 2, nameCn: '香蕉', nameEn: 'Banana' }
313
+ * ];
314
+ * products.map(item => getLocaleValue(item, 'nameCn', 'nameEn'));
315
+ * // 当前语言为中文时返回 ['苹果', '香蕉']
316
+ * // 当前语言为英文时返回 ['Apple', 'Banana']
317
+ * ```
257
318
  */
258
319
  export function getLocaleValue(
259
- sourceData: Record<string, string> | null | undefined,
260
- locale: string | Ref<string>,
261
- defaultProp?: string
320
+ sourceData: Record<string, any> | null | undefined,
321
+ zh?: string,
322
+ en?: string
262
323
  ): string;
263
324
 
264
325
  // storeHook.js hooks