地址接口的视线
This commit is contained in:
@@ -42,7 +42,8 @@ class _MattressControlPageState extends State<MattressControlPage> {
|
||||
"failure": 0,
|
||||
"updateTime": -1
|
||||
},
|
||||
"code": "545024122666"
|
||||
"code": "545024122666",
|
||||
"blueToothStatus": 1
|
||||
};
|
||||
int selectedIndex = 1; // 当前选中的tab索引
|
||||
@override
|
||||
@@ -120,16 +121,13 @@ class _MattressControlPageState extends State<MattressControlPage> {
|
||||
highlightColor: Colors.transparent,
|
||||
padding: EdgeInsets.only(right: 69.rpx),
|
||||
onTap: () {},
|
||||
child: Image.asset(
|
||||
child:
|
||||
//根据data['status']判断用那个svg
|
||||
Image.asset(
|
||||
'assets/images/active_bluetooth.png',
|
||||
width: 42.rpx,
|
||||
height: 42.rpx,
|
||||
),
|
||||
// Icon(
|
||||
// Icons.bluetooth,
|
||||
// color: Colors.white,
|
||||
// size: 42.rpx,
|
||||
// ),
|
||||
),
|
||||
ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
|
||||
@@ -13,17 +13,21 @@ import 'package:vbvs_app/component/img/img_preview_widget.dart';
|
||||
import 'package:vbvs_app/component/tool/CustomCard.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/mh_controller/apply_repair_controller.dart';
|
||||
import 'package:vbvs_app/controller/mh_controller/repair_list_controller.dart';
|
||||
import 'package:vbvs_app/controller/repair/repair_controller.dart';
|
||||
import 'package:vbvs_app/model/api_response.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/applyRepair/apply_repair_success.dart';
|
||||
|
||||
class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
BoxConstraints? bodysize;
|
||||
RepairController repairController = Get.find();
|
||||
|
||||
RepairListController repairListController = Get.find();
|
||||
ApplyRepairController applyRepairController = Get.find();
|
||||
ApplyRepairPage() {
|
||||
controller.attr.value.listenlists.clear();
|
||||
controller.getDeviceList();
|
||||
controller.model.device_type = "";
|
||||
controller.model.device_type = null;
|
||||
controller.model.select_device = "";
|
||||
controller.model.device_category = "";
|
||||
controller.model.device_name = "";
|
||||
@@ -37,9 +41,6 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
Widget build(BuildContext context) {
|
||||
var tmpcontroller =
|
||||
FormFieldController<String>(controller.model.select_device);
|
||||
var typecontroller =
|
||||
FormFieldController<String>(controller.model.device_type);
|
||||
controller.model.address;
|
||||
List<String> deviceTypeNames = ['床', '床垫'];
|
||||
List<String> deviceTypeIds = ['床', '床垫'];
|
||||
return LayoutBuilder(builder: (context, cc) {
|
||||
@@ -259,9 +260,10 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
(val) {
|
||||
var selectedDevice = controller.model.device_list!.firstWhere((device) => device['_id'].toString() == val);
|
||||
controller.model.select_device = val;
|
||||
controller.model.device_type = selectedDevice['type'] == 1 ? '床' : '床垫';
|
||||
controller.model.device_category = selectedDevice['deviceSeries']['name'] ?? '未知型号'; // 获取设备型号
|
||||
controller.model.device_id = selectedDevice['mac'] ?? '未知设备ID'; // 获取设备ID
|
||||
controller.model.device_type = selectedDevice['device_type'];
|
||||
// controller.model.device_category = selectedDevice['deviceSeries']['name'] ?? '未知型号'; // 获取设备型号
|
||||
controller.model.device_category = '未知型号';
|
||||
controller.model.device_id = selectedDevice['_id'] ?? '未知设备ID'; // 获取设备ID
|
||||
controller.model.device_name = selectedDevice['name'] ?? '未知设备'; // 获取设备名称
|
||||
controller.updateAll();
|
||||
},
|
||||
@@ -373,107 +375,24 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: 100,
|
||||
height: 100,
|
||||
decoration:
|
||||
BoxDecoration(
|
||||
color: Colors
|
||||
.white,
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(
|
||||
8),
|
||||
),
|
||||
child:
|
||||
TextFormField(
|
||||
// autofocus: true,
|
||||
onChanged:
|
||||
(value) {
|
||||
controller
|
||||
.model
|
||||
.device_type =
|
||||
value;
|
||||
},
|
||||
obscureText:
|
||||
false,
|
||||
width: 100,
|
||||
height: 100,
|
||||
decoration:
|
||||
InputDecoration(
|
||||
isDense:
|
||||
true,
|
||||
labelStyle:
|
||||
const TextStyle(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
letterSpacing:
|
||||
0,
|
||||
),
|
||||
hintStyle:
|
||||
const TextStyle(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
letterSpacing:
|
||||
0,
|
||||
),
|
||||
enabledBorder:
|
||||
OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(
|
||||
color: const Color(
|
||||
0x00000000),
|
||||
width: 1
|
||||
.rpx,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
AppConstants().normal_container_radius),
|
||||
),
|
||||
focusedBorder:
|
||||
OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(
|
||||
color: Colors
|
||||
.transparent,
|
||||
width: 1
|
||||
.rpx,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8.rpx),
|
||||
),
|
||||
errorBorder:
|
||||
OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(
|
||||
//
|
||||
width: 1
|
||||
.rpx,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8.rpx),
|
||||
),
|
||||
focusedErrorBorder:
|
||||
OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(
|
||||
//
|
||||
width: 1
|
||||
.rpx,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8.rpx),
|
||||
),
|
||||
BoxDecoration(
|
||||
color: Colors
|
||||
.white,
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(8),
|
||||
),
|
||||
style: TextStyle(
|
||||
letterSpacing:
|
||||
0,
|
||||
color: Colors
|
||||
.black,
|
||||
fontSize:
|
||||
26.rpx),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(left: 26.rpx),
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Obx(() => Text(
|
||||
getDeviceTypeName(controller.model.device_type),
|
||||
style: TextStyle(fontSize: 26.rpx, color: Colors.black),
|
||||
))))),
|
||||
),
|
||||
].divide(SizedBox(
|
||||
width: 26.rpx)),
|
||||
@@ -526,107 +445,24 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: 100,
|
||||
height: 100,
|
||||
decoration:
|
||||
BoxDecoration(
|
||||
color: Colors
|
||||
.white,
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(
|
||||
8),
|
||||
),
|
||||
child:
|
||||
TextFormField(
|
||||
// autofocus: true,
|
||||
onChanged:
|
||||
(value) {
|
||||
controller
|
||||
.model
|
||||
.device_category =
|
||||
value;
|
||||
},
|
||||
obscureText:
|
||||
false,
|
||||
width: 100,
|
||||
height: 100,
|
||||
decoration:
|
||||
InputDecoration(
|
||||
isDense:
|
||||
true,
|
||||
labelStyle:
|
||||
const TextStyle(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
letterSpacing:
|
||||
0,
|
||||
),
|
||||
hintStyle:
|
||||
const TextStyle(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
letterSpacing:
|
||||
0,
|
||||
),
|
||||
enabledBorder:
|
||||
OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(
|
||||
color: const Color(
|
||||
0x00000000),
|
||||
width: 1
|
||||
.rpx,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
AppConstants().normal_container_radius),
|
||||
),
|
||||
focusedBorder:
|
||||
OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(
|
||||
color: Colors
|
||||
.transparent,
|
||||
width: 1
|
||||
.rpx,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8.rpx),
|
||||
),
|
||||
errorBorder:
|
||||
OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(
|
||||
//
|
||||
width: 1
|
||||
.rpx,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8.rpx),
|
||||
),
|
||||
focusedErrorBorder:
|
||||
OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(
|
||||
//
|
||||
width: 1
|
||||
.rpx,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8.rpx),
|
||||
),
|
||||
BoxDecoration(
|
||||
color: Colors
|
||||
.white,
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(8),
|
||||
),
|
||||
style: TextStyle(
|
||||
letterSpacing:
|
||||
0,
|
||||
color: Colors
|
||||
.black,
|
||||
fontSize:
|
||||
26.rpx),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(left: 26.rpx),
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Obx(() => Text(
|
||||
controller.model.device_category ?? '',
|
||||
style: TextStyle(fontSize: 26.rpx, color: Colors.black),
|
||||
))))),
|
||||
),
|
||||
].divide(SizedBox(
|
||||
width: 26.rpx)),
|
||||
@@ -679,107 +515,24 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: 100,
|
||||
height: 100,
|
||||
decoration:
|
||||
BoxDecoration(
|
||||
color: const Color(
|
||||
0xFFF3F5F6),
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(
|
||||
8),
|
||||
),
|
||||
child:
|
||||
TextFormField(
|
||||
// autofocus: true,
|
||||
onChanged:
|
||||
(value) {
|
||||
controller
|
||||
.model
|
||||
.device_id =
|
||||
value;
|
||||
},
|
||||
obscureText:
|
||||
false,
|
||||
width: 100,
|
||||
height: 100,
|
||||
decoration:
|
||||
InputDecoration(
|
||||
isDense:
|
||||
true,
|
||||
labelStyle:
|
||||
const TextStyle(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
letterSpacing:
|
||||
0,
|
||||
),
|
||||
hintStyle:
|
||||
const TextStyle(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
letterSpacing:
|
||||
0,
|
||||
),
|
||||
enabledBorder:
|
||||
OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(
|
||||
color: const Color(
|
||||
0x00000000),
|
||||
width: 1
|
||||
.rpx,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
AppConstants().normal_container_radius),
|
||||
),
|
||||
focusedBorder:
|
||||
OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(
|
||||
color: Colors
|
||||
.transparent,
|
||||
width: 1
|
||||
.rpx,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8.rpx),
|
||||
),
|
||||
errorBorder:
|
||||
OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(
|
||||
//
|
||||
width: 1
|
||||
.rpx,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8.rpx),
|
||||
),
|
||||
focusedErrorBorder:
|
||||
OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(
|
||||
//
|
||||
width: 1
|
||||
.rpx,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8.rpx),
|
||||
),
|
||||
BoxDecoration(
|
||||
color: Colors
|
||||
.white,
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(8),
|
||||
),
|
||||
style: TextStyle(
|
||||
letterSpacing:
|
||||
0,
|
||||
color: Colors
|
||||
.black,
|
||||
fontSize:
|
||||
26.rpx),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(left: 26.rpx),
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Obx(() => Text(
|
||||
controller.model.device_id ?? '',
|
||||
style: TextStyle(fontSize: 26.rpx, color: Colors.black),
|
||||
))))),
|
||||
),
|
||||
].divide(SizedBox(
|
||||
width: 26.rpx)),
|
||||
@@ -833,21 +586,11 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
ApiResponse apiResponse =
|
||||
await repairController
|
||||
await applyRepairController
|
||||
.uploadImg();
|
||||
print(apiResponse);
|
||||
|
||||
if (apiResponse.code ==
|
||||
HttpStatusCodes.ok) {
|
||||
print(controller.model);
|
||||
// setState(() {
|
||||
// controller.model['path'] = apiResponse.data['path'];
|
||||
// });
|
||||
controller.model.issue_img!
|
||||
.add(apiResponse
|
||||
.data['path']);
|
||||
repairController.repairList
|
||||
.refresh(); // 通知 Obx 更新(如果用了 GetX)
|
||||
print(controller.model);
|
||||
} else {
|
||||
if (controller.model
|
||||
.issue_img ==
|
||||
@@ -1702,53 +1445,58 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
borderRadius: 16.rpx,
|
||||
gradientDirection: GradientDirection.vertical,
|
||||
onTap: () async {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "功能开发中...",
|
||||
);
|
||||
// Get.toNamed("/applyRepairSuccess");
|
||||
// String msg = checkRepairParam();
|
||||
// if (msg.isNotEmpty) {
|
||||
// TopSlideNotification.show(context,
|
||||
// text: msg,
|
||||
// textColor:
|
||||
// themeController.currentColor.sc9);
|
||||
// } else {
|
||||
// String serviceAddress =
|
||||
// ServiceConstant.service_address;
|
||||
// String serviceName =
|
||||
// ServiceConstant.server_service;
|
||||
// String serviceApi =
|
||||
// ServiceConstant.submit_repair;
|
||||
// String queryUrl =
|
||||
// "$serviceAddress$serviceName$serviceApi";
|
||||
// var data = {
|
||||
// "device": repairController.repairList.value,
|
||||
// "type": repairController.device_type.value,
|
||||
// "contacts": {
|
||||
// "name": repairController.name.value,
|
||||
// "phone": repairController.phone.value
|
||||
// },
|
||||
// };
|
||||
// ApiResponse apiResponse = await requestWithLog(
|
||||
// logTitle: "提交报修信息",
|
||||
// method: MyHttpMethod.post,
|
||||
// queryUrl: queryUrl,
|
||||
// data: data,
|
||||
// onSuccess: (res) {
|
||||
// TopSlideNotification.show(context,
|
||||
// text: res.msg!);
|
||||
// // Get.back();
|
||||
// Get.toNamed("/applyRepairSuccess");
|
||||
// },
|
||||
// onFailure: (res) {
|
||||
// TopSlideNotification.show(context,
|
||||
// text: res.msg!,
|
||||
// textColor:
|
||||
// themeController.currentColor.sc9);
|
||||
// },
|
||||
// );
|
||||
//}
|
||||
String msg = checkRepairParam();
|
||||
if (msg.isNotEmpty) {
|
||||
TopSlideNotification.show(context,
|
||||
text: msg,
|
||||
textColor:
|
||||
themeController.currentColor.sc9);
|
||||
} else {
|
||||
String serviceAddress =
|
||||
ServiceConstant.service_address;
|
||||
String serviceName =
|
||||
ServiceConstant.server_service;
|
||||
String serviceApi =
|
||||
ServiceConstant.submit_repair;
|
||||
String queryUrl =
|
||||
"$serviceAddress$serviceName$serviceApi";
|
||||
var data = {
|
||||
"type": controller.model.device_type,
|
||||
"contacts": {
|
||||
"name": controller.model.apply_name,
|
||||
"phone": controller.model.tel,
|
||||
},
|
||||
"device": [
|
||||
{
|
||||
"mac": controller.model.device_id,
|
||||
"desc": controller.model.desc,
|
||||
"img": controller.model.issue_img,
|
||||
}
|
||||
],
|
||||
};
|
||||
ApiResponse apiResponse = await requestWithLog(
|
||||
logTitle: "提交报修信息",
|
||||
method: MyHttpMethod.post,
|
||||
queryUrl: queryUrl,
|
||||
data: data,
|
||||
onSuccess: (res) {
|
||||
TopSlideNotification.show(context,
|
||||
text: res.msg!);
|
||||
|
||||
Get.toNamed("/applyRepairSuccess");
|
||||
// repairListController.getRepairList();
|
||||
},
|
||||
onFailure: (res) {
|
||||
TopSlideNotification.show(context,
|
||||
text: res.msg!,
|
||||
textColor:
|
||||
themeController.currentColor.sc9);
|
||||
},
|
||||
);
|
||||
controller.model =
|
||||
ApplyRepairModel(); // 在 submitRepair 完成后执行
|
||||
controller.updateAll();
|
||||
}
|
||||
},
|
||||
colors: const [
|
||||
Color(0xFFFCFCFC),
|
||||
@@ -1819,61 +1567,54 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
}
|
||||
|
||||
String checkRepairParam() {
|
||||
String errormsg = "";
|
||||
String message = "";
|
||||
|
||||
// 检查报修项
|
||||
for (var i = 0; i < repairController.repairList.length; i++) {
|
||||
final item = repairController.repairList[i];
|
||||
if (controller.model.device_type == null ||
|
||||
controller.model.device_type == 0) {
|
||||
message = '请选择设备类型!';
|
||||
return message;
|
||||
}
|
||||
if (controller.model.device_category == null ||
|
||||
controller.model.device_category!.isEmpty) {
|
||||
message = '请输入设备型号!';
|
||||
return message;
|
||||
}
|
||||
if (controller.model.device_id == null ||
|
||||
controller.model.device_id!.isEmpty) {
|
||||
message = '请输入设备序列号id!';
|
||||
return message;
|
||||
}
|
||||
if (controller.model.apply_name == null ||
|
||||
controller.model.apply_name!.isEmpty) {
|
||||
message = '请输入姓名!';
|
||||
return message;
|
||||
}
|
||||
RegExp nameRegExp = RegExp(r'^[\u4e00-\u9fa5]{2,4}$');
|
||||
|
||||
if (item["path"] == null || item["path"].toString().isEmpty) {
|
||||
_scrollToKey(repairItemKeys[i]);
|
||||
// return "第 ${i + 1} 项图片未上传";
|
||||
return "图片未上传".tr;
|
||||
}
|
||||
if (item["id"] == null || item["id"].toString().isEmpty) {
|
||||
_scrollToKey(repairItemKeys[i]);
|
||||
// return "第 ${i + 1} 项设备未选择";
|
||||
return "设备未选择".tr;
|
||||
}
|
||||
if (item["param"] == null || item["param"].toString().isEmpty) {
|
||||
_scrollToKey(repairItemKeys[i]);
|
||||
// return "第 ${i + 1} 项参数未填写";
|
||||
return "参数未填写".tr;
|
||||
}
|
||||
if (item["issue"] == null || item["issue"].toString().isEmpty) {
|
||||
_scrollToKey(repairItemKeys[i]);
|
||||
// return "第 ${i + 1} 项问题描述未填写";
|
||||
return "问题描述未填写".tr;
|
||||
}
|
||||
if (item["issue"] != null && item["issue"].toString().trim().isNotEmpty) {
|
||||
final issueText = item["issue"].toString().trim();
|
||||
final charCount = issueText.runes.length;
|
||||
if (!nameRegExp.hasMatch(controller.model.apply_name!)) {
|
||||
message = '姓名必须为2到4个汉字!';
|
||||
|
||||
if (charCount > 60) {
|
||||
_scrollToKey(repairItemKeys[i]);
|
||||
return "问题描述最多输入60个字".tr;
|
||||
}
|
||||
} else {
|
||||
_scrollToKey(repairItemKeys[i]);
|
||||
return "问题描述不能为空".tr;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
if (controller.model.tel == null || controller.model.tel!.isEmpty) {
|
||||
message = '请输入手机号!';
|
||||
return message;
|
||||
}
|
||||
if (!MyUtils.isValidPhoneNumber(controller.model.tel!)) {
|
||||
message = '无效的手机号!';
|
||||
return message;
|
||||
}
|
||||
|
||||
// 检查联系人
|
||||
if (repairController.name.trim().isEmpty) {
|
||||
_scrollToKey(contactKey);
|
||||
return "联系人不能为空".tr;
|
||||
if (controller.model.desc == null || controller.model.desc!.isEmpty) {
|
||||
message = '请输入问题描述!';
|
||||
return message;
|
||||
}
|
||||
if (repairController.phone.trim().isEmpty) {
|
||||
_scrollToKey(phoneKey);
|
||||
return "联系电话不能为空".tr;
|
||||
if (controller.model.issue_img == null ||
|
||||
controller.model.issue_img!.isEmpty) {
|
||||
message = '请至少上传一张问题图片!';
|
||||
return message;
|
||||
}
|
||||
if (!MyUtils.isValidPhoneNumber(repairController.phone.trim())) {
|
||||
_scrollToKey(phoneKey);
|
||||
return "无效的手机号码".tr;
|
||||
}
|
||||
|
||||
return errormsg;
|
||||
return message;
|
||||
}
|
||||
|
||||
// 新增滚动方法
|
||||
@@ -1886,4 +1627,18 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
String getDeviceTypeName(int? type) {
|
||||
if (type == null) return '';
|
||||
switch (type) {
|
||||
case 1:
|
||||
return '体征检测设备';
|
||||
case 2:
|
||||
return '智能床';
|
||||
case 3:
|
||||
return '智能床垫';
|
||||
default:
|
||||
return '未知设备';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,15 +107,27 @@ class BluetoothPage extends GetView {
|
||||
// 蓝牙连接状态
|
||||
Column(
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/images/active_bluetooth.png',
|
||||
width: 68.rpx,
|
||||
height: 68.rpx,
|
||||
),
|
||||
data['blueToothStatus'] == 1
|
||||
? SvgPicture.asset(
|
||||
'assets/img/icon/blue_fail.svg',
|
||||
width: 68.rpx,
|
||||
height: 68.rpx,
|
||||
)
|
||||
: SvgPicture.asset(
|
||||
'assets/img/icon/blue_success.svg',
|
||||
width: 68.rpx,
|
||||
height: 68.rpx,
|
||||
),
|
||||
SizedBox(height: 4),
|
||||
Text('已连接',
|
||||
//下面文字和颜色也根据上面变化
|
||||
Text(
|
||||
data['blueToothStatus'] == 1
|
||||
? '未连接'
|
||||
: '已连接',
|
||||
style: TextStyle(
|
||||
color: Color(0xFF6BFDAC),
|
||||
color: data['blueToothStatus'] == 1
|
||||
? Color(0xFFFF7159)
|
||||
: Color(0xFF6BFDAC),
|
||||
fontSize: 26.rpx)),
|
||||
],
|
||||
),
|
||||
@@ -136,7 +148,8 @@ class BluetoothPage extends GetView {
|
||||
context, '人员资料', "/peopleInfoPage",
|
||||
arguments: data),
|
||||
_buildMenuButton(
|
||||
context, '房间选择', "/roomPickerPage",arguments: data),
|
||||
context, '房间选择', "/roomPickerPage",
|
||||
arguments: data),
|
||||
_buildMenuButton(context, '设备校准', ""),
|
||||
_buildMenuButton(context, '体征传感器', ""),
|
||||
_buildMenuButton(context, 'WIFI配置', ""),
|
||||
|
||||
@@ -631,7 +631,8 @@ class _MHTBlueteethDevicePageState extends State<MHTBlueteethDevicePage> {
|
||||
)),
|
||||
)),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0, 52.rpx, 0, 0),
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0, 52.rpx, 0, 30.rpx),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/common/util/requestWithLog.dart';
|
||||
import 'package:vbvs_app/component/tool/CustomCard.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
|
||||
class EditBedPage extends StatefulWidget {
|
||||
final Map data;
|
||||
@@ -171,6 +172,8 @@ class _EditBedPageState extends State<EditBedPage> {
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
letterSpacing: 0,
|
||||
color: Colors.white,
|
||||
fontSize: 26.rpx,
|
||||
),
|
||||
),
|
||||
))
|
||||
@@ -200,7 +203,8 @@ class _EditBedPageState extends State<EditBedPage> {
|
||||
"name": editedData["name"],
|
||||
},
|
||||
onSuccess: (res) {
|
||||
'更新人员信息成功: $res';
|
||||
TopSlideNotification.show(context,
|
||||
text: "修改名称成功".tr);
|
||||
},
|
||||
);
|
||||
},
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:vbvs_app/common/color/appColors.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/mh_controller/repair_info_controller.dart';
|
||||
import 'package:vbvs_app/controller/mh_controller/repair_list_controller.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/ColorChangeOnTap.dart';
|
||||
@@ -23,133 +24,19 @@ class RepairHistoryWidget extends GetView<RepairInfoController> {
|
||||
Widget build(BuildContext context) {
|
||||
int tmp = index;
|
||||
index = tmp;
|
||||
// return ColorChangeOnPress(
|
||||
// pressColor: AppColors().press_color, // 按下时的颜色
|
||||
// shouldNavigate: true, // 是否需要跳转
|
||||
// routeName: "/repairHistoryListPage", // 路由名称
|
||||
// topLeft: 16,
|
||||
// topRight: 16,
|
||||
// bottomLeft: 16,
|
||||
// bottomRight: 16,
|
||||
// onTap: () async {
|
||||
// print("object");
|
||||
// final RepairInfoController repairInfoController =
|
||||
// Get.find<RepairInfoController>();
|
||||
// await repairInfoController
|
||||
// .initData(repairListController.model.repairList[index])
|
||||
// .then((_) {
|
||||
// repairInfoController.updateAll();
|
||||
// // Get.toNamed("/repairHistoryListPage"); // 这个在 ColorChangeOnPress 中已经处理
|
||||
// });
|
||||
// },
|
||||
// child: Container(
|
||||
// width: MediaQuery.sizeOf(context).width,
|
||||
// constraints: BoxConstraints(
|
||||
// minHeight: 70,
|
||||
// ),
|
||||
// child: Padding(
|
||||
// padding: EdgeInsetsDirectional.fromSTEB(15, 14, 15, 13),
|
||||
// child: Row(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// Container(
|
||||
// width: MediaQuery.sizeOf(context).width * 0.5,
|
||||
// child: Column(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// children: [
|
||||
// Align(
|
||||
// alignment: AlignmentDirectional(-1, 0),
|
||||
// child: Text(
|
||||
// repairListController
|
||||
// .model.repairList[index].device_category ??
|
||||
// '',
|
||||
// style: TextStyle(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// color: Color(0xFF333333),
|
||||
// fontSize: 30.rpx,
|
||||
// letterSpacing: 0,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// Align(
|
||||
// alignment: AlignmentDirectional(-1, 0),
|
||||
// child: Text(
|
||||
// "报修单号:${repairListController.model.repairList[index].id}",
|
||||
// style: TextStyle(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// color: Color(0xFFC8CBD2),
|
||||
// fontSize: AppFontsize.small_text_size,
|
||||
// letterSpacing: 0,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// Align(
|
||||
// alignment: AlignmentDirectional(-1, 0),
|
||||
// child: Text(
|
||||
// "提交时间:" +
|
||||
// (MyUtils.formatDateTime(repairListController
|
||||
// .model.repairList[index].create_time!) ??
|
||||
// ''),
|
||||
// style: TextStyle(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// color: Color(0xFFC8CBD2),
|
||||
// fontSize: AppFontsize.small_text_size,
|
||||
// letterSpacing: 0,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// Container(
|
||||
// width: MediaQuery.sizeOf(context).width * 0.2,
|
||||
// height: MediaQuery.sizeOf(context).height * 0.075,
|
||||
// constraints: BoxConstraints(
|
||||
// maxWidth: 130,
|
||||
// ),
|
||||
// child: Row(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// Align(
|
||||
// alignment: AlignmentDirectional(0, 0),
|
||||
// child: Text(
|
||||
// repairListController.model.repairList[index].status ??
|
||||
// '',
|
||||
// style: TextStyle(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// color: Color(0xFF333333),
|
||||
// fontSize: AppFontsize.normal_text_size,
|
||||
// letterSpacing: 0,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// Flexible(
|
||||
// child: Align(
|
||||
// alignment: AlignmentDirectional(0, 0.05),
|
||||
// child: Icon(
|
||||
// Icons.arrow_forward_ios,
|
||||
// color: FlutterFlowTheme.of(context).secondaryText,
|
||||
// size: 10,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ].divide(SizedBox(width: 27)),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
|
||||
return ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: Color(0XFF055466),
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
onTap: () {
|
||||
Get.toNamed("/repairHistoryListPage");
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "功能开发中...",
|
||||
);
|
||||
|
||||
// Get.toNamed("/repairHistoryListPage",
|
||||
// arguments: repairListController.model.repairList[index]);
|
||||
},
|
||||
child: Container(
|
||||
// height: 119.rpx,
|
||||
@@ -176,8 +63,8 @@ class RepairHistoryWidget extends GetView<RepairInfoController> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
repairListController
|
||||
.model.repairList[index].device_category ??
|
||||
repairListController.model.repairList[index]['device']
|
||||
[0]['mac'] ??
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 30.rpx, height: 1),
|
||||
@@ -185,8 +72,8 @@ class RepairHistoryWidget extends GetView<RepairInfoController> {
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
"提交时间:" +
|
||||
(MyUtils.formatDateTime(repairListController
|
||||
.model.repairList[index].create_time!) ??
|
||||
(MyUtils.formatTimestamp(repairListController
|
||||
.model.repairList[index]["create_time"]) ??
|
||||
''),
|
||||
style: TextStyle(
|
||||
color: Colors.white60, fontSize: 20.rpx, height: 1),
|
||||
@@ -197,8 +84,8 @@ class RepairHistoryWidget extends GetView<RepairInfoController> {
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
repairListController.model.repairList[index].status ??
|
||||
'',
|
||||
getStatusText(repairListController
|
||||
.model.repairList[index]['status']),
|
||||
style: TextStyle(color: Colors.white, fontSize: 26.rpx),
|
||||
),
|
||||
ClickableContainer(
|
||||
@@ -225,4 +112,23 @@ class RepairHistoryWidget extends GetView<RepairInfoController> {
|
||||
),
|
||||
)));
|
||||
}
|
||||
|
||||
String getStatusText(dynamic status) {
|
||||
switch (status?.toString()) {
|
||||
case '1':
|
||||
return '审核中';
|
||||
case '2':
|
||||
return '审核通过';
|
||||
case '3':
|
||||
return '维修中';
|
||||
case '4':
|
||||
return '维修完成';
|
||||
case '5':
|
||||
return '已完成';
|
||||
case '6':
|
||||
return '已评价';
|
||||
default:
|
||||
return '未知状态';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
||||
import 'package:vbvs_app/component/tool/CustomCard.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/device/body_device_controller.dart';
|
||||
import 'package:vbvs_app/controller/mh_controller/apply_repair_controller.dart';
|
||||
import 'package:vbvs_app/controller/repair/repair_controller.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
import 'package:vbvs_app/model/api_response.dart';
|
||||
@@ -28,7 +29,7 @@ class RepairModelWidget extends StatefulWidget {
|
||||
required this.onTap,
|
||||
required this.length,
|
||||
required this.widgetKey,
|
||||
this.showDelete = true, // ✅ 默认为 false
|
||||
this.showDelete = true, // ✅ 默认为 false
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -38,6 +39,7 @@ class RepairModelWidget extends StatefulWidget {
|
||||
class _RepairModelWidgetState extends State<RepairModelWidget> {
|
||||
FormFieldController<String> _deviceController =
|
||||
FormFieldController<String>(null);
|
||||
ApplyRepairController applyRepairController = Get.find();
|
||||
RepairController repairController = Get.find();
|
||||
UserInfoController userInfoController = Get.find();
|
||||
late FormFieldController<String?>? _issueController;
|
||||
@@ -143,7 +145,7 @@ class _RepairModelWidgetState extends State<RepairModelWidget> {
|
||||
),
|
||||
icon: Icon(
|
||||
Icons.keyboard_arrow_down_rounded,
|
||||
color:Colors.white,
|
||||
color: Colors.white,
|
||||
size: 24.rpx,
|
||||
),
|
||||
fillColor: themeController.currentColor.sc15,
|
||||
@@ -342,7 +344,8 @@ class _RepairModelWidgetState extends State<RepairModelWidget> {
|
||||
borderRadius: 20.rpx,
|
||||
padding: EdgeInsets.zero,
|
||||
onTap: () async {
|
||||
ApiResponse apiResponse = await repairController.uploadImg();
|
||||
ApiResponse apiResponse =
|
||||
await applyRepairController.uploadImg();
|
||||
print(apiResponse);
|
||||
if (apiResponse.code == HttpStatusCodes.ok) {
|
||||
print(widget.model);
|
||||
@@ -454,7 +457,7 @@ class _RepairModelWidgetState extends State<RepairModelWidget> {
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(height: 29.rpx)),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user