装备代码恢复

This commit is contained in:
hongchao 2025-02-28 11:31:25 +08:00
parent d755f2a60e
commit 1bf19d1f05
1 changed files with 24 additions and 1 deletions

View File

@ -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 ''; //
};
</script>
<template>
@ -1596,7 +1615,11 @@ const changeNextDate = (row: any) => {
</template>
</el-table-column>
<el-table-column align="center" prop="typeName" label="装备型号" />
<el-table-column align="center" prop="updateTime" label="更新时间" />
<el-table-column align="center" prop="nextCheckDate" label="下次检验日期" >
<template #default="{ row }">
<span :style="{ backgroundColor: getUpdateTimeBgColor(row) }">{{ row.nextCheckDate }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="装备状态">
<template #default="{ row }">
<el-tag v-if="row.maStatus == 0" size="small" type="info">草稿状态</el-tag>