1,锁操作记录新增清空记录接口对接及相应逻辑
2,修复bug:ID1002068 3,修复操作记录更换类型数据问题
This commit is contained in:
parent
05414a9c2d
commit
d4bb24e516
@ -712,7 +712,7 @@
|
||||
"请输入手机号": "Please enter mobile phone number",
|
||||
"家人到家": "Family gets home",
|
||||
"添加家人": "Add family",
|
||||
"若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择": "If the lock is not connected to the Internet, in addition to the electronic key, the password, card, fingerprint and other door reminders can not be sent in time, please choose according to your actual situation",
|
||||
"若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择。": "If the lock is not connected to the Internet, in addition to the electronic key, the password, card, fingerprint and other door reminders can not be sent in time, please choose according to your actual situation",
|
||||
"消息提醒": "Message reminder",
|
||||
"开门通知": "Opening notice",
|
||||
"N天未开门": "N days without opening the door",
|
||||
@ -844,5 +844,14 @@
|
||||
"钥匙无效": "The key is invalid",
|
||||
"操作失败,请确认锁是否在附近,或重启手机蓝牙后再试。": "The operation failed. Please confirm whether the lock is nearby, or restart your phone's Bluetooth and try again.",
|
||||
"如果是全自动锁,请使屏幕变亮": "If it is a fully automatic lock, please make the screen brighter",
|
||||
"正在尝试闭锁……": "Attempting to lock..."
|
||||
"正在尝试闭锁……": "Attempting to lock...",
|
||||
"清空记录":"Clear record",
|
||||
"是否要删除操作记录?":"Do you want to delete the operation record?",
|
||||
"被删除的记录不能恢复":"The deleted record cannot be restored",
|
||||
"全部事件":"All events",
|
||||
"开锁事件":"Unlock event",
|
||||
"异常事件":"Abnormal event",
|
||||
"门铃事件":"Doorbell event",
|
||||
"视频事件":"Video event"
|
||||
|
||||
}
|
||||
|
||||
@ -740,7 +740,7 @@
|
||||
"请输入手机号":"请输入手机号",
|
||||
"家人到家":"家人到家",
|
||||
"添加家人":"添加家人",
|
||||
"若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择":"若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择",
|
||||
"若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择。":"若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择。",
|
||||
"消息提醒":"消息提醒",
|
||||
"开门通知":"开门通知",
|
||||
"N天未开门":"N天未开门",
|
||||
@ -872,5 +872,13 @@
|
||||
"钥匙无效": "钥匙无效",
|
||||
"操作失败,请确认锁是否在附近,或重启手机蓝牙后再试。": "操作失败,请确认锁是否在附近,或重启手机蓝牙后再试。",
|
||||
"如果是全自动锁,请使屏幕变亮": "如果是全自动锁,请使屏幕变亮",
|
||||
"正在尝试闭锁……": "正在尝试闭锁……"
|
||||
"正在尝试闭锁……": "正在尝试闭锁……",
|
||||
"清空记录":"清空记录",
|
||||
"是否要删除操作记录?":"是否要删除操作记录?",
|
||||
"被删除的记录不能恢复":"被删除的记录不能恢复",
|
||||
"全部事件":"全部事件",
|
||||
"开锁事件":"开锁事件",
|
||||
"异常事件":"异常事件",
|
||||
"门铃事件":"门铃事件",
|
||||
"视频事件":"视频事件"
|
||||
}
|
||||
|
||||
@ -712,7 +712,7 @@
|
||||
"请输入手机号": "请输入手机号",
|
||||
"家人到家": "家人到家",
|
||||
"添加家人": "添加家人",
|
||||
"若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择": "若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择",
|
||||
"若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择。": "若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择。",
|
||||
"消息提醒": "消息提醒",
|
||||
"开门通知": "开门通知",
|
||||
"N天未开门": "N天未开门",
|
||||
@ -842,5 +842,13 @@
|
||||
"钥匙无效": "钥匙无效",
|
||||
"操作失败,请确认锁是否在附近,或重启手机蓝牙后再试。": "操作失败,请确认锁是否在附近,或重启手机蓝牙后再试。",
|
||||
"如果是全自动锁,请使屏幕变亮": "如果是全自动锁,请使屏幕变亮",
|
||||
"正在尝试闭锁……": "正在尝试闭锁……"
|
||||
"正在尝试闭锁……": "正在尝试闭锁……",
|
||||
"清空记录":"清空记录",
|
||||
"是否要删除操作记录?":"是否要删除操作记录?",
|
||||
"被删除的记录不能恢复":"被删除的记录不能恢复",
|
||||
"全部事件":"全部事件",
|
||||
"开锁事件":"开锁事件",
|
||||
"异常事件":"异常事件",
|
||||
"门铃事件":"门铃事件",
|
||||
"视频事件":"视频事件"
|
||||
}
|
||||
|
||||
@ -1,14 +1,13 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:get_storage/get_storage.dart';
|
||||
|
||||
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart';
|
||||
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_state.dart';
|
||||
import 'package:star_lock/main/lockDetail/lockOperatingRecord/lockOperatingRecordGetLastRecordTime_entity.dart';
|
||||
import 'package:star_lock/tools/commonDataManage.dart';
|
||||
import 'package:star_lock/tools/eventBusEventManage.dart';
|
||||
|
||||
import '../../../app_settings/app_settings.dart';
|
||||
import '../../../blue/blue_manage.dart';
|
||||
import '../../../blue/io_protocol/io_referEventRecordTime.dart';
|
||||
import '../../../blue/io_reply.dart';
|
||||
@ -137,6 +136,7 @@ class DoorLockLogLogic extends BaseGetXController {
|
||||
|
||||
//请求操作记录列表(门锁日志)
|
||||
void mockNetworkDataRequest() async {
|
||||
state.lockLogItemList.clear();
|
||||
DoorLockLogEntity entity = await ApiRepository.to.lockEventList(
|
||||
lockId: state.keyInfos.value.lockId!,
|
||||
lockEventType: state.dropdownValue.value,
|
||||
@ -210,10 +210,14 @@ class DoorLockLogLogic extends BaseGetXController {
|
||||
|
||||
//清空操作记录
|
||||
void clearOperationRecordRequest() async {
|
||||
KeyOperationRecordEntity entity =
|
||||
await ApiRepository.to.clearOperationRecord('28');
|
||||
KeyOperationRecordEntity entity = await ApiRepository.to
|
||||
.clearOperationRecord(
|
||||
CommonDataManage().currentKeyInfo.lockId.toString());
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("清除数据成功");
|
||||
showToast("清除数据成功", something: () {
|
||||
pageNo = 1;
|
||||
mockNetworkDataRequest();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ import 'package:star_lock/tools/EasyRefreshTool.dart';
|
||||
import 'package:star_lock/tools/advancedCalendar/src/widget.dart';
|
||||
import 'package:star_lock/tools/menuItem/xsDropDownWidget.dart';
|
||||
import 'package:star_lock/tools/noData.dart';
|
||||
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
||||
import 'package:timelines/timelines.dart';
|
||||
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
@ -27,11 +28,6 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
|
||||
final logic = Get.put(DoorLockLogLogic());
|
||||
final state = Get.find<DoorLockLogLogic>().state;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@ -40,6 +36,19 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
|
||||
barTitle: TranslationLoader.lanKeys!.operatingRecord!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
actionsList: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
ShowCupertinoAlertView().showClearOperationRecordAlert(
|
||||
clearClick: () {
|
||||
logic.clearOperationRecordRequest();
|
||||
});
|
||||
},
|
||||
child: Text(
|
||||
'清空记录'.tr,
|
||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||
)),
|
||||
],
|
||||
),
|
||||
body: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
@ -53,17 +62,7 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
|
||||
endIndent: 30.w,
|
||||
),
|
||||
eventDropDownWidget(),
|
||||
Expanded(
|
||||
child: EasyRefreshTool(
|
||||
onRefresh: () {
|
||||
logic.pageNo = 1;
|
||||
logic.mockNetworkDataRequest();
|
||||
},
|
||||
onLoad: () {
|
||||
logic.mockNetworkDataRequest();
|
||||
},
|
||||
child: Obx(() => timeLineView(state.lockLogItemList)),
|
||||
))
|
||||
Expanded(child: timeLineView())
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -144,77 +143,16 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
|
||||
}
|
||||
|
||||
//时间轴组件
|
||||
Widget timeLineView(List<DoorLockLogDataItem> timelineDataList) {
|
||||
Widget timeLineView() {
|
||||
return Container(
|
||||
margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 20.h, top: 20.h),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(16.w),
|
||||
),
|
||||
child: timelineDataList.isNotEmpty
|
||||
child: Obx(() => state.lockLogItemList.isNotEmpty
|
||||
? Timeline.tileBuilder(
|
||||
builder: TimelineTileBuilder.fromStyle(
|
||||
contentsAlign: ContentsAlign.basic,
|
||||
itemCount: timelineDataList.length,
|
||||
contentsBuilder: (context, index) {
|
||||
DoorLockLogDataItem timelineData = timelineDataList[index];
|
||||
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(
|
||||
timelineData.operateDate!);
|
||||
String formattedTime =
|
||||
'${dateTime.hour.toString().padLeft(2, '0')}:${dateTime.minute.toString().padLeft(2, '0')}';
|
||||
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(left: 20.w, top: 20.h),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'$formattedTime ${timelineData.recordTypeName}',
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 24.sp,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.videoLogDetailPage);
|
||||
},
|
||||
child: Stack(
|
||||
children: [
|
||||
timelineData.imagesUrl!.isNotEmpty
|
||||
? Image.network(
|
||||
timelineData.imagesUrl!,
|
||||
width: 260.w,
|
||||
height: 260.h,
|
||||
)
|
||||
: Container(),
|
||||
Positioned(
|
||||
top: 150.h,
|
||||
left: 10.w,
|
||||
child: Image(
|
||||
image: const AssetImage(
|
||||
'images/main/icon_lockLog_play.png'),
|
||||
width: 24.w,
|
||||
height: 20.w,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
builder: _timelineBuilderWidget(),
|
||||
theme: TimelineThemeData(
|
||||
nodePosition: 0.04, //居左侧距离
|
||||
connectorTheme: const ConnectorThemeData(
|
||||
@ -229,7 +167,72 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
|
||||
),
|
||||
),
|
||||
)
|
||||
: NoData(),
|
||||
: NoData()),
|
||||
);
|
||||
}
|
||||
|
||||
TimelineTileBuilder _timelineBuilderWidget() {
|
||||
return TimelineTileBuilder.fromStyle(
|
||||
contentsAlign: ContentsAlign.basic,
|
||||
itemCount: state.lockLogItemList.length,
|
||||
contentsBuilder: (context, index) {
|
||||
DoorLockLogDataItem timelineData = state.lockLogItemList[index];
|
||||
DateTime dateTime =
|
||||
DateTime.fromMillisecondsSinceEpoch(timelineData.operateDate!);
|
||||
String formattedTime =
|
||||
'${dateTime.hour.toString().padLeft(2, '0')}:${dateTime.minute.toString().padLeft(2, '0')}';
|
||||
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(left: 20.w, top: 20.h),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'$formattedTime ${timelineData.username!.isNotEmpty ? "${timelineData.username}用" : ""}${timelineData.recordTypeName}',
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 24.sp,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.videoLogDetailPage);
|
||||
},
|
||||
child: Stack(
|
||||
children: [
|
||||
timelineData.imagesUrl!.isNotEmpty
|
||||
? Image.network(
|
||||
timelineData.imagesUrl!,
|
||||
width: 260.w,
|
||||
height: 260.h,
|
||||
)
|
||||
: Container(),
|
||||
Positioned(
|
||||
top: 150.h,
|
||||
left: 10.w,
|
||||
child: Image(
|
||||
image: const AssetImage(
|
||||
'images/main/icon_lockLog_play.png'),
|
||||
width: 24.w,
|
||||
height: 20.w,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -27,28 +27,28 @@ class DoorLockLogState {
|
||||
.millisecondsSinceEpoch
|
||||
.obs;
|
||||
|
||||
var dropdownTitle = '全部事件'.obs;
|
||||
var dropdownTitle = '全部事件'.tr.obs;
|
||||
var dropdownValue = XSConstantMacro.lockEventTypeAll.obs;
|
||||
|
||||
List<DropDownItem> getDropDownItemList = [
|
||||
DropDownItem(
|
||||
itemTitle: "全部事件",
|
||||
itemTitle: "全部事件".tr,
|
||||
itemValue: XSConstantMacro.lockEventTypeAll.toString(),
|
||||
isCheked: false),
|
||||
DropDownItem(
|
||||
itemTitle: "开锁事件",
|
||||
itemTitle: "开锁事件".tr,
|
||||
itemValue: XSConstantMacro.lockEventTypeOpenDoor.toString(),
|
||||
isCheked: false),
|
||||
DropDownItem(
|
||||
itemTitle: "异常事件",
|
||||
itemTitle: "异常事件".tr,
|
||||
itemValue: XSConstantMacro.lockEventTypeAbnormal.toString(),
|
||||
isCheked: false),
|
||||
DropDownItem(
|
||||
itemTitle: "门铃事件",
|
||||
itemTitle: "门铃事件".tr,
|
||||
itemValue: XSConstantMacro.lockEventTypeDoorbell.toString(),
|
||||
isCheked: false),
|
||||
DropDownItem(
|
||||
itemTitle: "视频事件",
|
||||
itemTitle: "视频事件".tr,
|
||||
itemValue: XSConstantMacro.lockEventTypeVideo.toString(),
|
||||
isCheked: false),
|
||||
];
|
||||
|
||||
@ -72,7 +72,7 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
|
||||
alignment: Alignment.centerLeft,
|
||||
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
||||
child: Text(
|
||||
'若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择'.tr,
|
||||
'若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择。'.tr,
|
||||
style: TextStyle(color: AppColors.darkGrayTextColor, fontSize: 20.sp),
|
||||
));
|
||||
}
|
||||
|
||||
@ -364,4 +364,36 @@ class ShowCupertinoAlertView {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
//清空操作记录弹窗
|
||||
void showClearOperationRecordAlert({required Function clearClick}) {
|
||||
showCupertinoDialog(
|
||||
context: Get.context!,
|
||||
builder: (context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: Text('是否要删除操作记录?'.tr),
|
||||
content: Text('被删除的记录不能恢复'.tr),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text(
|
||||
'取消'.tr,
|
||||
style: TextStyle(color: AppColors.mainColor),
|
||||
),
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child:
|
||||
Text('删除'.tr, style: TextStyle(color: AppColors.mainColor)),
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
clearClick();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user