sy-form-components 0.2.8 → 0.2.10

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
@@ -6745,6 +6745,38 @@ var normalizeField = (key, field, system = false) => ({
6745
6745
  width: field?.width,
6746
6746
  system
6747
6747
  });
6748
+ var SYSTEM_VALUE_ALIASES = {
6749
+ formInstanceId: ["formInstanceId", "formInstId", "form_instance_id", "processInstanceId"],
6750
+ instanceTitle: ["instanceTitle", "instance_title", "processInstanceTitle", "title"],
6751
+ createdBy: ["createdBy", "created_by", "originator"],
6752
+ createdByName: ["createdByName", "created_by_name", "originatorName", "creatorName"],
6753
+ createdByDepartmentId: ["createdByDepartmentId", "created_by_department_id", "originatorCorp"],
6754
+ createdByDepartmentName: [
6755
+ "createdByDepartmentName",
6756
+ "created_by_department_name",
6757
+ "originatorDepartmentName",
6758
+ "originatorCorpName"
6759
+ ],
6760
+ createdAt: ["createdAt", "created_at", "createTime", "gmtCreate"],
6761
+ updatedAt: ["updatedAt", "updated_at", "modifiedTime", "modifyTime", "gmtModified"]
6762
+ };
6763
+ var pickAliasValue = (record, aliases) => {
6764
+ for (const alias of aliases) {
6765
+ const value = record?.[alias];
6766
+ if (value !== void 0 && value !== null && value !== "") return value;
6767
+ }
6768
+ return void 0;
6769
+ };
6770
+ var normalizeDataManagementRecord = (record) => {
6771
+ if (!record || typeof record !== "object" || Array.isArray(record)) return record;
6772
+ const normalized = { ...record };
6773
+ Object.entries(SYSTEM_VALUE_ALIASES).forEach(([targetKey, aliases]) => {
6774
+ if (normalized[targetKey] !== void 0 && normalized[targetKey] !== null) return;
6775
+ const aliasValue = pickAliasValue(record, aliases);
6776
+ if (aliasValue !== void 0) normalized[targetKey] = aliasValue;
6777
+ });
6778
+ return normalized;
6779
+ };
6748
6780
  var PROCESS_INSTANCE_STATUS_OPTIONS = [
6749
6781
  { label: "\u5F85\u5904\u7406", value: "pending" },
6750
6782
  { label: "\u5BA1\u6279\u4E2D", value: "running" },
@@ -6799,15 +6831,29 @@ var PROCESS_SYSTEM_FIELDS = [
6799
6831
  )
6800
6832
  ];
6801
6833
  var BASE_SYSTEM_FIELDS = [
6802
- normalizeField("createTime", { label: "\u521B\u5EFA\u65F6\u95F4", componentName: "DateField", width: 170 }, true),
6803
6834
  normalizeField(
6804
- "modifiedTime",
6805
- { label: "\u66F4\u65B0\u65F6\u95F4", componentName: "DateField", width: 170 },
6835
+ "instanceTitle",
6836
+ { label: "\u5B9E\u4F8B\u6807\u9898", componentName: "TextField", width: 220, displayable: true },
6806
6837
  true
6807
6838
  ),
6808
6839
  normalizeField(
6809
- "originatorName",
6810
- { label: "\u521B\u5EFA\u4EBA", componentName: "TextField", width: 130 },
6840
+ "createdByName",
6841
+ { label: "\u521B\u5EFA\u4EBA", componentName: "TextField", width: 130, displayable: true },
6842
+ true
6843
+ ),
6844
+ normalizeField(
6845
+ "createdByDepartmentName",
6846
+ { label: "\u521B\u5EFA\u4EBA\u90E8\u95E8", componentName: "TextField", width: 150, displayable: true },
6847
+ true
6848
+ ),
6849
+ normalizeField(
6850
+ "createdAt",
6851
+ { label: "\u521B\u5EFA\u65F6\u95F4", componentName: "DateField", width: 170, displayable: true },
6852
+ true
6853
+ ),
6854
+ normalizeField(
6855
+ "updatedAt",
6856
+ { label: "\u66F4\u65B0\u65F6\u95F4", componentName: "DateField", width: 170, displayable: true },
6811
6857
  true
6812
6858
  )
6813
6859
  ];
@@ -6828,7 +6874,7 @@ var normalizeDataManagementList = (payload) => {
6828
6874
  const records = body?.data || body?.records || body?.list || body?.items || [];
6829
6875
  const total = body?.totalCount ?? body?.total ?? body?.count ?? records.length;
6830
6876
  return {
6831
- records: Array.isArray(records) ? records : [],
6877
+ records: Array.isArray(records) ? records.map(normalizeDataManagementRecord) : [],
6832
6878
  total: Number(total) || 0
6833
6879
  };
6834
6880
  };
@@ -6848,7 +6894,9 @@ var buildFilterPayload = (group) => {
6848
6894
  var normalizeColumnConfig = (cfg, fields) => {
6849
6895
  const allowed = new Set(fields.map((field) => field.fieldId));
6850
6896
  const configured = Array.isArray(cfg?.showFields) ? cfg.showFields.filter((fieldId) => allowed.has(fieldId)) : [];
6851
- const defaultShow = fields.filter((field) => !field.system || field.displayable).slice(0, 8).map((field) => field.fieldId);
6897
+ const defaultBusinessFields = fields.filter((field) => !field.system).slice(0, 8).map((field) => field.fieldId);
6898
+ const defaultSystemFields = fields.filter((field) => field.system && field.displayable).map((field) => field.fieldId);
6899
+ const defaultShow = [...defaultBusinessFields, ...defaultSystemFields];
6852
6900
  return {
6853
6901
  showFields: configured.length > 0 ? configured : defaultShow,
6854
6902
  widths: cfg?.widths || {},
@@ -6951,6 +6999,16 @@ async function exportDataManagementRows(request, params) {
6951
6999
  }
6952
7000
  });
6953
7001
  }
7002
+ async function downloadDataManagementImportTemplate(request, params) {
7003
+ return request({
7004
+ url: `/${params.appType}/v1/form/advancedExportTemplate.xlsx`,
7005
+ method: "get",
7006
+ responseType: "blob",
7007
+ params: {
7008
+ formUuid: params.formUuid
7009
+ }
7010
+ });
7011
+ }
6954
7012
  async function importPreviewDataManagementRows(request, params) {
6955
7013
  const response = await request({
6956
7014
  url: `/${params.appType}/v1/form/importPreview.xlsx`,
@@ -7510,8 +7568,14 @@ import { useState as useState24, useEffect as useEffect29, useCallback as useCal
7510
7568
  var FORM_INSTANCE_METADATA_KEYS = /* @__PURE__ */ new Set([
7511
7569
  "appType",
7512
7570
  "code",
7571
+ "createTime",
7572
+ "created_at",
7513
7573
  "createdAt",
7514
7574
  "createdBy",
7575
+ "created_by",
7576
+ "created_by_department_id",
7577
+ "created_by_department_name",
7578
+ "created_by_name",
7515
7579
  "createdByDepartmentId",
7516
7580
  "createdByDepartmentName",
7517
7581
  "createdByName",
@@ -7523,9 +7587,18 @@ var FORM_INSTANCE_METADATA_KEYS = /* @__PURE__ */ new Set([
7523
7587
  "formUuid",
7524
7588
  "instanceTitle",
7525
7589
  "message",
7590
+ "modifiedTime",
7591
+ "modifyTime",
7592
+ "originator",
7593
+ "originatorCorp",
7594
+ "originatorCorpName",
7595
+ "originatorDepartmentName",
7596
+ "originatorName",
7597
+ "processInstanceTitle",
7526
7598
  "result",
7527
7599
  "success",
7528
7600
  "title",
7601
+ "updated_at",
7529
7602
  "updatedAt"
7530
7603
  ]);
7531
7604
  var isPlainRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
@@ -7572,6 +7645,76 @@ var extractFormValues = (formInstance, fieldIds) => {
7572
7645
  const flatValues = pickKnownFields(formInstance, fieldIds);
7573
7646
  return Object.keys(flatValues).length > 0 ? flatValues : null;
7574
7647
  };
7648
+ var firstValue = (source, keys) => {
7649
+ for (const key of keys) {
7650
+ const value = source[key];
7651
+ if (value !== void 0 && value !== null && value !== "") return value;
7652
+ }
7653
+ return void 0;
7654
+ };
7655
+ var normalizeFormInstanceInfo = (formInstance, fallback) => {
7656
+ if (!isPlainRecord(formInstance)) return null;
7657
+ const creator = isPlainRecord(formInstance.creator) ? formInstance.creator : {};
7658
+ const formInstanceId = firstValue(formInstance, [
7659
+ "formInstanceId",
7660
+ "formInstId",
7661
+ "form_instance_id",
7662
+ "id"
7663
+ ]);
7664
+ const createdByName = firstValue(formInstance, [
7665
+ "createdByName",
7666
+ "created_by_name",
7667
+ "originatorName",
7668
+ "creatorName"
7669
+ ]);
7670
+ const createdByDepartmentName = firstValue(formInstance, [
7671
+ "createdByDepartmentName",
7672
+ "created_by_department_name",
7673
+ "originatorDepartmentName",
7674
+ "originatorCorpName"
7675
+ ]);
7676
+ return {
7677
+ ...formInstance,
7678
+ formInstanceId: formInstanceId || fallback?.formInstanceId || "",
7679
+ formUuid: formInstance.formUuid || fallback?.formUuid || "",
7680
+ appType: formInstance.appType || fallback?.appType || "",
7681
+ data: isPlainRecord(formInstance.data) ? formInstance.data : {},
7682
+ title: firstValue(formInstance, [
7683
+ "title",
7684
+ "instanceTitle",
7685
+ "instance_title",
7686
+ "processInstanceTitle"
7687
+ ]) || void 0,
7688
+ instanceTitle: firstValue(formInstance, [
7689
+ "instanceTitle",
7690
+ "instance_title",
7691
+ "processInstanceTitle",
7692
+ "title"
7693
+ ]) || void 0,
7694
+ creator: {
7695
+ userId: creator.userId || creator.id || formInstance.createdBy || formInstance.originator || "",
7696
+ name: creator.name || createdByName || "",
7697
+ avatar: creator.avatar,
7698
+ department: creator.department || createdByDepartmentName || ""
7699
+ },
7700
+ createdBy: firstValue(formInstance, ["createdBy", "created_by", "originator"]),
7701
+ createdByName,
7702
+ createdByDepartmentId: firstValue(formInstance, [
7703
+ "createdByDepartmentId",
7704
+ "created_by_department_id",
7705
+ "originatorCorp"
7706
+ ]),
7707
+ createdByDepartmentName,
7708
+ createdAt: firstValue(formInstance, ["createdAt", "created_at", "createTime", "gmtCreate"]) || "",
7709
+ updatedAt: firstValue(formInstance, [
7710
+ "updatedAt",
7711
+ "updated_at",
7712
+ "modifiedTime",
7713
+ "modifyTime",
7714
+ "gmtModified"
7715
+ ])
7716
+ };
7717
+ };
7575
7718
 
7576
7719
  // src/hooks/useFormDetail.ts
7577
7720
  function useFormDetail(options) {
@@ -7602,8 +7745,13 @@ function useFormDetail(options) {
7602
7745
  if (!permResult || !hasViewOperation(permResult.operations, "view")) {
7603
7746
  onPermissionDenied?.();
7604
7747
  }
7748
+ const normalizedInfo = normalizeFormInstanceInfo(formResult, {
7749
+ formUuid,
7750
+ appType,
7751
+ formInstanceId
7752
+ });
7605
7753
  setPermissions(permResult);
7606
- setInstanceInfo(formResult);
7754
+ setInstanceInfo(normalizedInfo);
7607
7755
  setFormData(extractFormValues(formResult, fieldIds));
7608
7756
  } catch (error) {
7609
7757
  console.error("[useFormDetail] Failed to load data:", error);
@@ -9609,8 +9757,8 @@ var SummaryPanel = ({
9609
9757
  )
9610
9758
  ] }),
9611
9759
  /* @__PURE__ */ jsx86("h1", { className: "m-0 break-words text-2xl font-semibold leading-9 text-ant-text md:text-[28px]", children: title }),
9612
- items.length > 0 && /* @__PURE__ */ jsx86("div", { className: "mt-5 grid grid-cols-1 gap-4 md:grid-cols-3", children: items.map((item) => /* @__PURE__ */ jsxs38("div", { className: "flex min-w-0 items-center gap-3", children: [
9613
- /* @__PURE__ */ jsx86("span", { className: "inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-gray-100 text-ant-text-secondary", children: item.icon }),
9760
+ items.length > 0 && /* @__PURE__ */ jsx86("div", { className: "mt-5 grid grid-cols-1 gap-4 md:grid-cols-4", children: items.map((item) => /* @__PURE__ */ jsxs38("div", { className: "flex min-w-0 items-center gap-3", children: [
9761
+ item.icon && /* @__PURE__ */ jsx86("span", { className: "inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-gray-100 text-ant-text-secondary", children: item.icon }),
9614
9762
  /* @__PURE__ */ jsxs38("span", { className: "min-w-0", children: [
9615
9763
  /* @__PURE__ */ jsx86("span", { className: "block text-xs leading-5 text-ant-text-tertiary", children: item.label }),
9616
9764
  /* @__PURE__ */ jsx86("span", { className: "block break-words text-sm font-medium leading-6 text-ant-text", children: item.value || "-" })
@@ -9728,6 +9876,7 @@ import {
9728
9876
  Button as Button15,
9729
9877
  Checkbox as Checkbox5,
9730
9878
  ConfigProvider,
9879
+ Divider,
9731
9880
  Drawer as Drawer2,
9732
9881
  Dropdown as Dropdown3,
9733
9882
  Empty as Empty5,
@@ -9742,6 +9891,7 @@ import {
9742
9891
  Upload as Upload3,
9743
9892
  message
9744
9893
  } from "antd";
9894
+ import dayjs5 from "dayjs";
9745
9895
  import {
9746
9896
  DeleteOutlined,
9747
9897
  DownloadOutlined,
@@ -9787,6 +9937,11 @@ var formatPrimitive = (value) => {
9787
9937
  return /* @__PURE__ */ jsx89("span", { className: "text-ant-color-text-quaternary", children: "--" });
9788
9938
  return String(value);
9789
9939
  };
9940
+ var formatDateTime = (value) => {
9941
+ if (value === void 0 || value === null || value === "") return formatPrimitive("");
9942
+ const parsed = dayjs5(value);
9943
+ return parsed.isValid() ? parsed.format("YYYY-MM-DD HH:mm:ss") : String(value);
9944
+ };
9790
9945
  var pickOptionLabel = (field, value) => {
9791
9946
  const options = field.options || field.optionList || field.option_list || field.componentProps?.options || [];
9792
9947
  const scalar = typeof value === "object" ? value?.value ?? value?.id ?? value?.label ?? value?.name : value;
@@ -9814,6 +9969,9 @@ var renderStatusTag = (value, fieldId) => {
9814
9969
  var renderCellValue = (value, field) => {
9815
9970
  const status = renderStatusTag(value, field.fieldId);
9816
9971
  if (status) return status;
9972
+ if (field.componentName === "DateField" || field.componentName === "DateTimeField") {
9973
+ return formatDateTime(value);
9974
+ }
9817
9975
  if (Array.isArray(value)) {
9818
9976
  if (value.length === 0) return formatPrimitive("");
9819
9977
  if (field.componentName === "ImageField") {
@@ -9870,6 +10028,74 @@ var fileToBase64 = (file) => new Promise((resolve, reject) => {
9870
10028
  reader.onerror = reject;
9871
10029
  reader.readAsDataURL(file);
9872
10030
  });
10031
+ var normalizeBasePath2 = (basePath) => {
10032
+ const normalized = String(basePath || "").replace(/^\/+|\/+$/g, "");
10033
+ return normalized ? `/${normalized}` : "";
10034
+ };
10035
+ var inferBasePath2 = (appType) => {
10036
+ if (typeof window === "undefined") return "";
10037
+ const pathname = window.location?.pathname || "";
10038
+ const marker = `/${appType}/`;
10039
+ const markerIndex = pathname.indexOf(marker);
10040
+ if (markerIndex <= 0) return "";
10041
+ return pathname.slice(0, markerIndex);
10042
+ };
10043
+ var buildDefaultDetailUrl = ({
10044
+ appType,
10045
+ formUuid,
10046
+ formType,
10047
+ formInstanceId,
10048
+ basePath
10049
+ }) => {
10050
+ const prefix = normalizeBasePath2(basePath ?? inferBasePath2(appType));
10051
+ const detailType = formType === "process" ? "processDetail" : "formDetail";
10052
+ return `${prefix}/${appType}/${detailType}/${formUuid}?formInstId=${encodeURIComponent(formInstanceId)}`;
10053
+ };
10054
+ var getHeaderValue = (headers, key) => {
10055
+ if (!headers) return "";
10056
+ if (typeof headers.get === "function")
10057
+ return headers.get(key) || headers.get(key.toLowerCase()) || "";
10058
+ return headers[key] || headers[key.toLowerCase()] || "";
10059
+ };
10060
+ var resolveDownloadFilename = (headers, fallbackName) => {
10061
+ const disposition = getHeaderValue(headers, "content-disposition");
10062
+ if (typeof disposition !== "string") return fallbackName;
10063
+ const matchStar = disposition.match(/filename\*=UTF-8''([^;]+)/i);
10064
+ if (matchStar?.[1]) return decodeURIComponent(matchStar[1]);
10065
+ const match = disposition.match(/filename="?([^";]+)"?/i);
10066
+ if (match?.[1]) return decodeURIComponent(match[1]);
10067
+ return fallbackName;
10068
+ };
10069
+ var downloadBlobResponse = async (response, fallbackName) => {
10070
+ if (typeof window === "undefined" || typeof document === "undefined") return;
10071
+ const headers = response?.headers;
10072
+ const payload = response?.data ?? response;
10073
+ const contentType = getHeaderValue(headers, "content-type") || payload?.type || "";
10074
+ const hasBlob = typeof Blob !== "undefined";
10075
+ if (hasBlob && payload instanceof Blob && String(contentType).includes("application/json")) {
10076
+ const text = await payload.text();
10077
+ try {
10078
+ const json = JSON.parse(text);
10079
+ throw new Error(json?.message || "\u4E0B\u8F7D\u5931\u8D25");
10080
+ } catch (error) {
10081
+ if (error instanceof SyntaxError) throw new Error("\u4E0B\u8F7D\u5931\u8D25");
10082
+ if (error instanceof Error) throw error;
10083
+ throw new Error("\u4E0B\u8F7D\u5931\u8D25");
10084
+ }
10085
+ }
10086
+ const blob = hasBlob && payload instanceof Blob ? payload : hasBlob && payload instanceof ArrayBuffer ? new Blob([payload], { type: contentType || "application/octet-stream" }) : new Blob([typeof payload === "string" ? payload : JSON.stringify(payload ?? "")], {
10087
+ type: contentType || "application/octet-stream"
10088
+ });
10089
+ const filename = resolveDownloadFilename(headers, fallbackName);
10090
+ const url = window.URL.createObjectURL(blob);
10091
+ const anchor = document.createElement("a");
10092
+ anchor.href = url;
10093
+ anchor.download = filename;
10094
+ document.body.appendChild(anchor);
10095
+ anchor.click();
10096
+ anchor.remove();
10097
+ window.URL.revokeObjectURL(url);
10098
+ };
9873
10099
  function FilterGroupEditor({
9874
10100
  group,
9875
10101
  fields,
@@ -9992,15 +10218,69 @@ function FilterGroupEditor({
9992
10218
  }
9993
10219
  );
9994
10220
  }
10221
+ function ResizableColumnTitle({
10222
+ label,
10223
+ width,
10224
+ onResize,
10225
+ onResizeEnd
10226
+ }) {
10227
+ const dragRef = useRef14({ startX: 0, startWidth: width, latestWidth: width });
10228
+ const handleMouseDown = (event) => {
10229
+ event.preventDefault();
10230
+ event.stopPropagation();
10231
+ dragRef.current = {
10232
+ startX: event.clientX,
10233
+ startWidth: width,
10234
+ latestWidth: width
10235
+ };
10236
+ const handleMouseMove = (moveEvent) => {
10237
+ const nextWidth = Math.min(
10238
+ 520,
10239
+ Math.max(96, dragRef.current.startWidth + moveEvent.clientX - dragRef.current.startX)
10240
+ );
10241
+ dragRef.current.latestWidth = nextWidth;
10242
+ onResize(nextWidth);
10243
+ };
10244
+ const handleMouseUp = () => {
10245
+ document.removeEventListener("mousemove", handleMouseMove);
10246
+ document.removeEventListener("mouseup", handleMouseUp);
10247
+ onResizeEnd(dragRef.current.latestWidth);
10248
+ };
10249
+ document.addEventListener("mousemove", handleMouseMove);
10250
+ document.addEventListener("mouseup", handleMouseUp);
10251
+ };
10252
+ return /* @__PURE__ */ jsxs41("span", { className: "relative flex min-w-0 items-center pr-3", children: [
10253
+ /* @__PURE__ */ jsx89("span", { className: "min-w-0 truncate", children: label }),
10254
+ /* @__PURE__ */ jsx89(
10255
+ "span",
10256
+ {
10257
+ "aria-hidden": true,
10258
+ className: "absolute -right-3 top-0 h-full w-4 cursor-col-resize after:absolute after:right-1 after:top-1/2 after:h-5 after:w-0.5 after:-translate-y-1/2 after:rounded after:bg-transparent hover:after:bg-ant-color-primary",
10259
+ onClickCapture: (event) => {
10260
+ event.preventDefault();
10261
+ event.stopPropagation();
10262
+ },
10263
+ onDoubleClickCapture: (event) => {
10264
+ event.preventDefault();
10265
+ event.stopPropagation();
10266
+ },
10267
+ onMouseDownCapture: handleMouseDown,
10268
+ title: "\u62D6\u62FD\u8C03\u6574\u5217\u5BBD"
10269
+ }
10270
+ )
10271
+ ] });
10272
+ }
9995
10273
  var DataManagementList = ({
9996
10274
  appType,
9997
10275
  formUuid,
10276
+ detailBasePath,
9998
10277
  menuFormUuid,
9999
10278
  readonly = false,
10000
10279
  fullHeight = true,
10001
10280
  configScope = "global",
10002
10281
  title,
10003
10282
  detailRenderer,
10283
+ detailPageUrlBuilder,
10004
10284
  submitRenderer,
10005
10285
  requestOverride,
10006
10286
  rowActions = []
@@ -10014,9 +10294,11 @@ var DataManagementList = ({
10014
10294
  }, [requestOverride]);
10015
10295
  const [fields, setFields] = useState35([]);
10016
10296
  const [config, setConfig] = useState35({});
10297
+ const [formType, setFormType] = useState35("form");
10017
10298
  const [showFields, setShowFields] = useState35([]);
10018
10299
  const [lockFieldIds, setLockFieldIds] = useState35([]);
10019
10300
  const [widths, setWidths] = useState35({});
10301
+ const widthsRef = useRef14({});
10020
10302
  const [sort, setSort] = useState35([]);
10021
10303
  const [density, setDensity] = useState35("middle");
10022
10304
  const [detailOpenMode, setDetailOpenMode] = useState35("drawer");
@@ -10038,6 +10320,7 @@ var DataManagementList = ({
10038
10320
  const [importOpen, setImportOpen] = useState35(false);
10039
10321
  const [importPreview, setImportPreview] = useState35([]);
10040
10322
  const [importBase64, setImportBase64] = useState35("");
10323
+ const [templateDownloading, setTemplateDownloading] = useState35(false);
10041
10324
  const [recordsOpen, setRecordsOpen] = useState35(false);
10042
10325
  const [recordTab, setRecordTab] = useState35("export");
10043
10326
  const [transferRecords, setTransferRecords] = useState35([]);
@@ -10053,7 +10336,7 @@ var DataManagementList = ({
10053
10336
  const fetchStateRef = useRef14({});
10054
10337
  const request = api.request;
10055
10338
  const getPopupContainer = useCallback17(
10056
- (triggerNode) => triggerNode?.parentElement || rootRef.current || document.body,
10339
+ (triggerNode) => rootRef.current || triggerNode?.ownerDocument?.body || (typeof document !== "undefined" ? document.body : triggerNode?.parentElement),
10057
10340
  []
10058
10341
  );
10059
10342
  const confirmDanger = useCallback17((title2, content, onOk) => {
@@ -10063,6 +10346,9 @@ var DataManagementList = ({
10063
10346
  () => showFields.map((fieldId) => fields.find((field) => field.fieldId === fieldId)).filter(Boolean),
10064
10347
  [fields, showFields]
10065
10348
  );
10349
+ useEffect36(() => {
10350
+ widthsRef.current = widths;
10351
+ }, [widths]);
10066
10352
  useEffect36(() => {
10067
10353
  fetchStateRef.current = {
10068
10354
  current,
@@ -10133,6 +10419,7 @@ var DataManagementList = ({
10133
10419
  const nextSearchKeyWord = saved?.filter?.searchKeyWord || "";
10134
10420
  const nextFilterGroup = hydrateFilterGroup(saved?.filter?.group);
10135
10421
  setFields(allFields);
10422
+ setFormType(schemaResult.formType || "form");
10136
10423
  setConfig(saved || {});
10137
10424
  setShowFields(resolved.showFields);
10138
10425
  setWidths(resolved.widths);
@@ -10185,22 +10472,65 @@ var DataManagementList = ({
10185
10472
  showFields,
10186
10473
  lockFieldIds,
10187
10474
  widths,
10475
+ sort,
10188
10476
  density,
10189
10477
  detailOpenMode,
10190
10478
  pageSize
10191
10479
  });
10480
+ await loadData({ current: 1, pageSize, sort });
10481
+ };
10482
+ const handleSortChange = (index, patch) => {
10483
+ setSort(
10484
+ (prev) => prev.map((item, itemIndex) => itemIndex === index ? { ...item, ...patch } : item)
10485
+ );
10486
+ };
10487
+ const handleAddSort = () => {
10488
+ const firstFieldId = showFields[0] || fields[0]?.fieldId;
10489
+ if (!firstFieldId) return;
10490
+ setSort((prev) => [...prev, { id: firstFieldId, isAsc: "y" }]);
10192
10491
  };
10492
+ const handleRemoveSort = (index) => {
10493
+ setSort((prev) => prev.filter((_, itemIndex) => itemIndex !== index));
10494
+ };
10495
+ const updateColumnWidth = useCallback17((fieldId, width) => {
10496
+ const nextWidth = Math.round(Math.max(96, Math.min(520, width)));
10497
+ widthsRef.current = { ...widthsRef.current, [fieldId]: nextWidth };
10498
+ setWidths(widthsRef.current);
10499
+ }, []);
10500
+ const commitColumnWidth = useCallback17(
10501
+ (fieldId, width) => {
10502
+ const nextWidth = Math.round(Math.max(96, Math.min(520, width)));
10503
+ const nextWidths = { ...widthsRef.current, [fieldId]: nextWidth };
10504
+ widthsRef.current = nextWidths;
10505
+ setWidths(nextWidths);
10506
+ void persistConfig({ widths: nextWidths });
10507
+ },
10508
+ [persistConfig]
10509
+ );
10193
10510
  const handleDetail = useCallback17(
10194
10511
  (record) => {
10195
10512
  const formInstanceId = getRecordId(record);
10196
- if (detailOpenMode === "newPage" && typeof window !== "undefined") {
10197
- window.open(`/${appType}/forms/${formUuid}/detail/${formInstanceId}`, "_blank");
10513
+ if (!formInstanceId) {
10514
+ message.warning("\u5F53\u524D\u8BB0\u5F55\u7F3A\u5C11\u5B9E\u4F8B ID\uFF0C\u65E0\u6CD5\u6253\u5F00\u8BE6\u60C5");
10198
10515
  return;
10199
10516
  }
10517
+ if (detailOpenMode === "newPage" && typeof window !== "undefined") {
10518
+ const detailUrl = detailPageUrlBuilder?.({ record, formInstanceId: String(formInstanceId) }) || buildDefaultDetailUrl({
10519
+ appType,
10520
+ formUuid,
10521
+ formType,
10522
+ formInstanceId: String(formInstanceId),
10523
+ basePath: detailBasePath
10524
+ });
10525
+ if (detailUrl) {
10526
+ window.open(detailUrl, "_blank");
10527
+ return;
10528
+ }
10529
+ }
10200
10530
  setActiveRecord(record);
10201
10531
  setDetailOpen(true);
10202
10532
  },
10203
- [appType, detailOpenMode, formUuid]
10533
+ [appType, detailBasePath, detailOpenMode, detailPageUrlBuilder, formType, formUuid]
10204
10534
  );
10205
10535
  const handleDelete = useCallback17(
10206
10536
  async (ids) => {
@@ -10282,6 +10612,19 @@ var DataManagementList = ({
10282
10612
  setExporting(false);
10283
10613
  }
10284
10614
  };
10615
+ const handleDownloadTemplate = async () => {
10616
+ setTemplateDownloading(true);
10617
+ try {
10618
+ const response = await downloadDataManagementImportTemplate(request, { appType, formUuid });
10619
+ await downloadBlobResponse(response, `\u5BFC\u5165\u6A21\u677F-${formUuid}.xlsx`);
10620
+ message.success("\u6A21\u677F\u4E0B\u8F7D\u5DF2\u5F00\u59CB");
10621
+ } catch (error) {
10622
+ console.error("[DataManagementList] download template failed:", error);
10623
+ message.error(error instanceof Error ? error.message : "\u4E0B\u8F7D\u5BFC\u5165\u6A21\u677F\u5931\u8D25");
10624
+ } finally {
10625
+ setTemplateDownloading(false);
10626
+ }
10627
+ };
10285
10628
  const loadTransferRecords = async (type) => {
10286
10629
  setRecordTab(type);
10287
10630
  setRecordsOpen(true);
@@ -10316,22 +10659,32 @@ var DataManagementList = ({
10316
10659
  await loadData({ current: 1, pageSize });
10317
10660
  };
10318
10661
  const columns = useMemo18(() => {
10319
- const baseColumns = visibleFields.map((field) => ({
10320
- title: field.label,
10321
- dataIndex: field.fieldId,
10322
- key: field.fieldId,
10323
- width: widths[field.fieldId] || field.width || 160,
10324
- fixed: lockFieldIds.includes(field.fieldId) ? "left" : void 0,
10325
- ellipsis: true,
10326
- sorter: true,
10327
- render: (value) => renderCellValue(value, field)
10328
- })) || [];
10662
+ const baseColumns = visibleFields.map((field) => {
10663
+ const columnWidth = widths[field.fieldId] || field.width || 160;
10664
+ return {
10665
+ title: /* @__PURE__ */ jsx89(
10666
+ ResizableColumnTitle,
10667
+ {
10668
+ label: field.label,
10669
+ width: columnWidth,
10670
+ onResize: (width) => updateColumnWidth(field.fieldId, width),
10671
+ onResizeEnd: (width) => commitColumnWidth(field.fieldId, width)
10672
+ }
10673
+ ),
10674
+ dataIndex: field.fieldId,
10675
+ key: field.fieldId,
10676
+ width: columnWidth,
10677
+ fixed: lockFieldIds.includes(field.fieldId) ? "left" : void 0,
10678
+ ellipsis: true,
10679
+ render: (value) => renderCellValue(value, field)
10680
+ };
10681
+ }) || [];
10329
10682
  return [
10330
10683
  ...baseColumns,
10331
10684
  {
10332
10685
  title: "\u64CD\u4F5C",
10333
10686
  key: "__actions",
10334
- width: 148,
10687
+ width: 136,
10335
10688
  fixed: "right",
10336
10689
  render: (_, record) => /* @__PURE__ */ jsxs41(Space9, { size: 4, children: [
10337
10690
  /* @__PURE__ */ jsx89(Button15, { type: "link", size: "small", onClick: () => handleDetail(record), children: "\u8BE6\u60C5" }),
@@ -10342,18 +10695,6 @@ var DataManagementList = ({
10342
10695
  getPopupContainer,
10343
10696
  menu: {
10344
10697
  items: [
10345
- ...rowActions.map((action) => ({
10346
- key: action.key,
10347
- label: action.label,
10348
- danger: action.danger,
10349
- onClick: () => action.onClick(record)
10350
- })),
10351
- {
10352
- key: "workflow",
10353
- label: "\u6D41\u7A0B\u65E5\u5FD7",
10354
- icon: /* @__PURE__ */ jsx89(HistoryOutlined2, {}),
10355
- onClick: () => message.info("\u8BF7\u901A\u8FC7 detailRenderer \u63A5\u5165\u6D41\u7A0B\u65E5\u5FD7\u6216\u6D41\u7A0B\u56FE\u5165\u53E3")
10356
- },
10357
10698
  ...!readonly ? [
10358
10699
  {
10359
10700
  key: "delete",
@@ -10366,6 +10707,20 @@ var DataManagementList = ({
10366
10707
  () => handleDelete([String(getRecordId(record))])
10367
10708
  )
10368
10709
  }
10710
+ ] : [],
10711
+ ...rowActions.map((action) => ({
10712
+ key: action.key,
10713
+ label: action.label,
10714
+ danger: action.danger,
10715
+ onClick: () => action.onClick(record)
10716
+ })),
10717
+ ...formType === "process" ? [
10718
+ {
10719
+ key: "workflow",
10720
+ label: "\u6D41\u7A0B\u65E5\u5FD7",
10721
+ icon: /* @__PURE__ */ jsx89(HistoryOutlined2, {}),
10722
+ onClick: () => message.info("\u8BF7\u901A\u8FC7 detailRenderer \u63A5\u5165\u6D41\u7A0B\u65E5\u5FD7\u6216\u6D41\u7A0B\u56FE\u5165\u53E3")
10723
+ }
10369
10724
  ] : []
10370
10725
  ]
10371
10726
  },
@@ -10377,16 +10732,23 @@ var DataManagementList = ({
10377
10732
  ];
10378
10733
  }, [
10379
10734
  confirmDanger,
10735
+ commitColumnWidth,
10736
+ formType,
10380
10737
  getPopupContainer,
10381
10738
  handleDelete,
10382
10739
  handleDetail,
10383
10740
  lockFieldIds,
10384
10741
  readonly,
10385
10742
  rowActions,
10743
+ updateColumnWidth,
10386
10744
  visibleFields,
10387
10745
  widths
10388
10746
  ]);
10389
10747
  const tableSize = density === "compact" ? "small" : density === "loose" ? "large" : "middle";
10748
+ const tableScrollX = Math.max(
10749
+ 900,
10750
+ visibleFields.reduce((sum, field) => sum + (widths[field.fieldId] || field.width || 160), 136)
10751
+ );
10390
10752
  const importPreviewColumns = useMemo18(() => {
10391
10753
  const keys = Array.from(
10392
10754
  new Set(importPreview.flatMap((record) => Object.keys(record || {})))
@@ -10403,450 +10765,512 @@ var DataManagementList = ({
10403
10765
  };
10404
10766
  });
10405
10767
  }, [fields, importPreview]);
10406
- return /* @__PURE__ */ jsx89(ConfigProvider, { getPopupContainer, children: /* @__PURE__ */ jsxs41("div", { ref: rootRef, className: `${fullHeight ? "h-full min-h-full" : ""} bg-ant-bg-layout`, children: [
10407
- /* @__PURE__ */ jsxs41("div", { className: "mx-auto flex h-full max-w-[1440px] flex-col px-4 py-4 md:px-6", children: [
10408
- /* @__PURE__ */ jsxs41("div", { className: "mb-4 flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
10409
- /* @__PURE__ */ jsxs41("div", { children: [
10410
- /* @__PURE__ */ jsx89("h1", { className: "text-xl font-semibold text-ant-color-text", children: title || "\u6570\u636E\u7BA1\u7406" }),
10411
- /* @__PURE__ */ jsxs41("p", { className: "mt-1 text-sm text-ant-color-text-secondary", children: [
10412
- "\u5171 ",
10413
- total,
10414
- " \u6761\u6570\u636E\uFF0C\u5DF2\u9009\u62E9 ",
10415
- selectedRowKeys.length,
10416
- " \u6761"
10417
- ] })
10418
- ] }),
10419
- /* @__PURE__ */ jsxs41(Space9, { wrap: true, children: [
10420
- !readonly && submitRenderer && /* @__PURE__ */ jsx89(Button15, { icon: /* @__PURE__ */ jsx89(PlusOutlined, {}), type: "primary", onClick: () => setSubmitOpen(true), children: "\u65B0\u589E" }),
10421
- /* @__PURE__ */ jsx89(
10422
- Input12.Search,
10768
+ return /* @__PURE__ */ jsx89(ConfigProvider, { getPopupContainer, children: /* @__PURE__ */ jsxs41(
10769
+ "div",
10770
+ {
10771
+ ref: rootRef,
10772
+ className: `relative w-full bg-ant-bg-layout ${fullHeight ? "flex h-[calc(100vh-88px)] min-h-[560px] overflow-hidden" : ""}`,
10773
+ children: [
10774
+ /* @__PURE__ */ jsxs41("div", { className: "mx-auto flex min-h-0 w-full max-w-[1440px] flex-col px-4 py-4 md:px-6", children: [
10775
+ /* @__PURE__ */ jsxs41("div", { className: "mb-4 flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
10776
+ /* @__PURE__ */ jsxs41("div", { children: [
10777
+ /* @__PURE__ */ jsx89("h1", { className: "text-xl font-semibold text-ant-color-text", children: title || "\u6570\u636E\u7BA1\u7406" }),
10778
+ /* @__PURE__ */ jsxs41("p", { className: "mt-1 text-sm text-ant-color-text-secondary", children: [
10779
+ "\u5171 ",
10780
+ total,
10781
+ " \u6761\u6570\u636E\uFF0C\u5DF2\u9009\u62E9 ",
10782
+ selectedRowKeys.length,
10783
+ " \u6761"
10784
+ ] })
10785
+ ] }),
10786
+ /* @__PURE__ */ jsxs41(Space9, { wrap: true, children: [
10787
+ !readonly && submitRenderer && /* @__PURE__ */ jsx89(Button15, { icon: /* @__PURE__ */ jsx89(PlusOutlined, {}), type: "primary", onClick: () => setSubmitOpen(true), children: "\u65B0\u589E" }),
10788
+ /* @__PURE__ */ jsx89(
10789
+ Input12.Search,
10790
+ {
10791
+ allowClear: true,
10792
+ className: "w-[260px]",
10793
+ placeholder: "\u641C\u7D22\u5173\u952E\u5B57",
10794
+ value: searchKeyWord,
10795
+ onChange: (event) => setSearchKeyWord(event.target.value),
10796
+ onSearch: (value) => {
10797
+ const nextSearchKeyWord = String(value || "");
10798
+ setSearchKeyWord(nextSearchKeyWord);
10799
+ persistConfig({
10800
+ filter: { searchKeyWord: nextSearchKeyWord, group: filterGroup }
10801
+ });
10802
+ loadData({
10803
+ current: 1,
10804
+ pageSize,
10805
+ searchKeyWord: nextSearchKeyWord,
10806
+ filterGroup
10807
+ });
10808
+ }
10809
+ }
10810
+ ),
10811
+ /* @__PURE__ */ jsx89(Button15, { icon: /* @__PURE__ */ jsx89(FilterOutlined, {}), onClick: () => setFilterOpen(true), children: "\u7B5B\u9009" }),
10812
+ /* @__PURE__ */ jsx89(Button15, { icon: /* @__PURE__ */ jsx89(SettingOutlined, {}), onClick: () => setColumnOpen(true), children: "\u5217\u8BBE\u7F6E" }),
10813
+ /* @__PURE__ */ jsx89(
10814
+ Dropdown3,
10815
+ {
10816
+ getPopupContainer,
10817
+ menu: {
10818
+ items: [
10819
+ {
10820
+ key: "selected",
10821
+ label: "\u5BFC\u51FA\u9009\u4E2D",
10822
+ disabled: selectedRowKeys.length === 0,
10823
+ onClick: () => {
10824
+ setExportScope("selected");
10825
+ setExportFields(showFields);
10826
+ setExportOpen(true);
10827
+ }
10828
+ },
10829
+ {
10830
+ key: "all",
10831
+ label: "\u5BFC\u51FA\u5168\u90E8",
10832
+ onClick: () => {
10833
+ setExportScope("all");
10834
+ setExportFields(showFields);
10835
+ setExportOpen(true);
10836
+ }
10837
+ },
10838
+ {
10839
+ key: "records",
10840
+ label: "\u5BFC\u51FA\u8BB0\u5F55",
10841
+ onClick: () => loadTransferRecords("export")
10842
+ }
10843
+ ]
10844
+ },
10845
+ children: /* @__PURE__ */ jsx89(Button15, { icon: /* @__PURE__ */ jsx89(DownloadOutlined, {}), children: "\u5BFC\u51FA" })
10846
+ }
10847
+ ),
10848
+ !readonly && /* @__PURE__ */ jsx89(
10849
+ Dropdown3,
10850
+ {
10851
+ getPopupContainer,
10852
+ menu: {
10853
+ items: [
10854
+ { key: "import", label: "\u5BFC\u5165\u6570\u636E", onClick: () => setImportOpen(true) },
10855
+ {
10856
+ key: "records",
10857
+ label: "\u5BFC\u5165\u8BB0\u5F55",
10858
+ onClick: () => loadTransferRecords("import")
10859
+ }
10860
+ ]
10861
+ },
10862
+ children: /* @__PURE__ */ jsx89(Button15, { icon: /* @__PURE__ */ jsx89(ImportOutlined, {}), children: "\u5BFC\u5165" })
10863
+ }
10864
+ ),
10865
+ /* @__PURE__ */ jsx89(Button15, { icon: /* @__PURE__ */ jsx89(ReloadOutlined3, {}), onClick: () => loadData({ current, pageSize }) })
10866
+ ] })
10867
+ ] }),
10868
+ selectedRowKeys.length > 0 && /* @__PURE__ */ jsxs41("div", { className: "mb-3 flex flex-wrap items-center justify-between gap-3 rounded-lg border border-ant-border-secondary bg-ant-bg-container px-4 py-3 shadow-sm", children: [
10869
+ /* @__PURE__ */ jsxs41("span", { className: "text-sm text-ant-color-text-secondary", children: [
10870
+ "\u5DF2\u9009 ",
10871
+ selectedRowKeys.length,
10872
+ " \u6761"
10873
+ ] }),
10874
+ /* @__PURE__ */ jsxs41(Space9, { wrap: true, children: [
10875
+ !readonly && /* @__PURE__ */ jsx89(Button15, { icon: /* @__PURE__ */ jsx89(SwapOutlined2, {}), onClick: handleBatchApprove, children: "\u6279\u91CF\u5BA1\u6279" }),
10876
+ !readonly && /* @__PURE__ */ jsx89(
10877
+ Button15,
10878
+ {
10879
+ danger: true,
10880
+ icon: /* @__PURE__ */ jsx89(DeleteOutlined, {}),
10881
+ onClick: () => confirmDanger(
10882
+ "\u786E\u8BA4\u6279\u91CF\u5220\u9664",
10883
+ `\u5C06\u5220\u9664 ${selectedRowKeys.length} \u6761\u6570\u636E\uFF0C\u786E\u8BA4\u7EE7\u7EED\u5417\uFF1F`,
10884
+ () => handleDelete(selectedRowKeys.map(String))
10885
+ ),
10886
+ children: "\u6279\u91CF\u5220\u9664"
10887
+ }
10888
+ ),
10889
+ /* @__PURE__ */ jsx89(Button15, { type: "link", onClick: () => setSelectedRowKeys([]), children: "\u53D6\u6D88\u9009\u62E9" })
10890
+ ] })
10891
+ ] }),
10892
+ /* @__PURE__ */ jsx89("div", { className: "relative flex-1 overflow-hidden rounded-lg border border-ant-border-secondary bg-ant-bg-container", children: /* @__PURE__ */ jsx89(
10893
+ Table3,
10423
10894
  {
10424
- allowClear: true,
10425
- className: "w-[260px]",
10426
- placeholder: "\u641C\u7D22\u5173\u952E\u5B57",
10427
- value: searchKeyWord,
10428
- onChange: (event) => setSearchKeyWord(event.target.value),
10429
- onSearch: (value) => {
10430
- const nextSearchKeyWord = String(value || "");
10431
- setSearchKeyWord(nextSearchKeyWord);
10432
- persistConfig({
10433
- filter: { searchKeyWord: nextSearchKeyWord, group: filterGroup }
10434
- });
10895
+ rowKey: (record) => String(getRecordId(record)),
10896
+ loading: loading || schemaLoading,
10897
+ columns,
10898
+ dataSource,
10899
+ size: tableSize,
10900
+ scroll: {
10901
+ x: tableScrollX,
10902
+ y: fullHeight ? selectedRowKeys.length > 0 ? "calc(100vh - 360px)" : "calc(100vh - 300px)" : void 0
10903
+ },
10904
+ rowSelection: {
10905
+ selectedRowKeys,
10906
+ onChange: setSelectedRowKeys
10907
+ },
10908
+ pagination: {
10909
+ current,
10910
+ pageSize,
10911
+ total,
10912
+ showSizeChanger: true,
10913
+ showTotal: (count) => `\u5171 ${count} \u6761`
10914
+ },
10915
+ onChange: (pagination) => {
10435
10916
  loadData({
10436
- current: 1,
10437
- pageSize,
10438
- searchKeyWord: nextSearchKeyWord,
10439
- filterGroup
10917
+ current: pagination.current || 1,
10918
+ pageSize: pagination.pageSize || pageSize,
10919
+ sort
10440
10920
  });
10441
10921
  }
10442
10922
  }
10443
- ),
10444
- /* @__PURE__ */ jsx89(Button15, { icon: /* @__PURE__ */ jsx89(FilterOutlined, {}), onClick: () => setFilterOpen(true), children: "\u7B5B\u9009" }),
10445
- /* @__PURE__ */ jsx89(Button15, { icon: /* @__PURE__ */ jsx89(SettingOutlined, {}), onClick: () => setColumnOpen(true), children: "\u5217\u8BBE\u7F6E" }),
10446
- /* @__PURE__ */ jsx89(
10447
- Dropdown3,
10448
- {
10449
- getPopupContainer,
10450
- menu: {
10451
- items: [
10452
- {
10453
- key: "selected",
10454
- label: "\u5BFC\u51FA\u9009\u4E2D",
10455
- disabled: selectedRowKeys.length === 0,
10456
- onClick: () => {
10457
- setExportScope("selected");
10458
- setExportFields(showFields);
10459
- setExportOpen(true);
10460
- }
10461
- },
10462
- {
10463
- key: "all",
10464
- label: "\u5BFC\u51FA\u5168\u90E8",
10465
- onClick: () => {
10466
- setExportScope("all");
10467
- setExportFields(showFields);
10468
- setExportOpen(true);
10469
- }
10470
- },
10923
+ ) })
10924
+ ] }),
10925
+ /* @__PURE__ */ jsx89(
10926
+ Modal8,
10927
+ {
10928
+ getContainer: false,
10929
+ title: "\u9AD8\u7EA7\u7B5B\u9009",
10930
+ open: filterOpen,
10931
+ width: 760,
10932
+ onCancel: () => setFilterOpen(false),
10933
+ onOk: () => {
10934
+ setFilterOpen(false);
10935
+ persistConfig({ filter: { searchKeyWord, group: filterGroup } });
10936
+ loadData({ current: 1, pageSize, searchKeyWord, filterGroup });
10937
+ },
10938
+ okText: "\u5E94\u7528\u7B5B\u9009",
10939
+ children: /* @__PURE__ */ jsx89(FilterGroupEditor, { group: filterGroup, fields, onChange: setFilterGroup })
10940
+ }
10941
+ ),
10942
+ /* @__PURE__ */ jsx89(
10943
+ Modal8,
10944
+ {
10945
+ getContainer: false,
10946
+ title: "\u5217\u8BBE\u7F6E",
10947
+ open: columnOpen,
10948
+ width: 920,
10949
+ onCancel: () => setColumnOpen(false),
10950
+ onOk: handleColumnCommit,
10951
+ children: /* @__PURE__ */ jsxs41("div", { className: "space-y-5", children: [
10952
+ /* @__PURE__ */ jsxs41("div", { children: [
10953
+ /* @__PURE__ */ jsx89("div", { className: "mb-2 text-sm font-medium text-ant-color-text", children: "\u663E\u793A\u5217" }),
10954
+ /* @__PURE__ */ jsx89(
10955
+ Checkbox5.Group,
10471
10956
  {
10472
- key: "records",
10473
- label: "\u5BFC\u51FA\u8BB0\u5F55",
10474
- onClick: () => loadTransferRecords("export")
10957
+ className: "grid grid-cols-2 gap-2 md:grid-cols-3",
10958
+ value: showFields,
10959
+ options: fields.map((field) => ({ label: field.label, value: field.fieldId })),
10960
+ onChange: (values) => setShowFields(values.map(String))
10475
10961
  }
10476
- ]
10477
- },
10478
- children: /* @__PURE__ */ jsx89(Button15, { icon: /* @__PURE__ */ jsx89(DownloadOutlined, {}), children: "\u5BFC\u51FA" })
10479
- }
10480
- ),
10481
- !readonly && /* @__PURE__ */ jsx89(
10482
- Dropdown3,
10483
- {
10484
- getPopupContainer,
10485
- menu: {
10486
- items: [
10487
- { key: "import", label: "\u5BFC\u5165\u6570\u636E", onClick: () => setImportOpen(true) },
10962
+ )
10963
+ ] }),
10964
+ /* @__PURE__ */ jsxs41("div", { children: [
10965
+ /* @__PURE__ */ jsx89("div", { className: "mb-2 text-sm font-medium text-ant-color-text", children: "\u51BB\u7ED3\u5217" }),
10966
+ /* @__PURE__ */ jsx89(
10967
+ Select6,
10488
10968
  {
10489
- key: "records",
10490
- label: "\u5BFC\u5165\u8BB0\u5F55",
10491
- onClick: () => loadTransferRecords("import")
10969
+ mode: "multiple",
10970
+ className: "w-full",
10971
+ value: lockFieldIds,
10972
+ options: showFields.map((fieldId) => {
10973
+ const field = fields.find((item) => item.fieldId === fieldId);
10974
+ return { label: field?.label || fieldId, value: fieldId };
10975
+ }),
10976
+ onChange: setLockFieldIds
10492
10977
  }
10493
- ]
10494
- },
10495
- children: /* @__PURE__ */ jsx89(Button15, { icon: /* @__PURE__ */ jsx89(ImportOutlined, {}), children: "\u5BFC\u5165" })
10496
- }
10497
- ),
10498
- /* @__PURE__ */ jsx89(Button15, { icon: /* @__PURE__ */ jsx89(ReloadOutlined3, {}), onClick: () => loadData({ current, pageSize }) })
10499
- ] })
10500
- ] }),
10501
- selectedRowKeys.length > 0 && /* @__PURE__ */ jsxs41("div", { className: "mb-3 flex flex-wrap items-center justify-between gap-3 rounded-lg border border-ant-border-secondary bg-ant-bg-container px-4 py-3 shadow-sm", children: [
10502
- /* @__PURE__ */ jsxs41("span", { className: "text-sm text-ant-color-text-secondary", children: [
10503
- "\u5DF2\u9009 ",
10504
- selectedRowKeys.length,
10505
- " \u6761"
10506
- ] }),
10507
- /* @__PURE__ */ jsxs41(Space9, { wrap: true, children: [
10508
- !readonly && /* @__PURE__ */ jsx89(Button15, { icon: /* @__PURE__ */ jsx89(SwapOutlined2, {}), onClick: handleBatchApprove, children: "\u6279\u91CF\u5BA1\u6279" }),
10509
- !readonly && /* @__PURE__ */ jsx89(
10510
- Button15,
10511
- {
10512
- danger: true,
10513
- icon: /* @__PURE__ */ jsx89(DeleteOutlined, {}),
10514
- onClick: () => confirmDanger(
10515
- "\u786E\u8BA4\u6279\u91CF\u5220\u9664",
10516
- `\u5C06\u5220\u9664 ${selectedRowKeys.length} \u6761\u6570\u636E\uFF0C\u786E\u8BA4\u7EE7\u7EED\u5417\uFF1F`,
10517
- () => handleDelete(selectedRowKeys.map(String))
10518
- ),
10519
- children: "\u6279\u91CF\u5220\u9664"
10520
- }
10521
- ),
10522
- /* @__PURE__ */ jsx89(Button15, { type: "link", onClick: () => setSelectedRowKeys([]), children: "\u53D6\u6D88\u9009\u62E9" })
10523
- ] })
10524
- ] }),
10525
- /* @__PURE__ */ jsx89("div", { className: "relative flex-1 overflow-hidden rounded-lg border border-ant-border-secondary bg-ant-bg-container", children: /* @__PURE__ */ jsx89(
10526
- Table3,
10527
- {
10528
- rowKey: (record) => String(getRecordId(record)),
10529
- loading: loading || schemaLoading,
10530
- columns,
10531
- dataSource,
10532
- size: tableSize,
10533
- scroll: {
10534
- x: Math.max(900, visibleFields.length * 160),
10535
- y: fullHeight ? selectedRowKeys.length > 0 ? "calc(100vh - 320px)" : "calc(100vh - 260px)" : void 0
10536
- },
10537
- rowSelection: {
10538
- selectedRowKeys,
10539
- onChange: setSelectedRowKeys
10540
- },
10541
- pagination: {
10542
- current,
10543
- pageSize,
10544
- total,
10545
- showSizeChanger: true,
10546
- showTotal: (count) => `\u5171 ${count} \u6761`
10547
- },
10548
- onChange: (pagination, _filters, sorter) => {
10549
- const sorters = Array.isArray(sorter) ? sorter : [sorter];
10550
- const nextSort = sorters.filter((item) => item?.field && item?.order).map((item) => ({
10551
- id: String(item.field),
10552
- isAsc: item.order === "ascend" ? "y" : "n"
10553
- }));
10554
- setSort(nextSort);
10555
- persistConfig({ sort: nextSort });
10556
- loadData({
10557
- current: pagination.current || 1,
10558
- pageSize: pagination.pageSize || pageSize,
10559
- sort: nextSort
10560
- });
10978
+ )
10979
+ ] }),
10980
+ /* @__PURE__ */ jsx89(Divider, { className: "my-1" }),
10981
+ /* @__PURE__ */ jsxs41("div", { children: [
10982
+ /* @__PURE__ */ jsxs41("div", { className: "mb-2 flex items-center justify-between gap-3", children: [
10983
+ /* @__PURE__ */ jsx89("span", { className: "text-sm font-medium text-ant-color-text", children: "\u6392\u5E8F\u89C4\u5219" }),
10984
+ /* @__PURE__ */ jsx89(Button15, { size: "small", onClick: handleAddSort, disabled: fields.length === 0, children: "\u6DFB\u52A0\u6392\u5E8F" })
10985
+ ] }),
10986
+ /* @__PURE__ */ jsx89("div", { className: "space-y-2", children: sort.length === 0 ? /* @__PURE__ */ jsx89("div", { className: "rounded-lg border border-dashed border-ant-border-secondary px-3 py-4 text-center text-sm text-ant-color-text-tertiary", children: "\u6682\u65E0\u6392\u5E8F\u89C4\u5219" }) : sort.map((item, index) => /* @__PURE__ */ jsxs41("div", { className: "flex items-center gap-2", children: [
10987
+ /* @__PURE__ */ jsx89(
10988
+ Select6,
10989
+ {
10990
+ className: "min-w-0 flex-1",
10991
+ value: item.id,
10992
+ options: fields.map((field) => ({
10993
+ label: field.label,
10994
+ value: field.fieldId
10995
+ })),
10996
+ onChange: (value) => handleSortChange(index, { id: value })
10997
+ }
10998
+ ),
10999
+ /* @__PURE__ */ jsx89(
11000
+ Segmented,
11001
+ {
11002
+ value: item.isAsc,
11003
+ options: [
11004
+ { label: "\u5347\u5E8F", value: "y" },
11005
+ { label: "\u964D\u5E8F", value: "n" }
11006
+ ],
11007
+ onChange: (value) => handleSortChange(index, { isAsc: value })
11008
+ }
11009
+ ),
11010
+ /* @__PURE__ */ jsx89(
11011
+ Button15,
11012
+ {
11013
+ danger: true,
11014
+ type: "text",
11015
+ icon: /* @__PURE__ */ jsx89(DeleteOutlined, {}),
11016
+ onClick: () => handleRemoveSort(index)
11017
+ }
11018
+ )
11019
+ ] }, `${item.id}_${index}`)) })
11020
+ ] }),
11021
+ /* @__PURE__ */ jsxs41("div", { className: "grid gap-4 md:grid-cols-3", children: [
11022
+ /* @__PURE__ */ jsxs41("div", { children: [
11023
+ /* @__PURE__ */ jsx89("div", { className: "mb-2 text-sm font-medium text-ant-color-text", children: "\u8868\u683C\u5BC6\u5EA6" }),
11024
+ /* @__PURE__ */ jsx89(
11025
+ Segmented,
11026
+ {
11027
+ block: true,
11028
+ value: density,
11029
+ options: [
11030
+ { label: "\u7D27\u51D1", value: "compact" },
11031
+ { label: "\u6807\u51C6", value: "middle" },
11032
+ { label: "\u5BBD\u677E", value: "loose" }
11033
+ ],
11034
+ onChange: (value) => setDensity(value)
11035
+ }
11036
+ )
11037
+ ] }),
11038
+ /* @__PURE__ */ jsxs41("div", { children: [
11039
+ /* @__PURE__ */ jsx89("div", { className: "mb-2 text-sm font-medium text-ant-color-text", children: "\u8BE6\u60C5\u6253\u5F00\u65B9\u5F0F" }),
11040
+ /* @__PURE__ */ jsx89(
11041
+ Segmented,
11042
+ {
11043
+ block: true,
11044
+ value: detailOpenMode,
11045
+ options: [
11046
+ { label: "\u62BD\u5C49", value: "drawer" },
11047
+ { label: "\u65B0\u9875", value: "newPage" }
11048
+ ],
11049
+ onChange: (value) => setDetailOpenMode(value)
11050
+ }
11051
+ )
11052
+ ] }),
11053
+ /* @__PURE__ */ jsxs41("div", { children: [
11054
+ /* @__PURE__ */ jsx89("div", { className: "mb-2 text-sm font-medium text-ant-color-text", children: "\u9875\u5927\u5C0F" }),
11055
+ /* @__PURE__ */ jsx89(
11056
+ Select6,
11057
+ {
11058
+ className: "w-full",
11059
+ value: pageSize,
11060
+ options: [10, 20, 50, 100].map((value) => ({ label: `${value} \u6761`, value })),
11061
+ onChange: setPageSize
11062
+ }
11063
+ )
11064
+ ] })
11065
+ ] })
11066
+ ] })
10561
11067
  }
10562
- }
10563
- ) })
10564
- ] }),
10565
- /* @__PURE__ */ jsx89(
10566
- Modal8,
10567
- {
10568
- getContainer: false,
10569
- title: "\u9AD8\u7EA7\u7B5B\u9009",
10570
- open: filterOpen,
10571
- width: 760,
10572
- onCancel: () => setFilterOpen(false),
10573
- onOk: () => {
10574
- setFilterOpen(false);
10575
- persistConfig({ filter: { searchKeyWord, group: filterGroup } });
10576
- loadData({ current: 1, pageSize, searchKeyWord, filterGroup });
10577
- },
10578
- okText: "\u5E94\u7528\u7B5B\u9009",
10579
- children: /* @__PURE__ */ jsx89(FilterGroupEditor, { group: filterGroup, fields, onChange: setFilterGroup })
10580
- }
10581
- ),
10582
- /* @__PURE__ */ jsx89(
10583
- Modal8,
10584
- {
10585
- getContainer: false,
10586
- title: "\u5217\u8BBE\u7F6E",
10587
- open: columnOpen,
10588
- width: 720,
10589
- onCancel: () => setColumnOpen(false),
10590
- onOk: handleColumnCommit,
10591
- children: /* @__PURE__ */ jsxs41("div", { className: "space-y-5", children: [
10592
- /* @__PURE__ */ jsxs41("div", { children: [
10593
- /* @__PURE__ */ jsx89("div", { className: "mb-2 text-sm font-medium text-ant-color-text", children: "\u663E\u793A\u5217" }),
10594
- /* @__PURE__ */ jsx89(
11068
+ ),
11069
+ /* @__PURE__ */ jsx89(
11070
+ Modal8,
11071
+ {
11072
+ getContainer: false,
11073
+ title: exportScope === "selected" ? "\u5BFC\u51FA\u9009\u4E2D\u6570\u636E" : "\u5BFC\u51FA\u5168\u90E8\u6570\u636E",
11074
+ open: exportOpen,
11075
+ onCancel: () => setExportOpen(false),
11076
+ footer: /* @__PURE__ */ jsxs41(Space9, { children: [
11077
+ /* @__PURE__ */ jsx89(Button15, { onClick: () => setExportOpen(false), children: "\u53D6\u6D88" }),
11078
+ /* @__PURE__ */ jsx89(
11079
+ Button15,
11080
+ {
11081
+ type: "primary",
11082
+ loading: exporting,
11083
+ disabled: exportScope === "selected" && selectedRowKeys.length === 0,
11084
+ onClick: () => handleExport(exportScope),
11085
+ children: exportScope === "selected" ? `\u5BFC\u51FA\u9009\u4E2D (${selectedRowKeys.length})` : "\u5BFC\u51FA\u5168\u90E8"
11086
+ }
11087
+ )
11088
+ ] }),
11089
+ children: /* @__PURE__ */ jsx89(
10595
11090
  Checkbox5.Group,
10596
11091
  {
10597
- className: "grid grid-cols-2 gap-2 md:grid-cols-3",
10598
- value: showFields,
11092
+ className: "grid grid-cols-2 gap-2",
11093
+ value: exportFields,
10599
11094
  options: fields.map((field) => ({ label: field.label, value: field.fieldId })),
10600
- onChange: (values) => setShowFields(values.map(String))
10601
- }
10602
- )
10603
- ] }),
10604
- /* @__PURE__ */ jsxs41("div", { children: [
10605
- /* @__PURE__ */ jsx89("div", { className: "mb-2 text-sm font-medium text-ant-color-text", children: "\u51BB\u7ED3\u5217" }),
10606
- /* @__PURE__ */ jsx89(
10607
- Select6,
10608
- {
10609
- mode: "multiple",
10610
- className: "w-full",
10611
- value: lockFieldIds,
10612
- options: showFields.map((fieldId) => {
10613
- const field = fields.find((item) => item.fieldId === fieldId);
10614
- return { label: field?.label || fieldId, value: fieldId };
10615
- }),
10616
- onChange: setLockFieldIds
11095
+ onChange: (values) => setExportFields(values.map(String))
10617
11096
  }
10618
11097
  )
10619
- ] }),
10620
- /* @__PURE__ */ jsxs41("div", { className: "grid gap-4 md:grid-cols-3", children: [
10621
- /* @__PURE__ */ jsxs41("div", { children: [
10622
- /* @__PURE__ */ jsx89("div", { className: "mb-2 text-sm font-medium text-ant-color-text", children: "\u8868\u683C\u5BC6\u5EA6" }),
11098
+ }
11099
+ ),
11100
+ /* @__PURE__ */ jsx89(
11101
+ Modal8,
11102
+ {
11103
+ getContainer: false,
11104
+ title: "\u6279\u91CF\u5BA1\u6279",
11105
+ open: batchApprovalOpen,
11106
+ onCancel: () => setBatchApprovalOpen(false),
11107
+ onOk: handleBatchApprovalConfirm,
11108
+ okText: batchApprovalAction === "approved" ? "\u786E\u8BA4\u901A\u8FC7" : "\u786E\u8BA4\u62D2\u7EDD",
11109
+ confirmLoading: batchApproving,
11110
+ children: /* @__PURE__ */ jsxs41("div", { className: "space-y-4", children: [
11111
+ /* @__PURE__ */ jsxs41("div", { className: "text-sm text-ant-color-text-secondary", children: [
11112
+ "\u5DF2\u9009\u62E9 ",
11113
+ selectedRowKeys.length,
11114
+ " \u6761\u8BB0\u5F55"
11115
+ ] }),
10623
11116
  /* @__PURE__ */ jsx89(
10624
11117
  Segmented,
10625
11118
  {
10626
11119
  block: true,
10627
- value: density,
11120
+ value: batchApprovalAction,
10628
11121
  options: [
10629
- { label: "\u7D27\u51D1", value: "compact" },
10630
- { label: "\u6807\u51C6", value: "middle" },
10631
- { label: "\u5BBD\u677E", value: "loose" }
11122
+ { label: "\u540C\u610F", value: "approved" },
11123
+ { label: "\u62D2\u7EDD", value: "rejected" }
10632
11124
  ],
10633
- onChange: (value) => setDensity(value)
11125
+ onChange: (value) => setBatchApprovalAction(value)
11126
+ }
11127
+ ),
11128
+ /* @__PURE__ */ jsx89(
11129
+ Input12.TextArea,
11130
+ {
11131
+ value: batchApprovalComments,
11132
+ rows: 4,
11133
+ maxLength: 500,
11134
+ showCount: true,
11135
+ placeholder: "\u586B\u5199\u5BA1\u6279\u610F\u89C1",
11136
+ onChange: (event) => setBatchApprovalComments(event.target.value)
10634
11137
  }
10635
11138
  )
10636
- ] }),
10637
- /* @__PURE__ */ jsxs41("div", { children: [
10638
- /* @__PURE__ */ jsx89("div", { className: "mb-2 text-sm font-medium text-ant-color-text", children: "\u8BE6\u60C5\u6253\u5F00\u65B9\u5F0F" }),
11139
+ ] })
11140
+ }
11141
+ ),
11142
+ /* @__PURE__ */ jsxs41(
11143
+ Modal8,
11144
+ {
11145
+ getContainer: false,
11146
+ title: "\u5BFC\u5165\u6570\u636E",
11147
+ open: importOpen,
11148
+ width: 720,
11149
+ onCancel: () => setImportOpen(false),
11150
+ onOk: handleImportConfirm,
11151
+ okButtonProps: { disabled: !importBase64 },
11152
+ okText: "\u786E\u8BA4\u5BFC\u5165",
11153
+ children: [
11154
+ /* @__PURE__ */ jsxs41("div", { className: "mb-3 flex flex-col gap-3 rounded-lg border border-ant-border-secondary bg-ant-bg-container px-4 py-3 md:flex-row md:items-center md:justify-between", children: [
11155
+ /* @__PURE__ */ jsxs41("div", { children: [
11156
+ /* @__PURE__ */ jsx89("div", { className: "text-sm font-medium text-ant-color-text", children: "\u5BFC\u5165\u6A21\u677F" }),
11157
+ /* @__PURE__ */ jsx89("div", { className: "mt-1 text-xs text-ant-color-text-secondary", children: "\u5148\u4E0B\u8F7D\u6A21\u677F\u586B\u5199\u6570\u636E\uFF0C\u518D\u4E0A\u4F20 Excel \u6587\u4EF6\u5BFC\u5165" })
11158
+ ] }),
11159
+ /* @__PURE__ */ jsx89(
11160
+ Button15,
11161
+ {
11162
+ icon: /* @__PURE__ */ jsx89(DownloadOutlined, {}),
11163
+ loading: templateDownloading,
11164
+ onClick: handleDownloadTemplate,
11165
+ children: "\u4E0B\u8F7D\u5BFC\u5165\u6A21\u677F"
11166
+ }
11167
+ )
11168
+ ] }),
11169
+ /* @__PURE__ */ jsx89(
11170
+ Upload3.Dragger,
11171
+ {
11172
+ accept: ".xlsx,.xls",
11173
+ maxCount: 1,
11174
+ beforeUpload: handleImportPreview,
11175
+ onRemove: () => {
11176
+ setImportBase64("");
11177
+ setImportPreview([]);
11178
+ },
11179
+ children: /* @__PURE__ */ jsx89("p", { className: "text-ant-color-text-secondary", children: "\u62D6\u62FD Excel \u6587\u4EF6\u5230\u6B64\u5904\uFF0C\u6216\u70B9\u51FB\u9009\u62E9\u6587\u4EF6" })
11180
+ }
11181
+ ),
11182
+ importPreview.length > 0 && /* @__PURE__ */ jsxs41("div", { className: "mt-4", children: [
11183
+ /* @__PURE__ */ jsx89("div", { className: "mb-2 text-sm font-medium text-ant-color-text", children: "\u5BFC\u5165\u9884\u89C8" }),
11184
+ /* @__PURE__ */ jsx89(
11185
+ Table3,
11186
+ {
11187
+ size: "small",
11188
+ dataSource: importPreview,
11189
+ columns: importPreviewColumns,
11190
+ scroll: { x: Math.max(600, (importPreviewColumns?.length || 0) * 150) },
11191
+ pagination: false,
11192
+ rowKey: (_, index) => String(index)
11193
+ }
11194
+ )
11195
+ ] })
11196
+ ]
11197
+ }
11198
+ ),
11199
+ /* @__PURE__ */ jsxs41(
11200
+ Drawer2,
11201
+ {
11202
+ getContainer: false,
11203
+ rootStyle: { position: "absolute" },
11204
+ styles: { body: { padding: 24, overflow: "auto" } },
11205
+ title: recordTab === "import" ? "\u5BFC\u5165\u8BB0\u5F55" : "\u5BFC\u51FA\u8BB0\u5F55",
11206
+ open: recordsOpen,
11207
+ width: 720,
11208
+ onClose: () => setRecordsOpen(false),
11209
+ children: [
10639
11210
  /* @__PURE__ */ jsx89(
10640
11211
  Segmented,
10641
11212
  {
10642
- block: true,
10643
- value: detailOpenMode,
11213
+ value: recordTab,
10644
11214
  options: [
10645
- { label: "\u62BD\u5C49", value: "drawer" },
10646
- { label: "\u65B0\u9875", value: "newPage" }
11215
+ { label: "\u5BFC\u5165\u8BB0\u5F55", value: "import" },
11216
+ { label: "\u5BFC\u51FA\u8BB0\u5F55", value: "export" }
10647
11217
  ],
10648
- onChange: (value) => setDetailOpenMode(value)
11218
+ onChange: (value) => loadTransferRecords(value)
10649
11219
  }
10650
- )
10651
- ] }),
10652
- /* @__PURE__ */ jsxs41("div", { children: [
10653
- /* @__PURE__ */ jsx89("div", { className: "mb-2 text-sm font-medium text-ant-color-text", children: "\u9875\u5927\u5C0F" }),
11220
+ ),
10654
11221
  /* @__PURE__ */ jsx89(
10655
- Select6,
11222
+ Table3,
10656
11223
  {
10657
- className: "w-full",
10658
- value: pageSize,
10659
- options: [10, 20, 50, 100].map((value) => ({ label: `${value} \u6761`, value })),
10660
- onChange: setPageSize
11224
+ className: "mt-4",
11225
+ size: "small",
11226
+ dataSource: transferRecords,
11227
+ rowKey: (record) => record.id || record.recordId
10661
11228
  }
10662
11229
  )
10663
- ] })
10664
- ] })
10665
- ] })
10666
- }
10667
- ),
10668
- /* @__PURE__ */ jsx89(
10669
- Modal8,
10670
- {
10671
- getContainer: false,
10672
- title: exportScope === "selected" ? "\u5BFC\u51FA\u9009\u4E2D\u6570\u636E" : "\u5BFC\u51FA\u5168\u90E8\u6570\u636E",
10673
- open: exportOpen,
10674
- onCancel: () => setExportOpen(false),
10675
- footer: /* @__PURE__ */ jsxs41(Space9, { children: [
10676
- /* @__PURE__ */ jsx89(Button15, { onClick: () => setExportOpen(false), children: "\u53D6\u6D88" }),
10677
- /* @__PURE__ */ jsx89(
10678
- Button15,
10679
- {
10680
- type: "primary",
10681
- loading: exporting,
10682
- disabled: exportScope === "selected" && selectedRowKeys.length === 0,
10683
- onClick: () => handleExport(exportScope),
10684
- children: exportScope === "selected" ? `\u5BFC\u51FA\u9009\u4E2D (${selectedRowKeys.length})` : "\u5BFC\u51FA\u5168\u90E8"
10685
- }
10686
- )
10687
- ] }),
10688
- children: /* @__PURE__ */ jsx89(
10689
- Checkbox5.Group,
11230
+ ]
11231
+ }
11232
+ ),
11233
+ /* @__PURE__ */ jsx89(
11234
+ Drawer2,
10690
11235
  {
10691
- className: "grid grid-cols-2 gap-2",
10692
- value: exportFields,
10693
- options: fields.map((field) => ({ label: field.label, value: field.fieldId })),
10694
- onChange: (values) => setExportFields(values.map(String))
11236
+ getContainer: false,
11237
+ rootStyle: { position: "absolute" },
11238
+ styles: { body: { padding: 0, overflow: "auto" } },
11239
+ title: "\u8BE6\u60C5",
11240
+ open: detailOpen,
11241
+ width: 720,
11242
+ onClose: () => setDetailOpen(false),
11243
+ destroyOnClose: true,
11244
+ children: activeRecord && detailRenderer ? detailRenderer({
11245
+ record: activeRecord,
11246
+ formInstanceId: String(getRecordId(activeRecord)),
11247
+ onClose: () => setDetailOpen(false)
11248
+ }) : /* @__PURE__ */ jsx89(Empty5, { description: "\u8BF7\u901A\u8FC7 detailRenderer \u63A5\u5165\u8BE6\u60C5\u6A21\u677F" })
10695
11249
  }
10696
- )
10697
- }
10698
- ),
10699
- /* @__PURE__ */ jsx89(
10700
- Modal8,
10701
- {
10702
- getContainer: false,
10703
- title: "\u6279\u91CF\u5BA1\u6279",
10704
- open: batchApprovalOpen,
10705
- onCancel: () => setBatchApprovalOpen(false),
10706
- onOk: handleBatchApprovalConfirm,
10707
- okText: batchApprovalAction === "approved" ? "\u786E\u8BA4\u901A\u8FC7" : "\u786E\u8BA4\u62D2\u7EDD",
10708
- confirmLoading: batchApproving,
10709
- children: /* @__PURE__ */ jsxs41("div", { className: "space-y-4", children: [
10710
- /* @__PURE__ */ jsxs41("div", { className: "text-sm text-ant-color-text-secondary", children: [
10711
- "\u5DF2\u9009\u62E9 ",
10712
- selectedRowKeys.length,
10713
- " \u6761\u8BB0\u5F55"
10714
- ] }),
10715
- /* @__PURE__ */ jsx89(
10716
- Segmented,
10717
- {
10718
- block: true,
10719
- value: batchApprovalAction,
10720
- options: [
10721
- { label: "\u540C\u610F", value: "approved" },
10722
- { label: "\u62D2\u7EDD", value: "rejected" }
10723
- ],
10724
- onChange: (value) => setBatchApprovalAction(value)
10725
- }
10726
- ),
10727
- /* @__PURE__ */ jsx89(
10728
- Input12.TextArea,
10729
- {
10730
- value: batchApprovalComments,
10731
- rows: 4,
10732
- maxLength: 500,
10733
- showCount: true,
10734
- placeholder: "\u586B\u5199\u5BA1\u6279\u610F\u89C1",
10735
- onChange: (event) => setBatchApprovalComments(event.target.value)
10736
- }
10737
- )
10738
- ] })
10739
- }
10740
- ),
10741
- /* @__PURE__ */ jsxs41(
10742
- Modal8,
10743
- {
10744
- getContainer: false,
10745
- title: "\u5BFC\u5165\u6570\u636E",
10746
- open: importOpen,
10747
- width: 720,
10748
- onCancel: () => setImportOpen(false),
10749
- onOk: handleImportConfirm,
10750
- okButtonProps: { disabled: !importBase64 },
10751
- okText: "\u786E\u8BA4\u5BFC\u5165",
10752
- children: [
10753
- /* @__PURE__ */ jsx89(
10754
- Upload3.Dragger,
10755
- {
10756
- accept: ".xlsx,.xls",
10757
- maxCount: 1,
10758
- beforeUpload: handleImportPreview,
10759
- onRemove: () => {
10760
- setImportBase64("");
10761
- setImportPreview([]);
10762
- },
10763
- children: /* @__PURE__ */ jsx89("p", { className: "text-ant-color-text-secondary", children: "\u62D6\u62FD Excel \u6587\u4EF6\u5230\u6B64\u5904\uFF0C\u6216\u70B9\u51FB\u9009\u62E9\u6587\u4EF6" })
10764
- }
10765
- ),
10766
- importPreview.length > 0 && /* @__PURE__ */ jsxs41("div", { className: "mt-4", children: [
10767
- /* @__PURE__ */ jsx89("div", { className: "mb-2 text-sm font-medium text-ant-color-text", children: "\u5BFC\u5165\u9884\u89C8" }),
10768
- /* @__PURE__ */ jsx89(
10769
- Table3,
10770
- {
10771
- size: "small",
10772
- dataSource: importPreview,
10773
- columns: importPreviewColumns,
10774
- scroll: { x: Math.max(600, (importPreviewColumns?.length || 0) * 150) },
10775
- pagination: false,
10776
- rowKey: (_, index) => String(index)
11250
+ ),
11251
+ /* @__PURE__ */ jsx89(
11252
+ Drawer2,
11253
+ {
11254
+ getContainer: false,
11255
+ rootStyle: { position: "absolute" },
11256
+ styles: { body: { padding: 0, overflow: "auto" } },
11257
+ title: "\u65B0\u589E\u6570\u636E",
11258
+ open: submitOpen,
11259
+ width: 720,
11260
+ onClose: () => setSubmitOpen(false),
11261
+ destroyOnClose: true,
11262
+ children: submitRenderer ? submitRenderer({
11263
+ onClose: () => setSubmitOpen(false),
11264
+ onSubmitted: () => {
11265
+ setSubmitOpen(false);
11266
+ loadData({ current: 1, pageSize });
10777
11267
  }
10778
- )
10779
- ] })
10780
- ]
10781
- }
10782
- ),
10783
- /* @__PURE__ */ jsxs41(
10784
- Drawer2,
10785
- {
10786
- getContainer: false,
10787
- title: recordTab === "import" ? "\u5BFC\u5165\u8BB0\u5F55" : "\u5BFC\u51FA\u8BB0\u5F55",
10788
- open: recordsOpen,
10789
- width: 720,
10790
- onClose: () => setRecordsOpen(false),
10791
- children: [
10792
- /* @__PURE__ */ jsx89(
10793
- Segmented,
10794
- {
10795
- value: recordTab,
10796
- options: [
10797
- { label: "\u5BFC\u5165\u8BB0\u5F55", value: "import" },
10798
- { label: "\u5BFC\u51FA\u8BB0\u5F55", value: "export" }
10799
- ],
10800
- onChange: (value) => loadTransferRecords(value)
10801
- }
10802
- ),
10803
- /* @__PURE__ */ jsx89(
10804
- Table3,
10805
- {
10806
- className: "mt-4",
10807
- size: "small",
10808
- dataSource: transferRecords,
10809
- rowKey: (record) => record.id || record.recordId
10810
- }
10811
- )
10812
- ]
10813
- }
10814
- ),
10815
- /* @__PURE__ */ jsx89(
10816
- Drawer2,
10817
- {
10818
- getContainer: false,
10819
- title: "\u8BE6\u60C5",
10820
- open: detailOpen,
10821
- width: 720,
10822
- onClose: () => setDetailOpen(false),
10823
- destroyOnClose: true,
10824
- children: activeRecord && detailRenderer ? detailRenderer({
10825
- record: activeRecord,
10826
- formInstanceId: String(getRecordId(activeRecord)),
10827
- onClose: () => setDetailOpen(false)
10828
- }) : /* @__PURE__ */ jsx89(Empty5, { description: "\u8BF7\u901A\u8FC7 detailRenderer \u63A5\u5165\u8BE6\u60C5\u6A21\u677F" })
10829
- }
10830
- ),
10831
- /* @__PURE__ */ jsx89(
10832
- Drawer2,
10833
- {
10834
- getContainer: false,
10835
- title: "\u65B0\u589E\u6570\u636E",
10836
- open: submitOpen,
10837
- width: 720,
10838
- onClose: () => setSubmitOpen(false),
10839
- destroyOnClose: true,
10840
- children: submitRenderer ? submitRenderer({
10841
- onClose: () => setSubmitOpen(false),
10842
- onSubmitted: () => {
10843
- setSubmitOpen(false);
10844
- loadData({ current: 1, pageSize });
11268
+ }) : /* @__PURE__ */ jsx89(Empty5, { description: "\u8BF7\u901A\u8FC7 submitRenderer \u63A5\u5165\u63D0\u4EA4\u6A21\u677F" })
10845
11269
  }
10846
- }) : /* @__PURE__ */ jsx89(Empty5, { description: "\u8BF7\u901A\u8FC7 submitRenderer \u63A5\u5165\u63D0\u4EA4\u6A21\u677F" })
10847
- }
10848
- )
10849
- ] }) });
11270
+ )
11271
+ ]
11272
+ }
11273
+ ) });
10850
11274
  };
10851
11275
 
10852
11276
  // src/templates/FormSubmitTemplate.tsx
@@ -11104,52 +11528,66 @@ var InnerFormContent = ({
11104
11528
  actions,
11105
11529
  inDrawer,
11106
11530
  position: "inline",
11107
- className: "mt-6 -mx-5 -mb-5 rounded-b-lg md:-mx-6 md:-mb-6"
11531
+ className: inDrawer ? "mt-5 -mx-4 -mb-4 rounded-b-lg md:-mx-5 md:-mb-5" : "mt-6 -mx-5 -mb-5 rounded-b-lg md:-mx-6 md:-mb-6"
11108
11532
  }
11109
11533
  ) : null;
11110
- return /* @__PURE__ */ jsxs42(RuntimePageShell, { inDrawer, children: [
11111
- /* @__PURE__ */ jsxs42("div", { className: "space-y-6", children: [
11112
- header,
11113
- enableDraft && hasDraft && !submitted && /* @__PURE__ */ jsx90("div", { children: /* @__PURE__ */ jsx90(
11114
- DraftManager,
11115
- {
11116
- hasDraft,
11117
- draftTimestamp,
11118
- onRestore: handleRestoreDraft,
11119
- onDiscard: clearDraft
11120
- }
11121
- ) }),
11122
- !submitted ? /* @__PURE__ */ jsxs42("div", { className: "rounded-lg border border-ant-border-secondary bg-ant-bg-container p-5 md:p-6", children: [
11123
- departmentSelector,
11124
- beforeForm,
11125
- renderForm ? renderForm({ schema, config }) : /* @__PURE__ */ jsx90(FormRenderer, { columns: 2 }),
11126
- afterForm,
11127
- actionsNode
11128
- ] }) : successInfo && /* @__PURE__ */ jsx90(
11129
- SubmitSuccessCard,
11130
- {
11131
- info: successInfo,
11132
- mode: submitSuccessMode,
11133
- isRedirecting,
11134
- countdown,
11135
- onContinue: handleContinue,
11136
- onViewDetail: handleViewDetail,
11137
- renderSuccess
11138
- }
11139
- ),
11140
- footer
11141
- ] }),
11142
- /* @__PURE__ */ jsx90(
11143
- ProcessPreview,
11144
- {
11145
- open: previewOpen,
11146
- routes: previewRoutes,
11147
- loading: previewLoading,
11148
- onClose: () => setPreviewOpen(false),
11149
- onConfirm: handlePreviewConfirm
11150
- }
11151
- )
11152
- ] });
11534
+ return /* @__PURE__ */ jsxs42(
11535
+ RuntimePageShell,
11536
+ {
11537
+ inDrawer,
11538
+ maxWidth: inDrawer ? "100%" : 1240,
11539
+ contentClassName: inDrawer ? "px-4 py-4 md:px-5" : "py-4 md:py-6",
11540
+ children: [
11541
+ /* @__PURE__ */ jsxs42("div", { className: "space-y-6", children: [
11542
+ header,
11543
+ enableDraft && hasDraft && !submitted && /* @__PURE__ */ jsx90("div", { children: /* @__PURE__ */ jsx90(
11544
+ DraftManager,
11545
+ {
11546
+ hasDraft,
11547
+ draftTimestamp,
11548
+ onRestore: handleRestoreDraft,
11549
+ onDiscard: clearDraft
11550
+ }
11551
+ ) }),
11552
+ !submitted ? /* @__PURE__ */ jsxs42(
11553
+ "div",
11554
+ {
11555
+ className: `rounded-lg border border-ant-border-secondary bg-ant-bg-container ${inDrawer ? "p-4 md:p-5" : "p-5 shadow-sm md:p-6"}`,
11556
+ children: [
11557
+ departmentSelector,
11558
+ beforeForm,
11559
+ renderForm ? renderForm({ schema, config }) : /* @__PURE__ */ jsx90(FormRenderer, { columns: 2 }),
11560
+ afterForm,
11561
+ actionsNode
11562
+ ]
11563
+ }
11564
+ ) : successInfo && /* @__PURE__ */ jsx90(
11565
+ SubmitSuccessCard,
11566
+ {
11567
+ info: successInfo,
11568
+ mode: submitSuccessMode,
11569
+ isRedirecting,
11570
+ countdown,
11571
+ onContinue: handleContinue,
11572
+ onViewDetail: handleViewDetail,
11573
+ renderSuccess
11574
+ }
11575
+ ),
11576
+ footer
11577
+ ] }),
11578
+ /* @__PURE__ */ jsx90(
11579
+ ProcessPreview,
11580
+ {
11581
+ open: previewOpen,
11582
+ routes: previewRoutes,
11583
+ loading: previewLoading,
11584
+ onClose: () => setPreviewOpen(false),
11585
+ onConfirm: handlePreviewConfirm
11586
+ }
11587
+ )
11588
+ ]
11589
+ }
11590
+ );
11153
11591
  };
11154
11592
  var FormSubmitTemplate = ({
11155
11593
  schema,
@@ -11196,6 +11634,7 @@ var FormSubmitTemplate = ({
11196
11634
 
11197
11635
  // src/templates/FormDetailTemplate.tsx
11198
11636
  import { useCallback as useCallback19, useMemo as useMemo19, useRef as useRef15, useState as useState37 } from "react";
11637
+ import dayjs6 from "dayjs";
11199
11638
 
11200
11639
  // src/templates/PageSkeleton.tsx
11201
11640
  import { Skeleton as Skeleton3 } from "antd";
@@ -11267,6 +11706,11 @@ function FormDataBridge({
11267
11706
  formDataRef.current = getFormData2;
11268
11707
  return null;
11269
11708
  }
11709
+ var formatDateTime2 = (value) => {
11710
+ if (!value || typeof value !== "string") return value || "-";
11711
+ const parsed = dayjs6(value);
11712
+ return parsed.isValid() ? parsed.format("YYYY-MM-DD HH:mm:ss") : value;
11713
+ };
11270
11714
  var InnerDetailContent = ({
11271
11715
  schema,
11272
11716
  formUuid,
@@ -11377,14 +11821,36 @@ var InnerDetailContent = ({
11377
11821
  renderSummary && instanceInfo ? renderSummary(instanceInfo) : /* @__PURE__ */ jsx92(
11378
11822
  SummaryPanel,
11379
11823
  {
11380
- title: instanceInfo?.title || formData?.instanceTitle || schema.formMeta.title,
11824
+ title: instanceInfo?.title || instanceInfo?.instanceTitle || schema.formMeta.title,
11381
11825
  eyebrow: `\u6570\u636E\u5B9E\u4F8B ${formInstanceId?.slice(0, 8) || "-"}`,
11382
- creator: instanceInfo?.creator ? {
11383
- name: instanceInfo.creator.name,
11384
- avatar: instanceInfo.creator.avatar,
11385
- department: instanceInfo.creator.department
11826
+ creator: instanceInfo?.creator || instanceInfo?.createdByName ? {
11827
+ name: instanceInfo?.creator?.name || instanceInfo?.createdByName,
11828
+ avatar: instanceInfo?.creator?.avatar,
11829
+ department: instanceInfo?.creator?.department || instanceInfo?.createdByDepartmentName
11386
11830
  } : void 0,
11387
- createdAt: instanceInfo?.createdAt,
11831
+ createdAt: formatDateTime2(instanceInfo?.createdAt),
11832
+ metaItems: [
11833
+ {
11834
+ key: "creator",
11835
+ label: "\u521B\u5EFA\u4EBA",
11836
+ value: instanceInfo?.creator?.name || instanceInfo?.createdByName || "\u672A\u77E5\u7528\u6237"
11837
+ },
11838
+ {
11839
+ key: "department",
11840
+ label: "\u521B\u5EFA\u4EBA\u90E8\u95E8",
11841
+ value: instanceInfo?.creator?.department || instanceInfo?.createdByDepartmentName || "-"
11842
+ },
11843
+ {
11844
+ key: "createdAt",
11845
+ label: "\u521B\u5EFA\u65F6\u95F4",
11846
+ value: formatDateTime2(instanceInfo?.createdAt)
11847
+ },
11848
+ {
11849
+ key: "updatedAt",
11850
+ label: "\u66F4\u65B0\u65F6\u95F4",
11851
+ value: formatDateTime2(instanceInfo?.updatedAt)
11852
+ }
11853
+ ],
11388
11854
  status: mode === "edit" ? { label: "\u7F16\u8F91\u4E2D", tone: "brand" } : void 0
11389
11855
  }
11390
11856
  ),
@@ -11731,6 +12197,7 @@ export {
11731
12197
  defineFormSchema,
11732
12198
  deleteDataManagementRows,
11733
12199
  deleteFormData,
12200
+ downloadDataManagementImportTemplate,
11734
12201
  evaluateEffects,
11735
12202
  exportDataManagementRows,
11736
12203
  extractFormValues,