diff --git a/src/views/Home/Index10.vue b/src/views/Home/Index10.vue
index e69a7e6..57c1c0d 100644
--- a/src/views/Home/Index10.vue
+++ b/src/views/Home/Index10.vue
@@ -2,12 +2,17 @@
@@ -304,7 +306,7 @@ import { ref, computed, onMounted } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import { Refresh } from '@element-plus/icons-vue'
import Echart from '@/components/Echart/src/Echart.vue'
-import RegionSelector from '@/views/screen/components/RegionSelector.vue'
+import HeaderSelector from '@/views/screen/components/HeaderSelector.vue'
import { getTableList } from '@/api/design/report'
import type { EChartsOption } from 'echarts'
import dayjs from 'dayjs'
@@ -349,9 +351,7 @@ const route = useRoute()
// 区域选择相关
const currentView = ref('集团')
-const regionSelectorVisible = ref(false)
const selectedRegion = ref('')
-const regionOption = ref
([])
// 时间选择相关 - 默认当前月起止,如果路由中有日期范围参数则使用
const getCurrentMonthRange = () => {
@@ -523,6 +523,21 @@ const outsourcingChartOption = computed(() => {
trigger: 'item',
formatter: '{a}
{b}: {c} ({d}%)'
},
+ graphic: [
+ {
+ type: 'text',
+ left: 'center',
+ top: 'center',
+ style: {
+ text: `${outsourcingTotal.value}\n外协人员总数`,
+ fontSize: 16,
+ fontWeight: 'bold',
+ fill: '#333',
+ textAlign: 'center',
+ textVerticalAlign: 'middle'
+ }
+ }
+ ],
series: [
{
name: '外协人员',
@@ -536,14 +551,7 @@ const outsourcingChartOption = computed(() => {
borderWidth: 0
},
label: {
- show: true,
- position: 'center',
- formatter: () => {
- return `${outsourcingTotal.value}\n外协人员总数`
- },
- fontSize: 16,
- fontWeight: 'bold',
- color: '#333'
+ show: false
},
data: [
{ value: 1, name: '暂无数据', itemStyle: { color: '#e5e7eb' } }
@@ -558,6 +566,21 @@ const outsourcingChartOption = computed(() => {
trigger: 'item',
formatter: '{a}
{b}: {c} ({d}%)'
},
+ graphic: [
+ {
+ type: 'text',
+ left: 'center',
+ top: 'center',
+ style: {
+ text: `${outsourcingTotal.value}\n外协人员总数`,
+ fontSize: 16,
+ fontWeight: 'bold',
+ fill: '#333',
+ textAlign: 'center',
+ textVerticalAlign: 'middle'
+ }
+ }
+ ],
series: [
{
name: '外协人员',
@@ -571,19 +594,12 @@ const outsourcingChartOption = computed(() => {
borderWidth: 0
},
label: {
- show: true,
- position: 'center',
- formatter: () => {
- return `${outsourcingTotal.value}\n外协人员总数`
- },
- fontSize: 16,
- fontWeight: 'bold',
- color: '#333'
+ show: false
},
emphasis: {
label: {
show: true,
- fontSize: 18,
+ fontSize: 14,
fontWeight: 'bold'
}
},
@@ -595,40 +611,29 @@ const outsourcingChartOption = computed(() => {
// 风险管理环形图配置
const riskChartOption = computed(() => {
- const chartData = riskDistribution.value
- .filter(item => item.count > 0) // 只显示有数据的风险等级
- .map(item => ({
- value: item.count,
- name: item.level,
- itemStyle: { color: item.color }
- }))
-
- // 如果没有数据,显示空状态
- if (chartData.length === 0 || riskTotal.value === 0) {
- return {
- tooltip: { trigger: 'item', formatter: '{a}
{b}: {c} ({d}%)' },
- series: [{
- name: '风险',
- type: 'pie',
- radius: ['55%', '75%'],
- center: ['50%', '50%'],
- avoidLabelOverlap: false,
- itemStyle: { borderRadius: 0, borderColor: 'transparent', borderWidth: 0 },
- label: {
- show: true,
- position: 'center',
- formatter: () => `${riskTotal.value}\n风险总数`,
- fontSize: 16,
- fontWeight: 'bold',
- color: '#333'
- },
- data: [{ value: 1, name: '暂无数据', itemStyle: { color: '#e5e7eb' } }]
- }]
- }
- }
-
+ const chartData = riskDistribution.value.map(item => ({
+ value: item.count,
+ name: item.level,
+ itemStyle: { color: item.color }
+ }))
+
return {
tooltip: { trigger: 'item', formatter: '{a}
{b}: {c} ({d}%)' },
+ graphic: [
+ {
+ type: 'text',
+ left: 'center',
+ top: 'center',
+ style: {
+ text: `${riskTotal.value}\n风险总数`,
+ fontSize: 16,
+ fontWeight: 'bold',
+ fill: '#333',
+ textAlign: 'center',
+ textVerticalAlign: 'middle'
+ }
+ }
+ ],
series: [{
name: '风险',
type: 'pie',
@@ -638,13 +643,51 @@ const riskChartOption = computed(() => {
itemStyle: { borderRadius: 0, borderColor: 'transparent', borderWidth: 0 },
label: {
show: true,
- position: 'center',
- formatter: () => `${riskTotal.value}\n风险总数`,
- fontSize: 16,
- fontWeight: 'bold',
+ alignTo: 'edge',
+ formatter: (params: any) => {
+ const value = Number(params.value) || 0
+ const total = Number(riskTotal.value) || 0
+ if (total === 0) {
+ return '0%'
+ }
+ const percent = ((value / total) * 100).toFixed(2) + '%'
+ return percent
+ },
+ minMargin: 5,
+ edgeDistance: 10,
+ lineHeight: 15,
+ fontSize: 12,
color: '#333'
},
- emphasis: { label: { show: true, fontSize: 18, fontWeight: 'bold' } },
+ labelLine: {
+ show: true,
+ length: 15,
+ length2: 10,
+ maxSurfaceAngle: 80
+ },
+ labelLayout: function (params: any) {
+ const isLeft = params.labelRect.x < params.labelRect.width
+ const points = params.labelLinePoints
+ if (points && points.length >= 3) {
+ // 调整线条的终点位置
+ if (isLeft) {
+ points[2][0] = params.labelRect.x
+ } else {
+ points[2][0] = params.labelRect.x + params.labelRect.width
+ }
+ return {
+ labelLinePoints: points
+ }
+ }
+ return {}
+ },
+ emphasis: {
+ label: {
+ show: true,
+ fontSize: 14,
+ fontWeight: 'bold'
+ }
+ },
data: chartData
}]
}
@@ -783,6 +826,21 @@ const highRiskChartOption = computed(() => {
if (chartData.length === 0 || highRiskTotal.value === 0) {
return {
tooltip: { trigger: 'item', formatter: '{a}
{b}: {c} ({d}%)' },
+ graphic: [
+ {
+ type: 'text',
+ left: 'center',
+ top: 'center',
+ style: {
+ text: `${highRiskTotal.value}\n累计作业`,
+ fontSize: 15,
+ fontWeight: 'bold',
+ fill: '#333',
+ textAlign: 'center',
+ textVerticalAlign: 'middle'
+ }
+ }
+ ],
series: [{
name: '高危作业',
type: 'pie',
@@ -791,12 +849,7 @@ const highRiskChartOption = computed(() => {
avoidLabelOverlap: false,
itemStyle: { borderRadius: 0, borderColor: 'transparent', borderWidth: 0 },
label: {
- show: true,
- position: 'center',
- formatter: () => `${highRiskTotal.value}\n累计作业`,
- fontSize: 15,
- fontWeight: 'bold',
- color: '#333'
+ show: false
},
data: [{ value: 1, name: '暂无数据', itemStyle: { color: '#e5e7eb' } }]
}]
@@ -805,6 +858,21 @@ const highRiskChartOption = computed(() => {
return {
tooltip: { trigger: 'item', formatter: '{a}
{b}: {c} ({d}%)' },
+ graphic: [
+ {
+ type: 'text',
+ left: 'center',
+ top: 'center',
+ style: {
+ text: `${highRiskTotal.value}\n累计作业`,
+ fontSize: 15,
+ fontWeight: 'bold',
+ fill: '#333',
+ textAlign: 'center',
+ textVerticalAlign: 'middle'
+ }
+ }
+ ],
series: [{
name: '高危作业',
type: 'pie',
@@ -813,14 +881,9 @@ const highRiskChartOption = computed(() => {
avoidLabelOverlap: false,
itemStyle: { borderRadius: 0, borderColor: 'transparent', borderWidth: 0 },
label: {
- show: true,
- position: 'center',
- formatter: () => `${highRiskTotal.value}\n累计作业`,
- fontSize: 15,
- fontWeight: 'bold',
- color: '#333'
+ show: false
},
- emphasis: { label: { show: true, fontSize: 20, fontWeight: 'bold' } },
+ emphasis: { label: { show: true, fontSize: 16, fontWeight: 'bold' } },
data: chartData
}]
}
@@ -1002,10 +1065,6 @@ const navigateToModule = (path: string): void => {
router.push(path)
}
-const openRegionSelector = (): void => {
- regionSelectorVisible.value = true
-}
-
const onRegionChange = (item: RegionItem): void => {
selectedRegion.value = item.name
router.push({
@@ -1030,28 +1089,6 @@ const refreshData = async () => {
initData()
}
-// 初始化区域数据
-const initRegionData = async () => {
- try {
- const { records } = await getTableList('park_info_list')
- if (records && records.length > 0) {
- // 去重region字段,使用Map来确保唯一性
- const regionMap = new Map()
- records.forEach((el: any) => {
- if (!regionMap.has(el.region)) {
- regionMap.set(el.region, {
- name: el.region,
- code: el.region_id
- })
- }
- })
- // 转换为数组
- regionOption.value = Array.from(regionMap.values())
- }
- } catch (error) {
- console.error('初始化区域数据失败:', error)
- }
-}
// 初始化风险管理数据
const initRiskData = async () => {
@@ -1108,10 +1145,10 @@ const initRiskData = async () => {
// 处理风险等级分布数据(用于环形图)
const allLevels = [
- { key: '低', level: '低风险', count: 0, percent: '0%', color: '#10b981' },
- { key: '一般', level: '一般风险', count: 0, percent: '0%', color: '#f59e0b' },
- { key: '较大', level: '较大风险', count: 0, percent: '0%', color: '#ef4444' },
- { key: '重大', level: '重大风险', count: 0, percent: '0%', color: '#dc2626' }
+ { key: '低', level: '低风险', count: 0, percent: '0%', color: '#117cee' },
+ { key: '一般', level: '一般风险', count: 0, percent: '0%', color: '#fbde28' },
+ { key: '较大', level: '较大风险', count: 0, percent: '0%', color: '#ed740c' },
+ { key: '重大', level: '重大风险', count: 0, percent: '0%', color: '#df2a3f' }
]
riskDistribution.value = allLevels.map(defaultItem => {
@@ -1150,10 +1187,10 @@ const initRiskData = async () => {
// 如果没有数据,设置为默认值
riskTotal.value = 0
riskDistribution.value = [
- { level: '低风险', count: 0, percent: '0%', color: '#10b981' },
- { level: '一般风险', count: 0, percent: '0%', color: '#f59e0b' },
- { level: '较大风险', count: 0, percent: '0%', color: '#ef4444' },
- { level: '重大风险', count: 0, percent: '0%', color: '#dc2626' }
+ { level: '低风险', count: 0, percent: '0%', color: '#117cee' },
+ { level: '一般风险', count: 0, percent: '0%', color: '#fbde28' },
+ { level: '较大风险', count: 0, percent: '0%', color: '#ed740c' },
+ { level: '重大风险', count: 0, percent: '0%', color: '#df2a3f' }
]
areaRiskDistribution.value = []
console.log('风险管理无数据')
@@ -1163,10 +1200,10 @@ const initRiskData = async () => {
// 如果接口失败,设置为默认值
riskTotal.value = 0
riskDistribution.value = [
- { level: '低风险', count: 0, percent: '0%', color: '#10b981' },
- { level: '一般风险', count: 0, percent: '0%', color: '#f59e0b' },
- { level: '较大风险', count: 0, percent: '0%', color: '#ef4444' },
- { level: '重大风险', count: 0, percent: '0%', color: '#dc2626' }
+ { level: '低风险', count: 0, percent: '0%', color: '#117cee' },
+ { level: '一般风险', count: 0, percent: '0%', color: '#fbde28' },
+ { level: '较大风险', count: 0, percent: '0%', color: '#ed740c' },
+ { level: '重大风险', count: 0, percent: '0%', color: '#df2a3f' }
]
areaRiskDistribution.value = []
}
@@ -1558,7 +1595,6 @@ const initTrainingData = async () => {
}
const initData = async () => {
- await initRegionData()
initOutsourcingData()
initRiskData()
diff --git a/src/views/Home/Index12.vue b/src/views/Home/Index12.vue
index a166036..5e6f58a 100644
--- a/src/views/Home/Index12.vue
+++ b/src/views/Home/Index12.vue
@@ -2,15 +2,19 @@
+
+
+
diff --git a/src/views/screen/mainScreen.vue b/src/views/screen/mainScreen.vue
index 5d13d27..a2b945d 100644
--- a/src/views/screen/mainScreen.vue
+++ b/src/views/screen/mainScreen.vue
@@ -2,11 +2,16 @@
-
-