From 2dfc8dc4bcd3d3cd4aed1b6054e073e140eba9c8 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Mon, 19 May 2025 16:05:50 +0800
Subject: [PATCH] Merge branch 'master' into jiangwu
---
src/views/wel/index.vue | 332 ++++++++++++++++++++++++++++++-------------------------
1 files changed, 181 insertions(+), 151 deletions(-)
diff --git a/src/views/wel/index.vue b/src/views/wel/index.vue
index 4d44409..eeb305e 100644
--- a/src/views/wel/index.vue
+++ b/src/views/wel/index.vue
@@ -22,7 +22,7 @@
</div>
</div>
</div>
- <div class="arrow">
+ <div class="arrow" @click="jumpshebei">
<img src="/src/assets/images/workbench/st2.png" alt="" />
</div>
</div>
@@ -45,9 +45,10 @@
<div class="status-item" v-for="(item, index) in eventTypeList" :key="index">
<div class="statusCon">
<div class="status-label">{{ item.name }}</div>
- <div :style="{ color: item.color }" class="status-value">
+ <!-- <div :style="{ color: item.color }" class="status-value">
{{ item.value }}<span>个</span>
- </div>
+ </div> -->
+ <div class="status-value">{{ item.value }}<span>个</span></div>
<div class="ratio">
占比
<span :style="{ color: item.color }"
@@ -73,8 +74,11 @@
<div class="flycenter">
<div class="centerBox">
<div class="centerItem" v-for="(itemfly, index) in flyTypeList" :key="index">
- <div class="flyimg"><img :src="itemfly.img" alt="" />{{itemfly.name}}</div>
- <div class="flydata"><span>{{itemfly.value}}</span>{{unitMap[itemfly.name]}}</div>
+ <div class="flyimg"><img :src="itemfly.img" alt="" />{{ itemfly.name }}</div>
+ <div class="flydata">
+ <span>{{ itemfly.value }}</span
+ >{{ unitMap[itemfly.name] }}
+ </div>
</div>
</div>
<div class="lineChart">
@@ -105,49 +109,56 @@
import * as echarts from 'echarts';
import useEchartsResize from '@/hooks/useEchartsResize';
import { mapGetters } from 'vuex';
-import { getJobEventByStatus, getJobEventTotal,getFly,getFlyTime } from '@/api/home/index';
+import { getJobEventByStatus, getJobEventTotal, getFly, getFlyTime } from '@/api/home/index';
import overviewImg1 from '@/assets/images/workbench/tc1.png';
-import overviewImg2 from '@/assets/images/workbench/tc2.png';
-import overviewImg3 from '@/assets/images/workbench/tc3.png';
-import overviewImg4 from '@/assets/images/workbench/tc4.png';
-import overviewImg5 from '@/assets/images/workbench/tc5.png';
-import overviewImg6 from '@/assets/images/workbench/tc6.png';
-import flyImg1 from '@/assets/images/workbench/fy2.png';
-import flyImg2 from '@/assets/images/workbench/fy3.png';
-import flyImg3 from '@/assets/images/workbench/fy4.png';
+import overviewImg2 from '@/assets/images/workbench/tc2.svg';
+import overviewImg3 from '@/assets/images/workbench/tc3.svg';
+import overviewImg4 from '@/assets/images/workbench/tc4.svg';
+import overviewImg5 from '@/assets/images/workbench/tc5.svg';
+
+import flyImg1 from '@/assets/images/workbench/fy2.svg';
+import flyImg2 from '@/assets/images/workbench/fy3.svg';
+import flyImg3 from '@/assets/images/workbench/fy4.svg';
import statistics from './components/statistics.vue';
-let checked = ref('CURRENT_WEEK');
+import { ElMessage } from 'element-plus';
+let checked = ref('CURRENT_YEAR');
let timeListStr = ['本周', '本月', '本年'];
let timeListEnum = ['CURRENT_WEEK', 'CURRENT_MONTH', 'CURRENT_YEAR'];
const params = ref({
- date_enum: 'CURRENT_WEEK',
+ date_enum: 'CURRENT_YEAR',
device_sn: '',
end_date: undefined,
start_date: undefined,
});
-const dateSelect = ref('CURRENT_WEEK');
+const dateSelect = ref('CURRENT_YEAR');
let timeClick = (item, index) => {
checked.value = item;
params.value.date_enum = item;
dateSelect.value = item;
- console.log('日期选择', params.value.date_enum);
getTypeData();
+ getFlyList();
+ getFlyTimeList();
};
+// 跳转
+const jumpshebei = () => {
+ ElMessage.warning('加急开发中...');
+};
+
const eventTypeList = ref([
- { name: '待审核', value: 0, img: overviewImg2, color: '#FF6560', status: '2', rate: 0 },
- { name: '待处理', value: 0, img: overviewImg3, color: '#5D77FB', status: '0', rate: 0 },
- { name: '处理中', value: 0, img: overviewImg4, color: '#FF8B26', status: '3', rate: 0 },
+ { name: '待审核', value: 0, img: overviewImg2, color: '#FF472F', status: '2', rate: 0 },
+ { name: '待处理', value: 0, img: overviewImg3, color: '#FF7411', status: '0', rate: 0 },
+ { name: '处理中', value: 0, img: overviewImg4, color: '#FFC300', status: '3', rate: 0 },
{ name: '已完成', value: 0, img: overviewImg5, color: '#0291A1', status: '4', rate: 0 },
]);
const keyMapping = {
- '飞行时长': 'total_flight_time',
- '飞行里程': 'total_flight_distance',
- '任务成果': 'event_num'
+ 飞行时长: 'total_flight_time',
+ 飞行里程: 'total_flight_distance',
+ 任务成果: 'event_num',
};
const unitMap = {
- '飞行时长': '时',
- '飞行里程': '千米',
- '任务成果': '个'
+ 飞行时长: '时',
+ 飞行里程: '千米',
+ 任务成果: '个',
};
const flyTypeList = ref([
{ name: '飞行时长', value: 0, img: flyImg1 },
@@ -174,32 +185,31 @@
};
// 飞行统计
-const getFlyList=()=>{
- getFly(params.value).then(res=>{
- flyTypeList.value = flyTypeList.value.map(item => ({
- ...item,
- value: res.data.data[keyMapping[item.name]] || 0
- }));
- })
-}
-const getFlyTimeList=()=>{
- getFlyTime(params.value).then(res=>{
- const resList = res?.data?.data || [];
- console.log('飞行统计11',res.data.data);
- lineCharts(resList)
- })
-}
+const getFlyList = () => {
+ getFly(params.value).then(res => {
+ flyTypeList.value = flyTypeList.value.map(item => ({
+ ...item,
+ value: res.data.data[keyMapping[item.name]] || 0,
+ }));
+ });
+};
+const getFlyTimeList = () => {
+ getFlyTime(params.value).then(res => {
+ const resList = res?.data?.data || [];
+ lineCharts(resList);
+ });
+};
// 图表
const echartsRef = ref(null);
let { chart } = useEchartsResize(echartsRef);
const chartRef = ref(null);
let { chart: lineChart } = useEchartsResize(chartRef);
const initChart = val => {
- // 转换数据格式并计算总数
const totalNum = val.reduce((sum, item) => sum + item.num, 0);
const data = {
total: {
title: '总计',
+
figure: totalNum.toString(), // 动态计算总数
},
data: val.map(item => ({
@@ -210,7 +220,7 @@
};
const echartsOption = {
- color: ['#FF6560', '#5D77FB', '#FF8B26', '#0291A1'],
+ color: ['#FF472F', '#FF7411', '#FFC300', '#0291A1'],
tooltip: {
trigger: 'item',
padding: 0,
@@ -236,7 +246,7 @@
textStyle: {
color: 'rgba(28, 31, 35, 0.80)',
fontSize: '12px',
- fontWeight: 'normal',
+ fontWeight: 'bold',
},
subtext: data.total.figure,
subtextStyle: {
@@ -245,34 +255,39 @@
fontWeight: '600',
},
top: '40%',
- left: '50%',
+ left: '48%',
+ textAlign: 'center', // 文本对齐
},
series: [
{
name: '',
type: 'pie',
- radius: ['40%', '55%'],
+ radius: ['43%', '63%'],
avoidLabelOverlap: true,
- left: '10%',
+ left: '-2%',
label: {
- formatter: (params) => {
- return `{a|${params.name}}: ${params.data.rate}%`;
- },
+ formatter: params => {
+ // 使用 b 样式标记包裹百分比数值
+ return `{a|${params.name}}: {b|${params.data.rate}%}`;
+ },
alignTo: 'labelLine',
+ overflow: 'truncate',
rich: {
a: {
color: 'rgba(28, 31, 35, 0.80)',
- fontSize: '12px',
+ fontSize: 12, // 建议去掉引号使用数字
},
b: {
color: '#1C1F23',
- fontSize: '14px',
- fontWeight: '600',
+ fontSize: 14,
+ fontWeight: 'bold', // 确保加粗
},
},
},
labelLine: {
show: true,
+ length: 5, // 调整引导线长度
+ length2: 15,
lineStyle: {
cap: 'round',
},
@@ -286,11 +301,41 @@
};
// 柱状图
-const lineCharts = (bardata) => {
- const categories = bardata?.map(item => item.name); // x轴类别
-const flight_distance=[]
-const flight_time=[]
-const event_num=[]
+const lineCharts = bardata => {
+ const categories = bardata?.map(item => item.name); // x轴类别
+ const flight_distance = [];
+ const flight_time = [];
+ const event_num = [];
+ // /遍历数据填充各系列
+ bardata?.forEach(period => {
+ let hasDuration = false,
+ hasDistance = false,
+ hasResult = false;
+
+ period.data?.forEach(item => {
+ switch (item.name) {
+ case '飞行时长':
+ flight_time.push(parseFloat(item.value) || 0);
+ hasDuration = true;
+ break;
+ case '飞行里程':
+ // 转换为万公 (假设原始单位是米)
+ // flight_distance.push((parseFloat(item.value) / 10 || 0));
+ flight_distance.push(parseFloat(item.value) || 0);
+ hasDistance = true;
+ break;
+ case '任务成果':
+ event_num.push(Number(item.value) || 0);
+ hasResult = true;
+ break;
+ }
+ });
+
+ // 处理可能缺失的数据项
+ if (!hasDuration) flight_time.push(0);
+ if (!hasDistance) flight_distance.push(0);
+ if (!hasResult) event_num.push(0);
+ });
var option = {
tooltip: {
trigger: 'item',
@@ -309,9 +354,7 @@
data: ['飞行时长', '飞行里程', '任务成果'],
left: 'center',
top: '5%',
- textStyle: {
- color: '#666666',
- },
+ color: '#383838', // 直接配置颜色
itemWidth: 15,
itemHeight: 10,
itemGap: 25,
@@ -324,21 +367,17 @@
color: '#cdd5e2',
},
},
-
axisLabel: {
interval: 0,
- textStyle: {
- color: '#666666',
- },
+ color: '#383838', // 直接配置颜色
},
},
yAxis: [
- // 只保留第一个y轴
{
type: 'log',
name: '单位:万套',
nameTextStyle: {
- color: '#666666',
+ color: '#383838',
},
min: 1,
logBase: 3,
@@ -348,33 +387,24 @@
color: '#cdd5e2',
},
},
-
splitLine: {
- show: true, // 显示分割线
+ show: true,
lineStyle: {
- type: 'dashed', // 设置为虚线
- color: '#cdd5e2', // 颜色与轴线一致
- width: 1, // 线宽
- opacity: 0.5, // 透明度
+ type: 'dashed',
+ color: '#cdd5e2',
+ width: 1,
+ opacity: 0.5,
},
},
axisLabel: {
- textStyle: {
- color: '#666666',
- },
- },
- axisLine: {
- lineStyle: {
- color: '#cdd5e2',
- },
+ color: '#666666', // 直接配置颜色
},
},
-
{
type: 'log',
name: '',
nameTextStyle: {
- color: '#666666',
+ color: '#383838',
},
min: 1,
logBase: 3,
@@ -384,25 +414,17 @@
color: '#cdd5e2',
},
},
-
splitLine: {
- show: true, // 显示分割线
+ show: true,
lineStyle: {
- type: 'dashed', // 设置为虚线
- color: '#cdd5e2', // 颜色与轴线一致
- width: 1, // 线宽
- opacity: 0.5, // 透明度
+ type: 'dashed',
+ color: '#cdd5e2',
+ width: 1,
+ opacity: 0.5,
},
},
axisLabel: {
- textStyle: {
- color: '#666666',
- },
- },
- axisLine: {
- lineStyle: {
- color: '#cdd5e2',
- },
+ color: '#383838', // 直接配置颜色
},
},
],
@@ -412,61 +434,49 @@
type: 'bar',
barWidth: '12px',
itemStyle: {
- normal: {
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
- {
- offset: 0,
- color: '#29acff',
- },
- {
- offset: 1,
- color: '#4bdfff',
- },
- ]),
- barBorderRadius: 6,
- },
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
+ { offset: 0, color: '#29acff' },
+ { offset: 1, color: '#4bdfff' },
+ ]),
+ borderRadius: 6,
},
- data: [11, 14, 133, 4, 10, 14, 116, 12, 12, 58, 15, 12],
+ data: flight_time,
},
{
name: '飞行里程',
type: 'bar',
barWidth: '12px',
itemStyle: {
- normal: {
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
- {
- offset: 0,
- color: '#01c871',
- },
- {
- offset: 1,
- color: '#55f49c',
- },
- ]),
- barBorderRadius: 6,
- },
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
+ { offset: 0, color: '#01c871' },
+ { offset: 1, color: '#55f49c' },
+ ]),
+ borderRadius: 6,
},
- data: [0, 1, 9, 0, 5, 3, 0, 2, 0, 0, 1, 0],
+ data: flight_distance,
},
+
{
name: '任务成果',
type: 'line',
- yAxisIndex: 1, // 改为使用第一个y轴
+ yAxisIndex: 1,
smooth: true,
- // symbol: 'circle',
- // symbolSize: 8,
// itemStyle: {
- // normal: {
- // color: '#ffa43a',
- // borderColor: 'rgba(255, 234, 0, 0.5)',
- // borderWidth: 5,
+ // color: '#ffa43a', // 默认状态颜色
+ // borderColor: 'rgba(255, 234, 0, 0.5)',
+ // borderWidth: 5,
+ // },
+ // emphasis: {
+ // // 悬停状态
+ // itemStyle: {
+ // color: '#ff8c00', // 悬停时颜色变深
+ // borderWidth: 6,
// },
// },
lineStyle: {
color: 'rgba(52, 146, 242, 1)',
},
- data: [1, 7, 6, 30, 20, 21.43, 11, 16.67, 22, 88, 6.67, 10],
+ data: event_num,
},
],
};
@@ -479,8 +489,8 @@
getTypeData();
lineCharts();
- getFlyList()
- getFlyTimeList()
+ getFlyList();
+ getFlyTimeList();
});
</script>
@@ -490,7 +500,6 @@
}
</style>
<style scoped lang="scss">
-// 开始
.workbench {
padding: 0px 20px 0 20px;
display: flex;
@@ -499,7 +508,6 @@
.workleft {
width: 68%;
margin-right: 10px;
- // 综合
.comprehensiveCon {
// height: 736px;
background: #ffffff;
@@ -513,6 +521,10 @@
.name {
display: flex;
align-items: center;
+ font-weight: bold;
+ font-size: 16px;
+ color: #363636;
+ font-family: 'Source Han Sans CN';
span {
margin-right: 4px;
}
@@ -537,6 +549,10 @@
height: 100%;
line-height: 32px;
cursor: pointer;
+ font-family: 'Source Han Sans CN';
+font-weight: 400;
+font-size: 14px;
+color: #1441FF;
}
.card-item:first-child {
border-right: 1px solid #e5e5e5;
@@ -544,8 +560,9 @@
.card-item:nth-child(2) {
border-right: 1px solid #e5e5e5;
}
- .active {
+ .card-item.active {
color: #1441ff;
+ border: 1px solid #1c5cff;
}
}
}
@@ -558,6 +575,7 @@
.workOrder {
margin-top: 21px;
display: flex;
+ justify-content: space-between;
border-bottom: 1px solid #dfdfdf;
.card-group {
width: 40%;
@@ -585,7 +603,8 @@
color: #7c8091;
}
.total-number {
- font-family: 'YouSheBiaoTiHei';
+ font-family: 'Source Han Sans CN';
+
font-weight: bold;
font-size: 32px;
color: #2a54ff;
@@ -607,16 +626,18 @@
img {
width: 26px;
height: 26px;
- padding: 9px 2px;
+ padding: 9px 10px 9px 2px;
}
.statusCon {
display: flex;
flex-direction: column;
- align-items: center;
- padding: 9px 4px 0 4px;
+ // align-items: center;
+ padding: 9px 4px 7px 10px;
+ text-align: left;
.status-label {
font-weight: 400;
font-size: 14px;
+ text-align: left;
color: #383838;
}
.ratio {
@@ -624,12 +645,18 @@
font-size: 12px;
color: #363636;
white-space: nowrap;
+ text-align: left;
}
.status-value {
- font-family: 'YouSheBiaoTiHei';
+ font-family: 'Source Han Sans CN';
font-weight: bold;
- font-size: 24px;
+ font-size: 30px;
+ color: #363636;
margin: 5px 0;
+ // font-style: italic;
+ display: inline-block;
+ transform: skewX(-5deg);
+
span {
font-weight: 400;
font-size: 14px;
@@ -684,14 +711,17 @@
border-radius: 8px 8px 8px 8px;
border: 1px solid #ffffff;
margin-right: 16px;
- img{
- width: 15px;
- height: 15px;
- margin-right: 5px;
+ img {
+ width: 15px;
+ height: 15px;
+ margin-right: 5px;
}
.flyimg {
- display: flex;
- align-items: center;
+ display: flex;
+ align-items: center;
+ font-weight: 400;
+ font-size: 14px;
+ color: #7c8091;
}
.flydata {
margin-top: 15px;
--
Gitblit v1.9.3