This commit is contained in:
18631081161 2025-09-22 16:19:29 +08:00
parent 19f0eec34f
commit 971d120ac5
5 changed files with 75 additions and 118 deletions

View File

@ -27,6 +27,9 @@ class OdfDetailsBean {
String? updatedAt;
String? statusLabel;
String? deptName;
String? equipmentModel;
String? businessType;
OdfDetailsBean(
this.id,
@ -49,7 +52,9 @@ class OdfDetailsBean {
this.createdAt,
this.updatedAt,
this.statusLabel,
this.deptName);
this.deptName,
this.equipmentModel,
this.businessType);
factory OdfDetailsBean.fromJson(Map<String, dynamic> json) => _$OdfDetailsBeanFromJson(json);

View File

@ -31,6 +31,8 @@ OdfDetailsBean _$OdfDetailsBeanFromJson(Map<String, dynamic> json) =>
json['updatedAt'] as String?,
json['statusLabel'] as String?,
json['deptName'] as String?,
json['equipmentModel'] as String?,
json['businessType'] as String?,
);
Map<String, dynamic> _$OdfDetailsBeanToJson(OdfDetailsBean instance) =>
@ -56,4 +58,6 @@ Map<String, dynamic> _$OdfDetailsBeanToJson(OdfDetailsBean instance) =>
'updatedAt': instance.updatedAt,
'statusLabel': instance.statusLabel,
'deptName': instance.deptName,
'equipmentModel': instance.equipmentModel,
'businessType': instance.businessType,
};

View File

@ -1,8 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import '../network/NetworkConfig.dart';
class AddNoteDialog extends StatefulWidget {
Function onTap;
@ -22,18 +20,10 @@ class _AddNoteDialogState extends State<AddNoteDialog> {
final TextEditingController _portNumber2Controller = TextEditingController();
final TextEditingController _portNumber3Controller = TextEditingController();
// final List<String> items2 = ['电视', '光缆', '大会员', '电信', '联通'];
String selectedValue = "";
String selectedValue2 = "";
@override
void initState() {
// TODO: implement initState
super.initState();
selectedValue = NetworkConfig.diverItems.first;
selectedValue2 = NetworkConfig.businessItems.first;
}
@override
@ -57,8 +47,7 @@ class _AddNoteDialogState extends State<AddNoteDialog> {
return;
}
widget.onTap(_businessNameController.text, selectedValue, selectedValue2,
"${_portNumber1Controller.text}/${_portNumber2Controller.text}/${_portNumber3Controller.text}");
widget.onTap(_businessNameController.text, "${_portNumber1Controller.text}/${_portNumber2Controller.text}/${_portNumber3Controller.text}");
Navigator.pop(context);
}
@ -117,89 +106,7 @@ class _AddNoteDialogState extends State<AddNoteDialog> {
),
),
///
Container(
alignment: Alignment.centerLeft,
margin: EdgeInsets.all(10),
child: Text(
"设备型号",
style: TextStyle(fontSize: 12),
),
),
Container(
margin: EdgeInsets.only(left: 10, right: 10),
padding: EdgeInsets.symmetric(horizontal: 5),
height: 35,
alignment: Alignment.center,
decoration: BoxDecoration(color: Color(0xFFEBEBEB), borderRadius: BorderRadius.all(Radius.circular(7))),
child: DropdownButton<String>(
value: selectedValue,
//
icon: const Icon(Icons.arrow_drop_down, color: Colors.blue),
hint: const Text('请选择设备型号'),
underline: Container(),
isExpanded: true,
dropdownColor: const Color(0xFFEBEBEB),
onChanged: (String? newValue) {
//
setState(() {
selectedValue = newValue!;
});
},
items: NetworkConfig.diverItems.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(
value,
style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w400),
),
);
}).toList(),
),
),
///
Container(
alignment: Alignment.centerLeft,
margin: EdgeInsets.all(10),
child: Text(
"业务类型",
style: TextStyle(fontSize: 12),
),
),
Container(
margin: EdgeInsets.only(left: 10, right: 10),
padding: EdgeInsets.symmetric(horizontal: 5),
height: 35,
alignment: Alignment.center,
decoration: BoxDecoration(color: Color(0xFFEBEBEB), borderRadius: BorderRadius.all(Radius.circular(7))),
child: DropdownButton<String>(
value: selectedValue2,
//
icon: const Icon(Icons.arrow_drop_down, color: Colors.blue),
hint: const Text('请选择业务类型'),
underline: Container(),
isExpanded: true,
dropdownColor: const Color(0xFFEBEBEB),
onChanged: (String? newValue) {
//
setState(() {
selectedValue2 = newValue!;
});
},
items: NetworkConfig.businessItems.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(
value,
style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w400),
),
);
}).toList(),
),
),
///
///
Container(
alignment: Alignment.centerLeft,
margin: EdgeInsets.all(10),

View File

@ -42,13 +42,8 @@ class _ModifyInfoDialogState extends State<ModifyInfoDialog> {
bool isConnect = false;
bool isLoad = false;
String businessName = "";
String deviceModel = "";
String equipmentModel = "";
String businessType = "";
String portNumber = "";
String selectedValue = "";
String selectedValue2 = "";
//
late List<TextEditingController> _controllers;
@ -89,8 +84,8 @@ class _ModifyInfoDialogState extends State<ModifyInfoDialog> {
// TODO: implement initState
super.initState();
selectedValue = NetworkConfig.diverItems.first;
selectedValue2 = NetworkConfig.businessItems.first;
equipmentModel = NetworkConfig.diverItems.first;
businessType = NetworkConfig.businessItems.first;
subscription = _viewmodel.streamController.stream.listen((event) {
String code = event['code'];
@ -120,6 +115,14 @@ class _ModifyInfoDialogState extends State<ModifyInfoDialog> {
(index) => TextEditingController(text: odfDetailsBean.historyFault![index].faultReason),
);
if ("${odfDetailsBean.equipmentModel}" == "null" && "${odfDetailsBean.equipmentModel}" == "") {
equipmentModel = "${odfDetailsBean.equipmentModel}";
}
if ("${odfDetailsBean.businessType}" != "null" && "${odfDetailsBean.businessType}" != "") {
businessType = "${odfDetailsBean.businessType}";
}
break;
case "save": //
@ -160,7 +163,7 @@ class _ModifyInfoDialogState extends State<ModifyInfoDialog> {
}
if (_items.isNotEmpty) {
// 1使every()faultTime是否为空
// every()faultTime是否为空
bool allFaultTimeEmpty = _items.every((bean) {
// faultTime为null或空字符串
return bean.faultTime == null || bean.faultTime!.trim().isEmpty;
@ -174,7 +177,7 @@ class _ModifyInfoDialogState extends State<ModifyInfoDialog> {
EasyLoading.show(status: "loading...");
_viewmodel.save(widget.id, isConnect ? 1 : 0, _remarksController.text, _opticalAttenuationController.text, _historyRemarksController.text, _items,
_opticalCableOffRemarksController.text);
_opticalCableOffRemarksController.text, equipmentModel, businessType);
}
@override
@ -216,15 +219,9 @@ class _ModifyInfoDialogState extends State<ModifyInfoDialog> {
FunctionUtil.popDialog2(
context,
AddNoteDialog(
onTap: (value1, value2, value3, value4) {
print("$value1-$value2-$value3-$value4");
appendTextWithNewline("$value1 $value2 $value3 $value4");
businessName = value1;
deviceModel = value2;
businessType = value3;
portNumber = value4;
onTap: (value1, value2) {
print("$value1-$value2-");
appendTextWithNewline("$value1 $value2");
setState(() {});
},
),
@ -376,7 +373,7 @@ class _ModifyInfoDialogState extends State<ModifyInfoDialog> {
alignment: Alignment.center,
decoration: BoxDecoration(color: Color(0xFFEBEBEB), borderRadius: BorderRadius.all(Radius.circular(7))),
child: DropdownButton<String>(
value: selectedValue,
value: equipmentModel,
//
icon: const Icon(Icons.arrow_drop_down, color: Colors.blue),
hint: const Text('请选择设备型号'),
@ -386,7 +383,7 @@ class _ModifyInfoDialogState extends State<ModifyInfoDialog> {
onChanged: (String? newValue) {
//
setState(() {
selectedValue = newValue!;
equipmentModel = newValue!;
});
},
items: NetworkConfig.diverItems.map<DropdownMenuItem<String>>((String value) {
@ -400,6 +397,48 @@ class _ModifyInfoDialogState extends State<ModifyInfoDialog> {
}).toList(),
),
),
///
Container(
alignment: Alignment.centerLeft,
margin: EdgeInsets.all(10),
child: Text(
"业务类型",
style: TextStyle(fontSize: 12),
),
),
Container(
margin: EdgeInsets.only(left: 10, right: 10),
padding: EdgeInsets.symmetric(horizontal: 5),
height: 35,
alignment: Alignment.center,
decoration: BoxDecoration(color: Color(0xFFEBEBEB), borderRadius: BorderRadius.all(Radius.circular(7))),
child: DropdownButton<String>(
value: businessType,
//
icon: const Icon(Icons.arrow_drop_down, color: Colors.blue),
hint: const Text('请选择业务类型'),
underline: Container(),
isExpanded: true,
dropdownColor: const Color(0xFFEBEBEB),
onChanged: (String? newValue) {
//
setState(() {
businessType = newValue!;
});
},
items: NetworkConfig.businessItems.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(
value,
style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w400),
),
);
}).toList(),
),
),
Container(
alignment: Alignment.centerLeft,
margin: EdgeInsets.all(10),

View File

@ -103,7 +103,7 @@ class MachineModel {
}
///
Future<void> save(id, status, remarks, opticalAttenuation, historyRemarks, historyFault, opticalCableOffRemarks) async {
Future<void> save(id, status, remarks, opticalAttenuation, historyRemarks, historyFault, opticalCableOffRemarks,equipmentModel,businessType) async {
RequestCenter.instance.request(NetworkConfig.save, {
"Id": id,
"Status": status,
@ -112,6 +112,8 @@ class MachineModel {
"HistoryRemarks": historyRemarks,
"HistoryFault": historyFault,
"OpticalCableOffRemarks": opticalCableOffRemarks,
"EquipmentModel": equipmentModel,
"BusinessType": businessType,
}, (dataEntity) {
if (dataEntity.code == 200) {
// OdfDetailsBean odfDetailsBean = OdfDetailsBean.fromJson(dataEntity.data);