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