feat(screen): 更新主屏幕组件和风险统计面板

- 调整了组件标签格式,移除多余空格
- 修复了导入语句的空格格式问题
- 更新了JSON解析的空格格式
- 修改了工作订单类型从"安全生产"为"物业服务-安全"
- 增加了API响应数据的rate字段支持
- 将图表中心显示从总数改为完成率百分比
- 将状态标签从"已作废"更新为"已关闭"
- 优化了背景图片的CSS配置
- 添加了空行以提高代码可读性
This commit is contained in:
2025-12-24 10:18:33 +08:00
parent fcb0a38523
commit 301d47368d
2 changed files with 115 additions and 101 deletions

View File

@@ -16,8 +16,8 @@
<div class="chart-wrapper"> <div class="chart-wrapper">
<Echart class="donut-chart" :options="buildOption(item)" /> <Echart class="donut-chart" :options="buildOption(item)" />
<div class="chart-center"> <div class="chart-center">
<div class="center-title">总数</div> <div class="center-title">完成率</div>
<div class="center-value">{{ item.total }}</div> <div class="center-value">{{ item.rate }}%</div>
</div> </div>
</div> </div>
<div class="legend"> <div class="legend">
@@ -55,6 +55,7 @@ type StatusKey = 'notStarted' | 'inProgress' | 'done' | 'voided'
interface ChartItem { interface ChartItem {
title: string title: string
total: number total: number
rate: number
status: Record<StatusKey, number> status: Record<StatusKey, number>
} }
@@ -62,16 +63,16 @@ const statusList: { key: StatusKey; label: string; color: string }[] = [
{ key: 'notStarted', label: '未开始', color: '#2a59ff' }, { key: 'notStarted', label: '未开始', color: '#2a59ff' },
{ key: 'inProgress', label: '进行中', color: '#ff8a00' }, { key: 'inProgress', label: '进行中', color: '#ff8a00' },
{ key: 'done', label: '已完成', color: '#1bd9ff' }, { key: 'done', label: '已完成', color: '#1bd9ff' },
{ key: 'voided', label: '已作废', color: '#9fa0a6' } { key: 'voided', label: '已关闭', color: '#9fa0a6' }
] ]
const defaultChart: ChartItem[] = [ const defaultChart: ChartItem[] = [
{ title: '每日检查(维保类)', total: 6, 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, 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, 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, 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, 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, status: { notStarted: 3, inProgress: 0, done: 3, voided: 0 } } { title: '每年检查(巡检类)', total: 6, rate: 0, status: { notStarted: 3, inProgress: 0, done: 3, voided: 0 } }
] ]
const tabCharts = ref<Record<TabType, ChartItem[]>>({ const tabCharts = ref<Record<TabType, ChartItem[]>>({
@@ -114,7 +115,7 @@ const buildOption = (item: ChartItem): EChartsOption => ({
{ value: item.status.notStarted, name: '未开始', itemStyle: { color: '#2a59ff' }, label: { show: false } }, { value: item.status.notStarted, name: '未开始', itemStyle: { color: '#2a59ff' }, label: { show: false } },
{ value: item.status.inProgress, name: '进行中', itemStyle: { color: '#ff8a00' }, label: { show: false } }, { value: item.status.inProgress, name: '进行中', itemStyle: { color: '#ff8a00' }, label: { show: false } },
{ value: item.status.done, name: '已完成', itemStyle: { color: '#1bd9ff' }, label: { show: false } }, { value: item.status.done, name: '已完成', itemStyle: { color: '#1bd9ff' }, label: { show: false } },
{ value: item.status.voided, name: '已作废', itemStyle: { color: '#9fa0a6' }, label: { show: false } } { value: item.status.voided, name: '已关闭', itemStyle: { color: '#9fa0a6' }, label: { show: false } }
], ],
emphasis: { scale: true, scaleSize: 4 } emphasis: { scale: true, scaleSize: 4 }
} }

View File

@@ -21,23 +21,27 @@
<div class="left-wrapper"> <div class="left-wrapper">
<OverviewPanel :totalCount="dashboardData?.totalCount || 0" <OverviewPanel :totalCount="dashboardData?.totalCount || 0"
:formalEmployeeCount="dashboardData?.formalEmployeeCount || 0" :formalEmployeeCount="dashboardData?.formalEmployeeCount || 0"
:externalStaffCount="dashboardData?.externalStaffCount || 0" :visitorCount="dashboardData?.visitorCount || 0" :externalStaffCount="dashboardData?.externalStaffCount || 0"
:visitorCount="dashboardData?.visitorCount || 0"
:parkStatistics="dashboardData?.parkStatistics"/> :parkStatistics="dashboardData?.parkStatistics"/>
<RiskStatisticsPanel :riskStatistics="riskStatistics" :dangerDetail="dangerDetail" <RiskStatisticsPanel :riskStatistics="riskStatistics" :dangerDetail="dangerDetail"
@tab-change="handleRiskTabChange" :campus_id="query.campus_id"/> @tab-change="handleRiskTabChange" :campus_id="query.campus_id"/>
</div> </div>
<div class="right-wrapper"> <div class="right-wrapper">
<HighRiskAlertPanel :alertData="dashboardData?.alertData" :alertDetails="dashboardData?.alertData.details" <HighRiskAlertPanel :alertData="dashboardData?.alertData"
:alertDetails="dashboardData?.alertData.details"
:sourceIndex="sourceIndex"/> :sourceIndex="sourceIndex"/>
<TimeoutWorkOrderPanel :timeoutWorkOrders="dashboardData?.timeoutWorkOrders" <TimeoutWorkOrderPanel :timeoutWorkOrders="dashboardData?.timeoutWorkOrders"
:alertDetails="dashboardData?.timeoutWorkOrders.details" :sourceIndex="sourceIndex" /> :alertDetails="dashboardData?.timeoutWorkOrders.details"
:sourceIndex="sourceIndex"/>
</div> </div>
<HiddenDangerPanel :hiddenDangerData="dashboardData?.hiddenDangerData"/> <HiddenDangerPanel :hiddenDangerData="dashboardData?.hiddenDangerData"/>
</div> </div>
</div> </div>
<!-- 区域选择弹窗 --> <!-- 区域选择弹窗 -->
<RegionSelector v-model="regionSelectorVisible" :modelSelected="selectedRegion" :regions="regionOption" <RegionSelector v-model="regionSelectorVisible" :modelSelected="selectedRegion"
:regions="regionOption"
@change="onRegionChange"/> @change="onRegionChange"/>
</template> </template>
@@ -646,22 +650,30 @@ const handleRiskTabChange = async (tab: TabType) => {
let workOrderType = '' let workOrderType = ''
switch (tab) { switch (tab) {
case '安全类': case '安全类':
workOrderType = '安全生产' workOrderType = '物业服务-安全'
break break
case '工程类': case '工程类':
workOrderType = '物业服务-工程' workOrderType = '物业服务-工程'
break break
default: default:
workOrderType = '安全生产' workOrderType = '物业服务-安全'
} }
// 同时获取维保任务和巡检任务的数据 // 同时获取维保任务和巡检任务的数据
const [maintenanceResponse, inspectionResponse] = await Promise.all([ const [maintenanceResponse, inspectionResponse] = await Promise.all([
getWorkOrderStatistics({workOrderType, taskType: '维保任务',campus_id: query.campus_id}).catch(error => { getWorkOrderStatistics({
workOrderType,
taskType: '维保任务',
campus_id: query.campus_id
}).catch(error => {
console.error('获取维保任务数据失败:', error) console.error('获取维保任务数据失败:', error)
return {records: []} return {records: []}
}), }),
getWorkOrderStatistics({workOrderType, taskType: '巡检任务',campus_id: query.campus_id}).catch(error => { getWorkOrderStatistics({
workOrderType,
taskType: '巡检任务',
campus_id: query.campus_id
}).catch(error => {
console.error('获取巡检任务数据失败:', error) console.error('获取巡检任务数据失败:', error)
return {records: []} return {records: []}
}) })
@@ -696,6 +708,7 @@ const handleRiskTabChange = async (tab: TabType) => {
charts.push({ charts.push({
title, title,
total: Number(data.total) || 0, total: Number(data.total) || 0,
rate: Number(data.rate) || 0,
status: { status: {
notStarted: Number(data.pending) || 0, notStarted: Number(data.pending) || 0,
inProgress: Number(data.processing) || 0, inProgress: Number(data.processing) || 0,