|
@@ -370,6 +370,20 @@
|
|
|
|
|
|
<!-- 详情弹框 -->
|
|
<!-- 详情弹框 -->
|
|
<el-dialog :visible.sync="showDrawer" title="设备详情" width="65%" custom-class="detail-dialog">
|
|
<el-dialog :visible.sync="showDrawer" title="设备详情" width="65%" custom-class="detail-dialog">
|
|
|
|
+
|
|
|
|
+ <!-- 表格属性详情弹框 -->
|
|
|
|
+ <el-dialog :visible.sync="showTableDetail" title="表格数据详情" width="70%" append-to-body :modal-append-to-body="true">
|
|
|
|
+ <el-table :data="tableDetailData" style="width: 100%">
|
|
|
|
+ <el-table-column type="index" label="序号" width="50"></el-table-column>
|
|
|
|
+ <el-table-column prop="name" label="名称"></el-table-column>
|
|
|
|
+ <el-table-column prop="key" label="键"></el-table-column>
|
|
|
|
+ <el-table-column prop="value" label="值"></el-table-column>
|
|
|
|
+ <el-table-column prop="updateTime" label="更新时间"></el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button @click="showTableDetail = false">关闭</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </el-dialog>
|
|
<div v-if="curRow">
|
|
<div v-if="curRow">
|
|
<!-- 分页导航 -->
|
|
<!-- 分页导航 -->
|
|
<el-tabs v-model="activeTab">
|
|
<el-tabs v-model="activeTab">
|
|
@@ -422,20 +436,26 @@
|
|
<div v-if="activeTab === 'attr'">
|
|
<div v-if="activeTab === 'attr'">
|
|
<el-card class="box-card">
|
|
<el-card class="box-card">
|
|
<div v-for="(tableData, tableName) in attrTables" :key="tableName">
|
|
<div v-for="(tableData, tableName) in attrTables" :key="tableName">
|
|
- <p class="section-title">{{ tableData.title }}</p>
|
|
|
|
- <el-table :data="tableData.data" style="width: 100%" :show-header="true" :empty-text="'暂无数据'">
|
|
|
|
|
|
+ <p class="section-title" @click="toggleCollapse(tableName)" style="cursor: pointer;">
|
|
|
|
+ <i :class="collapsed[tableName] ? 'el-icon-arrow-right' : 'el-icon-arrow-down'" style="margin-right: 8px;"></i>
|
|
|
|
+ {{ tableData.title }} ({{ tableData.data.length }})
|
|
|
|
+ </p>
|
|
|
|
+ <el-table v-if="!collapsed[tableName]" :data="tableData.data" style="width: 100%" :show-header="true" :empty-text="'暂无数据'">
|
|
<el-table-column type="index" label="序号" width="50" align="center"></el-table-column>
|
|
<el-table-column type="index" label="序号" width="50" align="center"></el-table-column>
|
|
<el-table-column label="属性名称" prop="attrName"></el-table-column>
|
|
<el-table-column label="属性名称" prop="attrName"></el-table-column>
|
|
<el-table-column label="属性标识" prop="attrKey"></el-table-column>
|
|
<el-table-column label="属性标识" prop="attrKey"></el-table-column>
|
|
<!-- 动态显示属性值 -->
|
|
<!-- 动态显示属性值 -->
|
|
<el-table-column label="属性值" align="center">
|
|
<el-table-column label="属性值" align="center">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <span v-if="tableData.title === '状态属性'">
|
|
|
|
- {{ scope.row.attrValueName || getAttrValueText(scope.row.attrValue) }}
|
|
|
|
- <span v-if="scope.row.attrUnit">{{ scope.row.attrUnit }}</span>
|
|
|
|
|
|
+ <span v-if="scope.row.attrValueType === 'Table'">
|
|
|
|
+ <el-button type="text" size="small" @click="handleTableAttrDetail(scope.row)">详情</el-button>
|
|
|
|
+ </span>
|
|
|
|
+ <span v-else-if="tableData.title === '状态属性'">
|
|
|
|
+ {{ scope.row.attrValueName || getAttrValueText(scope.row.attrValue) }}
|
|
|
|
+ <span v-if="scope.row.attrUnit">{{ scope.row.attrUnit }}</span>
|
|
</span>
|
|
</span>
|
|
<span v-else>
|
|
<span v-else>
|
|
- {{ scope.row.attrValue }}
|
|
|
|
|
|
+ {{ scope.row.attrValue }}
|
|
</span>
|
|
</span>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
@@ -684,8 +704,12 @@ export default {
|
|
components: { Treeselect },
|
|
components: { Treeselect },
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- // 归属区域下拉选项
|
|
|
|
- areaOptions: [],
|
|
|
|
|
|
+ // 表格属性详情弹窗状态
|
|
|
|
+ showTableDetail: false,
|
|
|
|
+ // 表格详情数据
|
|
|
|
+ tableDetailData: [],
|
|
|
|
+ // 归属区域下拉选项
|
|
|
|
+ areaOptions: [],
|
|
// 归属子区下拉选项
|
|
// 归属子区下拉选项
|
|
subAreaOptions: [],
|
|
subAreaOptions: [],
|
|
abilityDialogVisible: false,
|
|
abilityDialogVisible: false,
|
|
@@ -825,12 +849,23 @@ export default {
|
|
ProtocolData: [],
|
|
ProtocolData: [],
|
|
StateData: [],
|
|
StateData: [],
|
|
MeasureData: [],
|
|
MeasureData: [],
|
|
|
|
+ // 折叠状态,默认全部折叠
|
|
|
|
+ collapsed: {
|
|
|
|
+ Base: true,
|
|
|
|
+ Protocol: true,
|
|
|
|
+ State: true,
|
|
|
|
+ Measure: true
|
|
|
|
+ },
|
|
attrTables: {
|
|
attrTables: {
|
|
Base: { title: '基础属性', data: [] },
|
|
Base: { title: '基础属性', data: [] },
|
|
Protocol: { title: '协议属性', data: [] },
|
|
Protocol: { title: '协议属性', data: [] },
|
|
State: { title: '状态属性', data: [] },
|
|
State: { title: '状态属性', data: [] },
|
|
Measure: { title: '计量属性', data: [] }
|
|
Measure: { title: '计量属性', data: [] }
|
|
},
|
|
},
|
|
|
|
+ // 控制表格显示的方法
|
|
|
|
+ toggleCollapse(tableName) {
|
|
|
|
+ this.collapsed[tableName] = !this.collapsed[tableName];
|
|
|
|
+ },
|
|
// 表单参数
|
|
// 表单参数
|
|
form: {
|
|
form: {
|
|
customAttrs: []
|
|
customAttrs: []
|
|
@@ -907,8 +942,28 @@ export default {
|
|
this.logDaterangeTime = [this.formatDate(startOfDay), this.formatDate(endOfDay)]
|
|
this.logDaterangeTime = [this.formatDate(startOfDay), this.formatDate(endOfDay)]
|
|
this.loadAreaOptions() // 加载归属区域数据
|
|
this.loadAreaOptions() // 加载归属区域数据
|
|
},
|
|
},
|
|
- methods: {
|
|
|
|
- // 根据区域代码获取区域名称
|
|
|
|
|
|
+ methods: {
|
|
|
|
+ // 处理表格属性详情点击事件
|
|
|
|
+ handleTableAttrDetail(row) {
|
|
|
|
+ try {
|
|
|
|
+ // 解析JSON格式的属性值
|
|
|
|
+ const tableData = JSON.parse(row.attrValue);
|
|
|
|
+ // 格式化表格数据,确保包含所需字段
|
|
|
|
+ this.tableDetailData = tableData.map((item, index) => ({
|
|
|
|
+ ...item,
|
|
|
|
+ name: item.name || `项目${index + 1}`,
|
|
|
|
+ key: item.key || '',
|
|
|
|
+ value: item.value || '',
|
|
|
|
+ updateTime: item.updateTime || ''
|
|
|
|
+ }));
|
|
|
|
+ // 显示弹窗
|
|
|
|
+ this.showTableDetail = true;
|
|
|
|
+ } catch (error) {
|
|
|
|
+ this.$message.error('解析表格数据失败,请检查数据格式');
|
|
|
|
+ console.error('解析表格数据失败:', error);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 根据区域代码获取区域名称
|
|
buildRefAreaName(curRow) {
|
|
buildRefAreaName(curRow) {
|
|
const area = this.areaOptions.find(a => a.id === curRow.areaCode);
|
|
const area = this.areaOptions.find(a => a.id === curRow.areaCode);
|
|
const areaName = area ? area.label : '未知区域';
|
|
const areaName = area ? area.label : '未知区域';
|