暂降方向统计页面联调
This commit is contained in:
@@ -1,14 +1,24 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<!--暂降方向统计 -->
|
<!--暂降方向统计 -->
|
||||||
<TableHeader ref="TableHeaderRef" :showReset="false" @selectChange="selectChange" datePicker v-if="fullscreen"></TableHeader>
|
<TableHeader
|
||||||
<my-echart class="tall" :options="echartList" :style="{ width: prop.width, height: `calc(${prop.height} )` }" />
|
ref="TableHeaderRef"
|
||||||
|
:showReset="false"
|
||||||
|
@selectChange="selectChange"
|
||||||
|
datePicker
|
||||||
|
v-if="fullscreen"
|
||||||
|
></TableHeader>
|
||||||
|
<my-echart
|
||||||
|
v-loading="tableStore.table.loading"
|
||||||
|
class="tall"
|
||||||
|
:options="echartList"
|
||||||
|
:style="{ width: prop.width, height: `calc(${prop.height} )` }"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, provide, reactive, watch, h } from 'vue'
|
import { ref, onMounted, provide, reactive, watch, h } from 'vue'
|
||||||
import TableStore from '@/utils/tableStore'
|
import TableStore from '@/utils/tableStore'
|
||||||
import Table from '@/components/table/index.vue'
|
|
||||||
import MyEchart from '@/components/echarts/MyEchart.vue'
|
import MyEchart from '@/components/echarts/MyEchart.vue'
|
||||||
import TableHeader from '@/components/table/header/index.vue'
|
import TableHeader from '@/components/table/header/index.vue'
|
||||||
import { getTime } from '@/utils/formatTime'
|
import { getTime } from '@/utils/formatTime'
|
||||||
@@ -49,84 +59,99 @@ const fullscreen = computed(() => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const data = [
|
const echartList = ref({})
|
||||||
{
|
|
||||||
name: '来自电网',
|
|
||||||
value: 4
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '来自负荷',
|
|
||||||
value: 41
|
|
||||||
}
|
|
||||||
]
|
|
||||||
const echartList = ref({
|
|
||||||
title: {},
|
|
||||||
|
|
||||||
tooltip: {
|
// const data = [
|
||||||
trigger: 'item'
|
// {
|
||||||
},
|
// name: '来自电网',
|
||||||
legend: {
|
// value: 4
|
||||||
orient: 'vertical',
|
// },
|
||||||
top: 'center',
|
// {
|
||||||
right: '5%',
|
// name: '来自负荷',
|
||||||
formatter: function (e: any) {
|
// value: 41
|
||||||
return e + ' ' + data.filter(item => item.name == e)[0].value + '次'
|
// }
|
||||||
}
|
// ]
|
||||||
},
|
|
||||||
xAxis: {
|
|
||||||
show: false
|
|
||||||
},
|
|
||||||
yAxis: {
|
|
||||||
show: false
|
|
||||||
},
|
|
||||||
grid: {
|
|
||||||
left: '10px',
|
|
||||||
right: '20px'
|
|
||||||
},
|
|
||||||
|
|
||||||
options: {
|
|
||||||
dataZoom: null,
|
|
||||||
title: [
|
|
||||||
{
|
|
||||||
text: '暂降方向统计',
|
|
||||||
left: 'center'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: data[0].value + data[1].value + '次',
|
|
||||||
left: 'center',
|
|
||||||
top: 'center'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
series: [
|
|
||||||
{
|
|
||||||
type: 'pie',
|
|
||||||
center: 'center',
|
|
||||||
radius: ['55%', '75%'],
|
|
||||||
label: {
|
|
||||||
show: false,
|
|
||||||
position: 'outside',
|
|
||||||
textStyle: {
|
|
||||||
//数值样式
|
|
||||||
}
|
|
||||||
},
|
|
||||||
name: '事件统计',
|
|
||||||
data: data
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
})
|
|
||||||
const OverLimitDetailsRef = ref()
|
const OverLimitDetailsRef = ref()
|
||||||
const tableStore: any = new TableStore({
|
const tableStore: any = new TableStore({
|
||||||
url: '/user-boot/dept/deptTree',
|
url: '/cs-harmonic-boot/csevent/getEventDirectionData',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|
||||||
showPage: false,
|
showPage: false,
|
||||||
|
|
||||||
column: [],
|
column: [],
|
||||||
beforeSearchFun: () => {
|
beforeSearchFun: () => {
|
||||||
setTime()
|
setTime()
|
||||||
},
|
},
|
||||||
loadCallback: () => {}
|
loadCallback: () => {
|
||||||
|
if (!tableStore.table.data || !Array.isArray(tableStore.table.data)) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
const chartData = ref(
|
||||||
|
tableStore.table.data.map((item: any) => ({
|
||||||
|
name: item.source === 'load' ? '来自负荷' : '来自电网',
|
||||||
|
value: item.times
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
|
||||||
|
const total = chartData.value.reduce((sum: any, item: any) => sum + item.value, 0)
|
||||||
|
|
||||||
|
echartList.value = {
|
||||||
|
title: {},
|
||||||
|
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'item'
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
orient: 'vertical',
|
||||||
|
top: 'center',
|
||||||
|
right: '5%',
|
||||||
|
formatter: function (name: string) {
|
||||||
|
const item = chartData.value.find((i: any) => i.name === name)
|
||||||
|
return item ? `${name} ${item.value}次` : name
|
||||||
|
}
|
||||||
|
},
|
||||||
|
xAxis: {
|
||||||
|
show: false
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
show: false
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
left: '10px',
|
||||||
|
right: '20px'
|
||||||
|
},
|
||||||
|
|
||||||
|
options: {
|
||||||
|
dataZoom: null,
|
||||||
|
title: [
|
||||||
|
{
|
||||||
|
text: '暂降方向统计',
|
||||||
|
left: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: total + '次',
|
||||||
|
left: 'center',
|
||||||
|
top: 'center'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
type: 'pie',
|
||||||
|
center: 'center',
|
||||||
|
radius: ['55%', '75%'],
|
||||||
|
label: {
|
||||||
|
show: false,
|
||||||
|
position: 'outside',
|
||||||
|
textStyle: {
|
||||||
|
//数值样式
|
||||||
|
}
|
||||||
|
},
|
||||||
|
name: '事件统计',
|
||||||
|
data: chartData.value
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const tableRef = ref()
|
const tableRef = ref()
|
||||||
@@ -156,7 +181,6 @@ const setTime = () => {
|
|||||||
// 点击行
|
// 点击行
|
||||||
const cellClickEvent = ({ row, column }: any) => {
|
const cellClickEvent = ({ row, column }: any) => {
|
||||||
if (column.field != 'name') {
|
if (column.field != 'name') {
|
||||||
console.log(row)
|
|
||||||
OverLimitDetailsRef.value.open(row)
|
OverLimitDetailsRef.value.open(row)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -173,12 +197,7 @@ watch(
|
|||||||
watch(
|
watch(
|
||||||
() => prop.timeValue,
|
() => prop.timeValue,
|
||||||
(newVal, oldVal) => {
|
(newVal, oldVal) => {
|
||||||
// 当外部时间值变化时,更新表格的时间参数
|
tableStore.index()
|
||||||
if (newVal && (!oldVal || newVal[0] !== oldVal[0] || newVal[1] !== oldVal[1])) {
|
|
||||||
tableStore.table.params.searchBeginTime = newVal[0]
|
|
||||||
tableStore.table.params.searchEndTime = newVal[1]
|
|
||||||
tableStore.index()
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
deep: true
|
deep: true
|
||||||
|
|||||||
Reference in New Issue
Block a user