From ee42bf1badae06026efa79dc17d2a541297ab49b Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 03 九月 2025 17:43:31 +0800
Subject: [PATCH] 采购管理整体样式优化,搜索条件修改
---
src/utils/ruoyi.js | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/src/utils/ruoyi.js b/src/utils/ruoyi.js
index 9a10326..624fe97 100644
--- a/src/utils/ruoyi.js
+++ b/src/utils/ruoyi.js
@@ -224,3 +224,33 @@
return true;
}
}
+
+/**
+* 灏嗘棩鏈熻浆鎹负YYYY-MM-DD鏍煎紡
+* @param {*} dateSource 鏃ユ湡婧愶紙鍙互鏄椂闂存埑鎴朌ate瀵硅薄锛�
+* @returns 鏍煎紡鍖栧悗鐨勬棩鏈熷瓧绗︿覆 YYYY-MM-DD
+*/
+export function formatDateToYMD(dateSource) {
+ let date;
+ // 澶勭悊锛氬鏋滄槸鏃堕棿鎴筹紝鍏堣浆涓篋ate瀵硅薄
+ if (typeof dateSource === 'number') {
+ date = new Date(dateSource);
+ }
+ // 澶勭悊锛氬鏋滄槸Date瀵硅薄锛岀洿鎺ヤ娇鐢�
+ else if (dateSource instanceof Date) {
+ date = dateSource;
+ }
+ // 寮傚父鎯呭喌锛氳繑鍥炵┖
+ else {
+ return '';
+ }
+
+ // 琛ラ浂鍑芥暟锛氱‘淇濇湀/鏃ユ槸涓や綅鏁�
+ const padZero = (num) => num.toString().padStart(2, '0');
+
+ const year = date.getFullYear();
+ const month = padZero(date.getMonth() + 1);
+ const day = padZero(date.getDate());
+
+ return `${year}-${month}-${day}`;
+}
--
Gitblit v1.9.3