Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
smart_hotel_app
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张宏
smart_hotel_app
Commits
77fb6258
Commit
77fb6258
authored
Jun 08, 2026
by
张宏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解耦
parent
a49802fa
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
348 additions
and
135 deletions
+348
-135
device_topology_bo.dart
lib/models/bo/device_topology_bo.dart
+77
-0
device_topology_repository.dart
lib/repositories/device_topology_repository.dart
+16
-0
device_topology_service.dart
lib/services/device_topology_service.dart
+18
-0
abnormal_detail_view.dart
lib/views/home/abnormal/abnormal_detail_view.dart
+1
-7
abnormal_cubit.dart
lib/views/home/abnormal/cubit/abnormal_cubit.dart
+6
-2
device_cubit.dart
lib/views/home/device/cubit/device_cubit.dart
+6
-2
device_detail_view.dart
lib/views/home/device/device_detail_view.dart
+1
-7
home_index_cubit.dart
lib/views/home/index/cubit/home_index_cubit.dart
+6
-2
index_view.dart
lib/views/home/index/index_view.dart
+1
-7
inspection_topology_cubit.dart
.../inspection_topology/cubit/inspection_topology_cubit.dart
+141
-95
inspection_topology_state.dart
.../inspection_topology/cubit/inspection_topology_state.dart
+25
-7
inspection_topology_view.dart
...ws/home/inspection_topology/inspection_topology_view.dart
+45
-3
对接方案.md
对接方案.md
+5
-3
No files found.
lib/models/bo/device_topology_bo.dart
0 → 100644
View file @
77fb6258
class
DeviceTopologyBO
{
final
DeviceTopologyInfoBO
deviceInfo
;
final
List
<
TreeNodeBO
>
treeNodes
;
const
DeviceTopologyBO
({
required
this
.
deviceInfo
,
required
this
.
treeNodes
,
});
factory
DeviceTopologyBO
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
return
DeviceTopologyBO
(
deviceInfo:
DeviceTopologyInfoBO
.
fromJson
(
json
[
'deviceInfo'
]
as
Map
<
String
,
dynamic
>?
??
{},
),
treeNodes:
(
json
[
'treeNodes'
]
as
List
<
dynamic
>?)
?.
map
((
e
)
=>
TreeNodeBO
.
fromJson
(
e
as
Map
<
String
,
dynamic
>))
.
toList
()
??
[],
);
}
}
class
DeviceTopologyInfoBO
{
final
int
deviceId
;
final
String
deviceName
;
final
String
deviceCode
;
final
String
locationText
;
const
DeviceTopologyInfoBO
({
required
this
.
deviceId
,
required
this
.
deviceName
,
required
this
.
deviceCode
,
required
this
.
locationText
,
});
factory
DeviceTopologyInfoBO
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
return
DeviceTopologyInfoBO
(
deviceId:
json
[
'deviceId'
]
as
int
?
??
0
,
deviceName:
json
[
'deviceName'
]
as
String
?
??
''
,
deviceCode:
json
[
'deviceCode'
]
as
String
?
??
''
,
locationText:
json
[
'locationText'
]
as
String
?
??
''
,
);
}
}
class
TreeNodeBO
{
final
int
deviceId
;
final
String
deviceName
;
final
String
deviceType
;
final
String
icon
;
final
String
status
;
final
String
statusText
;
final
String
deviceCode
;
const
TreeNodeBO
({
required
this
.
deviceId
,
required
this
.
deviceName
,
required
this
.
deviceType
,
required
this
.
icon
,
required
this
.
status
,
required
this
.
statusText
,
required
this
.
deviceCode
,
});
factory
TreeNodeBO
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
return
TreeNodeBO
(
deviceId:
json
[
'deviceId'
]
as
int
?
??
0
,
deviceName:
json
[
'deviceName'
]
as
String
?
??
''
,
deviceType:
json
[
'deviceType'
]
as
String
?
??
''
,
icon:
json
[
'icon'
]
as
String
?
??
''
,
status:
json
[
'status'
]
as
String
?
??
''
,
statusText:
json
[
'statusText'
]
as
String
?
??
''
,
deviceCode:
json
[
'deviceCode'
]
as
String
?
??
''
,
);
}
}
\ No newline at end of file
lib/repositories/device_topology_repository.dart
0 → 100644
View file @
77fb6258
import
'../utils/http/response_model.dart'
;
import
'../utils/http/dio_request.dart'
;
import
'../models/bo/device_topology_bo.dart'
;
class
DeviceTopologyRepository
{
/// 获取设备拓扑
Future
<
ResponseModel
<
DeviceTopologyBO
>>
getTopology
({
required
int
deviceId
})
{
return
DioRequest
.
instance
.
post
<
DeviceTopologyBO
>(
'/app/device/topology'
,
data:
{
'deviceId'
:
deviceId
},
fromJsonT:
(
data
)
=>
DeviceTopologyBO
.
fromJson
(
data
as
Map
<
String
,
dynamic
>),
);
}
}
\ No newline at end of file
lib/services/device_topology_service.dart
0 → 100644
View file @
77fb6258
import
'../models/bo/device_topology_bo.dart'
;
import
'../repositories/device_topology_repository.dart'
;
class
DeviceTopologyService
{
final
DeviceTopologyRepository
_repository
;
DeviceTopologyService
({
required
DeviceTopologyRepository
repository
})
:
_repository
=
repository
;
Future
<
DeviceTopologyBO
>
getTopology
({
required
int
deviceId
})
async
{
final
result
=
await
_repository
.
getTopology
(
deviceId:
deviceId
);
if
(
result
.
success
&&
result
.
data
!=
null
)
{
return
result
.
data
!;
}
throw
Exception
(
result
.
msg
);
}
}
\ No newline at end of file
lib/views/home/abnormal/abnormal_detail_view.dart
View file @
77fb6258
...
...
@@ -2,9 +2,7 @@ import 'package:auto_route/auto_route.dart';
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:smart_hotel_app/repositories/alert_detail_repository.dart'
;
import
'package:smart_hotel_app/routes/app_router.gr.dart'
;
import
'package:smart_hotel_app/services/alert_detail_service.dart'
;
import
'package:smart_hotel_app/views/home/abnormal/cubit/abnormal_cubit.dart'
;
import
'package:smart_hotel_app/views/home/abnormal/cubit/abnormal_state.dart'
;
import
'package:smart_hotel_app/views/home/abnormal/widget/alarm_info_block.dart'
;
...
...
@@ -20,11 +18,7 @@ class AbnormalDetailView extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
return
BlocProvider
(
create:
(
_
)
{
final
repository
=
AlertDetailRepository
();
final
service
=
AlertDetailService
(
repository:
repository
);
return
AbnormalCubit
(
service:
service
,
alertId:
alertId
);
},
create:
(
_
)
=>
AbnormalCubit
(
alertId:
alertId
),
child:
Scaffold
(
backgroundColor:
const
Color
.
fromRGBO
(
242
,
243
,
245
,
1
),
appBar:
AppBar
(
...
...
lib/views/home/abnormal/cubit/abnormal_cubit.dart
View file @
77fb6258
import
'package:fl_chart/fl_chart.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:smart_hotel_app/models/bo/alert_detail_bo.dart'
;
import
'package:smart_hotel_app/repositories/alert_detail_repository.dart'
;
import
'package:smart_hotel_app/services/alert_detail_service.dart'
;
import
'package:smart_hotel_app/views/home/abnormal/cubit/abnormal_state.dart'
;
...
...
@@ -9,9 +10,12 @@ class AbnormalCubit extends Cubit<AbnormalState> {
final
int
_alertId
;
AbnormalCubit
({
required
AlertDetailService
service
,
AlertDetailService
?
service
,
required
int
alertId
,
})
:
_service
=
service
,
})
:
_service
=
service
??
AlertDetailService
(
repository:
AlertDetailRepository
(),
),
_alertId
=
alertId
,
super
(
const
AbnormalState
())
{
loadDetail
();
...
...
lib/views/home/device/cubit/device_cubit.dart
View file @
77fb6258
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:smart_hotel_app/models/bo/device_control_bo.dart'
;
import
'package:smart_hotel_app/repositories/device_control_repository.dart'
;
import
'package:smart_hotel_app/services/device_control_service.dart'
;
import
'package:smart_hotel_app/views/home/device/cubit/device_state.dart'
;
...
...
@@ -8,9 +9,12 @@ class DeviceCubit extends Cubit<DeviceState> {
final
int
_deviceId
;
DeviceCubit
({
required
DeviceControlService
service
,
DeviceControlService
?
service
,
required
int
deviceId
,
})
:
_service
=
service
,
})
:
_service
=
service
??
DeviceControlService
(
repository:
DeviceControlRepository
(),
),
_deviceId
=
deviceId
,
super
(
const
DeviceState
())
{
loadDetail
();
...
...
lib/views/home/device/device_detail_view.dart
View file @
77fb6258
...
...
@@ -2,8 +2,6 @@ import 'package:auto_route/auto_route.dart';
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:smart_hotel_app/repositories/device_control_repository.dart'
;
import
'package:smart_hotel_app/services/device_control_service.dart'
;
import
'package:smart_hotel_app/views/home/device/cubit/device_cubit.dart'
;
import
'package:smart_hotel_app/views/home/device/cubit/device_state.dart'
;
import
'package:smart_hotel_app/views/home/device/widget/device_parms_block.dart'
;
...
...
@@ -19,11 +17,7 @@ class DeviceDetailView extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
return
BlocProvider
(
create:
(
_
)
{
final
repository
=
DeviceControlRepository
();
final
service
=
DeviceControlService
(
repository:
repository
);
return
DeviceCubit
(
service:
service
,
deviceId:
deviceId
);
},
create:
(
_
)
=>
DeviceCubit
(
deviceId:
deviceId
),
child:
Scaffold
(
backgroundColor:
const
Color
.
fromRGBO
(
242
,
243
,
245
,
1
),
appBar:
AppBar
(
...
...
lib/views/home/index/cubit/home_index_cubit.dart
View file @
77fb6258
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:smart_hotel_app/models/bo/alert_dashboard_bo.dart'
;
import
'package:smart_hotel_app/repositories/alert_dashboard_repository.dart'
;
import
'package:smart_hotel_app/services/alert_dashboard_service.dart'
;
import
'package:smart_hotel_app/views/home/index/cubit/home_index_state.dart'
;
class
HomeIndexCubit
extends
Cubit
<
HomeIndexState
>
{
final
AlertDashboardService
_service
;
HomeIndexCubit
({
required
AlertDashboardService
service
})
:
_service
=
service
,
HomeIndexCubit
({
AlertDashboardService
?
service
})
:
_service
=
service
??
AlertDashboardService
(
repository:
AlertDashboardRepository
(),
),
super
(
const
HomeIndexState
())
{
loadDashboard
();
}
...
...
lib/views/home/index/index_view.dart
View file @
77fb6258
...
...
@@ -3,8 +3,6 @@ import 'package:flutter/material.dart';
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:smart_hotel_app/models/bo/alert_dashboard_bo.dart'
;
import
'package:smart_hotel_app/repositories/alert_dashboard_repository.dart'
;
import
'package:smart_hotel_app/services/alert_dashboard_service.dart'
;
import
'package:smart_hotel_app/views/home/index/cubit/home_index_cubit.dart'
;
import
'package:smart_hotel_app/views/home/index/cubit/home_index_state.dart'
;
import
'package:smart_hotel_app/views/home/index/widget/equipment_list_block.dart'
;
...
...
@@ -20,11 +18,7 @@ class HomeView extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
return
BlocProvider
(
create:
(
_
)
{
final
repository
=
AlertDashboardRepository
();
final
service
=
AlertDashboardService
(
repository:
repository
);
return
HomeIndexCubit
(
service:
service
);
},
create:
(
_
)
=>
HomeIndexCubit
(),
child:
LayoutBuilder
(
builder:
(
context
,
constraints
)
{
return
SingleChildScrollView
(
...
...
lib/views/home/inspection_topology/cubit/inspection_topology_cubit.dart
View file @
77fb6258
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:smart_hotel_app/models/bo/device_topology_bo.dart'
;
import
'package:smart_hotel_app/repositories/device_topology_repository.dart'
;
import
'package:smart_hotel_app/services/device_topology_service.dart'
;
import
'inspection_topology_state.dart'
;
class
InspectionTopologyCubit
extends
Cubit
<
InspectionTopologyState
>
{
InspectionTopologyCubit
()
:
super
(
const
InspectionTopologyState
(
deviceName:
''
,
deviceModel:
''
,
topologyNodes:
[],
))
{
_loadTopologyData
();
final
DeviceTopologyService
_service
;
final
int
_deviceId
;
InspectionTopologyCubit
({
DeviceTopologyService
?
service
,
required
int
deviceId
,
})
:
_service
=
service
??
DeviceTopologyService
(
repository:
DeviceTopologyRepository
(),
),
_deviceId
=
deviceId
,
super
(
const
InspectionTopologyState
())
{
loadTopology
();
}
void
selectNode
(
TopologyNode
?
node
)
{
emit
(
state
.
copyWith
(
selectedNode:
node
));
}
void
_loadTopologyData
()
{
Future
<
void
>
loadTopology
()
async
{
emit
(
const
InspectionTopologyState
(
isLoading:
true
));
try
{
final
topology
=
await
_service
.
getTopology
(
deviceId:
_deviceId
);
_emitFromTopology
(
topology
);
}
catch
(
e
)
{
emit
(
InspectionTopologyState
(
error:
e
.
toString
()));
}
}
void
_emitFromTopology
(
DeviceTopologyBO
topology
)
{
final
info
=
topology
.
deviceInfo
;
final
nodes
=
topology
.
treeNodes
;
final
rootNode
=
_buildTopologyTree
(
nodes
);
// 计算连接数: 父节点到每个子节点一条连接
int
connectionCount
=
0
;
for
(
final
child
in
rootNode
.
children
)
{
connectionCount
++;
// 根到子
connectionCount
+=
child
.
children
.
length
;
// 子到孙
}
emit
(
InspectionTopologyState
(
deviceName:
info
.
deviceName
,
deviceModel:
'
${info.deviceCode}
·
${info.locationText}
'
,
topologyNodes:
[
rootNode
],
deviceCount:
_countAllNodes
(
rootNode
),
connectionCount:
connectionCount
,
));
}
/// 将 API 返回的扁平节点列表转换为树结构 + 自动计算位置
TopologyNode
_buildTopologyTree
(
List
<
TreeNodeBO
>
nodes
)
{
if
(
nodes
.
isEmpty
)
{
return
TopologyNode
(
id:
'0'
,
name:
'未知设备'
,
status:
'offline'
,
children:
[],
x:
0.5
,
y:
0.15
,
);
}
// 第一个节点作为根节点
final
root
=
nodes
.
first
;
final
children
=
nodes
.
length
>
1
?
nodes
.
sublist
(
1
)
:
<
TreeNodeBO
>[];
// 如果子节点 <= 6,平分到第二层;否则将前6个放第二层,其余作为叶子
final
int
maxLevel2
=
6
;
final
level2Nodes
=
children
.
take
(
maxLevel2
).
toList
();
final
leafNodes
=
children
.
length
>
maxLevel2
?
children
.
sublist
(
maxLevel2
)
:
<
TreeNodeBO
>[];
final
rootNode
=
TopologyNode
(
id:
'1'
,
name:
'智能空开'
,
status:
'online'
,
id:
root
.
deviceId
.
toString
()
,
name:
root
.
deviceName
,
status:
root
.
status
,
x:
0.5
,
y:
0.15
,
children:
[
TopologyNode
(
id:
'2'
,
name:
'串口分配器'
,
status:
'online'
,
x:
0.25
,
children:
level2Nodes
.
asMap
().
entries
.
map
((
entry
)
{
final
idx
=
entry
.
key
;
final
node
=
entry
.
value
;
// 在第二层均匀分布
final
xPos
=
(
level2Nodes
.
length
==
1
)
?
0.5
:
0.15
+
(
0.7
*
idx
/
(
level2Nodes
.
length
-
1
));
return
TopologyNode
(
id:
node
.
deviceId
.
toString
(),
name:
node
.
deviceName
,
status:
node
.
status
,
x:
xPos
,
y:
0.45
,
children:
[
TopologyNode
(
id:
'5'
,
name:
'环境采集'
,
status:
'online'
,
x:
0.15
,
y:
0.75
,
children:
[],
),
TopologyNode
(
id:
'6'
,
name:
'人体存在'
,
status:
'online'
,
x:
0.35
,
y:
0.75
,
children:
[],
),
],
),
TopologyNode
(
id:
'3'
,
name:
'网关'
,
status:
'online'
,
x:
0.5
,
y:
0.45
,
children:
[
TopologyNode
(
id:
'7'
,
name:
'环境采集'
,
status:
'online'
,
x:
0.45
,
y:
0.75
,
children:
[],
),
TopologyNode
(
id:
'8'
,
name:
'人体存在'
,
status:
'online'
,
x:
0.55
,
y:
0.75
,
children:
[],
),
],
),
TopologyNode
(
id:
'4'
,
name:
'WIFI'
,
status:
'online'
,
x:
0.75
,
y:
0.45
,
children:
[
TopologyNode
(
id:
'9'
,
name:
'环境采集'
,
status:
'online'
,
x:
0.65
,
y:
0.75
,
children:
[],
),
TopologyNode
(
id:
'10'
,
name:
'人体存在'
,
status:
'online'
,
x:
0.85
,
y:
0.75
,
children:
[],
),
],
),
],
children:
[],
);
}).
toList
(),
);
emit
(
InspectionTopologyState
(
deviceName:
'客房305 智能空开'
,
deviceModel:
'A-301智能空开·客房301'
,
topologyNodes:
[
rootNode
],
deviceCount:
10
,
connectionCount:
11
,
));
// 补充叶子节点:附着到最近的第二层节点上
if
(
leafNodes
.
isNotEmpty
&&
rootNode
.
children
.
isNotEmpty
)
{
final
leafNode
=
leafNodes
.
first
;
final
lastLevel2Idx
=
rootNode
.
children
.
length
-
1
;
final
lastLevel2
=
rootNode
.
children
[
lastLevel2Idx
];
final
updatedChildren
=
List
<
TopologyNode
>.
from
(
rootNode
.
children
);
updatedChildren
[
lastLevel2Idx
]
=
TopologyNode
(
id:
lastLevel2
.
id
,
name:
lastLevel2
.
name
,
status:
lastLevel2
.
status
,
x:
lastLevel2
.
x
,
y:
lastLevel2
.
y
,
children:
leafNodes
.
asMap
().
entries
.
map
((
entry
)
{
final
idx
=
entry
.
key
;
final
leaf
=
entry
.
value
;
final
xPos
=
(
leafNodes
.
length
==
1
)
?
lastLevel2
.
x
:
lastLevel2
.
x
-
0.1
+
(
0.2
*
idx
/
(
leafNodes
.
length
-
1
));
return
TopologyNode
(
id:
leaf
.
deviceId
.
toString
(),
name:
leaf
.
deviceName
,
status:
leaf
.
status
,
x:
xPos
,
y:
0.75
,
children:
[],
);
}).
toList
(),
);
return
TopologyNode
(
id:
rootNode
.
id
,
name:
rootNode
.
name
,
status:
rootNode
.
status
,
x:
rootNode
.
x
,
y:
rootNode
.
y
,
children:
updatedChildren
,
);
}
return
rootNode
;
}
int
_countAllNodes
(
TopologyNode
node
)
{
int
count
=
1
;
for
(
final
child
in
node
.
children
)
{
count
+=
_countAllNodes
(
child
);
}
return
count
;
}
}
}
\ No newline at end of file
lib/views/home/inspection_topology/cubit/inspection_topology_state.dart
View file @
77fb6258
...
...
@@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
import
'package:equatable/equatable.dart'
;
class
InspectionTopologyState
extends
Equatable
{
final
bool
isLoading
;
final
String
?
error
;
final
String
deviceName
;
final
String
deviceModel
;
final
List
<
TopologyNode
>
topologyNodes
;
...
...
@@ -10,15 +12,19 @@ class InspectionTopologyState extends Equatable {
final
TopologyNode
?
selectedNode
;
const
InspectionTopologyState
({
required
this
.
deviceName
,
required
this
.
deviceModel
,
required
this
.
topologyNodes
,
this
.
deviceCount
=
10
,
this
.
connectionCount
=
11
,
this
.
isLoading
=
false
,
this
.
error
,
this
.
deviceName
=
''
,
this
.
deviceModel
=
''
,
this
.
topologyNodes
=
const
[],
this
.
deviceCount
=
0
,
this
.
connectionCount
=
0
,
this
.
selectedNode
,
});
InspectionTopologyState
copyWith
({
bool
?
isLoading
,
String
?
error
,
String
?
deviceName
,
String
?
deviceModel
,
List
<
TopologyNode
>?
topologyNodes
,
...
...
@@ -27,6 +33,8 @@ class InspectionTopologyState extends Equatable {
TopologyNode
?
selectedNode
,
})
{
return
InspectionTopologyState
(
isLoading:
isLoading
??
this
.
isLoading
,
error:
error
,
deviceName:
deviceName
??
this
.
deviceName
,
deviceModel:
deviceModel
??
this
.
deviceModel
,
topologyNodes:
topologyNodes
??
this
.
topologyNodes
,
...
...
@@ -37,7 +45,16 @@ class InspectionTopologyState extends Equatable {
}
@override
List
<
Object
?>
get
props
=>
[
deviceName
,
deviceModel
,
topologyNodes
,
deviceCount
,
connectionCount
,
selectedNode
];
List
<
Object
?>
get
props
=>
[
isLoading
,
error
,
deviceName
,
deviceModel
,
topologyNodes
,
deviceCount
,
connectionCount
,
selectedNode
,
];
}
class
TopologyNode
extends
Equatable
{
...
...
@@ -59,4 +76,4 @@ class TopologyNode extends Equatable {
@override
List
<
Object
?>
get
props
=>
[
id
,
name
,
status
,
children
,
x
,
y
];
}
}
\ No newline at end of file
lib/views/home/inspection_topology/inspection_topology_view.dart
View file @
77fb6258
...
...
@@ -11,12 +11,14 @@ import 'widget/device_detail_dialog.dart';
@RoutePage
()
class
InspectionTopologyView
extends
StatelessWidget
{
const
InspectionTopologyView
({
super
.
key
});
final
int
deviceId
;
const
InspectionTopologyView
({
super
.
key
,
this
.
deviceId
=
0
});
@override
Widget
build
(
BuildContext
context
)
{
return
BlocProvider
(
create:
(
_
)
=>
InspectionTopologyCubit
(),
create:
(
_
)
=>
InspectionTopologyCubit
(
deviceId:
deviceId
),
child:
const
InspectionTopologyPage
(),
);
}
...
...
@@ -51,6 +53,45 @@ class InspectionTopologyPage extends StatelessWidget {
),
body:
BlocBuilder
<
InspectionTopologyCubit
,
InspectionTopologyState
>(
builder:
(
context
,
state
)
{
if
(
state
.
isLoading
)
{
return
const
Center
(
child:
CircularProgressIndicator
(),
);
}
if
(
state
.
error
!=
null
)
{
return
Center
(
child:
Padding
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
28
.
w
),
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
[
Text
(
state
.
error
!,
style:
TextStyle
(
fontSize:
28
.
sp
,
color:
const
Color
.
fromRGBO
(
239
,
68
,
68
,
1
),
),
textAlign:
TextAlign
.
center
,
),
SizedBox
(
height:
24
.
h
),
ElevatedButton
(
onPressed:
()
{
context
.
read
<
InspectionTopologyCubit
>()
.
loadTopology
();
},
child:
Text
(
'重新加载'
,
style:
TextStyle
(
fontSize:
28
.
sp
),
),
),
],
),
),
);
}
return
Stack
(
children:
[
SingleChildScrollView
(
...
...
@@ -86,4 +127,4 @@ class InspectionTopologyPage extends StatelessWidget {
),
);
}
}
}
\ No newline at end of file
对接方案.md
View file @
77fb6258
# 智慧酒
店 App 接口对接方案
# 智慧酒
店 App 接口对接方案
...
...
@@ -192,6 +192,8 @@ class xxxBO extends Equatable {
|
设备拓扑 |GET | /app/device/topology | 未对接 | 设备拓扑 | 相关页面:InspectionTopologyView |
#
## 3.2 接口详细定义
...
...
@@ -467,13 +469,13 @@ class xxxBO extends Equatable {
"code": 0,
"msg": "string",
"data": {
"deviceInfo": {
"deviceInfo": {
// 当前设备信息
"deviceId": 0,
"deviceName": "string",
"deviceCode": "string",
"locationText": "string"
},
"treeNodes": [
"treeNodes": [
// 拓扑节点列表(上下游关联设备)
{
"deviceId": 0,
"deviceName": "string",
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment