更新设备列表请求睡眠报告混乱

This commit is contained in:
wyf
2025-07-23 15:42:49 +08:00
parent ecf1cc7ba5
commit de4745af90
4 changed files with 60 additions and 2018 deletions

View File

@@ -72,79 +72,6 @@ class _MhtSleepReportReturnPageState extends State<MhtSleepReportReturnPage> {
),
child: ValueListenableBuilder(
valueListenable: formFieldController,
// builder: (context, val, _) {
// return ClipRRect(
// borderRadius: BorderRadius.circular(36.rpx),
// child: Theme(
// data: Theme.of(context).copyWith(
// splashColor: Colors.transparent,
// highlightColor: Colors.transparent,
// hoverColor: Colors.transparent,
// ),
// child: FlutterFlowDropDown<String>(
// controller: formFieldController,
// options: deviceController.personnelList.value
// .map<String>((d) => "${d["mac"]}")
// .toList(),
// optionLabels: deviceController
// .personnelList.value
// .map<String>((d) => d["name"] ?? d["mac"])
// .toList(),
// onChanged: (val) {
// WidgetsBinding.instance
// .addPostFrameCallback((_) {
// final list =
// deviceController.personnelList.value;
// final selectedPerson = list.firstWhere(
// (element) => element['mac'] == val,
// orElse: () => null,
// );
// homeController.selectPerson.value =
// selectedPerson;
// personInfo.value = selectedPerson;
// homeController.selectedDayIndex =
// 6.obs; // 默认选第7天
// if (val == null) {
// homeController.sleepDays.value = [];
// } else {
// homeController.selectDevcie.value = val;
// deviceController.getSleeps(val);
// homeController.updateAll();
// }
// });
// },
// width: 300.rpx,
// height: 81.rpx,
// maxHeight: 300.rpx,
// textStyle: TextStyle(
// fontSize: 28.rpx,
// overflow: TextOverflow.ellipsis,
// color: Colors.white,
// ),
// hintText: '',
// icon: Icon(
// Icons.keyboard_arrow_down_rounded,
// color: stringToColor("#FFFFFF"),
// size: 30.rpx,
// ),
// fillColor: stringToColor("#011D33"),
// elevation: 2,
// borderColor: Colors.transparent,
// borderWidth: 2,
// borderRadius: 0.rpx,
// margin: EdgeInsetsDirectional.fromSTEB(
// 32.rpx, 8.rpx, 32.rpx, 8.rpx),
// hidesUnderline: true,
// isOverButton: false,
// isSearchable: false,
// isMultiSelect: false,
// ),
// ),
// );
// },
builder: (context, val, _) {
// 只保留符合 bind_mac_a/b 的人员
final macA = widget.data['bind_mac_a'];
@@ -271,32 +198,63 @@ class _MhtSleepReportReturnPageState extends State<MhtSleepReportReturnPage> {
),
),
),
// body: SafeArea(
// child: Obx(() {
// final device = homeController.selectDevcie.value;
// if (device != null && device.isNotEmpty) {
// return Column(
// children: [
// Expanded(
// child: NewSleepReportPage(
// data: {
// "tag": "444",
// 'date': DateTime.now().millisecondsSinceEpoch,
// 'mac': device,
// 'person': homeController.selectPerson.value,
// 'backgroundImg': 'assets/images/new_background.png',
// 'arrow': false,
// 'noBackImg': true,
// 'person_show': false,
// },
// ),
// ),
// ],
// );
// }
// return Center(
// child: Text('暂无数据', style: TextStyle(color: Colors.white)));
// }),
// ),
body: SafeArea(
child: Obx(() {
final device = homeController.selectDevcie.value;
if (device != null && device.isNotEmpty) {
return Column(
children: [
Expanded(
child: NewSleepReportPage(
data: {
"tag": "444",
'date': DateTime.now().millisecondsSinceEpoch,
'mac': device,
'person': homeController.selectPerson.value,
'backgroundImg': 'assets/images/new_background.png',
'arrow': false,
'noBackImg': true,
'person_show': false,
},
child: Builder(
builder: (context) {
// final device = homeController.selectDevcie.value; // 直接获取值
final device = widget.data; // 直接获取值
if (device != null && device.isNotEmpty) {
return Column(
children: [
Expanded(
child: NewSleepReportPage(
data: {
"tag": "444",
'date': DateTime.now().millisecondsSinceEpoch,
'mac': device['bind_mac_a'],
'person': homeController.selectPerson.value,
'backgroundImg': 'assets/images/new_background.png',
'arrow': false,
'noBackImg': true,
'person_show': false,
},
),
),
),
],
],
);
}
return Center(
child: Text('暂无数据', style: TextStyle(color: Colors.white)),
);
}
return Center(
child: Text('暂无数据', style: TextStyle(color: Colors.white)));
}),
},
),
),
),
),