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 | 39 +++++++++++++++++++++++----------------
1 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js b/src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js
index 727f896..e92dc97 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-template/approveTemplateConstants.js
@@ -155,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 || "鈥�";
}
--
Gitblit v1.9.3