新增操作记录—导出记录Dialog相关UI及逻辑
This commit is contained in:
parent
1b66698504
commit
8725be3487
@ -906,5 +906,10 @@
|
|||||||
"转移成功": "Transfer success",
|
"转移成功": "Transfer success",
|
||||||
"该已锁被删除": "The locked is deleted",
|
"该已锁被删除": "The locked is deleted",
|
||||||
"授权管理员只能查看和管理自己下发的钥匙、密码等权限": "Authorized administrators can only view and manage the keys, passwords, etc. they issued",
|
"授权管理员只能查看和管理自己下发的钥匙、密码等权限": "Authorized administrators can only view and manage the keys, passwords, etc. they issued",
|
||||||
"添加授权管理员": "Add authorized administrator"
|
"添加授权管理员": "Add authorized administrator",
|
||||||
|
"导出记录":"Export record",
|
||||||
|
"选择时间段":"Select time period",
|
||||||
|
"导出":"Export",
|
||||||
|
"批量导出":"Batch export",
|
||||||
|
"读取记录":"Read record"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -938,5 +938,10 @@
|
|||||||
"转移成功": "转移成功",
|
"转移成功": "转移成功",
|
||||||
"该已锁被删除": "该已锁被删除",
|
"该已锁被删除": "该已锁被删除",
|
||||||
"授权管理员只能查看和管理自己下发的钥匙、密码等权限": "授权管理员只能查看和管理自己下发的钥匙、密码等权限",
|
"授权管理员只能查看和管理自己下发的钥匙、密码等权限": "授权管理员只能查看和管理自己下发的钥匙、密码等权限",
|
||||||
"添加授权管理员": "添加授权管理员"
|
"添加授权管理员": "添加授权管理员",
|
||||||
|
"导出记录":"导出记录",
|
||||||
|
"选择时间段":"选择时间段",
|
||||||
|
"导出":"导出",
|
||||||
|
"批量导出":"批量导出",
|
||||||
|
"读取记录":"读取记录"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -903,5 +903,10 @@
|
|||||||
"转移成功": "转移成功",
|
"转移成功": "转移成功",
|
||||||
"该已锁被删除": "该已锁被删除",
|
"该已锁被删除": "该已锁被删除",
|
||||||
"授权管理员只能查看和管理自己下发的钥匙、密码等权限": "授权管理员只能查看和管理自己下发的钥匙、密码等权限",
|
"授权管理员只能查看和管理自己下发的钥匙、密码等权限": "授权管理员只能查看和管理自己下发的钥匙、密码等权限",
|
||||||
"添加授权管理员": "添加授权管理员"
|
"添加授权管理员": "添加授权管理员",
|
||||||
|
"导出记录":"导出记录",
|
||||||
|
"选择时间段":"选择时间段",
|
||||||
|
"导出":"导出",
|
||||||
|
"批量导出":"批量导出",
|
||||||
|
"读取记录":"读取记录"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import 'package:star_lock/appRouters.dart';
|
|||||||
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart';
|
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_logic.dart';
|
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_logic.dart';
|
||||||
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_state.dart';
|
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_state.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/doorLockLog/exportRecordDialog/exportRecordDialog_page.dart';
|
||||||
import 'package:star_lock/tools/EasyRefreshTool.dart';
|
import 'package:star_lock/tools/EasyRefreshTool.dart';
|
||||||
import 'package:star_lock/tools/advancedCalendar/src/widget.dart';
|
import 'package:star_lock/tools/advancedCalendar/src/widget.dart';
|
||||||
import 'package:star_lock/tools/commonDataManage.dart';
|
import 'package:star_lock/tools/commonDataManage.dart';
|
||||||
@ -13,6 +14,7 @@ import 'package:star_lock/tools/menuItem/xsDropDownWidget.dart';
|
|||||||
import 'package:star_lock/tools/noData.dart';
|
import 'package:star_lock/tools/noData.dart';
|
||||||
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
||||||
import 'package:star_lock/tools/showTipView.dart';
|
import 'package:star_lock/tools/showTipView.dart';
|
||||||
|
import 'package:star_lock/tools/submitBtn.dart';
|
||||||
import 'package:timelines/timelines.dart';
|
import 'package:timelines/timelines.dart';
|
||||||
|
|
||||||
import '../../../app_settings/app_colors.dart';
|
import '../../../app_settings/app_colors.dart';
|
||||||
@ -53,7 +55,7 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
|
|||||||
ShowTipView().showSureAlertDialog(
|
ShowTipView().showSureAlertDialog(
|
||||||
'1.锁没有联网,密码、IC卡、指纹等开门记录无法实时上传,可以点击右上角按钮,然后读取记录。\n2.只能保留一定时间内的记录,如果您需要保留历史记录,可以点击右上角按钮,然后导出记录',
|
'1.锁没有联网,密码、IC卡、指纹等开门记录无法实时上传,可以点击右上角按钮,然后读取记录。\n2.只能保留一定时间内的记录,如果您需要保留历史记录,可以点击右上角按钮,然后导出记录',
|
||||||
tipTitle: '看不到操作记录,可能原因有',
|
tipTitle: '看不到操作记录,可能原因有',
|
||||||
sureStr: '我知道了');
|
sureStr: '我知道了'.tr);
|
||||||
},
|
},
|
||||||
)),
|
)),
|
||||||
Visibility(
|
Visibility(
|
||||||
@ -131,7 +133,16 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '导出记录':
|
case '导出记录':
|
||||||
{}
|
{
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return ExportRecordDialog(
|
||||||
|
onExport: () {},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,59 +7,63 @@ import 'package:star_lock/tools/menuItem/dropDownItem.dart';
|
|||||||
import '../../lockMian/entity/lockListInfo_entity.dart';
|
import '../../lockMian/entity/lockListInfo_entity.dart';
|
||||||
|
|
||||||
class DoorLockLogState {
|
class DoorLockLogState {
|
||||||
final lockLogEntity = DoorLockLogEntity().obs;
|
// 当前选择的日期
|
||||||
final keyInfos = LockListInfoItemEntity().obs;
|
|
||||||
final lockLogItemList = <DoorLockLogDataItem>[].obs;
|
DoorLockLogState() {
|
||||||
final calendarControllerToday = AdvancedCalendarController.today();
|
keyInfos.value = Get.arguments['keyInfo'];
|
||||||
final calendarControllerCustom = AdvancedCalendarController.today();
|
}
|
||||||
final events = <DateTime>[
|
final Rx<DoorLockLogEntity> lockLogEntity = DoorLockLogEntity().obs;
|
||||||
|
final Rx<LockListInfoItemEntity> keyInfos = LockListInfoItemEntity().obs;
|
||||||
|
final RxList<DoorLockLogDataItem> lockLogItemList =
|
||||||
|
<DoorLockLogDataItem>[].obs;
|
||||||
|
final AdvancedCalendarController calendarControllerToday =
|
||||||
|
AdvancedCalendarController.today();
|
||||||
|
final AdvancedCalendarController calendarControllerCustom =
|
||||||
|
AdvancedCalendarController.today();
|
||||||
|
final List<DateTime> events = <DateTime>[
|
||||||
DateTime.now(),
|
DateTime.now(),
|
||||||
DateTime(2024, 10, 10),
|
DateTime(2024, 10, 10),
|
||||||
];
|
];
|
||||||
|
|
||||||
final startDate =
|
final RxInt startDate =
|
||||||
DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day)
|
DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day)
|
||||||
.millisecondsSinceEpoch
|
.millisecondsSinceEpoch
|
||||||
.obs;
|
.obs;
|
||||||
final endDate = (DateTime(
|
final RxInt endDate = DateTime(
|
||||||
DateTime.now().year, DateTime.now().month, DateTime.now().day + 1)
|
DateTime.now().year, DateTime.now().month, DateTime.now().day + 1)
|
||||||
.subtract(const Duration(milliseconds: 1)))
|
.subtract(const Duration(milliseconds: 1))
|
||||||
.millisecondsSinceEpoch
|
.millisecondsSinceEpoch
|
||||||
.obs;
|
.obs;
|
||||||
|
|
||||||
var dropdownTitle = '全部事件'.tr.obs;
|
RxString dropdownTitle = '全部事件'.tr.obs;
|
||||||
var dropdownValue = XSConstantMacro.lockEventTypeAll.obs;
|
RxInt dropdownValue = XSConstantMacro.lockEventTypeAll.obs;
|
||||||
|
|
||||||
List<DropDownItem> getDropDownItemList = [
|
List<DropDownItem> getDropDownItemList = <DropDownItem>[
|
||||||
DropDownItem(
|
DropDownItem(
|
||||||
itemTitle: "全部事件".tr,
|
itemTitle: '全部事件'.tr,
|
||||||
itemValue: XSConstantMacro.lockEventTypeAll.toString(),
|
itemValue: XSConstantMacro.lockEventTypeAll.toString(),
|
||||||
isCheked: false),
|
isCheked: false),
|
||||||
DropDownItem(
|
DropDownItem(
|
||||||
itemTitle: "开锁事件".tr,
|
itemTitle: '开锁事件'.tr,
|
||||||
itemValue: XSConstantMacro.lockEventTypeOpenDoor.toString(),
|
itemValue: XSConstantMacro.lockEventTypeOpenDoor.toString(),
|
||||||
isCheked: false),
|
isCheked: false),
|
||||||
DropDownItem(
|
DropDownItem(
|
||||||
itemTitle: "异常事件".tr,
|
itemTitle: '异常事件'.tr,
|
||||||
itemValue: XSConstantMacro.lockEventTypeAbnormal.toString(),
|
itemValue: XSConstantMacro.lockEventTypeAbnormal.toString(),
|
||||||
isCheked: false),
|
isCheked: false),
|
||||||
DropDownItem(
|
DropDownItem(
|
||||||
itemTitle: "门铃事件".tr,
|
itemTitle: '门铃事件'.tr,
|
||||||
itemValue: XSConstantMacro.lockEventTypeDoorbell.toString(),
|
itemValue: XSConstantMacro.lockEventTypeDoorbell.toString(),
|
||||||
isCheked: false),
|
isCheked: false),
|
||||||
DropDownItem(
|
DropDownItem(
|
||||||
itemTitle: "视频事件".tr,
|
itemTitle: '视频事件'.tr,
|
||||||
itemValue: XSConstantMacro.lockEventTypeVideo.toString(),
|
itemValue: XSConstantMacro.lockEventTypeVideo.toString(),
|
||||||
isCheked: false),
|
isCheked: false),
|
||||||
];
|
];
|
||||||
|
|
||||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
var operateDate = 0; // 按日期查询消息记录的时间戳
|
int operateDate = 0; // 按日期查询消息记录的时间戳
|
||||||
var ifHaveNext = false; // 页码
|
bool ifHaveNext = false; // 页码
|
||||||
var logCountPage = 10; // 蓝牙记录一页多少个
|
int logCountPage = 10; // 蓝牙记录一页多少个
|
||||||
var currentSelectDate = DateTime.now().obs; // 当前选择的日期
|
Rx<DateTime> currentSelectDate = DateTime.now().obs;
|
||||||
|
|
||||||
DoorLockLogState() {
|
|
||||||
keyInfos.value = Get.arguments["keyInfo"];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,204 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
|
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||||
|
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
||||||
|
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
|
||||||
|
import 'package:star_lock/tools/showTipView.dart';
|
||||||
|
import 'package:star_lock/tools/submitBtn.dart';
|
||||||
|
|
||||||
|
class ExportRecordDialog extends StatelessWidget {
|
||||||
|
const ExportRecordDialog({required this.onExport, Key? key})
|
||||||
|
: super(key: key);
|
||||||
|
final VoidCallback onExport;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {},
|
||||||
|
child: Center(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 60.w),
|
||||||
|
child: _DerivedRecordWidget(onExport: onExport),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DerivedRecordWidget extends StatefulWidget {
|
||||||
|
const _DerivedRecordWidget({required this.onExport, Key? key})
|
||||||
|
: super(key: key);
|
||||||
|
final VoidCallback onExport;
|
||||||
|
|
||||||
|
@override
|
||||||
|
__DerivedRecordWidgetState createState() => __DerivedRecordWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class __DerivedRecordWidgetState extends State<_DerivedRecordWidget> {
|
||||||
|
DateTime? startDate;
|
||||||
|
DateTime? endDate;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Center(
|
||||||
|
child: IntrinsicHeight(
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 20.h),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(16.w),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
'导出记录'.tr,
|
||||||
|
style: TextStyle(fontSize: 22.sp),
|
||||||
|
),
|
||||||
|
SizedBox(height: 16.h),
|
||||||
|
Text(
|
||||||
|
'选择时间段'.tr,
|
||||||
|
style: TextStyle(fontSize: 24.sp, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
SizedBox(height: 26.h),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: <Widget>[
|
||||||
|
_buildDateContainer(
|
||||||
|
startDate != null
|
||||||
|
? DateFormat('yyyy-MM-dd').format(startDate!)
|
||||||
|
: DateFormat('yyyy-MM-dd').format(DateTime.now()),
|
||||||
|
_showStartDatePicker),
|
||||||
|
Text(
|
||||||
|
'--',
|
||||||
|
style: TextStyle(fontSize: 24.sp),
|
||||||
|
),
|
||||||
|
_buildDateContainer(
|
||||||
|
endDate != null
|
||||||
|
? DateFormat('yyyy-MM-dd').format(endDate!)
|
||||||
|
: DateFormat('yyyy-MM-dd').format(DateTime.now()),
|
||||||
|
_showEndDatePicker),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: 26.h),
|
||||||
|
Divider(
|
||||||
|
height: 1.sp,
|
||||||
|
color: AppColors.greyLineColor,
|
||||||
|
),
|
||||||
|
SizedBox(height: 26.h),
|
||||||
|
SubmitBtn(
|
||||||
|
btnName: '导出'.tr,
|
||||||
|
onClick: _handleExport,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
// 批量导出的处理逻辑
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'批量导出'.tr,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 22.sp,
|
||||||
|
color: AppColors.mainColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildDateContainer(String date, VoidCallback onPressed) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: onPressed,
|
||||||
|
child: Container(
|
||||||
|
width: 200.w,
|
||||||
|
height: 60.h,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(
|
||||||
|
color: AppColors.greyLineColor,
|
||||||
|
width: 1.w,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(8.w),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
date,
|
||||||
|
style: TextStyle(fontSize: 24.sp),
|
||||||
|
),
|
||||||
|
Icon(
|
||||||
|
Icons.arrow_drop_down,
|
||||||
|
size: 30.w,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _showStartDatePicker() {
|
||||||
|
final PDuration selectDate = PDuration.parse(startDate ?? DateTime.now());
|
||||||
|
Pickers.showDatePicker(
|
||||||
|
context,
|
||||||
|
selectDate: selectDate,
|
||||||
|
mode: DateMode.YMD,
|
||||||
|
onConfirm: (PDuration p) {
|
||||||
|
setState(() {
|
||||||
|
startDate = DateTime(p.year!, p.month!, p.day!);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _showEndDatePicker() {
|
||||||
|
final PDuration selectDate = PDuration.parse(endDate ?? DateTime.now());
|
||||||
|
Pickers.showDatePicker(
|
||||||
|
context,
|
||||||
|
selectDate: selectDate,
|
||||||
|
mode: DateMode.YMD,
|
||||||
|
onConfirm: (PDuration p) {
|
||||||
|
setState(() {
|
||||||
|
endDate = DateTime(p.year!, p.month!, p.day!);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _handleExport() {
|
||||||
|
if (startDate == null || endDate == null) {
|
||||||
|
ShowTipView().showSureAlertDialog(
|
||||||
|
'请选择开始和结束日期'.tr,
|
||||||
|
tipTitle: '提示'.tr,
|
||||||
|
sureStr: '我知道了'.tr,
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 调用导出接口的逻辑示例
|
||||||
|
|
||||||
|
// 调用导出成功后的回调
|
||||||
|
widget.onExport();
|
||||||
|
|
||||||
|
// 关闭弹窗
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user