修bug
This commit is contained in:
		| @@ -118,6 +118,7 @@ export default { | ||||
|         data.sort((a, b) => a.id - b.id); | ||||
|         this.allDevices = data; | ||||
|         this.tableData = this.buildTreeData(data); | ||||
|         console.log('Final tableData:', this.tableData); // 添加这行日志 | ||||
|         this.originalTableData = [...this.tableData]; // 保存原始顺序 | ||||
|       } catch (err) { | ||||
|         this.error = err.message || '未知错误'; | ||||
| @@ -159,7 +160,11 @@ export default { | ||||
|       return areaControllers.map(controller => { | ||||
|         const children = devices.filter(device =>  | ||||
|           device.type === 'device' && device.parent_id === controller.id | ||||
|         ); | ||||
|         ).map(childDevice => { | ||||
|           // 对于作为子设备的普通设备,确保它们没有 'children' 属性,并显式设置 hasChildren 为 false。 | ||||
|           const { children, ...rest } = childDevice;  | ||||
|           return { ...rest, hasChildren: false }; // 显式添加 hasChildren: false | ||||
|         }); | ||||
|          | ||||
|         return { | ||||
|           ...controller, | ||||
| @@ -227,7 +232,9 @@ export default { | ||||
|      | ||||
|     tableRowClassName({ row, rowIndex }) { | ||||
|       if (row.type === 'area_controller') { | ||||
|         return 'current-row'; | ||||
|         return 'is-area-controller-row'; | ||||
|       } else if (row.type === 'device') { | ||||
|         return 'is-device-row'; | ||||
|       } | ||||
|       return ''; | ||||
|     } | ||||
| @@ -292,10 +299,15 @@ export default { | ||||
| } | ||||
|  | ||||
| /* 确保区域主控设备始终高亮显示 */ | ||||
| :deep(.current-row) { | ||||
| :deep(.is-area-controller-row) { | ||||
|   background-color: #f5f7fa !important; | ||||
| } | ||||
|  | ||||
| /* 隐藏普通设备行的展开图标 */ | ||||
| :deep(.is-device-row) .el-table__expand-icon { | ||||
|   visibility: hidden; | ||||
| } | ||||
|  | ||||
| @media (max-width: 768px) { | ||||
|   .device-list { | ||||
|     padding: 10px; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user