|
@ -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> |
|
|
|
|
|
|