From 1bf19d1f0599f1e100fd4f71cf2cf4f1f3fd0bb1 Mon Sep 17 00:00:00 2001 From: hongchao <3228015117@qq.com> Date: Fri, 28 Feb 2025 11:31:25 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A3=85=E5=A4=87=E4=BB=A3=E7=A0=81=E6=81=A2?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/user/goodsManagement/index.vue | 25 +++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/views/user/goodsManagement/index.vue b/src/views/user/goodsManagement/index.vue index c8fba05..898c6c8 100644 --- a/src/views/user/goodsManagement/index.vue +++ b/src/views/user/goodsManagement/index.vue @@ -1441,6 +1441,25 @@ const changeNextDate = (row: any) => { } } } + + +const getUpdateTimeBgColor = (row: any) => { + // 将字符串日期转换为 Date 对象 + const checkDate = new Date(); + const nextCheckDate = new Date(row.nextCheckDate); + + // 计算两个日期之间的差值(以毫秒为单位) + const diffTime = Math.abs(nextCheckDate - checkDate); + // 将差值转换为天数 + const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)); + + if (checkDate < nextCheckDate && diffDays <= 30) { + return '#FFFFCC'; // 黄色背景 + } else if (checkDate > nextCheckDate) { + return '#FFCCCC'; // 红色背景 + } + return ''; // 返回空字符串,让背景色保持默认 +}; - + + +