This commit is contained in:
sjl
2025-11-12 15:42:31 +08:00
parent d6336f7ba8
commit b982cee382
3 changed files with 105 additions and 51 deletions

View File

@@ -294,7 +294,7 @@ const tableStore = new TableStore({
// treeData = tree2List(tableStore.table.data) // treeData = tree2List(tableStore.table.data)
// tableStore.table.data = JSON.parse(JSON.stringify(treeData)) // tableStore.table.data = JSON.parse(JSON.stringify(treeData))
tableStore.table.data = tree2List(tableStore.table.data, Math.random() * 1000) tableStore.table.data = tree2List(tableStore.table.data, Math.random() * 1000)
console.log('tableStore.table.params---2', tableStore.table.params)
chartsRef.value && chartsRef.value.getTableStoreParams(tableStore.table.params) chartsRef.value && chartsRef.value.getTableStoreParams(tableStore.table.params)
setTimeout(() => { setTimeout(() => {
activeName.value == 0 && tableRef.value && tableRef.value.getRef().setAllTreeExpand(true) activeName.value == 0 && tableRef.value && tableRef.value.getRef().setAllTreeExpand(true)

View File

@@ -65,12 +65,12 @@
<vxe-column field="devName" title="终端名称" align="center" min-width="120"></vxe-column> <vxe-column field="devName" title="终端名称" align="center" min-width="120"></vxe-column>
<vxe-column field="devType" title="终端型号" align="center" min-width="150"></vxe-column> <vxe-column field="devType" title="终端型号" align="center" min-width="150"></vxe-column>
<vxe-column field="loginTime" title="投运时间" align="center" min-width="120"></vxe-column> <vxe-column field="loginTime" title="投运时间" align="center" min-width="120"></vxe-column>
<vxe-column field="lineName" title="监测点名称" align="center" min-width="150"></vxe-column> <vxe-column field="lineName" title="监测点名称" align="center" min-width="150" :formatter="formatMonitorId"></vxe-column>
<vxe-column field="powerFlag" title="监测位置" align="center" min-width="100"></vxe-column> <vxe-column field="powerFlag" title="监测位置" align="center" min-width="100"></vxe-column>
<vxe-column field="lineVoltage" title="监测点电压等级" align="center" min-width="120"></vxe-column> <vxe-column field="lineVoltage" title="监测点电压等级" align="center" min-width="120"></vxe-column>
<vxe-column field="loadType" title="干扰源类型" align="center" min-width="120"></vxe-column> <vxe-column field="loadType" title="干扰源类型" align="center" min-width="120"></vxe-column>
<vxe-column field="objName" title="监测对象名称" align="center" min-width="150"></vxe-column> <vxe-column field="objName" title="监测对象名称" align="center" min-width="150" :formatter="formatMonitorId"></vxe-column>
<vxe-column field="interval" title="统计间隔" align="center" min-width="100"></vxe-column> <vxe-column field="interval" title="统计间隔" align="center" min-width="100" :formatter="formatMonitorId"></vxe-column>
<vxe-column field="onlineRate" title="在线率(%)" align="center" min-width="100"></vxe-column> <vxe-column field="onlineRate" title="在线率(%)" align="center" min-width="100"></vxe-column>
<vxe-column field="integrity" title="完整率(%)" align="center" min-width="100"></vxe-column> <vxe-column field="integrity" title="完整率(%)" align="center" min-width="100"></vxe-column>
<vxe-column field="harmonicValue" :title="harmonicValueTitle" align="center" min-width="120"></vxe-column> <vxe-column field="harmonicValue" :title="harmonicValueTitle" align="center" min-width="120"></vxe-column>
@@ -141,7 +141,7 @@ interface PollutionItem {
} }
const formatMonitorId = (row: any) => { const formatMonitorId = (row: any) => {
return row.row.monitorId || '/' return row.cellValue || '/'
} }
const handleSelectChange = (isExpanded: boolean) => { const handleSelectChange = (isExpanded: boolean) => {
@@ -302,7 +302,7 @@ const handleCurrentChange = (val: number) => {
const exportEvent = () => { const exportEvent = () => {
const allFilteredData = filteredData.value const allFilteredData = filteredData.value
tableRef.value.exportData({ tableRef.value.exportData({
filename: '污染值报告', filename: '监测点评估-污染值报告',
sheetName: 'Sheet1', sheetName: 'Sheet1',
type: 'xlsx', type: 'xlsx',
useStyle: true, useStyle: true,

View File

@@ -35,7 +35,7 @@
<el-form-item label="筛选"> <el-form-item label="筛选">
<el-input <el-input
v-model="searchKeyword" v-model="searchKeyword"
placeholder="请输入变电站/终端/监测点" placeholder="请输入变电站"
clearable clearable
@input="handleFilterChange" @input="handleFilterChange"
:show-word-limit=true :show-word-limit=true
@@ -64,14 +64,11 @@
<vxe-column field="subStationName" :show-overflow="true" title="变电站" align="center" min-width="150"></vxe-column> <vxe-column field="subStationName" :show-overflow="true" title="变电站" align="center" min-width="150"></vxe-column>
<vxe-column field="subVStationValue" :title="harmonicValueTitle" align="center" min-width="150"></vxe-column> <vxe-column field="subVStationValue" :title="harmonicValueTitle" align="center" min-width="150"></vxe-column>
<vxe-column field="subVoltage" title="变电站电压等级" align="center" min-width="150"></vxe-column> <vxe-column field="subVoltage" title="变电站电压等级" align="center" min-width="150"></vxe-column>
<vxe-column field="lineName" title="监测点名称" align="center" min-width="150"></vxe-column> <vxe-column title="操作" width="150" align="center">
<vxe-column field="devName" title="终端名称" align="center" min-width="150"></vxe-column> <template #default="{ row }">
<vxe-column field="devType" title="终端型号" align="center" min-width="120"></vxe-column> <el-button size="small" type="primary" @click="showDetailDialog(row)">监测点详情</el-button>
<vxe-column field="manufacturer" title="终端厂家" align="center" min-width="150"></vxe-column> </template>
<vxe-column field="loginTime" title="投运时间" align="center" min-width="150"></vxe-column> </vxe-column>
<vxe-column field="interval" title="统计间隔" align="center" min-width="150"></vxe-column>
<vxe-column field="powerFlag" title="监测位置" align="center" min-width="150"></vxe-column>
<vxe-column field="vharmonicValue" title="监测点污染值" align="center" min-width="150"></vxe-column>
</vxe-table> </vxe-table>
</div> </div>
@@ -87,6 +84,33 @@
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
class="custom-pagination"/> class="custom-pagination"/>
</div> </div>
<!-- 添加弹窗 -->
<el-dialog
v-model="detailDialogVisible"
:title="detailDialogTitle"
width="80%"
>
<div v-loading="detailLoading">
<vxe-table
:data="detailData"
auto-resize
resizable
show-overflow
height="400px"
>
<vxe-column title="序号" width="60" type="seq" align="center"></vxe-column>
<vxe-column field="lineName" title="监测点名称" align="center" min-width="120"></vxe-column>
<vxe-column field="devName" title="终端名称" align="center" min-width="120"></vxe-column>
<vxe-column field="devType" title="终端型号" align="center" min-width="100"></vxe-column>
<vxe-column field="manufacturer" title="终端厂家" align="center" min-width="120"></vxe-column>
<vxe-column field="loginTime" title="投运时间" align="center" min-width="120"></vxe-column>
<vxe-column field="interval" title="统计间隔" align="center" min-width="100"></vxe-column>
<vxe-column field="powerFlag" title="监测位置" align="center" min-width="100"></vxe-column>
<vxe-column field="vharmonicValue" title="监测点污染值" align="center" min-width="120"></vxe-column>
</vxe-table>
</div>
</el-dialog>
</div> </div>
</template> </template>
@@ -119,6 +143,53 @@ const areOptions: any = dictData.state.area
const allData = ref<PollutionItem[]>([]) const allData = ref<PollutionItem[]>([])
const searchKeyword = ref('') const searchKeyword = ref('')
const harmonicValueTitle = ref('电站谐波电压污染值') const harmonicValueTitle = ref('电站谐波电压污染值')
const detailDialogVisible = ref(false)
const detailDialogTitle = ref('')
const detailLoading = ref(false)
const detailData = ref<PollutionItem[]>([])
const originalTableData = ref<any[]>([])
// 方法
const showDetailDialog = (row) => {
detailDialogTitle.value = `${row.subStationName} - 监测点详情`
loadDetailData(row)
detailDialogVisible.value = true
}
const loadDetailData = async (row) => {
detailLoading.value = true
try {
// 从原始数据中查找该变电站的详细信息
const originalItem = originalTableData.value.find(
item => item.subStationName === row.subStationName
)
if (originalItem && originalItem.powerFlagPollutionList) {
const detailList: PollutionItem[] = []
originalItem.powerFlagPollutionList.forEach((point: any) => {
detailList.push({
lineName: processNullValue(point.lineName),
devName: processNullValue(point.devName),
devType: processNullValue(point.devType),
manufacturer: processNullValue(point.manufacturer),
loginTime: processNullValue(point.loginTime),
interval: processNullValue(point.interval),
powerFlag: processNullValue(point.powerFlag),
vharmonicValue: processNullValue(point.vharmonicValue)
})
})
detailData.value = detailList
} else {
detailData.value = []
}
} catch (error) {
console.error('加载详情数据失败:', error)
detailData.value = []
} finally {
detailLoading.value = false
}
}
const cascaderProps = { const cascaderProps = {
label: 'name', label: 'name',
@@ -142,8 +213,6 @@ interface PollutionItem {
vharmonicValue?: string vharmonicValue?: string
} }
const handleSelectChange = (isExpanded: boolean) => { const handleSelectChange = (isExpanded: boolean) => {
if (isExpanded) { if (isExpanded) {
tableHeight.value = tableHeight.value - 55 tableHeight.value = tableHeight.value - 55
@@ -220,7 +289,6 @@ const updateTotal = computed(() => {
return filteredData.value.length return filteredData.value.length
}) })
const processNullValue = (value: any) => { const processNullValue = (value: any) => {
return value === null || value === undefined || value === '' || value === 'null'? '/' : value return value === null || value === undefined || value === '' || value === 'null'? '/' : value
} }
@@ -237,37 +305,19 @@ const tableStore = new TableStore({
delete tableStore.table.params.timeFlag delete tableStore.table.params.timeFlag
}, },
loadCallback: () => { loadCallback: () => {
// 展开数据 // 保存原始数据以便后续查询
originalTableData.value = [...(tableStore.table.data || [])]
const expandedData: PollutionItem[] = []; const expandedData: PollutionItem[] = [];
(tableStore.table.data || []).forEach((item: any) => { (tableStore.table.data || []).forEach((item: any) => {
if (item.powerFlagPollutionList && item.powerFlagPollutionList.length > 0) {
// 为每个监测点创建一行数据
item.powerFlagPollutionList.forEach((point: any) => {
expandedData.push({
gdName: processNullValue(item.gdName),
subStationName: processNullValue(item.subStationName),
subVStationValue: processNullValue(item.subVStationValue),
subVoltage: processNullValue(item.subVoltage),
devName: processNullValue(point.devName),
lineName: processNullValue(point.lineName),
powerFlag: processNullValue(point.powerFlag),
devType: processNullValue(point.devType),
manufacturer: processNullValue(point.manufacturer),
loginTime: processNullValue(point.loginTime),
interval: processNullValue(point.interval),
vharmonicValue: processNullValue(point.vharmonicValue)
});
});
} else {
// 如果没有监测点数据,也保留变电站基本信息行
expandedData.push({ expandedData.push({
gdName: processNullValue(item.gdName), gdName: processNullValue(item.gdName),
subStationName: processNullValue(item.subStationName), subStationName: processNullValue(item.subStationName),
subVStationValue: processNullValue(item.subVStationValue), subVStationValue: processNullValue(item.subVStationValue),
subVoltage: processNullValue(item.subVoltage) subVoltage: processNullValue(item.subVoltage)
}); });
}
}); });
allData.value = expandedData; allData.value = expandedData;
@@ -340,17 +390,21 @@ const handleCurrentChange = (val: number) => {
const exportEvent = () => { const exportEvent = () => {
const allFilteredData = filteredData.value const allFilteredData = filteredData.value
tableRef.value.exportData({ tableRef.value.exportData({
filename: '污染值报告', filename: '场战级评估-污染值报告',
sheetName: 'Sheet1', sheetName: 'Sheet1',
type: 'xlsx', type: 'xlsx',
useStyle: true, useStyle: true,
data: allFilteredData, data: allFilteredData,
columnFilterMethod: function (column, $columnIndex) { columnFilterMethod: function (column: any) {
return !(column.$columnIndex === 0) return !(
column.column.title === '操作'
)
} }
}) })
} }
onMounted(() => { onMounted(() => {
if (props.active) { if (props.active) {
tableStore.index() tableStore.index()