bonus-ui/src/views/screen/cityScreen-old/components/equiStatus/index.vue

269 lines
9.2 KiB
Vue
Raw Normal View History

2025-09-14 19:34:02 +08:00
<template>
<div class="content">
<div class="content-title">
<div class="title">
装备状态
</div>
</div>
<div class="content-view">
2025-09-15 09:23:58 +08:00
<div id="lineChartFour" style="width: 100%;height: 90%;"></div>
<div class="text">备注说明在用装备包含共享装备</div>
2025-09-14 19:34:02 +08:00
</div>
</div>
</template>
2025-09-15 17:50:00 +08:00
<script>
import { equipmentStatusApi } from "@/api/screen/cityScreen";
2025-09-15 09:23:58 +08:00
import * as echarts from 'echarts'
2025-09-14 19:34:02 +08:00
export default {
data() {
return {
2025-09-15 17:50:00 +08:00
myCharts4:null,
2025-09-15 09:23:58 +08:00
barWidth:40,
size:[40, 20],
Offset1:[-0, 10],
Offset2:[-0, -10],
2025-09-15 10:49:50 +08:00
fontSize:20
2025-09-14 19:34:02 +08:00
}
},
created() {
},
2025-09-15 17:50:00 +08:00
mounted() {
2025-09-15 09:23:58 +08:00
console.log(window.innerWidth, window.innerHeight);
if(window.innerWidth<3000){
this.barWidth=20
this.size=[20, 5]
2025-09-15 10:49:50 +08:00
this.Offset1=[-0, 3]
this.Offset2=[-0, -3]
this.fontSize=10
2025-09-15 09:23:58 +08:00
}
this.InitEChartsOne()
2025-09-14 19:34:02 +08:00
},
methods: {
2025-09-15 09:23:58 +08:00
InitEChartsOne() {
2025-09-15 17:50:00 +08:00
equipmentStatusApi({companyId:sessionStorage.getItem('companyId')}).then((response) => {
console.log(response,"equipmentStatusApi")
var dataList = response.data||[];
var xData=[]
var yData=[]
var rateData=[]
dataList.forEach(item=>{
xData.push(item.name)
yData.push(item.num)
rateData.push(item.rate)
})
2025-09-15 09:23:58 +08:00
var option = {
2025-09-15 10:49:50 +08:00
grid: {
show: true,
2025-11-27 10:29:03 +08:00
left: '18%',
2025-09-15 10:49:50 +08:00
right: '10%',
top: '20%',
bottom: '15%',
borderColor: "transparent"
},
2025-09-15 09:23:58 +08:00
xAxis: {
2025-09-15 17:50:00 +08:00
data: xData,
2025-09-15 09:23:58 +08:00
axisTick: {
show: false
},
axisLine: {
show: true
},
axisLabel: {
interval: 0,
textStyle: {
2025-09-15 10:49:50 +08:00
color: '#ccc',
fontSize: this.fontSize,
2025-09-15 09:23:58 +08:00
},
2025-09-15 10:49:50 +08:00
margin: 10, //刻度标签与轴线之间的距离。
2025-09-15 09:23:58 +08:00
},
},
yAxis: {
// name:"单位t",
nameTextStyle:{
2025-09-15 10:49:50 +08:00
color: '#ccc',
fontSize:this.fontSize ,
2025-09-15 09:23:58 +08:00
},
splitLine: {
show: false,
},
axisTick: {
show: true,
},
axisLine: {
show: true,
},
axisLabel: {
textStyle: {
2025-09-15 10:49:50 +08:00
color: '#ccc',
fontSize: this.fontSize,
2025-09-15 09:23:58 +08:00
},
}
},
series: [
{
type: 'bar',
barWidth:this.barWidth,
z: 10,
itemStyle: {
color: {
x: 1,
y: 0,
x2: 0,
y2: 0,
type: "linear",
global: false,
colorStops: [
{
offset: 0,
color: '#217CA7',
},
{
offset: .5,
color: '#217CA7'
},
{
offset: .5,
color: '#2B9CCC'
},
{
offset: 1,
color: '#2B9CCC'
}
],
},
},
label: {
show: true,
position: 'top',
offset: 0,
2025-09-15 10:49:50 +08:00
fontSize: this.fontSize,
color: '#ccc',
2025-09-15 09:23:58 +08:00
formatter: function(params) {
2025-09-15 17:50:00 +08:00
// console.log(params)
var str = params.value+ "/" + rateData[params.dataIndex]+"%";
2025-09-15 09:23:58 +08:00
return str;
},
},
2025-09-15 17:50:00 +08:00
data:yData
2025-09-15 09:23:58 +08:00
},
{
"name": "",
barWidth:this.barWidth,
"type": "pictorialBar",
symbol: 'diamond',
"symbolSize": this.size,
"symbolOffset": this.Offset1,
"z": 1,
itemStyle: {
2025-09-15 10:49:50 +08:00
color: {
x: 1,
y: 0,
x2: 0,
y2: 0,
type: "linear",
global: false,
colorStops: [
{
offset: 0,
color: '#217CA7',
},
{
offset: .5,
color: '#217CA7'
},
{
offset: .5,
color: '#2B9CCC'
},
{
offset: 1,
color: '#2B9CCC'
}
],
},
2025-09-15 09:23:58 +08:00
},
2025-09-15 10:49:50 +08:00
"data": [1, 1, 1, 1]
2025-09-15 09:23:58 +08:00
},
{
"name": "",
barWidth:this.barWidth,
"type": "pictorialBar",
symbol: 'diamond',
symbolPosition: 'end',
"symbolSize": this.size,
"symbolOffset": this.Offset2,
"z": 50,
itemStyle:{
opacity: 1,
color:'#2B9CCC',
},
2025-09-15 17:50:00 +08:00
"data": yData
2025-09-15 09:23:58 +08:00
},
]
};
2025-09-15 17:50:00 +08:00
this.myCharts4 = echarts.init(document.querySelector('#lineChartFour'));
this.myCharts4.setOption(option)
});
2025-09-15 09:23:58 +08:00
},
2025-09-14 19:34:02 +08:00
},
}
</script>
<style lang="scss" scoped>
.content{
width: 100%;
height: 100%;
background-image: url("../../../../../assets/cityScreen/equiStatusBg.png");
background-repeat: no-repeat;
background-size: 100% 100%;
}
.content-title{
width: 100%;
height: 18%;
position: relative;
color: #78D6FF;
}
.title{
font-size: 24px;
position: absolute;
top: 42%;
left: 18%;
2025-11-27 10:29:03 +08:00
font-family: DS-TITLE;
background: linear-gradient(180deg, #fff 19.35%, #5dcbfe 77.42%);
background-clip: text;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
2025-09-14 19:34:02 +08:00
}
.content-view{
width: 100%;
height: 85%;
padding-left: 8%;
}
2025-09-15 09:23:58 +08:00
.text{
width: 100%;margin-bottom: 10px;color: #A9C4F8;text-align: center;
font-size: 24px;
}
2025-09-15 17:50:00 +08:00
@media screen and (min-width: 1080px) {
2025-09-14 19:34:02 +08:00
.title{
font-size: 10px;
}
2025-09-15 09:23:58 +08:00
.text{
font-size: 10px;
}
2025-09-14 19:34:02 +08:00
}
@media screen and (min-width: 3000px) {
.title{
font-size: 24px;
}
2025-09-15 09:23:58 +08:00
.text{
font-size: 24px;
}
2025-09-14 19:34:02 +08:00
}
</style>