设备 预约接口

This commit is contained in:
czz
2025-06-12 17:38:31 +08:00
parent d5c3addd4a
commit d8b46c41ad
13 changed files with 267 additions and 521 deletions

View File

@@ -1,18 +1,40 @@
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/color/ServiceConstant.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/base/THFlutterFlowDropDown.dart';
import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
class DevicePeopleInfo extends StatelessWidget {
DevicePeopleInfo({super.key});
class DevicePeopleInfo extends GetView {
Map data;
DevicePeopleInfo({required this.data});
get glController => Get.find<GlobalController>();
get bodyData => glController.model.mainDevicePeople;
// get glController => Get.find<GlobalController>();
// get bodyData => glController.model.mainDevicePeople;
RxList<dynamic> peopleList = <dynamic>[].obs;
Future<void> devicePeopleInfo() async {
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.person_info;
String queryUrl =
"$serviceAddress$serviceName$serviceApi?mac=${data["mac"]}";
requestWithLog(
logTitle: "获取设备的人员信息列表",
method: MyHttpMethod.get,
queryUrl: queryUrl,
onSuccess: (res) {
if (res.data != null && res.data is List) {
peopleList.assignAll(res.data);
print("peopleList: $peopleList");
}
},
);
}
getInfoRow(context, String str) {
return Container(
@@ -34,6 +56,11 @@ class DevicePeopleInfo extends StatelessWidget {
@override
Widget build(BuildContext context) {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (data["device_type"] == 1 && peopleList.isEmpty) {
devicePeopleInfo();
}
});
return LayoutBuilder(
builder: (context, boxConstraints) => GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
@@ -104,8 +131,8 @@ class DevicePeopleInfo extends StatelessWidget {
mainAxisSize: MainAxisSize.max,
children: [
ClickableContainer(
backgroundColor: Color(0xFF003058),
highlightColor: Color(0xFF036060),
backgroundColor: Color(0xFFFF036060),
highlightColor: Colors.transparent,
borderRadius: 16.rpx,
padding: EdgeInsets.fromLTRB(
30.rpx, 20.rpx, 0, 20.rpx),
@@ -130,127 +157,74 @@ class DevicePeopleInfo extends StatelessWidget {
),
),
),
getInfoRow(
context, "名称:${data["name"] ?? "-"}"),
getInfoRow(context,
"名称${glController.getDeviceGroupName2(glController.model.deviceMain)}"),
getInfoRow(context,
"房间:${glController.model.deviceMain["roomName"] ?? "-"}"),
getInfoRow(context,
"网络:${glController.model.deviceMain["status"] ?? "-"}"),
getInfoRow(context,
"MAC${glController.model.deviceMain["mac"] ?? "-"}"),
"房间${data["roomName"] ?? "-"}"),
getInfoRow(
context,
"网络:${data["status"]?["status"] == 1 ? "在线" : data["status"]?["status"] == 0 ? "不在线" : "-"}",
),
getInfoRow(
context, "MAC${data["mac"] ?? "-"}"),
],
),
)),
...List.generate(
"${glController.model.deviceMain["bindMacB"]}"
.length >
6
? 2
: 1, (index) {
String location_ = "";
if ("${glController.model.deviceMain["bindMacB"]}"
.length >
6 &&
(glController.model.mainDevicePeople[0]
?["direction"] ==
1 ||
glController.model.mainDevicePeople[1]
?["direction"] ==
1)) {
location_ =
"${glController.model.mainDevicePeople[index]?["direction"] == 1 ? '左侧' : '右侧'}";
}
// return Container(
// decoration: BoxDecoration(
// color: Color(0xFF003058),
// borderRadius: BorderRadius.circular(16.rpx),
// ),
// child: Padding(
// padding: EdgeInsets.symmetric(
// horizontal: 30.rpx),
// child: Column(
// children: [
// Container(
// width: double.infinity,
// margin: EdgeInsets.only(
// bottom: 30.rpx, top: 50.rpx),
// decoration: BoxDecoration(),
// child: Text(
// '人员资料${index == 0 ? "A" : "B"}',
// style: FlutterFlowTheme.of(context)
// .bodyMedium
// .override(
// fontFamily: 'Readex Pro',
// color: Colors.white,
// fontSize: 32.rpx,
// letterSpacing: 0,
// ),
// ),
// ),
// if (location_.isNotEmpty)
// getInfoRow(
// context, "校准位置:$location_"),
// getInfoRow(context,
// "姓名:${bodyData[index]["name"] ?? "-"}"),
// getInfoRow(context,
// "性别:${bodyData[index]["gender"] == null ? "-" : (bodyData[index]["gender"] == 1 ? "男" : "女")}"),
// getInfoRow(context,
// "身高:${bodyData[index]["height"] == null ? "-" : "${bodyData[index]["height"]}cm"}"),
// getInfoRow(context,
// "体重:${bodyData[index]["weight"] == null ? "-" : "${bodyData[index]["weight"]}kg"}"),
// getInfoRow(context,
// "生日:${bodyData[index]["birthday"] == null ? "-" : (time_08_Formatter_pattern(bodyData[index]["birthday"], "yyyy年MM月dd日"))}"),
// getInfoRow(context,
// "电话:${bodyData[index]["tel"] ?? "-"}"),
// getInfoRow(context,
// "紧急联系人:${bodyData[index]["contact"] ?? "-"}"),
// ],
// )));
if (data["device_type"] == 1 && peopleList.isNotEmpty)
...List.generate(peopleList.length, (index) {
final person = peopleList[index];
String location_ = '';
if ("${data["bindMacB"]}".length > 6 &&
(person["direction"] == 1 ||
person["direction"] == 2)) {
location_ =
person["direction"] == 1 ? '左侧' : '右侧';
}
return ClickableContainer(
backgroundColor: Color(0xFF003058),
highlightColor: Color(0xFF036060),
borderRadius: 16.rpx,
padding: EdgeInsets.fromLTRB(
30.rpx, 20.rpx, 30.rpx, 20.rpx),
onTap: () {},
child: Column(
children: [
Container(
width: double.infinity,
alignment: Alignment.centerLeft,
child: Text(
'人员资料${index == 0 ? "A" : "B"}',
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color: Colors.white,
fontSize: 32.rpx,
letterSpacing: 0,
),
return ClickableContainer(
backgroundColor: Color(0xFF003058),
highlightColor: Color(0xFF036060),
borderRadius: 16.rpx,
padding: EdgeInsets.fromLTRB(
30.rpx, 20.rpx, 30.rpx, 20.rpx),
onTap: () {},
child: Column(
children: [
Container(
width: double.infinity,
alignment: Alignment.centerLeft,
child: Text(
'人员资料${index == 0 ? "A" : "B"}',
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color: Colors.white,
fontSize: 32.rpx,
letterSpacing: 0,
),
),
),
),
if (location_.isNotEmpty)
getInfoRow(context, "校准位置:$location_"),
getInfoRow(context,
"姓名:${bodyData[index]["name"] ?? "-"}"),
getInfoRow(context,
"性别:${bodyData[index]["gender"] == null ? "-" : (bodyData[index]["gender"] == 1 ? "" : "")}"),
getInfoRow(context,
"身高:${bodyData[index]["height"] == null ? "-" : "${bodyData[index]["height"]}cm"}"),
getInfoRow(context,
"体重:${bodyData[index]["weight"] == null ? "-" : "${bodyData[index]["weight"]}kg"}"),
getInfoRow(context,
"生日:${bodyData[index]["birthday"] == null ? "-" : (time_08_Formatter_pattern(bodyData[index]["birthday"], "yyyy年MM月dd日"))}"),
getInfoRow(context,
"电话:${bodyData[index]["tel"] ?? "-"}"),
getInfoRow(context,
"紧急联系人:${bodyData[index]["contact"] ?? "-"}"),
],
),
);
})
if (location_.isNotEmpty)
getInfoRow(context, "校准位置:$location_"),
getInfoRow(
context, "姓名:${person["name"] ?? "-"}"),
getInfoRow(context,
"性别:${person["gender"] == null ? "-" : (person["gender"] == 1 ? "" : "")}"),
getInfoRow(context,
"身高:${person["height"] == null ? "-" : "${person["height"]}cm"}"),
getInfoRow(context,
"体重:${person["weight"] == null ? "-" : "${person["weight"]}kg"}"),
getInfoRow(context,
"生日:${person["birthday"] == null ? "-" : time_08_Formatter_pattern(person["birthday"], "yyyy年MM月dd日")}"),
getInfoRow(
context, "电话:${person["tel"] ?? "-"}"),
getInfoRow(context,
"紧急联系人:${person["contact"] ?? "-"}"),
],
),
);
})
].divide(SizedBox(
height: 25.rpx,
)),