设备报修

This commit is contained in:
czz
2025-07-14 18:04:42 +08:00
parent a26834f56c
commit d5a5e3282d
13 changed files with 952 additions and 374 deletions

View File

@@ -31,7 +31,7 @@ class ApplyRepairModel {
int? device_type; //类型 床,床垫 不能为空
String? device_category; //型号 不能为空
String? device_id; //序列号 设备id 不能为空
String? device_series;
String? device_name; //名称 可为空
List<String>? issue_img = []; //图片
@@ -123,118 +123,6 @@ class ApplyRepairController extends GetControllerEx<ApplyRepairModel> {
}
}
// //提交
// Future<String> submitRepair(BuildContext context) async {
// //tmp
// // return '';
// String message = '';
// final MyDialogController myDialogController =
// Get.find<MyDialogController>();
// if (model.device_type == null || model.device_type!.isEmpty) {
// message = '请选择设备类型!';
// showToast(message);
// return message;
// }
// if (model.device_category == null || model.device_category!.isEmpty) {
// message = '请输入设备型号!';
// showToast(message);
// return message;
// }
// if (model.device_id == null || model.device_id!.isEmpty) {
// message = '请输入设备序列号id';
// showToast(message);
// return message;
// }
// if (model.apply_name == null || model.apply_name!.isEmpty) {
// message = '请输入姓名!';
// showToast(message);
// return message;
// }
// RegExp nameRegExp = RegExp(r'^[\u4e00-\u9fa5]{2,4}$');
// if (!nameRegExp.hasMatch(model.apply_name!)) {
// message = '姓名必须为2到4个汉字';
// showToast(message);
// return message;
// }
// if (model.tel == null || model.tel!.isEmpty) {
// message = '请输入手机号!';
// showToast(message);
// return message;
// }
// if (!MyUtils.isValidPhoneNumber(model.tel!)) {
// message = '无效的手机号!';
// showToast(message);
// return message;
// }
// if (model.desc == null || model.desc!.isEmpty) {
// message = '请输入问题描述!';
// showToast(message);
// return message;
// }
// if (model.issue_img == null || model.issue_img!.isEmpty) {
// message = '请至少上传一张问题图片!';
// showToast(message);
// return message;
// }
// model.status = RepairStatus.pending;
// // await repairRepository.saveRepair(model);
// String type = "repair_submit_${model.device_id}";
// String serviceAddress = ServiceConstant.service_address;
// String serviceName = ServiceConstant.server_service;
// String serviceApi = ServiceConstant.submit_repair;
// String queryUrl = "$serviceAddress$serviceName$serviceApi?type=$type";
// // 组织请求数据
// final UserInfoController userInfoController =
// Get.find<UserInfoController>();
// UserModel user = userInfoController.model.user!;
// Map<String, dynamic> data = {
// 'apply_name': model.apply_name,
// 'desc': model.desc,
// 'device_type': model.device_type,
// 'issue_img': model.issue_img,
// 'tel': model.tel,
// 'uid': user.uid,
// 'device_category': model.device_category,
// 'device_id': model.device_id,
// 'device_name': model.device_name,
// 'status': model.status,
// };
// // 发起插入请求(这里相当于之前的 saveRepair
// requestWithLog(
// logTitle: "提交报修",
// method: MyHttpMethod.post,
// queryUrl: queryUrl,
// data: data,
// onSuccess: (res) {
// if (res.data is List && res.data.isNotEmpty) {
// final inserted = res.data[0];
// model.id = inserted['id'];
// model.create_time = DateTime.tryParse(inserted['create_time']);
// // TextSelectionOverlay
// // // saveRepairHistor
// // saveRepairHistory(
// // RepairProcessModel()
// // ..status = model.status
// // ..record_id = inserted['id'],
// // );
// showToast("提交成功!");
// } else {
// showToast("提交失败:未返回数据!");
// }
// },
// onFailure: (res) {
// showToast("提交失败!");
// },
// );
// return message;
// }
Future<void> getDeviceList() async {
// UserModel loginUser = userInfoController.model.user!;
DeviceListController deviceListController = Get.find();
@@ -243,5 +131,4 @@ class ApplyRepairController extends GetControllerEx<ApplyRepairModel> {
ApplyRepairController applyRepairController = Get.find();
applyRepairController.model.device_list = aa;
}
}

View File

@@ -18,6 +18,7 @@ ApplyRepairModel _$ApplyRepairModelFromJson(Map<String, dynamic> json) =>
..device_type = (json['device_type'] as num?)?.toInt()
..device_category = json['device_category'] as String?
..device_id = json['device_id'] as String?
..device_series = json['device_series'] as String?
..device_name = json['device_name'] as String?
..issue_img = (json['issue_img'] as List<dynamic>?)
?.map((e) => e as String)
@@ -44,6 +45,7 @@ Map<String, dynamic> _$ApplyRepairModelToJson(ApplyRepairModel instance) =>
'device_type': instance.device_type,
'device_category': instance.device_category,
'device_id': instance.device_id,
'device_series': instance.device_series,
'device_name': instance.device_name,
'issue_img': instance.issue_img,
'imagesLImit': instance.imagesLImit,

View File

@@ -54,9 +54,10 @@ class ExperienceStoreListController
if (lock) {
return;
}
if (page == 0) {
position = await weatherModelController.determinePosition();
}
// if (page == 0) {
// position = await weatherModelController.determinePosition();
// }
lock = true;
int page_ = page;
ApiService.reservation

View File

@@ -28,10 +28,10 @@ class RepairListController extends GetControllerEx<RepairListModel> {
}
//初始化列表数据
@override
Future<void> onInit() async {
super.onInit();
Future<void> initData() async {
await getRepairList();
updateAll();
}
getRepairList() async {