fix:调整获取卡片时会刷新多个列表的问题
This commit is contained in:
parent
807c71b614
commit
c4191dbc95
@ -28,6 +28,7 @@ class CardListLogic extends BaseGetXController {
|
||||
|
||||
// 获取解析后的数据
|
||||
late StreamSubscription<Reply> _replySubscription;
|
||||
|
||||
void _initReplySubscription() {
|
||||
_replySubscription =
|
||||
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
|
||||
@ -69,11 +70,15 @@ class CardListLogic extends BaseGetXController {
|
||||
userID: (await Storage.getUid())!,
|
||||
cardNo: state.deletCardNo,
|
||||
useCountLimit: 0xffff,
|
||||
operate: state.isDeletAll == true ? 3 : 2, // 0:注册 1:修改 2:删除 3:删除全部
|
||||
operate: state.isDeletAll == true ? 3 : 2,
|
||||
// 0:注册 1:修改 2:删除 3:删除全部
|
||||
isAdmin: 0,
|
||||
isForce: 0, // 是否是胁迫
|
||||
isRound: 0, // 是否是循环
|
||||
weekRound: 0, // 周循环
|
||||
isForce: 0,
|
||||
// 是否是胁迫
|
||||
isRound: 0,
|
||||
// 是否是循环
|
||||
weekRound: 0,
|
||||
// 周循环
|
||||
startDate: 0x11223344,
|
||||
endDate: 0x11223344,
|
||||
startTime: '0',
|
||||
@ -116,11 +121,15 @@ class CardListLogic extends BaseGetXController {
|
||||
userID: (await Storage.getUid())!,
|
||||
cardNo: state.deletCardNo,
|
||||
useCountLimit: 0xffff,
|
||||
operate: state.isDeletAll == true ? 3 : 2, // 0:注册 1:修改 2:删除 3:删除全部
|
||||
operate: state.isDeletAll == true ? 3 : 2,
|
||||
// 0:注册 1:修改 2:删除 3:删除全部
|
||||
isAdmin: 0,
|
||||
isForce: 0, // 是否是胁迫
|
||||
isRound: 0, // 是否是循环
|
||||
weekRound: 0, // 周循环
|
||||
isForce: 0,
|
||||
// 是否是胁迫
|
||||
isRound: 0,
|
||||
// 是否是循环
|
||||
weekRound: 0,
|
||||
// 周循环
|
||||
startDate: 0x11223344,
|
||||
endDate: 0x11223344,
|
||||
startTime: '0',
|
||||
@ -193,6 +202,7 @@ class CardListLogic extends BaseGetXController {
|
||||
|
||||
// 监听修改完详情之后刷新列表
|
||||
late StreamSubscription _teamEvent;
|
||||
|
||||
void _initRefreshAction() {
|
||||
_teamEvent = eventBus
|
||||
.on<OtherTypeRefreshListEvent>()
|
||||
@ -240,6 +250,7 @@ class CardListLogic extends BaseGetXController {
|
||||
|
||||
_initRefreshAction();
|
||||
}
|
||||
await getICCardListData(isRefresh: true);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -31,24 +31,24 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
||||
final CardListLogic logic = Get.put(CardListLogic());
|
||||
final CardListState state = Get.find<CardListLogic>().state;
|
||||
|
||||
Future<void> getHttpData({required bool isRefresh}) async {
|
||||
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
logic
|
||||
.getICCardListData(isRefresh: isRefresh)
|
||||
.then((FingerprintListDataEntity value) {
|
||||
if (mounted) {
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// Future<void> logic.getICCardListData({required bool isRefresh}) async {
|
||||
// final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
// if (isDemoMode == false) {
|
||||
// logic
|
||||
// .getICCardListData(isRefresh: isRefresh)
|
||||
// .then((FingerprintListDataEntity value) {
|
||||
// if (mounted) {
|
||||
// setState(() {});
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
getHttpData(isRefresh: true);
|
||||
// logic.getICCardListData(isRefresh: true);
|
||||
}
|
||||
|
||||
@override
|
||||
@ -92,17 +92,17 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
||||
),
|
||||
body: EasyRefreshTool(
|
||||
onRefresh: () {
|
||||
getHttpData(isRefresh: true);
|
||||
logic.getICCardListData(isRefresh: true);
|
||||
},
|
||||
onLoad: () {
|
||||
getHttpData(isRefresh: false);
|
||||
logic.getICCardListData(isRefresh: false);
|
||||
},
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
KeySearchWidget(
|
||||
editingController: state.searchController,
|
||||
onSubmittedAction: () {
|
||||
getHttpData(isRefresh: true);
|
||||
logic.getICCardListData(isRefresh: true);
|
||||
},
|
||||
),
|
||||
SizedBox(height: 20.h),
|
||||
@ -115,10 +115,10 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
||||
'fromType': 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
})!
|
||||
.then((value) {
|
||||
getHttpData(isRefresh: true);
|
||||
logic.getICCardListData(isRefresh: true);
|
||||
});
|
||||
// if (data != null) {
|
||||
// getHttpData(isRefresh: true);
|
||||
// logic.getICCardListData(isRefresh: true);
|
||||
// }
|
||||
},
|
||||
),
|
||||
@ -180,9 +180,9 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
|
||||
arguments: <String, FingerprintItemData>{
|
||||
'fingerprintItemData': fingerprintItemData,
|
||||
})!
|
||||
.then((value) => getHttpData(isRefresh: true));
|
||||
.then((value) => logic.getICCardListData(isRefresh: true));
|
||||
// if (data != null) {
|
||||
// getHttpData(isRefresh: true);
|
||||
// logic.getICCardListData(isRefresh: true);
|
||||
// }
|
||||
}),
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user