Files
admin-sjzx/src/views/pqs/qualityInspeection/panorama/components/details/stand.vue

364 lines
12 KiB
Vue
Raw Normal View History

2024-04-26 09:15:20 +08:00
<template>
<!-- 变电站 -->
2024-05-09 18:00:04 +08:00
<el-dialog draggable title="变电站统计" v-model="dialogVisible" width="1400px" :before-close="handleClose">
2024-04-26 09:15:20 +08:00
<el-row style="height: 300px" :gutter="20">
<el-col :span="12">
<div class="title">
<span>趋势分析</span>
<el-select v-model="time" style="width: 80px; margin-right: 80px" @change="analysis">
<el-option label="年" value="1" />
<el-option label="月" value="3" />
</el-select>
</div>
<MyEChart style="height: 260px" :options="trendEChart" />
</el-col>
<el-col :span="12">
<div class="title">
2024-04-29 16:37:07 +08:00
<span>
污染告警
2024-05-23 17:30:16 +08:00
<el-popover placement="right" :width="170" trigger="hover">
2024-04-29 16:37:07 +08:00
<template #reference>
<WarningFilled class="WarningFilled" />
</template>
<div class="text">
2024-05-23 17:30:16 +08:00
<span style="color: #00b07d">无污染(0 , 1]</span>
2024-04-29 16:37:07 +08:00
<br />
2024-05-23 17:30:16 +08:00
<span style="color: #3399ff">轻微污染(1 , 1.2]</span>
2024-04-29 16:37:07 +08:00
<br />
2024-05-23 17:30:16 +08:00
<span style="color: #ffcc33">轻度污染(1.2 , 1.6]</span>
2024-04-29 16:37:07 +08:00
<br />
2024-05-23 17:30:16 +08:00
<span style="color: #ff9900">中度污染(1.6 , 2]</span>
2024-04-29 16:37:07 +08:00
<br />
2024-05-23 17:30:16 +08:00
<span style="color: #cc0000">重度污染(2 , +)</span>
2024-04-29 16:37:07 +08:00
</div>
</el-popover>
</span>
<el-select v-model="contaminate" style="width: 120px; margin-right: 80px" @change="contaminateC">
<el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
2024-04-26 09:15:20 +08:00
</div>
2024-04-29 16:37:07 +08:00
2024-04-26 09:15:20 +08:00
<div class="pie">
2024-05-09 18:00:04 +08:00
<MyEChart
v-for="(item, i) in picEChart"
:style="i == 3 ? `margin-left: 20%;` : ``"
class="MyEChart"
:options="item"
/>
2024-04-26 09:15:20 +08:00
</div>
</el-col>
</el-row>
<div>
2024-04-29 16:37:07 +08:00
<div class="title mb10">
2024-05-09 18:00:04 +08:00
<span>区域变电站统计</span>
2024-04-26 09:15:20 +08:00
</div>
2024-05-14 18:28:27 +08:00
<vxe-table v-bind="defaultAttribute" ref="vxeRef" height="320px" :data="tableData">
2024-05-09 18:00:04 +08:00
<vxe-column field="name" title="区域" />
2024-04-29 18:30:32 +08:00
<vxe-column field="num" title="变电站总数" />
<vxe-column field="num1" title="无污染数量" :formatter="formatter" />
<vxe-column field="num2" title="轻微污染数量" :formatter="formatter" />
<vxe-column field="num3" title="轻度污染数量" :formatter="formatter" />
<vxe-column field="num4" title="中度污染数量" :formatter="formatter" />
<vxe-column field="num5" title="重度污染数量" :formatter="formatter" />
2024-04-26 09:15:20 +08:00
</vxe-table>
</div>
</el-dialog>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import MyEChart from '@/components/echarts/MyEchart.vue'
import { useDictData } from '@/stores/dictData'
import { defaultAttribute } from '@/components/table/defaultAttribute'
2024-04-29 16:37:07 +08:00
import { WarningFilled } from '@element-plus/icons-vue'
2024-04-29 18:30:32 +08:00
import { getPollutionAlarmList, getPollutionAlarmData, getGridDiagramSubTendency } from '@/api/device-boot/panorama'
2024-04-26 09:15:20 +08:00
const dictData = useDictData()
const dialogVisible: any = ref(false)
const time = ref('1')
const Voltage = dictData.getBasicData('Dev_Voltage_Stand')
2024-04-29 16:37:07 +08:00
const options: any = dictData.getBasicData('Pollution_Statis').filter(item => {
if (item.code == 'V_Harmonic' || item.code == 'I_All') {
return item
}
})
const contaminate = ref(options[0].id)
2024-04-26 09:15:20 +08:00
const rowList: any = ref({})
const trendEChart: any = ref({})
const tableData: any = ref([])
const picEChart: any = ref([{}, {}, {}, {}, {}])
const open = async (row: any) => {
rowList.value = {
deviceInfoParam: {
...row
},
pageNum: 1,
pageSize: 1000,
...row
}
analysis(1)
// 污染
2024-04-29 16:37:07 +08:00
contaminateC()
// 列表
dialogVisible.value = true
}
const contaminateC = () => {
2024-05-09 18:00:04 +08:00
// rowList.value.deviceInfoParam.ids=[contaminate.value]
2024-04-29 16:37:07 +08:00
getPollutionAlarmData({ ...rowList.value, ids: [contaminate.value] }).then(res => {
2024-04-26 09:15:20 +08:00
let data = []
let a1 = 0
let a2 = 0
let a3 = 0
let a4 = 0
let a5 = 0
2024-04-29 16:37:07 +08:00
if (rowList.value.isUpToGrid == 0) {
2024-04-26 09:15:20 +08:00
data = res.data.info
} else {
data = res.data.gwInfo
}
for (let i = 0; i < data.length; i++) {
2024-05-23 17:30:16 +08:00
if (data[i] >= 2) {
2024-05-27 10:37:50 +08:00
++a5
2024-05-23 17:30:16 +08:00
} else if (data[i] >= 1.6 && data[i] < 2) {
2024-05-27 10:37:50 +08:00
++a4
2024-05-23 17:30:16 +08:00
} else if (data[i] >= 1.2 && data[i] < 1.6) {
2024-05-27 10:37:50 +08:00
++a3
2024-05-23 17:30:16 +08:00
} else if (data[i] >= 1 && data[i] < 1.2) {
2024-05-27 10:37:50 +08:00
++a2
2024-05-23 17:30:16 +08:00
} else if (data[i] >= 0 && data[i] < 1) {
2024-05-27 10:37:50 +08:00
++a1
2024-04-26 09:15:20 +08:00
}
}
2024-05-16 14:56:04 +08:00
// console.log('🚀 ~ getPollutionAlarmData ~ a1 / data.length:', a1 / data.length)
2024-04-26 09:15:20 +08:00
let list = [
{
2024-04-30 11:18:41 +08:00
value: ((a1 / data.length || 0) * 100).toFixed(2),
2024-04-26 09:15:20 +08:00
name: `无污染:${a1}`
},
{
2024-04-30 11:18:41 +08:00
value: ((a2 / data.length || 0) * 100).toFixed(2),
2024-04-26 09:15:20 +08:00
name: `轻微污染::${a2}`
},
{
2024-04-30 11:18:41 +08:00
value: ((a3 / data.length || 0) * 100).toFixed(2),
2024-04-26 09:15:20 +08:00
name: `轻度污染:${a3}`
},
{
2024-04-30 11:18:41 +08:00
value: ((a4 / data.length || 0) * 100).toFixed(2),
2024-04-26 09:15:20 +08:00
name: `中度污染:${a4}`
},
{
2024-04-30 11:18:41 +08:00
value: ((a5 / data.length || 0) * 100).toFixed(2),
2024-04-26 09:15:20 +08:00
name: `重度污染:${a5}`
}
]
2024-04-29 16:37:07 +08:00
const color = ['#00B07D', '#3399ff', '#ffcc33', '#ff9900', '#cc0000']
2024-04-26 09:15:20 +08:00
list.forEach((item, i) => {
picEChart.value[i] = {
legend: {
type: 'scroll',
orient: 'vertical',
left: 10,
top: '10%'
},
xAxis: {
show: false
},
yAxis: {
show: false
},
options: {
dataZoom: null,
series: [
{
type: 'gauge',
startAngle: 180,
center: ['50%', '80%'],
radius: '135%',
endAngle: 0,
min: 0,
max: 100,
progress: {
show: true,
width: 15,
itemStyle: {
color: color[i]
}
},
pointer: {
show: false
},
axisLine: {
lineStyle: {
width: 15,
color: [[1, '#f4f4f4']]
}
},
axisTick: {
show: false
},
splitLine: {
show: false
},
axisLabel: {
2024-05-09 18:00:04 +08:00
show: false
// distance: 5,
// color: '#666',
// fontSize: 12,
// formatter: function (value: any) {
// if (value === 0 || value === 100) {
// return value + '%'
// }
// }
2024-04-26 09:15:20 +08:00
},
anchor: {
show: false,
showAbove: false,
size: 25,
itemStyle: {
borderWidth: 60
}
},
title: {
show: true,
offsetCenter: [0, '20%'],
fontSize: 14
},
detail: {
valueAnimation: true,
fontSize: 14,
lineHeight: 20,
color: color[i],
fontWeight: 'bold',
offsetCenter: [0, '-20%'],
formatter: function (value: any) {
return '{a|占比} ' + '\n' + value + '{a|%}'
},
rich: {
a: {
color: '#333',
fontSize: 16,
lineHeight: 30
}
}
},
data: [item]
}
]
}
}
})
})
2024-05-09 18:00:04 +08:00
getPollutionAlarmList({ ...rowList.value, ids: [contaminate.value] }).then(res => {
tableData.value = res.data.map((item: any) => {
return {
name: item[0],
num: item[1],
num1: item[2],
num2: item[3],
num3: item[4],
num4: item[5],
2024-05-27 10:37:50 +08:00
num5: item[6]
2024-05-09 18:00:04 +08:00
}
})
})
2024-04-26 09:15:20 +08:00
}
const analysis = (e: any) => {
2024-04-29 16:37:07 +08:00
let time = rowList.value.searchBeginTime?.slice(0, 4) + `-01-01`
2024-04-26 09:15:20 +08:00
// 分析
getGridDiagramSubTendency({ ...rowList.value, searchBeginTime: time, type: e }).then(res => {
let name = []
let data = []
for (let k in res.data) {
name.push(k)
data.push(res.data[k])
}
trendEChart.value = {
title: {
text: '变电站接入数量'
},
xAxis: {
name: '时间',
data: name
},
legend: {
show: false
},
yAxis: {
name: '座'
},
options: {
dataZoom: null,
series: [
{
name: '接入',
type: 'line',
data: data,
smooth: true,
label: {
show: true,
position: 'top',
fontSize: 12
}
}
]
}
}
})
}
const formatter = (row: any) => {
if (row.column.field == 'dataV') {
2024-04-29 16:37:07 +08:00
return row.cellValue == 3.14159 ? '/' : row.cellValue
2024-04-26 09:15:20 +08:00
} else if (row.column.field == 'data') {
2024-04-29 16:37:07 +08:00
return row.cellValue == 3.14159 ? '/' : row.cellValue
2024-04-26 09:15:20 +08:00
} else if (row.column.field == 'voltageLevel') {
return Voltage.filter((item: any) => item.id == row.cellValue)[0]?.name
} else {
return row.cellValue
}
}
const handleClose = () => {
tableData.value = []
dialogVisible.value = false
}
defineExpose({ open })
</script>
<style lang="scss" scoped>
:deep(.el-select) {
min-width: 80px;
}
.title {
display: flex;
justify-content: space-between;
2024-04-29 16:37:07 +08:00
position: relative;
2024-04-26 09:15:20 +08:00
span {
font-weight: 550;
font-size: 18px;
}
2024-04-29 16:37:07 +08:00
.WarningFilled {
width: 16px;
cursor: pointer;
}
2024-04-26 09:15:20 +08:00
}
.pie {
display: flex;
flex-wrap: wrap;
.MyEChart {
height: 130px;
width: 30%;
margin-right: 3%;
}
}
2024-05-27 10:37:50 +08:00
:deep(.el-dialog__body) {
max-height: none !important;
}
2024-04-26 09:15:20 +08:00
</style>