antd-import-export 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -4,33 +4,33 @@ import { saveAs as n } from "file-saver";
4
4
  import r from "exceljs";
5
5
  import { useCallback as i, useEffect as a, useMemo as o, useRef as s, useState as c, useSyncExternalStore as l } from "react";
6
6
  import { DeleteOutlined as u, DownloadOutlined as d, FileOutlined as f, UploadOutlined as p } from "@ant-design/icons";
7
- import { App as m, Button as h, Flex as g, Input as _, InputNumber as v, Modal as y, Popover as b, Progress as x, Select as S, Space as C, Table as ee, Tag as w, Tooltip as te, Typography as T, message as E, theme as ne } from "antd";
8
- import { Fragment as D, jsx as O, jsxs as k } from "react/jsx-runtime";
7
+ import { App as m, Button as h, Flex as g, Input as _, InputNumber as v, Modal as y, Popover as b, Progress as x, Select as S, Space as C, Table as ee, Tag as w, Tooltip as T, Typography as E, theme as te } from "antd";
8
+ import { Fragment as ne, jsx as D, jsxs as O } from "react/jsx-runtime";
9
9
  // \0rolldown/runtime.js
10
- var re = Object.create, A = Object.defineProperty, j = Object.getOwnPropertyDescriptor, M = Object.getOwnPropertyNames, ie = Object.getPrototypeOf, ae = Object.prototype.hasOwnProperty, oe = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e = null), t.exports), N = (e, t, n, r) => {
11
- if (t && typeof t == "object" || typeof t == "function") for (var i = M(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !ae.call(e, s) && s !== n && A(e, s, {
10
+ var k = Object.create, A = Object.defineProperty, j = Object.getOwnPropertyDescriptor, M = Object.getOwnPropertyNames, N = Object.getPrototypeOf, P = Object.prototype.hasOwnProperty, re = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e = null), t.exports), ie = (e, t, n, r) => {
11
+ if (t && typeof t == "object" || typeof t == "function") for (var i = M(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !P.call(e, s) && s !== n && A(e, s, {
12
12
  get: ((e) => t[e]).bind(null, s),
13
13
  enumerable: !(r = j(t, s)) || r.enumerable
14
14
  });
15
15
  return e;
16
- }, se = (e, t, n) => (n = e == null ? {} : re(ie(e)), N(t || !e || !e.__esModule || !ae.call(e, "default") ? A(n, "default", {
16
+ }, ae = (e, t, n) => (n = e == null ? {} : k(N(e)), ie(t || !e || !e.__esModule || !P.call(e, "default") ? A(n, "default", {
17
17
  value: e,
18
18
  enumerable: !0
19
19
  }) : n, e));
20
20
  // src/core/schema/index.ts
21
- function ce(e) {
21
+ function oe(e) {
22
22
  return e.filter((e) => e.importable !== !1);
23
23
  }
24
24
  // src/core/schema/multiValue.ts
25
- var le = ";", ue = /[;;]/;
26
- function P(e) {
25
+ var F = ";", se = /[;;]/;
26
+ function I(e) {
27
27
  return e.map((e) => String(e)).join(";");
28
28
  }
29
- function F(e) {
30
- return e.split(ue).map((e) => e.trim()).filter(Boolean);
29
+ function L(e) {
30
+ return e.split(se).map((e) => e.trim()).filter(Boolean);
31
31
  }
32
32
  // src/core/schema/validate.ts
33
- var de = /* @__PURE__ */ se((/* @__PURE__ */ oe(((e, t, n) => {
33
+ var ce = /* @__PURE__ */ ae((/* @__PURE__ */ re(((e, t, n) => {
34
34
  (function(n, r) {
35
35
  typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self).dayjs_plugin_customParseFormat = r();
36
36
  })(n, (function() {
@@ -187,8 +187,8 @@ var de = /* @__PURE__ */ se((/* @__PURE__ */ oe(((e, t, n) => {
187
187
  };
188
188
  }));
189
189
  })))(), 1);
190
- e.extend(de.default);
191
- function fe(e, t) {
190
+ e.extend(ce.default);
191
+ function R(e, t) {
192
192
  return e.length > t.property.max_length ? {
193
193
  validateSuccess: !1,
194
194
  validateMessage: `长度不能超过 ${t.property.max_length}`
@@ -197,7 +197,7 @@ function fe(e, t) {
197
197
  validateValue: e
198
198
  };
199
199
  }
200
- function pe(e, n) {
200
+ function le(e, n) {
201
201
  let r = Number(e);
202
202
  if (!Number.isFinite(r)) return {
203
203
  validateSuccess: !1,
@@ -235,7 +235,7 @@ function pe(e, n) {
235
235
  validateValue: r
236
236
  };
237
237
  }
238
- function me(e, t) {
238
+ function ue(e, t) {
239
239
  return e === t.property.true_label ? {
240
240
  validateSuccess: !0,
241
241
  validateValue: !0
@@ -247,7 +247,7 @@ function me(e, t) {
247
247
  validateMessage: `内容必须是 ${t.property.true_label}|${t.property.false_label}`
248
248
  };
249
249
  }
250
- function I(t) {
250
+ function de(t) {
251
251
  let n = e(t, "YYYY-MM-DD", !0);
252
252
  return n.isValid() ? {
253
253
  validateSuccess: !0,
@@ -257,7 +257,7 @@ function I(t) {
257
257
  validateMessage: "不是有效的日期格式 YYYY-MM-DD"
258
258
  };
259
259
  }
260
- function L(e) {
260
+ function fe(e) {
261
261
  let t = /^([01]?[0-9]|2[0-3]):([0-5][0-9])$/.exec(e);
262
262
  return t ? {
263
263
  validateSuccess: !0,
@@ -267,7 +267,7 @@ function L(e) {
267
267
  validateMessage: "不是有效的日期格式 HH:mm"
268
268
  };
269
269
  }
270
- function R(t) {
270
+ function pe(t) {
271
271
  let n = e(t, "YYYY-MM-DD HH:mm", !0);
272
272
  return n.isValid() ? {
273
273
  validateSuccess: !0,
@@ -278,7 +278,7 @@ function R(t) {
278
278
  };
279
279
  }
280
280
  function z(e, t) {
281
- let n = F(e);
281
+ let n = L(e);
282
282
  if (n.length > t.property.list_max_length) return {
283
283
  validateSuccess: !1,
284
284
  validateMessage: `列表长度不能超过 ${t.property.list_max_length}`
@@ -292,7 +292,7 @@ function z(e, t) {
292
292
  validateValue: n
293
293
  };
294
294
  }
295
- function B(e, t) {
295
+ function me(e, t) {
296
296
  return e in t.property.option_map ? {
297
297
  validateSuccess: !0,
298
298
  validateValue: t.property.option_map[e]
@@ -301,8 +301,8 @@ function B(e, t) {
301
301
  validateMessage: `内容必须是 ${Object.keys(t.property.option_map).join("|")}`
302
302
  };
303
303
  }
304
- function V(e, t) {
305
- let n = F(e), r = t.property.option_map, i = [];
304
+ function B(e, t) {
305
+ let n = L(e), r = t.property.option_map, i = [];
306
306
  for (let e of n) {
307
307
  if (!(e in r)) return {
308
308
  validateSuccess: !1,
@@ -315,7 +315,7 @@ function V(e, t) {
315
315
  validateValue: i
316
316
  };
317
317
  }
318
- function H(e, t) {
318
+ function V(e, t) {
319
319
  if (e === null) return t.property.required ? {
320
320
  validateSuccess: !1,
321
321
  validateMessage: "不能为空"
@@ -323,85 +323,85 @@ function H(e, t) {
323
323
  validateSuccess: !0,
324
324
  validateValue: t.property.default_value
325
325
  };
326
- if (t.type === "text") return fe(e, t);
327
- if (t.type === "number") return pe(e, t);
328
- if (t.type === "boolean") return me(e, t);
329
- if (t.type === "date") return I(e);
330
- if (t.type === "time") return L(e);
331
- if (t.type === "datetime") return R(e);
326
+ if (t.type === "text") return R(e, t);
327
+ if (t.type === "number") return le(e, t);
328
+ if (t.type === "boolean") return ue(e, t);
329
+ if (t.type === "date") return de(e);
330
+ if (t.type === "time") return fe(e);
331
+ if (t.type === "datetime") return pe(e);
332
332
  if (t.type === "list") return z(e, t);
333
- if (t.type === "single_choice") return B(e, t);
334
- if (t.type === "multiple_choice") return V(e, t);
333
+ if (t.type === "single_choice") return me(e, t);
334
+ if (t.type === "multiple_choice") return B(e, t);
335
335
  throw Error("未知的字段类型");
336
336
  }
337
337
  // src/core/limits.ts
338
- var U = 2e4, he = 2e4, ge = 20971520;
338
+ var he = 2e4, H = 2e4, ge = 20971520;
339
339
  // src/core/excel/importEditor.ts
340
- function _e(e, t) {
340
+ function U(e, t) {
341
341
  if (t != null) {
342
342
  if (e.type !== "single_choice" && e.type !== "multiple_choice") return String(t);
343
343
  for (let [n, r] of Object.entries(e.property.option_map)) if (r === t) return n;
344
344
  return String(t);
345
345
  }
346
346
  }
347
+ function _e(e, t) {
348
+ return e.type === "boolean" ? t === !0 ? e.property.true_label : t === !1 ? e.property.false_label : void 0 : e.type === "single_choice" ? U(e, t) : e.type === "multiple_choice" ? Array.isArray(t) ? t.map((t) => U(e, t)).filter(Boolean) : [] : e.type === "list" ? Array.isArray(t) ? I(t) : "" : e.type === "number" ? typeof t == "number" ? t : void 0 : t == null ? "" : String(t);
349
+ }
347
350
  function ve(e, t) {
348
- return e.type === "boolean" ? t === !0 ? e.property.true_label : t === !1 ? e.property.false_label : void 0 : e.type === "single_choice" ? _e(e, t) : e.type === "multiple_choice" ? Array.isArray(t) ? t.map((t) => _e(e, t)).filter(Boolean) : [] : e.type === "list" ? Array.isArray(t) ? P(t) : "" : e.type === "number" ? typeof t == "number" ? t : void 0 : t == null ? "" : String(t);
351
+ return t === null ? e.type === "multiple_choice" ? [] : "" : e.type === "multiple_choice" ? L(t) : t;
349
352
  }
350
353
  function ye(e, t) {
351
- return t === null ? e.type === "multiple_choice" ? [] : "" : e.type === "multiple_choice" ? F(t) : t;
352
- }
353
- function be(e, t) {
354
- return t == null ? "" : e.type === "boolean" || e.type === "single_choice" ? String(t) : (e.type === "multiple_choice" || e.type === "list") && Array.isArray(t) ? P(t) : String(t);
354
+ return t == null ? "" : e.type === "boolean" || e.type === "single_choice" ? String(t) : (e.type === "multiple_choice" || e.type === "list") && Array.isArray(t) ? I(t) : String(t);
355
355
  }
356
356
  // src/core/excel/importRow.ts
357
- function xe(e, t, n) {
357
+ function be(e, t, n) {
358
358
  let r = {};
359
359
  return t.forEach((t) => {
360
360
  if (!n.includes(t.key)) return;
361
- let i = be(t, e.values[t.key]), a = H(i.trim() === "" ? null : i, t);
361
+ let i = ye(t, e.values[t.key]), a = V(i.trim() === "" ? null : i, t);
362
362
  if (!a.validateSuccess) throw Error(a.validateMessage);
363
363
  r[t.key] = a.validateValue ?? null;
364
364
  }), r;
365
365
  }
366
366
  // src/core/excel/parseSheet.ts
367
- function Se(e) {
367
+ function xe(e) {
368
368
  return !Number.isFinite(e) || e < 1 || e >= 2958466 ? null : new Date(Math.round((e - 25569) * 24 * 3600 * 1e3));
369
369
  }
370
- function Ce(e, t = !1) {
370
+ function Se(e, t = !1) {
371
371
  let n = String(e.getUTCMonth() + 1).padStart(2, "0"), r = String(e.getUTCDate()).padStart(2, "0"), i = `${e.getUTCFullYear()}-${n}-${r}`;
372
372
  return t ? `${i} ${String(e.getUTCHours()).padStart(2, "0")}:${String(e.getUTCMinutes()).padStart(2, "0")}` : i;
373
373
  }
374
- function we(e, t) {
374
+ function Ce(e, t) {
375
375
  let n = (e) => e.trim() === "" ? null : e.trim(), i = t === "datetime", a = t === "date" || i;
376
376
  if (e.type === r.ValueType.Null) return null;
377
- if (e.type === r.ValueType.Date) return Ce(e.value, i);
377
+ if (e.type === r.ValueType.Date) return Se(e.value, i);
378
378
  if (e.type === r.ValueType.Formula) {
379
379
  if (e.result === null || e.result === void 0) return null;
380
- if (e.result instanceof Date) return Ce(e.result, i);
380
+ if (e.result instanceof Date) return Se(e.result, i);
381
381
  if (a && typeof e.result == "number") {
382
- let t = Se(e.result);
383
- if (t) return Ce(t, i);
382
+ let t = xe(e.result);
383
+ if (t) return Se(t, i);
384
384
  }
385
385
  return n(String(e.result));
386
386
  }
387
387
  if (e.type === r.ValueType.Number) {
388
388
  if (a && typeof e.value == "number") {
389
- let t = Se(e.value);
390
- if (t) return Ce(t, i);
389
+ let t = xe(e.value);
390
+ if (t) return Se(t, i);
391
391
  }
392
392
  return n(String(e.value));
393
393
  }
394
394
  return n(e.text);
395
395
  }
396
- function Te(e) {
396
+ function we(e) {
397
397
  let t = e.property.default_value;
398
398
  if (t == null) return null;
399
399
  if (e.type === "boolean") return t ? e.property.true_label : e.property.false_label;
400
- if (Array.isArray(t)) return t.length > 0 ? P(t) : null;
400
+ if (Array.isArray(t)) return t.length > 0 ? I(t) : null;
401
401
  let n = String(t);
402
402
  return n.trim() === "" ? null : n;
403
403
  }
404
- function Ee(e, t) {
404
+ function Te(e, t) {
405
405
  let n = new Map(t.map((e) => [e.title, e])), r = [];
406
406
  for (let t = 1; t <= e.columnCount; t++) {
407
407
  let i = e.getRow(1).getCell(t).text.split("\n")[0].trim();
@@ -409,8 +409,8 @@ function Ee(e, t) {
409
409
  }
410
410
  return r;
411
411
  }
412
- function De(e, t) {
413
- let n = [], i = [], a = [], o = 0, s = !1, c = Ee(e, t), l = c.filter((e) => e !== null).map((e) => e.key), u = new Set(l);
412
+ function Ee(e, t) {
413
+ let n = [], i = [], a = [], o = 0, s = !1, c = Te(e, t), l = c.filter((e) => e !== null).map((e) => e.key), u = new Set(l);
414
414
  if (t.forEach((e) => {
415
415
  e.property.required && !u.has(e.key) && n.push(`缺少列: ${e.title}`);
416
416
  }), n.length > 0) return {
@@ -424,14 +424,14 @@ function De(e, t) {
424
424
  if (l === 1) return;
425
425
  let f = {};
426
426
  if (c.forEach((t, n) => {
427
- t && (f[t.key] = we(e.getCell(n + 1), t.type));
427
+ t && (f[t.key] = Ce(e.getCell(n + 1), t.type));
428
428
  }), c.forEach((t, n) => {
429
429
  if (!t) return;
430
430
  let a = e.getCell(n + 1);
431
431
  a.type === r.ValueType.Formula && (a.result === null || a.result === void 0) && (o += 1, i.length < 20 && i.push(`第 ${l} 行 [${t.title}] 是公式且没有保存计算结果, 请用 Excel 打开并保存后再导入`));
432
432
  }), Object.values(f).every((e) => e === null)) return;
433
433
  if (d += 1, d > 2e4) {
434
- s ||= (n.push(`导入数据超出限制(${U} 条), 请分批导入`), !0);
434
+ s ||= (n.push(`导入数据超出限制(${he} 条), 请分批导入`), !0);
435
435
  return;
436
436
  }
437
437
  let p = {
@@ -442,8 +442,8 @@ function De(e, t) {
442
442
  };
443
443
  t.forEach((e) => {
444
444
  if (!u.has(e.key)) return;
445
- let t = H(f[e.key] ?? Te(e), e);
446
- t.validateSuccess ? p.values[e.key] = ve(e, t.validateValue ?? null) : (p.values[e.key] = ye(e, f[e.key] ?? null), p.errors[e.key] = t.validateMessage);
445
+ let t = V(f[e.key] ?? we(e), e);
446
+ t.validateSuccess ? p.values[e.key] = _e(e, t.validateValue ?? null) : (p.values[e.key] = ve(e, f[e.key] ?? null), p.errors[e.key] = t.validateMessage);
447
447
  }), a.push(p);
448
448
  }), o > i.length && i.push(`还有 ${o - i.length} 个公式单元格没有保存计算结果`), {
449
449
  headerMessages: n,
@@ -453,7 +453,7 @@ function De(e, t) {
453
453
  };
454
454
  }
455
455
  // src/core/excel/worksheet.ts
456
- function Oe(t, n) {
456
+ function De(t, n) {
457
457
  let r = n[t.key];
458
458
  if (r == null || r === "") return null;
459
459
  switch (t.type) {
@@ -465,23 +465,23 @@ function Oe(t, n) {
465
465
  }
466
466
  case "multiple_choice": {
467
467
  let e = t.property.option_map;
468
- return P((Array.isArray(r) ? r : [r]).map((t) => Object.keys(e).find((n) => e[n] === t) ?? String(t)));
468
+ return I((Array.isArray(r) ? r : [r]).map((t) => Object.keys(e).find((n) => e[n] === t) ?? String(t)));
469
469
  }
470
470
  case "list": {
471
471
  let e = Array.isArray(r) ? r : [r], n = t.property.item_key;
472
- return P(e.map((e) => String(n && typeof e == "object" && e ? e[n] ?? "" : e)));
472
+ return I(e.map((e) => String(n && typeof e == "object" && e ? e[n] ?? "" : e)));
473
473
  }
474
474
  default: return r;
475
475
  }
476
476
  }
477
- function ke(e, t) {
477
+ function Oe(e, t) {
478
478
  t.forEach((t, n) => {
479
479
  t.type === "text" && (e.getColumn(n + 1).numFmt = "@");
480
480
  });
481
481
  }
482
- function Ae(e, t, n) {
482
+ function ke(e, t, n) {
483
483
  let r = n.map((e) => e.importable === !1 ? `${e.title}\n(仅导出)` : e.title), i = e.addRow(r);
484
- i.height = 20 + (Math.max(...r.map((e) => e.split("\n").length)) - 1) * 15, i.eachCell({ includeEmpty: !0 }, (e) => {
484
+ i.height = 20 + (Math.max(1, ...r.map((e) => e.split("\n").length)) - 1) * 15, i.eachCell({ includeEmpty: !0 }, (e) => {
485
485
  e.font = {
486
486
  bold: !0,
487
487
  size: 14,
@@ -495,16 +495,16 @@ function Ae(e, t, n) {
495
495
  wrapText: !0
496
496
  };
497
497
  }), t.forEach((t) => {
498
- e.addRow(n.map((e) => Oe(e, t))).eachCell({ includeEmpty: !0 }, (e) => {
498
+ e.addRow(n.map((e) => De(e, t))).eachCell({ includeEmpty: !0 }, (e) => {
499
499
  e.alignment = {
500
500
  ...e.alignment,
501
501
  wrapText: !0,
502
502
  vertical: "top"
503
503
  };
504
504
  });
505
- }), ke(e, n), Ne(e);
505
+ }), Oe(e, n), Me(e);
506
506
  }
507
- function je(e) {
507
+ function Ae(e) {
508
508
  let t = [e.property.required ? "必填" : "可选"];
509
509
  switch (e.type) {
510
510
  case "text":
@@ -534,12 +534,12 @@ function je(e) {
534
534
  case "multiple_choice": t.push(`可多选, 分号分隔(中英文均可): ${Object.keys(e.property.option_map).join(" / ")}`);
535
535
  }
536
536
  e.key.endsWith("_name") ? t.push("填对应记录的名称") : e.key.endsWith("_number") && t.push("填对应记录的编号");
537
- let n = Oe(e, { [e.key]: e.property.default_value });
537
+ let n = De(e, { [e.key]: e.property.default_value });
538
538
  return t.push(`默认值: ${n == null || n === "" ? "空" : n}`), t.join("\n");
539
539
  }
540
- function Me(e, t) {
541
- let n = t.map((e) => `${e.title}\n\n${je(e)}`), r = e.addRow(n);
542
- r.height = 20 + (Math.max(...n.map((e) => e.split("\n").length)) - 1) * 15, r.eachCell({ includeEmpty: !0 }, (e) => {
540
+ function je(e, t) {
541
+ let n = t.map((e) => `${e.title}\n\n${Ae(e)}`), r = e.addRow(n);
542
+ r.height = 20 + (Math.max(1, ...n.map((e) => e.split("\n").length)) - 1) * 15, r.eachCell({ includeEmpty: !0 }, (e) => {
543
543
  e.font = {
544
544
  bold: !0,
545
545
  size: 14,
@@ -552,9 +552,9 @@ function Me(e, t) {
552
552
  vertical: "top",
553
553
  wrapText: !0
554
554
  };
555
- }), ke(e, t), Ne(e);
555
+ }), Oe(e, t), Me(e);
556
556
  }
557
- function Ne(e, t = 20, n = 60) {
557
+ function Me(e, t = 20, n = 60) {
558
558
  let r = [];
559
559
  e.eachRow({ includeEmpty: !1 }, (e) => {
560
560
  e.eachCell({ includeEmpty: !1 }, (e, t) => {
@@ -576,9 +576,15 @@ function Ne(e, t = 20, n = 60) {
576
576
  });
577
577
  }
578
578
  // src/core/excel/runtime.ts
579
- var Pe = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", Fe;
579
+ var Ne = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
580
+ function Pe(e, t) {
581
+ n(e, `${t}.xlsx`);
582
+ }
583
+ var Fe;
580
584
  function Ie() {
581
- return Fe ??= import("exceljs").then((e) => e.default ?? e), Fe;
585
+ return Fe ??= import("exceljs").then((e) => e.default ?? e, (e) => {
586
+ throw Fe = void 0, e;
587
+ }), Fe;
582
588
  }
583
589
  function Le() {
584
590
  return new Promise((e) => {
@@ -592,21 +598,21 @@ async function ze(e, t, n) {
592
598
  let r = await Ie();
593
599
  Re(n), await Le();
594
600
  let i = new r.Workbook();
595
- Ae(i.addWorksheet("Sheet"), e, t);
601
+ ke(i.addWorksheet("Sheet"), e, t);
596
602
  let a = await i.xlsx.writeBuffer();
597
- return Re(n), new Blob([a], { type: Pe });
603
+ return Re(n), new Blob([a], { type: Ne });
598
604
  }
599
- async function Be(e, t, r) {
600
- let i = await ze(e, t);
601
- return n(i, `${r}.xlsx`), i;
605
+ async function Be(e, t, n) {
606
+ let r = await ze(e, t);
607
+ return Pe(r, n), r;
602
608
  }
603
609
  async function Ve(e, t) {
604
- let r = await Ie();
610
+ let n = await Ie();
605
611
  await Le();
606
- let i = new r.Workbook();
607
- Me(i.addWorksheet("导入模板"), e);
608
- let a = await i.xlsx.writeBuffer();
609
- n(new Blob([a], { type: Pe }), `${t}.xlsx`);
612
+ let r = new n.Workbook();
613
+ je(r.addWorksheet("导入模板"), e);
614
+ let i = await r.xlsx.writeBuffer();
615
+ Pe(new Blob([i], { type: Ne }), t);
610
616
  }
611
617
  async function He(e, t) {
612
618
  let n = await Ie(), r = await e.arrayBuffer();
@@ -619,7 +625,7 @@ async function He(e, t) {
619
625
  includedKeys: []
620
626
  };
621
627
  let a = i.worksheets[0];
622
- return a ? De(a, t) : {
628
+ return a ? Ee(a, t) : {
623
629
  headerMessages: ["文件里没有工作表"],
624
630
  formulaMessages: [],
625
631
  rows: [],
@@ -638,32 +644,36 @@ function We(e) {
638
644
  function Ge(e) {
639
645
  return e?.response?.data;
640
646
  }
647
+ function Ke(e) {
648
+ if (!Ue(e)) return;
649
+ let t = We(e);
650
+ return t === void 0 ? "network" : t === 401 ? "unauthorized" : t === 403 ? "forbidden" : t === 404 ? "notFound" : t === 400 ? "badRequest" : t >= 500 ? "server" : "unknown";
651
+ }
641
652
  // src/core/taskManager.ts
642
653
  var W = class extends Error {
643
654
  constructor(e) {
644
655
  super(e), this.name = "ImportPauseError";
645
656
  }
646
- }, Ke = 100, qe = 500;
647
- function Je(e, t) {
648
- let n = t - (Date.now() - e);
649
- return n > 0 ? new Promise((e) => setTimeout(e, n)) : Promise.resolve();
650
- }
651
- var G = { tasks: [] }, Ye = /* @__PURE__ */ new Set(), Xe = /* @__PURE__ */ new Map(), K = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map();
652
- function Ze() {
653
- G = { ...G }, Ye.forEach((e) => e());
654
- }
655
- function Qe(e) {
656
- return Ye.add(e), () => {
657
- Ye.delete(e);
658
- };
657
+ }, qe = 100, Je = 300;
658
+ function Ye(e) {
659
+ return new Promise((t) => setTimeout(t, e));
660
+ }
661
+ var G = { tasks: [] }, Xe = /* @__PURE__ */ new Set(), Ze = /* @__PURE__ */ new Map(), K = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map();
662
+ function Qe() {
663
+ G = { ...G }, Xe.forEach((e) => e());
659
664
  }
660
665
  function $e(e) {
661
- return Qe(e);
666
+ return Xe.add(e), () => {
667
+ Xe.delete(e);
668
+ };
662
669
  }
663
- function et() {
664
- return G.tasks;
670
+ function et(e) {
671
+ return $e(e);
665
672
  }
666
673
  function tt() {
674
+ return G.tasks;
675
+ }
676
+ function nt() {
667
677
  return `task-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
668
678
  }
669
679
  function J(e) {
@@ -677,29 +687,29 @@ function Y(e, t) {
677
687
  n && (G = {
678
688
  ...G,
679
689
  tasks: r
680
- }, Ze());
690
+ }, Qe());
681
691
  }
682
- function nt(e, t) {
692
+ function rt(e, t) {
683
693
  let n = J(e), r = Date.now();
684
694
  return [...n?.samples ?? [], {
685
695
  time: r,
686
696
  processed: t
687
697
  }].filter((e) => r - e.time <= 15e3).slice(-20);
688
698
  }
689
- var rt = 100, X = /* @__PURE__ */ new Set(), Z = null;
690
- function it(e, t, n) {
699
+ var it = 100, X = /* @__PURE__ */ new Set(), Z = null;
700
+ function at(e, t, n) {
691
701
  let r = K.get(e);
692
702
  r && (r.rowStates[t] = {
693
703
  ...r.rowStates[t],
694
704
  ...n
695
- }, at(e));
705
+ }, ot(e));
696
706
  }
697
- function at(e) {
707
+ function ot(e) {
698
708
  X.add(e), Z === null && (Z = setTimeout(() => {
699
709
  Z = null;
700
710
  let e = [...X];
701
- X.clear(), e.forEach(ot);
702
- }, rt));
711
+ X.clear(), e.forEach(st);
712
+ }, it));
703
713
  }
704
714
  function Q(e) {
705
715
  X.delete(e);
@@ -707,36 +717,36 @@ function Q(e) {
707
717
  function $(e, t) {
708
718
  return {
709
719
  processed: t.processed,
710
- total: st(t),
720
+ total: ct(t),
711
721
  successCount: t.successCount,
712
722
  failureCount: t.failures.length,
713
723
  validationFailedCount: t.validationFailedCount,
714
724
  failures: t.failures,
715
725
  rowStates: t.rowStates,
716
- samples: nt(e, t.processed)
726
+ samples: rt(e, t.processed)
717
727
  };
718
728
  }
719
- function ot(e) {
729
+ function st(e) {
720
730
  let t = K.get(e);
721
731
  t && J(e) && Y(e, $(e, t));
722
732
  }
723
- function st(e) {
733
+ function ct(e) {
724
734
  return e.options.rows.length - e.deletedIndexes.size;
725
735
  }
726
- async function ct(e, t, r) {
727
- let { options: i } = t;
728
- t.controller = r, t.cancelRequested = !1;
736
+ async function lt(e, t, n) {
737
+ let { options: r } = t;
738
+ t.controller = n, t.cancelRequested = !1;
729
739
  try {
730
740
  for (; !t.cancelRequested;) {
731
- let n = t.cursorId === void 0 ? {} : { cursor_id: t.cursorId }, a = await i.fetchPage(n, r.signal);
732
- if (r.signal.aborted) throw new DOMException("任务已取消", "AbortError");
741
+ let i = t.cursorId === void 0 ? {} : { cursor_id: t.cursorId }, a = await r.fetchPage(i, n.signal);
742
+ if (n.signal.aborted) throw new DOMException("任务已取消", "AbortError");
733
743
  if (t.total = a.count, a.results.length === 0) break;
734
744
  t.rows = t.rows.concat(a.results);
735
745
  let o = t.rows.length;
736
746
  Y(e, {
737
747
  total: t.total,
738
748
  processed: o,
739
- samples: nt(e, o)
749
+ samples: rt(e, o)
740
750
  });
741
751
  let s = a.results[a.results.length - 1]?.id;
742
752
  if (typeof s != "number") throw Error("导出数据缺少 id");
@@ -752,25 +762,25 @@ async function ct(e, t, r) {
752
762
  return;
753
763
  }
754
764
  if (t.rows.length === 0) throw Error("没有可导出的数据");
755
- Y(e, { finalizing: !0 });
756
- let a = Date.now(), o = await ze(t.rows, i.fieldSchemas, r.signal);
757
- if (r.signal.aborted) throw new DOMException("任务已取消", "AbortError");
765
+ Y(e, { finalizing: !0 }), await Ye(Je);
766
+ let i = await ze(t.rows, r.fieldSchemas, n.signal);
767
+ if (n.signal.aborted) throw new DOMException("任务已取消", "AbortError");
758
768
  try {
759
- n(o, `${i.fileName}.xlsx`);
769
+ Pe(i, r.fileName);
760
770
  } catch (e) {
761
771
  console.error(`自动下载失败: ${e}`);
762
772
  }
763
- await Je(a, qe), Y(e, {
773
+ Y(e, {
764
774
  status: "completed",
765
775
  pausing: !1,
766
776
  finalizing: !1,
767
777
  canceling: !1,
768
778
  total: t.rows.length,
769
779
  processed: t.rows.length,
770
- blob: o
780
+ blob: i
771
781
  });
772
782
  } catch (t) {
773
- if (r.signal.aborted) {
783
+ if (n.signal.aborted) {
774
784
  Y(e, {
775
785
  status: "canceled",
776
786
  pausing: !1,
@@ -784,23 +794,31 @@ async function ct(e, t, r) {
784
794
  pausing: !1,
785
795
  finalizing: !1,
786
796
  canceling: !1,
787
- errorMessage: lt(t)
797
+ errorMessage: dt(t)
788
798
  });
789
799
  } finally {
790
800
  t.controller = null;
791
801
  }
792
802
  }
793
- function lt(e) {
794
- if (!Ue(e)) return e instanceof Error ? e.message : "导出失败";
795
- let t = We(e);
796
- return t === void 0 ? "网络异常, 导出失败" : t === 401 ? "登录已过期, 导出失败" : t === 403 ? "没有导出权限, 导出失败" : t === 404 ? "导出接口不存在, 导出失败" : t === 400 ? "导出参数错误, 导出失败" : t >= 500 ? "服务器错误, 导出失败" : "导出失败";
803
+ var ut = {
804
+ network: "网络异常, 导出失败",
805
+ unauthorized: "登录已过期, 导出失败",
806
+ forbidden: "没有导出权限, 导出失败",
807
+ notFound: "导出接口不存在, 导出失败",
808
+ badRequest: "导出参数错误, 导出失败",
809
+ server: "服务器错误, 导出失败",
810
+ unknown: "导出失败"
811
+ };
812
+ function dt(e) {
813
+ let t = Ke(e);
814
+ return t === void 0 ? e instanceof Error ? e.message : "导出失败" : ut[t];
797
815
  }
798
- function ut(e) {
799
- return `导入完成: 成功 ${e.successCount} 条, 失败 ${e.failures.length} 条`;
816
+ function ft(e) {
817
+ return `成功 ${e.successCount} 条, 失败 ${e.failures.length} 条, 可修正失败行后继续`;
800
818
  }
801
- async function dt(e, t, n) {
819
+ async function pt(e, t, n) {
802
820
  let r = t.options.rows.length;
803
- if (t.controller = n, t.pauseRequested = !1, t.cancelRequested = !1, t.cycleFailureCount = 0, r === 0) {
821
+ if (t.controller = n, t.pauseRequested = !1, t.cancelRequested = !1, t.runFailureCount = 0, r === 0) {
804
822
  Y(e, {
805
823
  status: "failed",
806
824
  pausing: !1,
@@ -817,20 +835,20 @@ async function dt(e, t, n) {
817
835
  }]
818
836
  });
819
837
  let i = Math.min(Math.max(t.options.batchSize ?? 20, 1), 200), a = Math.min(Math.max(t.options.concurrency ?? 3, 1), 5), o = () => {
820
- let n = [];
821
- for (; n.length < i;) {
822
- let i = t.nextIndex;
823
- if (t.nextIndex += 1, i >= r) break;
824
- t.deletedIndexes.has(i) || J(e)?.rowStates?.[i]?.status !== "completed" && (t.skippedIndexes.has(i) || n.push(i));
838
+ let e = [];
839
+ for (; e.length < i;) {
840
+ let n = t.nextIndex;
841
+ if (t.nextIndex += 1, n >= r) break;
842
+ t.deletedIndexes.has(n) || t.rowStates[n]?.status !== "completed" && (t.skippedIndexes.has(n) || e.push(n));
825
843
  }
826
- return n;
844
+ return e;
827
845
  }, s = async () => {
828
846
  for (;;) {
829
847
  if (n.signal.aborted || t.pauseRequested || t.cancelRequested) return;
830
848
  let r = o();
831
849
  if (r.length === 0) return;
832
850
  r.forEach((t) => {
833
- it(e, t, {
851
+ at(e, t, {
834
852
  status: "running",
835
853
  message: void 0,
836
854
  fieldErrors: void 0
@@ -842,7 +860,7 @@ async function dt(e, t, n) {
842
860
  if (a.length !== r.length) throw new W("导入接口返回结果数量不正确, 任务已暂停");
843
861
  a.forEach((n, i) => {
844
862
  let a = r[i], o = t.options.rows[a];
845
- n.success ? (t.successCount += 1, it(e, a, {
863
+ n.success ? (t.successCount += 1, at(e, a, {
846
864
  status: "completed",
847
865
  fieldErrors: void 0
848
866
  })) : (t.failures.push({
@@ -850,27 +868,27 @@ async function dt(e, t, n) {
850
868
  rowNumber: o.rowNumber,
851
869
  message: n.message ?? "导入失败",
852
870
  fieldErrors: n.fieldErrors
853
- }), it(e, a, {
871
+ }), at(e, a, {
854
872
  status: "failed",
855
873
  message: n.message,
856
874
  fieldErrors: n.fieldErrors
857
- }), t.cycleFailureCount += 1, t.cycleFailureCount > Ke && (t.pauseRequested = !0));
875
+ }), t.runFailureCount += 1, t.runFailureCount > qe && (t.pauseRequested = !0));
858
876
  });
859
877
  } catch (i) {
860
878
  if (n.signal.aborted) return;
861
- let a = i instanceof W, o = i instanceof Error ? i.message : "导入失败";
879
+ let a = i instanceof W, o = `${i instanceof Error ? i.message : "导入失败"}(该批结果未知,重试可能重复)`;
862
880
  r.forEach((n) => {
863
881
  t.failures.push({
864
882
  index: n,
865
883
  rowNumber: t.options.rows[n].rowNumber,
866
884
  message: o
867
- }), it(e, n, {
885
+ }), at(e, n, {
868
886
  status: "failed",
869
887
  message: o
870
- }), t.cycleFailureCount += 1;
871
- }), a ? (t.pauseRequested = !0, n.abort()) : t.cycleFailureCount > Ke && (t.pauseRequested = !0);
888
+ }), t.runFailureCount += 1;
889
+ }), a ? (t.pauseRequested = !0, n.abort()) : t.runFailureCount > qe && (t.pauseRequested = !0);
872
890
  } finally {
873
- t.processed += r.length, at(e);
891
+ t.processed += r.length, ot(e);
874
892
  }
875
893
  }
876
894
  }, c = Math.min(a, Math.max(1, r));
@@ -919,7 +937,7 @@ async function dt(e, t, n) {
919
937
  ...$(e, t),
920
938
  status: "paused",
921
939
  pausing: !1,
922
- errorMessage: ut(t)
940
+ errorMessage: ft(t)
923
941
  }), t.options.onFinished?.();
924
942
  return;
925
943
  }
@@ -935,20 +953,20 @@ async function dt(e, t, n) {
935
953
  pausing: !1
936
954
  }), t.options.onFinished?.());
937
955
  }
938
- function ft(e, t) {
956
+ function mt(e, t) {
939
957
  let n = new AbortController();
940
- q.set(e, n), ct(e, t, n).finally(() => {
941
- q.delete(e), Xe.delete(e);
958
+ q.set(e, n), lt(e, t, n).finally(() => {
959
+ q.delete(e), Ze.delete(e);
942
960
  });
943
961
  }
944
- function pt(e, t) {
962
+ function ht(e, t) {
945
963
  let n = new AbortController();
946
- q.set(e, n), dt(e, t, n).finally(() => {
964
+ q.set(e, n), pt(e, t, n).finally(() => {
947
965
  q.delete(e), X.delete(e), J(e)?.status !== "paused" && K.delete(e);
948
966
  });
949
967
  }
950
- function mt(e) {
951
- let t = tt(), n = {
968
+ function gt(e) {
969
+ let t = nt(), n = {
952
970
  id: t,
953
971
  type: "export",
954
972
  title: e.title,
@@ -969,10 +987,10 @@ function mt(e) {
969
987
  cancelRequested: !1,
970
988
  controller: null
971
989
  };
972
- return Xe.set(t, r), Ze(), ft(t, r), t;
990
+ return Ze.set(t, r), Qe(), mt(t, r), t;
973
991
  }
974
- function ht(e) {
975
- let t = tt(), n = e.rows.map((e) => ({
992
+ function _t(e) {
993
+ let t = nt(), n = e.rows.map((e) => ({
976
994
  status: "queued",
977
995
  validationErrors: Object.keys(e.errors).length > 0 ? e.errors : void 0
978
996
  })), r = new Set(e.rows.flatMap((e, t) => Object.keys(e.errors).length > 0 ? [t] : [])), i = r.size, a = {
@@ -1006,12 +1024,12 @@ function ht(e) {
1006
1024
  cancelRequested: !1,
1007
1025
  deletedIndexes: /* @__PURE__ */ new Set(),
1008
1026
  skippedIndexes: r,
1009
- cycleFailureCount: 0,
1027
+ runFailureCount: 0,
1010
1028
  controller: null
1011
1029
  };
1012
- return K.set(t, o), Ze(), pt(t, o), t;
1030
+ return K.set(t, o), Qe(), ht(t, o), t;
1013
1031
  }
1014
- function gt(e) {
1032
+ function vt(e) {
1015
1033
  let t = J(e);
1016
1034
  if (!t || t.type !== "import" || t.status !== "paused") return;
1017
1035
  let n = K.get(e);
@@ -1020,7 +1038,7 @@ function gt(e) {
1020
1038
  status: "queued",
1021
1039
  validationErrors: e.validationErrors
1022
1040
  }), a = i.filter((e) => e.validationErrors && Object.keys(e.validationErrors).length > 0).length;
1023
- n.rowStates = i, n.validationFailedCount = a, n.nextIndex = 0, n.processed = r, n.successCount = r, n.failures = [], n.pauseRequested = !1, n.cancelRequested = !1, n.cycleFailureCount = 0, Y(e, {
1041
+ n.rowStates = i, n.validationFailedCount = a, n.nextIndex = 0, n.processed = r, n.successCount = r, n.failures = [], n.pauseRequested = !1, n.cancelRequested = !1, n.runFailureCount = 0, Y(e, {
1024
1042
  status: "running",
1025
1043
  pausing: !1,
1026
1044
  canceling: !1,
@@ -1031,21 +1049,21 @@ function gt(e) {
1031
1049
  failures: [],
1032
1050
  rowStates: i,
1033
1051
  errorMessage: void 0
1034
- }), pt(e, n);
1052
+ }), ht(e, n);
1035
1053
  }
1036
- function _t(e) {
1054
+ function yt(e) {
1037
1055
  let t = J(e);
1038
1056
  if (!t || t.type !== "import" || t.status !== "running" || t.canceling) return;
1039
1057
  let n = K.get(e);
1040
1058
  n && (n.pauseRequested = !0, Y(e, { pausing: !0 }));
1041
1059
  }
1042
- function vt(e, t, n) {
1060
+ function bt(e, t, n) {
1043
1061
  let r = J(e), i = K.get(e);
1044
1062
  if (!r || r.type !== "import" || r.status !== "paused" && r.status !== "failed" || !i) return;
1045
1063
  let a = r.rowStates?.[t]?.status;
1046
1064
  (a === "queued" || a === "failed") && (i.options.rows[t] = n);
1047
1065
  }
1048
- function yt(e, t, n) {
1066
+ function xt(e, t, n) {
1049
1067
  let r = J(e), i = K.get(e);
1050
1068
  if (!r || r.type !== "import" || !i || r.status !== "paused" && r.status !== "failed") return;
1051
1069
  let a = Object.keys(n).length > 0, o = i.rowStates[t]?.validationErrors, s = !!(o && Object.keys(o).length > 0);
@@ -1060,7 +1078,7 @@ function yt(e, t, n) {
1060
1078
  rowStates: i.rowStates
1061
1079
  });
1062
1080
  }
1063
- function bt(e, t) {
1081
+ function St(e, t) {
1064
1082
  let n = J(e), r = K.get(e);
1065
1083
  n && n.type === "import" && n.status === "paused" && r && (t.forEach((e) => {
1066
1084
  let t = r.rowStates[e];
@@ -1069,21 +1087,21 @@ function bt(e, t) {
1069
1087
  fieldErrors: void 0
1070
1088
  });
1071
1089
  }), Y(e, {
1072
- total: st(r),
1090
+ total: ct(r),
1073
1091
  validationFailedCount: r.validationFailedCount,
1074
1092
  rowStates: r.rowStates
1075
1093
  }));
1076
1094
  }
1077
- function xt(e, t, n) {
1095
+ function Ct(e, t, n) {
1078
1096
  let r = J(e)?.rowStates?.[t];
1079
1097
  if (!r?.fieldErrors?.some((e) => n in e)) return;
1080
1098
  let i = r.fieldErrors.filter((e) => !(n in e));
1081
- it(e, t, {
1099
+ at(e, t, {
1082
1100
  ...r,
1083
1101
  fieldErrors: i.length > 0 ? i : void 0
1084
1102
  });
1085
1103
  }
1086
- function St(e) {
1104
+ function wt(e) {
1087
1105
  let t = J(e);
1088
1106
  if (!t) return;
1089
1107
  if (t.status === "paused") {
@@ -1097,8 +1115,8 @@ function St(e) {
1097
1115
  }
1098
1116
  if (t.status !== "running") return;
1099
1117
  if (t.type === "export") {
1100
- if (t.canceling) return;
1101
- let n = Xe.get(e);
1118
+ if (t.canceling || t.finalizing) return;
1119
+ let n = Ze.get(e);
1102
1120
  if (!n) return;
1103
1121
  n.cancelRequested = !0, n.controller?.abort(), Y(e, { canceling: !0 });
1104
1122
  return;
@@ -1107,28 +1125,28 @@ function St(e) {
1107
1125
  let n = K.get(e);
1108
1126
  n && (n.cancelRequested = !0, Y(e, { canceling: !0 }));
1109
1127
  }
1110
- function Ct(e) {
1128
+ function Tt(e) {
1111
1129
  let t = J(e);
1112
- t && (t.status === "running" && q.get(e)?.abort(), Xe.delete(e), K.delete(e), X.delete(e), G = {
1130
+ t && (t.status === "running" && q.get(e)?.abort(), Ze.delete(e), K.delete(e), X.delete(e), G = {
1113
1131
  ...G,
1114
1132
  tasks: G.tasks.filter((t) => t.id !== e)
1115
- }, Ze());
1133
+ }, Qe());
1116
1134
  }
1117
- function wt(e, t) {
1135
+ function Et(e, t) {
1118
1136
  try {
1119
- return n(e, `${t}.xlsx`), !0;
1137
+ return Pe(e, t), !0;
1120
1138
  } catch (e) {
1121
1139
  return console.error(`下载失败: ${e}`), !1;
1122
1140
  }
1123
1141
  }
1124
- function Tt(e) {
1142
+ function Dt(e) {
1125
1143
  let t = J(e);
1126
- return t?.type !== "export" || !t.blob || !t.fileName ? !1 : wt(t.blob, t.fileName);
1144
+ return t?.type !== "export" || !t.blob || !t.fileName ? !1 : Et(t.blob, t.fileName);
1127
1145
  }
1128
- function Et() {
1129
- q.forEach((e) => e.abort()), q.clear(), Xe.clear(), K.clear(), X.clear(), Z !== null && (clearTimeout(Z), Z = null), G = { tasks: [] }, Ze();
1146
+ function Ot() {
1147
+ q.forEach((e) => e.abort()), q.clear(), Ze.clear(), K.clear(), X.clear(), Z !== null && (clearTimeout(Z), Z = null), G = { tasks: [] }, Qe();
1130
1148
  }
1131
- function Dt(e) {
1149
+ function kt(e) {
1132
1150
  if (e.status !== "running" || e.total <= 0) return null;
1133
1151
  let t = Math.max(0, e.total - (e.validationFailedCount ?? 0) - e.processed);
1134
1152
  if (t === 0) return 0;
@@ -1136,59 +1154,32 @@ function Dt(e) {
1136
1154
  let n = e.samples[0], r = e.samples[e.samples.length - 1], i = (r.time - n.time) / 1e3, a = r.processed - n.processed;
1137
1155
  return i <= 0 || a <= 0 ? null : t / (a / i);
1138
1156
  }
1139
- function Ot(e) {
1157
+ function At(e) {
1140
1158
  return e.type === "import" ? e.successCount === void 0 ? e.rowStates?.filter((e) => e.status === "completed").length ?? e.processed : e.successCount : e.processed;
1141
1159
  }
1142
- function kt(e) {
1143
- return e.total <= 0 ? 0 : Math.min(100, Ot(e) / e.total * 100);
1160
+ function jt(e) {
1161
+ return e.total <= 0 ? 0 : Math.min(100, At(e) / e.total * 100);
1144
1162
  }
1145
- function At(e) {
1163
+ function Mt(e) {
1146
1164
  if (e.finalizing) return 100;
1147
- let t = kt(e);
1165
+ let t = jt(e);
1148
1166
  return t >= 100 ? 100 : Math.trunc(t * 10) / 10;
1149
1167
  }
1150
- function jt(e) {
1168
+ function Nt(e) {
1151
1169
  return `${(Math.trunc(e * 10) / 10).toFixed(1)}%`;
1152
1170
  }
1153
- function Mt(e) {
1171
+ function Pt(e) {
1154
1172
  if (e === null) return "计算中...";
1155
1173
  let t = Math.ceil(e);
1156
1174
  return t < 60 ? `约 ${t} 秒` : `约 ${Math.floor(t / 60)} 分 ${t % 60} 秒`;
1157
1175
  }
1158
1176
  // src/react/useTaskDetail.ts
1159
- function Nt(e) {
1160
- let t = i(() => e ? et().find((t) => t.id === e) : void 0, [e]);
1161
- return l($e, t);
1162
- }
1163
- // src/components/BatchExportButton.tsx
1164
- var Pt = ({ title: t, fieldSchemas: n, selectedRows: r, disabled: i }) => {
1165
- let [a, o] = c(!1);
1166
- return /* @__PURE__ */ O(h, {
1167
- type: "default",
1168
- icon: /* @__PURE__ */ O(d, {}),
1169
- loading: a,
1170
- disabled: i ?? r.length === 0,
1171
- onClick: async () => {
1172
- if (r.length === 0) return;
1173
- if (r.length > 2e4) {
1174
- E.error(`导出数据 ${r.length.toLocaleString()} 条,超过上限 ${he} 条,请分批导出`);
1175
- return;
1176
- }
1177
- let i = `${t}_${e().format("YYYYMMDDHHmmss")}`;
1178
- o(!0);
1179
- try {
1180
- await Be(r, n, i), E.success("导出成功");
1181
- } catch (e) {
1182
- console.error(`导出失败: ${e}`), E.error("导出失败");
1183
- } finally {
1184
- o(!1);
1185
- }
1186
- },
1187
- children: "批量导出"
1188
- });
1189
- };
1190
- // src/components/ExportTaskModal.tsx
1191
1177
  function Ft(e) {
1178
+ let t = i(() => e ? tt().find((t) => t.id === e) : void 0, [e]);
1179
+ return l(et, t);
1180
+ }
1181
+ // src/components/ExportTaskModal.tsx
1182
+ function It(e) {
1192
1183
  if (e.canceling) return "正在取消";
1193
1184
  if (e.finalizing) return "正在生成文件";
1194
1185
  switch (e.status) {
@@ -1199,26 +1190,26 @@ function Ft(e) {
1199
1190
  case "canceled": return "已取消";
1200
1191
  }
1201
1192
  }
1202
- function It(e) {
1193
+ function Lt(e) {
1203
1194
  if (e.canceling) return "warning";
1204
1195
  if (e.finalizing) return "processing";
1205
1196
  }
1206
- function Lt(e) {
1197
+ function Rt(e) {
1207
1198
  switch (e.status) {
1208
1199
  case "failed": return "exception";
1209
1200
  case "completed": return "success";
1210
1201
  default: return "normal";
1211
1202
  }
1212
1203
  }
1213
- var Rt = ({ taskId: e, onClose: t }) => {
1214
- let n = Nt(e), { message: r } = m.useApp();
1204
+ var zt = ({ taskId: e, onClose: t }) => {
1205
+ let n = Ft(e), { message: r } = m.useApp();
1215
1206
  if (!n) return null;
1216
- let i = n.status === "completed" || n.status === "failed" || n.status === "canceled", a = At(n), o = () => {
1217
- Ct(n.id), t();
1207
+ let i = n.status === "completed" || n.status === "failed" || n.status === "canceled", a = Mt(n), o = () => {
1208
+ Tt(n.id), t();
1218
1209
  }, s = () => {
1219
- Tt(n.id) || r.error("文件不存在");
1220
- }, c = Ft(n);
1221
- return /* @__PURE__ */ O(y, {
1210
+ Dt(n.id) || r.error("文件不存在");
1211
+ }, c = It(n);
1212
+ return /* @__PURE__ */ D(y, {
1222
1213
  title: n.title,
1223
1214
  open: !0,
1224
1215
  maskClosable: !1,
@@ -1227,114 +1218,131 @@ var Rt = ({ taskId: e, onClose: t }) => {
1227
1218
  onCancel: () => {
1228
1219
  i && o();
1229
1220
  },
1230
- footer: i ? /* @__PURE__ */ k(g, {
1221
+ footer: i ? /* @__PURE__ */ O(g, {
1231
1222
  justify: "flex-end",
1232
1223
  gap: 8,
1233
- children: [n.status === "completed" ? /* @__PURE__ */ O(h, {
1224
+ children: [n.status === "completed" ? /* @__PURE__ */ D(h, {
1234
1225
  onClick: s,
1235
1226
  children: "重新下载"
1236
- }) : null, /* @__PURE__ */ O(h, {
1227
+ }) : null, /* @__PURE__ */ D(h, {
1237
1228
  type: "primary",
1238
1229
  onClick: o,
1239
1230
  children: "关闭"
1240
1231
  })]
1241
- }) : /* @__PURE__ */ O(g, {
1232
+ }) : /* @__PURE__ */ D(g, {
1242
1233
  justify: "flex-end",
1243
- children: /* @__PURE__ */ O(h, {
1234
+ children: /* @__PURE__ */ D(h, {
1244
1235
  danger: !0,
1245
1236
  loading: n.canceling,
1246
1237
  disabled: n.canceling || n.finalizing,
1247
- onClick: () => St(n.id),
1238
+ onClick: () => wt(n.id),
1248
1239
  children: n.canceling ? "取消中" : "取消任务"
1249
1240
  })
1250
1241
  }),
1251
- children: /* @__PURE__ */ k(g, {
1242
+ children: /* @__PURE__ */ O(g, {
1252
1243
  vertical: !0,
1253
1244
  gap: 12,
1254
1245
  children: [
1255
- /* @__PURE__ */ k(g, {
1246
+ /* @__PURE__ */ O(g, {
1256
1247
  justify: "space-between",
1257
1248
  align: "center",
1258
1249
  gap: 12,
1259
- children: [/* @__PURE__ */ k(T.Text, {
1250
+ children: [/* @__PURE__ */ O(E.Text, {
1260
1251
  type: "secondary",
1261
1252
  children: [
1262
1253
  "已导出 ",
1263
- Ot(n).toLocaleString(),
1254
+ At(n).toLocaleString(),
1264
1255
  " / 总数 ",
1265
1256
  n.total > 0 ? n.total.toLocaleString() : "--"
1266
1257
  ]
1267
- }), /* @__PURE__ */ O(w, {
1268
- color: It(n),
1258
+ }), /* @__PURE__ */ D(w, {
1259
+ color: Lt(n),
1269
1260
  children: c
1270
1261
  })]
1271
1262
  }),
1272
- /* @__PURE__ */ O(x, {
1263
+ /* @__PURE__ */ D(x, {
1273
1264
  percent: a,
1274
- format: () => jt(a),
1275
- status: Lt(n),
1265
+ format: () => Nt(a),
1266
+ status: Rt(n),
1276
1267
  size: "small"
1277
1268
  }),
1278
- n.finalizing ? /* @__PURE__ */ O(T.Text, {
1269
+ n.finalizing ? /* @__PURE__ */ D(E.Text, {
1279
1270
  type: "secondary",
1280
1271
  children: "正在生成文件..."
1281
1272
  }) : null,
1282
- n.canceling ? /* @__PURE__ */ O(T.Text, {
1273
+ n.canceling ? /* @__PURE__ */ D(E.Text, {
1283
1274
  type: "secondary",
1284
1275
  children: "正在取消..."
1285
1276
  }) : null,
1286
- n.errorMessage ? /* @__PURE__ */ O(T.Text, {
1277
+ n.errorMessage ? /* @__PURE__ */ D(E.Text, {
1287
1278
  type: "danger",
1288
1279
  children: n.errorMessage
1289
1280
  }) : null
1290
1281
  ]
1291
1282
  })
1292
1283
  });
1293
- }, zt = ({ title: t, buttonText: n = "导出", fieldSchemas: r, filters: i, totalCount: o, disabled: l, fetchPage: u }) => {
1294
- let { message: f } = m.useApp(), [p, g] = c(), _ = s(void 0);
1284
+ };
1285
+ // src/core/excel/exportFile.ts
1286
+ function Bt(t) {
1287
+ return `${t}_${e().format("YYYYMMDDHHmmss")}`;
1288
+ }
1289
+ function Vt(e) {
1290
+ return e <= 2e4 ? null : `导出数据 ${e.toLocaleString()} 条,超过上限 ${H.toLocaleString()} 条,请分批导出`;
1291
+ }
1292
+ async function Ht(e) {
1293
+ let { title: t, fieldSchemas: n, rows: r } = e;
1294
+ if (r.length === 0) throw Error("没有可导出的数据");
1295
+ let i = Vt(r.length);
1296
+ if (i) throw Error(i);
1297
+ return Be(r, n, Bt(t));
1298
+ }
1299
+ // src/components/ExportButton.tsx
1300
+ var Ut = ({ title: e, buttonText: t = "导出", fieldSchemas: n, filters: r, totalCount: i, disabled: o, fetchPage: l }) => {
1301
+ let { message: u } = m.useApp(), [f, p] = c(), g = s(void 0);
1295
1302
  return a(() => {
1296
- _.current = p;
1297
- }, [p]), a(() => () => {
1298
- _.current && Ct(_.current);
1299
- }, []), /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O(te, {
1303
+ g.current = f;
1304
+ }, [f]), a(() => () => {
1305
+ g.current && Tt(g.current);
1306
+ }, []), /* @__PURE__ */ O(ne, { children: [/* @__PURE__ */ D(T, {
1300
1307
  title: "导出 Excel",
1301
- children: /* @__PURE__ */ O(h, {
1308
+ children: /* @__PURE__ */ D(h, {
1302
1309
  type: "default",
1303
- icon: /* @__PURE__ */ O(d, {}),
1304
- disabled: l,
1310
+ icon: /* @__PURE__ */ D(d, {}),
1311
+ disabled: o,
1305
1312
  onClick: () => {
1306
- if (o === 0) {
1307
- f.error("没有可导出的数据");
1313
+ if (i === 0) {
1314
+ u.error("没有可导出的数据");
1308
1315
  return;
1309
1316
  }
1310
- if (o > 2e4) {
1311
- f.error(`导出数据共 ${o.toLocaleString()} 条, 超过上限 ${he} 条, 请缩小筛选范围后分批导出`);
1317
+ let t = Vt(i);
1318
+ if (t) {
1319
+ u.error(t);
1312
1320
  return;
1313
1321
  }
1314
- let n = `${t}_${e().format("YYYYMMDDHHmmss")}`;
1315
- g(mt({
1316
- title: `${t}导出`,
1317
- fileName: n,
1318
- fieldSchemas: r,
1319
- fetchPage: (e, t) => u({
1320
- ...i,
1322
+ let a = Bt(e);
1323
+ p(gt({
1324
+ title: `${e}导出`,
1325
+ fileName: a,
1326
+ fieldSchemas: n,
1327
+ fetchPage: (e, t) => l({
1328
+ ...r,
1321
1329
  ...e
1322
1330
  }, t)
1323
1331
  }));
1324
1332
  },
1325
- children: n
1333
+ children: t
1326
1334
  })
1327
- }), p ? /* @__PURE__ */ O(Rt, {
1328
- taskId: p,
1329
- onClose: () => g(void 0)
1335
+ }), f ? /* @__PURE__ */ D(zt, {
1336
+ taskId: f,
1337
+ onClose: () => p(void 0)
1330
1338
  }) : null] });
1331
- }, { Text: Bt } = T, Vt = ({ missingTitles: e, headerMessages: t }) => /* @__PURE__ */ k(g, {
1339
+ }, { Text: Wt } = E, Gt = ({ missingTitles: e, headerMessages: t }) => /* @__PURE__ */ O(g, {
1332
1340
  vertical: !0,
1333
1341
  gap: 4,
1334
- children: [e.length > 0 ? /* @__PURE__ */ O(Bt, { children: `缺少必填列: ${e.join(", ")}` }) : null, t.map((e, t) => /* @__PURE__ */ O(Bt, { children: e }, t))]
1342
+ children: [e.length > 0 ? /* @__PURE__ */ D(Wt, { children: `缺少必填列: ${e.join(", ")}` }) : null, t.map((e, t) => /* @__PURE__ */ D(Wt, { children: e }, t))]
1335
1343
  });
1336
1344
  // src/react/useDebouncedValue.ts
1337
- function Ht(e, t) {
1345
+ function Kt(e, t) {
1338
1346
  let [n, r] = c(e);
1339
1347
  return a(() => {
1340
1348
  let n = setTimeout(() => r(e), t);
@@ -1342,9 +1350,10 @@ function Ht(e, t) {
1342
1350
  }, [e, t]), n;
1343
1351
  }
1344
1352
  // src/react/useThrottledValue.ts
1345
- function Ut(e, t) {
1353
+ function qt(e, t) {
1346
1354
  let [n, r] = c(e), i = s(e), o = s(0), l = s(null);
1347
- return i.current = e, a(() => {
1355
+ return a(() => {
1356
+ i.current = e;
1348
1357
  let n = Date.now() - o.current;
1349
1358
  n >= t ? (o.current = Date.now(), r(e)) : l.current === null && (l.current = setTimeout(() => {
1350
1359
  l.current = null, o.current = Date.now(), r(i.current);
@@ -1354,12 +1363,12 @@ function Ut(e, t) {
1354
1363
  }, []), n;
1355
1364
  }
1356
1365
  // src/components/ImportPreviewModal.tsx
1357
- function Wt(e) {
1358
- return e == null || e === "" ? "" : Array.isArray(e) ? P(e) : String(e);
1366
+ function Jt(e) {
1367
+ return e == null || e === "" ? "" : Array.isArray(e) ? I(e) : String(e);
1359
1368
  }
1360
- var Gt = ({ field: e, record: t, disabled: n, onChange: r, onSave: i }) => {
1361
- let { token: a } = ne.useToken(), [o, s] = c(!1), [l, u] = c(!1), d = t.values[e.key];
1362
- if (o && !n) return e.type === "boolean" ? /* @__PURE__ */ O(S, {
1369
+ var Yt = ({ field: e, record: t, disabled: n, onChange: r, onSave: i }) => {
1370
+ let { token: a } = te.useToken(), [o, s] = c(!1), [l, u] = c(!1), d = t.values[e.key];
1371
+ if (o && !n) return e.type === "boolean" ? /* @__PURE__ */ D(S, {
1363
1372
  autoFocus: !0,
1364
1373
  open: !0,
1365
1374
  size: "small",
@@ -1376,7 +1385,7 @@ var Gt = ({ field: e, record: t, disabled: n, onChange: r, onSave: i }) => {
1376
1385
  r(e), i(e), s(!1);
1377
1386
  },
1378
1387
  onBlur: () => s(!1)
1379
- }) : e.type === "single_choice" ? /* @__PURE__ */ O(S, {
1388
+ }) : e.type === "single_choice" ? /* @__PURE__ */ D(S, {
1380
1389
  autoFocus: !0,
1381
1390
  open: !0,
1382
1391
  size: "small",
@@ -1390,7 +1399,7 @@ var Gt = ({ field: e, record: t, disabled: n, onChange: r, onSave: i }) => {
1390
1399
  r(e), i(e), s(!1);
1391
1400
  },
1392
1401
  onBlur: () => s(!1)
1393
- }) : e.type === "multiple_choice" ? /* @__PURE__ */ O(S, {
1402
+ }) : e.type === "multiple_choice" ? /* @__PURE__ */ D(S, {
1394
1403
  autoFocus: !0,
1395
1404
  open: !0,
1396
1405
  mode: "multiple",
@@ -1405,7 +1414,7 @@ var Gt = ({ field: e, record: t, disabled: n, onChange: r, onSave: i }) => {
1405
1414
  onBlur: () => {
1406
1415
  s(!1), i(d);
1407
1416
  }
1408
- }) : e.type === "number" ? /* @__PURE__ */ O(v, {
1417
+ }) : e.type === "number" ? /* @__PURE__ */ D(v, {
1409
1418
  autoFocus: !0,
1410
1419
  size: "small",
1411
1420
  style: { width: "100%" },
@@ -1417,7 +1426,7 @@ var Gt = ({ field: e, record: t, disabled: n, onChange: r, onSave: i }) => {
1417
1426
  onPressEnter: () => {
1418
1427
  s(!1), i(d);
1419
1428
  }
1420
- }) : /* @__PURE__ */ O(_, {
1429
+ }) : /* @__PURE__ */ D(_, {
1421
1430
  autoFocus: !0,
1422
1431
  size: "small",
1423
1432
  value: typeof d == "string" ? d : "",
@@ -1430,8 +1439,8 @@ var Gt = ({ field: e, record: t, disabled: n, onChange: r, onSave: i }) => {
1430
1439
  s(!1), i(d);
1431
1440
  }
1432
1441
  });
1433
- let f = Wt(d);
1434
- return /* @__PURE__ */ O("div", {
1442
+ let f = Jt(d);
1443
+ return /* @__PURE__ */ D("div", {
1435
1444
  title: f || void 0,
1436
1445
  style: {
1437
1446
  height: 24,
@@ -1452,7 +1461,7 @@ var Gt = ({ field: e, record: t, disabled: n, onChange: r, onSave: i }) => {
1452
1461
  onClick: () => {
1453
1462
  n || s(!0);
1454
1463
  },
1455
- children: /* @__PURE__ */ O("span", {
1464
+ children: /* @__PURE__ */ D("span", {
1456
1465
  style: {
1457
1466
  minWidth: 0,
1458
1467
  overflow: "hidden",
@@ -1463,7 +1472,7 @@ var Gt = ({ field: e, record: t, disabled: n, onChange: r, onSave: i }) => {
1463
1472
  })
1464
1473
  });
1465
1474
  };
1466
- function Kt(e) {
1475
+ function Xt(e) {
1467
1476
  if (e.canceling) return {
1468
1477
  label: "正在取消",
1469
1478
  color: "warning"
@@ -1491,21 +1500,21 @@ function Kt(e) {
1491
1500
  };
1492
1501
  }
1493
1502
  }
1494
- function qt(e, t) {
1503
+ function Zt(e, t) {
1495
1504
  if (e.canceling) return "正在取消...";
1496
1505
  switch (e.status) {
1497
- case "running": return `预计剩余 ${Mt(t)}`;
1506
+ case "running": return `预计剩余 ${Pt(t)}`;
1498
1507
  default: return null;
1499
1508
  }
1500
1509
  }
1501
- function Jt(e) {
1510
+ function Qt(e) {
1502
1511
  switch (e.status) {
1503
1512
  case "failed": return "exception";
1504
1513
  case "completed": return "success";
1505
1514
  default: return "normal";
1506
1515
  }
1507
1516
  }
1508
- var Yt = {
1517
+ var $t = {
1509
1518
  valid: {
1510
1519
  label: "已校验",
1511
1520
  color: "success"
@@ -1514,7 +1523,7 @@ var Yt = {
1514
1523
  label: "校验失败",
1515
1524
  color: "error"
1516
1525
  }
1517
- }, Xt = {
1526
+ }, en = {
1518
1527
  pending: {
1519
1528
  label: "待导入",
1520
1529
  color: "default"
@@ -1536,10 +1545,10 @@ var Yt = {
1536
1545
  color: "warning"
1537
1546
  }
1538
1547
  };
1539
- function Zt(e) {
1548
+ function tn(e) {
1540
1549
  return Object.keys(e.errors).length > 0 ? "invalid" : "valid";
1541
1550
  }
1542
- function Qt(e, t, n) {
1551
+ function nn(e, t, n) {
1543
1552
  if (!t || e.taskIndex === void 0) return "pending";
1544
1553
  switch (n?.rowStates?.[e.taskIndex]?.status) {
1545
1554
  case "running": return "running";
@@ -1549,19 +1558,21 @@ function Qt(e, t, n) {
1549
1558
  default: return "pending";
1550
1559
  }
1551
1560
  }
1552
- var $t = ({ open: e, title: t, fieldSchemas: n, rows: r, taskId: i, includedKeys: a, onChangeCell: s, onSaveCell: l, onDelete: d, onConfirm: f, onClose: p }) => {
1553
- let [m, v] = c("all"), [C, te] = c("all"), [E, ne] = c(""), re = Ht(E, 300), A = () => {
1554
- v("all"), te("all"), ne("");
1555
- }, j = Nt(i), [M, ie] = c(), ae = o(() => new Set(a), [a]), oe = n.filter((e) => ae.has(e.key));
1556
- j && j !== M && ie(j);
1557
- let N = j ?? (M?.id === i ? M : void 0), se = N ? Kt(N) : void 0, ce = !!(N && N.status !== "completed" && N.status !== "failed" && N.status !== "canceled"), le = Ut(N?.status === "running" ? Dt(N) : null, 1e3), ue = N ? qt(N, le) : null, P = (e) => e.taskIndex === void 0 ? void 0 : N?.rowStates?.[e.taskIndex], F = !(!j || j.status !== "failed" && j.status !== "paused"), de = (e) => {
1561
+ var rn = ({ open: e, title: t, fieldSchemas: n, rows: r, taskId: i, includedKeys: l, onChangeCell: d, onSaveCell: f, onDelete: p, onConfirm: m, onClose: v }) => {
1562
+ let [C, T] = c("all"), [te, k] = c("all"), [A, j] = c(""), M = Kt(A, 300), N = () => {
1563
+ T("all"), k("all"), j("");
1564
+ }, P = Ft(i), re = s(void 0);
1565
+ a(() => {
1566
+ P && (re.current = P);
1567
+ }, [P]);
1568
+ let ie = o(() => new Set(l), [l]), ae = n.filter((e) => ie.has(e.key)), oe = re.current, F = P ?? (oe?.id === i ? oe : void 0), se = F ? Xt(F) : void 0, I = !!(F && F.status !== "completed" && F.status !== "failed" && F.status !== "canceled"), L = qt(F?.status === "running" ? kt(F) : null, 1e3), ce = F ? Zt(F, L) : null, R = (e) => e.taskIndex === void 0 ? void 0 : F?.rowStates?.[e.taskIndex], le = !(!P || P.status !== "failed" && P.status !== "paused"), ue = (e) => {
1558
1569
  if (!i) return !0;
1559
- let t = P(e)?.status;
1560
- return F && (t === "queued" || t === "failed") ? !0 : F && e.taskIndex === void 0 && Object.keys(e.errors).length > 0;
1561
- }, fe = (e) => !i || j?.status === "paused" && P(e)?.status === "queued", pe = o(() => ["valid", "invalid"].map((e) => ({
1570
+ let t = R(e)?.status;
1571
+ return le && (t === "queued" || t === "failed") ? !0 : le && e.taskIndex === void 0 && Object.keys(e.errors).length > 0;
1572
+ }, de = (e) => !i || P?.status === "paused" && R(e)?.status === "queued", fe = o(() => ["valid", "invalid"].map((e) => ({
1562
1573
  value: e,
1563
- label: Yt[e].label
1564
- })), []), me = o(() => [
1574
+ label: $t[e].label
1575
+ })), []), pe = o(() => [
1565
1576
  "pending",
1566
1577
  "running",
1567
1578
  "completed",
@@ -1569,33 +1580,33 @@ var $t = ({ open: e, title: t, fieldSchemas: n, rows: r, taskId: i, includedKeys
1569
1580
  "canceled"
1570
1581
  ].map((e) => ({
1571
1582
  value: e,
1572
- label: Xt[e].label
1573
- })), []), I = N?.status === "running", L = I ? "" : re, R = !I && m !== "all" && pe.some((e) => e.value === m) ? m : "all", z = !I && C !== "all" && me.some((e) => e.value === C) ? C : "all", B = R !== "all" || L.trim() !== "", V = z !== "all", H = B || V, U = o(() => {
1574
- if (!B) return r;
1575
- let e = L.trim().toLowerCase();
1576
- return r.filter((t) => R !== "all" && Zt(t) !== R ? !1 : !e || Object.values(t.values).some((t) => (Array.isArray(t) ? t.join(" ") : String(t ?? "")).toLowerCase().includes(e)));
1583
+ label: en[e].label
1584
+ })), []), z = F?.status === "running", me = z ? "" : M, B = !z && C !== "all" && fe.some((e) => e.value === C) ? C : "all", V = !z && te !== "all" && pe.some((e) => e.value === te) ? te : "all", he = B !== "all" || me.trim() !== "", H = V !== "all", ge = he || H, U = o(() => {
1585
+ if (!he) return r;
1586
+ let e = me.trim().toLowerCase();
1587
+ return r.filter((t) => B !== "all" && tn(t) !== B ? !1 : !e || Object.values(t.values).some((t) => (Array.isArray(t) ? t.join(" ") : String(t ?? "")).toLowerCase().includes(e)));
1577
1588
  }, [
1578
1589
  r,
1579
- R,
1580
- L,
1581
- B
1582
- ]), he = Ut(N, 300), ge = V ? he : void 0, _e = o(() => V ? U.filter((e) => Qt(e, i, ge) === z) : i && N ? U.slice() : U, [
1590
+ B,
1591
+ me,
1592
+ he
1593
+ ]), _e = qt(F, 300), ve = H ? _e : void 0, ye = o(() => H ? U.filter((e) => nn(e, i, ve) === V) : i && F ? U.slice() : U, [
1583
1594
  U,
1584
- z,
1585
1595
  V,
1586
- ge,
1587
- N,
1596
+ H,
1597
+ ve,
1598
+ F,
1588
1599
  i
1589
- ]), ve = (e) => {
1600
+ ]), be = (e) => {
1590
1601
  let t = Object.entries(e.errors);
1591
- return /* @__PURE__ */ O(g, {
1602
+ return /* @__PURE__ */ D(g, {
1592
1603
  vertical: !0,
1593
1604
  gap: 4,
1594
1605
  style: { maxWidth: 320 },
1595
1606
  children: t.map(([e, t]) => {
1596
1607
  let r = n.find((t) => t.key === e)?.title ?? e;
1597
- return /* @__PURE__ */ k(T.Text, { children: [
1598
- /* @__PURE__ */ O(T.Text, {
1608
+ return /* @__PURE__ */ O(E.Text, { children: [
1609
+ /* @__PURE__ */ D(E.Text, {
1599
1610
  strong: !0,
1600
1611
  children: r
1601
1612
  }),
@@ -1604,45 +1615,45 @@ var $t = ({ open: e, title: t, fieldSchemas: n, rows: r, taskId: i, includedKeys
1604
1615
  ] }, e);
1605
1616
  })
1606
1617
  });
1607
- }, ye = (e) => {
1608
- let t = Zt(e), n = Yt[t];
1609
- return t === "invalid" ? /* @__PURE__ */ O(b, {
1618
+ }, xe = (e) => {
1619
+ let t = tn(e), n = $t[t];
1620
+ return t === "invalid" ? /* @__PURE__ */ D(b, {
1610
1621
  trigger: "hover",
1611
1622
  placement: "topRight",
1612
1623
  title: "错误信息",
1613
- content: ve(e),
1614
- children: /* @__PURE__ */ O(w, {
1624
+ content: be(e),
1625
+ children: /* @__PURE__ */ D(w, {
1615
1626
  color: n.color,
1616
1627
  children: n.label
1617
1628
  })
1618
- }) : /* @__PURE__ */ O(w, {
1629
+ }) : /* @__PURE__ */ D(w, {
1619
1630
  color: n.color,
1620
1631
  children: n.label
1621
1632
  });
1622
- }, be = (e) => {
1623
- let t = P(e), r = t?.fieldErrors ?? [], i = t?.message;
1624
- if (r.length === 0) return /* @__PURE__ */ O(T.Text, { children: i ?? "导入失败" });
1633
+ }, Se = (e) => {
1634
+ let t = R(e), r = t?.fieldErrors ?? [], i = t?.message;
1635
+ if (r.length === 0) return /* @__PURE__ */ D(E.Text, { children: i ?? "导入失败" });
1625
1636
  let a = /* @__PURE__ */ new Map();
1626
1637
  r.forEach((e) => {
1627
1638
  let [t, r] = Object.entries(e)[0] ?? [], i = t === "detail" || t === "non_field_errors" ? "错误" : n.find((e) => e.key === t)?.title ?? "数据", o = a.get(i) ?? [];
1628
1639
  o.push(r), a.set(i, o);
1629
1640
  });
1630
1641
  let o = [...a.entries()], s = o.slice(0, 3), c = o.length - s.length;
1631
- return /* @__PURE__ */ k(g, {
1642
+ return /* @__PURE__ */ O(g, {
1632
1643
  vertical: !0,
1633
1644
  gap: 8,
1634
1645
  style: { maxWidth: 360 },
1635
1646
  children: [
1636
- i ? /* @__PURE__ */ O(T.Text, { children: i }) : null,
1637
- s.map(([e, t]) => /* @__PURE__ */ k(g, {
1647
+ i ? /* @__PURE__ */ D(E.Text, { children: i }) : null,
1648
+ s.map(([e, t]) => /* @__PURE__ */ O(g, {
1638
1649
  vertical: !0,
1639
1650
  gap: 2,
1640
- children: [/* @__PURE__ */ O(T.Text, {
1651
+ children: [/* @__PURE__ */ D(E.Text, {
1641
1652
  strong: !0,
1642
1653
  children: e
1643
- }), t.map((e, t) => /* @__PURE__ */ k(T.Text, { children: ["• ", e] }, t))]
1654
+ }), t.map((e, t) => /* @__PURE__ */ O(E.Text, { children: ["• ", e] }, t))]
1644
1655
  }, e)),
1645
- c > 0 ? /* @__PURE__ */ k(T.Text, {
1656
+ c > 0 ? /* @__PURE__ */ O(E.Text, {
1646
1657
  type: "secondary",
1647
1658
  children: [
1648
1659
  "还有 ",
@@ -1652,36 +1663,36 @@ var $t = ({ open: e, title: t, fieldSchemas: n, rows: r, taskId: i, includedKeys
1652
1663
  }) : null
1653
1664
  ]
1654
1665
  });
1655
- }, xe = (e) => {
1656
- let t = Qt(e, i, N), n = Xt[t];
1666
+ }, Ce = (e) => {
1667
+ let t = nn(e, i, F), n = en[t];
1657
1668
  if (t === "failed") {
1658
- let t = P(e), r = (t?.fieldErrors?.length ?? 0) + +!!t?.message, i = r > 0 ? `导入失败(${r})` : n.label;
1659
- return /* @__PURE__ */ O(b, {
1669
+ let t = R(e), r = (t?.fieldErrors?.length ?? 0) + +!!t?.message, i = r > 0 ? `导入失败(${r})` : n.label;
1670
+ return /* @__PURE__ */ D(b, {
1660
1671
  trigger: "hover",
1661
1672
  placement: "topRight",
1662
1673
  title: "错误信息",
1663
- content: be(e),
1664
- children: /* @__PURE__ */ O(w, {
1674
+ content: Se(e),
1675
+ children: /* @__PURE__ */ D(w, {
1665
1676
  color: n.color,
1666
1677
  children: i
1667
1678
  })
1668
1679
  });
1669
1680
  }
1670
- return /* @__PURE__ */ O(w, {
1681
+ return /* @__PURE__ */ D(w, {
1671
1682
  color: n.color,
1672
1683
  children: n.label
1673
1684
  });
1674
- }, Se = (e) => /* @__PURE__ */ O(h, {
1685
+ }, we = (e) => /* @__PURE__ */ D(h, {
1675
1686
  type: "primary",
1676
1687
  danger: !0,
1677
1688
  size: "small",
1678
- disabled: !fe(e),
1679
- icon: /* @__PURE__ */ O(u, {}),
1689
+ disabled: !de(e),
1690
+ icon: /* @__PURE__ */ D(u, {}),
1680
1691
  onClick: () => {
1681
- d(e), j && e.taskIndex !== void 0 && bt(j.id, [e.taskIndex]);
1692
+ p(e), P && e.taskIndex !== void 0 && St(P.id, [e.taskIndex]);
1682
1693
  },
1683
1694
  children: "删除"
1684
- }), Ce = [
1695
+ }), Te = [
1685
1696
  {
1686
1697
  key: "rowNumber",
1687
1698
  title: "行号",
@@ -1689,17 +1700,17 @@ var $t = ({ open: e, title: t, fieldSchemas: n, rows: r, taskId: i, includedKeys
1689
1700
  width: 60,
1690
1701
  fixed: "left"
1691
1702
  },
1692
- ...oe.map((e) => ({
1703
+ ...ae.map((e) => ({
1693
1704
  key: e.key,
1694
1705
  title: e.title,
1695
1706
  dataIndex: e.key,
1696
1707
  width: 160,
1697
- render: (t, n) => /* @__PURE__ */ O(Gt, {
1708
+ render: (t, n) => /* @__PURE__ */ D(Yt, {
1698
1709
  field: e,
1699
1710
  record: n,
1700
- disabled: !de(n),
1701
- onChange: (t) => s(n, e, t),
1702
- onSave: (t) => l(n, e, t)
1711
+ disabled: !ue(n),
1712
+ onChange: (t) => d(n, e, t),
1713
+ onSave: (t) => f(n, e, t)
1703
1714
  })
1704
1715
  })),
1705
1716
  {
@@ -1707,24 +1718,24 @@ var $t = ({ open: e, title: t, fieldSchemas: n, rows: r, taskId: i, includedKeys
1707
1718
  title: "数据状态",
1708
1719
  width: 100,
1709
1720
  fixed: "right",
1710
- render: (e, t) => ye(t)
1721
+ render: (e, t) => xe(t)
1711
1722
  },
1712
1723
  {
1713
1724
  key: "importStatus",
1714
1725
  title: "导入状态",
1715
1726
  width: 110,
1716
1727
  fixed: "right",
1717
- render: (e, t) => xe(t)
1728
+ render: (e, t) => Ce(t)
1718
1729
  },
1719
1730
  {
1720
1731
  key: "action",
1721
1732
  title: "操作",
1722
1733
  width: 80,
1723
1734
  fixed: "right",
1724
- render: (e, t) => Se(t)
1735
+ render: (e, t) => we(t)
1725
1736
  }
1726
- ], we = Math.max(1200, 60 + oe.length * 160 + 100 + 110 + 80), Te = N && N.total > 0 ? At(N) : 0, Ee = N?.failureCount ?? N?.failures?.length ?? 0, De = N?.validationFailedCount ?? r.filter((e) => Object.keys(e.errors).length > 0).length, Oe = r.filter((e) => Object.keys(e.errors).length > 0).length, ke = r.length > 0 && Oe === r.length;
1727
- return /* @__PURE__ */ O(D, { children: /* @__PURE__ */ k(y, {
1737
+ ], Ee = Math.max(1200, 60 + ae.length * 160 + 100 + 110 + 80), De = F && F.total > 0 ? Mt(F) : 0, Oe = F?.failureCount ?? F?.failures?.length ?? 0, ke = F?.validationFailedCount ?? r.filter((e) => Object.keys(e.errors).length > 0).length, Ae = r.filter((e) => Object.keys(e.errors).length > 0).length, je = r.length > 0 && Ae === r.length;
1738
+ return /* @__PURE__ */ D(ne, { children: /* @__PURE__ */ O(y, {
1728
1739
  title: i ? `${t}导入` : `${t}导入预览`,
1729
1740
  open: e,
1730
1741
  width: "min(1400px, 96vw)",
@@ -1732,251 +1743,259 @@ var $t = ({ open: e, title: t, fieldSchemas: n, rows: r, taskId: i, includedKeys
1732
1743
  closable: !1,
1733
1744
  keyboard: !1,
1734
1745
  onCancel: () => {
1735
- ce || p();
1746
+ I || v();
1736
1747
  },
1737
1748
  footer: (() => {
1738
- if (!i) return /* @__PURE__ */ k(g, {
1749
+ if (!i) return /* @__PURE__ */ O(g, {
1739
1750
  justify: "space-between",
1740
1751
  align: "center",
1741
1752
  gap: 8,
1742
1753
  wrap: !0,
1743
- children: [/* @__PURE__ */ O("span", { children: r.length > 0 && Oe > 0 ? /* @__PURE__ */ O(T.Text, {
1744
- type: ke ? "danger" : "secondary",
1745
- children: ke ? "全部行校验失败, 请先修正后再导入" : `有 ${Oe} 行校验失败, 不会导入`
1746
- }) : null }), /* @__PURE__ */ k(g, {
1754
+ children: [/* @__PURE__ */ D("span", { children: r.length > 0 && Ae > 0 ? /* @__PURE__ */ D(E.Text, {
1755
+ type: je ? "danger" : "secondary",
1756
+ children: je ? "全部行校验失败, 请先修正后再导入" : `有 ${Ae} 行校验失败, 不会导入`
1757
+ }) : null }), /* @__PURE__ */ O(g, {
1747
1758
  gap: 8,
1748
- children: [/* @__PURE__ */ O(h, {
1749
- onClick: p,
1759
+ children: [/* @__PURE__ */ D(h, {
1760
+ onClick: v,
1750
1761
  children: "取消"
1751
- }), /* @__PURE__ */ O(h, {
1762
+ }), /* @__PURE__ */ D(h, {
1752
1763
  type: "primary",
1753
- disabled: r.length === 0 || ke,
1764
+ disabled: r.length === 0 || je,
1754
1765
  onClick: () => {
1755
- A(), f();
1766
+ N(), m();
1756
1767
  },
1757
1768
  children: "开始导入"
1758
1769
  })]
1759
1770
  })]
1760
1771
  });
1761
- if (!j || !N) return /* @__PURE__ */ O(g, {
1772
+ if (!P || !F) return /* @__PURE__ */ D(g, {
1762
1773
  justify: "flex-end",
1763
- children: /* @__PURE__ */ O(h, {
1764
- onClick: p,
1774
+ children: /* @__PURE__ */ D(h, {
1775
+ onClick: v,
1765
1776
  children: "关闭"
1766
1777
  })
1767
1778
  });
1768
- let e = N.status === "running", t = N.status === "paused";
1769
- return /* @__PURE__ */ k(g, {
1779
+ let e = F.status === "running", t = F.status === "paused";
1780
+ return /* @__PURE__ */ O(g, {
1770
1781
  justify: "flex-end",
1771
1782
  gap: 8,
1772
1783
  children: [
1773
- e ? /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O(h, {
1784
+ e ? /* @__PURE__ */ O(ne, { children: [/* @__PURE__ */ D(h, {
1774
1785
  danger: !0,
1775
- loading: N.canceling,
1776
- disabled: N.canceling,
1777
- onClick: () => St(N.id),
1778
- children: N.canceling ? "取消中" : "取消任务"
1779
- }), /* @__PURE__ */ O(h, {
1780
- loading: N.pausing,
1781
- disabled: N.canceling,
1782
- onClick: () => _t(N.id),
1786
+ loading: F.canceling,
1787
+ disabled: F.canceling,
1788
+ onClick: () => wt(F.id),
1789
+ children: F.canceling ? "取消中" : "取消任务"
1790
+ }), /* @__PURE__ */ D(h, {
1791
+ loading: F.pausing,
1792
+ disabled: F.canceling,
1793
+ onClick: () => yt(F.id),
1783
1794
  children: "暂停"
1784
1795
  })] }) : null,
1785
- t ? /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O(h, {
1796
+ t ? /* @__PURE__ */ O(ne, { children: [/* @__PURE__ */ D(h, {
1786
1797
  danger: !0,
1787
- onClick: () => St(N.id),
1798
+ onClick: () => wt(F.id),
1788
1799
  children: "取消任务"
1789
- }), /* @__PURE__ */ O(h, {
1800
+ }), /* @__PURE__ */ D(h, {
1790
1801
  type: "primary",
1791
1802
  onClick: () => {
1792
- A(), gt(N.id);
1803
+ N(), vt(F.id);
1793
1804
  },
1794
1805
  children: "继续导入"
1795
1806
  })] }) : null,
1796
- !e && !t ? /* @__PURE__ */ O(h, {
1807
+ !e && !t ? /* @__PURE__ */ D(h, {
1797
1808
  type: "primary",
1798
- onClick: p,
1809
+ onClick: v,
1799
1810
  children: "关闭"
1800
1811
  }) : null
1801
1812
  ]
1802
1813
  });
1803
1814
  })(),
1804
1815
  children: [
1805
- N && se ? /* @__PURE__ */ k(g, {
1816
+ F && se ? /* @__PURE__ */ O(g, {
1806
1817
  vertical: !0,
1807
1818
  gap: 4,
1808
1819
  style: { marginBottom: 12 },
1809
- children: [/* @__PURE__ */ k(g, {
1820
+ children: [/* @__PURE__ */ O(g, {
1810
1821
  justify: "space-between",
1811
1822
  align: "center",
1812
- children: [/* @__PURE__ */ k(T.Text, {
1823
+ children: [/* @__PURE__ */ O(E.Text, {
1813
1824
  type: "secondary",
1814
1825
  children: [
1815
1826
  "已导入 ",
1816
- Ot(N).toLocaleString(),
1827
+ At(F).toLocaleString(),
1817
1828
  " / 总数 ",
1818
- N.total.toLocaleString()
1829
+ F.total.toLocaleString()
1819
1830
  ]
1820
- }), /* @__PURE__ */ k(g, {
1831
+ }), /* @__PURE__ */ O(g, {
1821
1832
  align: "center",
1822
1833
  gap: 8,
1823
1834
  children: [
1824
- ue ? /* @__PURE__ */ O(T.Text, {
1835
+ ce ? /* @__PURE__ */ D(E.Text, {
1825
1836
  type: "secondary",
1826
- children: ue
1837
+ children: ce
1827
1838
  }) : null,
1828
- De > 0 ? /* @__PURE__ */ k(w, {
1839
+ ke > 0 ? /* @__PURE__ */ O(w, {
1829
1840
  color: "error",
1830
1841
  children: [
1831
1842
  "校验失败 ",
1832
- De,
1843
+ ke,
1833
1844
  " 条"
1834
1845
  ]
1835
1846
  }) : null,
1836
- Ee > 0 ? /* @__PURE__ */ k(w, {
1847
+ Oe > 0 ? /* @__PURE__ */ O(w, {
1837
1848
  color: "error",
1838
1849
  children: [
1839
1850
  "导入失败 ",
1840
- Ee,
1851
+ Oe,
1841
1852
  " 条"
1842
1853
  ]
1843
1854
  }) : null,
1844
- /* @__PURE__ */ O(w, {
1855
+ /* @__PURE__ */ D(w, {
1845
1856
  color: se.color,
1846
1857
  children: se.label
1847
1858
  })
1848
1859
  ]
1849
1860
  })]
1850
- }), /* @__PURE__ */ O(x, {
1851
- percent: Te,
1852
- format: () => jt(Te),
1853
- status: Jt(N),
1861
+ }), /* @__PURE__ */ D(x, {
1862
+ percent: De,
1863
+ format: () => Nt(De),
1864
+ status: Qt(F),
1854
1865
  size: "small"
1855
1866
  })]
1856
- }) : i ? null : /* @__PURE__ */ k(g, {
1867
+ }) : i ? null : /* @__PURE__ */ O(g, {
1857
1868
  vertical: !0,
1858
1869
  gap: 4,
1859
1870
  style: { marginBottom: 12 },
1860
- children: [/* @__PURE__ */ k(g, {
1871
+ children: [/* @__PURE__ */ O(g, {
1861
1872
  justify: "space-between",
1862
1873
  align: "center",
1863
- children: [/* @__PURE__ */ k(T.Text, {
1874
+ children: [/* @__PURE__ */ O(E.Text, {
1864
1875
  type: "secondary",
1865
1876
  children: ["总数 ", r.length.toLocaleString()]
1866
- }), /* @__PURE__ */ k(g, {
1877
+ }), /* @__PURE__ */ O(g, {
1867
1878
  align: "center",
1868
1879
  gap: 8,
1869
- children: [De > 0 ? /* @__PURE__ */ k(w, {
1880
+ children: [ke > 0 ? /* @__PURE__ */ O(w, {
1870
1881
  color: "error",
1871
1882
  children: [
1872
1883
  "校验失败 ",
1873
- De,
1884
+ ke,
1874
1885
  " 条"
1875
1886
  ]
1876
- }) : null, /* @__PURE__ */ O(w, { children: "待导入" })]
1887
+ }) : null, /* @__PURE__ */ D(w, { children: "待导入" })]
1877
1888
  })]
1878
- }), /* @__PURE__ */ O(x, {
1889
+ }), /* @__PURE__ */ D(x, {
1879
1890
  percent: 0,
1880
1891
  format: () => "0.0%",
1881
1892
  size: "small"
1882
1893
  })]
1883
1894
  }),
1884
- /* @__PURE__ */ k(g, {
1895
+ /* @__PURE__ */ O(g, {
1885
1896
  justify: "space-between",
1886
1897
  align: "center",
1887
1898
  gap: 8,
1888
1899
  wrap: !0,
1889
1900
  style: { marginBottom: 8 },
1890
- children: [/* @__PURE__ */ k(g, {
1901
+ children: [/* @__PURE__ */ O(g, {
1891
1902
  align: "center",
1892
1903
  gap: 8,
1893
1904
  wrap: !0,
1894
1905
  children: [
1895
- /* @__PURE__ */ O(_, {
1906
+ /* @__PURE__ */ D(_, {
1896
1907
  allowClear: !0,
1897
- disabled: I,
1908
+ disabled: z,
1898
1909
  placeholder: "搜索所有字段",
1899
- value: I ? "" : E,
1910
+ value: z ? "" : A,
1900
1911
  style: { width: 260 },
1901
1912
  onChange: (e) => {
1902
- ne(e.target.value);
1913
+ j(e.target.value);
1903
1914
  }
1904
1915
  }),
1905
- /* @__PURE__ */ O(S, {
1916
+ /* @__PURE__ */ D(S, {
1906
1917
  allowClear: !0,
1907
- disabled: I,
1918
+ disabled: z,
1908
1919
  placeholder: "数据状态",
1909
- value: R === "all" ? void 0 : R,
1910
- options: pe,
1920
+ value: B === "all" ? void 0 : B,
1921
+ options: fe,
1911
1922
  style: { width: 140 },
1912
1923
  onChange: (e) => {
1913
- v(e ?? "all");
1924
+ T(e ?? "all");
1914
1925
  }
1915
1926
  }),
1916
- /* @__PURE__ */ O(S, {
1927
+ /* @__PURE__ */ D(S, {
1917
1928
  allowClear: !0,
1918
- disabled: I,
1929
+ disabled: z,
1919
1930
  placeholder: "导入状态",
1920
- value: z === "all" ? void 0 : z,
1921
- options: me,
1931
+ value: V === "all" ? void 0 : V,
1932
+ options: pe,
1922
1933
  style: { width: 140 },
1923
1934
  onChange: (e) => {
1924
- te(e ?? "all");
1935
+ k(e ?? "all");
1925
1936
  }
1926
1937
  })
1927
1938
  ]
1928
- }), H ? /* @__PURE__ */ k(T.Text, {
1939
+ }), ge ? /* @__PURE__ */ O(E.Text, {
1929
1940
  type: "secondary",
1930
1941
  children: [
1931
1942
  "筛选出 ",
1932
- _e.length,
1943
+ ye.length,
1933
1944
  " 条"
1934
1945
  ]
1935
1946
  }) : null]
1936
1947
  }),
1937
- /* @__PURE__ */ O(ee, {
1948
+ /* @__PURE__ */ D(ee, {
1938
1949
  rowKey: "key",
1939
1950
  size: "middle",
1940
1951
  tableLayout: "fixed",
1941
1952
  virtual: !0,
1942
- columns: Ce,
1943
- dataSource: _e,
1953
+ columns: Te,
1954
+ dataSource: ye,
1944
1955
  pagination: !1,
1945
1956
  scroll: {
1946
- x: we,
1957
+ x: Ee,
1947
1958
  y: 520
1948
1959
  },
1949
- locale: { emptyText: H ? "没有符合条件的行" : void 0 }
1960
+ locale: { emptyText: ge ? "没有符合条件的行" : void 0 }
1950
1961
  })
1951
1962
  ]
1952
1963
  }) });
1953
- }, en = "缺少列: ", tn = [
1964
+ }, an = "缺少列: ", on = [
1954
1965
  /期望为一个包含物件的列表/,
1955
1966
  /expected a list/i,
1956
1967
  /得到的类型是/,
1957
1968
  /not a list/i
1958
1969
  ];
1959
- function nn(e) {
1960
- return tn.some((t) => t.test(e)) ? "数据格式不正确, 请检查导入内容" : e;
1970
+ function sn(e) {
1971
+ return on.some((t) => t.test(e)) ? "数据格式不正确, 请检查导入内容" : e;
1961
1972
  }
1962
- function rn(e) {
1973
+ function cn(e) {
1963
1974
  if (Object.keys(e).length === 0) return { success: !0 };
1964
1975
  let t = [], n;
1965
1976
  return Object.entries(e).forEach(([e, r]) => {
1966
1977
  let i = Array.isArray(r) ? r : [r];
1967
- e === "detail" || e === "non_field_errors" ? n = i.map((e) => nn(String(e))).join("; ") : i.forEach((n) => t.push({ [e]: nn(String(n)) }));
1978
+ e === "detail" || e === "non_field_errors" ? n = i.map((e) => sn(String(e))).join("; ") : i.forEach((n) => t.push({ [e]: sn(String(n)) }));
1968
1979
  }), {
1969
1980
  success: !1,
1970
1981
  ...n ? { message: n } : {},
1971
1982
  ...t.length > 0 ? { fieldErrors: t } : {}
1972
1983
  };
1973
1984
  }
1974
- function an(e) {
1975
- if (!Ue(e)) return "导入失败, 任务已暂停";
1976
- let t = We(e);
1977
- return t === void 0 ? "网络异常, 任务已暂停" : t === 401 ? "登录已过期, 任务已暂停" : t === 403 ? "没有导入权限, 任务已暂停" : t === 404 ? "导入接口不存在, 任务已暂停" : t === 400 ? "请求参数错误, 任务已暂停" : t >= 500 ? "服务器错误, 任务已暂停" : "导入失败, 任务已暂停";
1985
+ var ln = {
1986
+ network: "网络异常, 任务已暂停",
1987
+ unauthorized: "登录已过期, 任务已暂停",
1988
+ forbidden: "没有导入权限, 任务已暂停",
1989
+ notFound: "导入接口不存在, 任务已暂停",
1990
+ badRequest: "请求参数错误, 任务已暂停",
1991
+ server: "服务器错误, 任务已暂停",
1992
+ unknown: "导入失败, 任务已暂停"
1993
+ };
1994
+ function un(e) {
1995
+ let t = Ke(e);
1996
+ return t === void 0 ? "导入失败, 任务已暂停" : ln[t];
1978
1997
  }
1979
- function on(e) {
1998
+ function dn(e) {
1980
1999
  let t = Ge(e);
1981
2000
  if (t && typeof t == "object") {
1982
2001
  let e = t;
@@ -1989,81 +2008,81 @@ function on(e) {
1989
2008
  }
1990
2009
  return "导入数据校验失败";
1991
2010
  }
1992
- var sn = ({ title: e, fieldSchemas: t, importRows: n, onImported: r }) => {
1993
- let [i, l] = c(!1), [u, d] = c([]), [g, _] = c(), [v, y] = c("empty"), [b, x] = c(!1), [S, ee] = c(!1), [w, T] = c([]), { modal: ne } = m.useApp(), re = s(null), A = s(void 0), j = o(() => ce(t), [t]);
2011
+ var fn = ({ title: e, fieldSchemas: t, importRows: n, onImported: r }) => {
2012
+ let [i, l] = c(!1), [u, d] = c([]), [g, _] = c(), [v, y] = c("empty"), [b, x] = c(!1), [S, ee] = c(!1), [w, E] = c([]), { modal: te, message: k } = m.useApp(), A = s(null), j = s(void 0), M = o(() => oe(t), [t]);
1994
2013
  a(() => {
1995
- A.current = g;
2014
+ j.current = g;
1996
2015
  }, [g]), a(() => () => {
1997
- A.current && Ct(A.current);
2016
+ j.current && Tt(j.current);
1998
2017
  }, []);
1999
- let M = () => re.current?.click(), ie = (e, t) => {
2000
- ne.warning({
2018
+ let N = () => A.current?.click(), P = (e, t) => {
2019
+ te.warning({
2001
2020
  title: t ?? (e.missingTitles.length > 0 ? "文件表头不完整" : "文件检查未通过"),
2002
2021
  width: 480,
2003
- content: /* @__PURE__ */ O(Vt, { ...e }),
2022
+ content: /* @__PURE__ */ D(Gt, { ...e }),
2004
2023
  okCancel: !0,
2005
2024
  okText: "重新选择文件",
2006
2025
  cancelText: "关闭",
2007
2026
  closable: !0,
2008
- onOk: M
2027
+ onOk: N
2009
2028
  });
2010
- }, ae = async (e) => {
2011
- if (e.size > 20971520) E.error("文件大小超过 20MB, 请拆分后再导入");
2029
+ }, re = async (e) => {
2030
+ if (e.size > 20971520) k.error("文件大小超过 20MB, 请拆分后再导入");
2012
2031
  else {
2013
- _(void 0), T([]), x(!0);
2032
+ _(void 0), E([]), x(!0);
2014
2033
  try {
2015
- let { headerMessages: t, formulaMessages: n, rows: r, includedKeys: i } = await He(e, j);
2034
+ let { headerMessages: t, formulaMessages: n, rows: r, includedKeys: i } = await He(e, M);
2016
2035
  if (n.length > 0) {
2017
- ie({
2036
+ P({
2018
2037
  missingTitles: [],
2019
2038
  headerMessages: n
2020
2039
  }, "文件里的公式还没有计算结果");
2021
2040
  return;
2022
2041
  }
2023
2042
  if (t.length > 0) {
2024
- ie({
2025
- missingTitles: t.filter((e) => e.startsWith(en)).map((e) => e.slice(5)),
2026
- headerMessages: t.filter((e) => !e.startsWith(en))
2043
+ P({
2044
+ missingTitles: t.filter((e) => e.startsWith(an)).map((e) => e.slice(5)),
2045
+ headerMessages: t.filter((e) => !e.startsWith(an))
2027
2046
  });
2028
2047
  return;
2029
2048
  }
2030
2049
  if (r.length === 0) {
2031
- E.error("文件里没有数据行");
2050
+ k.error("文件里没有数据行");
2032
2051
  return;
2033
2052
  }
2034
- T(i), y(`${e.name}-${Date.now()}`), d(r), l(!0);
2053
+ E(i), y(`${e.name}-${Date.now()}`), d(r), l(!0);
2035
2054
  } catch (e) {
2036
- console.error(`导入文件解析失败: ${e}`), E.error("导入文件解析失败, 请确认上传的是 Excel 文件");
2055
+ console.error(`导入文件解析失败: ${e}`), k.error("导入文件解析失败, 请确认上传的是 Excel 文件");
2037
2056
  } finally {
2038
2057
  x(!1);
2039
2058
  }
2040
2059
  }
2041
2060
  };
2042
- return /* @__PURE__ */ k(D, { children: [
2043
- /* @__PURE__ */ k(C.Compact, {
2061
+ return /* @__PURE__ */ O(ne, { children: [
2062
+ /* @__PURE__ */ O(C.Compact, {
2044
2063
  block: !0,
2045
- children: [/* @__PURE__ */ O(te, {
2064
+ children: [/* @__PURE__ */ D(T, {
2046
2065
  title: "Excel 导入",
2047
- children: /* @__PURE__ */ O(h, {
2066
+ children: /* @__PURE__ */ D(h, {
2048
2067
  type: "default",
2049
- icon: /* @__PURE__ */ O(p, {}),
2068
+ icon: /* @__PURE__ */ D(p, {}),
2050
2069
  loading: b,
2051
2070
  disabled: b,
2052
- onClick: M,
2071
+ onClick: N,
2053
2072
  children: "导入"
2054
2073
  })
2055
- }), /* @__PURE__ */ O(te, {
2074
+ }), /* @__PURE__ */ D(T, {
2056
2075
  title: "Excel 导入模板",
2057
- children: /* @__PURE__ */ O(h, {
2076
+ children: /* @__PURE__ */ D(h, {
2058
2077
  type: "default",
2059
- icon: /* @__PURE__ */ O(f, {}),
2078
+ icon: /* @__PURE__ */ D(f, {}),
2060
2079
  loading: S,
2061
2080
  onClick: async () => {
2062
2081
  ee(!0);
2063
2082
  try {
2064
- await Ve(j, `${e}导入模板`);
2083
+ await Ve(M, `${e}导入模板`);
2065
2084
  } catch (e) {
2066
- console.error(`模板下载失败: ${e}`), E.error("模板下载失败");
2085
+ console.error(`模板下载失败: ${e}`), k.error("模板下载失败");
2067
2086
  } finally {
2068
2087
  ee(!1);
2069
2088
  }
@@ -2072,26 +2091,26 @@ var sn = ({ title: e, fieldSchemas: t, importRows: n, onImported: r }) => {
2072
2091
  })
2073
2092
  })]
2074
2093
  }),
2075
- /* @__PURE__ */ O("input", {
2076
- ref: re,
2094
+ /* @__PURE__ */ D("input", {
2095
+ ref: A,
2077
2096
  type: "file",
2078
2097
  accept: ".xlsx",
2079
2098
  style: { display: "none" },
2080
2099
  onChange: (e) => {
2081
2100
  let t = e.target.files?.[0];
2082
- e.target.value = "", t && ae(t);
2101
+ e.target.value = "", t && re(t);
2083
2102
  }
2084
2103
  }),
2085
- /* @__PURE__ */ O($t, {
2104
+ /* @__PURE__ */ D(rn, {
2086
2105
  open: i,
2087
2106
  title: e,
2088
- fieldSchemas: j,
2107
+ fieldSchemas: M,
2089
2108
  rows: u,
2090
2109
  taskId: g,
2091
2110
  includedKeys: w,
2092
2111
  onChangeCell: (e, t, n) => {
2093
2112
  if (!w.includes(t.key)) return;
2094
- let r = be(t, n), i = H(r.trim() === "" ? null : r, t);
2113
+ let r = ye(t, n), i = V(r.trim() === "" ? null : r, t);
2095
2114
  d((r) => r.map((r) => {
2096
2115
  if (r.key !== e.key) return r;
2097
2116
  let a = { ...r.errors };
@@ -2111,9 +2130,9 @@ var sn = ({ title: e, fieldSchemas: t, importRows: n, onImported: r }) => {
2111
2130
  ...e.values,
2112
2131
  [t.key]: n
2113
2132
  }, i = {};
2114
- j.forEach((e) => {
2133
+ M.forEach((e) => {
2115
2134
  if (!w.includes(e.key)) return;
2116
- let t = be(e, r[e.key]), n = H(t.trim() === "" ? null : t, e);
2135
+ let t = ye(e, r[e.key]), n = V(t.trim() === "" ? null : t, e);
2117
2136
  n.validateSuccess || (i[e.key] = n.validateMessage);
2118
2137
  });
2119
2138
  let a = {
@@ -2121,7 +2140,7 @@ var sn = ({ title: e, fieldSchemas: t, importRows: n, onImported: r }) => {
2121
2140
  values: r,
2122
2141
  errors: i
2123
2142
  };
2124
- d((t) => t.map((t) => t.key === e.key ? a : t)), g && e.taskIndex !== void 0 && (xt(g, e.taskIndex, t.key), yt(g, e.taskIndex, i), vt(g, e.taskIndex, a));
2143
+ d((t) => t.map((t) => t.key === e.key ? a : t)), g && e.taskIndex !== void 0 && (Ct(g, e.taskIndex, t.key), xt(g, e.taskIndex, i), bt(g, e.taskIndex, a));
2125
2144
  },
2126
2145
  onDelete: (e) => {
2127
2146
  d((t) => t.filter((t) => t.key !== e.key));
@@ -2129,11 +2148,11 @@ var sn = ({ title: e, fieldSchemas: t, importRows: n, onImported: r }) => {
2129
2148
  onConfirm: () => {
2130
2149
  let t = u;
2131
2150
  if (t.length === 0) {
2132
- E.error("没有可导入的数据");
2151
+ k.error("没有可导入的数据");
2133
2152
  return;
2134
2153
  }
2135
2154
  if (t.every((e) => Object.keys(e.errors).length > 0)) {
2136
- E.error("所有行都有校验错误, 请先修正后再导入");
2155
+ k.error("所有行都有校验错误, 请先修正后再导入");
2137
2156
  return;
2138
2157
  }
2139
2158
  let i = t.map((e, t) => ({
@@ -2141,18 +2160,18 @@ var sn = ({ title: e, fieldSchemas: t, importRows: n, onImported: r }) => {
2141
2160
  taskIndex: t
2142
2161
  }));
2143
2162
  d(i);
2144
- let a = ht({
2163
+ let a = _t({
2145
2164
  title: `${e}导入`,
2146
2165
  rows: i,
2147
- fieldSchemas: j,
2166
+ fieldSchemas: M,
2148
2167
  includedKeys: w,
2149
2168
  importRows: async (e, t) => {
2150
2169
  try {
2151
- let r = await n(e.map((e) => xe(e, j, w)), t);
2170
+ let r = await n(e.map((e) => be(e, M, w)), t);
2152
2171
  if (r.length !== e.length) throw new W("导入接口返回结果数量不正确, 任务已暂停");
2153
- return r.map(rn);
2172
+ return r.map(cn);
2154
2173
  } catch (e) {
2155
- throw t.aborted || e instanceof W ? e : We(e) === 422 ? Error(on(e)) : new W(an(e));
2174
+ throw t.aborted || e instanceof W ? e : We(e) === 422 ? Error(dn(e)) : new W(un(e));
2156
2175
  }
2157
2176
  },
2158
2177
  onFinished: r
@@ -2160,9 +2179,9 @@ var sn = ({ title: e, fieldSchemas: t, importRows: n, onImported: r }) => {
2160
2179
  _(a);
2161
2180
  },
2162
2181
  onClose: () => {
2163
- g && Ct(g), l(!1), _(void 0), d([]), T([]);
2182
+ g && Tt(g), l(!1), _(void 0), d([]), E([]);
2164
2183
  }
2165
2184
  }, v)
2166
2185
  ] });
2167
2186
  };
2168
- export { Pt as BatchExportButton, zt as ExcelExportButton, sn as ExcelImportButton, Rt as ExportTaskModal, W as ImportPauseError, he as MAX_EXPORT_ROWS, ge as MAX_IMPORT_FILE_SIZE, U as MAX_IMPORT_ROWS, le as MULTI_VALUE_SEPARATOR, Ne as autoAdjustColumnWidths, ze as buildExportBlob, xe as buildImportPayload, St as cancelTask, xt as clearImportRowFieldError, gt as continueTask, bt as deleteImportRows, Ct as dismissTask, Ve as downloadImportTemplate, Tt as downloadTask, mt as enqueueExport, ht as enqueueImport, Be as exportExcel, jt as formatTaskPercent, Mt as formatTaskRemainingSeconds, At as getTaskDisplayPercent, Dt as getTaskRemainingSeconds, Ot as getTaskSuccessCount, et as getTasksSnapshot, ce as importableFields, P as joinMultiValues, He as parseImportFile, _t as pauseTask, Et as resetTasks, yt as setImportRowValidation, F as splitMultiValues, $e as subscribeTasks, vt as updateImportRowData, Nt as useTaskDetail, me as validateBooleanField, I as validateDateField, R as validateDateTimeField, H as validateField, z as validateListField, V as validateMultipleChoiceField, pe as validateNumberField, B as validateSingleChoiceField, fe as validateTextField, L as validateTimeField };
2187
+ export { Ut as ExportButton, zt as ExportTaskModal, fn as ImportButton, W as ImportPauseError, H as MAX_EXPORT_ROWS, ge as MAX_IMPORT_FILE_SIZE, he as MAX_IMPORT_ROWS, F as MULTI_VALUE_SEPARATOR, Me as autoAdjustColumnWidths, ze as buildExportBlob, be as buildImportPayload, wt as cancelTask, Ct as clearImportRowFieldError, vt as continueTask, St as deleteImportRows, Tt as dismissTask, Ve as downloadImportTemplate, Dt as downloadTask, gt as enqueueExport, _t as enqueueImport, Be as exportExcel, Ht as exportRows, Vt as formatExportRowLimitMessage, Nt as formatTaskPercent, Pt as formatTaskRemainingSeconds, Mt as getTaskDisplayPercent, kt as getTaskRemainingSeconds, At as getTaskSuccessCount, tt as getTasksSnapshot, oe as importableFields, I as joinMultiValues, Bt as makeExportFileName, He as parseImportFile, yt as pauseTask, Ot as resetTasks, xt as setImportRowValidation, L as splitMultiValues, et as subscribeTasks, bt as updateImportRowData, Ft as useTaskDetail, ue as validateBooleanField, de as validateDateField, pe as validateDateTimeField, V as validateField, z as validateListField, B as validateMultipleChoiceField, le as validateNumberField, me as validateSingleChoiceField, R as validateTextField, fe as validateTimeField };