提交更改版本

This commit is contained in:
zhujiyan
2024-07-22 10:35:01 +08:00
parent 33a41b9d7a
commit bccf61c6d1
31 changed files with 180231 additions and 443 deletions

View File

@@ -0,0 +1,18 @@
<template>
<div class="harmonic">
谐波频谱
</div>
</template>
<script lang="ts" setup>
import { ref, onMounted } from 'vue'
onMounted(() => {
console.log()
})
</script>
<style lang="scss" scoped>
.harmonic{
width:100%;
height:100%;
border: 2px solid green;
}
</style>

View File

@@ -0,0 +1,643 @@
<template>
<div class="realtrend">
<el-tabs type="border-card" v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="谐波电压含有率" name="0">
<template #label>
<span class="custom-tabs-label">
<el-icon><TrendCharts /></el-icon>
谐波电压含有率
</span>
</template>
<div class="tab_info">
<vxe-grid v-if="activeName == '0'" class="reverse-table" v-bind="gridOptions"></vxe-grid>
<div class="charts">
<MyEchart ref="barCharts1" :options="echartsData1"></MyEchart>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="间谐波电压含有率" name="1">
<template #label>
<span class="custom-tabs-label">
<el-icon><TrendCharts /></el-icon>
间谐波电压含有率
</span>
</template>
<div class="tab_info">
<vxe-grid v-if="activeName == '1'" class="reverse-table" v-bind="gridOptions"></vxe-grid>
<div class="charts">
<MyEchart ref="barCharts2" :options="echartsData2"></MyEchart>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="谐波电流幅值" name="2">
<template #label>
<span class="custom-tabs-label">
<el-icon><DataLine /></el-icon>
谐波电流幅值
</span>
</template>
<div class="tab_info">
<vxe-grid v-if="activeName == '2'" class="reverse-table" v-bind="gridOptions"></vxe-grid>
<div class="charts">
<MyEchart ref="barCharts3" :options="echartsData3"></MyEchart>
</div>
</div>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script lang="ts" setup>
import { ref, onMounted, reactive } from 'vue'
import { VxeGridProps, VxeGridPropTypes } from 'vxe-table'
import { defaultAttribute } from '@/components/table/defaultAttribute'
import MyEchart from '@/components/echarts/MyEchart.vue'
import { Platform, TrendCharts, DataLine } from '@element-plus/icons-vue'
const activeName = ref('0')
const tableList = [
{
name: '2次',
value: Math.floor(Math.random() * 101)
},
{
name: '3次',
value: Math.floor(Math.random() * 101)
},
{
name: '4次',
value: Math.floor(Math.random() * 101)
},
{
name: '5次',
value: Math.floor(Math.random() * 101)
},
{
name: '6次',
value: Math.floor(Math.random() * 101)
},
{
name: '7次',
value: Math.floor(Math.random() * 101)
},
{
name: '8次',
value: Math.floor(Math.random() * 101)
},
{
name: '9次',
value: Math.floor(Math.random() * 101)
},
{
name: '10次',
value: Math.floor(Math.random() * 101)
},
{
name: '11次',
value: Math.floor(Math.random() * 101)
},
{
name: '12次',
value: Math.floor(Math.random() * 101)
},
{
name: '13次',
value: Math.floor(Math.random() * 101)
},
{
name: '14次',
value: Math.floor(Math.random() * 101)
},
{
name: '15次',
value: Math.floor(Math.random() * 101)
},
{
name: '16次',
value: Math.floor(Math.random() * 101)
}
]
interface RowVO {
[key: string]: any
}
//谐波电压含有率
const gridOptions = ref<VxeGridProps<RowVO>>({
border: true,
showOverflow: true,
showHeader: false,
columns: [],
data: [],
columnConfig: {
resizable: true
},
align: 'center'
})
gridOptions.value = { ...defaultAttribute, ...gridOptions.value }
const myColumns = ref([
{ field: 'name', title: '次数' },
{ field: 'value', title: '谐波电压含有率(%)' }
])
const yAxisUnit: any = ref('')
myColumns.value.map(item => {
if (item.field == 'value') {
item.title =
activeName.value == '0'
? '谐波电压含有率(%)'
: activeName.value == '1'
? '间谐波电压含有率(%)'
: activeName.value == '2'
? '谐波电流幅值(A)'
: ''
yAxisUnit.value = item.title.split('(')[0]
}
})
const myData = tableList
//反转表格
const reverseTable = () => {
const buildData = myColumns.value.map(column => {
const item: any = { col0: column.title }
myData.forEach((row, index) => {
item[`col${index + 1}`] = row[column.field]
})
return item
})
const buildColumns: VxeGridPropTypes.Columns = [
{
field: 'col0',
fixed: 'left',
width: 200
}
]
myData.forEach((item, index) => {
buildColumns.push({
field: `col${index + 1}`,
minWidth: 120
})
})
gridOptions.value.data = buildData
gridOptions.value.columns = buildColumns
}
reverseTable()
const echartsData1: any = ref([]),
echartsData2: any = ref([]),
echartsData3: any = ref([]),
barCharts1 = ref(),
barCharts2 = ref(),
barCharts3 = ref()
//加载echarts
const init = () => {
const xDataList: any = [],
yDataList1: any = [],
yDataList2: any = []
tableList.map((item: any) => {
xDataList.push(item.name)
yDataList1.push(item.value)
yDataList2.push(Math.floor(Math.random() * 101) + Math.floor(Math.random() * 101))
yDataList2.push(Math.floor(Math.random() * 101) + Math.floor(Math.random() * 101))
})
if (activeName.value == '0') {
echartsData1.value = {
options: {
// backgroundColor: '#0f375f',
grid: {
top: '22%',
bottom: '15%', //也可设置left和right设置距离来控制图表的大小
left: '3%',
right: '5%'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
show: false
}
}
},
legend: {
data: ['国标限值', yAxisUnit.value],
top: '2%',
right: '2%'
// icon: 'icon'
// icon: "circle", //icon 长方形 circle 圆形 arrow箭头型 diamond菱形
// itemWidth: 14,
// itemHeight: 14,
// textStyle: {
// inside: true,
// color: '#000',
// padding: [11, 0, 10, 0],
// align: 'left',
// verticalAlign: 'center',
// fontSize: 14,
// rich: {}
// }
},
xAxis: {
name: '次数',
data: xDataList,
axisLine: {
show: true, //隐藏X轴轴线
lineStyle: {
color: '#000'
}
},
axisTick: {
show: true //隐藏X轴刻度
},
axisPointer: {
type: 'shadow'
},
axisLabel: {
show: true,
textStyle: {
color: '#000' //X轴文字颜色
}
}
},
yAxis: [
{
type: 'value',
name: '单位(' + '%' + ')',
splitLine: {
show: false
},
axisTick: {
show: true
},
axisLine: {
show: true,
lineStyle: {
color: '#000'
}
}
}
],
series: [
{
name: '国标限值',
type: 'bar',
barMaxWidth: 24, //使用的 y 轴的 index在单个图表实例中存在多个 y轴的时候有用
itemStyle: {
// normal: {
barBorderRadius: [3, 3, 0, 0],
color: '#00CC99'
// }e
},
data: yDataList1
},
{
name: yAxisUnit.value,
type: 'bar',
barMaxWidth: 24,
itemStyle: {
// normal: {
barBorderRadius: [3, 3, 0, 0],
color: '#FF9900'
// }
},
data: yDataList2
}
]
}
}
barCharts1.value.initChart()
} else if (activeName.value == '1') {
echartsData2.value = {
options: {
// backgroundColor: '#0f375f',
grid: {
top: '22%',
bottom: '15%', //也可设置left和right设置距离来控制图表的大小
left: '3%',
right: '5%'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
show: false
}
}
},
legend: {
data: ['国标限值', yAxisUnit.value],
top: '2%',
right: '2%'
// icon: 'icon'
// icon: "circle", //icon 长方形 circle 圆形 arrow箭头型 diamond菱形
// itemWidth: 14,
// itemHeight: 14,
// textStyle: {
// inside: true,
// color: '#000',
// padding: [11, 0, 10, 0],
// align: 'left',
// verticalAlign: 'center',
// fontSize: 14,
// rich: {}
// }
},
xAxis: {
name: '次数',
data: xDataList,
axisLine: {
show: true, //隐藏X轴轴线
lineStyle: {
color: '#000'
}
},
axisTick: {
show: true //隐藏X轴刻度
},
axisPointer: {
type: 'shadow'
},
axisLabel: {
show: true,
textStyle: {
color: '#000' //X轴文字颜色
}
}
},
yAxis: [
{
type: 'value',
name: '单位(' + '%' + ')',
splitLine: {
show: false
},
axisTick: {
show: true
},
axisLine: {
show: true,
lineStyle: {
color: '#000'
}
}
}
],
series: [
{
name: '国标限值',
type: 'bar',
barMaxWidth: 24, //使用的 y 轴的 index在单个图表实例中存在多个 y轴的时候有用
itemStyle: {
// normal: {
barBorderRadius: [3, 3, 0, 0],
color: '#00CC99'
// }e
},
data: yDataList1
},
{
name: yAxisUnit.value,
type: 'bar',
barMaxWidth: 24,
itemStyle: {
// normal: {
barBorderRadius: [3, 3, 0, 0],
color: '#FF9900'
// }
},
data: yDataList2
}
]
}
}
barCharts2.value.initChart()
} else if (activeName.value == '2') {
echartsData3.value = {
options: {
// backgroundColor: '#0f375f',
grid: {
top: '22%',
bottom: '15%', //也可设置left和right设置距离来控制图表的大小
left: '3%',
right: '5%'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
show: false
}
}
},
legend: {
data: ['国标限值', yAxisUnit.value],
top: '2%',
right: '2%'
// icon: 'icon'
// icon: "circle", //icon 长方形 circle 圆形 arrow箭头型 diamond菱形
// itemWidth: 14,
// itemHeight: 14,
// textStyle: {
// inside: true,
// color: '#000',
// padding: [11, 0, 10, 0],
// align: 'left',
// verticalAlign: 'center',
// fontSize: 14,
// rich: {}
// }
},
xAxis: {
name: '次数',
data: xDataList,
axisLine: {
show: true, //隐藏X轴轴线
lineStyle: {
color: '#000'
}
},
axisTick: {
show: true //隐藏X轴刻度
},
axisPointer: {
type: 'shadow'
},
axisLabel: {
show: true,
textStyle: {
color: '#000' //X轴文字颜色
}
}
},
yAxis: [
{
type: 'value',
name: '单位(' + '%' + ')',
splitLine: {
show: false
},
axisTick: {
show: true
},
axisLine: {
show: true,
lineStyle: {
color: '#000'
}
}
}
],
series: [
{
name: '国标限值',
type: 'bar',
barMaxWidth: 24, //使用的 y 轴的 index在单个图表实例中存在多个 y轴的时候有用
itemStyle: {
// normal: {
barBorderRadius: [3, 3, 0, 0],
color: '#00CC99'
// }e
},
data: yDataList1
},
{
name: yAxisUnit.value,
type: 'bar',
barMaxWidth: 24,
itemStyle: {
// normal: {
barBorderRadius: [3, 3, 0, 0],
color: '#FF9900'
// }
},
data: yDataList2
}
]
}
}
barCharts3.value.initChart()
}
}
const handleClick = (tab: any, event: any) => {
activeName.value = tab.index
myColumns.value.map(item => {
if (item.field == 'value') {
item.title =
activeName.value == '0'
? '谐波电压含有率(%)'
: activeName.value == '1'
? '间谐波电压含有率(%)'
: activeName.value == '2'
? '谐波电流幅值(A)'
: ''
yAxisUnit.value = item.title.split('(')[0]
}
})
reverseTable()
init()
}
onMounted(() => {
init()
})
</script>
<style lang="scss" scoped>
.realtrend {
width: 100%;
height: 100%;
.table_info {
width: 100%;
height: auto;
overflow-x: auto;
.table {
width: auto;
height: auto;
border: 2px solid #eee;
display: flex;
flex-direction: column;
.thead {
width: 100%;
height: 40px;
display: flex;
border-bottom: 2px solid #eee;
.thead_left {
width: 200px !important;
height: 100%;
line-height: 40px;
text-align: center;
font-size: 14px;
font-weight: 800;
}
.thead_right {
flex: 1;
display: flex;
.thead_right_item {
flex: none;
width: 100px;
text-align: center;
line-height: 40px;
border-left: 1px solid #eee;
}
}
}
.tbody {
width: 100%;
height: 40px;
display: flex;
.tbody_left {
width: 200px !important;
height: 100%;
line-height: 40px;
text-align: center;
font-size: 14px;
font-weight: 800;
}
.tbody_right {
flex: 1;
display: flex;
.tbody_right_item {
flex: none;
width: 100px;
text-align: center;
line-height: 40px;
border-left: 1px solid #eee;
}
}
}
}
}
}
.reverse-table {
// max-height:120px !important;
}
.reverse-table .vxe-body--row .vxe-body--column:first-child {
background-color: #f8f8f9;
}
::v-deep .vxe-table--render-wrapper {
height: 90px !important;
max-height: 90px !important;
overflow-x: auto !important;
min-height: 0 !important;
}
::v-deep .body--wrapper {
height: 90px !important;
max-height: 90px !important;
min-height: 0 !important;
}
.tab_info {
width: 100%;
height: calc(100vh - 450px);
// overflow: auto;
// padding-bottom: 20px;
.charts {
width: 100%;
margin-top: 10px;
height: calc(100vh - 550px);
}
}
.custom-tabs-label {
display: flex;
align-items: center;
}
</style>

View File

@@ -0,0 +1,18 @@
<template>
<div class="record">
实时录波
</div>
</template>
<script lang="ts" setup>
import { ref, onMounted } from 'vue'
onMounted(() => {
console.log()
})
</script>
<style lang="scss" scoped>
.record{
width:100%;
height:100%;
border: 2px solid red;
}
</style>

View File

@@ -1,140 +1,62 @@
<template>
<div>
<vxe-table
border
show-footer
ref="tableRef"
v-bind="defaultAttribute"
height="70"
align="center"
stripe
:loading="loading"
:print-config="{}"
:column-config="{ resizable: false, width: 90 }"
:data="tableData"
style="width: 100%; margin-top: 10px"
>
<div v-if="tableIndex == 0">
<vxe-colgroup title="电压有效值(kV)">
<vxe-column field="a" title="AB相"></vxe-column>
<vxe-column field="b" title="BC相"></vxe-column>
<vxe-column field="c" title="CA相"></vxe-column>
</vxe-colgroup>
<vxe-colgroup title="电流有效值(A)">
<vxe-column field="a" title="A相"></vxe-column>
<vxe-column field="b" title="B相"></vxe-column>
<vxe-column field="c" title="C相"></vxe-column>
</vxe-colgroup>
<vxe-colgroup title="基波电压幅值(kV)">
<vxe-column field="a" title="A相"></vxe-column>
<vxe-column field="b" title="B相"></vxe-column>
<vxe-column field="c" title="C相"></vxe-column>
</vxe-colgroup>
<vxe-colgroup title="基波电压相位(°)">
<vxe-column field="a" title="A相"></vxe-column>
<vxe-column field="b" title="B相"></vxe-column>
<vxe-column field="c" title="C相"></vxe-column>
</vxe-colgroup>
<vxe-colgroup title="基波电流幅值(A)">
<vxe-column field="a" title="A相"></vxe-column>
<vxe-column field="b" title="B相"></vxe-column>
<vxe-column field="c" title="C相"></vxe-column>
</vxe-colgroup>
<vxe-colgroup title="基波电流相位(°)">
<vxe-column field="a" title="A相"></vxe-column>
<vxe-column field="b" title="B相"></vxe-column>
<vxe-column field="c" title="C相"></vxe-column>
</vxe-colgroup>
<div v-if="tableData.length != 0">
<!-- div设计table -->
<div class="table" v-for="(item, index) in columnsData" :key="index">
<!-- 单层表头 -->
<div class="thead">
<div class="thead_top">
{{ item[0].showName ? item[0].showName : '' }}({{ item[0].unit }})
</div>
<div class="thead_bot">
<div class="thead_bot_cell" v-for="(vv, key) in item" :key="key">
{{ vv.phase + ' ' }}
</div>
</div>
</div>
<div v-if="tableIndex == 1">
<vxe-colgroup title="电压偏差(%)">
<vxe-column field="a" title="AB相"></vxe-column>
<vxe-column field="b" title="BC相"></vxe-column>
<vxe-column field="c" title="CA相"></vxe-column>
</vxe-colgroup>
<vxe-colgroup title="电压总谐波畸变率(%)">
<vxe-column field="a" title="A相"></vxe-column>
<vxe-column field="b" title="BC相"></vxe-column>
<vxe-column field="c" title="CA相"></vxe-column>
</vxe-colgroup>
<vxe-colgroup title="电流总谐波畸变率(%)">
<vxe-column field="a" title="A相"></vxe-column>
<vxe-column field="b" title="BC相"></vxe-column>
<vxe-column field="c" title="CA相"></vxe-column>
</vxe-colgroup>
<vxe-colgroup title="电压不平衡度(%)">
<vxe-column field="a" title="A相"></vxe-column>
<vxe-column field="b" title="BC相"></vxe-column>
<vxe-column field="c" title="CA相"></vxe-column>
</vxe-colgroup>
<vxe-column field="a" width="170" title="电流不平衡度(%)"></vxe-column>
<vxe-column field="b" width="170" title="频率(Hz)"></vxe-column>
<vxe-column field="c" width="170" title="基波电流相位(°)"></vxe-column>
<!-- 有合并表头的数据 -->
<div class="tbody">
<div class="tbody_cell" v-for="(vv, key) in item" :key="key">
{{
tableData.find(item => {
return item.anotherName == vv.showName && item.phase == vv.phase
})?.statisticalData
? tableData.find(item => {
return item.anotherName == vv.showName && item.phase == vv.phase
})?.statisticalData
: '/'
}}
</div>
</div>
<div v-if="tableIndex == 2">
<vxe-colgroup title="有功功率(kV)">
<vxe-column field="a" title="A相"></vxe-column>
<vxe-column field="b" title="B相"></vxe-column>
<vxe-column field="c" title="C相"></vxe-column>
<vxe-column field="c" title="总有功功率"></vxe-column>
</vxe-colgroup>
<vxe-colgroup title="无功功率(kV)">
<vxe-column field="a" title="A相"></vxe-column>
<vxe-column field="b" title="B相"></vxe-column>
<vxe-column field="c" title="C相"></vxe-column>
<vxe-column field="c" title="总无功功率"></vxe-column>
</vxe-colgroup>
<vxe-colgroup title="视在功率(kV)">
<vxe-column field="a" title="A相"></vxe-column>
<vxe-column field="b" title="B相"></vxe-column>
<vxe-column field="c" title="C相"></vxe-column>
<vxe-column field="c" title="总视在功率"></vxe-column>
</vxe-colgroup>
<vxe-colgroup title="功率因数">
<vxe-column field="a" title="A相"></vxe-column>
<vxe-column field="b" title="B相"></vxe-column>
<vxe-column field="c" title="C相"></vxe-column>
<vxe-column field="c" title="总功率因数"></vxe-column>
</vxe-colgroup>
</div>
</vxe-table>
</div>
</div>
</template>
<script lang="ts" setup>
import { ref, nextTick, onMounted } from 'vue'
import { defaultAttribute } from '@/components/table/defaultAttribute'
import { VxeTablePropTypes, VxeTableInstance, VxeToolbarInstance } from 'vxe-table'
interface RowVO {
a: string
b: string
c: string
}
import { getRealTimeTableList } from '@/api/cs-device-boot/EquipmentDelivery'
const loading = ref(false)
const tableData = ref<RowVO[]>([])
const tableRef = ref<VxeTableInstance<RowVO>>()
const toolbarRef = ref<VxeToolbarInstance>()
const tableData: any = ref([])
loading.value = true
nextTick(() => {
// 将表格和工具栏进行关联
const $table = tableRef.value
const $toolbar = toolbarRef.value
if ($table && $toolbar) {
$table.connect($toolbar)
}
})
const columnsData: any = ref([])
const getColumns = () => {
getRealTimeTableList().then(res => {
columnsData.value = res.data
})
}
nextTick(() => {})
onMounted(() => {
getColumns()
loading.value = false
})
const tableIndex: any = ref(null)
const getTableData = (val: any, list: any) => {
tableIndex.value = val
const getTableData = (list: any) => {
tableData.value = list
loading.value = false
columnsData.value.map((item: any) => {
item.map((vv: any) => {
vv.statisticalData = list.find((kk: any) => {
return kk.anotherName == vv.showName && kk.phase == vv.phase
})?.statisticalData
})
})
}
defineExpose({ getTableData })
</script>
@@ -143,4 +65,58 @@ defineExpose({ getTableData })
// ::v-deep .vxe-table--empty-content{
// display: none !important;
// }
.table {
width: 100%;
height: 120px;
border: 1px solid #eee;
border-bottom: 2px solid #eee;
margin-bottom: 20px;
display: flex;
flex-direction: column;
.thead {
width: 100%;
height: auto;
background: #f4f6f9;
text-align: center;
display: flex;
flex-direction: column;
.thead_top {
width: 100%;
height: 40px;
line-height: 40px;
border: 1px solid #eee;
color: #111;
font-size: 14px;
font-weight: 800;
}
.thead_bot {
width: 100%;
height: 40px;
line-height: 40px;
display: flex;
color: #111;
font-size: 14px;
font-weight: 800;
.thead_bot_cell {
flex: 1;
border: 1px solid #eee;
}
}
}
.tbody {
flex: 1;
display: flex;
text-align: center;
.tbody_cell {
flex: 1;
text-align: center;
line-height: 40px;
border: 1px solid #eee;
border-bottom: 0;
}
}
.tbody:hover {
background: #f4f6f9;
}
}
</style>

View File

@@ -3,29 +3,57 @@
<div class="view_top">
<!-- 左侧仪表盘 -->
<div class="view_top_left">
<div class="left_charts"><MyEchart ref="pieChartRef" :options="echartsData"></MyEchart></div>
<div class="left_charts"><MyEchart ref="pieChartRef" :options="echartsData"></MyEchart></div>
<div class="left_charts"><MyEchart ref="pieChartRef" :options="echartsData"></MyEchart></div>
<div class="left_charts_title">电压有效值</div>
<div class="left_charts"><MyEchart ref="pieChart1" :options="echartsDataV1"></MyEchart></div>
<div class="left_charts"><MyEchart ref="pieChart2" :options="echartsDataV2"></MyEchart></div>
<div class="left_charts"><MyEchart ref="pieChart3" :options="echartsDataV3"></MyEchart></div>
</div>
<div class="view_top_mid">
<div class="mid_charts"><MyEchart ref="pieChartRef" :options="echartsData1"></MyEchart></div>
<div class="mid_charts_title">基波电压/电流幅值(相位)</div>
<div class="mid_charts"><MyEchart :options="echartsData1"></MyEchart></div>
</div>
<!-- 右侧仪表盘 -->
<div class="view_top_right">
<div class="right_charts"><MyEchart ref="pieChartRef" :options="echartsData"></MyEchart></div>
<div class="right_charts"><MyEchart ref="pieChartRef" :options="echartsData"></MyEchart></div>
<div class="right_charts"><MyEchart ref="pieChartRef" :options="echartsData"></MyEchart></div>
<div class="right_chartsitle">电流有效值</div>
<div class="right_charts"><MyEchart ref="pieChart4" :options="echartsDataA1"></MyEchart></div>
<div class="right_charts"><MyEchart ref="pieChart5" :options="echartsDataA2"></MyEchart></div>
<div class="right_charts"><MyEchart ref="pieChart6" :options="echartsDataA3"></MyEchart></div>
</div>
</div>
<div class="view_bot">
<div class="view_bot_tables">
<tableInfo ref="tableInfoRef1" />
</div>
<div class="view_bot_tables">
<tableInfo ref="tableInfoRef2" />
</div>
<div class="view_bot_tables">
<tableInfo ref="tableInfoRef3" />
<!-- <tableInfo ref="tableInfoRef" /> -->
<!-- 表格数据 -->
<div v-if="tableData.length != 0">
<!-- div设计table -->
<div class="table" v-for="(item, index) in columnsData" :key="index">
<!-- 单层表头 -->
<div class="thead">
<div class="thead_top">
{{ item[0].showName ? item[0].showName : '' }}({{ item[0].unit }})
</div>
<div class="thead_bot">
<div class="thead_bot_cell" v-for="(vv, key) in item" :key="key">
{{ vv.phase + ' ' }}
</div>
</div>
</div>
<!-- 有合并表头的数据 -->
<div class="tbody">
<div class="tbody_cell" v-for="(vv, key) in item" :key="key">
{{
tableData.find(item => {
return item.anotherName == vv.showName && item.phase == vv.phase
})?.statisticalData
? tableData.find(item => {
return item.anotherName == vv.showName && item.phase == vv.phase
})?.statisticalData
: '/'
}}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@@ -33,12 +61,27 @@
<script lang="ts" setup>
import { ref, onMounted } from 'vue'
import MyEchart from '@/components/echarts/MyEchart.vue'
import { getRealTimeTableList } from '@/api/cs-device-boot/EquipmentDelivery'
import tableInfo from './components/tableInfo.vue'
import * as echarts from 'echarts'
import { split } from 'lodash-es'
const pieChartRef: any = ref()
const pieChart1: any = ref()
const pieChart2: any = ref()
const pieChart3: any = ref()
const pieChart4: any = ref()
const pieChart5: any = ref()
const pieChart6: any = ref()
const echartsData: any = ref({})
const echartsData1: any = ref({})
//电压有效值
const echartsDataV1: any = ref({})
const echartsDataV2: any = ref({})
const echartsDataV3: any = ref({})
//电流有效值
const echartsDataA1: any = ref({})
const echartsDataA2: any = ref({})
const echartsDataA3: any = ref({})
//渲染echarts
const init = () => {
echartsData.value = {
@@ -87,251 +130,22 @@ const init = () => {
data: [
{
value: 15,
name: '违规率'
name: 'A相'
}
]
}
]
}
}
echartsDataV1.value = echartsData.value
echartsDataV2.value = echartsData.value
echartsDataV3.value = echartsData.value
echartsDataA1.value = echartsData.value
echartsDataA2.value = echartsData.value
echartsDataA3.value = echartsData.value
//中间指针图
echartsData1.value = {
// options: {
// // backgroundColor: '#001533',
// tooltip: {
// format: function (params) {
// console.log(params)
// }
// },
// series: [
// //外圈
// {
// radius: '100%',
// min: -150,
// max: 180,
// startAngle: -90,
// endAngle: 270,
// pointer: {
// show: true,
// length: '80%',
// radius: '20%',
// width: 6 //指针粗细
// },
// itemStyle: {
// normal: {
// color: 'rgb(0,191,255)'
// }
// },
// // axisLine: {
// // show: true,
// // fontSize: 20,
// // lineStyle: {
// // width: 0,
// // color: [[1, '#01b4e0']]
// // }
// // },
// axisLine: {
// show: true,
// // 坐标轴线
// lineStyle: {
// color: [[1, '#F42E47']], // 属性lineStyle控制线条样式
// width: 2
// },
// interval: 0
// },
// splitLine: {
// length: 10,
// lineStyle: {
// width: 2,
// color: '#01b4e0',
// distance: 5
// }, //刻度节点线
// splitNumber: 5
// },
// splitNumber: 11,
// axisTick: {
// show: false
// },
// axisLabel: {
// show: true,
// fontSize: 14,
// color: '#000',
// formatter: function (v: any) {
// console.log(v, '00000000000')
// switch (v + '') {
// case '-122.5':
// return '-120'
// case '-95':
// return '-90'
// case '-60':
// return '-60'
// case '-67.5':
// return '-60'
// case '-40':
// return '-30'
// case '-12.5':
// return '0'
// case '42.5':
// return '30'
// case '70':
// return '60'
// case '97.5':
// return '90'
// case '125':
// return '120'
// case '152.5':
// return '150'
// case '-180':
// return ''
// case '180':
// return '180'
// default:
// return v
// }
// }
// },
// detail: {
// show: false,
// textStyle: {
// fontSize: 30,
// fontWeight: '700',
// color: '#67d9fe'
// }
// },
// data: [
// {
// name: '',
// value: 150,
// itemStyle: {
// color: 'red'
// }
// },
// {
// name: '',
// value: 60,
// itemStyle: {
// color: '#DAA521'
// }
// },
// {
// name: '',
// value: 90,
// itemStyle: {
// color: 'green'
// }
// }
// ]
// },
// //内圈
// {
// radius: '50%',
// splitNumber: 11,
// startAngle: 0,
// endAngle: 360,
// min: -150,
// max: 180,
// axisLine: {
// show: true,
// // 坐标轴线
// lineStyle: {
// color: [[1, '#1C9EE9']], // 属性lineStyle控制线条样式
// width: 2,
// type: 'dashed'
// }
// },
// pointer: {
// show: true,
// length: '80%',
// radius: '20%',
// width: 8 //指针粗细
// },
// itemStyle: {
// // show: false,
// normal: {
// color: 'rgb(0,191,255)'
// }
// },
// splitLine: {
// length: 5,
// interval: 30,
// lineStyle: {
// width: 2,
// color: 'green',
// distance: -20
// } //刻度节点线
// },
// axisTick: {
// show: false
// },
// axisLabel: {
// show: true,
// itemStyle: {
// interval: 0
// },
// formatter: function (v: any) {
// console.log(v, '00000000000')
// switch (v + '') {
// case '-122.5':
// return '-120'
// case '-95':
// return '-90'
// case '-60':
// return '-60'
// case '-67.5':
// return '-60'
// case '-40':
// return '-30'
// case '-12.5':
// return '0'
// case '42.5':
// return '30'
// case '70':
// return '60'
// case '97.5':
// return '90'
// case '125':
// return '120'
// case '152.5':
// return '150'
// case '-180':
// return ''
// case '180':
// return '180'
// default:
// return v
// }
// }
// },
// detail: {
// show: false
// },
// data: [
// {
// name: '',
// value: 110,
// itemStyle: {
// color: 'red'
// }
// },
// {
// name: '',
// value: 70,
// itemStyle: {
// color: '#DAA521'
// }
// },
// {
// name: '',
// value: 20,
// itemStyle: {
// color: 'green'
// }
// }
// ]
// }
// ]
// }
options: {
grid: {
top: 230
@@ -1102,7 +916,7 @@ const init = () => {
show: true,
lineStyle: {
color: [
[0.25, '#9D322D'],
[0.25, '#9D322D'],
[0.5, '#9D322D'],
[0.75, '#9D322D'],
[1, '#9D322D']
@@ -1186,32 +1000,125 @@ const init = () => {
echartsData1.value.options.series[i].startAngle = 90
echartsData1.value.options.series[i].endAngle = -270
echartsData1.value.options.series[i].center = ['50%', '50%']
// option.series[i].axisTick = {show: false};
// option.series[i].axisLabel = {show: false};
// optionThree.series[i].pointer = {show: false};
// optionThree.series[i].detail = {show: false};
}
}
//渲染table表头
const tableInfoRef1: any = ref(null)
const tableInfoRef2: any = ref(null)
const tableInfoRef3: any = ref(null)
const initTableHead = () => {
const list: any = []
for (let index = 0; index < 1; index++) {
list.push({
a: Math.floor(Math.random() * (100 + 1)),
b: Math.floor(Math.random() * (100 + 1)),
c: Math.floor(Math.random() * (100 + 1))
//接收父组件传递的table数据
const tableInfoRef: any = ref(null)
const dataList: any = ref([])
const listV: any = ref([])
const listA: any = ref([])
const loading = ref(false)
//定义表格所需要的数据
const tableData: any = ref([])
loading.value = true
const columnsData: any = ref([])
const getColumns = () => {
getRealTimeTableList().then(res => {
columnsData.value = res.data
})
}
//处理表格数据
const getTableData = (list: any) => {
tableData.value = list
loading.value = false
columnsData.value.map((item: any) => {
item.map((vv: any) => {
vv.statisticalData = list.find((kk: any) => {
return kk.anotherName == vv.showName && kk.phase == vv.phase
})?.statisticalData
})
}
tableInfoRef1.value.getTableData(0, list)
tableInfoRef2.value.getTableData(1, list)
tableInfoRef3.value.getTableData(2, list)
})
}
//获取实时数据
const getRealTimeData = (val: any) => {
dataList.value = val
dataList.value.map((item: any, index: any) => {
if (item.anotherName == '相电压总有效值') {
listV.value.push(item)
}
if (item.anotherName == '线电压总有效值') {
listA.value.push(item)
}
})
echartsDataV1.value.options.series[0].data = [
{
name:
listV.value.find((item: any) => {
return item.phase == 'A'
})?.phase + '相',
value: listV.value.find((item: any) => {
return item.phase == 'A'
})?.statisticalData
}
]
pieChart1.value.initChart()
echartsDataV2.value.options.series[0].data = [
{
name:
listV.value.find((item: any) => {
return item.phase == 'B'
})?.phase + '相',
value: listV.value.find((item: any) => {
return item.phase == 'B'
})?.statisticalData
}
]
pieChart2.value.initChart()
echartsDataV3.value.options.series[0].data = [
{
name:
listV.value.find((item: any) => {
return item.phase == 'C'
})?.phase + '相',
value: listV.value.find((item: any) => {
return item.phase == 'C'
})?.statisticalData
}
]
pieChart3.value.initChart()
echartsDataA1.value.options.series[0].data = [
{
name:
listA.value.find((item: any) => {
return item.phase == 'AB'
})?.phase + '相',
value: listA.value.find((item: any) => {
return item.phase == 'AB'
})?.statisticalData
}
]
pieChart4.value.initChart()
echartsDataA2.value.options.series[0].data = [
{
name:
listA.value.find((item: any) => {
return item.phase == 'BC'
})?.phase + '相',
value: listA.value.find((item: any) => {
return item.phase == 'BC'
})?.statisticalData
}
]
pieChart5.value.initChart()
echartsDataA3.value.options.series[0].data = [
{
name:
listA.value.find((item: any) => {
return item.phase == 'CA'
})?.phase + '相',
value: listA.value.find((item: any) => {
return item.phase == 'CA'
})?.statisticalData
}
]
pieChart6.value.initChart()
getColumns()
getTableData(val)
}
defineExpose({ getRealTimeData })
onMounted(() => {
init()
initTableHead()
})
</script>
<style lang="scss" scoped>
@@ -1232,16 +1139,18 @@ onMounted(() => {
.view_top_right {
width: 30%;
height: 100%;
padding: 10px;
display: flex;
flex-direction: column;
align-items: center;
border: 1px solid #eee;
.left_charts,
.right_charts {
flex: none;
width: 100%;
height: 120px;
border: 1px solid #eee;
margin-bottom: 10px;
margin-bottom: 16px;
padding: 10px;
}
}
@@ -1250,11 +1159,23 @@ onMounted(() => {
border: 1px solid #eee;
margin: 0 10px;
padding: 10px;
height: 450px;
.mid_charts {
width: 100%;
height: 100%;
}
}
.left_charts_title,
.mid_charts_title,
.right_charts_title {
width: 100%;
height: 20px;
text-align: left;
font-weight: 800;
font-weight: 16px;
line-height: 20px;
}
}
.view_bot {
min-height: 300px;
@@ -1268,4 +1189,58 @@ onMounted(() => {
.view::-webkit-scrollbar {
display: none;
}
.table {
width: 100%;
height: 120px;
border: 1px solid #eee;
border-bottom: 2px solid #eee;
margin-bottom: 20px;
display: flex;
flex-direction: column;
.thead {
width: 100%;
height: auto;
background: #f4f6f9;
text-align: center;
display: flex;
flex-direction: column;
.thead_top {
width: 100%;
height: 40px;
line-height: 40px;
border: 1px solid #eee;
color: #111;
font-size: 14px;
font-weight: 800;
}
.thead_bot {
width: 100%;
height: 40px;
line-height: 40px;
display: flex;
color: #111;
font-size: 14px;
font-weight: 800;
.thead_bot_cell {
flex: 1;
border: 1px solid #eee;
}
}
}
.tbody {
flex: 1;
display: flex;
text-align: center;
.tbody_cell {
flex: 1;
text-align: center;
line-height: 40px;
border: 1px solid #eee;
border-bottom: 0;
}
}
.tbody:hover {
background: #f4f6f9;
}
}
</style>