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 ''; // 返回空字符串,让背景色保持默认 +}; - + + +