区域主控高亮
编辑时展示原有属性
This commit is contained in:
@@ -35,7 +35,9 @@
|
||||
table-layout="auto"
|
||||
row-key="id"
|
||||
default-expand-all
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
||||
:row-class-name="tableRowClassName"
|
||||
highlight-current-row>
|
||||
<el-table-column width="40"></el-table-column>
|
||||
<el-table-column prop="id" label="设备ID" min-width="80" />
|
||||
<el-table-column prop="name" label="设备名称" min-width="120" />
|
||||
@@ -163,7 +165,20 @@ export default {
|
||||
},
|
||||
|
||||
editDevice(device) {
|
||||
this.currentDevice = { ...device };
|
||||
// 处理设备数据,确保正确传递给表单
|
||||
const processedDevice = { ...device };
|
||||
|
||||
// 如果properties是字符串,则解析为对象
|
||||
if (processedDevice.properties && typeof processedDevice.properties === 'string') {
|
||||
try {
|
||||
processedDevice.properties = JSON.parse(processedDevice.properties);
|
||||
} catch (e) {
|
||||
console.error('解析properties失败:', e);
|
||||
processedDevice.properties = {};
|
||||
}
|
||||
}
|
||||
|
||||
this.currentDevice = processedDevice;
|
||||
this.isEdit = true;
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
@@ -193,6 +208,14 @@ export default {
|
||||
this.dialogVisible = false;
|
||||
// 重新加载设备列表
|
||||
await this.loadDevices();
|
||||
},
|
||||
|
||||
// 为区域主控设备添加高亮
|
||||
tableRowClassName({ row, rowIndex }) {
|
||||
if (row.type === 'area_controller') {
|
||||
return 'current-row';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user