fix:调整人脸列表加载逻辑
This commit is contained in:
parent
3552d15429
commit
99813877b6
@ -22,6 +22,7 @@ class FaceListLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 获取解析后的数据
|
// 获取解析后的数据
|
||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
|
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription =
|
_replySubscription =
|
||||||
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
|
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
|
||||||
@ -77,11 +78,15 @@ class FaceListLogic extends BaseGetXController {
|
|||||||
userID: (await Storage.getUid())!,
|
userID: (await Storage.getUid())!,
|
||||||
faceNo: state.deletFaceNo,
|
faceNo: state.deletFaceNo,
|
||||||
useCountLimit: 0xffff,
|
useCountLimit: 0xffff,
|
||||||
operate: state.isDeletAll == true ? 3 : 2, // 0:注册 1:修改 2:删除 3:删除全部
|
operate: state.isDeletAll == true ? 3 : 2,
|
||||||
|
// 0:注册 1:修改 2:删除 3:删除全部
|
||||||
isAdmin: 0,
|
isAdmin: 0,
|
||||||
isForce: 0, // 是否是胁迫
|
isForce: 0,
|
||||||
isRound: 0, // 是否是循环
|
// 是否是胁迫
|
||||||
weekRound: 0, // 周循环
|
isRound: 0,
|
||||||
|
// 是否是循环
|
||||||
|
weekRound: 0,
|
||||||
|
// 周循环
|
||||||
startDate: 0x11223344,
|
startDate: 0x11223344,
|
||||||
endDate: 0x11223344,
|
endDate: 0x11223344,
|
||||||
startTime: '0',
|
startTime: '0',
|
||||||
@ -277,11 +282,15 @@ class FaceListLogic extends BaseGetXController {
|
|||||||
userID: (await Storage.getUid())!,
|
userID: (await Storage.getUid())!,
|
||||||
faceNo: state.deletFaceNo,
|
faceNo: state.deletFaceNo,
|
||||||
useCountLimit: 0xffff,
|
useCountLimit: 0xffff,
|
||||||
operate: state.isDeletAll == true ? 3 : 2, // 0:注册 1:修改 2:删除 3:删除全部
|
operate: state.isDeletAll == true ? 3 : 2,
|
||||||
|
// 0:注册 1:修改 2:删除 3:删除全部
|
||||||
isAdmin: 0,
|
isAdmin: 0,
|
||||||
isForce: 0, // 是否是胁迫
|
isForce: 0,
|
||||||
isRound: 0, // 是否是循环
|
// 是否是胁迫
|
||||||
weekRound: 0, // 周循环
|
isRound: 0,
|
||||||
|
// 是否是循环
|
||||||
|
weekRound: 0,
|
||||||
|
// 周循环
|
||||||
startDate: 0x11223344,
|
startDate: 0x11223344,
|
||||||
endDate: 0x11223344,
|
endDate: 0x11223344,
|
||||||
startTime: '0',
|
startTime: '0',
|
||||||
@ -348,8 +357,8 @@ class FaceListLogic extends BaseGetXController {
|
|||||||
lockId: state.lockId.value,
|
lockId: state.lockId.value,
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast('删除成功'.tr, something: () {
|
showToast('删除成功'.tr, something: () async {
|
||||||
getFaceListData(isRefresh: true);
|
await getFaceListData(isRefresh: true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -366,8 +375,8 @@ class FaceListLogic extends BaseGetXController {
|
|||||||
lockId: state.lockId.value,
|
lockId: state.lockId.value,
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast('重置成功'.tr, something: () {
|
showToast('重置成功'.tr, something: () async{
|
||||||
getFaceListData(isRefresh: true);
|
await getFaceListData(isRefresh: true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -403,11 +412,12 @@ class FaceListLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 监听修改完详情之后刷新列表
|
// 监听修改完详情之后刷新列表
|
||||||
late StreamSubscription _teamEvent;
|
late StreamSubscription _teamEvent;
|
||||||
|
|
||||||
void _initRefreshAction() {
|
void _initRefreshAction() {
|
||||||
_teamEvent = eventBus
|
_teamEvent = eventBus
|
||||||
.on<OtherTypeRefreshListEvent>()
|
.on<OtherTypeRefreshListEvent>()
|
||||||
.listen((OtherTypeRefreshListEvent event) {
|
.listen((OtherTypeRefreshListEvent event) async {
|
||||||
getFaceListData(isRefresh: true);
|
await getFaceListData(isRefresh: true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -434,6 +444,7 @@ class FaceListLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// senderCheckingUserInfoCount();
|
// senderCheckingUserInfoCount();
|
||||||
}
|
}
|
||||||
|
getFaceListData(isRefresh: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
@ -31,24 +30,6 @@ class _FaceListPageState extends State<FaceListPage> with RouteAware {
|
|||||||
final FaceListLogic logic = Get.put(FaceListLogic());
|
final FaceListLogic logic = Get.put(FaceListLogic());
|
||||||
final FaceListState state = Get.find<FaceListLogic>().state;
|
final FaceListState state = Get.find<FaceListLogic>().state;
|
||||||
|
|
||||||
Future<void> getHttpData({required bool isRefresh}) async {
|
|
||||||
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
|
||||||
if (isDemoMode == false) {
|
|
||||||
logic.getFaceListData(isRefresh: isRefresh).then((FingerprintListDataEntity value) {
|
|
||||||
if (mounted) {
|
|
||||||
setState(() {});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
|
|
||||||
getHttpData(isRefresh: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -92,17 +73,17 @@ class _FaceListPageState extends State<FaceListPage> with RouteAware {
|
|||||||
),
|
),
|
||||||
body: EasyRefreshTool(
|
body: EasyRefreshTool(
|
||||||
onRefresh: () {
|
onRefresh: () {
|
||||||
getHttpData(isRefresh: true);
|
logic.getFaceListData(isRefresh: true);
|
||||||
},
|
},
|
||||||
onLoad: () {
|
onLoad: () {
|
||||||
getHttpData(isRefresh: false);
|
logic.getFaceListData(isRefresh: false);
|
||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
KeySearchWidget(
|
KeySearchWidget(
|
||||||
editingController: state.searchController,
|
editingController: state.searchController,
|
||||||
onSubmittedAction: () {
|
onSubmittedAction: () {
|
||||||
getHttpData(isRefresh: true);
|
logic.getFaceListData(isRefresh: true);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -110,14 +91,15 @@ class _FaceListPageState extends State<FaceListPage> with RouteAware {
|
|||||||
),
|
),
|
||||||
Expanded(child: _buildMainUI()),
|
Expanded(child: _buildMainUI()),
|
||||||
AddBottomWhiteBtn(
|
AddBottomWhiteBtn(
|
||||||
btnName:
|
btnName: '添加人脸'.tr,
|
||||||
'添加人脸'.tr,
|
|
||||||
onClick: () async {
|
onClick: () async {
|
||||||
await Get.toNamed(Routers.addFaceTypePage, arguments: <String, int>{
|
await Get.toNamed(Routers.addFaceTypePage,
|
||||||
|
arguments: <String, int>{
|
||||||
'lockId': state.lockId.value,
|
'lockId': state.lockId.value,
|
||||||
'fromType': 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
'fromType': 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||||
})!.then((value) {
|
})!
|
||||||
getHttpData(isRefresh: true);
|
.then((value) {
|
||||||
|
logic.getFaceListData(isRefresh: true);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -154,9 +136,11 @@ class _FaceListPageState extends State<FaceListPage> with RouteAware {
|
|||||||
logic.getKeyType(getFaceItemData),
|
logic.getKeyType(getFaceItemData),
|
||||||
logic.getKeyDateType(getFaceItemData), () async {
|
logic.getKeyDateType(getFaceItemData), () async {
|
||||||
await Get.toNamed(Routers.faceDetailPage,
|
await Get.toNamed(Routers.faceDetailPage,
|
||||||
arguments: <String, FingerprintItemData>{
|
arguments: <String, FingerprintItemData>{
|
||||||
'faceItemData': getFaceItemData,
|
'faceItemData': getFaceItemData,
|
||||||
})!.then((value) => getHttpData(isRefresh: true));
|
})!
|
||||||
|
.then((value) =>
|
||||||
|
logic.getFaceListData(isRefresh: true));
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user