Browse Source

Merge branch 'develop' of http://39.106.31.193:9211/mengff/jihe-hs into develop

wangqin
hui 1 year ago
parent
commit
0ebec8f882
  1. 12
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/dailyDisposal/assets/charts.js
  2. 119
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/dailyDisposal/index.vue

12
ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/dailyDisposal/assets/charts.js

@ -4,7 +4,7 @@ window.echartsData = [
{ value: 35, name: "已处理" }, { value: 35, name: "已处理" },
]; ];
window.colorList = ["#FFee0B", "#61D8FF", "#6AE0BC"]; window.colorList = ["#FFee0B", "#61D8FF", "#6AE0BC", "#1DA7FF"];
window.count = 0; window.count = 0;
echartsData.forEach((it) => { echartsData.forEach((it) => {
@ -66,10 +66,10 @@ var options = {
{ {
name: "", name: "",
type: "pie", type: "pie",
radius: "60px", radius: "70%",
width: "200px", // width: "200px",
center: ["130px", "50%"], center: ["130px", "50%"],
roseType: "radius", // roseType: "radius",
label: { label: {
show: false, show: false,
position: "outside", position: "outside",
@ -111,11 +111,11 @@ var options = {
{ {
name: "", name: "",
type: "pie", type: "pie",
radius: "70px", radius: "80%",
hoverAnimation: false, hoverAnimation: false,
emphasis: { scale: false }, emphasis: { scale: false },
center: ["130px", "50%"], center: ["130px", "50%"],
roseType: "radius", // roseType: "radius",
label: { label: {
show: false, show: false,
position: "outside", position: "outside",

119
ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/dailyDisposal/index.vue

@ -1,5 +1,5 @@
<template> <template>
<div class='congestion'> <div class="congestion">
<WgtTitle :title="'日事件处置情况占比'"></WgtTitle> <WgtTitle :title="'日事件处置情况占比'"></WgtTitle>
<div class="board"> <div class="board">
<div class="charts keep-ratio" id="dailyDisposal"></div> <div class="charts keep-ratio" id="dailyDisposal"></div>
@ -8,51 +8,56 @@
</template> </template>
<script> <script>
import WgtTitle from "../../../widgets/title";
import WgtTitle from '../../../widgets/title'
import * as echarts from "echarts"; import * as echarts from "echarts";
import chartsStatistics from "./assets/charts"; import chartsStatistics from "./assets/charts";
import { getWarningStateDay } from '../../../../../../../api/event/perceiveEvent'; import { getWarningStateDay } from "../../../../../../../api/event/perceiveEvent";
const drawRoundRect = (ctx, x, y, width, height, radius, gr) => { const drawRoundRect = (ctx, x, y, width, height, radius, gr) => {
// ctx, x, y, , , // ctx, x, y, , ,
ctx.beginPath(); ctx.beginPath();
ctx.fillStyle = gr; ctx.fillStyle = gr;
ctx.arc(x + radius, y + radius, radius, Math.PI, Math.PI * 3 / 2); ctx.arc(x + radius, y + radius, radius, Math.PI, (Math.PI * 3) / 2);
ctx.lineTo(width - radius + x, y); ctx.lineTo(width - radius + x, y);
ctx.arc(width - radius + x, radius + y, radius, Math.PI * 3 / 2, Math.PI * 2); ctx.arc(
width - radius + x,
radius + y,
radius,
(Math.PI * 3) / 2,
Math.PI * 2
);
ctx.lineTo(width + x, height + y - radius); ctx.lineTo(width + x, height + y - radius);
ctx.arc(width - radius + x, height - radius + y, radius, 0, Math.PI * 1 / 2); ctx.arc(
width - radius + x,
height - radius + y,
radius,
0,
(Math.PI * 1) / 2
);
ctx.lineTo(radius + x, height + y); ctx.lineTo(radius + x, height + y);
ctx.arc(radius + x, height - radius + y, radius, Math.PI * 1 / 2, Math.PI); ctx.arc(radius + x, height - radius + y, radius, (Math.PI * 1) / 2, Math.PI);
ctx.closePath(); ctx.closePath();
//ctx.stroke(); //ctx.stroke();
ctx.fill() ctx.fill();
} };
export default { export default {
name: 'dailyDisposal', name: "dailyDisposal",
components: { components: {
WgtTitle WgtTitle,
}, },
data() { data() {
return { return {};
}
}, },
created() { created() {},
methods: {},
},
methods: {
},
mounted() { mounted() {
setTimeout(() => { setTimeout(() => {
this.$nextTick(() => { this.$nextTick(() => {
var myChart = echarts.init(document.getElementById('dailyDisposal')); var myChart = echarts.init(document.getElementById("dailyDisposal"));
getWarningStateDay().then(res => { getWarningStateDay().then((res) => {
if (res.code == 200) { if (res.code == 200) {
let data = res.data; let data = res.data;
if (data.length > 0) { if (data.length > 0) {
@ -69,90 +74,85 @@ export default {
// it.number = 86; // it.number = 86;
echartsData.push({ echartsData.push({
name: "上报", name: "上报",
value: it.number value: it.number,
}); });
} }
if (it.warningState == 2) { if (it.warningState == 2) {
echartsData.push({ echartsData.push({
name: "已完成", name: "已完成",
value: it.number value: it.number,
}); });
} }
if (it.warningState == 3) { if (it.warningState == 3) {
echartsData.push({ echartsData.push({
name: "已终止", name: "已终止",
value: it.number value: it.number,
}); });
} }
if (it.warningState == 4) { if (it.warningState == 4) {
echartsData.push({ echartsData.push({
name: "自动结束", name: "自动结束",
value: it.number value: it.number,
}); });
} }
} }
chartsStatistics.legend.data = window.echartsData?.map(x => x); chartsStatistics.legend.data = window.echartsData?.map((x) => x);
chartsStatistics.series[0].data = echartsData.map((item, index) => { chartsStatistics.series[0].data = echartsData.map(
(item, index) => {
return { return {
...item, ...item,
label: { label: {
color: colorList[index] color: colorList[index],
} },
};
} }
}) );
chartsStatistics.series[1].data = echartsData.map((item, index) => { chartsStatistics.series[1].data = echartsData.map(
(item, index) => {
return { return {
...item, ...item,
label: { label: {
color: colorList[index] color: colorList[index],
} },
};
} }
}) );
} }
} }
myChart.setOption(chartsStatistics); myChart.setOption(chartsStatistics);
}); });
const domMap = document.getElementById("dailyDisposal"); const domMap = document.getElementById("dailyDisposal");
let parentDiv = domMap.firstChild; let parentDiv = domMap.firstChild;
// canvas // canvas
let canvas = document.createElement('canvas'); let canvas = document.createElement("canvas");
canvas.width = parentDiv.offsetWidth; canvas.width = parentDiv.offsetWidth;
canvas.height = parentDiv.offsetHeight; canvas.height = parentDiv.offsetHeight;
parentDiv.appendChild(canvas); parentDiv.appendChild(canvas);
const context = canvas.getContext('2d'); const context = canvas.getContext("2d");
// //
var gr = context.createLinearGradient(230, 0, 360, 0); var gr = context.createLinearGradient(230, 0, 360, 0);
// //
gr.addColorStop(1, 'rgba(92,197,255,0)'); gr.addColorStop(1, "rgba(92,197,255,0)");
gr.addColorStop(0, 'rgba(92,197,255,0.5)'); gr.addColorStop(0, "rgba(92,197,255,0.5)");
context.lineWidth = 1; // 线 context.lineWidth = 1; // 线
// //
drawRoundRect(context, 230, 36, 180, 24, 12, gr) drawRoundRect(context, 230, 36, 180, 24, 12, gr);
drawRoundRect(context, 230, 63, 180, 24, 12, gr) drawRoundRect(context, 230, 63, 180, 24, 12, gr);
drawRoundRect(context, 230, 90, 180, 24, 12, gr) drawRoundRect(context, 230, 90, 180, 24, 12, gr);
drawRoundRect(context, 230, 117, 180, 24, 12, gr) drawRoundRect(context, 230, 117, 180, 24, 12, gr);
}); });
}); });
}, },
} };
</script> </script>
<style lang='scss' scoped> <style lang="scss" scoped>
.congestion { .congestion {
width: 100%; width: 100%;
@ -164,11 +164,15 @@ export default {
border-radius: 5px 5px 5px 5px; border-radius: 5px 5px 5px 5px;
opacity: 1; opacity: 1;
border: 1px solid; border: 1px solid;
border-image: linear-gradient(360deg, rgba(55, 231, 255, 0.3), rgba(55, 231, 255, 0)) 1 1; border-image: linear-gradient(
360deg,
rgba(55, 231, 255, 0.3),
rgba(55, 231, 255, 0)
)
1 1;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
} }
} }
@ -177,4 +181,3 @@ export default {
width: 100%; width: 100%;
} }
</style> </style>
Loading…
Cancel
Save