UI修改
This commit is contained in:
parent
19f0eec34f
commit
971d120ac5
|
|
@ -27,6 +27,9 @@ class OdfDetailsBean {
|
||||||
String? updatedAt;
|
String? updatedAt;
|
||||||
String? statusLabel;
|
String? statusLabel;
|
||||||
String? deptName;
|
String? deptName;
|
||||||
|
String? equipmentModel;
|
||||||
|
String? businessType;
|
||||||
|
|
||||||
|
|
||||||
OdfDetailsBean(
|
OdfDetailsBean(
|
||||||
this.id,
|
this.id,
|
||||||
|
|
@ -49,7 +52,9 @@ class OdfDetailsBean {
|
||||||
this.createdAt,
|
this.createdAt,
|
||||||
this.updatedAt,
|
this.updatedAt,
|
||||||
this.statusLabel,
|
this.statusLabel,
|
||||||
this.deptName);
|
this.deptName,
|
||||||
|
this.equipmentModel,
|
||||||
|
this.businessType);
|
||||||
|
|
||||||
factory OdfDetailsBean.fromJson(Map<String, dynamic> json) => _$OdfDetailsBeanFromJson(json);
|
factory OdfDetailsBean.fromJson(Map<String, dynamic> json) => _$OdfDetailsBeanFromJson(json);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,8 @@ OdfDetailsBean _$OdfDetailsBeanFromJson(Map<String, dynamic> json) =>
|
||||||
json['updatedAt'] as String?,
|
json['updatedAt'] as String?,
|
||||||
json['statusLabel'] as String?,
|
json['statusLabel'] as String?,
|
||||||
json['deptName'] as String?,
|
json['deptName'] as String?,
|
||||||
|
json['equipmentModel'] as String?,
|
||||||
|
json['businessType'] as String?,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$OdfDetailsBeanToJson(OdfDetailsBean instance) =>
|
Map<String, dynamic> _$OdfDetailsBeanToJson(OdfDetailsBean instance) =>
|
||||||
|
|
@ -56,4 +58,6 @@ Map<String, dynamic> _$OdfDetailsBeanToJson(OdfDetailsBean instance) =>
|
||||||
'updatedAt': instance.updatedAt,
|
'updatedAt': instance.updatedAt,
|
||||||
'statusLabel': instance.statusLabel,
|
'statusLabel': instance.statusLabel,
|
||||||
'deptName': instance.deptName,
|
'deptName': instance.deptName,
|
||||||
|
'equipmentModel': instance.equipmentModel,
|
||||||
|
'businessType': instance.businessType,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
|
|
||||||
import '../network/NetworkConfig.dart';
|
|
||||||
|
|
||||||
class AddNoteDialog extends StatefulWidget {
|
class AddNoteDialog extends StatefulWidget {
|
||||||
Function onTap;
|
Function onTap;
|
||||||
|
|
||||||
|
|
@ -22,18 +20,10 @@ class _AddNoteDialogState extends State<AddNoteDialog> {
|
||||||
final TextEditingController _portNumber2Controller = TextEditingController();
|
final TextEditingController _portNumber2Controller = TextEditingController();
|
||||||
final TextEditingController _portNumber3Controller = TextEditingController();
|
final TextEditingController _portNumber3Controller = TextEditingController();
|
||||||
|
|
||||||
// final List<String> items2 = ['电视', '光缆', '大会员', '电信', '联通'];
|
|
||||||
|
|
||||||
String selectedValue = "";
|
|
||||||
String selectedValue2 = "";
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
// TODO: implement initState
|
// TODO: implement initState
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
selectedValue = NetworkConfig.diverItems.first;
|
|
||||||
selectedValue2 = NetworkConfig.businessItems.first;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -57,8 +47,7 @@ class _AddNoteDialogState extends State<AddNoteDialog> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.onTap(_businessNameController.text, selectedValue, selectedValue2,
|
widget.onTap(_businessNameController.text, "${_portNumber1Controller.text}/${_portNumber2Controller.text}/${_portNumber3Controller.text}");
|
||||||
"${_portNumber1Controller.text}/${_portNumber2Controller.text}/${_portNumber3Controller.text}");
|
|
||||||
|
|
||||||
Navigator.pop(context);
|
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(
|
Container(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
margin: EdgeInsets.all(10),
|
margin: EdgeInsets.all(10),
|
||||||
|
|
|
||||||
|
|
@ -42,13 +42,8 @@ class _ModifyInfoDialogState extends State<ModifyInfoDialog> {
|
||||||
bool isConnect = false;
|
bool isConnect = false;
|
||||||
bool isLoad = false;
|
bool isLoad = false;
|
||||||
|
|
||||||
String businessName = "";
|
String equipmentModel = "";
|
||||||
String deviceModel = "";
|
|
||||||
String businessType = "";
|
String businessType = "";
|
||||||
String portNumber = "";
|
|
||||||
|
|
||||||
String selectedValue = "";
|
|
||||||
String selectedValue2 = "";
|
|
||||||
|
|
||||||
// 用列表存储所有输入框的值,通过索引区分不同输入框
|
// 用列表存储所有输入框的值,通过索引区分不同输入框
|
||||||
late List<TextEditingController> _controllers;
|
late List<TextEditingController> _controllers;
|
||||||
|
|
@ -89,8 +84,8 @@ class _ModifyInfoDialogState extends State<ModifyInfoDialog> {
|
||||||
// TODO: implement initState
|
// TODO: implement initState
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
selectedValue = NetworkConfig.diverItems.first;
|
equipmentModel = NetworkConfig.diverItems.first;
|
||||||
selectedValue2 = NetworkConfig.businessItems.first;
|
businessType = NetworkConfig.businessItems.first;
|
||||||
|
|
||||||
subscription = _viewmodel.streamController.stream.listen((event) {
|
subscription = _viewmodel.streamController.stream.listen((event) {
|
||||||
String code = event['code'];
|
String code = event['code'];
|
||||||
|
|
@ -120,6 +115,14 @@ class _ModifyInfoDialogState extends State<ModifyInfoDialog> {
|
||||||
(index) => TextEditingController(text: odfDetailsBean.historyFault![index].faultReason),
|
(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;
|
break;
|
||||||
|
|
||||||
case "save": //保存信息
|
case "save": //保存信息
|
||||||
|
|
@ -160,7 +163,7 @@ class _ModifyInfoDialogState extends State<ModifyInfoDialog> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_items.isNotEmpty) {
|
if (_items.isNotEmpty) {
|
||||||
// 方法1:使用every()检查所有元素的faultTime是否为空
|
// every()检查所有元素的faultTime是否为空
|
||||||
bool allFaultTimeEmpty = _items.every((bean) {
|
bool allFaultTimeEmpty = _items.every((bean) {
|
||||||
// 判断faultTime为null或空字符串
|
// 判断faultTime为null或空字符串
|
||||||
return bean.faultTime == null || bean.faultTime!.trim().isEmpty;
|
return bean.faultTime == null || bean.faultTime!.trim().isEmpty;
|
||||||
|
|
@ -174,7 +177,7 @@ class _ModifyInfoDialogState extends State<ModifyInfoDialog> {
|
||||||
|
|
||||||
EasyLoading.show(status: "loading...");
|
EasyLoading.show(status: "loading...");
|
||||||
_viewmodel.save(widget.id, isConnect ? 1 : 0, _remarksController.text, _opticalAttenuationController.text, _historyRemarksController.text, _items,
|
_viewmodel.save(widget.id, isConnect ? 1 : 0, _remarksController.text, _opticalAttenuationController.text, _historyRemarksController.text, _items,
|
||||||
_opticalCableOffRemarksController.text);
|
_opticalCableOffRemarksController.text, equipmentModel, businessType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -216,15 +219,9 @@ class _ModifyInfoDialogState extends State<ModifyInfoDialog> {
|
||||||
FunctionUtil.popDialog2(
|
FunctionUtil.popDialog2(
|
||||||
context,
|
context,
|
||||||
AddNoteDialog(
|
AddNoteDialog(
|
||||||
onTap: (value1, value2, value3, value4) {
|
onTap: (value1, value2) {
|
||||||
print("$value1-$value2-$value3-$value4");
|
print("$value1-$value2-");
|
||||||
|
appendTextWithNewline("$value1 $value2");
|
||||||
appendTextWithNewline("$value1 $value2 $value3 $value4");
|
|
||||||
|
|
||||||
businessName = value1;
|
|
||||||
deviceModel = value2;
|
|
||||||
businessType = value3;
|
|
||||||
portNumber = value4;
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
@ -376,7 +373,7 @@ class _ModifyInfoDialogState extends State<ModifyInfoDialog> {
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
decoration: BoxDecoration(color: Color(0xFFEBEBEB), borderRadius: BorderRadius.all(Radius.circular(7))),
|
decoration: BoxDecoration(color: Color(0xFFEBEBEB), borderRadius: BorderRadius.all(Radius.circular(7))),
|
||||||
child: DropdownButton<String>(
|
child: DropdownButton<String>(
|
||||||
value: selectedValue,
|
value: equipmentModel,
|
||||||
// 当前选中的值
|
// 当前选中的值
|
||||||
icon: const Icon(Icons.arrow_drop_down, color: Colors.blue),
|
icon: const Icon(Icons.arrow_drop_down, color: Colors.blue),
|
||||||
hint: const Text('请选择设备型号'),
|
hint: const Text('请选择设备型号'),
|
||||||
|
|
@ -386,7 +383,7 @@ class _ModifyInfoDialogState extends State<ModifyInfoDialog> {
|
||||||
onChanged: (String? newValue) {
|
onChanged: (String? newValue) {
|
||||||
// 当选择改变时,更新状态
|
// 当选择改变时,更新状态
|
||||||
setState(() {
|
setState(() {
|
||||||
selectedValue = newValue!;
|
equipmentModel = newValue!;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
items: NetworkConfig.diverItems.map<DropdownMenuItem<String>>((String value) {
|
items: NetworkConfig.diverItems.map<DropdownMenuItem<String>>((String value) {
|
||||||
|
|
@ -400,6 +397,48 @@ class _ModifyInfoDialogState extends State<ModifyInfoDialog> {
|
||||||
}).toList(),
|
}).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(
|
Container(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
margin: EdgeInsets.all(10),
|
margin: EdgeInsets.all(10),
|
||||||
|
|
|
||||||
|
|
@ -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, {
|
RequestCenter.instance.request(NetworkConfig.save, {
|
||||||
"Id": id,
|
"Id": id,
|
||||||
"Status": status,
|
"Status": status,
|
||||||
|
|
@ -112,6 +112,8 @@ class MachineModel {
|
||||||
"HistoryRemarks": historyRemarks,
|
"HistoryRemarks": historyRemarks,
|
||||||
"HistoryFault": historyFault,
|
"HistoryFault": historyFault,
|
||||||
"OpticalCableOffRemarks": opticalCableOffRemarks,
|
"OpticalCableOffRemarks": opticalCableOffRemarks,
|
||||||
|
"EquipmentModel": equipmentModel,
|
||||||
|
"BusinessType": businessType,
|
||||||
}, (dataEntity) {
|
}, (dataEntity) {
|
||||||
if (dataEntity.code == 200) {
|
if (dataEntity.code == 200) {
|
||||||
// OdfDetailsBean odfDetailsBean = OdfDetailsBean.fromJson(dataEntity.data);
|
// OdfDetailsBean odfDetailsBean = OdfDetailsBean.fromJson(dataEntity.data);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user