style:能源报表-更换子列表渲染字段

liutao_branch
黄伟杰 4 months ago
parent c9286c4a7f
commit 8998160f7a

@ -8,8 +8,8 @@ VITE_DEV=true
# 线上环境 # 线上环境
# VITE_BASE_URL='https://besure.ngsk.tech:7001' # VITE_BASE_URL='https://besure.ngsk.tech:7001'
# 本地联调 # 本地联调
VITE_BASE_URL='http://localhost:48081' # VITE_BASE_URL='http://192.168.5.107:48081'
# VITE_BASE_URL='http://192.168.5.135:48081' VITE_BASE_URL='http://192.168.5.131:48081'
# 文件上传类型server - 后端上传, client - 前端直连上传,仅支持 S3 服务 # 文件上传类型server - 后端上传, client - 前端直连上传,仅支持 S3 服务

@ -39,10 +39,14 @@
<el-table-column type="selection" width="50" align="center" /> <el-table-column type="selection" width="50" align="center" />
<el-table-column type="expand" width="52"> <el-table-column type="expand" width="52">
<template #default="scope"> <template #default="scope">
<el-table v-if="getOperationRuleRows(scope.row).length" :data="getOperationRuleRows(scope.row)" <el-table v-if="getPointDetailsRows(scope.row).length" :data="getPointDetailsRows(scope.row)"
:show-overflow-tooltip="true" size="small" border> :show-overflow-tooltip="true" size="small" border>
<el-table-column label="指标" prop="name" min-width="140" /> <el-table-column label="参数名称" prop="pointName" min-width="140" />
<el-table-column label="值" prop="value" min-width="120" /> <el-table-column label="最早采集值" prop="earliestValue" min-width="120" />
<el-table-column label="最早采集时间" prop="earliestTime" min-width="170" />
<el-table-column label="最新值" prop="latestValue" min-width="120" />
<el-table-column label="最新采集时间" prop="latestTime" min-width="170" />
<el-table-column label="能耗用量" prop="difference" min-width="120" />
</el-table> </el-table>
</template> </template>
</el-table-column> </el-table-column>
@ -116,20 +120,18 @@ const queryParams = reactive({
const queryFormRef = ref() // const queryFormRef = ref() //
const exportLoading = ref(false) // const exportLoading = ref(false) //
const getOperationRuleRows = (row: EnergyDeviceDataRecordVO) => { const getPointDetailsRows = (row: EnergyDeviceDataRecordVO) => {
const map = row?.operationRulesVOMap const list = (row as any)?.pointDetails
if (!map) return [] if (!Array.isArray(list)) return []
const entries = Object.entries(map).filter(([k]) => !!k) return list
if (!entries.length) return []
return entries.map(([name, value]) => ({ name, value: value ?? '-' }))
} }
const getRowClassName = ({ row }: { row: EnergyDeviceDataRecordVO }) => { const getRowClassName = ({ row }: { row: EnergyDeviceDataRecordVO }) => {
return getOperationRuleRows(row).length ? '' : 'row-no-expand' return getPointDetailsRows(row).length ? '' : 'row-no-expand'
} }
const handleRowClick = (row: EnergyDeviceDataRecordVO) => { const handleRowClick = (row: EnergyDeviceDataRecordVO) => {
const rows = getOperationRuleRows(row) const rows = getPointDetailsRows(row)
if (!rows.length) return if (!rows.length) return
const key = row.id const key = row.id
const idx = expandRowKeys.value.findIndex((k) => k === key) const idx = expandRowKeys.value.findIndex((k) => k === key)

Loading…
Cancel
Save