门锁日志部分提交

This commit is contained in:
Daisy 2024-02-01 10:52:23 +08:00
parent ea530d5b95
commit 3a8faadfc9
7 changed files with 96 additions and 40 deletions

View File

@ -18,4 +18,11 @@ class XSConstantMacro {
static int keyTypeTime = 2;
static int keyTypeOnce = 3;
static int keyTypeLoop = 4;
// lockEventType 0-10-20-30-40-
static int lockEventTypeAll = 0;
static int lockEventTypeOpenDoor = 10;
static int lockEventTypeAbnormal = 20;
static int lockEventTypeDoorbell = 30;
static int lockEventTypeVideo = 40;
}

View File

@ -183,23 +183,15 @@ class DoorLockLogLogic extends BaseGetXController {
});
}
//
//
void mockNetworkDataRequest() async {
KeyOperationRecordEntity entity = await ApiRepository.to.lockRecordList(
'',
"",
'0',
state.keyInfos.value.lockId.toString(),
'1',
'1',
'20',
'',
'',
'',
'',
'',
'',
'');
KeyOperationRecordEntity entity = await ApiRepository.to.lockEventList(
lockId: state.keyInfos.value.lockId!,
lockEventType: state.dropdownValue.value,
pageNo: 1,
pageSize: 20,
startDate: state.startDate.value,
endDate: state.endDate.value);
if (entity.errorCode!.codeIsSuccessful) {
print("操作记录列表成功:${entity.data?.itemList}");
state.lockOperatingRecordListData.value = entity.data!.itemList!;
@ -248,6 +240,8 @@ class DoorLockLogLogic extends BaseGetXController {
// mockNetworkDataRequest();
}
mockNetworkDataRequest();
}
@override

View File

@ -131,8 +131,11 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> {
children: [
Obx(() => XSDropDownWidget(
items: state.getDropDownItemList,
value: state.dropdownValue.value,
valueChanged: (value) {})),
value: state.dropdownTitle.value,
valueChanged: (value) {
print('dropdownValue选中了$value');
state.dropdownValue.value = int.parse(value);
})),
],
),
);

View File

@ -1,5 +1,5 @@
import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/tools/advancedCalendar/src/controller.dart';
import 'package:star_lock/tools/menuItem/dropDownItem.dart';
@ -15,16 +15,35 @@ class DoorLockLogState {
DateTime.now(),
DateTime(2024, 10, 10),
];
var dropdownValue = '全部事件'.obs;
List<DropDownItem> getDropDownItemList = [
DropDownItem(itemTitle: "全部事件", itemValue: '0', isCheked: false),
DropDownItem(itemTitle: "开锁事件", itemValue: '1', isCheked: false),
DropDownItem(itemTitle: "异常事件", itemValue: '2', isCheked: false),
DropDownItem(itemTitle: "门锁事件", itemValue: '3', isCheked: false),
DropDownItem(itemTitle: "视频事件", itemValue: '4', isCheked: false),
];
var currentStep = 0.obs;
final startDate = 0.obs;
final endDate = 0.obs;
var dropdownTitle = '全部事件'.obs;
var dropdownValue = XSConstantMacro.lockEventTypeAll.obs;
List<DropDownItem> getDropDownItemList = [
DropDownItem(
itemTitle: "全部事件",
itemValue: XSConstantMacro.lockEventTypeAll.toString(),
isCheked: false),
DropDownItem(
itemTitle: "开锁事件",
itemValue: XSConstantMacro.lockEventTypeOpenDoor.toString(),
isCheked: false),
DropDownItem(
itemTitle: "异常事件",
itemValue: XSConstantMacro.lockEventTypeAbnormal.toString(),
isCheked: false),
DropDownItem(
itemTitle: "门铃事件",
itemValue: XSConstantMacro.lockEventTypeDoorbell.toString(),
isCheked: false),
DropDownItem(
itemTitle: "视频事件",
itemValue: XSConstantMacro.lockEventTypeVideo.toString(),
isCheked: false),
];
DoorLockLogState() {
keyInfos.value = Get.arguments["keyInfo"];

View File

@ -11,6 +11,8 @@ abstract class Api {
final String sendElectronicKeyURL = '/key/send'; //
final String resetElectronicKeyURL = '/key/reset'; //
final String keyOperationRecordURL = '/lockRecords/list'; //
final String lockEventListURL = '/lockRecords/lockEventList'; //
final String uploadElectricQuantityURL =
'/room/uploadElectricQuantity'; //

View File

@ -254,6 +254,19 @@ class ApiProvider extends BaseProvider {
'fingerprintId': fingerprintId
}));
//
Future<Response> lockEventList(int lockId, int lockEventType, int pageNo,
int pageSize, int startDate, int endDate) =>
post(
lockEventListURL.toUrl,
jsonEncode({
'lockId': lockId,
'lockEventType': lockEventType,
"pageNo": pageNo,
'pageSize': pageSize,
"startDate": startDate,
'endDate': endDate,
}));
//
Future<Response> lockRecordUploadData(String lockId, List records) => post(
lockRecordUploadURL.toUrl,

View File

@ -125,18 +125,16 @@ class ApiRepository {
//
Future<ElectronicKeyListEntity> electronicKeyList(
{
required String endDate,
required String keyId,
required String keyStatus,
required String lockId,
required String operatorUid,
required String pageNo,
required String pageSize,
required String startDate,
required String keyRight,
required String searchStr
}) async {
{required String endDate,
required String keyId,
required String keyStatus,
required String lockId,
required String operatorUid,
required String pageNo,
required String pageSize,
required String startDate,
required String keyRight,
required String searchStr}) async {
final res = await apiProvider.electronicKeyList(endDate, keyId, keyStatus,
lockId, operatorUid, pageNo, pageSize, startDate, keyRight, searchStr);
return ElectronicKeyListEntity.fromJson(res.body);
@ -221,6 +219,26 @@ class ApiRepository {
return KeyOperationRecordEntity.fromJson(res.body);
}
//
Future<KeyOperationRecordEntity> lockEventList({
required int lockId,
required int lockEventType,
required int pageNo,
required int pageSize,
required int startDate,
required int endDate,
}) async {
final res = await apiProvider.lockEventList(
lockId,
lockEventType,
pageNo,
pageSize,
startDate,
endDate,
);
return KeyOperationRecordEntity.fromJson(res.body);
}
//
Future<KeyOperationRecordEntity> lockRecordUploadData(
{required String lockId, required List records}) async {