feat:对接工单模块接口

This commit is contained in:
zjc
2025-01-01 12:59:32 +08:00
parent d2c0db5270
commit 0742c6fa93
19 changed files with 616 additions and 772 deletions

View File

@@ -1,110 +1,119 @@
<template>
<div class="work-box-2">
<!-- 1 -->
<div class="work-2-flex">
<div class="header">
<div class="title"> <span>今日工单</span> </div>
</div>
<div class="box-1">
<Title1 title="今日工单" />
<div class="hd-list">
<img class="h-icon" src="@/assets/images/work-icon-1.png" alt="" />
<img class="h-icon" src="@/assets/images/work-icon-1.png" />
<div class="item item1">
今日工单总条数 <span class="color1"><countup endVal="45678" /></span>
今日工单总条数 <span class="color1"><countup :end-val="totalData.total" /></span>
</div>
<div class="item item1">
工单完成数 <span class="color1"><countup endVal="45678" /></span>
工单完成数 <span class="color1"><countup :end-val="totalData.complete" /></span>
</div>
<div class="item item3">
紧急工单数 <span class=""><countup endVal="45678" /></span>
紧急工单数 <span class=""><countup :end-val="totalData.warn" /></span>
</div>
<div class="item item2">
重要工单数 <span class=""><countup endVal="45678" /></span>
重要工单数 <span class=""><countup :end-val="totalData.important" /></span>
</div>
<div class="item item1">
普通工单数 <span class=""><countup endVal="45678" /></span>
普通工单数 <span class=""><countup :end-val="totalData.normal" /></span>
</div>
</div>
<div class="chart-box flex">
<div class="lt-chart">
<div class="title-3"><span>异常告警占比</span></div>
<div class="box chart-p">
<div class="check-label">
<span class="active">全部</span>
<span>已完成总数</span>
</div>
<v-chart class="line-chart" :option="optionLine" autoresize />
</div>
<div class="chart">
<div class="chart__wrapper">
<Title3 title="工单总数" />
<!-- <div class="check-label">
<span class="active">全部</span>
<span>已完成总数</span>
</div> -->
<Line :width="680" :height="320" :data="seriesData" :xAxisData="xAxisData" />
</div>
<div class="lt-chart">
<div class="title-3"><span>异常告警占比</span></div>
<div class="box-press">
<!-- <v-chart class="line-chart" :option="optionLine" autoresize /> -->
<div class="p-item">
<span>普通</span>
<div class="box-1">
<div class="chart__wrapper">
<Title3 title="工单类型完成比例" />
<div class="progress">
<div class="progress-item">
<span class="progress-item__label">普通</span>
<div class="progress-item__inner">
<el-progress
:percentage="50"
:percentage="completeRateData.normal * 100"
:stroke-width="fitChartSize(24)"
stroke-linecap="square"
:stroke-width="fitChartSize(15)"
color="#2380FB"
></el-progress>
/>
</div>
</div>
<div class="p-item">
<span>普通</span>
<div class="box-1">
<div class="progress-item">
<span class="progress-item__label">紧急</span>
<div class="progress-item__inner">
<el-progress
:percentage="50"
:percentage="completeRateData.warn * 100"
:stroke-width="fitChartSize(24)"
stroke-linecap="square"
:stroke-width="fitChartSize(15)"
color="#D9011B"
></el-progress>
/>
</div>
</div>
<div class="p-item">
<span>普通</span>
<div class="box-1">
<div class="progress-item">
<span class="progress-item__label">紧急</span>
<div class="progress-item__inner">
<el-progress
:percentage="50"
:percentage="completeRateData.important * 100"
:stroke-width="fitChartSize(24)"
stroke-linecap="square"
:stroke-width="fitChartSize(15)"
color="#FEAE00"
></el-progress>
/>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="work-2-flex">
<div class="header">
<div class="title"> <span>不同景区工单占比</span> </div>
</div>
<div class="chart-box flex">
<div class="lt-chart">
<div class="title-3"><span>异常告警占比</span></div>
<div class="box">
<v-chart class="chart" :option="option1" autoresize />
<!-- <v-chart class="line-chart" :option="optionLine" autoresize /> -->
<div class="box-2 mt-8">
<Title1 title="不同景区工单占比" />
<div class="chart">
<div class="chart__wrapper">
<Title3 title="景区工单占比" />
<div class="chart__inner">
<spotRate :dataList="spotRateData" :total="8888" />
<ul class="chart__legend">
<li class="chart__legend-item" v-for="(item, index) in spotRateData" :key="index">
<p class="dot" :style="{ background: colors[index] }" />
<p class="name">{{ item.name }}</p>
<p class="value">{{ item.value }}%</p>
</li>
</ul>
</div>
</div>
<div class="lt-chart">
<div class="title-3"><span>异常告警占比</span></div>
<div class="box">
<div class="chart-1">
<v-chart class="chart" :option="option2" autoresize />
<div class="chart__wrapper">
<Title3 title="景区工单占比" />
<div class="chart__inner">
<spotRate :dataList="spotRateData" :total="8888" />
<ul class="chart__legend">
<li class="chart__legend-item" v-for="(item, index) in spotRateData" :key="index">
<p class="dot" :style="{ background: colors[index] }" />
<p class="name">{{ item.name }}</p>
<p class="value">{{ item.value }}%</p>
</li>
</ul>
<div class="alarm">
<Title2 title="异常点位告警排名" />
<ul class="alarm__wrapper">
<li class="alarm-item" v-for="(item, index) in 8" :key="index">
<p
class="alarm-item__rank"
:class="{
'alarm-item__rank--error': index == 0,
'alarm-item__rank--warning': index == 1,
'alarm-item__rank--primary': index == 2
}"
>
{{ item }}
</p>
<p class="alarm-item__content">异常点位告警1号名称</p>
</li>
</ul>
</div>
<div class="chart-des">
<div class="t-des">
<img class="h-icon" src="@/assets/images/work-icon-m-1.png" alt="" />
异常点位告警排名
</div>
<div class="t-item" v-for="item in 8">
<span class="bgColor1">1</span>
<p>异常点位告警1号名称</p>
</div>
</div>
<!-- <v-chart class="line-chart" :option="optionLine" autoresize /> -->
</div>
</div>
</div>
@@ -114,404 +123,57 @@
<script setup>
import countup from 'vue-countup-v3'
import * as echarts from 'echarts'
import spotRate from './spotRate.vue'
import { fitChartSize } from '@/utils/dataUtil'
import Map from '@/components/Map/marker.vue'
import VChart, { THEME_KEY } from 'vue-echarts'
import { ref, provide } from 'vue'
import {
getTotalApi,
getLineChartApi,
getCompleteRateApi,
getSpotRateApi,
getTypeRateApi
} from '@/api/workOrder.js'
provide(THEME_KEY, 'dark')
const customColor = ref('#2380FB')
const option1 = ref({
backgroundColor: 'transparent',
tooltip: {
trigger: 'item'
},
legend: {
type: 'scroll',
orient: 'vertical',
right: fitChartSize(10),
top: fitChartSize(70),
bottom: fitChartSize(20),
itemWidth: 5,
itemHeight: 5,
padding: [20, 10, 20, 10],
// itemGap:15,
show: true,
lineStyle: {
borderColor: '#fff',
width: 5
},
textStyle: {
color: '#fff',
fontSize: fitChartSize(16),
lineHeight: 16,
rich: {
d: {
width: '100%',
borderWidth: 0.5,
height: 5,
backgroundColor: '1'
},
a: {
width: fitChartSize(200),
align: 'left',
fontSize: fitChartSize(16)
// backgroundColor:'1'
// color:'1',
// borderColor:'#eee',
// borderWidth:2
}
}
},
formatter: (e) => {
let ratio = 0
let value = 0
if (option1.value.series[0].data.length > 0) {
option1.value.series[0].data.forEach((item) => {
if (e == item.name) {
ratio = ((item.value * 100) / 3799).toFixed(0)
value = item.value
}
})
}
// return `${e} ${ratio}%
let arr = ['{a|' + e + '}', '{b|' + ratio + '%}']
return arr.join('')
},
itemStyle: {
// color:'#fff'
},
backgroundColor: 'rgba(0,77,136,0.6)'
},
series: [
{
name: 'Access From',
type: 'pie',
left: 0,
top: 40,
width: fitChartSize(350),
height: fitChartSize(350),
// width:200,
// height:200,
radius: ['40%', '50%'],
avoidLabelOverlap: false,
padAngle: 5,
itemStyle: {
borderRadius: 2
},
label: {
show: false,
position: 'center',
fontWeight: 'bold'
// formatter: function (o) {
// let data = o.data.value
// return `{value|${data}}` + '\n' + `{name|整改率}`
// },
// rich: {
// value: {
// color: '#fff',
// fontSize: fitChartSize(24),
// fontWeight: 'bold',
// padding: [0, 0, 5, 0]
// },
// name: {
// color: '#7894A8',
// fontSize: fitChartSize(12)
// }
// }
},
emphasis: {
label: {
show: true,
fontSize: fitChartSize(16),
fontWeight: 'bold',
color: '#fff',
fontWeight: 'bold',
formatter: function (o) {
let data = o.data.value
return `{value|${data}}` + '\n' + `{name|整改率}`
},
rich: {
value: {
color: '#fff',
fontSize: fitChartSize(24),
fontWeight: 'bold',
padding: [0, 0, 5, 0]
},
name: {
color: '#7894A8',
fontSize: fitChartSize(12)
}
}
}
},
labelLine: {
show: true
},
data: [
{ value: 200, name: '异常状况1' },
{ value: 500, name: '异常状况2' },
{ value: 234, name: '异常状况3' },
{ value: 135, name: '异常状况4' },
{ value: 100, name: '异常状况5' },
{ value: 777, name: '异常状况6' },
{ value: 888, name: '其他' }
]
}
]
const colors = ['#FDC40A', '#FF5232', '#50F0A6', '#5FDFFA']
let totalData = ref({
total: 0,
complete: 0,
urgent: 0,
important: 0,
normal: 0
})
const option2 = ref({
backgroundColor: 'transparent',
tooltip: {
trigger: 'item'
},
legend: {
type: 'scroll',
orient: 'vertical',
right: fitChartSize(30),
top: fitChartSize(70),
bottom: fitChartSize(20),
itemWidth: 5,
itemHeight: 5,
padding: [20, 10, 20, 10],
// itemGap:15,
show: true,
lineStyle: {
borderColor: '#fff',
width: 5
},
textStyle: {
color: '#fff',
fontSize: fitChartSize(16),
lineHeight: 16,
rich: {
d: {
width: '100%',
borderWidth: 0.5,
height: 5,
backgroundColor: '1'
},
a: {
width: fitChartSize(100),
align: 'left',
fontSize: fitChartSize(16)
// backgroundColor:'1'
// color:'1',
// borderColor:'#eee',
// borderWidth:2
}
}
},
formatter: (e) => {
let ratio = 0
let value = 0
if (option1.value.series[0].data.length > 0) {
option1.value.series[0].data.forEach((item) => {
if (e == item.name) {
ratio = ((item.value * 100) / 3799).toFixed(0)
value = item.value
}
})
}
// return `${e} ${ratio}%
let arr = ['{a|' + e + '}', '{b|' + ratio + '%}']
return arr.join('')
},
itemStyle: {
// color:'#fff'
},
backgroundColor: 'rgba(0,77,136,0.6)'
},
series: [
{
name: 'Access From',
type: 'pie',
left: fitChartSize(-65),
top: fitChartSize(40),
width: fitChartSize(350),
height: fitChartSize(350),
// width:200,
// height:200,
radius: ['40%', '50%'],
avoidLabelOverlap: false,
padAngle: 5,
itemStyle: {
borderRadius: 2
},
label: {
show: false,
position: 'center',
fontWeight: 'bold'
// formatter: function (o) {
// let data = o.data.value
// return `{value|${data}}` + '\n' + `{name|整改率}`
// },
// rich: {
let completeRateData = ref({ important: 0, normal: 0, warn: 0 })
let seriesData = ref([])
let xAxisData = ref([])
let typeRateData = ref([])
let spotRateData = ref([])
// value: {
// color: '#fff',
// fontSize: fitChartSize(24),
// fontWeight: 'bold',
// padding: [0, 0, 5, 0]
// },
// name: {
// color: '#7894A8',
// fontSize: fitChartSize(12)
// }
// }
},
emphasis: {
label: {
show: true,
fontSize: fitChartSize(16),
fontWeight: 'bold',
color: '#fff',
fontWeight: 'bold',
formatter: function (o) {
let data = o.data.value
return `{value|${data}}` + '\n' + `{name|整改率}`
},
rich: {
value: {
color: '#fff',
fontSize: fitChartSize(24),
fontWeight: 'bold',
padding: [0, 0, 5, 0]
},
name: {
color: '#7894A8',
fontSize: fitChartSize(12)
}
}
}
},
labelLine: {
show: true
},
data: [
{ value: 200, name: '异常状况1' },
{ value: 500, name: '异常状况2' },
{ value: 234, name: '异常状况3' },
{ value: 135, name: '异常状况4' },
{ value: 100, name: '异常状况5' },
{ value: 777, name: '异常状况6' },
{ value: 888, name: '其他' }
]
}
]
})
const optionLine = ref({
backgroundColor: 'transparent',
height: '90%',
grid: {
top: '20',
bottom: '0',
left: '4%',
containLabel: true
},
xAxis: {
nameLocation: 'middle',
type: 'category',
boundaryGap: false,
axisLabel: {
fontSize: 10,
interval: 0, // 显示所有标签
rotate: 0 // 旋转标签45度
},
data: [
'10:00',
'10:00',
'10:00',
'10:00',
'10:00',
'10:00',
'10:00',
'10:00',
'10:00',
'10:00'
],
axisTisk: {
show: true,
// 设置刻度长度
length: 1,
lineStyle: {
type: 'dashed', // 设置为虚线
width: 0
}
},
axisLine: {
lineStyle: {
color: '#0096FF' // 设置横线颜色
}
}
},
yAxis: {
type: 'value',
min: 0,
max: 7000,
interval: 1000,
axisLabel: {
fontSize: fitChartSize(12), // 设置Y轴刻度字体大小
color: '#eee'
},
splitLine: {
show: true,
lineStyle: {
type: 'dashed',
color: '#00D0FF'
}
}
},
series: [
{
data: [0, 1000, 3000, 3500, 4200, 2000, 6000, 800, 6500, 4500],
type: 'line',
smooth: true,
label: {
show: false //隐藏坐标点
},
itemStyle: {
color: 'transparent'
},
markLine: {
symbol: ['none', 'none'],
label: { show: false }
},
areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: 'rgba(125, 231, 255, 0.1)'
},
{
offset: 1,
color: 'rgba(0, 157, 255, 0.1)'
}
])
},
lineStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
{
offset: 0,
color: '#7DE7FF'
},
{
offset: 0.5,
color: '#02F9FA'
},
{
offset: 1,
color: '#009DFF'
}
]),
width: 2
}
}
]
const getTypeRate = async () => {
let res = await getTypeRateApi()
typeRateData.value = res.data.data
}
const getSpotRate = async () => {
let res = await getSpotRateApi()
spotRateData.value = res.data.data
}
const getCompleteRate = async () => {
let res = await getCompleteRateApi()
completeRateData.value = res.data
}
const getLineChart = async () => {
let res = await getLineChartApi()
seriesData.value = res.data.series
xAxisData.value = res.data.data
}
const getTotal = async () => {
let res = await getTotalApi()
totalData.value = res.data
}
onMounted(() => {
getTotal()
getLineChart()
getCompleteRate()
getTypeRate()
getSpotRate()
})
</script>
@@ -527,9 +189,7 @@
font-size: vw(14) !important;
color: #fff;
}
.line-chart {
// margin-top:vh(20);
}
.chart-p {
position: relative;
.check-label {
@@ -541,7 +201,6 @@
padding: vw(5);
background: linear-gradient(270deg, rgba(8, 41, 86, 0.16) 0%, #0b61b4 100%);
border-radius: vw(50);
// border: 1px solid rgba(0,114,220,0.3);
margin-left: vw(5);
display: inline-block;
font-weight: 400;
@@ -561,144 +220,44 @@
}
.work-box-2 {
width: vw(1522);
height: vh(965);
margin-top: vh(100);
margin-top: vh(120);
margin-left: vw(10);
position: relative;
z-index: 99;
.work-2-flex {
.box-1 {
height: vh(500);
background: linear-gradient(321deg, #0b2f64 0%, #062b57 100%);
height: vh(490);
overflow: hidden;
.chart-box {
.chart {
display: flex;
justify-content: space-between;
padding: vw(20) vw(15);
.lt-chart {
&__wrapper {
width: vw(740);
min-height: vw(336);
padding: vw(20);
height: vh(370);
padding: 0 vw(20);
background-image: url('@/assets/images/bg-3.png');
background-size: 100% 100%;
.box-press {
.progress {
padding: vw(30);
padding-top: vh(40);
.p-item {
&-item {
display: flex;
width: 100%;
margin-top: vh(40);
align-items: center;
span {
font-weight: bold;
font-size: vw(14);
color: #ffffff;
text-align: left;
font-style: normal;
text-transform: none;
margin-right: vw(10);
}
.box-1 {
flex: 1;
}
}
}
.box {
width: 100%;
height: vh(250);
display: flex;
margin-top: vh(30);
.chart-1 {
flex: 1;
}
.chart-des {
width: vw(224);
height: vh(312);
background: #0a4190;
.t-item:nth-child(odd) {
background: rgba(0, 150, 255, 0.3);
}
.t-item:nth-child(even) {
background-color: transparent;
}
.t-item {
display: flex;
padding: vh(10) vw(10);
span {
width: vw(24);
height: vh(16);
text-align: center;
display: inline-block;
margin-right: vw(10);
color: #fff;
border-radius: 2px 2px 2px 2px;
}
p {
font-weight: 400;
font-size: vw(15);
color: #ffffff;
text-align: left;
font-style: normal;
text-transform: none;
flex: 1;
/*1. 先强制一行内显示文本*/
white-space: nowrap;
/*2. 超出的部分隐藏*/
overflow: hidden;
/*3. 文字用省略号替代超出的部分*/
text-overflow: ellipsis;
}
.bgColor1 {
background: #d9011b;
}
.bgColor2 {
background: #feae00;
}
.bgColor3 {
background: #2380fb;
}
.bgColor4 {
background: #495c77;
}
}
.t-des {
background: rgba(0, 150, 255, 0.4);
padding: vw(10);
font-weight: 400;
font-size: vw(13);
color: #02f9fa;
display: flex;
text-align: left;
font-style: normal;
text-transform: none;
img {
width: vw(16);
height: vh(12);
margin-right: vw(5);
}
}
}
}
.title-3 {
position: relative;
width: vw(344);
height: vh(12);
margin-top: vh(20);
background-image: url('@/assets/images/title-6.png');
background-size: 100% 100%;
& > span {
position: absolute;
bottom: vh(4);
left: vw(20);
font-size: vw(15);
&-item__label {
font-weight: bold;
background-image: linear-gradient(to bottom, #ffffff 0%, #0096ff 100%);
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent; /* 兼容WebKit内核浏览器 */
color: transparent; /* 兼容其他浏览器 */
font-size: vw(14);
color: #ffffff;
text-align: left;
font-style: normal;
text-transform: none;
margin-right: vw(10);
}
&-item__inner {
flex: 1;
}
}
}
@@ -752,30 +311,131 @@
background-size: 100% 100%;
}
}
.header {
position: relative;
margin: vh(20);
}
.box-2 {
height: vh(434);
background: linear-gradient(321deg, #0b2f64 0%, #062b57 100%);
.title {
margin: vh(5) auto;
width: vw(468);
height: vh(32);
font-weight: 800;
font-size: vw(16);
color: #fff;
.chart {
display: flex;
justify-content: space-between;
padding: vw(20) vw(15);
&__wrapper {
width: vw(740);
height: vh(370);
padding: 0 vw(20);
background-image: url('@/assets/images/bg-3.png');
background-size: 100% 100%;
}
&__inner {
display: flex;
align-items: center;
}
&__legend {
flex: 1;
&-item {
position: relative;
width: 100%;
height: vh(40);
display: flex;
align-items: center;
margin-bottom: vh(8);
background: linear-gradient(
90deg,
rgba(0, 150, 255, 0.34) 0%,
rgba(0, 150, 255, 0) 100%
);
&::before {
position: absolute;
content: '';
width: vw(4);
height: vh(40);
background-color: #0096ff;
}
.dot {
width: vw(4);
height: vw(4);
margin: 0 vw(16);
}
.name {
font-weight: 400;
font-size: vw(12);
color: #ffffff;
width: vw(130);
}
.value {
font-weight: bold;
font-size: vw(15);
color: #ffffff;
}
}
}
}
.alarm {
background: #0a4190;
&__wrapper {
flex: 1;
height: vh(270);
background: #054581; /* 滚动条整体样式 */
&::-webkit-scrollbar {
width: vw(4); /* 滚动条的宽度 */
}
/* 滚动条轨道 */
&::-webkit-scrollbar-track {
background: 'transparent'; /* 轨道的背景色 */
}
/* 滚动条滑块 */
&::-webkit-scrollbar-thumb {
background: rgba(0, 150, 255, 0.63); /* 滑块的背景色 */
border-radius: 5px; /* 滑块的圆角 */
}
overflow: auto;
}
&-item {
padding: 0 vw(12);
&:nth-child(2n) {
background: #054d8d;
}
height: vh(40);
display: flex;
align-items: center;
}
&-item__rank {
width: vw(24);
height: vh(16);
font-size: vw(12);
color: #ffffff;
display: flex;
align-items: center;
justify-content: center;
background-image: url('@/assets/images/title-4.png');
background-size: 100% 100%;
span {
font-weight: 800;
color: transparent;
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
background-image: linear-gradient(to bottom, #ffffff 0%, #87c9ff 100%);
}
background: #495c77;
}
&-item__rank--error {
background-color: #d9011b;
}
&-item__rank--warning {
background-color: #feae00;
}
&-item__rank--primary {
background-color: #2380fb;
}
&-item__content {
padding-left: vw(20);
font-weight: 400;
font-size: vw(14);
color: #ffffff;
}
}
}