fix 79311

This commit is contained in:
danshihao
2023-12-26 09:33:56 +08:00
parent 89588d1bea
commit 433af730c0
@@ -129,10 +129,10 @@
</template>
<!-- 计划稽查日期 到期前一周标红 -->
<template slot="scheduledCheckDate" slot-scope="{text}">
<template slot="scheduledCheckDate" slot-scope="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<div class="table-text" :class="{'table-red-text': text && new Date(Date.parse(text)) > sevenDaysAgo}">{{ text || text === 0 ? text : global.emptyLine }}</div>
<div class="table-text" :class="{'table-red-text': isMarkRed(record)}">{{ text || text === 0 ? text : global.emptyLine }}</div>
</a-tooltip>
</template>
@@ -185,6 +185,8 @@ import DeferredCheckModal from './modules/DeferredCheckModal'
// 稽查报告弹框
import CheckReportModal from './modules/CheckReportModal'
import RectificationPlanModal from './modules/RectificationPlanModal'
import { InspectStatus } from '@/enums/commonEnums'
import moment from 'moment'
export default {
name: 'CheckList',
@@ -335,6 +337,19 @@ export default {
},
methods: {
isHasPermission,
/**
* 是否标红
* @description fix:79388((进行中 || 稽查中) && 到期前一周) || 拖期
* @param record
* @return {boolean}
*/
isMarkRed (record) {
// 是否进行中或稽查中
const state = [InspectStatus.inProgress.value, InspectStatus.underInspection.value].includes(record.inspectStatus + '')
// 是否到期前一周(比较当前天和每条数据的计划稽查日期小于7天)
const isExpireOneWeek = moment().diff(moment(record.planInspectDate), 'days') < 7
return (state && isExpireOneWeek) || record.inspectStatus === InspectStatus.delay.value
},
// 获取七天前日期
getSevenDaysAgo () {
const dateStr = new Date().getFullYear() + '-' + (new Date().getMonth() + 1) + '-' + (new Date().getDate() - 7)