重整多余的UI组件和未定功能的逻辑链路的修正
This commit is contained in:
@@ -26,6 +26,9 @@ class RobotDataModel {
|
||||
/// 展示位置在版本号(PRO / PLUS / STD)之前:`MC700 · PRO 旗舰版`。
|
||||
final String? deviceType;
|
||||
|
||||
/// 设备类型名称,保留接口 deviceTypeName 的原文。
|
||||
final String? deviceTypeName;
|
||||
|
||||
/// 归属信息:当前挂在哪个组织 / 场站 / 负责人下。
|
||||
///
|
||||
/// 后端 getSiteList 不一定回传这些字段,因此全部可空:
|
||||
@@ -51,6 +54,7 @@ class RobotDataModel {
|
||||
this.productName,
|
||||
this.productModel,
|
||||
this.deviceType,
|
||||
this.deviceTypeName,
|
||||
this.orgId,
|
||||
this.orgName,
|
||||
this.siteId,
|
||||
@@ -72,12 +76,13 @@ class RobotDataModel {
|
||||
|
||||
// 设备状态码(原始 status 字段)
|
||||
final statusCode = json['status'] ?? 0;
|
||||
final deviceTypeName = _pickStr(json['deviceTypeName']);
|
||||
|
||||
return RobotDataModel(
|
||||
name: json['deviceName'] ?? json['name'] ?? '',
|
||||
id: json['deviceId']?.toString() ?? json['id']?.toString() ?? '',
|
||||
alias: json['deviceAlias'] as String?, // 获取别名字段
|
||||
type: _convertType(json['deviceTypeName'] ?? json['type'] ?? '未知类型'),
|
||||
type: _convertType(deviceTypeName ?? _pickStr(json['type']) ?? '未知类型'),
|
||||
status: isOnline ? '在线' : '离线',
|
||||
isOnline: isOnline,
|
||||
statusCode: statusCode is int ? statusCode : 0,
|
||||
@@ -86,7 +91,8 @@ class RobotDataModel {
|
||||
hasHost: json['hasHost'] as bool? ?? false,
|
||||
productName: _pickStr(json['productName']),
|
||||
productModel: _pickStr(json['productModel']),
|
||||
deviceType: _pickStr(json['deviceType'] ?? json['device_type']),
|
||||
deviceType: _pickStr(json['deviceType']) ?? _pickStr(json['device_type']),
|
||||
deviceTypeName: deviceTypeName,
|
||||
orgId: _pickInt(json, const ['orgId', 'org_id', 'organizationId']),
|
||||
orgName: _pickStr(
|
||||
json['orgName'] ?? json['org_name'] ?? json['organizationName'],
|
||||
@@ -153,6 +159,7 @@ class RobotDataModel {
|
||||
'productName': productName,
|
||||
'productModel': productModel,
|
||||
'deviceType': deviceType,
|
||||
'deviceTypeName': deviceTypeName,
|
||||
'orgId': orgId,
|
||||
'orgName': orgName,
|
||||
'siteId': siteId,
|
||||
|
||||
Reference in New Issue
Block a user