地址接口的视线
This commit is contained in:
@@ -165,5 +165,11 @@
|
|||||||
"注销账号":"注销账号",
|
"注销账号":"注销账号",
|
||||||
"退出成功":"退出成功",
|
"退出成功":"退出成功",
|
||||||
"退出失败":"退出失败"
|
"退出失败":"退出失败"
|
||||||
}
|
},
|
||||||
|
"操作成功": "操作成功",
|
||||||
|
"关于我们": "关于我们",
|
||||||
|
"用户协议": "用户协议",
|
||||||
|
"隐私协议": "隐私协议",
|
||||||
|
"退出登录": "退出登录",
|
||||||
|
"注销账号": "注销账号"
|
||||||
}
|
}
|
||||||
@@ -32,6 +32,7 @@ class ServiceConstant {
|
|||||||
static String address_list = "/api/addresss/list"; //查询地址列表
|
static String address_list = "/api/addresss/list"; //查询地址列表
|
||||||
static String add_address = "/api/addresss/info"; //添加地址
|
static String add_address = "/api/addresss/info"; //添加地址
|
||||||
|
|
||||||
|
|
||||||
static String logService = "$service_address/vsbs_log";
|
static String logService = "$service_address/vsbs_log";
|
||||||
static const String webSocketService = "wss://$baseHost/vsbs_ws_gateway/ws";
|
static const String webSocketService = "wss://$baseHost/vsbs_ws_gateway/ws";
|
||||||
static const String sleep_token = "HdAMjzqiYQKsmHRyEFKhfRGQ";
|
static const String sleep_token = "HdAMjzqiYQKsmHRyEFKhfRGQ";
|
||||||
|
|||||||
@@ -1,13 +1,20 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:EasyDartModule/EasyDartModule.dart';
|
||||||
import 'package:ef/ef.dart';
|
import 'package:ef/ef.dart';
|
||||||
|
import 'package:dio/dio.dart' as dio;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:img_picker/img_picker.dart';
|
||||||
import 'package:json_annotation/json_annotation.dart';
|
import 'package:json_annotation/json_annotation.dart';
|
||||||
import 'package:vbvs_app/common/color/ServiceConstant.dart';
|
import 'package:vbvs_app/common/color/ServiceConstant.dart';
|
||||||
import 'package:vbvs_app/common/color/repair_status.dart';
|
import 'package:vbvs_app/common/color/repair_status.dart';
|
||||||
|
import 'package:vbvs_app/common/util/DailyLogUtils.dart';
|
||||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||||
import 'package:vbvs_app/common/util/myDialog/my_dialog_controller.dart';
|
import 'package:vbvs_app/common/util/myDialog/my_dialog_controller.dart';
|
||||||
import 'package:vbvs_app/common/util/requestWithLog.dart';
|
import 'package:vbvs_app/common/util/requestWithLog.dart';
|
||||||
import 'package:vbvs_app/controller/mh_controller/device_list_controller.dart';
|
import 'package:vbvs_app/controller/mh_controller/device_list_controller.dart';
|
||||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||||
|
import 'package:vbvs_app/model/api_response.dart';
|
||||||
import 'package:vbvs_app/model/user_data.dart';
|
import 'package:vbvs_app/model/user_data.dart';
|
||||||
|
|
||||||
part 'apply_repair_controller.g.dart';
|
part 'apply_repair_controller.g.dart';
|
||||||
@@ -17,11 +24,11 @@ class ApplyRepairModel {
|
|||||||
int? id; //报修id
|
int? id; //报修id
|
||||||
String? apply_name; //申请人名称
|
String? apply_name; //申请人名称
|
||||||
String? tel; //手机号
|
String? tel; //手机号
|
||||||
String? address; //地址
|
|
||||||
String? desc; //问题描述
|
String? desc; //问题描述
|
||||||
DateTime? create_time; //创建时间
|
DateTime? create_time; //创建时间
|
||||||
|
|
||||||
String? device_type; //类型 床,床垫 不能为空
|
int? device_type; //类型 床,床垫 不能为空
|
||||||
String? device_category; //型号 不能为空
|
String? device_category; //型号 不能为空
|
||||||
String? device_id; //序列号 设备id 不能为空
|
String? device_id; //序列号 设备id 不能为空
|
||||||
|
|
||||||
@@ -55,167 +62,178 @@ class ApplyRepairController extends GetControllerEx<ApplyRepairModel> {
|
|||||||
attr = GetModel(ApplyRepairModel()).obs;
|
attr = GetModel(ApplyRepairModel()).obs;
|
||||||
}
|
}
|
||||||
|
|
||||||
// //上传图片
|
Future<ApiResponse> uploadImg() async {
|
||||||
// Future<void> uploadImg() async {
|
EasyDartModule.logger.info("请求上传图片");
|
||||||
// final ImagePicker picker = ImagePicker();
|
DailyLogUtils.writeLog("请求上传图片");
|
||||||
// final XFile? image = await picker.pickImage(source: ImageSource.gallery);
|
final ImagePicker picker = ImagePicker();
|
||||||
// final user = Supabase.instance.client.auth.currentUser;
|
final XFile? image = await picker.pickImage(source: ImageSource.gallery);
|
||||||
// try {
|
try {
|
||||||
// if (image != null) {
|
ApiResponse apiResponse = ApiResponse(code: -1, msg: "我的.头像上传失败".tr);
|
||||||
// int fileSize = await image.length(); // 获取图片大小,单位为字节
|
if (image != null) {
|
||||||
// if (fileSize > 1024 * 1024 * 5) {
|
int fileSize = await image.length(); // 获取图片大小,单位为字节
|
||||||
// // 1 MB = 1024 * 1024 bytes
|
if (fileSize > 1048576 * 5) {
|
||||||
// showToast("上传图片不能超过5MB");
|
apiResponse.msg = "上传限制".tr;
|
||||||
// return;
|
return apiResponse;
|
||||||
// }
|
|
||||||
// final filePath = image.path; // 获取文件路径
|
|
||||||
// final fileExtension = p.extension(filePath); // 获取文件扩展名,包括点(.)
|
|
||||||
// // 获取当前日期并格式化为 yyyy-MM-dd
|
|
||||||
// final String folderName =
|
|
||||||
// DateFormat('yyyy-MM-dd').format(DateTime.now());
|
|
||||||
// final file = File(image.path);
|
|
||||||
// // 构造文件路径,文件会被上传到 record_img 文件夹下的当天日期文件夹
|
|
||||||
// var response = await ef.client.storage
|
|
||||||
// .from(model.img_bucket!)
|
|
||||||
// .upload('$folderName/${Uuid().v4()}$fileExtension', file);
|
|
||||||
// if (response != null) {
|
|
||||||
// String publicUrl =
|
|
||||||
// ef.client.storage.from(model.img_bucket!).getPublicUrl(response);
|
|
||||||
|
|
||||||
// print('文件上传成功: $response');
|
|
||||||
// print('文件上传成功: $publicUrl');
|
|
||||||
// String prefixToRemove = 'mianhuatang_repair/';
|
|
||||||
// model.issue_img!.add(response.startsWith(prefixToRemove)
|
|
||||||
// ? response.substring(prefixToRemove.length)
|
|
||||||
// : response);
|
|
||||||
// updateAll();
|
|
||||||
// }
|
|
||||||
// print('/$model.img_bucket');
|
|
||||||
// } else {
|
|
||||||
// print('未选择图片');
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// } catch (e) {
|
|
||||||
// print('上传失败: $e');
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
//提交
|
|
||||||
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.address == null || model.address!.isEmpty) {
|
|
||||||
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 serviceAddress = ServiceConstant.service_address;
|
||||||
String serviceName = ServiceConstant.server_service;
|
String serviceName = ServiceConstant.server_service;
|
||||||
String serviceApi = ServiceConstant.submit_repair;
|
String serviceApi = ServiceConstant.upload_file;
|
||||||
String queryUrl = "$serviceAddress$serviceName$serviceApi?type=$type";
|
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
|
||||||
|
String? language = "";
|
||||||
// 组织请求数据
|
if (languageController.selectLanguage != null) {
|
||||||
final UserInfoController userInfoController =
|
language = languageController.selectLanguage.value!.language_code;
|
||||||
Get.find<UserInfoController>();
|
}
|
||||||
UserModel user = userInfoController.model.user!;
|
if (language != null && language.isNotEmpty) {
|
||||||
|
if (queryUrl.contains("?")) {
|
||||||
Map<String, dynamic> data = {
|
queryUrl += "&lang=$language";
|
||||||
'apply_name': model.apply_name,
|
|
||||||
'address': model.address,
|
|
||||||
'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 {
|
} else {
|
||||||
showToast("提交失败:未返回数据!");
|
queryUrl += "?lang=$language";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var formData = dio.FormData.fromMap({
|
||||||
|
"type": 2,
|
||||||
|
"file": await dio.MultipartFile.fromFile(
|
||||||
|
image.path, // 确保 image 是 File 类型
|
||||||
|
filename: image.path.split('/').last,
|
||||||
|
),
|
||||||
|
});
|
||||||
|
var response = await EasyDartModule.dio.post(queryUrl, data: formData);
|
||||||
|
if (response != null) {
|
||||||
|
var responseData = response.data is String
|
||||||
|
? jsonDecode(response.data)
|
||||||
|
: response.data;
|
||||||
|
ApiResponse res =
|
||||||
|
ApiResponse.fromJson(responseData, (object) => object);
|
||||||
|
model.issue_img!.add(res.data['path']);
|
||||||
|
updateAll();
|
||||||
|
MyUtils.formatResponse(res, "我的.上传成功".tr, "我的.头像上传失败".tr);
|
||||||
|
updateAll();
|
||||||
|
return res;
|
||||||
|
} else {
|
||||||
|
return ApiResponse(code: -1, msg: "服务器.失败".tr);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
apiResponse.msg = "我的.未选择图片".tr;
|
||||||
|
return apiResponse;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
EasyDartModule.logger.error("上传图片失败->$e");
|
||||||
|
DailyLogUtils.writeError("上传图片失败->$e");
|
||||||
|
return ApiResponse(code: -1, msg: "服务器.失败".tr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
onFailure: (res) {
|
|
||||||
showToast("提交失败!");
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
return message;
|
// //提交
|
||||||
}
|
// 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 {
|
Future<void> getDeviceList() async {
|
||||||
// UserModel loginUser = userInfoController.model.user!;
|
// UserModel loginUser = userInfoController.model.user!;
|
||||||
@@ -226,22 +244,4 @@ class ApplyRepairController extends GetControllerEx<ApplyRepairModel> {
|
|||||||
applyRepairController.model.device_list = aa;
|
applyRepairController.model.device_list = aa;
|
||||||
}
|
}
|
||||||
|
|
||||||
// String getPublicUrl(String path) {
|
|
||||||
// try {
|
|
||||||
// String bucketPath = '${model.img_bucket}/';
|
|
||||||
// if (path.contains(bucketPath)) {
|
|
||||||
// int firstIndex = path.indexOf(bucketPath);
|
|
||||||
// // int secondIndex =
|
|
||||||
// // response.indexOf(bucketPath, firstIndex + bucketPath.length);
|
|
||||||
// if (firstIndex != -1) {
|
|
||||||
// // 去掉第一个存储桶路径
|
|
||||||
// path = path.replaceFirst(bucketPath, '', firstIndex);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// String publicUrl =
|
|
||||||
// ef.client.storage.from(model.img_bucket!).getPublicUrl(path);
|
|
||||||
// return publicUrl;
|
|
||||||
// } catch (e) {}
|
|
||||||
// return '';
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,12 +11,11 @@ ApplyRepairModel _$ApplyRepairModelFromJson(Map<String, dynamic> json) =>
|
|||||||
..id = (json['id'] as num?)?.toInt()
|
..id = (json['id'] as num?)?.toInt()
|
||||||
..apply_name = json['apply_name'] as String?
|
..apply_name = json['apply_name'] as String?
|
||||||
..tel = json['tel'] as String?
|
..tel = json['tel'] as String?
|
||||||
..address = json['address'] as String?
|
|
||||||
..desc = json['desc'] as String?
|
..desc = json['desc'] as String?
|
||||||
..create_time = json['create_time'] == null
|
..create_time = json['create_time'] == null
|
||||||
? null
|
? null
|
||||||
: DateTime.parse(json['create_time'] as String)
|
: DateTime.parse(json['create_time'] as String)
|
||||||
..device_type = json['device_type'] as String?
|
..device_type = (json['device_type'] as num?)?.toInt()
|
||||||
..device_category = json['device_category'] as String?
|
..device_category = json['device_category'] as String?
|
||||||
..device_id = json['device_id'] as String?
|
..device_id = json['device_id'] as String?
|
||||||
..device_name = json['device_name'] as String?
|
..device_name = json['device_name'] as String?
|
||||||
@@ -40,7 +39,6 @@ Map<String, dynamic> _$ApplyRepairModelToJson(ApplyRepairModel instance) =>
|
|||||||
'id': instance.id,
|
'id': instance.id,
|
||||||
'apply_name': instance.apply_name,
|
'apply_name': instance.apply_name,
|
||||||
'tel': instance.tel,
|
'tel': instance.tel,
|
||||||
'address': instance.address,
|
|
||||||
'desc': instance.desc,
|
'desc': instance.desc,
|
||||||
'create_time': instance.create_time?.toIso8601String(),
|
'create_time': instance.create_time?.toIso8601String(),
|
||||||
'device_type': instance.device_type,
|
'device_type': instance.device_type,
|
||||||
|
|||||||
@@ -15,35 +15,37 @@ import '../../controller/mh_controller/apply_repair_controller.dart';
|
|||||||
import '../../controller/mh_controller/repair_info_controller.dart';
|
import '../../controller/mh_controller/repair_info_controller.dart';
|
||||||
|
|
||||||
class RepairHistoryListPage extends GetView<RepairInfoController> {
|
class RepairHistoryListPage extends GetView<RepairInfoController> {
|
||||||
|
Map data;
|
||||||
|
RepairHistoryListPage({Key? key, required this.data});
|
||||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||||
|
|
||||||
BoxConstraints? bodysize;
|
BoxConstraints? bodysize;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
controller.model.applyRepairModel = ApplyRepairModel()
|
// controller.model.applyRepairModel = ApplyRepairModel()
|
||||||
..id = 1001
|
// ..id = 1001
|
||||||
..apply_name = '张三'
|
// ..apply_name = '张三'
|
||||||
..tel = '13812345678'
|
// ..tel = '13812345678'
|
||||||
..address = '北京市海淀区清华东路66号'
|
// ..desc = '床垫传感器失灵,无法监测心率和呼吸'
|
||||||
..desc = '床垫传感器失灵,无法监测心率和呼吸'
|
// ..create_time = DateTime.parse('2025-05-01 10:00:00')
|
||||||
..create_time = DateTime.parse('2025-05-01 10:00:00')
|
// ..device_type = 1
|
||||||
..device_type = '床垫'
|
// ..device_category = 'BY-H'
|
||||||
..device_category = 'BY-H'
|
// ..device_id = 'BD202505011001'
|
||||||
..device_id = 'BD202505011001'
|
// ..device_name = '智能床垫 BY-H 型号'
|
||||||
..device_name = '智能床垫 BY-H 型号'
|
// ..issue_img = [
|
||||||
..issue_img = [
|
// 'https://example.com/img1.jpg',
|
||||||
'https://example.com/img1.jpg',
|
// 'https://example.com/img2.jpg'
|
||||||
'https://example.com/img2.jpg'
|
// ]
|
||||||
]
|
// ..imagesLImit = 3
|
||||||
..imagesLImit = 3
|
// ..img_bucket = 'mianhuatang_repair'
|
||||||
..img_bucket = 'mianhuatang_repair'
|
// ..status = '待处理'
|
||||||
..status = '待处理'
|
// ..select_device = '床垫/BY-H/智能床垫'
|
||||||
..select_device = '床垫/BY-H/智能床垫'
|
// ..device_list = ['床垫/BY-H/智能床垫', '床垫/BY-A/智能床垫', '床垫/BY-C/智能床垫']
|
||||||
..device_list = ['床垫/BY-H/智能床垫', '床垫/BY-A/智能床垫', '床垫/BY-C/智能床垫']
|
// ..score = null
|
||||||
..score = null
|
// ..score_time = null
|
||||||
..score_time = null
|
// ..messageType = 1
|
||||||
..messageType = 1
|
// ..repairId = 1001;
|
||||||
..repairId = 1001;
|
|
||||||
|
|
||||||
controller.model.repairProcessList = [
|
controller.model.repairProcessList = [
|
||||||
RepairProcessModel()
|
RepairProcessModel()
|
||||||
@@ -154,10 +156,7 @@ class RepairHistoryListPage extends GetView<RepairInfoController> {
|
|||||||
-1, 0),
|
-1, 0),
|
||||||
child: Text(
|
child: Text(
|
||||||
// 'SWES01号智能一键入眠床',
|
// 'SWES01号智能一键入眠床',
|
||||||
controller
|
data['device'][0]['name'] ??
|
||||||
.model
|
|
||||||
.applyRepairModel!
|
|
||||||
.device_name ??
|
|
||||||
'未命名',
|
'未命名',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontFamily: 'Readex Pro',
|
fontFamily: 'Readex Pro',
|
||||||
@@ -173,10 +172,8 @@ class RepairHistoryListPage extends GetView<RepairInfoController> {
|
|||||||
-1, 0),
|
-1, 0),
|
||||||
child: Text(
|
child: Text(
|
||||||
'系列:' +
|
'系列:' +
|
||||||
(controller
|
(data['device'][0][
|
||||||
.model
|
'device_category'] ??
|
||||||
.applyRepairModel!
|
|
||||||
.device_category ??
|
|
||||||
'未命名'),
|
'未命名'),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontFamily: 'Readex Pro',
|
fontFamily: 'Readex Pro',
|
||||||
@@ -193,11 +190,12 @@ class RepairHistoryListPage extends GetView<RepairInfoController> {
|
|||||||
-1, 0),
|
-1, 0),
|
||||||
child: Text(
|
child: Text(
|
||||||
'类型:' +
|
'类型:' +
|
||||||
(controller
|
getDeviceTypeName(
|
||||||
|
controller
|
||||||
.model
|
.model
|
||||||
.applyRepairModel!
|
.applyRepairModel
|
||||||
.device_type ??
|
?.device_type,
|
||||||
'未命名'),
|
),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontFamily: 'Readex Pro',
|
fontFamily: 'Readex Pro',
|
||||||
color: const Color(
|
color: const Color(
|
||||||
@@ -254,11 +252,9 @@ class RepairHistoryListPage extends GetView<RepairInfoController> {
|
|||||||
-1, 0),
|
-1, 0),
|
||||||
child: Text(
|
child: Text(
|
||||||
'提交时间:' +
|
'提交时间:' +
|
||||||
(MyUtils.formatDateTime(
|
(MyUtils.formatDateTimeDay(
|
||||||
controller
|
data['device'][0][
|
||||||
.model
|
'create_time']!)),
|
||||||
.applyRepairModel!
|
|
||||||
.create_time!)),
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontFamily: 'Readex Pro',
|
fontFamily: 'Readex Pro',
|
||||||
color: const Color(
|
color: const Color(
|
||||||
@@ -274,10 +270,8 @@ class RepairHistoryListPage extends GetView<RepairInfoController> {
|
|||||||
-1, 0),
|
-1, 0),
|
||||||
child: Text(
|
child: Text(
|
||||||
'问题描述:' +
|
'问题描述:' +
|
||||||
(controller
|
(data['device'][0]
|
||||||
.model
|
['desc'] ??
|
||||||
.applyRepairModel!
|
|
||||||
.desc ??
|
|
||||||
'未命名'),
|
'未命名'),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontFamily: 'Readex Pro',
|
fontFamily: 'Readex Pro',
|
||||||
@@ -755,4 +749,17 @@ class RepairHistoryListPage extends GetView<RepairInfoController> {
|
|||||||
|
|
||||||
return images;
|
return images;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getDeviceTypeName(int? type) {
|
||||||
|
switch (type) {
|
||||||
|
case 1:
|
||||||
|
return '体征检测设备';
|
||||||
|
case 2:
|
||||||
|
return '智能床';
|
||||||
|
case 3:
|
||||||
|
return '智能床垫';
|
||||||
|
default:
|
||||||
|
return '未知设备';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,12 +41,6 @@ class DeviceRepairPage extends GetView<RepairListController> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return LayoutBuilder(builder: (context, cc) {
|
return LayoutBuilder(builder: (context, cc) {
|
||||||
bodysize = cc;
|
bodysize = cc;
|
||||||
controller.model.repairList = List.generate(4, (index) {
|
|
||||||
return ApplyRepairModel()
|
|
||||||
..device_category = "SWESO1号智能一键入眠床"
|
|
||||||
..status = index == 0 ? "已提交" : "已完成"
|
|
||||||
..create_time = DateTime(2024, 5, 12, 12, 5, 12);
|
|
||||||
});
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () => FocusScope.of(context).unfocus(),
|
onTap: () => FocusScope.of(context).unfocus(),
|
||||||
child: Container(
|
child: Container(
|
||||||
@@ -175,54 +169,7 @@ class DeviceRepairPage extends GetView<RepairListController> {
|
|||||||
))),
|
))),
|
||||||
SizedBox(height: 24.rpx),
|
SizedBox(height: 24.rpx),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {
|
onTap: () {},
|
||||||
// bool isOk = true;
|
|
||||||
// for (var i = 0; i < 2; i++) {
|
|
||||||
// var d = controller.model.peopleList[i];
|
|
||||||
// print("${d.toJson()}");
|
|
||||||
// String before = "人员信息${i == 0 ? "A" : "B"}:";
|
|
||||||
// if (isOk &&
|
|
||||||
// d.height != null &&
|
|
||||||
// d.height != "" &&
|
|
||||||
// int.tryParse("${d.height}") == null) {
|
|
||||||
// showToast("$before身高请输入数字");
|
|
||||||
// isOk = false;
|
|
||||||
// }
|
|
||||||
// if (isOk &&
|
|
||||||
// d.weight != null &&
|
|
||||||
// d.weight != "" &&
|
|
||||||
// int.tryParse("${d.weight}") == null) {
|
|
||||||
// showToast("$before体重请输入数字");
|
|
||||||
// isOk = false;
|
|
||||||
// }
|
|
||||||
// if (isOk &&
|
|
||||||
// d.tel != null &&
|
|
||||||
// d.tel != "" &&
|
|
||||||
// MyUtils.isValidPhoneNumber("${d.tel}") ==
|
|
||||||
// false) {
|
|
||||||
// showToast("$before请输入正确的电话");
|
|
||||||
// isOk = false;
|
|
||||||
// }
|
|
||||||
// if (isOk &&
|
|
||||||
// d.emergencyContact != null &&
|
|
||||||
// d.emergencyContact != "" &&
|
|
||||||
// MyUtils.isValidPhoneNumber(
|
|
||||||
// "${d.emergencyContact}") ==
|
|
||||||
// false) {
|
|
||||||
// showToast("$before请输入正确的紧急联系人电话");
|
|
||||||
// isOk = false;
|
|
||||||
// }
|
|
||||||
// if (isOk) {
|
|
||||||
// controller.savePeoples().then((d) {
|
|
||||||
// showToast("保存成功", color: color_success);
|
|
||||||
// }).catchError((d) {
|
|
||||||
// print("$d");
|
|
||||||
// showToast("保存失败");
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// controller.model.peopleList.forEach((d) {});
|
|
||||||
},
|
|
||||||
child: CustomCard(
|
child: CustomCard(
|
||||||
borderRadius: 16.rpx,
|
borderRadius: 16.rpx,
|
||||||
gradientDirection: GradientDirection.vertical,
|
gradientDirection: GradientDirection.vertical,
|
||||||
@@ -268,119 +215,51 @@ class DeviceRepairPage extends GetView<RepairListController> {
|
|||||||
),
|
),
|
||||||
|
|
||||||
SizedBox(height: 32.rpx),
|
SizedBox(height: 32.rpx),
|
||||||
|
// Obx(() {
|
||||||
// 报修历史列表
|
// return Visibility(
|
||||||
// Expanded(
|
// visible: controller.model.repairList != null &&
|
||||||
// child: ListView.builder(
|
// controller.model.repairList!.isNotEmpty,
|
||||||
// itemCount: mockData.length,
|
// replacement: EmptyMessageWidget(),
|
||||||
// itemBuilder: (context, index) {
|
// child: Expanded(
|
||||||
// final item = mockData[index];
|
// child: Obx(() => ListView(
|
||||||
// return ClickableContainer(
|
// controller:
|
||||||
// backgroundColor: Colors.transparent,
|
// scrollController, // 绑定 ScrollController
|
||||||
// highlightColor: Color(0XFF055466),
|
// shrinkWrap: true,
|
||||||
// padding: EdgeInsets.only(top: 0),
|
// scrollDirection: Axis.vertical,
|
||||||
// onTap: () {
|
// children: (controller.model.repairList
|
||||||
// Get.toNamed("/repairHistoryListPage");
|
// .asMap()
|
||||||
// },
|
// .entries
|
||||||
// child: Container(
|
// .map((e) => RepairHistoryWidget(
|
||||||
// height: 119.rpx,
|
// index: e.key,
|
||||||
// // margin: const EdgeInsets.only(bottom: 10),
|
// repairListController: controller))
|
||||||
// // padding: const EdgeInsets.symmetric(
|
// .toList() as List<Widget>))),
|
||||||
// // vertical: 12, horizontal: 16),
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// // color: const Color(0xFF06486F),
|
|
||||||
// border: Border(
|
|
||||||
// top: index == 0
|
|
||||||
// ? BorderSide(
|
|
||||||
// color:
|
|
||||||
// const Color(0xFF929699),
|
|
||||||
// width: 1.rpx)
|
|
||||||
// : BorderSide.none,
|
|
||||||
// bottom: BorderSide(
|
|
||||||
// color: const Color(0xFF929699),
|
|
||||||
// width: 1.rpx),
|
|
||||||
// ),
|
// ),
|
||||||
// ),
|
// );
|
||||||
// child: Padding(
|
// }),
|
||||||
// padding: EdgeInsets.fromLTRB(
|
// 替换原来的 Obx(() => Visibility(...))
|
||||||
// 17.rpx, 0, 30.rpx, 0),
|
Expanded(
|
||||||
// child: Row(
|
child: Obx(() {
|
||||||
// mainAxisAlignment:
|
final hasData =
|
||||||
// MainAxisAlignment.spaceBetween,
|
controller.model.repairList != null &&
|
||||||
// crossAxisAlignment:
|
controller.model.repairList!.isNotEmpty;
|
||||||
// CrossAxisAlignment.center,
|
return hasData
|
||||||
// children: [
|
? ListView(
|
||||||
// // 左侧设备信息
|
controller: scrollController,
|
||||||
// Column(
|
padding: EdgeInsets.zero,
|
||||||
// mainAxisAlignment:
|
|
||||||
// MainAxisAlignment.center,
|
|
||||||
// crossAxisAlignment:
|
|
||||||
// CrossAxisAlignment.start,
|
|
||||||
// children: [
|
|
||||||
// Text(
|
|
||||||
// item.device_name ?? '',
|
|
||||||
// style: TextStyle(
|
|
||||||
// color: Colors.white,
|
|
||||||
// fontSize: 30.rpx),
|
|
||||||
// ),
|
|
||||||
// const SizedBox(height: 4),
|
|
||||||
// Text(
|
|
||||||
// "提交时间:${item.create_time?.toString().substring(0, 19) ?? ''}",
|
|
||||||
// style: TextStyle(
|
|
||||||
// color: Colors.white60,
|
|
||||||
// fontSize: 20.rpx),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// // 右侧状态
|
|
||||||
// Row(
|
|
||||||
// children: [
|
|
||||||
// Text(
|
|
||||||
// item.status ?? '',
|
|
||||||
// style: TextStyle(
|
|
||||||
// color: Colors.white,
|
|
||||||
// fontSize: 26.rpx),
|
|
||||||
// ),
|
|
||||||
// Icon(Icons.arrow_forward_ios,
|
|
||||||
// color: Colors.white,
|
|
||||||
// size: 30.rpx),
|
|
||||||
// ],
|
|
||||||
// )
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// )));
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
|
|
||||||
Obx(() {
|
|
||||||
return Visibility(
|
|
||||||
visible: controller.model.repairList != null &&
|
|
||||||
controller.model.repairList!.isNotEmpty,
|
|
||||||
replacement: EmptyMessageWidget(),
|
|
||||||
child: Expanded(
|
|
||||||
child: Obx(() => ListView(
|
|
||||||
controller:
|
|
||||||
scrollController, // 绑定 ScrollController
|
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
scrollDirection: Axis.vertical,
|
children: controller.model.repairList
|
||||||
children: (controller.model.repairList
|
|
||||||
.asMap()
|
.asMap()
|
||||||
.entries
|
.entries
|
||||||
.map((e) => RepairHistoryWidget(
|
.map((e) => RepairHistoryWidget(
|
||||||
index: e.key,
|
index: e.key,
|
||||||
repairListController: controller))
|
repairListController:
|
||||||
.toList() as List<Widget>)
|
controller,
|
||||||
// .divide(const SizedBox(
|
))
|
||||||
// height: 13,
|
.toList(),
|
||||||
// ))
|
)
|
||||||
// .addToEnd(SizedBox(
|
: EmptyMessageWidget();
|
||||||
// height: AppConstants.list_end_height,
|
|
||||||
// ))
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}),
|
}),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
))),
|
))),
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ class _UpdateUserPageState extends State<EditUserPage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
left: 0,
|
left: 20.rpx,
|
||||||
child: returnIconButtomNew,
|
child: returnIconButtomNew,
|
||||||
),
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
|
|||||||
@@ -491,7 +491,6 @@ class _ApplyRepairPageState extends State<ApplyRepairPage> {
|
|||||||
cursorColor: themeController.currentColor.sc3,
|
cursorColor: themeController.currentColor.sc3,
|
||||||
onChanged: onChanged,
|
onChanged: onChanged,
|
||||||
),
|
),
|
||||||
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
].divide(SizedBox(width: 24.rpx)),
|
].divide(SizedBox(width: 24.rpx)),
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ dependencies:
|
|||||||
fluwx: ^5.5.2
|
fluwx: ^5.5.2
|
||||||
connectivity_plus: ^6.1.4
|
connectivity_plus: ^6.1.4
|
||||||
google_sign_in: ^6.2.1
|
google_sign_in: ^6.2.1
|
||||||
|
azlistview: ^2.0.0
|
||||||
path: ^1.8.0
|
path: ^1.8.0
|
||||||
flutter_pdfview: ^1.4.0+1
|
flutter_pdfview: ^1.4.0+1
|
||||||
flutter_switch: ^0.3.2
|
flutter_switch: ^0.3.2
|
||||||
@@ -55,6 +56,7 @@ dependencies:
|
|||||||
flutter_slidable: ^3.1.1
|
flutter_slidable: ^3.1.1
|
||||||
flutter_city_picker: ^2.1.1
|
flutter_city_picker: ^2.1.1
|
||||||
weather: ^3.1.1
|
weather: ^3.1.1
|
||||||
|
lpinyin: ^2.0.3
|
||||||
geocoding: ^2.1.0
|
geocoding: ^2.1.0
|
||||||
# fl_chart: ^1.0.0
|
# fl_chart: ^1.0.0
|
||||||
video_player: ^2.9.5
|
video_player: ^2.9.5
|
||||||
|
|||||||
Reference in New Issue
Block a user