枪号回填,v1.2.4

This commit is contained in:
2026-03-04 13:38:26 +08:00
parent 8df16f0787
commit 572c416827
4 changed files with 20 additions and 7 deletions

View File

@@ -49,6 +49,7 @@ class ReservationModel {
final String addStatusName;
bool hasEdit;
final String isEdit; // "1" 表示可以修改信息
final String gunNumber;
// 新增附件相关字段
final int isTruckAttachment; // 1为有证件数据 0为缺少
@@ -85,6 +86,7 @@ class ReservationModel {
required this.isEdit,
required this.drivingAttachments,
required this.hydrogenationAttachments,
required this.gunNumber,
});
/// 工厂构造函数用于从JSON创建ReservationModel实例
@@ -160,6 +162,7 @@ class ReservationModel {
isEdit: json['isEdit']?.toString() ?? '0',
drivingAttachments: drivingList.map((e) => e.toString()).toList(),
hydrogenationAttachments: hydrogenationList.map((e) => e.toString()).toList(),
gunNumber: json['gunNumber']?.toString() ?? '',
);
}
}
@@ -377,7 +380,7 @@ class SiteController extends GetxController with BaseControllerMixin {
hasHydrogenationAttachment: false,
isEdit: "0",
drivingAttachments: [],
hydrogenationAttachments: [],
hydrogenationAttachments: [], gunNumber: '',
);
}
@@ -392,7 +395,17 @@ class SiteController extends GetxController with BaseControllerMixin {
text: initialAmount.toStringAsFixed(3),
);
final RxString selectedGun = (gasGunList.isNotEmpty ? gasGunList.first : '').obs;
//枪号回填
String initialGun = '';
if (item.gunNumber.isNotEmpty && gasGunList.contains(item.gunNumber)) {
initialGun = item.gunNumber; // 如果接口有返回且在列表中,则反显
} else if (gasGunList.isNotEmpty) {
initialGun = gasGunList.first; // 否则默认选第一个
}
final RxString selectedGun = initialGun.obs;
final RxBool isOfflineChecked = false.obs;
Get.dialog(
@@ -818,7 +831,7 @@ class SiteController extends GetxController with BaseControllerMixin {
} else {
var status = await Permission.photos.request();
if (!status.isGranted) {
showErrorToast("请在系统设置中开启相册权限");
showErrorToast("请在系统设置中开启存储权限");
return;
}
}