fix:调整操作记录中UI(未完成)
This commit is contained in:
parent
c32f052cb0
commit
f48e7c8274
@ -236,13 +236,15 @@ class DoorLockLogLogic extends BaseGetXController {
|
|||||||
lockId: state.keyInfos.value.lockId!,
|
lockId: state.keyInfos.value.lockId!,
|
||||||
lockEventType: state.dropdownValue.value,
|
lockEventType: state.dropdownValue.value,
|
||||||
pageNo: pageNo,
|
pageNo: pageNo,
|
||||||
pageSize: 1000,
|
pageSize: 100,
|
||||||
startDate: state.startDate.value,
|
startDate: state.startDate.value,
|
||||||
endDate: state.endDate.value);
|
endDate: state.endDate.value);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
// 更新数据列表
|
// 更新数据列表
|
||||||
state.lockLogItemList.addAll(entity.data!.itemList!);
|
state.lockLogItemList.addAll(entity.data!.itemList!);
|
||||||
state.lockLogItemList.refresh();
|
state.lockLogItemList.refresh();
|
||||||
|
state.weekEventList.addAll(entity.data!.itemList!);
|
||||||
|
state.weekEventList.refresh();
|
||||||
// 更新页码
|
// 更新页码
|
||||||
pageNo++;
|
pageNo++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -192,7 +192,8 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
|
|||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(16.w),
|
borderRadius: BorderRadius.circular(16.w),
|
||||||
),
|
),
|
||||||
child: Obx(() => EasyRefreshTool(
|
child: Obx(
|
||||||
|
() => EasyRefreshTool(
|
||||||
onRefresh: () async {
|
onRefresh: () async {
|
||||||
logic.mockNetworkDataRequest(isRefresh: true);
|
logic.mockNetworkDataRequest(isRefresh: true);
|
||||||
},
|
},
|
||||||
@ -216,14 +217,19 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: NoData())),
|
: NoData(),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String formatTimestampToHHmm(int timestampMs) {
|
String formatTimestampToDateTimeYYYYMMDD(int timestampMs) {
|
||||||
// 1. 将毫秒时间戳转换为秒(DateTime 需要秒级时间戳)
|
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(timestampMs);
|
||||||
int timestampSec = timestampMs ~/ 1000;
|
DateFormat formatter = DateFormat('MM${'月'.tr}dd${'日'.tr}'); // 格式:2025-08-18 14:30
|
||||||
|
return formatter.format(dateTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
String formatTimestampToHHmm(int timestampMs) {
|
||||||
// 2. 创建 DateTime 对象
|
// 2. 创建 DateTime 对象
|
||||||
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(timestampMs);
|
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(timestampMs);
|
||||||
|
|
||||||
@ -368,6 +374,12 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
|
|||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
'${formatTimestampToDateTimeYYYYMMDD(timelineData.operateDate!)}',
|
||||||
|
style: TextStyle(
|
||||||
|
|
||||||
|
fontSize: 20.sp,
|
||||||
|
)),
|
||||||
// 使用 SingleChildScrollView 实现横向滚动
|
// 使用 SingleChildScrollView 实现横向滚动
|
||||||
SingleChildScrollView(
|
SingleChildScrollView(
|
||||||
scrollDirection: Axis.horizontal, // 横向滚动
|
scrollDirection: Axis.horizontal, // 横向滚动
|
||||||
@ -569,7 +581,7 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
|
|||||||
|
|
||||||
Widget _buildWeekCalendar() {
|
Widget _buildWeekCalendar() {
|
||||||
return Obx(() {
|
return Obx(() {
|
||||||
final list = state.lockLogItemList.value;
|
final list = state.weekEventList.value;
|
||||||
final dateSet = list
|
final dateSet = list
|
||||||
.map((e) => DateTime.fromMillisecondsSinceEpoch(e.operateDate!))
|
.map((e) => DateTime.fromMillisecondsSinceEpoch(e.operateDate!))
|
||||||
.map((dt) => dt.withoutTime) // 转为年月日
|
.map((dt) => dt.withoutTime) // 转为年月日
|
||||||
@ -579,9 +591,21 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
|
|||||||
hasData: (DateTime date) {
|
hasData: (DateTime date) {
|
||||||
return dateSet.contains(date.withoutTime);
|
return dateSet.contains(date.withoutTime);
|
||||||
},
|
},
|
||||||
onDateSelected: (DateTime date) {},
|
onDateSelected: (DateTime date) async {
|
||||||
onWeekChanged: (DateTime start, DateTime end) {
|
print('外部收到选中: $date');
|
||||||
|
|
||||||
|
state.operateDate = date.millisecondsSinceEpoch;
|
||||||
|
state.startDate.value =
|
||||||
|
DateTime(date.year, date.month, date.day).millisecondsSinceEpoch;
|
||||||
|
state.endDate.value =
|
||||||
|
DateTime(date.year, date.month, date.day, 23, 59, 59, 999)
|
||||||
|
.millisecondsSinceEpoch;
|
||||||
|
await logic.mockNetworkDataRequest(isRefresh: true);
|
||||||
|
},
|
||||||
|
onWeekChanged: (DateTime start, DateTime end) {
|
||||||
|
state.startDate.value = start.millisecondsSinceEpoch;
|
||||||
|
state.endDate.value = end.millisecondsSinceEpoch;
|
||||||
|
logic.mockNetworkDataRequest(isRefresh: true);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -17,7 +17,9 @@ class DoorLockLogState {
|
|||||||
final Rx<LockListInfoItemEntity> keyInfos = LockListInfoItemEntity().obs;
|
final Rx<LockListInfoItemEntity> keyInfos = LockListInfoItemEntity().obs;
|
||||||
final RxList<DoorLockLogDataItem> lockLogItemList =
|
final RxList<DoorLockLogDataItem> lockLogItemList =
|
||||||
<DoorLockLogDataItem>[].obs;
|
<DoorLockLogDataItem>[].obs;
|
||||||
final RxList<DoorLockLogDataItem> eventList =
|
final RxList<DoorLockLogDataItem> weekEventList =
|
||||||
|
<DoorLockLogDataItem>[].obs;
|
||||||
|
final RxList<DoorLockLogDataItem> dayEventList =
|
||||||
<DoorLockLogDataItem>[].obs;
|
<DoorLockLogDataItem>[].obs;
|
||||||
final AdvancedCalendarController calendarControllerToday =
|
final AdvancedCalendarController calendarControllerToday =
|
||||||
AdvancedCalendarController.today();
|
AdvancedCalendarController.today();
|
||||||
@ -28,14 +30,13 @@ class DoorLockLogState {
|
|||||||
DateTime(2024, 10, 10),
|
DateTime(2024, 10, 10),
|
||||||
];
|
];
|
||||||
|
|
||||||
// 获取当前月份的第一天 00:00:00.000
|
final RxInt startDate =
|
||||||
final RxInt startDate = DateTime(DateTime.now().year, DateTime.now().month, 1)
|
DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day)
|
||||||
.millisecondsSinceEpoch
|
.millisecondsSinceEpoch
|
||||||
.obs;
|
.obs;
|
||||||
|
|
||||||
// 获取当前月份的最后一天 23:59:59.999
|
|
||||||
final RxInt endDate = DateTime(
|
final RxInt endDate = DateTime(
|
||||||
DateTime.now().year, DateTime.now().month + 1, 0, 23, 59, 59, 999)
|
DateTime.now().year, DateTime.now().month, DateTime.now().day + 1)
|
||||||
|
.subtract(const Duration(milliseconds: 1))
|
||||||
.millisecondsSinceEpoch
|
.millisecondsSinceEpoch
|
||||||
.obs;
|
.obs;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user