地址接口的视线

This commit is contained in:
czz
2025-06-21 08:55:52 +08:00
parent d94a0c8a6c
commit 41adcedad7
38 changed files with 2399 additions and 2223 deletions

View File

@@ -7,16 +7,20 @@ import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart';
class RoomPickerPage extends StatefulWidget {
final Map data;
RoomPickerPage({Key? key, required this.data});
@override
_RoomPickerPageState createState() => _RoomPickerPageState();
}
class _RoomPickerPageState extends State<RoomPickerPage> {
late Map<String, dynamic> editedData;
RxList rooms = [].obs;
@override
void initState() {
super.initState();
editedData = Map.from(widget.data); // 创建副本
getRoomList();
}
@@ -31,6 +35,7 @@ class _RoomPickerPageState extends State<RoomPickerPage> {
queryUrl: queryUrl,
onSuccess: (res) {
rooms.assignAll(res.data);
setState(() => selectedIndex = 0);
},
);
}
@@ -161,8 +166,32 @@ class _RoomPickerPageState extends State<RoomPickerPage> {
child: CustomCard(
borderRadius: 16.rpx,
gradientDirection: GradientDirection.vertical,
onTap: () {
onTap: () async {
// Get.toNamed("/applyRepairPage");
try {
String serviceAddress =
ServiceConstant.service_address;
String serviceName =
ServiceConstant.server_service;
String serviceApi =
ServiceConstant.device_show;
String queryUrl =
"$serviceAddress$serviceName$serviceApi";
await requestWithLog(
logTitle: "更新设备信息",
method: MyHttpMethod.put,
queryUrl: queryUrl,
data: {
"id": editedData["_id"],
"roomId": rooms[selectedIndex]['_id'],
},
onSuccess: (res) {
'更新人员信息成功: $res';
},
);
} catch (e) {
print(e);
}
},
colors: const [
Color(0xFFFCFCFC),