From 682124f3e573a24523dd643f23d16bb7d3c7e08d Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期二, 29 九月 2026 18:22:17 +0800
Subject: [PATCH] fix(inventory): 移除不合格库存相关字段并修复日期时间处理

---
 src/utils/index.js |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/src/utils/index.js b/src/utils/index.js
index 73f6b5f..aee9fa7 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -41,6 +41,32 @@
 }
 
 /**
+ * 琛ュ叏鏃跺垎绉掞紝杈撳嚭 YYYY-MM-DD HH:mm:ss锛岀敤浜庡悗绔� LocalDateTime 瀛楁銆�
+ * 鍏煎 Date 瀵硅薄銆�"YYYY-MM-DD"銆�"YYYY-MM-DD HH:mm"銆�"YYYY-MM-DDTHH:mm:ss" 绛夎緭鍏ワ紱
+ * 绌哄�煎師鏍疯繑鍥炪��
+ */
+export function toDateTimeString(value) {
+  if (value == null || value === "") return value;
+  if (value instanceof Date) {
+    if (Number.isNaN(value.getTime())) return "";
+    const pad = (num) => String(num).padStart(2, "0");
+    return `${value.getFullYear()}-${pad(value.getMonth() + 1)}-${pad(
+      value.getDate()
+    )} ${pad(value.getHours())}:${pad(value.getMinutes())}:${pad(
+      value.getSeconds()
+    )}`;
+  }
+  const [datePart, timePart = ""] = String(value)
+    .trim()
+    .replace("T", " ")
+    .split(/\s+/);
+  const timeUnits = timePart.split(":").filter((unit) => unit !== "");
+  while (timeUnits.length < 3) timeUnits.push("00");
+  const time = timeUnits.map((unit) => unit.padStart(2, "0")).join(":");
+  return `${datePart} ${time}`;
+}
+
+/**
  * @param {number} time
  * @param {string} option
  * @returns {string}

--
Gitblit v1.9.3