feat:开卡页面加入搜索

This commit is contained in:
dzc committed 2025-03-19 10:23:13 +08:00
1 parent 72020b2376
commit c095c52ee5
2 files changed
+47 -15

No files matched your search

+15
View File
@@ -26,6 +26,9 @@ class CardActiveController extends GetxController {
// 写卡
RxBool writeLoading = false.obs;
// 卡号
final carNumberC = TextEditingController();
_initData() {
update(["card_active"]);
}
@@ -45,13 +48,24 @@ class CardActiveController extends GetxController {
@override
void onClose() {
super.onClose();
carNumberC.dispose();
}
Future<void> doPage({int? page}) async {
if (page != null) currentPage.value = page;
// 收起键盘
FocusManager.instance.primaryFocus?.unfocus();
getTableList();
}
Future<void> doReset() async {
currentPage.value = 1;
carNumberC.clear();
// 收起键盘
FocusManager.instance.primaryFocus?.unfocus();
await getTableList();
}
Future<void> getTableList() async {
EasyLoading.show(
status: '查询中...',
@@ -65,6 +79,7 @@ class CardActiveController extends GetxController {
"size": pageSize.value,
"deptId": "",
"walletTypeId": "",
"cardNumber": carNumberC.text,
};
final data = await WalletApi.openCardList(pa);
if (data == null) return;
+32 -15
View File
@@ -22,6 +22,37 @@ class CardActivePage extends GetView<CardActiveController> {
onTap: () => Get.offAndToNamed(RouteNames.panel),
),
const Spacer(),
FTextField(
controller: controller.carNumberC,
hint: '请输入卡号',
maxLines: 1,
).width(300.w),
FButton(
prefix: FIcon(
FAssets.icons.ban,
size: theme.typography.base.fontSize,
),
label: Text(
'重置',
style: theme.typography.base.copyWith(
color: theme.colorScheme.secondary,
),
),
onPress: () => controller.doReset(),
),
FButton(
prefix: FIcon(
FAssets.icons.search,
size: theme.typography.base.fontSize,
),
label: Text(
'搜索',
style: theme.typography.base.copyWith(
color: theme.colorScheme.secondary,
),
),
onPress: () => controller.doPage(page: 1),
),
FButton(
prefix: FIcon(
FAssets.icons.idCard,
@@ -34,21 +65,7 @@ class CardActivePage extends GetView<CardActiveController> {
style: FButtonStyle.secondary,
onPress: () => controller.doReadCard(),
),
SizedBox(width: 20.w),
FButton(
prefix: FIcon(
FAssets.icons.search,
size: theme.typography.base.fontSize,
),
label: Text(
'搜索',
style: theme.typography.base.copyWith(
color: theme.colorScheme.secondary,
),
),
onPress: () => controller.doPage(),
),
].toRow();
].toRowSpace(space: 15.w);
}
// 主视图