| | |
| | | <div class="ratio"> |
| | | 占比 |
| | | <span :style="{ color: item.color }" |
| | | >{{ (item.rate / 100) * 100 }}%</span |
| | | >{{ ((item.rate * 100) / 100).toFixed(2) }}%</span |
| | | > |
| | | </div> |
| | | </div> |
| | |
| | | </div> |
| | | <div class="flycenter"> |
| | | <div class="centerBox"> |
| | | <div class="centerItem" v-for="(item, index) in 3" :key="index"> |
| | | <div><img src="@/assets/images/workbench/fy2.png" alt="" />飞行时长</div> |
| | | <div class="flydata"><span>5421.56</span>时</div> |
| | | <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> |
| | | </div> |
| | | <div class="lineChart"> |
| | |
| | | </div> |
| | | </div> |
| | | <div class="centerRight"> |
| | | <flyratio></flyratio> |
| | | <flyratio :dateSelect="dateSelect"></flyratio> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | import * as echarts from 'echarts'; |
| | | import useEchartsResize from '@/hooks/useEchartsResize'; |
| | | import { mapGetters } from 'vuex'; |
| | | import { ref } from 'vue'; |
| | | 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 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 statistics from './components/statistics.vue'; |
| | | import { getJobEventByStatus, getJobEventTotal } from '@/api/home/index'; |
| | | // const value = ref(new Date()); |
| | | let checked = ref('CURRENT_WEEK'); |
| | | let timeListStr = ['本周', '本月', '本年']; |
| | | let timeListEnum = ['CURRENT_WEEK', 'CURRENT_MONTH', 'CURRENT_YEAR']; |
| | | const params = ref({ |
| | | date_enum: 'CURRENT_WEEK', |
| | | device_sn: '', |
| | | end_date: undefined, |
| | | start_date: undefined, |
| | | }); |
| | | const dateSelect = ref('CURRENT_WEEK'); |
| | | let timeClick = (item, index) => { |
| | | checked.value = item; |
| | | params.value.date_enum = item; |
| | | dateSelect.value = item; |
| | | console.log('日期选择', params.value.date_enum); |
| | | getTypeData(); |
| | | }; |
| | |
| | | { name: '处理中', value: 0, img: overviewImg4, color: '#FF8B26', 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' |
| | | }; |
| | | const unitMap = { |
| | | '飞行时长': '时', |
| | | '飞行里程': '千米', |
| | | '任务成果': '个' |
| | | }; |
| | | const flyTypeList = ref([ |
| | | { name: '飞行时长', value: 0, img: overviewImg2 }, |
| | | { name: '飞行里程', value: 0, img: overviewImg3 }, |
| | | { name: '任务成功', value: 0, img: overviewImg4 }, |
| | | { name: '飞行时长', value: 0, img: flyImg1 }, |
| | | { name: '飞行里程', value: 0, img: flyImg2 }, |
| | | { name: '任务成果', value: 0, img: flyImg3 }, |
| | | ]); |
| | | const params = ref({ |
| | | date_enum: 'CURRENT_WEEK', |
| | | device_sn: '', |
| | | end_date: undefined, |
| | | start_date: undefined, |
| | | }); |
| | | |
| | | const eventTotal = ref(0); |
| | | const data = ref([]); |
| | | // 工单统计 |
| | | const getTypeData = () => { |
| | | getJobEventByStatus(params.value).then(res => { |
| | | const resList = res?.data?.data || []; |
| | | console.log('工单统计', res.data.data); |
| | | |
| | | resList.forEach(item => { |
| | | eventTypeList.value.forEach(item1 => { |
| | | if (item1.name === item.name) { |
| | |
| | | initChart(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 || []; |
| | | console.log('飞行统计11',res.data.data); |
| | | lineCharts(resList) |
| | | }) |
| | | } |
| | | // 图表 |
| | | const echartsRef = ref(null); |
| | | let { chart } = useEchartsResize(echartsRef); |
| | |
| | | fontWeight: '600', |
| | | }, |
| | | top: '40%', |
| | | left: 'center', |
| | | left: '50%', |
| | | }, |
| | | series: [ |
| | | { |
| | | name: '', |
| | | type: 'pie', |
| | | radius: ['30%', '45%'], |
| | | radius: ['40%', '55%'], |
| | | avoidLabelOverlap: true, |
| | | // avoidLabelOverlap: false, |
| | | left: '10%', |
| | | label: { |
| | | formatter: `{a|{b}}: {b|{d}%}`, |
| | | formatter: (params) => { |
| | | return `{a|${params.name}}: ${params.data.rate}%`; |
| | | }, |
| | | alignTo: 'labelLine', |
| | | rich: { |
| | | a: { |
| | |
| | | }; |
| | | |
| | | // 柱状图 |
| | | const lineCharts = () => { |
| | | const lineCharts = (bardata) => { |
| | | const categories = bardata?.map(item => item.name); // x轴类别 |
| | | const flight_distance=[] |
| | | const flight_time=[] |
| | | const event_num=[] |
| | | var option = { |
| | | tooltip: { |
| | | trigger: 'item', |
| | |
| | | }, |
| | | xAxis: { |
| | | type: 'category', |
| | | data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], |
| | | data: categories, |
| | | axisLine: { |
| | | lineStyle: { |
| | | color: '#cdd5e2', |
| | |
| | | }, |
| | | }, |
| | | }, |
| | | // 移除第二个y轴配置 |
| | | |
| | | { |
| | | type: 'log', |
| | | name: '', |
| | | nameTextStyle: { |
| | | color: '#666666', |
| | | }, |
| | | min: 1, |
| | | logBase: 3, |
| | | axisLine: { |
| | | show: false, |
| | | lineStyle: { |
| | | color: '#cdd5e2', |
| | | }, |
| | | }, |
| | | |
| | | splitLine: { |
| | | show: true, // 显示分割线 |
| | | lineStyle: { |
| | | type: 'dashed', // 设置为虚线 |
| | | color: '#cdd5e2', // 颜色与轴线一致 |
| | | width: 1, // 线宽 |
| | | opacity: 0.5, // 透明度 |
| | | }, |
| | | }, |
| | | axisLabel: { |
| | | textStyle: { |
| | | color: '#666666', |
| | | }, |
| | | }, |
| | | axisLine: { |
| | | lineStyle: { |
| | | color: '#cdd5e2', |
| | | }, |
| | | }, |
| | | }, |
| | | ], |
| | | series: [ |
| | | { |
| | |
| | | { |
| | | name: '任务成果', |
| | | type: 'line', |
| | | yAxisIndex: 0, // 改为使用第一个y轴 |
| | | yAxisIndex: 1, // 改为使用第一个y轴 |
| | | smooth: true, |
| | | // symbol: 'circle', |
| | | // symbolSize: 8, |
| | |
| | | |
| | | getTypeData(); |
| | | lineCharts(); |
| | | getFlyList() |
| | | getFlyTimeList() |
| | | }); |
| | | </script> |
| | | |
| | |
| | | .status-item { |
| | | display: flex; |
| | | text-align: center; |
| | | justify-content: space-between; |
| | | height: 97px; |
| | | max-width: 148px; |
| | | background: #f6f8fe; |
| | | border-radius: 8px 8px 8px 8px; |
| | | img { |
| | |
| | | } |
| | | .flycenter { |
| | | margin-top: 13px; |
| | | |
| | | .centerBox { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | margin-bottom: 10px; |
| | | .centerItem { |
| | | padding: 7px 7px 0 15px; |
| | | // width: 196px; |
| | |
| | | border-radius: 8px 8px 8px 8px; |
| | | border: 1px solid #ffffff; |
| | | margin-right: 16px; |
| | | img{ |
| | | width: 15px; |
| | | height: 15px; |
| | | margin-right: 5px; |
| | | } |
| | | .flyimg { |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | .flydata { |
| | | margin-top: 15px; |
| | | text-align: right; |
| | |
| | | } |
| | | } |
| | | } |
| | | .centerRight { |
| | | width: 40%; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | .workright { |
| | | width: 32%; |
| | | } |