更新快检功能
This commit is contained in:
@@ -99,6 +99,7 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
|
||||
|
||||
final allTexts = [
|
||||
"体征检测设备.首页展示".tr,
|
||||
"体征检测设备.人员资料".tr,
|
||||
"体征检测设备.设备详情".tr,
|
||||
"WIFI配置".tr,
|
||||
"设备校准".tr,
|
||||
@@ -286,6 +287,69 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
|
||||
? themeController.currentColor.sc2
|
||||
: themeController.currentColor.sc3,
|
||||
),
|
||||
_buildMenuItem(
|
||||
text: "人员资料.标题".tr,
|
||||
onTap: () async {
|
||||
setState(() {
|
||||
_isPopupOpen = false;
|
||||
});
|
||||
_popupEntry?.remove();
|
||||
_popupEntry = null;
|
||||
if (widget.device['person'] != null) {
|
||||
personController.currentPersonId.value = widget.device['_id'];
|
||||
personController.name.value = widget.device['person']['name'];
|
||||
personController.update_person_mac.value = widget.device['mac'];
|
||||
personController.gender.value =
|
||||
widget.device['person']['gender'] ?? 1;
|
||||
personController.weight?.value =
|
||||
widget.device['person']['weight'] == null
|
||||
? ''
|
||||
: widget.device['person']['weight'].toString();
|
||||
|
||||
personController.height.value =
|
||||
widget.device['person']['height'] == null
|
||||
? ''
|
||||
: widget.device['person']['height'].toString();
|
||||
|
||||
personController.selectedDiseaseIds.value =
|
||||
widget.device['person']['disease'] ?? [];
|
||||
personController.birthday.value =
|
||||
widget.device['person']['birthday'] ?? '';
|
||||
personController.dateTime =
|
||||
MyUtils.formatBirthdayTime(widget.device['person']['birthday']);
|
||||
personController.timeZone.value =
|
||||
widget.device['person']['UTC'] ?? '';
|
||||
if (widget.device['person']['city_id'] != null) {
|
||||
// 根据city_id查找完整的城市数据
|
||||
final int cityId = widget.device['person']['city_id'];
|
||||
await initializeCityData();
|
||||
final CityModel? completeCityData = _findCityDataById(cityId);
|
||||
|
||||
if (completeCityData != null) {
|
||||
personController.cityModel = completeCityData;
|
||||
} else {
|
||||
personController.cityModel = null;
|
||||
}
|
||||
} else {
|
||||
personController.cityModel = null;
|
||||
}
|
||||
} else {
|
||||
personController.update_person_mac.value = widget.device['mac'];
|
||||
personController.currentPersonId.value = widget.device['_id'];
|
||||
personController.name.value = "";
|
||||
personController.gender.value = 1;
|
||||
personController.dateTime = null;
|
||||
personController.height.value = "";
|
||||
personController.weight.value = "";
|
||||
personController.diseaseList.value = [];
|
||||
personController.cityModel = null;
|
||||
personController.timeZone.value = "";
|
||||
}
|
||||
await Get.toNamed("/updatePersonPage",
|
||||
arguments: widget.device['bind_type']);
|
||||
bodyDeviceController.getDeviceList();
|
||||
},
|
||||
),
|
||||
_buildMenuItem(
|
||||
text: "体征检测设备.设备详情".tr,
|
||||
onTap: () {
|
||||
@@ -1158,69 +1222,8 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
|
||||
child: CustomCard(
|
||||
borderRadius: AppConstants().button_container_radius,
|
||||
onTap: () async {
|
||||
if (widget.device['person'] != null) {
|
||||
personController.currentPersonId.value =
|
||||
widget.device['_id'];
|
||||
personController.name.value =
|
||||
widget.device['person']['name'];
|
||||
personController.update_person_mac.value =
|
||||
widget.device['mac'];
|
||||
personController.gender.value =
|
||||
widget.device['person']['gender'] ?? 1;
|
||||
personController.weight?.value =
|
||||
widget.device['person']['weight'] == null
|
||||
? ''
|
||||
: widget.device['person']['weight']
|
||||
.toString();
|
||||
|
||||
personController.height.value =
|
||||
widget.device['person']['height'] == null
|
||||
? ''
|
||||
: widget.device['person']['height']
|
||||
.toString();
|
||||
|
||||
personController.selectedDiseaseIds.value =
|
||||
widget.device['person']['disease'] ?? [];
|
||||
personController.birthday.value =
|
||||
widget.device['person']['birthday'] ?? '';
|
||||
personController.dateTime =
|
||||
MyUtils.formatBirthdayTime(
|
||||
widget.device['person']['birthday']);
|
||||
personController.timeZone.value =
|
||||
widget.device['person']['UTC'] ?? '';
|
||||
if (widget.device['person']['city_id'] != null) {
|
||||
// 根据city_id查找完整的城市数据
|
||||
final int cityId =
|
||||
widget.device['person']['city_id'];
|
||||
await initializeCityData();
|
||||
final CityModel? completeCityData =
|
||||
_findCityDataById(cityId);
|
||||
|
||||
if (completeCityData != null) {
|
||||
personController.cityModel = completeCityData;
|
||||
} else {
|
||||
personController.cityModel = null;
|
||||
}
|
||||
} else {
|
||||
personController.cityModel = null;
|
||||
}
|
||||
} else {
|
||||
personController.update_person_mac.value =
|
||||
widget.device['mac'];
|
||||
personController.currentPersonId.value =
|
||||
widget.device['_id'];
|
||||
personController.name.value = "";
|
||||
personController.gender.value = 1;
|
||||
personController.dateTime = null;
|
||||
personController.height.value = "";
|
||||
personController.weight.value = "";
|
||||
personController.diseaseList.value = [];
|
||||
personController.cityModel = null;
|
||||
personController.timeZone.value = "";
|
||||
}
|
||||
await Get.toNamed("/updatePersonPage",
|
||||
arguments: widget.device['bind_type']);
|
||||
bodyDeviceController.getDeviceList();
|
||||
await Get.toNamed("/healthCheckPage",
|
||||
arguments: widget.device);
|
||||
},
|
||||
colors: [
|
||||
themeController.currentColor.sc1,
|
||||
@@ -1241,7 +1244,7 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"体征检测设备.人员资料".tr,
|
||||
"健康快检".tr,
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontFamily: 'Inter',
|
||||
|
||||
234
lib/pages/device/component/HealthReportCard.dart
Normal file
234
lib/pages/device/component/HealthReportCard.dart
Normal file
@@ -0,0 +1,234 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
||||
import 'package:vbvs_app/component/tool/NewTopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/device/device_share_controller.dart';
|
||||
import 'package:vbvs_app/controller/device/device_type_controller.dart';
|
||||
import 'package:vbvs_app/controller/message/message_controller.dart';
|
||||
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
|
||||
class HealthReportCardWidget extends StatefulWidget {
|
||||
final data;
|
||||
|
||||
const HealthReportCardWidget({super.key, required this.data});
|
||||
|
||||
@override
|
||||
State<HealthReportCardWidget> createState() => _HealthReportCardWidgetState();
|
||||
}
|
||||
|
||||
class _HealthReportCardWidgetState extends State<HealthReportCardWidget> {
|
||||
ThemeController themeController = Get.find();
|
||||
MessageController messageController = Get.find();
|
||||
DeviceShareController deviceShareController = Get.find();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var reportData = widget.data;
|
||||
return ClickableContainer(
|
||||
backgroundColor: themeController.currentColor.sc5,
|
||||
highlightColor: themeController.currentColor.sc21,
|
||||
borderRadius: 20.rpx,
|
||||
padding: EdgeInsetsDirectional.fromSTEB(31.rpx, 30.rpx, 31.rpx, 33.rpx),
|
||||
onTap: () {},
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
// Container(
|
||||
// width: double.infinity,
|
||||
// constraints: BoxConstraints(
|
||||
// minHeight: 66.rpx,
|
||||
// ),
|
||||
// child: Align(
|
||||
// alignment: AlignmentDirectional(-1, 0),
|
||||
// child: Text(
|
||||
// reportData['name'] ?? '健康报告',
|
||||
// style: TextStyle(
|
||||
// fontFamily: 'Inter',
|
||||
// fontSize: 30.rpx,
|
||||
// letterSpacing: 0.0,
|
||||
// color: themeController.currentColor.sc3,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 左侧标签列
|
||||
Container(
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 30.rpx,
|
||||
maxWidth: 140.rpx,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildInfoItem(context, '姓名'.tr),
|
||||
_buildInfoItem(context, '设备ID'.tr),
|
||||
_buildInfoItem(context, '快检得分'.tr),
|
||||
_buildInfoItem(context, '创建时间'.tr),
|
||||
],
|
||||
),
|
||||
),
|
||||
// 右侧数值列
|
||||
Expanded(
|
||||
child: Container(
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 30.rpx,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildValueItem(context, reportData['name'] ?? '--'),
|
||||
_buildValueItem(context, reportData['mac'] ?? '--'),
|
||||
_buildValueItem(
|
||||
context, '${reportData['score'] ?? '--'}分'),
|
||||
_buildValueRowWithButton(
|
||||
context,
|
||||
_formatTime(reportData['create_time']),
|
||||
onViewTap: () async {
|
||||
// 查看按钮点击事件
|
||||
String ID = reportData['id'];
|
||||
DeviceTypeController deviceTypeController =
|
||||
Get.find();
|
||||
await deviceTypeController.getCheckHistory(id: ID);
|
||||
if (deviceTypeController.currentCq.value == null ||
|
||||
deviceTypeController.currentCq.value.isEmpty) {
|
||||
NewTopSlideNotification.show(
|
||||
text: "未找到快检报告".tr,
|
||||
textColor: themeController.currentColor.sc9);
|
||||
return;
|
||||
}
|
||||
_onViewReport(deviceTypeController.currentCq.value);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 35.rpx)),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildInfoItem(BuildContext context, label) {
|
||||
return Container(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 62.rpx,
|
||||
),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(-1, 0),
|
||||
child: Text(
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 1,
|
||||
"$label",
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController.currentColor.sc4,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildValueItem(BuildContext context, value) {
|
||||
return Container(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 62.rpx,
|
||||
),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(-1, 0),
|
||||
child: Text(
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 1,
|
||||
"$value",
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 创建时间行,包含时间和查看按钮
|
||||
Widget _buildValueRowWithButton(BuildContext context, String value,
|
||||
{required VoidCallback onViewTap}) {
|
||||
return Container(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 62.rpx,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 1,
|
||||
value,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
// 查看按钮
|
||||
ClickableContainer(
|
||||
onTap: onViewTap,
|
||||
borderRadius: 50.rpx,
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 26.rpx,
|
||||
vertical: 6.rpx,
|
||||
),
|
||||
backgroundColor: themeController.currentColor.sc2,
|
||||
highlightColor: Colors.transparent,
|
||||
child: Text(
|
||||
'查看',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 24.rpx,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 查看报告的方法
|
||||
void _onViewReport(Map reportData) {
|
||||
// TODO: 实现查看报告详情的逻辑
|
||||
// 可以根据需要跳转到报告详情页面
|
||||
print('查看报告: ${reportData['_id']}');
|
||||
// 示例:Get.to(() => ReportDetailPage(reportId: reportData['_id']));
|
||||
Get.toNamed('/healthQuickCheckReportPage', arguments: reportData);
|
||||
}
|
||||
|
||||
// 格式化时间戳
|
||||
String _formatTime(dynamic timestamp) {
|
||||
if (timestamp == null) return '--';
|
||||
|
||||
try {
|
||||
// 假设时间戳是毫秒级
|
||||
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(timestamp);
|
||||
// 格式化为:年/月/日 时:分
|
||||
return "${dateTime.year}/${dateTime.month.toString().padLeft(2, '0')}/${dateTime.day.toString().padLeft(2, '0')} ${dateTime.hour.toString().padLeft(2, '0')}:${dateTime.minute.toString().padLeft(2, '0')}";
|
||||
} catch (e) {
|
||||
return '--';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'dart:async';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
@@ -9,7 +9,6 @@ import 'package:vbvs_app/common/color/app_uri_status.dart';
|
||||
import 'package:vbvs_app/common/util/EventBus.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/common/util/eventType.dart';
|
||||
import 'package:vbvs_app/component/NullDataComponentWidget.dart';
|
||||
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
||||
import 'package:vbvs_app/component/tool/CustomCard.dart';
|
||||
|
||||
1821
lib/pages/device/health_experience.dart
Normal file
1821
lib/pages/device/health_experience.dart
Normal file
File diff suppressed because it is too large
Load Diff
141
lib/pages/device/health_experience_history.dart
Normal file
141
lib/pages/device/health_experience_history.dart
Normal file
@@ -0,0 +1,141 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/NullDataComponentWidget.dart';
|
||||
import 'package:vbvs_app/controller/device/device_type_controller.dart';
|
||||
import 'package:vbvs_app/controller/message/message_review_controller.dart';
|
||||
import 'package:vbvs_app/pages/device/component/HealthReportCard.dart';
|
||||
|
||||
class HealthExperienceHistory extends StatefulWidget {
|
||||
var data; //1.绑定时 2.绑定后
|
||||
HealthExperienceHistory({super.key, required this.data});
|
||||
|
||||
@override
|
||||
State<HealthExperienceHistory> createState() =>
|
||||
_HealthExperienceHistoryState();
|
||||
}
|
||||
|
||||
class _HealthExperienceHistoryState extends State<HealthExperienceHistory> {
|
||||
MessageReviewController messageReviewController = Get.find();
|
||||
DeviceTypeController deviceTypeController = Get.find();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
loadData(widget.data);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(
|
||||
builder: (context, bodysize) => GestureDetector(
|
||||
// onTap: () => FocusScope.of(context).unfocus(),,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(getBackgroundImageNoImage()), // 本地图片
|
||||
fit: BoxFit.fill, // 填满整个 Container
|
||||
),
|
||||
),
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: AppBar(
|
||||
backgroundColor: themeController.currentColor.sc17,
|
||||
automaticallyImplyLeading: false,
|
||||
iconTheme: IconThemeData(
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
titleSpacing: 0,
|
||||
title: Container(
|
||||
width: double.infinity,
|
||||
height: 180.rpx,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
/// 居中标题
|
||||
Text(
|
||||
'快检历史'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: themeController.currentColor.sc3,
|
||||
letterSpacing: 0,
|
||||
fontSize: 30.rpx,
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
left: 0,
|
||||
// child: returnIconButtom,
|
||||
child: returnIconButtomAddCallback(() {}),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [],
|
||||
centerTitle: false,
|
||||
),
|
||||
body: SafeArea(
|
||||
top: true,
|
||||
child: Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(30.rpx, 0.rpx, 30.rpx, 0),
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Obx(() {
|
||||
final list = deviceTypeController.cqHistoryList.value;
|
||||
return list.isEmpty
|
||||
? const NullDataWidget()
|
||||
: _buildMessageListView(list);
|
||||
}),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> loadData(data) async {
|
||||
//todo 请求历史体征数据
|
||||
// String serviceAddress = ServiceConstant.service_address;
|
||||
// String serviceName = ServiceConstant.server_service;
|
||||
// String serviceApi = ServiceConstant.message_list;
|
||||
// String queryUrl =
|
||||
// "${serviceAddress}${serviceName}${serviceApi}?type=app_vsm&mac=${data['mac']}";
|
||||
// ApiResponse apiResponse = await requestWithLog(
|
||||
// logTitle: "查询消息回看数据", method: MyHttpMethod.get, queryUrl: queryUrl);
|
||||
// messageReviewController.messageList.value = apiResponse.data;
|
||||
// messageReviewController.updateAll();
|
||||
deviceTypeController.getCheckHistory();
|
||||
}
|
||||
|
||||
Widget _buildMessageListView(List dataList) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.symmetric(horizontal: 0.rpx),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 30.rpx),
|
||||
...dataList
|
||||
.map((item) => HealthReportCardWidget(data: item))
|
||||
.toList()
|
||||
.divide(SizedBox(height: 30.rpx)),
|
||||
SizedBox(height: 30.rpx),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -659,6 +659,7 @@ class _InstantBodyPageState extends State<InstantBodyPage>
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: 40.rpx,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user