Browse Source

感知事件检测

wangqin
zhoule 2 years ago
parent
commit
3b6557268f
  1. 39
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/dailyDisposal/assets/charts.js
  2. 86
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/dailyDisposal/index.vue
  3. 20
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/dayTotal/assets/charts.js
  4. 96
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/dayTotal/index.vue
  5. 24
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/eventQuery/assets/charts.js
  6. 297
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/eventQuery/assets/charts2.js
  7. 39
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/eventQuery/assets/charts3.js
  8. 594
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/eventQuery/index.vue
  9. 138
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/eventQuery/progressBar.vue
  10. 109
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/eventSource/assets/charts.js
  11. 141
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/eventSource/index.vue
  12. 20
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/monthStatistics/assets/charts.js
  13. 59
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/monthStatistics/index.vue
  14. 23
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/railway/assets/charts.js
  15. 139
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/railway/index.vue
  16. 23
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/railwayDay/assets/charts.js
  17. 25
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/railwayDay/index.vue
  18. 52
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/typeAnalysis/assets/charts.js
  19. 114
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/typeAnalysis/index.vue
  20. 2
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/index.vue

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

@ -1,22 +1,22 @@
window.echartsData = [ window.echartsData = [
{ value: 25, name: '处理中' }, { value: 25, name: '处理中' },
{ value: 32, name: '待处理' }, { value: 40, name: '待处理' },
{ value: 30, name: '已处理' },] { value: 35, name: '已处理' },]
window.colorList = [ window.colorList = [
"#FFee0B", "#FFee0B",
"#61D8FF", "#61D8FF",
"#6AE0BC", "#6AE0BC",
] ]
window.count = 0; window.count = 0;
echartsData.forEach((it)=>{ echartsData.forEach((it) => {
count += it.value; count += it.value;
}) })
var options = { var options = {
color: colorList, color: colorList,
legend: { legend: {
orient: 'vertical', orient: 'vertical',
@ -29,24 +29,23 @@ window.count = 0;
textStyle: { textStyle: {
color: "#fff", color: "#fff",
fontSize: 12, fontSize: 12,
rich:{ rich: {
ast: { ast: {
align: "left", align: "left",
fontSize: 12, fontSize: 12,
width:35, width: 35,
}, },
bst: { bst: {
align: "left", align: "left",
fontSize: 12, fontSize: 12,
marginLeft:20, marginLeft: 20,
color:"#37E7FF" color: "#37E7FF"
} }
} }
}, },
formatter: (params) => { formatter: (params) => {
let obj = echartsData.filter(it=>{ return it.name == params}) let obj = echartsData.filter(it => { return it.name == params })
console.log(obj); return `{ast|${obj[0].name}} {bst|${Math.round(obj[0].value)}%}`
return `{ast|${obj[0].name}} {bst|${Math.round(obj[0].value/count* 100) }%}`
}, },
data: echartsData?.map(x => x), data: echartsData?.map(x => x),
}, },
@ -64,7 +63,7 @@ window.count = 0;
position: 'outside', position: 'outside',
fontSize: 16, fontSize: 16,
formatter: (params) => { formatter: (params) => {
return `{a|${params.name}} {b|${params.value/count}%}` return `{a|${params.name}} {b|${params.value / count}%}`
}, },
rich: { rich: {
a: { a: {
@ -84,7 +83,7 @@ window.count = 0;
}, },
}, },
labelLine: { labelLine: {
show:false, show: false,
length: 10, length: 10,
length2: 30, length2: 30,
}, },
@ -96,7 +95,7 @@ window.count = 0;
} }
} }
}) })
},{ }, {
name: '', name: '',
type: 'pie', type: 'pie',
radius: '90%', radius: '90%',
@ -120,13 +119,13 @@ window.count = 0;
}, },
itemStyle: { itemStyle: {
normal: { normal: {
opacity:0.3, opacity: 0.3,
shadowColor: "rgba(0, 0, 0, 0.8)", shadowColor: "rgba(0, 0, 0, 0.8)",
shadowBlur: 50, shadowBlur: 50,
}, },
}, },
labelLine: { labelLine: {
show:false, show: false,
length: 10, length: 10,
length2: 30, length2: 30,
}, },
@ -139,6 +138,6 @@ window.count = 0;
} }
}) })
}] }]
}; };
export default options; export default options;

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

@ -5,16 +5,16 @@
<div class="charts keep-ratio " id="dailyDisposal"></div> <div class="charts keep-ratio " id="dailyDisposal"></div>
</div> </div>
</div> </div>
</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;
@ -23,14 +23,14 @@
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
@ -52,36 +52,36 @@
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;
console.log(data); if (data.lemgth > 0) {
window.echartsData = []; window.echartsData = [];
for (let i = 0;i < data.length;i++){ for (let i = 0; i < data.length; i++) {
let it = data[i]; let it = data[i];
if ( it.warningState == 1 ) { if (it.warningState == 1) {
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
}); });
@ -89,14 +89,12 @@
} }
count = 0; let count = 0;
echartsData.forEach((it)=>{ echartsData.forEach((it) => {
count += it.value; count += it.value;
}) })
console.log(echartsData);
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 {
@ -115,6 +113,7 @@
} }
}) })
} }
}
myChart.setOption(chartsStatistics); myChart.setOption(chartsStatistics);
}); });
@ -127,7 +126,7 @@
// 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');
@ -141,38 +140,39 @@
context.lineWidth = 1; // 线 context.lineWidth = 1; // 线
// //
drawRoundRect(context, 260, 50, 120, 24, 12,gr) // drawRoundRect(context, 260, 50, 120, 24, 12, gr)
drawRoundRect(context, 260, 78, 120, 24, 12,gr) // drawRoundRect(context, 260, 78, 120, 24, 12, gr)
drawRoundRect(context, 260, 106, 120, 24, 12,gr) // drawRoundRect(context, 260, 106, 120, 24, 12, gr)
}); });
}); });
}, },
} }
</script> </script>
<style lang='scss' scoped> <style lang='scss' scoped>
.congestion { .congestion {
width: 100%; width: 100%;
.board{
height:200px; .board {
height: 200px;
width: 100%; width: 100%;
padding: 0px 20px; padding: 0px 20px;
background: linear-gradient(180deg, rgba(6,66,88,0.2) 0%, #064258 100%); background: linear-gradient(180deg, rgba(6, 66, 88, 0.2) 0%, #064258 100%);
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;
} }
} }
.charts {
height:180px;
width: 100%;
}
</style> .charts {
height: 180px;
width: 100%;
}
</style>

20
ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/dayTotal/assets/charts.js

@ -8,23 +8,13 @@ const sxnja = [
}) })
console.log(minArray) console.log(minArray)
let xaxisData = [ let xaxisData = [
'1月',
'2月',
'3月',
'4月',
'5月',
'6月',
'7月',
'8月',
'9月',
'10月',
]; ];
var options = { var options = {
title: { title: {
text: '单位/%', // text: '单位/%',
top: '4%', top: '0%',
left: '3%', left: '0%',
textStyle: { textStyle: {
fontSize: '10px', fontSize: '10px',
fontWeight: 300, fontWeight: 300,
@ -34,7 +24,7 @@ const sxnja = [
}, },
tooltip: { tooltip: {
valueFormatter: function (value) { valueFormatter: function (value) {
return (value + minNumber).toFixed(2) + ' %'; return (value + minNumber).toFixed(2);
} }
}, },
grid: { grid: {
@ -100,7 +90,7 @@ const sxnja = [
], ],
series: [ series: [
{ {
name: '审限内结案率', // name: '审限内结案率',
data: minArray, data: minArray,
type: 'pictorialBar', type: 'pictorialBar',
symbol: 'roundRect', symbol: 'roundRect',

96
ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/dayTotal/index.vue

@ -1,20 +1,20 @@
<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="daytotal"></div> <div class="charts keep-ratio " id="daytotal"></div>
</div> </div>
</div> </div>
</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 { getDailyCumulative } from '../../../../../../../api/event/perceiveEvent'; import { getDailyCumulative } from '../../../../../../../api/event/perceiveEvent';
export default { export default {
name: 'RailWayDay', name: 'RailWayDay',
components: { components: {
WgtTitle WgtTitle
@ -36,13 +36,58 @@
this.$nextTick(() => { this.$nextTick(() => {
var myChart = echarts.init(document.getElementById('daytotal')); var myChart = echarts.init(document.getElementById('daytotal'));
getDailyCumulative().then(res=>{ getDailyCumulative().then(res => {
if ( res.code == 200) { if (res.code == 200) {
let data = res.data; let data = res.data;
let timer = []; let timer = [];
let number = []; let number = [];
//
if(data.length < 1){
data = [
{
time: '00:00',
number: 800
},
{
time: '02:00',
number: 1000
},
{
time: '04:00',
number: 800
},
{
time: '06:00',
number: 700
},
{
time: '08:00',
number: 400
},
{
time: '10:00',
number: 1000
},
{
time: '12:00',
number: 800
},
{
time: '14:00',
number: 500
},
{
time: '16:00',
number: 800
},
{
time: '18:00',
number: 500
},
]
}
data.forEach((it)=>{ data.forEach((it) => {
timer.push(it.time); timer.push(it.time);
number.push(it.number); number.push(it.number);
}); });
@ -58,31 +103,32 @@
}); });
}); });
}, },
} }
</script> </script>
<style lang='scss' scoped> <style lang='scss' scoped>
.congestion { .congestion {
width: 100%; width: 100%;
.board{
height:200px; .board {
height: 200px;
width: 100%; width: 100%;
padding: 0px 20px; padding: 0px 20px;
background: linear-gradient(180deg, rgba(6,66,88,0.2) 0%, #064258 100%); background: linear-gradient(180deg, rgba(6, 66, 88, 0.2) 0%, #064258 100%);
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;
} }
} }
.charts {
height:180px;
width: 100%;
}
</style> .charts {
height: 180px;
width: 100%;
}
</style>

24
ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/eventQuery/assets/charts.js

@ -1,8 +1,8 @@
/* 数据 */ /* 数据 */
let nameList = ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"]; // 类别 let nameList = ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"]; // 类别
let valueList = [800, 520, 650, 950, 420, 600, 450, 720, 303, 503 , 203 ,703 , 903 ]; // 人数 let valueList = [800, 520, 650, 950, 420, 600, 450, 720, 303, 503, 203, 703, 903]; // 人数
var yList = [ "1000","800","轻度拥堵","基本畅通","畅通"] // var yList = ["1000", "800", "轻度拥堵", "基本畅通", "畅通"]
/* 数据整合 */ /* 数据整合 */
let dataList = []; let dataList = [];
nameList.map((item, index) => { nameList.map((item, index) => {
@ -32,7 +32,7 @@ nameList.map((item, index) => {
dataList.push({ dataList.push({
name: item, name: item,
value: valueList[index], value: valueList[index],
itemStyle:{ itemStyle: {
borderRadius: 6 borderRadius: 6
} }
}) })
@ -41,11 +41,14 @@ nameList.map((item, index) => {
var options = { var options = {
grid: { grid: {
top: '5%',//上边距 top: '7%',//上边距
right: '0',//右边距 right: '0',//右边距
left: '0',//左边距 left: '0',//左边距
bottom: "0%",//下边距 bottom: "2%",//下边距
containLabel: true, containLabel: true,
},
tooltip: {
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
@ -61,14 +64,14 @@ var options = {
axisLabel: { axisLabel: {
show: true, show: true,
color: '#B6E6FF', color: '#B6E6FF',
fontSize:8, fontSize: 8,
fontFamily: 'Source Han Sans CN-Regular', fontFamily: 'Source Han Sans CN-Regular',
}, },
}, },
yAxis: [{ yAxis: [{
type: 'value', type: 'value',
name: "", name: "",
splitNumber:5, splitNumber: 5,
nameTextStyle: { nameTextStyle: {
color: '#B6E6FF', color: '#B6E6FF',
fontSize: 13, fontSize: 13,
@ -99,7 +102,7 @@ var options = {
series: [{ series: [{
type: 'bar', type: 'bar',
data: dataList, data: dataList,
z:4, z: 4,
itemStyle: { itemStyle: {
color: { color: {
type: 'linear', type: 'linear',
@ -116,8 +119,9 @@ var options = {
}, },
borderRadius: [4, 4, 0, 0] borderRadius: [4, 4, 0, 0]
}, },
barWidth:10, barWidth: 10,
label: {show:false, label: {
show: false,
} }
}, },
] ]

297
ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/eventQuery/assets/charts2.js

@ -1,155 +1,182 @@
import * as echarts from "echarts"; let data = [
let data = [{ {
average:20, average: 10,
typeName:'行人', typeName: "交通拥堵",
percent:0.2 percent: 0.1,
},{ },
average:35, {
typeName:'非机动车', average: 11,
percent:0.25 typeName: "行人",
},{ percent: 0.11,
average:23, },
typeName:'抛洒物', {
percent:0.08 average: 12,
},{ typeName: "非机动车",
average:20, percent: 0.12,
typeName:'烟火', },
percent:0.14 {
},{ average: 13,
average:8, typeName: "停车",
typeName:'拥堵', percent: 0.13,
percent:0.14 },
},{ {
average:5, average: 5,
typeName:'逆行', typeName: "倒车/逆行",
percent:0.14 percent: 0.05,
}] },
let chartData = [],lengData=[], colorList = ['#50EED3', '#5DEF9E', '#29B3FF', '#FB5C38', '#FB5C38','#FCBB14']; {
for (let i = 0; i < data.length; i++) { average: 15,
typeName: "烟火",
percent: 0.15,
},
{
average: 10,
typeName: "撒落物",
percent: 0.1,
},
{
average: 10,
typeName: "异常天气",
percent: 0.1,
},
{
average: 14,
typeName: "护栏碰撞",
percent: 0.14,
},
];
let chartData = [],
lengData = [],
colorList = [
"#50EED3",
"#5DEF9E",
"#29B3FF",
"#FB5C38",
"#FB5C38",
"#FCBB14",
];
for (let i = 0; i < data.length; i++) {
chartData.push({ chartData.push({
value: data[i].average, value: data[i].average,
name: data[i].typeName, name: data[i].typeName,
percent: data[i].percent, percent: data[i].percent,
color: colorList[i] color: colorList[i],
}) });
lengData.push({ lengData.push({
name: data[i].typeName, name: data[i].typeName,
color: colorList[i] color: colorList[i],
}) });
} }
let a = chartData.map(t=>{ let a = chartData.map((t) => {
t.value = parseInt(t.value) t.value = parseInt(t.value);
return t return t;
}) });
const sum = a.reduce((per, cur) => per + cur.value, 0); const sum = a.reduce((per, cur) => per + cur.value, 0);
const gap = (1 * sum) / 100; const gap = (1 * sum) / 100;
const pieData1 = []; const pieData1 = [];
const gapData = { const gapData = {
name: "", name: "",
value: gap, value: gap,
itemStyle: { itemStyle: {
color: "transparent", color: "transparent",
}, },
}; };
let total = 0; let total = 0;
chartData.forEach((item) => { chartData.forEach((item) => {
total += parseInt(item.value); total += parseInt(item.value);
}); });
for (let i = 0; i < chartData.length; i++) { for (let i = 0; i < chartData.length; i++) {
// 第一圈数据 // 第一圈数据
pieData1.push({ pieData1.push({
...chartData[i], ...chartData[i],
}); });
pieData1.push(gapData); pieData1.push(gapData);
} }
console.log(pieData1); console.log(pieData1);
var options = { var options = {
tooltip: { tooltip: {
confine: true, confine: true,
textStyle: { textStyle: {
fontSize: 14 // 字体大小 fontSize: 14, // 字体大小
}, },
}, },
title:{ //圆环中间内容 title: {
text: '100%', //圆环中间内容
subtext: '类型分析', text: "100%",
left:"19%", subtext: "类型分析",
top:"40%", left: "19%",
textStyle:{ top: "40%",
color:"#fff", textStyle: {
fontSize:26, color: "#fff",
align:"center" fontSize: 26,
align: "center",
}, },
subtextStyle: { subtextStyle: {
fontSize: 18, fontSize: 18,
fontWeight: '400', fontWeight: "400",
top: -8, top: -8,
align:"center", align: "center",
color:'#fff' color: "#fff",
}, },
}, },
color:['#50EED3', '#5F8EFE','#29B3FF', '#5DEF9E', '#FB5C38', '#FCBB14','#50EED3'], color: colorList,
legend: { legend: {
top:'20%', top: "15%",
right: -10, right: -5,
orient: "vertical", //改变排列方式 orient: "vertical", //改变排列方式
icon: "circle", //改变legend小图标形状 icon: "circle", //改变legend小图标形状
itemGap: 20, // 设置legend的间距 itemGap: 20, // 设置legend的间距
itemWidth: 12, // 设置宽度 itemWidth: 10, // 设置宽度
itemHeight: 12, // 设置高度 itemHeight: 10, // 设置高度
itemStyle:{
},
textStyle: { textStyle: {
right: -19, right: -19,
fontSize: 50, fontSize: 30,
color: "#fff", color: "#fff",
rich:{ rich: {
a:{ a: {
width:45, width: 45,
fontSize: 12, fontSize: 12,
}, },
b:{ b: {
fontSize:14, fontSize: 14,
color:"#37E7FF", color: "#37E7FF",
marginLeft:-0, marginLeft: -0,
} },
}, },
}, },
itemStyle: { itemStyle: {
borderColor: "transparent", borderColor: "transparent",
}, },
data: lengData, data: lengData,
formatter: function(name){ formatter: function (name) {
let total = 0 let total = 0;
let target let target;
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
total += data[i].average total += data[i].average;
if (data[i].typeName === name) { if (data[i].typeName == name) {
target = data[i].average target = data[i].average;
} }
} }
var arr = [ var arr = [
'{a|' + name + '}', "{a|" + name + "}",
'{b|' + ((target / total) * 100).toFixed(2) + '%}', "{b|" + ((target / total) * 100).toFixed(2) + "%}",
] ];
return arr.join(' ') return arr.join(" ");
}, },
}, },
series: [ series: [
{ {
name: '', name: "",
roseType: 'radius', roseType: "radius",
startAngle:-220, startAngle: -220,
avoidLabelOverlap: true,//防止标签重叠 avoidLabelOverlap: true, //防止标签重叠
type: 'pie', type: "pie",
radius: ['63%', '90%'], //大小 radius: ["50%", "80%"], //大小
center : ['25%','50%'], //位置 center: ["25%", "50%"], //位置
hoverAnimation: true, hoverAnimation: true,
itemStyle: { itemStyle: {
normal: { normal: {
@ -159,87 +186,55 @@ let data = [{
}, },
}, },
labelLine: { labelLine: {
show:false, show: false,
lineStyle: { lineStyle: {
width: 3, width: 3,
}, },
normal: { normal: {
length: 30, // 指示线长度 length: 30, // 指示线长度
length2:80 length2: 80,
}, },
}, },
data: pieData1, data: pieData1,
label: { label: {
show: false, show: false,
formatter: function(params){ }, formatter: function (params) {},
textStyle: { textStyle: {
fontSize: '18', fontSize: "18",
fontWeight: 'bold', fontWeight: "bold",
color:'#fff' color: "#fff",
}, },
rich: { rich: {
color0: { color0: {
color: '#D56383', color: "#D56383",
}, },
color1: { color1: {
color: '#00FF95', color: "#00FF95",
}, },
color3: { color3: {
color: '#FFE900', color: "#FFE900",
}, },
color2: { color2: {
color: '#F5B157', color: "#F5B157",
}, },
color4: { color4: {
color: '#1DA7FF', color: "#1DA7FF",
},
color5: {
color: "#2967EA",
}, },
color5:{
color:'#2967EA'
}
}, },
}, },
emphasis: { emphasis: {
show: false, show: false,
}, },
}, },
// {
// type: 'gauge',
// zlevel: 0,
// splitNumber: 360,
// radius: '50%',
// center: ['25%', '50%'],
// startAngle: 90,
// endAngle: -269.9999,
// axisLine: {
// show: false,
// },
// axisTick: {
// show: false,
// },
// axisLabel: {
// show: false,
// },
// splitLine: {
// show: true,
// length:68,
// lineStyle: {
// width: 2,
// color: '#277DCA',
// },
// },
// pointer: {
// show: 0,
// },
// detail: {
// show: 0,
// },
// },
{ {
type: 'gauge', type: "gauge",
zlevel: 2, zlevel: 2,
splitNumber: 185, splitNumber: 185,
radius: '70%', radius: "70%",
center: ['25%', '50%'], center: ["25%", "50%"],
startAngle: 90, startAngle: 90,
endAngle: -269.9999, endAngle: -269.9999,
axisLine: { axisLine: {
@ -253,10 +248,10 @@ let data = [{
}, },
splitLine: { splitLine: {
show: true, show: true,
length:2, length: 2,
lineStyle: { lineStyle: {
width: 1, width: 1,
color: '#017383', color: "#017383",
}, },
}, },
pointer: { pointer: {
@ -266,7 +261,7 @@ let data = [{
show: 0, show: 0,
}, },
}, },
] ],
}; };
export default options export default options;

39
ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/eventQuery/assets/charts3.js

@ -13,23 +13,10 @@ let xData = [
"10月", "10月",
"11月", "11月",
"12月" "12月"
]; ];
let data1 = [200, 530, 920, 400, 600, 700, 300, 800, 900, 120, 570, 800]; let data1 = [200, 530, 920, 400, 600, 700, 300, 800, 900, 120, 570, 800];
let options = { let options = {
tooltip: { tooltip: {
show:false,
trigger: "axis",
axisPointer: {
// 坐标轴指示器,坐标轴触发有效
type: "shadow", // 默认为直线,可选为:'line' | 'shadow'
},
textStyle: {
color: "#fff",
fontSize: 14,
},
backgroundColor: "rgba(3, 31, 71, .0)", //设置背景颜色
borderColor: "rgba(3, 31, 71, .1)",
formatter: "健康监测<br>{b1}:{c1}人",
}, },
grid: { grid: {
left: "2%", left: "2%",
@ -102,13 +89,13 @@ let xData = [
series: [ series: [
// 下半截柱状图linear-gradient(180deg, #61D8FF 0%, #003B4E 100%); linear-gradient(180deg, #06D7B1 0%, #003B4E 100%) // 下半截柱状图linear-gradient(180deg, #61D8FF 0%, #003B4E 100%); linear-gradient(180deg, #06D7B1 0%, #003B4E 100%)
{ {
name: "种植面积", // name: "种植面积",
type: "bar", type: "bar",
barWidth: "10px", barWidth: "10px",
barGap: "-100%", barGap: "-100%",
selectedMode:true, selectedMode: true,
select:{ select: {
itemStyle:{ itemStyle: {
opacity: 1, opacity: 1,
color: function (params) { color: function (params) {
var a = params; var a = params;
@ -138,8 +125,8 @@ let xData = [
opacity: 0.6, opacity: 0.6,
color: function (params) { color: function (params) {
var a = params.name; var a = params.name;
console.log("==========a=============",a); console.log("==========a=============", a);
if ( a == "6月" ) { if (a == "6月") {
return new echarts.graphic.LinearGradient( return new echarts.graphic.LinearGradient(
0, 0,
0, 0,
@ -180,7 +167,7 @@ let xData = [
data: data1, data: data1,
}, },
// 进度条的小圆圈 // 进度条的小圆圈
{ {
name: "小圈圈", name: "小圈圈",
type: "scatter", type: "scatter",
emphasis: { emphasis: {
@ -200,9 +187,9 @@ let xData = [
zlevel: 10, zlevel: 10,
data: data1, data: data1,
animationDelay: 500 animationDelay: 500
} }
], ],
}; };
export default options; export default options;

594
ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/eventQuery/index.vue

@ -1,66 +1,58 @@
<template> <template>
<div class='congestion'> <div class='congestion'>
<WgtTitle :title="'感知事件查询'" ></WgtTitle>
<div class="board"> <div class="board">
<ProgressBar class="keep-ratio" @selectItem="selectProgress" :dataList="dataList" :selectIndex="7" /> <ProgressBar class="keep-ratio" @selectItem="selectProgress" :dataList="dataList" :selectIndex="selectId" />
<div class="searchPanel"> <div class="searchPanel">
<el-select v-model="area" size="mini" class="selectRoad" placeholder="请选择"> <el-select v-model="area" size="mini" class="selectRoad" placeholder="请选择" default-first-option>
<el-option <el-option v-for="item in areaOptions" :key="item.value" :label="item.label" :value="item.value">
v-for="item in areaOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option> </el-option>
</el-select> </el-select>
<el-select v-model="year" size="mini" class="selectRoad" placeholder="请选择"> <el-select v-model="year" size="mini" class="selectRoad" placeholder="请选择">
<el-option <el-option v-for="item in yearOptions" :key="item.value" :label="item.label" :value="item.value">
v-for="item in yearOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option> </el-option>
</el-select> </el-select>
<el-date-picker <el-date-picker size="mini" v-if="year != 'quarter'" class="selectRoad" v-model="dateTime" style="width:140px;"
size="mini" :type="year" placeholder="请选择" />
v-if="year != 'quarter'" <el-quarter-picker size="mini" class="selectRoad" style="width:180px;" v-if="year == 'quarter'" v-model="dateTime"
class="selectRoad" aria-placeholder="请选季度" />
v-model="dateTime"
style="width:140px;"
:type="year"
placeholder="请选择"
/>
<el-quarter-picker size="mini" class="selectRoad" style="width:180px;" v-if="year == 'quarter'" v-model="dateTime" aria-placeholder="请选季度" />
<el-button type="primary" size="mini" class="btnSearch" @click="searchQuery" icon="el-icon-search">查询</el-button> <el-button type="primary" size="mini" class="btnSearch" @click="searchQuery" icon="el-icon-search">查询</el-button>
<el-button class="btnReset" size="mini" icon="el-icon-refresh-left" >重置</el-button> <el-button class="btnReset" size="mini" icon="el-icon-refresh-left" @click="onReset">重置</el-button>
</div> </div>
</div> </div>
<div class="body" >
<div id="chart1" class="keep-ratio" >
<div class="body">
<div>
<WgtTitle :title="'感知事件趋势分析'"></WgtTitle>
<div id="chart1" class="btnChart" />
</div> </div>
<div id="chart2" class="keep-ratio" >
<div>
<WgtTitle :title="'感知事件类型分析'"></WgtTitle>
<div id="chart2" class="btnChart" />
</div> </div>
<div id="chart3" class="keep-ratio" >
<div>
<WgtTitle :title="'桩号范围内事件分析趋势'"></WgtTitle>
<div id="chart3" class="btnChart" />
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import WgtTitle from '../../../widgets/title' import WgtTitle from '../../../widgets/title'
import ProgressBar from './progressBar.vue'; import ProgressBar from './progressBar';
import * as echarts from "echarts"; import * as echarts from "echarts";
import chart1 from "./assets/charts"; import chart1 from "./assets/charts";
import chart2 from "./assets/charts2"; import chart2 from "./assets/charts2";
import chart3 from "./assets/charts3"; import chart3 from "./assets/charts3";
import ElQuarterPicker from './ElQuarterPicker' import ElQuarterPicker from './ElQuarterPicker'
import { getWarningTrend,getWarningSectionType,getSectionMarkNumber,getRoadSectionList } from '../../../../../../../api/event/perceiveEvent'; import { getWarningTrend, getWarningSectionType, getSectionMarkNumber, getRoadSectionList } 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;
@ -69,14 +61,14 @@
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: 'EventQuery', name: 'EventQuery',
components: { components: {
WgtTitle, WgtTitle,
@ -85,11 +77,11 @@
}, },
data() { data() {
return { return {
yearOptions:[ yearOptions: [
{ {
value: 'year', value: 'year',
label: '年' label: '年'
},{ }, {
value: 'month', value: 'month',
label: '月' label: '月'
}, },
@ -102,127 +94,132 @@
label: '季' label: '季'
},], },],
areaOptions: [{ areaOptions: [{
value: '0531', value: '1',
label: '济南' label: '济南方向'
}, { }, {
value: '菏泽', value: '2',
label: '菏泽' label: '菏泽方向'
}], }],
dateTime:"", dateTime: "2024",
area: '0531', area: '1',
dataList:[ dataList: [
{ {
title:"殷家林枢纽" title: "殷家林枢纽"
}, },
{ {
title:"大学城立交" title: "大学城立交"
}, },
{ {
title:"长清立交" title: "长清立交"
}, },
{ {
title:"松竹枢纽" title: "松竹枢纽"
}, },
{ {
title:"孝里立交" title: "孝里立交"
}, },
{ {
title:"平阴立交" title: "平阴立交"
}, },
{ {
title:"孔村枢纽" title: "孔村枢纽"
}, },
{ {
title:"平阴南立交" title: "平阴南立交"
}, },
{ {
title:"魏雪枢纽" title: "魏雪枢纽"
}, },
{ {
title:"东平立交" title: "东平立交"
}, },
{ {
title:"东平湖枢纽" title: "东平湖枢纽"
}, },
{ {
title:"韩岗立交" title: "韩岗立交"
}, },
{ {
title:"梁山立交" title: "梁山立交"
}, },
{ {
title:"鄄郓枢纽" title: "鄄郓枢纽"
}, },
{ {
title:"嘉祥西立交" title: "嘉祥西立交"
}, },
{ {
title:"王官屯枢纽" title: "王官屯枢纽"
} }
], ],
quarter:"", quarter: "",
selectId:1, selectId: 3,
year:"year", year: "year",
list:[ list: [
{name:'大学城-长清', direction:'济南方向', state:"正常",speed:'108.14km/h', follow:'161'}, { name: '大学城-长清', direction: '济南方向', state: "正常", speed: '108.14km/h', follow: '161' },
{name:'大学城-长清', direction:'济南方向', state:"正常",speed:'108.14km/h', follow:'161'}, { name: '大学城-长清', direction: '济南方向', state: "正常", speed: '108.14km/h', follow: '161' },
{name:'大学城-长清', direction:'济南方向', state:"正常",speed:'108.14km/h', follow:'161'}, { name: '大学城-长清', direction: '济南方向', state: "正常", speed: '108.14km/h', follow: '161' },
{name:'大学城-长清', direction:'济南方向', state:"正常",speed:'108.14km/h', follow:'161'}, { name: '大学城-长清', direction: '济南方向', state: "正常", speed: '108.14km/h', follow: '161' },
{name:'大学城-长清', direction:'济南方向', state:"正常",speed:'108.14km/h', follow:'161'}, { name: '大学城-长清', direction: '济南方向', state: "正常", speed: '108.14km/h', follow: '161' },
{name:'大学城-长清', direction:'济南方向', state:"正常",speed:'108.14km/h', follow:'161'} { name: '大学城-长清', direction: '济南方向', state: "正常", speed: '108.14km/h', follow: '161' }
] ]
} }
}, },
created() { created() {
}, },
methods: { methods: {
selectProgress(item){ selectProgress(item) {
this.selectId = item.id; this.selectId = item.id;
}, },
searchQuery(){ onReset() {
this.area = '1';
this.year = "year";
this.dateTime = '2024';
this.selectId = 1;
},
searchQuery() {
let dateTime = this.dateTime; let dateTime = this.dateTime;
if ( dateTime == "" ) { if (dateTime == "") {
this.$message.error('没有选日期参数!'); this.$message.error('没有选日期参数!');
return return
} }
var quarter = 0; var quarter = 0;
if ( this.year == "year") { if (this.year == "year") {
dateTime = new Date(dateTime); dateTime = new Date(dateTime);
dateTime = dateTime.getFullYear() + "-01-01 00:00:00"; dateTime = dateTime.getFullYear() + "-01-01 00:00:00";
console.log(dateTime); console.log(dateTime);
} }
if ( this.year == "month") { if (this.year == "month") {
dateTime = new Date(dateTime); dateTime = new Date(dateTime);
let m = dateTime.getMonth()+1; let m = dateTime.getMonth() + 1;
m = m < 10?"0"+m:m; m = m < 10 ? "0" + m : m;
dateTime = dateTime.getFullYear() + "-" + m +"-01 00:00:00"; dateTime = dateTime.getFullYear() + "-" + m + "-01 00:00:00";
console.log(dateTime); console.log(dateTime);
} }
if ( this.year == "quarter" ) { if (this.year == "quarter") {
console.log(dateTime); console.log(dateTime);
dateTime = new Date(dateTime); dateTime = new Date(dateTime);
let m = dateTime.getMonth()+1; let m = dateTime.getMonth() + 1;
if ( m == 1) m = 1; if (m == 1) m = 1;
if ( m == 2) m = 4; if (m == 2) m = 4;
if ( m == 3) m = 7; if (m == 3) m = 7;
if ( m == 4) m = 10; if (m == 4) m = 10;
quarter = m; quarter = m;
m = m < 10?"0"+m:m; m = m < 10 ? "0" + m : m;
dateTime = dateTime.getFullYear() + "-" + m +"-01 00:00:00"; dateTime = dateTime.getFullYear() + "-" + m + "-01 00:00:00";
console.log(dateTime); console.log(dateTime);
} }
if ( this.year == "date" ) { if (this.year == "date") {
this.year = "day"; this.year = "day";
dateTime = new Date(dateTime); dateTime = new Date(dateTime);
let m = dateTime.getMonth()+1; let m = dateTime.getMonth() + 1;
m = m < 10?"0"+m:m; m = m < 10 ? "0" + m : m;
let d = dateTime.getDate(); let d = dateTime.getDate();
d = d < 10?"0"+d:d; d = d < 10 ? "0" + d : d;
dateTime = dateTime.getFullYear() + "-" + m +"-"+d+" 00:00:00"; dateTime = dateTime.getFullYear() + "-" + m + "-" + d + " 00:00:00";
} }
// //
@ -230,57 +227,65 @@
"type": this.year, "type": this.year,
"sectionId": this.selectId, "sectionId": this.selectId,
"createTime": dateTime, "createTime": dateTime,
"direction":1, "direction": this.area,
}).then(res=>{ }).then(res => {
console.log(res); if (res.code == 200) {
chart1.series[0].data = [];
if ( res.code == 200 ) {
let data = res.data; let data = res.data;
if ( this.year == "year" ) { chart1.series[0].data = [];
let years = []; if (data.length > 0) {
const maxObject = data.reduce((prev, current) => (current.number > prev.number ? current : prev));
let xData = [];
let numbers = []; let numbers = [];
data.forEach(it=>{
years.push(it.month+"月");
numbers.push(it.number);
})
chart1.xAxis.data = years;
chart1.series[0].data = numbers;
}
if ( this.year == "month" ) { data.forEach(it => {
let months = []; if (this.year == "year") {
let numbers = []; xData.push(it.month + "月");
data.forEach(it=>{
months.push(it.day.split("-")[2]+"日");
numbers.push(it.number);
})
chart1.xAxis.data = months;
chart1.series[0].data = numbers;
} }
if (this.year == "month") {
if ( this.year == "day" ) { xData.push(it.day.split("-")[2] + "日");
let times = []; }
let numbers = []; if (this.year == "day") {
data.forEach(it=>{ xData.push(it.time.split(" ")[1] + "小时");
times.push(it.time.split(" ")[1]+"小时"); }
numbers.push(it.number); if (this.year == "quarter") {
}) xData.push(it.QUARTER);
chart1.xAxis.data = times; }
chart1.series[0].data = numbers; if (it.number == maxObject.number) {
numbers.push({
value: it.number,
itemStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [{
offset: 0, color: '#FFB904' // 0%
}, {
offset: 1, color: '#FF6969' // 100%
}],
global: false // false
},
borderRadius: 6
}
});
} else {
numbers.push({
value: it.number,
itemStyle: {
borderRadius: 6
}
});
} }
if ( this.year == "quarter" ) {
let months = [];
let numbers = [];
data.forEach(it=>{
months.push(it.MONTH+"月");
numbers.push(it.number);
}) })
chart1.xAxis.data = months;
chart1.xAxis.data = xData;
chart1.series[0].data = numbers; chart1.series[0].data = numbers;
} }
} }
this.myChart1.setOption(chart1); this.myChart1.setOption(chart1);
}); });
@ -289,69 +294,57 @@
"type": this.year, "type": this.year,
"sectionId": this.selectId, "sectionId": this.selectId,
"createTime": dateTime, "createTime": dateTime,
"direction":1, "direction": this.area,
}).then(res=>{ }).then(res => {
console.log(res);
chart2.series[0].data = []; chart2.series[0].data = [];
if ( res.code == 200 ) { if (res.code == 200) {
let types = []; let types = [];
let numbers = []; let numbers = [];
const gapData = {
name: "",
value: 0.5,
itemStyle: {
color: "transparent",
},
};
let data = res.data.warningTypeList; let data = res.data.warningTypeList;
let total= res.data.total; let total = res.data.total;
data.forEach((it)=>{ data.forEach((it) => {
// 1- 2- 3- 4-5-/ 6-7-8- 9- if (it.warningType == 1) {
if ( it.warningType == 1) {
types.push("交通拥堵"); types.push("交通拥堵");
} }
if ( it.warningType == 2) { if (it.warningType == 2) {
types.push("行人"); types.push("行人");
} }
if ( it.warningType == 3) { if (it.warningType == 3) {
types.push("非机动车"); types.push("非机动车");
} }
if ( it.warningType == 4) { if (it.warningType == 4) {
types.push("停车"); types.push("停车");
} }
if ( it.warningType == 5) { if (it.warningType == 5) {
types.push("倒车/逆行"); types.push("倒车/逆行");
} }
if ( it.warningType == 6) { if (it.warningType == 6) {
types.push("烟火"); types.push("烟火");
} }
if ( it.warningType == 7) { if (it.warningType == 7) {
types.push("撒落物"); types.push("撒落物");
} }
if ( it.warningType == 8) { if (it.warningType == 8) {
types.push("异常天气"); types.push("异常天气");
} }
if ( it.warningType == 9) { if (it.warningType == 9) {
types.push("护栏碰撞"); types.push("护栏碰撞");
} }
numbers.push({ numbers.push({
name:types[types.length - 1], name: types[types.length - 1],
value:it.number value: it.number
}); });
numbers.push(gapData);
}) })
console.log(types);
chart2.legend.data = types; chart2.legend.data = types;
chart2.legend.formatter = function(name){ chart2.legend.formatter = function (name) {
let total = 0 let total = 0
let target let target
for (let i = 0; i < numbers.length; i++) { for (let i = 0; i < numbers.length; i++) {
total += numbers[i].value; total += numbers[i].value;
if (types[i] === name) { if (types[i] == name) {
target = numbers[i].value; target = numbers[i].value;
} }
} }
@ -369,7 +362,7 @@
return return
} }
console.log(params); console.log(params);
chart2.title.text = Math.round(params.data.value/total * 100) + "%"; chart2.title.text = Math.round(params.data.value / total * 100) + "%";
chart2.title.subtext = params.data.name; chart2.title.subtext = params.data.name;
this.myChart2.setOption(chart2); this.myChart2.setOption(chart2);
}) })
@ -389,20 +382,20 @@
"type": this.year, "type": this.year,
"sectionId": this.selectId, "sectionId": this.selectId,
"createTime": dateTime, "createTime": dateTime,
"direction":1, "direction": this.area,
}).then(res=>{ }).then(res => {
console.log(res);
chart3.series[0].data = []; chart3.series[0].data = [];
chart3.series[1].data = []; chart3.series[1].data = [];
if ( res.code == 200 ) { if (res.code == 200) {
let data = res.data; let data = res.data;
if ( this.year != "quarter" ) { if (this.year != "quarter") {
let zhs = []; let zhs = [];
let values = []; let values = [];
data.forEach((it)=>{ data.forEach((it) => {
console.log(it); if (it.sectionNumber > 0) {
values.push(it.sectionNumber); values.push(it.sectionNumber);
zhs.push(it.stakeMarkId); zhs.push(it.stakeMarkId);
}
}) })
chart3.xAxis.data = zhs; chart3.xAxis.data = zhs;
chart3.series[0].data = values; chart3.series[0].data = values;
@ -410,25 +403,27 @@
} else { } else {
let zhs = []; let zhs = [];
let values = []; let values = [];
data.forEach((dt,i)=>{ data.forEach((dt, i) => {
dt.forEach((it)=>{ dt.forEach((it) => {
console.log(it); if (it.number > 0) {
if ( quarter == 1 && it.QUARTER == "第一季度") { if (quarter == 1 && it.QUARTER == "第一季度") {
values[i] = it.number; values[i] = it.number;
zhs[i] = it.stakeMark; zhs[i] = it.stakeMark;
} }
if ( quarter == 4 && it.QUARTER == "第二季度") { if (quarter == 4 && it.QUARTER == "第二季度") {
values[i] = it.number; values[i] = it.number;
zhs[i] = it.stakeMark; zhs[i] = it.stakeMark;
} }
if ( quarter == 7 && it.QUARTER == "第三季度") { if (quarter == 7 && it.QUARTER == "第三季度") {
values[i] = it.number; values[i] = it.number;
zhs[i] = it.stakeMark; zhs[i] = it.stakeMark;
} }
if ( quarter == 10 && it.QUARTER == "第四季度") { if (quarter == 10 && it.QUARTER == "第四季度") {
values[i] = it.number; values[i] = it.number;
zhs[i] = it.stakeMark; zhs[i] = it.stakeMark;
} }
}
}) })
}) })
chart3.xAxis.data = zhs; chart3.xAxis.data = zhs;
@ -439,7 +434,7 @@
this.myChart3.setOption(chart3); this.myChart3.setOption(chart3);
}) })
if ( this.year == "day" ) if (this.year == "day")
this.year = "date"; this.year = "date";
}, },
}, },
@ -447,19 +442,28 @@
setTimeout(() => { setTimeout(() => {
this.$nextTick(() => { this.$nextTick(() => {
getRoadSectionList().then(res=>{ getRoadSectionList().then(res => {
console.log(res); console.log(res);
if ( res.code == 200 ) { if (res.code == 200) {
let rows = res.rows; let rows = res.rows;
this.dataList = []; this.dataList = [];
rows.forEach(it=>{ rows.forEach(it => {
this.dataList.push({ this.dataList.push({
title:it.sectionName.split("-")[0], title: it.sectionName.split("-")[0],
id:it.id, id: it.id,
}); });
}) })
if (rows.length > 0) {
let lastRoad = rows[rows.length - 1].sectionName.split("-")[1];
this.dataList.push({
title: lastRoad,
id: rows[rows.length - 1].id,
});
}
} }
this.searchQuery();
}) })
@ -481,146 +485,192 @@
// 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(247, 63, 450, 0);
//
gr.addColorStop(1, 'rgba(92,197,255,0)');
gr.addColorStop(0, 'rgba(92,197,255,0.5)');
context.lineWidth = 1; // 线 context.lineWidth = 1; // 线
// //
drawRoundRect(context, 300, 78, 160, 24, 12,gr)
var gr = context.createLinearGradient(240, 63, 450, 0);
//
gr.addColorStop(1, 'rgba(92,197,255,0)');
gr.addColorStop(0, 'rgba(92,197,255,0.5)');
drawRoundRect(context, 300, 148, 160, 24, 12,gr)
var gr = context.createLinearGradient(240, 63, 450, 0);
//
gr.addColorStop(1, 'rgba(92,197,255,0)');
gr.addColorStop(0, 'rgba(92,197,255,0.5)');
drawRoundRect(context, 300, 218, 160, 24, 12,gr)
var gr = context.createLinearGradient(400, 63, 450, 0);
// //
gr.addColorStop(1, 'rgba(92,197,255,0)'); // var gr = context.createLinearGradient(247, 63, 450, 0);
gr.addColorStop(0, 'rgba(92,197,255,0.5)'); // gr.addColorStop(1, 'rgba(92,197,255,0)');
// gr.addColorStop(0, 'rgba(92,197,255,0.5)');
// drawRoundRect(context, 267, 57, 140, 24, 12, gr)
// //
// var gr = context.createLinearGradient(247, 63, 450, 0);
// gr.addColorStop(1, 'rgba(92,197,255,0)');
// gr.addColorStop(0, 'rgba(92,197,255,0.5)');
// drawRoundRect(context, 267, 108, 140, 24, 12, gr)
// //
// var gr = context.createLinearGradient(240, 63, 450, 0);
// gr.addColorStop(1, 'rgba(92,197,255,0)');
// gr.addColorStop(0, 'rgba(92,197,255,0.5)');
// drawRoundRect(context, 267, 157, 140, 24, 12, gr)
// //
// var gr = context.createLinearGradient(240, 63, 450, 0);
// gr.addColorStop(1, 'rgba(92,197,255,0)');
// gr.addColorStop(0, 'rgba(92,197,255,0.5)');
// drawRoundRect(context, 267, 208, 140, 24, 12, gr)
// //
// var gr = context.createLinearGradient(240, 63, 450, 0);
// gr.addColorStop(1, 'rgba(92,197,255,0)');
// gr.addColorStop(0, 'rgba(92,197,255,0.5)');
// drawRoundRect(context, 267, 258, 140, 24, 12, gr)
// //
// var gr = context.createLinearGradient(400, 63, 450, 0);
// gr.addColorStop(1, 'rgba(92,197,255,0)');
// gr.addColorStop(0, 'rgba(92,197,255,0.5)');
// drawRoundRect(context, 416, 57, 140, 24, 12, gr)
// //
// var gr = context.createLinearGradient(350, 63, 450, 0);
// gr.addColorStop(1, 'rgba(92,197,255,0)');
// gr.addColorStop(0, 'rgba(92,197,255,0.5)');
// drawRoundRect(context, 416, 108, 140, 24, 12, gr)
// //
// var gr = context.createLinearGradient(300, 63, 450, 0);
// gr.addColorStop(1, 'rgba(92,197,255,0)');
// gr.addColorStop(0, 'rgba(92,197,255,0.5)');
// drawRoundRect(context, 416, 157, 140, 24, 12, gr)
// //
// var gr = context.createLinearGradient(300, 63, 450, 0);
// gr.addColorStop(1, 'rgba(92,197,255,0)');
// gr.addColorStop(0, 'rgba(92,197,255,0.5)');
// drawRoundRect(context, 416, 208, 140, 24, 12, gr);
drawRoundRect(context, 460, 78, 160, 24, 12,gr)
var gr = context.createLinearGradient(350, 63, 450, 0);
//
gr.addColorStop(1, 'rgba(92,197,255,0)');
gr.addColorStop(0, 'rgba(92,197,255,0.5)');
drawRoundRect(context, 460, 148, 160, 24, 12,gr)
var gr = context.createLinearGradient(300, 63, 450, 0);
//
gr.addColorStop(1, 'rgba(92,197,255,0)');
gr.addColorStop(0, 'rgba(92,197,255,0.5)');
drawRoundRect(context, 460, 218, 160, 24, 12,gr)
}); });
}); });
}, },
} }
</script> </script>
<style lang='scss' scoped> <style lang='scss' scoped>
.congestion { .congestion {
width: 100%; width: 100%;
position: relative;
.body { .body {
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
height: 320px; justify-content: space-evenly;
width:100%;
font-size: 14px; font-size: 14px;
> div { >div {
display: inline-flex; width: 33%;
height:100%; height: 470px;
width:33%; background: linear-gradient(180deg, rgba(6, 66, 88, 0.2) 0%, #064258 100%);
margin-right:px; border: 1px solid;
background: linear-gradient(180deg, rgba(6,66,88,0) 0%, rgba(19, 39, 47, 0.9725490196) 93%); border-image: linear-gradient(360deg, rgba(55, 231, 255, 0.3), rgba(55, 231, 255, 0)) 1 1;
padding: 10px; }
:nth-child(1) {
margin-right: 6px;
} }
:nth-child(2) {
margin-left: 6px;
margin-right: 6px;
}
:nth-child(3) {
margin-left: 6px;
}
.btnChart {
height: 330px;
width: 90%;
margin: 95px auto 0;
}
} }
.board{ .board {
height:100px; height: 100px;
width: 100%; width: 100%;
padding:10px 20px; position: absolute;
background: linear-gradient(180deg, rgba(6,66,88,0.2) 0%, #064258 100%); top: 30px;
padding: 18px 20px;
// background: linear-gradient(180deg, rgba(6, 66, 88, 0.2) 0%, #064258 100%);
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;
flex-direction: column; flex-direction: column;
.searchPanel{ .searchPanel {
display: flex; display: flex;
align-items: center; align-items: center;
height: 40px; height: 40px;
width:100%; width: 100%;
font-size: 14px; font-size: 14px;
margin-top: 10px; margin-top: 10px;
div{
div {
white-space: nowrap; white-space: nowrap;
margin-right: 4px; margin-right: 4px;
} }
.inputZh{
.inputZh {
width: 47px; width: 47px;
::v-deep{
.el-input__inner{ ::v-deep {
.el-input__inner {
background-color: #064258 !important; background-color: #064258 !important;
border-width: 0px !important; border-width: 0px !important;
} }
} }
} }
.inputJl{
.inputJl {
margin-left: 5px; margin-left: 5px;
margin-right: 10px; margin-right: 10px;
} }
.selectRoad{
width:89px; .selectRoad {
border:1px solid #00B3CC; width: 100px;
::v-deep{ border: 1px solid #00B3CC;
.el-input__inner{
::v-deep {
.el-input__inner {
background-color: #064258 !important; background-color: #064258 !important;
border-width: 0px !important; border-width: 0px !important;
} }
} }
} }
.btnSearch{
.btnSearch {
background: linear-gradient(180deg, #005C79 0%, #009BCC 100%); background: linear-gradient(180deg, #005C79 0%, #009BCC 100%);
margin-left: 10px; margin-left: 10px;
border-color: transparent; border-color: transparent;
} }
.btnReset{
background: linear-gradient(180deg, #005C79 0%, #009BCC 100%);; .btnReset {
background: linear-gradient(180deg, #005C79 0%, #009BCC 100%);
;
border-color: transparent; border-color: transparent;
color: white; color: white;
} }
} }
} }
} }
.charts {
height:100px;
width: 100%;
}
</style> .charts {
height: 100px;
width: 100%;
}
</style>

138
ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/eventQuery/progressBar.vue

@ -1,77 +1,79 @@
<template> <template>
<div class='congestion'> <div class='congestion'>
<div :style="{width: dataList.length * 300}" > <div :style="{ width: dataList.length * 300 }">
<div :class="selectIndex == index?selectLine < 1?'item action Abefore':'item action Aafter':selectIndex + selectLine == index?selectLine < 1?'item action Aafter':'item action Abefore':'item'" v-for="(item,index) in dataList" :key="index" > <div :class="selectIndex == index ? selectLine < 1 ? 'item action Abefore' : 'item action Aafter' : selectIndex + selectLine == index ? selectLine < 1 ? 'item action Aafter' : 'item action Abefore' : 'item'"
<i class="after" @click="selectItem(index,-1, dataList[index - 1])"></i> v-for="(item, index) in dataList" :key="index">
<i class="before" @click="selectItem(index,+1,item)" ></i> <i class="after" @click="selectItem(index, -1, dataList[index - 1])"></i>
<i class="before" @click="selectItem(index, +1, item)"></i>
<span></span> <span></span>
<div>{{ item.title }}</div> <div>{{ item.title }}</div>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { number } from 'echarts';
export default {
export default {
name: 'ProgressBar', name: 'ProgressBar',
components: { components: {
}, },
props:{ props: {
dataList:{ dataList: {
type:Array, type: Array,
default: () => { default: () => {
return [] return []
} }
}, },
selectIndex: {
type: Number,
default: 1
}
}, },
data() { data() {
return { return {
selectIndex:0, // selectIndex: 0,
selectLine:-1, selectLine: -1,
} }
}, },
created() { created() {
}, },
methods: { methods: {
selectItem(index,num,item){ selectItem(index, num, item) {
this.selectIndex = index; this.selectIndex = index;
this.selectLine = num; this.selectLine = num;
if ( item ) if (item)
this.$emit("selectItem",item); this.$emit("selectItem", item);
} }
}, },
mounted() { mounted() {
}, },
} }
</script> </script>
<style lang='scss' scoped> <style lang='scss' scoped>
.congestion { .congestion {
width: 100%; width: 100%;
height:35px; height: 35px;
display: inline-flex; display: inline-flex;
flex-direction: row; flex-direction: row;
> div { >div {
position: relative; position: relative;
width: 100%; width: 100%;
height:35px; height: 35px;
display: inline-flex; display: inline-flex;
flex-direction: row; flex-direction: row;
>.item .after { >.item .after {
position: absolute; position: absolute;
display: inline-flex; display: inline-flex;
left:0px; left: 0px;
top:-5px; top: -5px;
width:45px !important; width: 45px !important;
height:35px !important; height: 35px !important;
background-color: transparent; background-color: transparent;
cursor: pointer; cursor: pointer;
} }
@ -80,20 +82,20 @@ import { number } from 'echarts';
content: ""; content: "";
position: absolute; position: absolute;
display: inline-flex; display: inline-flex;
left:0px; left: 0px;
top:8px; top: 8px;
width:45px !important; width: 45px !important;
height:3px !important; height: 3px !important;
background-color: #C7C7C7; background-color: #C7C7C7;
} }
>.item .before { >.item .before {
position: absolute; position: absolute;
display: inline-flex; display: inline-flex;
right:0px; right: 0px;
top:-5px; top: -5px;
width:45px; width: 45px;
height:35px; height: 35px;
background-color: transparent; background-color: transparent;
cursor: pointer; cursor: pointer;
} }
@ -102,55 +104,55 @@ import { number } from 'echarts';
content: ""; content: "";
position: absolute; position: absolute;
display: inline-flex; display: inline-flex;
left:0px; left: 0px;
top:8px; top: 8px;
width:45px !important; width: 45px !important;
height:3px !important; height: 3px !important;
background-color: #C7C7C7; background-color: #C7C7C7;
} }
.item.action .after::after { .item.action .after::after {
background-color: #72FDC9 ; background-color: #72FDC9;
} }
.item.action.Aafter .after::after{ .item.action.Aafter .after::after {
background-color: #C7C7C7 !important; background-color: #C7C7C7 !important;
} }
> .item.action.Aafter .before::after { >.item.action.Aafter .before::after {
background-color: #72FDC9 ; background-color: #72FDC9;
} }
> .item.action.Abefore .after::after { >.item.action.Abefore .after::after {
background-color: #72FDC9 ; background-color: #72FDC9;
} }
> .bef::before { >.bef::before {
background-color: #72FDC9 !important; background-color: #72FDC9 !important;
} }
> .aft::after { >.aft::after {
background-color: #72FDC9 !important; background-color: #72FDC9 !important;
} }
> .item.action span { >.item.action span {
background-color: #72FDC9 ; background-color: #72FDC9;
cursor: pointer; cursor: pointer;
} }
> .item.action span::after { >.item.action span::after {
border-color: #72FDC9 ; border-color: #72FDC9;
} }
> .action div { >.action div {
color:#72FDC9 !important; color: #72FDC9 !important;
} }
>.item { >.item {
position: relative; position: relative;
width: 113px; width: 113px;
height:35px; height: 35px;
display: inline-flex; display: inline-flex;
flex-direction: column; flex-direction: column;
justify-items: center; justify-items: center;
@ -158,40 +160,40 @@ import { number } from 'echarts';
>span { >span {
position: absolute; position: absolute;
display:inline-flex; display: inline-flex;
width: 9px; width: 9px;
height: 9px; height: 9px;
background: #C7C7C7; background: #C7C7C7;
border-radius: 50%; border-radius: 50%;
opacity: 1; opacity: 1;
left:53px; left: 53px;
} }
>div { >div {
position: relative; position: relative;
display:inline-flex; display: inline-flex;
width:100%; width: 100%;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
top: 5px; top: 5px;
margin-top:10px; margin-top: 10px;
color:#C7C7C7; color: #C7C7C7;
} }
>span::after { >span::after {
content: ""; content: "";
position: absolute; position: absolute;
display:inline-flex; display: inline-flex;
width: 15px; width: 15px;
height: 15px; height: 15px;
border:1px solid #C7C7C7; border: 1px solid #C7C7C7;
border-radius: 50%; border-radius: 50%;
opacity: 1; opacity: 1;
top:-3.5px; top: -3.5px;
left:-3px; left: -3px;
}
} }
} }
} }
</style> }
</style>

109
ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/eventSource/assets/charts.js

@ -1,24 +1,24 @@
let data = [{ let data = [{
average:30, average: 30,
typeName:'视频识别', typeName: '视频识别',
percent:0.2 percent: 0.2
},{ }, {
average:25, average: 25,
typeName:'雷达识别', typeName: '雷达识别',
percent:0.25 percent: 0.25
},{ }, {
average:15, average: 15,
typeName:'锥桶', typeName: '锥桶',
percent:0.08 percent: 0.08
},{ }, {
average:30, average: 30,
typeName:'护栏碰撞', typeName: '护栏碰撞',
percent:0.14 percent: 0.14
}] }]
window.mainData = data; window.mainData = data;
let chartData = [],lengData=[], colorList = ['#006EDF', '#00FF00', '#FFC30D', '#FF8400', '#1DA7FF','#2967EA']; let chartData = [], lengData = [], colorList = ['#006EDF', '#00FF00', '#FFC30D', '#FF8400', '#1DA7FF', '#2967EA'];
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
chartData.push({ chartData.push({
value: data[i].average, value: data[i].average,
@ -32,7 +32,7 @@ for (let i = 0; i < data.length; i++) {
}) })
} }
let a = chartData.map(t=>{ let a = chartData.map(t => {
t.value = parseInt(t.value) t.value = parseInt(t.value)
return t return t
}) })
@ -58,40 +58,39 @@ for (let i = 0; i < chartData.length; i++) {
}); });
pieData1.push(gapData); pieData1.push(gapData);
} }
console.log(pieData1);
var options = { var options = {
tooltip: { tooltip: {
confine: true, confine: true,
textStyle: { textStyle: {
fontSize: 10, // 字体大小 fontSize: 10, // 字体大小
color:'#333', color: '#333',
}, },
color:'#333', color: '#333',
backgroundColor:"#ffffff", backgroundColor: "#ffffff",
}, },
title:{ //圆环中间内容 title: { //圆环中间内容
text: '99% ', text: '99% ',
subtext: ' 占比', subtext: ' 占比',
left:"22%", left: "22%",
top:"40%", top: "40%",
textStyle:{ textStyle: {
color:"#fff", color: "#fff",
fontSize:21, fontSize: 21,
align:"center" align: "center"
}, },
subtextStyle: { subtextStyle: {
fontSize: 13, fontSize: 13,
fontWeight: '400', fontWeight: '400',
top: 0, top: 0,
marginLeft:20, marginLeft: 20,
align:"center", align: "center",
color:'#fff' color: '#fff'
}, },
}, },
color:['#5973FF', '#14d8b4', '#FFC30D', '#61D8FF', '#1DA7FF','#2967EA'], color: ['#5973FF', '#14d8b4', '#FFC30D', '#61D8FF', '#1DA7FF', '#2967EA'],
legend: { legend: {
top:'20%', top: '20%',
right: 0, right: 0,
orient: "vertical", //改变排列方式 orient: "vertical", //改变排列方式
icon: "circle", //改变legend小图标形状 icon: "circle", //改变legend小图标形状
@ -101,15 +100,15 @@ var options = {
textStyle: { textStyle: {
fontSize: 12, fontSize: 12,
color: "#fff", color: "#fff",
rich:{ rich: {
a:{ a: {
fontSize: 12, fontSize: 12,
}, },
b:{ b: {
fontSize: 12, fontSize: 12,
padding: 5, padding: 5,
marginLeft:5, marginLeft: 5,
color:"#37E7FF", color: "#37E7FF",
} }
}, },
}, },
@ -117,20 +116,20 @@ var options = {
borderColor: "transparent", borderColor: "transparent",
}, },
data: lengData, data: lengData,
formatter: function(name){ formatter: function (name) {
let total = 0 let total = 0
let target let target = 0
if ( !mainData ) return ""; if (!mainData) return "";
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
if ( window.mainData[i] ) { if (window.mainData[i]) {
total += window.mainData[i].value total += window.mainData[i].percent
if ( window.mainData[i].name === name) { if (window.mainData[i].typeName === name) {
target = window.mainData[i].value target = window.mainData[i].percent
} }
} }
} }
var arr = [ var arr = [
'{a|' + name + '}', '{a|' + name + (name.length == 4 ? '}' : '} '),
'{b|' + ((target / total) * 100).toFixed(2) + '%}', '{b|' + ((target / total) * 100).toFixed(2) + '%}',
] ]
return arr.join(' ') return arr.join(' ')
@ -143,7 +142,7 @@ var options = {
avoidLabelOverlap: true,//防止标签重叠 avoidLabelOverlap: true,//防止标签重叠
type: 'pie', type: 'pie',
radius: ['63%', '73%'], //大小 radius: ['63%', '73%'], //大小
center : ['30%','50%'], //位置 center: ['30%', '50%'], //位置
hoverAnimation: true, hoverAnimation: true,
itemStyle: { itemStyle: {
normal: { normal: {
@ -153,23 +152,23 @@ var options = {
}, },
}, },
labelLine: { labelLine: {
show:false, show: false,
lineStyle: { lineStyle: {
width: 3, width: 3,
}, },
normal: { normal: {
length: 30, // 指示线长度 length: 30, // 指示线长度
length2:80 length2: 80
}, },
}, },
data: pieData1, data: pieData1,
label: { label: {
show: false, show: false,
formatter: function(params){ }, formatter: function (params) { },
textStyle: { textStyle: {
fontSize: '18', fontSize: '18',
fontWeight: 'bold', fontWeight: 'bold',
color:'#fff' color: '#fff'
}, },
rich: { rich: {
color0: { color0: {
@ -187,8 +186,8 @@ var options = {
color4: { color4: {
color: '#1DA7FF', color: '#1DA7FF',
}, },
color5:{ color5: {
color:'#2967EA' color: '#2967EA'
} }
}, },
}, },
@ -215,7 +214,7 @@ var options = {
}, },
splitLine: { splitLine: {
show: true, show: true,
length:68, length: 68,
lineStyle: { lineStyle: {
width: 2, width: 2,
color: '#277DCA', color: '#277DCA',
@ -247,7 +246,7 @@ var options = {
}, },
splitLine: { splitLine: {
show: true, show: true,
length:2, length: 2,
lineStyle: { lineStyle: {
width: 1, width: 1,
color: '#017383', color: '#017383',

141
ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/eventSource/index.vue

@ -5,16 +5,32 @@
<div class="charts keep-ratio " id="eventSource"></div> <div class="charts keep-ratio " id="eventSource"></div>
</div> </div>
</div> </div>
</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 { getWarningSourceGroup } from '../../../../../../../api/event/perceiveEvent'; import { getWarningSourceGroup } from '../../../../../../../api/event/perceiveEvent';
export default { const drawRoundRect = (ctx, x, y, width, height, radius, gr) => {
// ctx, x, y, , ,
ctx.beginPath();
ctx.fillStyle = gr;
ctx.arc(x + radius, y + radius, radius, Math.PI, Math.PI * 3 / 2);
ctx.lineTo(width - radius + x, y);
ctx.arc(width - radius + x, radius + y, radius, Math.PI * 3 / 2, Math.PI * 2);
ctx.lineTo(width + x, height + y - radius);
ctx.arc(width - radius + x, height - radius + y, radius, 0, Math.PI * 1 / 2);
ctx.lineTo(radius + x, height + y);
ctx.arc(radius + x, height - radius + y, radius, Math.PI * 1 / 2, Math.PI);
ctx.closePath();
//ctx.stroke();
ctx.fill()
}
export default {
name: 'EventSource', name: 'EventSource',
components: { components: {
WgtTitle WgtTitle
@ -29,73 +45,73 @@
}, },
methods: { methods: {
changeReisze(){ changeReisze() {
this.myChart.resize(); this.myChart.resize();
}, },
}, },
mounted() { mounted() {
setTimeout(() => { setTimeout(() => {
let currentIndex = -1;
this.$nextTick(() => { this.$nextTick(() => {
var myChart = echarts.init(document.getElementById('eventSource')); var myChart = echarts.init(document.getElementById('eventSource'));
getWarningSourceGroup().then((res)=>{ getWarningSourceGroup().then((res) => {
if ( res.code == 200 ) { if (res.code == 200) {
console.log("=================",res);
let data = res.data.warningSourceList; let data = res.data.warningSourceList;
let total = res.data.total; let total = res.data.total;
if (data.length > 0) {
let warningTypes = []; let warningTypes = [];
let number = []; let number = [];
data.forEach(it=>{ data.forEach((it, index )=> {
if ( it.warningSource == 1) { if (it.warningSource == 1) {
warningTypes.push('交通拥堵'); warningTypes.push('交通拥堵');
} }
if ( it.warningSource == 2) { if (it.warningSource == 2) {
warningTypes.push('行人'); warningTypes.push('行人');
} }
if ( it.warningSource == 3) { if (it.warningSource == 3) {
warningTypes.push('非机动车'); warningTypes.push('非机动车');
} }
if ( it.warningSource == 4) { if (it.warningSource == 4) {
warningTypes.push('停车'); warningTypes.push('停车');
} }
if ( it.warningSource == 5) { if (it.warningSource == 5) {
warningTypes.push('倒车/逆行'); warningTypes.push('倒车/逆行');
} }
if ( it.warningSource == 6) { if (it.warningSource == 6) {
warningTypes.push('烟火'); warningTypes.push('烟火');
} }
if ( it.warningSource == 7) { if (it.warningSource == 7) {
warningTypes.push('撒落物'); warningTypes.push('撒落物');
} }
if ( it.warningSource == 8) { if (it.warningSource == 8) {
warningTypes.push('异常天气'); warningTypes.push('异常天气');
} }
if ( it.warningSource == 9) { if (it.warningSource == 9) {
warningTypes.push('护栏碰撞'); warningTypes.push('护栏碰撞');
} }
number.push(it.number); number.push(it.number);
// drawRoundRect(context, 241, 37 + (index * 27), 134, 20, 12, gr);
}) })
let colorList = ['#006EDF', '#00FF00', '#FFC30D', '#FF8400', '#1DA7FF','#2967EA']; let colorList = ['#006EDF', '#00FF00', '#FFC30D', '#FF8400', '#1DA7FF', '#2967EA'];
let lengData = []; let lengData = [];
let mainData = []; let mainData = [];
let mainCount = 0; let mainCount = 0;
for (let j =0;j < number.length;j++){ for (let j = 0; j < number.length; j++) {
mainCount+= number[j]; mainCount += number[j];
} }
for (let i = 0;i < warningTypes.length;i++){ for (let i = 0; i < warningTypes.length; i++) {
let it = warningTypes[i]; let it = warningTypes[i];
lengData.push({ lengData.push({
name:it, name: it,
color:colorList[i], color: colorList[i],
value:number[i], value: number[i],
}); });
mainData.push({ mainData.push({
name:it, name: it,
color:colorList[i], color: colorList[i],
value:number[i], value: number[i],
percent: number[i]/mainCount percent: number[i] / mainCount
}) })
} }
window.mainData = mainData; window.mainData = mainData;
@ -107,7 +123,6 @@
if (params.componentType == 'graphic') { if (params.componentType == 'graphic') {
return return
} }
console.log(params);
chartsStatistics.title.text = params.percent + "%"; chartsStatistics.title.text = params.percent + "%";
chartsStatistics.title.subtext = params.data.name; chartsStatistics.title.subtext = params.data.name;
chartsStatistics.title.left = "22%"; chartsStatistics.title.left = "22%";
@ -122,39 +137,63 @@
myChart.setOption(chartsStatistics); myChart.setOption(chartsStatistics);
}) })
} }
}
myChart.setOption(chartsStatistics); myChart.setOption(chartsStatistics);
}) })
const domMap = document.getElementById("eventSource");
let parentDiv = domMap.firstChild;
// canvas
let canvas = document.createElement('canvas');
canvas.width = parentDiv.offsetWidth;
canvas.height = parentDiv.offsetHeight;
parentDiv.appendChild(canvas);
const context = canvas.getContext('2d');
//
let gr = context.createLinearGradient(247, 63, 450, 0);
gr.addColorStop(1, 'rgba(92,197,255,0)');
gr.addColorStop(0, 'rgba(92,197,255,0.3)');
// drawRoundRect(context, 241, 37, 134, 20, 12, gr);
// drawRoundRect(context, 241, 64, 134, 20, 12, gr);
// drawRoundRect(context, 241, 91, 134, 20, 12, gr);
// drawRoundRect(context, 241, 118, 134, 20, 12, gr);
context.lineWidth = 1; // 线
this.myChart = myChart; this.myChart = myChart;
}); });
}); });
}, },
} }
</script> </script>
<style lang='scss' scoped> <style lang='scss' scoped>
.congestion { .congestion {
width: 100%; width: 100%;
.board{
height:200px; .board {
height: 200px;
width: 100%; width: 100%;
padding: 40px 40px; padding: 40px 40px;
background: linear-gradient(180deg, rgba(6,66,88,0.2) 0%, #064258 100%); background: linear-gradient(180deg, rgba(6, 66, 88, 0.2) 0%, #064258 100%);
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;
} }
} }
.charts {
height:180px;
width: 100%;
}
</style> .charts {
height: 180px;
width: 100%;
}
</style>

20
ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/monthStatistics/assets/charts.js

@ -30,14 +30,14 @@ var options = {
// 'image://data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+PHN2ZyB0PSIxNTg2NDg1MzkzMjI2IiBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHAtaWQ9IjQ3MzUiIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCI+PGRlZnM+PHN0eWxlIHR5cGU9InRleHQvY3NzIj48L3N0eWxlPjwvZGVmcz48cGF0aCBkPSJNNTEyIDBDMjI2Ljc0Mjg1NyAwIDAgMjI2Ljc0Mjg1NyAwIDUxMnMyMjYuNzQyODU3IDUxMiA1MTIgNTEyIDUxMi0yMjYuNzQyODU3IDUxMi01MTItMjI2Ljc0Mjg1Ny01MTItNTEyLTUxMnogbTAgODc3LjcxNDI4NmMtMjA0LjggMC0zNjUuNzE0Mjg2LTE2MC45MTQyODYtMzY1LjcxNDI4Ni0zNjUuNzE0Mjg2czE2MC45MTQyODYtMzY1LjcxNDI4NiAzNjUuNzE0Mjg2LTM2NS43MTQyODYgMzY1LjcxNDI4NiAxNjAuOTE0Mjg2IDM2NS43MTQyODYgMzY1LjcxNDI4Ni0xNjAuOTE0Mjg2IDM2NS43MTQyODYtMzY1LjcxNDI4NiAzNjUuNzE0Mjg2eiIgZmlsbD0iIzRBQkRDRiIgcC1pZD0iNDczNiI+PC9wYXRoPjxwYXRoIGQ9Ik01MTIgNTEybS0zNjUuNzE0Mjg2IDBhMzY1LjcxNDI4NiAzNjUuNzE0Mjg2IDAgMSAwIDczMS40Mjg1NzIgMCAzNjUuNzE0Mjg2IDM2NS43MTQyODYgMCAxIDAtNzMxLjQyODU3MiAwWiIgZmlsbD0iI0ZGRkZGRiIgcC1pZD0iNDczNyI+PC9wYXRoPjwvc3ZnPg==', // 'image://data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+PHN2ZyB0PSIxNTg2NDg1MzkzMjI2IiBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHAtaWQ9IjQ3MzUiIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCI+PGRlZnM+PHN0eWxlIHR5cGU9InRleHQvY3NzIj48L3N0eWxlPjwvZGVmcz48cGF0aCBkPSJNNTEyIDBDMjI2Ljc0Mjg1NyAwIDAgMjI2Ljc0Mjg1NyAwIDUxMnMyMjYuNzQyODU3IDUxMiA1MTIgNTEyIDUxMi0yMjYuNzQyODU3IDUxMi01MTItMjI2Ljc0Mjg1Ny01MTItNTEyLTUxMnogbTAgODc3LjcxNDI4NmMtMjA0LjggMC0zNjUuNzE0Mjg2LTE2MC45MTQyODYtMzY1LjcxNDI4Ni0zNjUuNzE0Mjg2czE2MC45MTQyODYtMzY1LjcxNDI4NiAzNjUuNzE0Mjg2LTM2NS43MTQyODYgMzY1LjcxNDI4NiAxNjAuOTE0Mjg2IDM2NS43MTQyODYgMzY1LjcxNDI4Ni0xNjAuOTE0Mjg2IDM2NS43MTQyODYtMzY1LjcxNDI4NiAzNjUuNzE0Mjg2eiIgZmlsbD0iIzRBQkRDRiIgcC1pZD0iNDczNiI+PC9wYXRoPjxwYXRoIGQ9Ik01MTIgNTEybS0zNjUuNzE0Mjg2IDBhMzY1LjcxNDI4NiAzNjUuNzE0Mjg2IDAgMSAwIDczMS40Mjg1NzIgMCAzNjUuNzE0Mjg2IDM2NS43MTQyODYgMCAxIDAtNzMxLjQyODU3MiAwWiIgZmlsbD0iI0ZGRkZGRiIgcC1pZD0iNDczNyI+PC9wYXRoPjwvc3ZnPg==',
handleStyle: { handleStyle: {
color: '#0BDADA', color: '#0BDADA',
borderWidth :0, borderWidth: 0,
}, },
moveHandleStyle:{ moveHandleStyle: {
color: 'transparent', color: 'transparent',
borderWidth:0, borderWidth: 0,
opacity:0, opacity: 0,
}, },
selectedDataBackground:{ selectedDataBackground: {
color: 'transparent', color: 'transparent',
areaStyle: { areaStyle: {
opacity: 0 opacity: 0
@ -46,7 +46,7 @@ var options = {
opacity: 0 opacity: 0
} }
}, },
backgroundColor:new echarts.graphic.LinearGradient( backgroundColor: new echarts.graphic.LinearGradient(
0, 0, 1, 0, 0, 0, 1, 0,
[{ [{
offset: 0, offset: 0,
@ -175,9 +175,9 @@ var options = {
showSymbol: false, showSymbol: false,
smooth: true, // 是否曲线 smooth: true, // 是否曲线
name: "", // 图例对应类别 name: "", // 图例对应类别
data: [400, 600, 700, 200, 500, 700, 900,400, 600, 700, 200, 500, 700, 900,400, 600, 700, 200, 500, 700, 900,400, 600, 700, 200, 500, 700, 900], // 纵坐标数据 data: [400, 600, 700, 200, 500, 700, 900, 400, 600, 700, 200, 500, 700, 900, 400, 600, 700, 200, 500, 700, 900, 400, 600, 700, 200, 500, 700, 900], // 纵坐标数据
lineStyle :{ lineStyle: {
color:"#39B1FF" color: "#39B1FF"
}, },
areaStyle: { areaStyle: {
// 区域颜色 // 区域颜色
@ -204,7 +204,7 @@ var options = {
}, },
{ {
offset: 1, offset: 1,
opacity:0.01, opacity: 0.01,
color: '#39b1ff01' // 100% 处的颜色 color: '#39b1ff01' // 100% 处的颜色
} }
] ]

59
ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/monthStatistics/index.vue

@ -5,16 +5,16 @@
<div class="charts keep-ratio " id="monthStatistics"></div> <div class="charts keep-ratio " id="monthStatistics"></div>
</div> </div>
</div> </div>
</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 { getDailyCumulativeMonth } from '../../../../../../../api/event/perceiveEvent'; import { getDailyCumulativeMonth } from '../../../../../../../api/event/perceiveEvent';
export default { export default {
name: 'MonthStatistics', name: 'MonthStatistics',
components: { components: {
WgtTitle WgtTitle
@ -35,24 +35,24 @@
setTimeout(() => { setTimeout(() => {
this.$nextTick(() => { this.$nextTick(() => {
var myChart = echarts.init(document.getElementById('monthStatistics')); var myChart = echarts.init(document.getElementById('monthStatistics'));
getDailyCumulativeMonth().then((res)=>{ getDailyCumulativeMonth().then((res) => {
console.log(res); console.log(res);
if ( res.code == 200 ) { if (res.code == 200) {
let data = res.data; let data = res.data;
let timeData = []; let timeData = [];
let datasN = []; let datasN = [];
for (var i = 0; i < 24;i++){ for (var i = 0; i < 24; i++) {
let k = 0; let k = 0;
for (var j = 0;j < data.length;j++){ for (var j = 0; j < data.length; j++) {
let it = data[j]; let it = data[j];
if ( it.time == i ) { if (it.time == i) {
timeData.push( i +"点至"+ (i +1)+"点"); timeData.push(i + "点至" + (i + 1) + "点");
datasN.push(it.number); datasN.push(it.number);
k++; k++;
} }
} }
if ( k == 0 ) { if (k == 0) {
timeData.push( i +"点至"+ (i +1)+"点"); timeData.push(i + "点至" + (i + 1) + "点");
datasN.push(0); datasN.push(0);
} }
} }
@ -66,31 +66,32 @@
}); });
}); });
}, },
} }
</script> </script>
<style lang='scss' scoped> <style lang='scss' scoped>
.congestion { .congestion {
width: 100%; width: 100%;
.board{
height:200px; .board {
height: 200px;
width: 100%; width: 100%;
padding: 0px 20px; padding: 0px 20px;
background: linear-gradient(180deg, rgba(6,66,88,0.2) 0%, #064258 100%); background: linear-gradient(180deg, rgba(6, 66, 88, 0.2) 0%, #064258 100%);
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;
} }
} }
.charts {
height:180px;
width: 100%;
}
</style> .charts {
height: 180px;
width: 100%;
}
</style>

23
ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/railway/assets/charts.js

@ -11,14 +11,13 @@ let dataZoomMove = {
end: 4 end: 4
} }
var options = { var options = {
grid: { grid: {
containLabel: true, containLabel: true,
// 边距自行修改 // 边距自行修改
bottom: '0%', bottom: '0%',
left: '0%', left: '0%',
top: '20%', top: '2%',
right: '10%', right: '15%',
}, },
xAxis: { xAxis: {
type: 'value', type: 'value',
@ -44,12 +43,12 @@ var options = {
fontSize: '14px', fontSize: '14px',
inside: true, inside: true,
verticalAlign: 'bottom', verticalAlign: 'bottom',
color:'#fff', color: '#fff',
padding:10, padding: 10,
margin:-5, margin: -5,
formatter: function (value) { formatter: function (value, index) {
let index = xdata.value.indexOf(value); // let index = xdata.value.indexOf(value);
return `{a|Top${index + 2}} {b|${value}}` return `{a|Top${index + 1}} {b|${value}}`
}, },
rich: { rich: {
a: { a: {
@ -101,7 +100,7 @@ var options = {
position: 'right', position: 'right',
distance: -10, distance: -10,
data: sdata, data: sdata,
color:'#fff', color: '#fff',
formatter: (c) => { formatter: (c) => {
return `{a|}{b|${c.value}辆}` return `{a|}{b|${c.value}辆}`
}, },
@ -113,8 +112,8 @@ var options = {
image: chartIcon image: chartIcon
}, },
}, },
b:{ b: {
padding:[0,0,0,10] padding: [0, 0, 0, 10]
} }
} }
} }

139
ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/railway/index.vue

@ -1,47 +1,91 @@
<template> <template>
<div class='situation'> <div class="situation">
<WgtTitle :title="'路段感知事件排名'"></WgtTitle> <WgtTitle :title="'路段感知事件排名'"></WgtTitle>
<div class="board"> <div class="board">
<!-- <div class="tag"> <!-- <div class="tag">
<div class="checked">路段车流量Top10</div> <div class="checked">路段车流量Top10</div>
<div>断面交通量Top10</div> <div>断面交通量Top10</div>
</div> --> </div> -->
<div class="charts keep-ratio " id="situationEchartBox"></div> <div class="charts keep-ratio" id="situationEchartBox"></div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import WgtTitle from "../../../widgets/title";
import * as echarts from "echarts";
import chartsStatistics from "./assets/charts";
import { getSectionPerceivedList } from "../../../../../../../api/event/perceiveEvent";
import WgtTitle from '../../../widgets/title' export default {
import * as echarts from "echarts"; name: "Situation",
import chartsStatistics from "./assets/charts";
import { getSectionPerceivedList } from '../../../../../../../api/event/perceiveEvent';
export default {
name: 'Situation',
components: { components: {
WgtTitle WgtTitle,
}, },
data() { data() {
return { return {};
}
}, },
mounted() { mounted() {
setTimeout(() => { setTimeout(() => {
this.$nextTick(() => { this.$nextTick(() => {
var myChart = echarts.init(document.getElementById('situationEchartBox')); var myChart = echarts.init(
document.getElementById("situationEchartBox")
);
getSectionPerceivedList({}).then((res)=>{ getSectionPerceivedList({}).then((res) => {
console.log(res); console.log(res);
if ( res.code == 200 ) { if (res.code == 200) {
let data = res.data; let data = res.data;
let texts = []; let texts = [];
let datas = []; let datas = [];
//
data.forEach(it => { if (data.length <= 0) {
data = [
{
sectionName: "华山北枢纽-济南虚",
number: 32774,
},
{
sectionName: "东客站虚-华山北枢纽",
number: 30067,
},
{
sectionName: "小许家枢纽-东客站虚",
number: 30057,
},
{
sectionName: "临沂枣园枢纽-临沂虚",
number: 28774,
},
{
sectionName: "华山北枢纽-济南虚",
number: 26021,
},
{
sectionName: "华山北枢纽-济南虚",
number: 24061,
},
{
sectionName: "华山北枢纽-济南虚",
number: 20150,
},
{
sectionName: "华山北枢纽-济南虚",
number: 20140,
},
{
sectionName: "华山北枢纽-济南虚",
number: 20050,
},
{
sectionName: "华山北枢纽-济南虚",
number: 20010,
},
];
}
data.forEach((it) => {
texts.push(it.sectionName); texts.push(it.sectionName);
datas.push(it.number); datas.push(it.number);
}); });
@ -52,60 +96,63 @@
myChart.setOption(chartsStatistics); myChart.setOption(chartsStatistics);
} }
}); });
}); });
}); });
}, },
created() { created() {},
methods: {},
}, };
methods: { </script>
}
}
</script>
<style lang='scss' scoped> <style lang="scss" scoped>
.situation { .situation {
width: 100%; width: 100%;
.board{
.board {
height: 455px; height: 455px;
width: 100%; width: 100%;
padding: 0px 30px; padding: 10px 10px;
background: linear-gradient(180deg, rgba(6,66,88,0.2) 0%, #064258 100%); background: linear-gradient(180deg, rgba(6, 66, 88, 0.2) 0%, #064258 100%);
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: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
} }
.charts { .charts {
margin-top: -40px; // margin-top: -40px;
height: 400px; height: 450px;
width: 100%; width: 100%;
} }
.tag{
.tag {
margin-top: 20px; margin-top: 20px;
display: flex; display: flex;
width: 100%; width: 100%;
justify-content: flex-start; justify-content: flex-start;
div{
div {
width: 150px; width: 150px;
height: 25px; height: 25px;
line-height: 25px; line-height: 25px;
border-radius: 20px; border-radius: 20px;
text-align: center; text-align: center;
background-color: #C87800; background-color: #c87800;
margin-right: 10px; margin-right: 10px;
} }
.checked{
background-color: #00B3CC;; .checked {
} background-color: #00b3cc;
} }
} }
</style> }
</style>

23
ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/railwayDay/assets/charts.js

@ -1,12 +1,13 @@
/* 数据 */ /* 数据 */
let nameList = ["大学城", "长清", "孝里", "安城", "平阴北", "平阴南", "东平", "梁山东", "嘉祥西"]; // 类别 let nameList = ["大学城", "长清", "孝里", "安城", "平阴北", "平阴南", "东平", "梁山东", "嘉祥西"]; // 类别
let valueList = [800, 520, 650, 950, 420, 600, 450, 720, 303 ]; // 人数 let valueList = [800, 520, 650, 950, 420, 600, 450, 720, 303]; // 人数
var yList = [ "1000","800","轻度拥堵","基本畅通","畅通"] // var yList = [ "1000","800","轻度拥堵","基本畅通","畅通"]
/* 数据整合 */ /* 数据整合 */
const minNumber = 0;
let dataList = []; let dataList = [];
nameList.map((item, index) => { nameList.map((item, index) => {
if (index === 4) { if (index === 3) {
dataList.push({ dataList.push({
name: item, name: item,
value: valueList[index], value: valueList[index],
@ -32,7 +33,7 @@ nameList.map((item, index) => {
dataList.push({ dataList.push({
name: item, name: item,
value: valueList[index], value: valueList[index],
itemStyle:{ itemStyle: {
borderRadius: 6 borderRadius: 6
} }
}) })
@ -47,6 +48,11 @@ var options = {
bottom: "0%",//下边距 bottom: "0%",//下边距
containLabel: true, containLabel: true,
}, },
tooltip: {
valueFormatter: function (value) {
return (value + minNumber).toFixed(2);
}
},
xAxis: { xAxis: {
type: 'category', type: 'category',
data: nameList, data: nameList,
@ -61,7 +67,7 @@ var options = {
axisLabel: { axisLabel: {
show: true, show: true,
color: '#B6E6FF', color: '#B6E6FF',
fontSize:8, fontSize: 8,
fontFamily: 'Source Han Sans CN-Regular', fontFamily: 'Source Han Sans CN-Regular',
}, },
}, },
@ -99,7 +105,7 @@ var options = {
series: [{ series: [{
type: 'bar', type: 'bar',
data: dataList, data: dataList,
z:4, z: 4,
itemStyle: { itemStyle: {
color: { color: {
type: 'linear', type: 'linear',
@ -116,8 +122,9 @@ var options = {
}, },
borderRadius: [4, 4, 0, 0] borderRadius: [4, 4, 0, 0]
}, },
barWidth:10, barWidth: 10,
label: {show:false, label: {
show: false,
} }
}, },
] ]

25
ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/railwayDay/index.vue

@ -35,9 +35,10 @@ export default {
setTimeout(() => { setTimeout(() => {
this.$nextTick(() => { this.$nextTick(() => {
var myChart = echarts.init(document.getElementById('railwayDay')); var myChart = echarts.init(document.getElementById('railwayDay'));
getSectionPerceivedNumber().then((res)=>{ getSectionPerceivedNumber().then((res) => {
if ( res.code == 200 ) { if (res.code == 200) {
let data = res.data; let data = res.data;
if (data.length > 0) {
let texts = []; let texts = [];
let datas = []; let datas = [];
@ -48,8 +49,9 @@ export default {
chartsStatistics.xAxis.data = texts; chartsStatistics.xAxis.data = texts;
chartsStatistics.series[0].data = datas; chartsStatistics.series[0].data = datas;
}
myChart.setOption(chartsStatistics); myChart.setOption(chartsStatistics);
} }
}) })
}); });
@ -61,24 +63,25 @@ export default {
<style lang='scss' scoped> <style lang='scss' scoped>
.congestion { .congestion {
width: 100%; width: 100%;
.board{
height:200px; .board {
height: 200px;
width: 100%; width: 100%;
padding: 0px 20px; padding: 0px 20px;
background: linear-gradient(180deg, rgba(6,66,88,0.2) 0%, #064258 100%); background: linear-gradient(180deg, rgba(6, 66, 88, 0.2) 0%, #064258 100%);
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;
} }
} }
.charts {
height:180px;
width: 100%;
}
.charts {
height: 180px;
width: 100%;
}
</style> </style>

52
ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/typeAnalysis/assets/charts.js

@ -1,10 +1,11 @@
window.typeAnalysisData = [ window.typeAnalysisData = [
{ value: 100, name: '行人' }, { value: 100, name: '行人' },
{ value: 90, name: '非机动车' }, // { value: 90, name: '非机动车' },
{ value: 80, name: '拥堵' }, // { value: 80, name: '拥堵' },
{ value: 60, name: '逆行' }, // { value: 60, name: '逆行' },
{ value: 50, name: '抛洒物' }, // { value: 50, name: '抛洒物' },
{ value: 45, name: '烟火' }] // { value: 45, name: '烟火' }
]
window.colorList = [ window.colorList = [
"#019AFF", "#019AFF",
@ -19,13 +20,6 @@ window.colorList1 = [
"#FFB905", "#FFB905",
"#6AE0BC",] "#6AE0BC",]
window.count = 0;
typeAnalysisData.forEach((it)=>{
count += it.value;
})
var options = { var options = {
color: colorList, color: colorList,
legend: { legend: {
@ -39,26 +33,30 @@ var options = {
textStyle: { textStyle: {
color: "#fff", color: "#fff",
fontSize: 12, fontSize: 12,
rich:{ rich: {
ast: { ast: {
align: "left", align: "left",
fontSize: 12, fontSize: 12,
width:30, width: 30,
}, },
bst: { bst: {
align: "left", align: "left",
fontSize: 12, fontSize: 12,
marginLeft:20, marginLeft: 20,
color:"#37E7FF" color: "#37E7FF"
} }
} }
}, },
formatter: (params) => { formatter: (params) => {
let obj = typeAnalysisData.filter(it=>{ return it.name == params}) let count = 0;
console.log(obj); typeAnalysisData.forEach((it) => {
return `{ast|${obj[0].name}} {bst|${Math.round(obj[0].value/count* 100) }%}` count += it.value;
})
let obj = typeAnalysisData.filter(it => { return it.name == params })
// console.log(obj);
return `{ast|${obj[0].name}} {bst|${Math.round((obj[0].value / count) * 100)}%}`
}, },
data: typeAnalysisData?.map(x => x.name), // data: typeAnalysisData?.map(x => x.name),
}, },
tooltip: { tooltip: {
trigger: 'item', trigger: 'item',
@ -68,9 +66,9 @@ var options = {
type: 'pie', type: 'pie',
radius: '80%', radius: '80%',
center: ['40%', '50%'], center: ['40%', '50%'],
clockwise:false, clockwise: false,
roseType: 'radius', roseType: 'radius',
startAngle1:180, startAngle1: 180,
label: { label: {
show: false, show: false,
position: 'outside', position: 'outside',
@ -92,7 +90,7 @@ var options = {
}, },
}, },
labelLine: { labelLine: {
show:false, show: false,
length: 10, length: 10,
length2: 30, length2: 30,
}, },
@ -104,13 +102,13 @@ var options = {
} }
} }
}) })
},{ }, {
name: '', name: '',
type: 'pie', type: 'pie',
radius: '90%', radius: '90%',
hoverAnimation: false, hoverAnimation: false,
emphasis: { scale: false }, emphasis: { scale: false },
clockwise:false, clockwise: false,
center: ['40%', '50%'], center: ['40%', '50%'],
roseType: 'radius', roseType: 'radius',
label: { label: {
@ -129,13 +127,13 @@ var options = {
}, },
itemStyle: { itemStyle: {
normal: { normal: {
opacity:0.3, opacity: 0.3,
shadowColor: "rgba(0, 0, 0, 0.8)", shadowColor: "rgba(0, 0, 0, 0.8)",
shadowBlur: 50, shadowBlur: 50,
}, },
}, },
labelLine: { labelLine: {
show:false, show: false,
length: 10, length: 10,
length2: 30, length2: 30,
}, },

114
ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/typeAnalysis/index.vue

@ -5,17 +5,17 @@
<div class="charts keep-ratio " id="typeAnalysis"></div> <div class="charts keep-ratio " id="typeAnalysis"></div>
</div> </div>
</div> </div>
</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 { getWarningTypeDay } from '../../../../../../../api/event/perceiveEvent'; import { getWarningTypeDay } 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;
@ -24,7 +24,7 @@
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();
@ -32,7 +32,7 @@
} }
export default { export default {
name: 'TypeAnalysis', name: 'TypeAnalysis',
components: { components: {
WgtTitle WgtTitle
@ -42,7 +42,6 @@
} }
}, },
created() { created() {
}, },
@ -55,70 +54,70 @@
var myChart = echarts.init(document.getElementById('typeAnalysis')); var myChart = echarts.init(document.getElementById('typeAnalysis'));
getWarningTypeDay().then(res=>{ getWarningTypeDay().then(res => {
console.log(res); console.log(res);
if ( res.code == 200 ) { if (res.code == 200) {
let data = res.data; let data = res.data;
console.log("===================",data); console.log("===================", data);
typeAnalysisData = []; typeAnalysisData = [];
for (var i = 0;i < data.length;i++){ for (var i = 0; i < data.length; i++) {
var it = data[i]; var it = data[i];
if ( it.warningType == 1) { if (it.warningType == 1) {
typeAnalysisData.push({ typeAnalysisData.push({
name:'交通拥堵', name: '交通拥堵',
value:it.number value: it.number
}); });
} }
if ( it.warningType == 2) { if (it.warningType == 2) {
typeAnalysisData.push({ typeAnalysisData.push({
name:'行人', name: '行人',
value:it.number value: it.number
}); });
} }
if ( it.warningType == 3) { if (it.warningType == 3) {
typeAnalysisData.push({ typeAnalysisData.push({
name:'非机动车', name: '非机动车',
value:it.number value: it.number
}); });
} }
if ( it.warningType == 4) { if (it.warningType == 4) {
typeAnalysisData.push({ typeAnalysisData.push({
name:'停车', name: '停车',
value:it.number value: it.number
}); });
} }
if ( it.warningType == 5) { if (it.warningType == 5) {
typeAnalysisData.push({ typeAnalysisData.push({
name:'倒车/逆行', name: '倒车/逆行',
value:it.number value: it.number
}); });
} }
if ( it.warningType == 6) { if (it.warningType == 6) {
typeAnalysisData.push({ typeAnalysisData.push({
name:'烟火', name: '烟火',
value:it.number value: it.number
}); });
} }
if ( it.warningType == 7) { if (it.warningType == 7) {
typeAnalysisData.push({ typeAnalysisData.push({
name:'撒落物', name: '撒落物',
value:it.number value: it.number
}); });
} }
if ( it.warningType == 8) { if (it.warningType == 8) {
typeAnalysisData.push({ typeAnalysisData.push({
name:'异常天气', name: '异常天气',
value:it.number value: it.number
}); });
} }
if ( it.warningType == 9) { if (it.warningType == 9) {
typeAnalysisData.push({ typeAnalysisData.push({
name:'护栏碰撞', name: '护栏碰撞',
value:it.number value: it.number
}); });
} }
drawRoundRect(context, 260, 8 + i * 28, 120, 24, 12,gr) drawRoundRect(context, 260, 8 + i * 28, 120, 24, 12, gr)
} }
chartsStatistics.legend.data = typeAnalysisData?.map(x => x.name); chartsStatistics.legend.data = typeAnalysisData?.map(x => x.name);
@ -148,7 +147,7 @@
// 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');
@ -171,31 +170,32 @@
}); });
}); });
}, },
} }
</script> </script>
<style lang='scss' scoped> <style lang='scss' scoped>
.congestion { .congestion {
width: 100%; width: 100%;
.board{
height:200px; .board {
height: 200px;
width: 100%; width: 100%;
padding: 0px 20px; padding: 0px 20px;
background: linear-gradient(180deg, rgba(6,66,88,0.2) 0%, #06425888 100%); background: linear-gradient(180deg, rgba(6, 66, 88, 0.2) 0%, #06425888 100%);
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.1), rgba(55, 231, 255, 0)) 1 1; border-image: linear-gradient(360deg, rgba(55, 231, 255, 0.1), 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;
} }
} }
.charts {
height:180px;
width: 100%;
}
</style> .charts {
height: 180px;
width: 100%;
}
</style>

2
ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/index.vue

@ -1,9 +1,7 @@
<template> <template>
<div class='TrafficFlow'> <div class='TrafficFlow'>
<section class="content"> <section class="content">
<!-- 在途车流量车型分类 -->
<Railway class="content-l" /> <Railway class="content-l" />
<!-- -->
<div class="content-m" > <div class="content-m" >
<RailWayDay class="content-m-t" /> <RailWayDay class="content-m-t" />
<DayTotal class="content-m-t" /> <DayTotal class="content-m-t" />

Loading…
Cancel
Save