From 2cea35752e8b86dc1efdc5542fbb792272d1c799 Mon Sep 17 00:00:00 2001
From: zhang_nuo <zhang_12370@163.com>
Date: 星期一, 17 八月 2026 17:21:08 +0800
Subject: [PATCH] 将意博凯新修改的年月日同步到 环境工程和奇缘恒艺

---
 src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js |   74 ++++++++++++++++++++++++++-----------
 1 files changed, 52 insertions(+), 22 deletions(-)

diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js b/src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js
index 517e01c..e92dc97 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js
@@ -1,6 +1,9 @@
 import dayjs from "dayjs";
 import { getTypeEnums } from "@/api/basicData/enum.js";
-import { TEMPLATE_TYPE_CUSTOM } from "@/api/officeProcessAutomation/approvalTemplate.js";
+import {
+  TEMPLATE_TYPE_BUILTIN,
+  TEMPLATE_TYPE_CUSTOM,
+} from "@/api/officeProcessAutomation/approvalTemplate.js";
 import { APPROVAL_TYPE_OPTIONS } from "../approve-list/approveListConstants.js";
 import {
   buildFormConfigJson,
@@ -42,6 +45,11 @@
   } catch {
     return [];
   }
+}
+
+/** 鏄惁涓虹郴缁熷唴缃ā鏉匡紙templateType === 0锛� */
+export function isBuiltinTemplate(row) {
+  return Number(row?.templateType) === TEMPLATE_TYPE_BUILTIN;
 }
 
 /** 鑺傜偣鍐呭鎵规柟寮忥細浼氱 / 鎴栫 */
@@ -147,24 +155,31 @@
   return { createdTime, updatedTime, createTime: createdTime, updateTime: updatedTime };
 }
 
-function normalizeTimeValue(val) {
-  if (val == null || val === "") return "";
-  if (Array.isArray(val) && val.length >= 3) {
-    const [y, m, d, h = 0, min = 0, s = 0] = val;
-    return dayjs(new Date(y, m - 1, d, h, min, s)).format("YYYY-MM-DD HH:mm:ss");
-  }
-  if (typeof val === "number") {
-    const d = val > 1e12 ? dayjs(val) : dayjs.unix(val);
-    return d.isValid() ? d.format("YYYY-MM-DD HH:mm:ss") : "";
-  }
-  const s = String(val).trim();
-  if (!s) return "";
-  const parsed = dayjs(s.includes("T") ? s : s.replace(/-/g, "/"));
-  return parsed.isValid() ? parsed.format("YYYY-MM-DD HH:mm:ss") : s;
+
+/**
+ * @param {any} val 鏃堕棿鍊�
+ * @param {boolean} [onlyDate=true] true:鍙勾鏈堟棩锛宖alse:骞存湀鏃ユ椂鍒嗙
+ */
+function normalizeTimeValue(val, onlyDate = true) {
+    if (val == null || val === "") return "";
+    const fmt = onlyDate ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm:ss";
+
+    if (Array.isArray(val) && val.length >= 3) {
+        const [y, m, d, h = 0, min = 0, s = 0] = val;
+        return dayjs(new Date(y, m - 1, d, h, min, s)).format(fmt);
+    }
+    if (typeof val === "number") {
+        const d = val > 1e12 ? dayjs(val) : dayjs.unix(val);
+        return d.isValid() ? d.format(fmt) : "";
+    }
+    const s = String(val).trim();
+    if (!s) return "";
+    const parsed = dayjs(s.includes("T") ? s : s.replace(/-/g, "/"));
+    return parsed.isValid() ? parsed.format(fmt) : s;
 }
 
-export function formatDisplayTime(val) {
-  const t = normalizeTimeValue(val);
+export function formatDisplayTime(val,onlyDate) {
+  const t = normalizeTimeValue(val,onlyDate);
   return t || "鈥�";
 }
 
@@ -176,6 +191,18 @@
   if (data.approvalTemplateVo) return data.approvalTemplateVo;
   if (data.records && data.records[0]) return data.records[0];
   return data;
+}
+
+/** 鍚庣闄勪欢瀛楁 鈫� 椤甸潰 storageBlobDTOs */
+export function mapAttachmentsFromApi(row) {
+  const list =
+    row?.storageBlobDTOs ||
+    row?.storageBlobDTOS ||
+    row?.storageBlobVOS ||
+    row?.storageBlobVOList ||
+    row?.attachmentList ||
+    [];
+  return Array.isArray(list) ? list : [];
 }
 
 /** 鍒嗛〉鍒楄〃椤� 鈫� 椤甸潰琛屾暟鎹紙涓昏〃 + 鑺傜偣锛� */
@@ -193,6 +220,7 @@
     businessType: row.businessType ?? "",
     formConfig: row.formConfig,
     formConfigData: parseFormConfigToData(row.formConfig),
+    storageBlobDTOs: mapAttachmentsFromApi(row),
     createdUser: row.createdUser,
     createdUserName: row.createdUserName,
     ...times,
@@ -209,7 +237,8 @@
     templateName: (form.templateName || "").trim(),
     description: (form.description || "").trim(),
     enabled: mapEnabledToApi(form.enabled),
-    templateType: TEMPLATE_TYPE_CUSTOM,
+    templateType:
+      form.templateType != null ? Number(form.templateType) : TEMPLATE_TYPE_CUSTOM,
     businessType: form.businessType ?? "",
     formConfig: buildFormConfigJson(form.formConfigData),
     nodes: nodes.map((n, i) => {
@@ -236,16 +265,15 @@
     }),
   };
   if (templateId) dto.id = templateId;
+  const attachments = Array.isArray(form.storageBlobDTOs) ? form.storageBlobDTOs : [];
+  if (attachments.length) dto.storageBlobDTOs = attachments;
   return dto;
 }
 
-export function buildApprovalTemplateListParams({ page, searchForm, templateType = TEMPLATE_TYPE_CUSTOM }) {
+export function buildApprovalTemplateListParams({ page, searchForm }) {
   const params = {
     current: page.current,
     size: page.size,
-    templateType: searchForm?.templateType != null && searchForm.templateType !== ""
-      ? searchForm.templateType
-      : templateType,
   };
   const kw = (searchForm?.keyword || "").trim();
   if (kw) params.templateName = kw;
@@ -275,11 +303,13 @@
     templateName: "",
     description: "",
     templateType: TEMPLATE_TYPE_CUSTOM,
+    lockedFormFieldUids: [],
     businessType: "",
     formConfig: "",
     formConfigData: createEmptyFormConfigData(),
     enabled: true,
     flowNodes: [createEmptyNode(1)],
+    storageBlobDTOs: [],
   };
 }
 

--
Gitblit v1.9.3