|
@@ -1,17 +1,21 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <div class="algo-data">
|
|
|
|
|
- <span class="algo-tit">算法数据分析</span>
|
|
|
|
|
- <CensusTabs @check-tab="onCheckTab" />
|
|
|
|
|
- <v-chart class="chart" :option="option" />
|
|
|
|
|
- <div class="stat-show">
|
|
|
|
|
- <ViolationStatItem :data="getVioStatData(0)" />
|
|
|
|
|
- <div class="stat-divider"></div>
|
|
|
|
|
- <ViolationStatItem :data="getVioStatData(1)" />
|
|
|
|
|
- <div class="stat-divider"></div>
|
|
|
|
|
- <ViolationStatItem :data="getVioStatData(2)" />
|
|
|
|
|
- <div class="stat-divider"></div>
|
|
|
|
|
- <ViolationStatItem :data="getVioStatData(3)" />
|
|
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <div class="algo-header">
|
|
|
|
|
+ <span class="algo-tit">算法数据分析</span>
|
|
|
|
|
+ <CensusTabs @check-tab="onCheckTab" />
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <el-divider />
|
|
|
|
|
+ <div style="flex-grow: 1; display: flex">
|
|
|
|
|
+ <v-chart class="chart" :option="option" />
|
|
|
|
|
+ <el-divider direction="vertical" border-style="solid" />
|
|
|
|
|
+ <div class="stat-show">
|
|
|
|
|
+ <ViolationStatItem :data="getVioStatData(0)" class="stat-data" />
|
|
|
|
|
+ <div class="stat-divider"></div>
|
|
|
|
|
+ <ViolationStatItem :data="getVioStatData(1)" class="stat-data" />
|
|
|
|
|
+ <ViolationStatItem :data="getVioStatData(2)" class="stat-data" />
|
|
|
|
|
+ <div class="stat-divider"></div>
|
|
|
|
|
+ <ViolationStatItem :data="getVioStatData(3)" class="stat-data" /> </div
|
|
|
|
|
+ ></div>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -23,7 +27,7 @@
|
|
|
import { use } from 'echarts/core';
|
|
import { use } from 'echarts/core';
|
|
|
import { CanvasRenderer } from 'echarts/renderers';
|
|
import { CanvasRenderer } from 'echarts/renderers';
|
|
|
import { PieChart } from 'echarts/charts';
|
|
import { PieChart } from 'echarts/charts';
|
|
|
- import { TooltipComponent, LegendComponent } from 'echarts/components';
|
|
|
|
|
|
|
+ import { TooltipComponent, LegendComponent, TitleComponent } from 'echarts/components';
|
|
|
import { ViolationCount } from '@/api/home/home.ts';
|
|
import { ViolationCount } from '@/api/home/home.ts';
|
|
|
import VChart from 'vue-echarts';
|
|
import VChart from 'vue-echarts';
|
|
|
|
|
|
|
@@ -32,7 +36,7 @@
|
|
|
getViolations: (range: string[]) => void;
|
|
getViolations: (range: string[]) => void;
|
|
|
}>();
|
|
}>();
|
|
|
|
|
|
|
|
- use([CanvasRenderer, PieChart, TooltipComponent, LegendComponent]);
|
|
|
|
|
|
|
+ use([CanvasRenderer, PieChart, TooltipComponent, TitleComponent, LegendComponent]);
|
|
|
|
|
|
|
|
const algoData = computed(() => {
|
|
const algoData = computed(() => {
|
|
|
let newData: any[] = [];
|
|
let newData: any[] = [];
|
|
@@ -49,6 +53,10 @@
|
|
|
|
|
|
|
|
return newData;
|
|
return newData;
|
|
|
});
|
|
});
|
|
|
|
|
+
|
|
|
|
|
+ const algoLegendData = computed(() => {
|
|
|
|
|
+ return algoData.value.map((item) => item.name);
|
|
|
|
|
+ });
|
|
|
// [
|
|
// [
|
|
|
// { value: 335, name: "人员闯入" },
|
|
// { value: 335, name: "人员闯入" },
|
|
|
// { value: 310, name: "未穿反光背心" },
|
|
// { value: 310, name: "未穿反光背心" },
|
|
@@ -77,74 +85,151 @@
|
|
|
return { ...violationHandleCounts[index], count };
|
|
return { ...violationHandleCounts[index], count };
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ // const option = computed(() => {
|
|
|
|
|
+ // return {
|
|
|
|
|
+ // tooltip: {
|
|
|
|
|
+ // trigger: 'item',
|
|
|
|
|
+ // formatter: '{a} <br/>{b} : {c} ({d}%)',
|
|
|
|
|
+ // },
|
|
|
|
|
+ // legend: {
|
|
|
|
|
+ // orient: 'horizontial',
|
|
|
|
|
+ // x: 'center',
|
|
|
|
|
+ // y: 'bottom',
|
|
|
|
|
+ // icon: 'circle',
|
|
|
|
|
+ // width: '80%',
|
|
|
|
|
+ // height: '28%',
|
|
|
|
|
+ // type: 'scroll',
|
|
|
|
|
+ // data: algoData.value.map((item) => item.name),
|
|
|
|
|
+ // formatter: function (name) {
|
|
|
|
|
+ // let total = 0;
|
|
|
|
|
+ // let target;
|
|
|
|
|
+ // for (let i = 0; i < algoData.value.length; i++) {
|
|
|
|
|
+ // total += algoData.value[i].value;
|
|
|
|
|
+ // if (algoData.value[i].name === name) {
|
|
|
|
|
+ // target = algoData.value[i].value;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ // var arr = [
|
|
|
|
|
+ // '{a|' + name + '}',
|
|
|
|
|
+ // '{b|' + ' | ' + ((target / total) * 100).toFixed(0) + '%}\n',
|
|
|
|
|
+ // ];
|
|
|
|
|
+ // return arr.join(' ');
|
|
|
|
|
+ // },
|
|
|
|
|
+ // textStyle: {
|
|
|
|
|
+ // padding: [8, 0, 0, 0],
|
|
|
|
|
+ // fontSize: 14,
|
|
|
|
|
+ // rich: {
|
|
|
|
|
+ // a: {
|
|
|
|
|
+ // fontSize: 15,
|
|
|
|
|
+ // },
|
|
|
|
|
+ // b: {
|
|
|
|
|
+ // fontSize: 15,
|
|
|
|
|
+ // color: '#c1c1c1',
|
|
|
|
|
+ // },
|
|
|
|
|
+ // },
|
|
|
|
|
+ // },
|
|
|
|
|
+ // },
|
|
|
|
|
+ // series: [
|
|
|
|
|
+ // {
|
|
|
|
|
+ // name: '违规统计',
|
|
|
|
|
+ // type: 'pie',
|
|
|
|
|
+ // radius: ['40%', '65%'],
|
|
|
|
|
+ // center: ['50%', '40%'],
|
|
|
|
|
+ // labelLine: {
|
|
|
|
|
+ // show: false,
|
|
|
|
|
+ // },
|
|
|
|
|
+
|
|
|
|
|
+ // label: {
|
|
|
|
|
+ // show: false,
|
|
|
|
|
+ // position: 'center',
|
|
|
|
|
+ // },
|
|
|
|
|
+ // data: algoData.value,
|
|
|
|
|
+ // itemStyle: {
|
|
|
|
|
+ // borderColor: '#fff',
|
|
|
|
|
+ // borderWidth: 5,
|
|
|
|
|
+ // },
|
|
|
|
|
+ // emphasis: {
|
|
|
|
|
+ // label: {
|
|
|
|
|
+ // show: true,
|
|
|
|
|
+ // fontSize: 20,
|
|
|
|
|
+ // fontWeight: 'bold',
|
|
|
|
|
+ // },
|
|
|
|
|
+ // itemStyle: {
|
|
|
|
|
+ // shadowBlur: 10,
|
|
|
|
|
+ // shadowOffsetX: 0,
|
|
|
|
|
+ // shadowColor: 'rgba(0, 0, 0, 0.5)',
|
|
|
|
|
+ // },
|
|
|
|
|
+ // },
|
|
|
|
|
+ // },
|
|
|
|
|
+ // ],
|
|
|
|
|
+ // };
|
|
|
|
|
+ // });
|
|
|
|
|
+
|
|
|
const option = computed(() => {
|
|
const option = computed(() => {
|
|
|
return {
|
|
return {
|
|
|
|
|
+ title: {
|
|
|
|
|
+ text: '算法占比', // 设置标题文本
|
|
|
|
|
+ left: '25%', // 标题居中对齐
|
|
|
|
|
+ top: 'center',
|
|
|
|
|
+ textStyle: {
|
|
|
|
|
+ fontSize: 20,
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
tooltip: {
|
|
tooltip: {
|
|
|
trigger: 'item',
|
|
trigger: 'item',
|
|
|
- formatter: '{a} <br/>{b} : {c} ({d}%)',
|
|
|
|
|
},
|
|
},
|
|
|
- legend: {
|
|
|
|
|
- orient: 'horizontial',
|
|
|
|
|
- x: 'center',
|
|
|
|
|
- y: 'bottom',
|
|
|
|
|
- icon: 'circle',
|
|
|
|
|
- width: '80%',
|
|
|
|
|
- height: '28%',
|
|
|
|
|
- type: 'scroll',
|
|
|
|
|
- data: algoData.value.map((item) => item.name),
|
|
|
|
|
- formatter: function (name) {
|
|
|
|
|
- let total = 0;
|
|
|
|
|
- let target;
|
|
|
|
|
- for (let i = 0; i < algoData.value.length; i++) {
|
|
|
|
|
- total += algoData.value[i].value;
|
|
|
|
|
- if (algoData.value[i].name === name) {
|
|
|
|
|
- target = algoData.value[i].value;
|
|
|
|
|
|
|
+ grid: {
|
|
|
|
|
+ left: '10px',
|
|
|
|
|
+ right: '4%',
|
|
|
|
|
+ bottom: '3%',
|
|
|
|
|
+ },
|
|
|
|
|
+ legend: [
|
|
|
|
|
+ {
|
|
|
|
|
+ icon: 'circle',
|
|
|
|
|
+ orient: 'vertical',
|
|
|
|
|
+ type: 'scroll',
|
|
|
|
|
+ left: '65%',
|
|
|
|
|
+ top: 'center',
|
|
|
|
|
+ itemWidth: 10,
|
|
|
|
|
+ itemHeight: 10,
|
|
|
|
|
+ align: 'left',
|
|
|
|
|
+ textStyle: {
|
|
|
|
|
+ fontSize: 14,
|
|
|
|
|
+ color: '#6e69b2',
|
|
|
|
|
+ },
|
|
|
|
|
+ data: algoLegendData.value,
|
|
|
|
|
+ formatter: function (name) {
|
|
|
|
|
+ if (algoData.value && algoData.value.length) {
|
|
|
|
|
+ for (var i = 0; i < algoData.value.length; i++) {
|
|
|
|
|
+ if (name === algoData.value[i].name) {
|
|
|
|
|
+ return (
|
|
|
|
|
+ '' + name + ' | ' + ' ' + (algoData.value[i].value * 100).toFixed(2) + '%'
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- var arr = [
|
|
|
|
|
- '{a|' + name + '}',
|
|
|
|
|
- '{b|' + ' | ' + ((target / total) * 100).toFixed(0) + '%}\n',
|
|
|
|
|
- ];
|
|
|
|
|
- return arr.join(' ');
|
|
|
|
|
- },
|
|
|
|
|
- textStyle: {
|
|
|
|
|
- padding: [8, 0, 0, 0],
|
|
|
|
|
- fontSize: 14,
|
|
|
|
|
- rich: {
|
|
|
|
|
- a: {
|
|
|
|
|
- fontSize: 15,
|
|
|
|
|
- },
|
|
|
|
|
- b: {
|
|
|
|
|
- fontSize: 15,
|
|
|
|
|
- color: '#c1c1c1',
|
|
|
|
|
- },
|
|
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
- },
|
|
|
|
|
|
|
+ ],
|
|
|
|
|
+
|
|
|
series: [
|
|
series: [
|
|
|
{
|
|
{
|
|
|
- name: '违规统计',
|
|
|
|
|
|
|
+ // name: 'Access From',
|
|
|
|
|
+ center: ['30%', '50%'],
|
|
|
type: 'pie',
|
|
type: 'pie',
|
|
|
- radius: ['40%', '65%'],
|
|
|
|
|
- center: ['50%', '40%'],
|
|
|
|
|
- labelLine: {
|
|
|
|
|
- show: false,
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
|
|
+ radius: ['50%', '70%'],
|
|
|
|
|
+ avoidLabelOverlap: false,
|
|
|
label: {
|
|
label: {
|
|
|
show: false,
|
|
show: false,
|
|
|
- position: 'center',
|
|
|
|
|
- },
|
|
|
|
|
- data: algoData.value,
|
|
|
|
|
- itemStyle: {
|
|
|
|
|
- borderColor: '#fff',
|
|
|
|
|
- borderWidth: 5,
|
|
|
|
|
|
|
+ // position: 'center',
|
|
|
},
|
|
},
|
|
|
|
|
+
|
|
|
emphasis: {
|
|
emphasis: {
|
|
|
label: {
|
|
label: {
|
|
|
show: true,
|
|
show: true,
|
|
|
fontSize: 20,
|
|
fontSize: 20,
|
|
|
fontWeight: 'bold',
|
|
fontWeight: 'bold',
|
|
|
|
|
+ formatter: '{b}: {c}',
|
|
|
},
|
|
},
|
|
|
itemStyle: {
|
|
itemStyle: {
|
|
|
shadowBlur: 10,
|
|
shadowBlur: 10,
|
|
@@ -152,6 +237,10 @@
|
|
|
shadowColor: 'rgba(0, 0, 0, 0.5)',
|
|
shadowColor: 'rgba(0, 0, 0, 0.5)',
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
|
|
+ labelLine: {
|
|
|
|
|
+ show: false,
|
|
|
|
|
+ },
|
|
|
|
|
+ data: algoData.value,
|
|
|
},
|
|
},
|
|
|
],
|
|
],
|
|
|
};
|
|
};
|
|
@@ -166,39 +255,79 @@
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
<style scoped>
|
|
|
- .algo-data {
|
|
|
|
|
|
|
+ /* .algo-data {
|
|
|
width: 484px;
|
|
width: 484px;
|
|
|
padding: 12px 27px;
|
|
padding: 12px 27px;
|
|
|
border-left: 2px solid #e8e8e8;
|
|
border-left: 2px solid #e8e8e8;
|
|
|
display: flex;
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
|
align-items: flex-start;
|
|
align-items: flex-start;
|
|
|
|
|
+ } */
|
|
|
|
|
+
|
|
|
|
|
+ .algo-header {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ justify-content: space-between;
|
|
|
|
|
+ margin-bottom: 10px;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.chart {
|
|
.chart {
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
- height: 450px;
|
|
|
|
|
|
|
+ flex-grow: 1;
|
|
|
|
|
+ height: 340px;
|
|
|
|
|
+ }
|
|
|
|
|
+ .el-divider--horizontal {
|
|
|
|
|
+ margin: 0px;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.algo-tit {
|
|
.algo-tit {
|
|
|
- font-size: 16px;
|
|
|
|
|
|
|
+ /* font-size: 16px;
|
|
|
font-weight: 500;
|
|
font-weight: 500;
|
|
|
margin-bottom: 10px;
|
|
margin-bottom: 10px;
|
|
|
line-height: 44px;
|
|
line-height: 44px;
|
|
|
- color: #2e2e2e;
|
|
|
|
|
|
|
+ color: #2e2e2e; */
|
|
|
|
|
+ font-size: 16px;
|
|
|
|
|
+ margin-top: 17px;
|
|
|
|
|
+ margin-left: 18px;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.stat-show {
|
|
.stat-show {
|
|
|
- width: 100%;
|
|
|
|
|
- margin-top: 32px;
|
|
|
|
|
|
|
+ flex-grow: 0;
|
|
|
|
|
+ width: 266px;
|
|
|
|
|
+ flex-shrink: 0;
|
|
|
|
|
+ font-size: 14px;
|
|
|
display: flex;
|
|
display: flex;
|
|
|
- justify-content: space-between;
|
|
|
|
|
- align-items: center;
|
|
|
|
|
|
|
+ flex-wrap: wrap;
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ padding: 0;
|
|
|
|
|
+ margin-top: 72px;
|
|
|
|
|
+ margin-bottom: 82px;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .stat-data {
|
|
|
|
|
+ flex-basis: calc(50% - 1px);
|
|
|
|
|
+ padding-bottom: 35px;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.stat-divider {
|
|
.stat-divider {
|
|
|
width: 1px;
|
|
width: 1px;
|
|
|
height: 40px;
|
|
height: 40px;
|
|
|
background: #e9e9e9;
|
|
background: #e9e9e9;
|
|
|
|
|
+ /* margin-left: 29px;
|
|
|
|
|
+ margin-right: 27px; */
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .el-divider--vertical {
|
|
|
|
|
+ margin: 0px;
|
|
|
|
|
+ height: 339px;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /* 控制图例的样式 */
|
|
|
|
|
+ ::v-deep .echarts-legend {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex-wrap: wrap; /* 图例换行 */
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ ::v-deep .echarts-legend-item {
|
|
|
|
|
+ flex: 0 0 50%; /* 每行显示两个图例 */
|
|
|
}
|
|
}
|
|
|
</style>
|
|
</style>
|