提交更改版本

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

@@ -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>