修改
This commit is contained in:
@@ -36,7 +36,9 @@ export default {
|
||||
},
|
||||
data() {
|
||||
// 城市数组的顺序必须是固定的
|
||||
const cities = ["瑞昌", "邯郸", "株洲", "佳木斯", "成都", "凯盛", "蚌埠"];
|
||||
const cities = ["瑞昌", "邯郸",
|
||||
// "株洲", "佳木斯", "成都", "凯盛", "蚌埠"
|
||||
];
|
||||
return {
|
||||
xAxis: cities,
|
||||
};
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2024-05-10 11:10:54
|
||||
* @LastEditTime: 2024-05-30 13:23:03
|
||||
* @LastEditTime: 2024-05-31 16:19:45
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div class="chip-rate">
|
||||
<ChipRateItem :period="period" :than="than" :cities="['成都', '邯郸', '株洲', '瑞昌']" :color="1" />
|
||||
<ChipRateItem :period="period" :than="than" :cities="['佳木斯', '凯盛光伏', '蚌埠兴科']" :color="2" />
|
||||
<ChipRateItem :period="period" :than="than" :cities="['邯郸', '瑞昌']" :color="1" />
|
||||
<!-- <ChipRateItem :period="period" :than="than" :cities="['佳木斯', '凯盛光伏', '蚌埠兴科']" :color="2" /> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -43,15 +43,15 @@ export default {
|
||||
gap: 5px;
|
||||
position: relative;
|
||||
|
||||
&:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 0;
|
||||
width: 3px;
|
||||
height: 100%;
|
||||
transform: translateX(-50%);
|
||||
background: linear-gradient(to bottom, transparent, #00f2ff, transparent);
|
||||
}
|
||||
// &:after {
|
||||
// content: "";
|
||||
// position: absolute;
|
||||
// left: 50%;
|
||||
// top: 0;
|
||||
// width: 3px;
|
||||
// height: 100%;
|
||||
// transform: translateX(-50%);
|
||||
// background: linear-gradient(to bottom, transparent, #00f2ff, transparent);
|
||||
// }
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2024-05-07 10:25:10
|
||||
* @LastEditTime: 2024-05-30 11:19:51
|
||||
* @LastEditTime: 2024-05-31 16:38:29
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
|
||||
<template>
|
||||
<!-- <div class="order"> -->
|
||||
<div class="std-rate" style="width: 100%; overflow: hidden scroll; height: 400px">
|
||||
<div class="span-2">
|
||||
<div class="std-rate" style="width: 100%; overflow: hidden scroll; height: 400px">
|
||||
<!-- <div class="span-2">
|
||||
<StdRateItem :period="period" :city="cities[5]" />
|
||||
</div>
|
||||
<div class="flex-item" v-for="item in cities.filter((val, index) => index != 5)" :key="item.name">
|
||||
<StdRateItem :period="period" :than="than" :city="item" />
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="span-2" v-for="item in cities.filter((val, index) => index != 5)" :key="item.name">
|
||||
<StdRateItem :period="period" :than="than" :city="item" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -49,8 +49,8 @@ export default {
|
||||
// break;
|
||||
// }
|
||||
const _cities = [
|
||||
{ name: "瑞昌", target: 0, total: 0, current: 0, componentYield: 0, goodNumber:0,},
|
||||
{ name: "邯郸", target: 0, total: 0, current: 0, componentYield: 0, goodNumber: 0, },
|
||||
{ name: "瑞昌", target: 0, previous: 0, current: 0, componentYield: 0, goodNumber: 0, },
|
||||
{ name: "邯郸",target: 0, previous: 0, current: 0, componentYield: 0, goodNumber: 0, },
|
||||
{ name: "株洲", target: 0, previous: 0, current: 0, componentYield: 0, goodNumber: 0, },
|
||||
{ name: "佳木斯", target: 0, previous: 0, current: 0, componentYield: 0, goodNumber: 0, },
|
||||
{ name: "成都", target: 0, previous: 0, current: 0, componentYield: 0, goodNumber: 0, },
|
||||
@@ -80,7 +80,10 @@ export default {
|
||||
}
|
||||
// 删掉凯盛光伏
|
||||
// _cities.splice(4, 1);
|
||||
return _cities;
|
||||
let arr = []
|
||||
arr.push(_cities[0])
|
||||
arr.push(_cities[1])
|
||||
return arr;
|
||||
},
|
||||
},
|
||||
data() {
|
||||
|
||||
@@ -36,7 +36,9 @@ export default {
|
||||
},
|
||||
data() {
|
||||
// 城市数组的顺序必须是固定的
|
||||
const cities = ["瑞昌", "邯郸", "株洲", "佳木斯", "成都", "凯盛", "蚌埠"];
|
||||
const cities = ["瑞昌", "邯郸",
|
||||
// "株洲", "佳木斯", "成都", "凯盛", "蚌埠"
|
||||
];
|
||||
return {
|
||||
xAxis: cities,
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2024-05-07 13:22:43
|
||||
* @LastEditTime: 2024-05-29 14:09:08
|
||||
* @LastEditTime: 2024-05-31 15:55:00
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
@@ -11,7 +11,7 @@
|
||||
<span v-for="(item,index) in legend" :key="index" class="legend-item"
|
||||
:style="{ fontSize: isFullscreen ? '0.58vw' : '0.54vw' }">{{ item.label }}</span>
|
||||
</div>
|
||||
<div ref="oeeChart" style="height:96%;width:100%"></div>
|
||||
<div ref="oeeChart" style="height:100%;width:100%"></div>
|
||||
</chart-container>
|
||||
</template>
|
||||
|
||||
@@ -220,30 +220,30 @@ export default {
|
||||
this.canvasReset()
|
||||
},
|
||||
/** 全屏状态切换时,对柱子粗细和字体大小进行相应调整 */
|
||||
isFullscreen(val) {
|
||||
this.actualOptions.series.map((item) => {
|
||||
item.barWidth = val ? 18 : 12;
|
||||
});
|
||||
this.actualOptions.xAxis.axisLabel.fontSize = val ? 18 : 12;
|
||||
this.actualOptions.yAxis.axisLabel.fontSize = val ? 18 : 12;
|
||||
this.actualOptions.yAxis.nameTextStyle.fontSize = val ? 18 : 12;
|
||||
// if (val === false && this.isOpen === true) {
|
||||
// console.log(val)
|
||||
// this.width = 97 + '%'
|
||||
// this.canvasReset()
|
||||
// } else if (val === false && this.isOpen === false) {
|
||||
// this.width = 100 + '%'
|
||||
// this.canvasReset()
|
||||
// }
|
||||
// this.actualOptions.series.map((item) => {
|
||||
// item.barWidth = val ? 18 : 12;
|
||||
// });
|
||||
// this.actualOptions.xAxis.axisLabel.fontSize = val ? 18 : 12;
|
||||
// this.actualOptions.yAxis.axisLabel.fontSize = val ? 18 : 12;
|
||||
// this.actualOptions.yAxis.nameTextStyle.fontSize = val ? 18 : 12;
|
||||
this.initChart(this.actualOptions)
|
||||
this.canvasReset()
|
||||
},
|
||||
// isFullscreen(val) {
|
||||
// this.actualOptions.series.map((item) => {
|
||||
// item.barWidth = val ? 18 : 12;
|
||||
// });
|
||||
// this.actualOptions.xAxis.axisLabel.fontSize = val ? 18 : 12;
|
||||
// this.actualOptions.yAxis.axisLabel.fontSize = val ? 18 : 12;
|
||||
// this.actualOptions.yAxis.nameTextStyle.fontSize = val ? 18 : 12;
|
||||
// // if (val === false && this.isOpen === true) {
|
||||
// // console.log(val)
|
||||
// // this.width = 97 + '%'
|
||||
// // this.canvasReset()
|
||||
// // } else if (val === false && this.isOpen === false) {
|
||||
// // this.width = 100 + '%'
|
||||
// // this.canvasReset()
|
||||
// // }
|
||||
// // this.actualOptions.series.map((item) => {
|
||||
// // item.barWidth = val ? 18 : 12;
|
||||
// // });
|
||||
// // this.actualOptions.xAxis.axisLabel.fontSize = val ? 18 : 12;
|
||||
// // this.actualOptions.yAxis.axisLabel.fontSize = val ? 18 : 12;
|
||||
// // this.actualOptions.yAxis.nameTextStyle.fontSize = val ? 18 : 12;
|
||||
// this.initChart(this.actualOptions)
|
||||
// this.canvasReset()
|
||||
// },
|
||||
series(val) {
|
||||
if (!val) {
|
||||
this.initChart(this.options);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2024-05-23 15:50:44
|
||||
* @LastEditTime: 2024-05-29 14:25:10
|
||||
* @LastEditTime: 2024-05-31 15:54:41
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
@@ -11,7 +11,7 @@
|
||||
<span v-for="(item,index) in legend" :key="index" class="legend-item"
|
||||
:style="{ fontSize: isFullscreen ? '0.58vw' : '0.54vw' }">{{ item.label }}</span>
|
||||
</div>
|
||||
<div ref="oeeChart" style="height:96%;width:100%"></div>
|
||||
<div ref="oeeChart" style="height:100%;width:100%"></div>
|
||||
</chart-container>
|
||||
</template>
|
||||
|
||||
@@ -241,7 +241,7 @@ export default {
|
||||
// this.actualOptions.xAxis.axisLabel.fontSize = val ? 18 : 12;
|
||||
// this.actualOptions.yAxis.axisLabel.fontSize = val ? 18 : 12;
|
||||
// this.actualOptions.yAxis.nameTextStyle.fontSize = val ? 18 : 12;
|
||||
this.initChart(this.actualOptions)
|
||||
// this.initChart(this.actualOptions)
|
||||
// this.canvasReset()
|
||||
},
|
||||
series(val) {
|
||||
|
||||
@@ -79,15 +79,64 @@ export default {
|
||||
];
|
||||
},
|
||||
options() {
|
||||
const single = this.period === "日" || this.period === "周";
|
||||
// const single = this.period === "日" || this.period === "周";
|
||||
const today = new Date().getDate();
|
||||
const year = new Date().getFullYear();
|
||||
const month = new Date().getMonth() + 1;
|
||||
const vt = this.valueTuple;
|
||||
let titleValue = single
|
||||
? (vt[1] != null && `${vt[1] * 100}%`) || "0%"
|
||||
: vt[0] != null && vt[2] != null && vt[2] !== 0
|
||||
? `${((vt[1] / vt[2]) * 100).toFixed(0)}%`
|
||||
: "0%",
|
||||
let items = [];
|
||||
var day1 = new Date();
|
||||
day1.setTime(day1.getTime() - 24 * 60 * 60 * 1000);
|
||||
var yesterday = (day1.getMonth() + 1) + "月" + day1.getDate()
|
||||
//今天的时间
|
||||
// var day2 = new Date();
|
||||
// day2.setTime(day2.getTime());
|
||||
// var s2 = (day2.getMonth() + 1) + "月" + day2.getDate() + '日';
|
||||
// const today = new Date().getDate();
|
||||
// let yesterday = new Date().getDate() -1;
|
||||
// const month = new Date().getMonth() + 1;
|
||||
const lastMonth = new Date().getMonth() + 1 === 12 ? 1 : new Date().getMonth() + 1 - 1;
|
||||
// const year = new Date().getFullYear();
|
||||
if (this.period === '日' && this.than === '同比') {
|
||||
items = [
|
||||
{ label: `${month}月${today}日良率`, },
|
||||
{ label: `去年${month}月${today}日良率` },
|
||||
];
|
||||
} else if (this.period === '日' && this.than === '环比') {
|
||||
items = [
|
||||
{ label: `${month}月${today}日良率` },
|
||||
{ label: `${yesterday}日良率` },
|
||||
];
|
||||
} else if (this.period === '周' && this.than === '同比') {
|
||||
items = [
|
||||
{ label: `本周良率`, },
|
||||
{ label: `去年本周良率` },
|
||||
];
|
||||
} else if (this.period === '周' && this.than === '环比') {
|
||||
items = [
|
||||
{ label: `本周良率`, },
|
||||
{ label: `上周良率`, },
|
||||
];
|
||||
} else if (this.period === '月' && this.than === '同比') {
|
||||
items = [
|
||||
{ label: `${month}月良率`, },
|
||||
{ label: `去年${month}月良率`, },
|
||||
{ label: `${month}月目标良率`, },
|
||||
];
|
||||
} else if (this.period === '月' && this.than === '环比') {
|
||||
items = [
|
||||
{ label: `${month}月良率`, },
|
||||
{ label: `${lastMonth}月良率`, },
|
||||
{ label: `${month}月目标良率`, },
|
||||
];
|
||||
} else {
|
||||
items = [
|
||||
{ label: `${year}年良率`, },
|
||||
{ label: `${year - 1}年良率` },
|
||||
{ label: `${year}年目标良率` },
|
||||
];
|
||||
}
|
||||
let titleValue = vt[1] === null ? 0 + '%' : this.formatNumber(vt[1]) + '%',
|
||||
subtitle = {
|
||||
日: "本日良率",
|
||||
周: "本周良率",
|
||||
@@ -96,10 +145,12 @@ export default {
|
||||
}[this.period];
|
||||
|
||||
const t = getOptions({
|
||||
single,
|
||||
// single,
|
||||
color: this.color == 1 ? "#4CF0E8" : "#1065ff",
|
||||
titleValue,
|
||||
subtitle,
|
||||
currentName: items[0].label,
|
||||
preName: items[1].label,
|
||||
previousSum: vt[0],
|
||||
currentSum: vt[1],
|
||||
targetSum: vt[2],
|
||||
@@ -122,41 +173,45 @@ export default {
|
||||
const year = new Date().getFullYear();
|
||||
if (this.period === '日' && this.than === '同比') {
|
||||
items = [
|
||||
{ label: `${month}月${today}日良率`, value: isNaN(this.valueTuple[1]) || this.valueTuple[1] == null ? 0 + "%" : (this.valueTuple[1]) + "%" },
|
||||
{ label: `去年${month}月${today}日良率`, value: isNaN(this.valueTuple[0]) || this.valueTuple[0] == null ? 0 + "%" : (this.valueTuple[0]) + "%" },
|
||||
{ label: `去年${month}月${today}日良率`, value: isNaN(this.valueTuple[0]) || this.valueTuple[0] == null ? 0 + "%" : (this.formatNumber(this.valueTuple[0]) ) + "%" },
|
||||
{ label: `${month}月${today}日良率`, value: isNaN(this.valueTuple[1]) || this.valueTuple[1] == null ? 0 + "%" : (this.formatNumber(this.valueTuple[1])) + "%" },
|
||||
];
|
||||
} else if (this.period === '日' && this.than === '环比') {
|
||||
items = [
|
||||
{ label: `${month}月${today}日良率`, value: isNaN(this.valueTuple[1]) || this.valueTuple[1] == null ? 0 + "%" : (this.valueTuple[1]) + "%" },
|
||||
{ label: `${yesterday}日良率`, value: isNaN(this.valueTuple[0]) || this.valueTuple[0] == null ? 0 + "%" : (this.valueTuple[0]) + "%" },
|
||||
{ label: `${yesterday}日良率`, value: isNaN(this.valueTuple[0]) || this.valueTuple[0] == null ? 0 + "%" : (this.formatNumber(this.valueTuple[0])) + "%" },
|
||||
{ label: `${month}月${today}日良率`, value: isNaN(this.valueTuple[1]) || this.valueTuple[1] == null ? 0 + "%" : (this.formatNumber(this.valueTuple[1])) + "%" },
|
||||
];
|
||||
} else if (this.period === '周' && this.than === '同比') {
|
||||
items = [
|
||||
{ label: `本周良率`, value: isNaN(this.valueTuple[1]) || this.valueTuple[1] == null ? 0 + "%" : (this.valueTuple[1]) + "%" },
|
||||
{ label: `去年本周良率`, value: isNaN(this.valueTuple[0]) || this.valueTuple[0] == null ? 0 + "%" : (this.valueTuple[0]) + "%" },
|
||||
{ label: `去年本周良率`, value: isNaN(this.valueTuple[0]) || this.valueTuple[0] == null ? 0 + "%" : (this.formatNumber(this.valueTuple[0])) + "%" },
|
||||
{ label: `本周良率`, value: isNaN(this.valueTuple[1]) || this.valueTuple[1] == null ? 0 + "%" : (this.formatNumber(this.valueTuple[1])) + "%" },
|
||||
|
||||
];
|
||||
} else if (this.period === '周' && this.than === '环比') {
|
||||
items = [
|
||||
{ label: `本周良率`, value: isNaN(this.valueTuple[1]) || this.valueTuple[1] == null ? 0 + "%" : (this.valueTuple[1]) + "%" },
|
||||
{ label: `上周良率`, value: isNaN(this.valueTuple[0]) || this.valueTuple[0] == null ? 0 + "%" : (this.valueTuple[0]) + "%" },
|
||||
{ label: `上周良率`, value: isNaN(this.valueTuple[0]) || this.valueTuple[0] == null ? 0 + "%" : (this.formatNumber(this.valueTuple[0])) + "%" },
|
||||
{ label: `本周良率`, value: isNaN(this.valueTuple[1]) || this.valueTuple[1] == null ? 0 + "%" : (this.formatNumber(this.valueTuple[1])) + "%" },
|
||||
];
|
||||
} else if (this.period === '月' && this.than === '同比') {
|
||||
items = [
|
||||
{ label: `${month}月良率`, value: isNaN(this.valueTuple[1]) || this.valueTuple[1] == null ? 0 + "%" : (this.valueTuple[1]) + "%" },
|
||||
{ label: `去年${month}月良率`, value: isNaN(this.valueTuple[0]) || this.valueTuple[0] == null ? 0 + "%" : (this.valueTuple[0]) + "%" },
|
||||
{ label: `${month}月目标良率`, value: isNaN(this.valueTuple[2]) || this.valueTuple[2] == null ? 0 + "%" : (this.valueTuple[2]) + "%" },
|
||||
{ label: `去年${month}月良率`, value: isNaN(this.valueTuple[0]) || this.valueTuple[0] == null ? 0 + "%" : (this.formatNumber(this.valueTuple[0])) + "%" },
|
||||
{ label: `${month}月良率`, value: isNaN(this.valueTuple[1]) || this.valueTuple[1] == null ? 0 + "%" : (this.formatNumber(this.valueTuple[1])) + "%" },
|
||||
|
||||
{ label: `${month}月目标良率`, value: isNaN(this.valueTuple[2]) || this.valueTuple[2] == null ? 0 + "%" : (this.formatNumber(this.valueTuple[2])) + "%" },
|
||||
];
|
||||
} else if (this.period === '月' && this.than === '环比') {
|
||||
items = [
|
||||
{ label: `${month}月良率`, value: isNaN(this.valueTuple[1]) || this.valueTuple[1] == null ? 0 + "%" : (this.valueTuple[1]) + "%" },
|
||||
{ label: `${lastMonth}月良率`, value: isNaN(this.valueTuple[0]) || this.valueTuple[0] == null ? 0 + "%" : (this.valueTuple[0]) + "%" },
|
||||
{ label: `${month}月目标良率`, value: isNaN(this.valueTuple[2]) || this.valueTuple[2] == null ? 0 + "%" : (this.valueTuple[2]) + "%" },
|
||||
{ label: `${lastMonth}月良率`, value: isNaN(this.valueTuple[0]) || this.valueTuple[0] == null ? 0 + "%" : (this.formatNumber(this.valueTuple[0])) + "%" },
|
||||
{ label: `${month}月良率`, value: isNaN(this.valueTuple[1]) || this.valueTuple[1] == null ? 0 + "%" : (this.formatNumber(this.valueTuple[1])) + "%" },
|
||||
|
||||
{ label: `${month}月目标良率`, value: isNaN(this.valueTuple[2]) || this.valueTuple[2] == null ? 0 + "%" : (this.formatNumber(this.valueTuple[2])) + "%" },
|
||||
];
|
||||
} else {
|
||||
items = [
|
||||
{ label: `${year}年良率`, value: isNaN(this.valueTuple[1]) || this.valueTuple[1] == null ? 0 + "%" : (this.valueTuple[1]) + "%" },
|
||||
{ label: `${year - 1}年良率`, value: isNaN(this.valueTuple[0]) || this.valueTuple[0] == null ? 0 + "%" : (this.valueTuple[0]) + "%" },
|
||||
{ label: `${year}年目标良率`, value: isNaN(this.valueTuple[2]) || this.valueTuple[2] == null ? 0 + "%" : (this.valueTuple[2]) + "%" },
|
||||
{ label: `${year - 1}年良率`, value: isNaN(this.valueTuple[0]) || this.valueTuple[0] == null ? 0 + "%" : (this.formatNumber(this.valueTuple[1])) + "%" },
|
||||
{ label: `${year}年良率`, value: isNaN(this.valueTuple[1]) || this.valueTuple[1] == null ? 0 + "%" : (this.formatNumber(this.valueTuple[1])) + "%" },
|
||||
|
||||
{ label: `${year}年目标良率`, value: isNaN(this.valueTuple[2]) || this.valueTuple[2] == null ? 0 + "%" : (this.formatNumber(this.valueTuple[2])) + "%" },
|
||||
];
|
||||
}
|
||||
return items
|
||||
@@ -191,6 +246,15 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
formatNumber(num) {
|
||||
// 判断是否为整数
|
||||
if (Number.isInteger(num)) {
|
||||
return num; // 如果是整数,直接转换为字符串
|
||||
} else {
|
||||
// 如果不是整数,保留两位小数并转换为字符串
|
||||
return num.toFixed(2);
|
||||
}
|
||||
},
|
||||
handleCityUpdate(id) {
|
||||
this.factoryId = id;
|
||||
},
|
||||
@@ -216,14 +280,11 @@ export default {
|
||||
.chart {
|
||||
// margin-left: 5%;
|
||||
// width: 290px;
|
||||
align-self: stretch;
|
||||
// flex: 1 1 auto;
|
||||
// align-items: center;
|
||||
// margin:0 auto;
|
||||
// padding: 0 10%;;
|
||||
flex: 1 1 auto;
|
||||
padding: 0 15%;
|
||||
/* margin: 10%; */
|
||||
/* min-width: 300px; */
|
||||
height: 200px;
|
||||
align-self: stretch;
|
||||
}
|
||||
.legend {
|
||||
height: 80px;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<!--
|
||||
<!--
|
||||
filename: DoubleRingChart.vue
|
||||
author: liubin
|
||||
date: 2024-04-17 11:01:55
|
||||
description:
|
||||
description:
|
||||
-->
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2024-05-07 10:04:53
|
||||
* @LastEditTime: 2024-05-30 11:13:01
|
||||
* @LastEditTime: 2024-05-31 13:19:34
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
|
||||
@@ -1,163 +1,138 @@
|
||||
export default function ({
|
||||
single = false,
|
||||
color,
|
||||
export default ({
|
||||
titleValue,
|
||||
subtitle,
|
||||
previousSum,
|
||||
currentSum,
|
||||
targetSum,
|
||||
}) {
|
||||
return {
|
||||
grid: {
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
top: 0,
|
||||
containLabel: true,
|
||||
currentName,
|
||||
preName,
|
||||
}) => ({
|
||||
grid: {
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
top: 0,
|
||||
containLabel: true,
|
||||
},
|
||||
tooltip: {},
|
||||
title: {
|
||||
text: titleValue,
|
||||
left: "44%",
|
||||
top: "37%",
|
||||
textAlign: "center",
|
||||
textStyle: {
|
||||
fontWeight: 600,
|
||||
fontSize: 32,
|
||||
color: "#fffd",
|
||||
},
|
||||
tooltip: {
|
||||
// formatter(params) {
|
||||
// return `${params.name}: ${(params.value * 100).toFixed(0)}%`;
|
||||
// }
|
||||
subtext: `\u2002${subtitle}\u2002`,
|
||||
subtextStyle: {
|
||||
fontSize: 14,
|
||||
fontWeight: 100,
|
||||
color: "#fffd",
|
||||
align: "right",
|
||||
},
|
||||
title: {
|
||||
text: titleValue,
|
||||
left: "49%",
|
||||
top: "39%",
|
||||
textAlign: "center",
|
||||
textStyle: {
|
||||
fontWeight: 600,
|
||||
fontSize: 32,
|
||||
color: "#fffd",
|
||||
},
|
||||
subtext: `\u2002${subtitle}\u2002`,
|
||||
subtextStyle: {
|
||||
fontSize: 14,
|
||||
fontWeight: 100,
|
||||
color: "#fffd",
|
||||
align: "right",
|
||||
},
|
||||
series: [
|
||||
// 背景 series
|
||||
{
|
||||
type: "pie",
|
||||
name: "当前良率",
|
||||
radius: ["70%", "85%"],
|
||||
center: ["45%", "52%"],
|
||||
emptyCircleStyle: {
|
||||
color: "#042c5f33",
|
||||
},
|
||||
},
|
||||
series: [
|
||||
// 背景 series
|
||||
{
|
||||
type: "pie",
|
||||
name: "当前目标",
|
||||
radius: ["70%", "85%"],
|
||||
center: ["50%", "52%"],
|
||||
emptyCircleStyle: {
|
||||
color: "#040c5f45",
|
||||
},
|
||||
// 数据 series
|
||||
{
|
||||
type: "pie",
|
||||
radius: ["70%", "85%"],
|
||||
center: ["45%", "52%"],
|
||||
avoidLabelOvervlap: false,
|
||||
label: {
|
||||
show: false,
|
||||
},
|
||||
// 数据 series
|
||||
{
|
||||
type: "pie",
|
||||
radius: ["70%", "85%"],
|
||||
center: ["50%", "52%"],
|
||||
avoidLabelOvervlap: false,
|
||||
label: {
|
||||
show: false,
|
||||
},
|
||||
labelLine: {
|
||||
show: false,
|
||||
},
|
||||
data: [
|
||||
{
|
||||
value: currentSum,
|
||||
name: "当前良率",
|
||||
selected: false,
|
||||
itemStyle: {
|
||||
borderJoin: "round",
|
||||
borderCap: "round",
|
||||
borderWidth: 12,
|
||||
borderRadius: "50%",
|
||||
color: {
|
||||
type: "linear",
|
||||
x: 1,
|
||||
y: 0,
|
||||
x2: 0,
|
||||
y2: 1,
|
||||
colorStops: single
|
||||
? [
|
||||
{ offset: 0, color: `${color}11` },
|
||||
{ offset: 1, color: `${color}` },
|
||||
]
|
||||
: [
|
||||
{ offset: 0, color: "#4CF0E811" },
|
||||
{ offset: 1, color: "#4CF0E8" },
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
value:
|
||||
targetSum > currentSum
|
||||
? targetSum - currentSum
|
||||
: targetSum == 0
|
||||
? currentSum == 0
|
||||
? 1
|
||||
: 0
|
||||
: targetSum,
|
||||
|
||||
name: "未达成",
|
||||
itemStyle: { color: "transparent" },
|
||||
label: { show: false },
|
||||
},
|
||||
],
|
||||
labelLine: {
|
||||
show: false,
|
||||
},
|
||||
// 数据 series2 - 2023累计
|
||||
single
|
||||
? null
|
||||
: {
|
||||
type: "pie",
|
||||
radius: ["55%", "70%"],
|
||||
center: ["50%", "52%"],
|
||||
avoidLabelOvervlap: false,
|
||||
label: {
|
||||
show: false,
|
||||
data: [
|
||||
{
|
||||
value: currentSum,
|
||||
name: currentName,
|
||||
selected: false,
|
||||
itemStyle: {
|
||||
borderJoin: "round",
|
||||
borderCap: "round",
|
||||
borderWidth: 12,
|
||||
borderRadius: "50%",
|
||||
color: {
|
||||
type: "linear",
|
||||
x: 1,
|
||||
y: 0,
|
||||
x2: 0,
|
||||
y2: 1,
|
||||
colorStops: [
|
||||
{ offset: 0, color: "#4CF0E811" },
|
||||
{ offset: 1, color: "#4CF0E8" },
|
||||
],
|
||||
},
|
||||
labelLine: {
|
||||
show: false,
|
||||
},
|
||||
data: [
|
||||
{
|
||||
value: previousSum,
|
||||
name: "上期良率",
|
||||
selected: false,
|
||||
itemStyle: {
|
||||
borderJoin: "round",
|
||||
borderCap: "round",
|
||||
borderWidth: 12,
|
||||
borderRadius: "50%",
|
||||
color: {
|
||||
type: "linear",
|
||||
x: 1,
|
||||
y: 0,
|
||||
x2: 0,
|
||||
y2: 1,
|
||||
colorStops: [
|
||||
{ offset: 0, color: "#1065ff66" },
|
||||
{ offset: 1, color: "#1065ff" },
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
value:
|
||||
targetSum > previousSum
|
||||
? targetSum - previousSum
|
||||
: previousSum == 0
|
||||
? 1
|
||||
: 0,
|
||||
name: "-",
|
||||
formatter: {
|
||||
show: false
|
||||
},
|
||||
itemStyle: { color: "transparent" },
|
||||
label: { show: false },
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
},
|
||||
{
|
||||
value:currentSum == 0
|
||||
? 1
|
||||
: 0,
|
||||
name: "未达成良率",
|
||||
itemStyle: { color: "transparent" },
|
||||
label: { show: false },
|
||||
},
|
||||
],
|
||||
},
|
||||
// 数据 series2 - 2023累计
|
||||
{
|
||||
type: "pie",
|
||||
radius: ["55%", "70%"],
|
||||
center: ["45%", "52%"],
|
||||
avoidLabelOvervlap: false,
|
||||
label: {
|
||||
show: false,
|
||||
},
|
||||
labelLine: {
|
||||
show: false,
|
||||
},
|
||||
data: [
|
||||
{
|
||||
value: previousSum,
|
||||
name: preName,
|
||||
selected: false,
|
||||
itemStyle: {
|
||||
borderJoin: "round",
|
||||
borderCap: "round",
|
||||
borderWidth: 12,
|
||||
borderRadius: "50%",
|
||||
color: {
|
||||
type: "linear",
|
||||
x: 1,
|
||||
y: 0,
|
||||
x2: 0,
|
||||
y2: 1,
|
||||
colorStops: [
|
||||
{ offset: 0, color: "#1065ff66" },
|
||||
{ offset: 1, color: "#1065ff" },
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
value:previousSum == 0
|
||||
? 1
|
||||
: 0,
|
||||
name: "-",
|
||||
itemStyle: { color: "transparent" },
|
||||
label: { show: false },
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user