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

285 lines
11 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">
2024-04-26 09:15:20 +08:00
<div>
<vxe-table v-bind="defaultAttribute" ref="vxeRef" height="300px" :data="tableData">
2024-05-09 18:00:04 +08:00
<vxe-column field="deptName" title="地市" />
<vxe-column field="assessLevel" title="综合评估结论">
<template #default="scope">
2024-06-05 17:01:09 +08:00
<!-- class="conclusion"
:class="
scope.row.assessLevel == '特质'
? 'background1'
: scope.row.assessLevel == '较差'
? 'background2'
: scope.row.assessLevel == '极差'
? 'background3'
: ''
2024-06-05 17:01:09 +08:00
" -->
<span
>
2024-06-05 17:01:09 +08:00
{{ scope.row.assessData }}
</span>
</template>
</vxe-column>
<vxe-column field="qualifyData" title="指标合格率(%)" />
2024-05-27 10:37:50 +08:00
2024-06-05 17:01:09 +08:00
<!-- <vxe-colgroup title="评估结论">
2024-06-04 18:06:17 +08:00
<vxe-column field="vdevAssessLevel" title="电压偏差">
<template #default="scope">
<span
class="conclusion"
:class="
scope.row.vdevAssessLevel == '特质'
? 'background1'
: scope.row.vdevAssessLevel == '较差'
? 'background2'
: scope.row.vdevAssessLevel == '极差'
? 'background3'
: ''
"
>
{{ scope.row.vdevAssessLevel }}
</span>
</template>
</vxe-column>
2024-06-04 18:06:17 +08:00
<vxe-column field="freqAssessLevel" title="频率偏差">
<template #default="scope">
<span
class="conclusion"
:class="
scope.row.freqAssessLevel == '特质'
? 'background1'
: scope.row.freqAssessLevel == '较差'
? 'background2'
: scope.row.freqAssessLevel == '极差'
? 'background3'
: ''
"
>
{{ scope.row.freqAssessLevel }}
</span>
</template>
</vxe-column>
2024-06-04 18:06:17 +08:00
<vxe-column field="harmAssessLevel" title="电压总谐波畸变率">
<template #default="scope">
<span
class="conclusion"
:class="
scope.row.harmAssessLevel == '特质'
? 'background1'
: scope.row.harmAssessLevel == '较差'
? 'background2'
: scope.row.harmAssessLevel == '极差'
? 'background3'
: ''
"
>
{{ scope.row.harmAssessLevel }}
</span>
</template>
</vxe-column>
2024-06-04 18:06:17 +08:00
<vxe-column field="flickerAssessLevel" title="电压闪变">
<template #default="scope">
<span
class="conclusion"
:class="
scope.row.flickerAssessLevel == '特质'
? 'background1'
: scope.row.flickerAssessLevel == '较差'
? 'background2'
: scope.row.flickerAssessLevel == '极差'
? 'background3'
: ''
"
>
{{ scope.row.flickerAssessLevel }}
</span>
</template>
</vxe-column>
2024-06-04 18:06:17 +08:00
<vxe-column field="unbalanceAssessLevel" title="三相电压不平衡度">
<template #default="scope">
<span
class="conclusion"
:class="
scope.row.unbalanceAssessLevel == '特质'
? 'background1'
: scope.row.unbalanceAssessLevel == '较差'
? 'background2'
: scope.row.unbalanceAssessLevel == '极差'
? 'background3'
: ''
"
>
{{ scope.row.unbalanceAssessLevel }}
</span>
</template>
</vxe-column>
2024-06-05 17:01:09 +08:00
</vxe-colgroup> -->
2024-04-26 09:15:20 +08:00
</vxe-table>
</div>
<div style="height: 300px; margin-top: 10px; position: relative" v-loading="loading">
<el-select
v-model="time"
size="small"
style="width: 50px; position: absolute; top: 20px; right: 20px; z-index: 1"
@change="analysis"
>
<el-option label="年" value="1" />
<el-option label="月" value="3" />
</el-select>
2024-04-26 09:15:20 +08:00
<MyEChart style="height: 300px" :options="picEChart" />
</div>
</el-dialog>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import MyEChart from '@/components/echarts/MyEchart.vue'
import { defaultAttribute } from '@/components/table/defaultAttribute'
2024-04-29 16:37:07 +08:00
import { getAssessDetail, getAssessTrend } from '@/api/device-boot/panorama'
2024-04-26 09:15:20 +08:00
const dialogVisible: any = ref(false)
const rowList: any = ref({})
const time = ref('1')
const loading = ref(false)
2024-04-27 22:18:58 +08:00
const tableData: any = ref([])
const picEChart = ref()
const open = async (row: any) => {
getAssessDetail(row).then(res => {
tableData.value = res.data
2024-04-29 16:37:07 +08:00
})
rowList.value = row
analysis(1)
dialogVisible.value = true
}
const analysis = (e: any) => {
loading.value = true
let time = rowList.value.searchBeginTime.slice(0, 4) + `-01-01`
getAssessTrend({ ...rowList.value, searchBeginTime: time, type: e }).then(res => {
2024-04-27 22:18:58 +08:00
picEChart.value = {
title: {
2024-04-29 16:37:07 +08:00
text: '各地市综合评估趋势对比'
2024-04-27 22:18:58 +08:00
},
2024-06-05 17:01:09 +08:00
// tooltip: {
// formatter: function (params: any) {
// // console.log(123, params)
// var tips = ''
// for (var i = 0; i < params.length; i++) {
// console.log('🚀 ~ getAssessTrend ~ params[i].value:', params[i].value)
// tips +=
// params[i].seriesName +
// ':' +
// `<span style="color:${
// params[i].value > 4.5
// ? ''
// : params[i].value > 4
// ? ''
// : params[i].value > 3
// ? ''
// : params[i].value > 2
// ? '#97017e'
// : params[i].value > 0
// ? '#cc0000'
// : ''
// }">
// ${
// params[i].value > 4.5
// ? '优质'
// : params[i].value > 4
// ? '良好'
// : params[i].value > 3
// ? '一般'
// : params[i].value > 2
// ? '较差'
// : params[i].value > 0
// ? '极差'
// : ''
// }
// </span>` +
// '</br>'
// }
// return tips
// }
// },
2024-04-27 22:18:58 +08:00
xAxis: {
2024-05-09 18:00:04 +08:00
name: '时间',
data: res.data[0].children.map((item: any) => item.dataTime)
2024-04-27 22:18:58 +08:00
},
2024-04-29 16:37:07 +08:00
grid: {
bottom: '10px'
},
2024-04-27 22:18:58 +08:00
yAxis: {
2024-04-29 16:37:07 +08:00
name: ''
2024-04-27 22:18:58 +08:00
},
options: {
2024-04-29 16:37:07 +08:00
dataZoom: false,
series: []
2024-04-26 09:15:20 +08:00
}
2024-04-27 22:18:58 +08:00
}
2024-04-29 16:37:07 +08:00
let list: any = []
let time: any = []
2024-06-04 18:06:17 +08:00
let mun: any = []
2024-04-29 16:37:07 +08:00
res.data.forEach((item: any, num: any) => {
2024-05-09 18:00:04 +08:00
time.push(item.deptName)
list.push([])
2024-04-29 16:37:07 +08:00
item.children.forEach((val: any, i: any) => {
2024-06-04 18:06:17 +08:00
mun.push(val.score == 3.14159 ? null : val.score)
2024-05-09 18:00:04 +08:00
list[num].push(val.score == 3.14159 ? null : val.score)
2024-04-29 16:37:07 +08:00
})
})
2024-06-04 18:06:17 +08:00
2024-04-29 16:37:07 +08:00
list.forEach((item: any, i: any) => {
picEChart.value.options.series.push({
name: time[i],
type: 'line',
data: item
})
})
2024-06-04 18:06:17 +08:00
picEChart.value.yAxis.min = Math.min(...mun) < 1 ? 0 : (Math.min(...mun) - 0.5).toFixed(2)
picEChart.value.yAxis.max = Math.max(...mun) > 4.5 ? 5 : (Math.max(...mun) + 0.5).toFixed(2)
loading.value = false
2024-04-27 22:18:58 +08:00
})
}
2024-04-26 09:15:20 +08:00
defineExpose({ open })
</script>
2024-05-27 10:37:50 +08:00
<style lang="scss" scoped>
:deep(.el-dialog__body) {
max-height: none !important;
}
.conclusion {
display: inline-block;
padding: 0 10px;
height: 24px;
line-height: 24px;
border-radius: 4px;
}
.background1 {
background-color: #339966;
color: #fff;
}
.background2 {
background-color: #97017e;
color: #fff;
}
.background3 {
background-color: #cc0000;
color: #fff;
}
:deep(.el-select) {
min-width: 80px !important;
}
2024-05-27 10:37:50 +08:00
</style>