This commit is contained in:
chenlin
2026-01-08 11:26:13 +08:00
2 changed files with 16 additions and 15 deletions

View File

@@ -61,7 +61,8 @@
<div class="safe-wrapper">
<span class="safe-title">
<img width="22" style="margin: 3px 5px 0 0" src="@/assets/images/ybp_icon.png" />
安全指数:<p title="安全指数 = 逾期隐患百分比 × 60% + 安全考核通过率 × 20% + 安全培训完成率 × 20%"></p>
安全指数:<p title="安全指数 = (1-逾期隐患百分比) × 40% + 安全考核通过率 × 10% + 安全培训完成率 × 10%
+ 安全类工单完成率 × 20% + 工程类工单完成率 × 20%"></p>
</span>
<span class="pending-count">{{ hiddenDangerData?.safetyIndex || 0 }}</span>
</div>

View File

@@ -2,9 +2,9 @@
<div class="left-bottom">
<div class="panel-title">
<div class="tabs">
<span class="tab" :class="{ active: activeTab === '安全类' }" @click="handleTabClick('安全类')">安全类</span>
<span class="tab" :class="{ active: activeTab === '安全类事项' }" @click="handleTabClick('安全类事项')">安全类事项</span>
<span class="divider">|</span>
<span class="tab" :class="{ active: activeTab === '工程类' }" @click="handleTabClick('工程类')">工程类</span>
<span class="tab" :class="{ active: activeTab === '工程类事项' }" @click="handleTabClick('工程类事项')">工程类事项</span>
</div>
</div>
<img class="title-line" src="@/assets/images/title_border_line.png" />
@@ -49,7 +49,7 @@ import { computed, ref, watch } from 'vue'
import { ElTooltip } from 'element-plus'
import type { EChartsOption } from 'echarts'
type TabType = '安全类' | '工程类'
type TabType = '安全类事项' | '工程类事项'
type StatusKey = 'notStarted' | 'inProgress' | 'done' | 'voided'
interface ChartItem {
@@ -67,12 +67,12 @@ const statusList: { key: StatusKey; label: string; color: string }[] = [
]
const defaultChart: ChartItem[] = [
{ title: '每日检查(维保类)', total: 6, rate: 0, status: { notStarted: 3, inProgress: 0, done: 3, voided: 0 } },
{ title: '每月检查(维保类)', total: 6, rate: 0, status: { notStarted: 3, inProgress: 0, done: 3, voided: 0 } },
{ title: '每年检查(维保类)', total: 6, rate: 0, status: { notStarted: 3, inProgress: 0, done: 3, voided: 0 } },
{ title: '每日检查(巡检类)', total: 6, rate: 0, status: { notStarted: 3, inProgress: 0, done: 3, voided: 0 } },
{ title: '每月检查(巡检类)', total: 6, rate: 0, status: { notStarted: 3, inProgress: 0, done: 3, voided: 0 } },
{ title: '每年检查(巡检类)', total: 6, rate: 0, status: { notStarted: 3, inProgress: 0, done: 3, voided: 0 } }
{ title: '当日维保', total: 6, rate: 0, status: { notStarted: 3, inProgress: 0, done: 3, voided: 0 } },
{ title: '本月维保', total: 6, rate: 0, status: { notStarted: 3, inProgress: 0, done: 3, voided: 0 } },
{ title: '本年维保', total: 6, rate: 0, status: { notStarted: 3, inProgress: 0, done: 3, voided: 0 } },
{ title: '当日巡检', total: 6, rate: 0, status: { notStarted: 3, inProgress: 0, done: 3, voided: 0 } },
{ title: '本月巡检', total: 6, rate: 0, status: { notStarted: 3, inProgress: 0, done: 3, voided: 0 } },
{ title: '本年巡检', total: 6, rate: 0, status: { notStarted: 3, inProgress: 0, done: 3, voided: 0 } }
]
const handleChartTitleClick = () => {
@@ -80,23 +80,23 @@ const handleChartTitleClick = () => {
}
const tabCharts = ref<Record<TabType, ChartItem[]>>({
安全类: [...defaultChart],
工程类: [...defaultChart]
安全类事项: [...defaultChart],
工程类事项: [...defaultChart]
})
const props = defineProps<{
riskStatistics?: Record<TabType, ChartItem[]>
}>()
const activeTab = ref<TabType>('安全类')
const activeTab = ref<TabType>('安全类事项')
const emit = defineEmits<{ tabChange: [tab: TabType] }>()
// 监听props变化更新图表数据
watch(() => props.riskStatistics, (newData) => {
if (newData) {
tabCharts.value = {
安全类: newData['安全类'] ? JSON.parse(JSON.stringify(newData['安全类'])) : [...defaultChart],
工程类: newData['工程类'] ? JSON.parse(JSON.stringify(newData['工程类'])) : [...defaultChart]
安全类事项: newData['安全类事项'] ? JSON.parse(JSON.stringify(newData['安全类事项'])) : [...defaultChart],
工程类事项: newData['工程类事项'] ? JSON.parse(JSON.stringify(newData['工程类事项'])) : [...defaultChart]
}
}
}, { deep: true, immediate: true })