diff --git a/android/app/talk.jks b/android/app/talk.jks new file mode 100644 index 0000000..f804989 Binary files /dev/null and b/android/app/talk.jks differ diff --git a/lib/dialog/add_note_dialog.dart b/lib/dialog/add_note_dialog.dart index 50318bd..4ec8cef 100644 --- a/lib/dialog/add_note_dialog.dart +++ b/lib/dialog/add_note_dialog.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; +import '../network/NetworkConfig.dart'; + class AddNoteDialog extends StatefulWidget { Function onTap; @@ -20,10 +22,18 @@ class _AddNoteDialogState extends State { final TextEditingController _portNumber2Controller = TextEditingController(); final TextEditingController _portNumber3Controller = TextEditingController(); + // final List items2 = ['电视', '光缆', '大会员', '电信', '联通']; + + String selectedValue = ""; + String selectedValue2 = ""; + @override void initState() { // TODO: implement initState super.initState(); + + selectedValue = NetworkConfig.diverItems.first; + selectedValue2 = NetworkConfig.businessItems.first; } @override @@ -47,7 +57,8 @@ class _AddNoteDialogState extends State { return; } - widget.onTap(_businessNameController.text, "${_portNumber1Controller.text}/${_portNumber2Controller.text}/${_portNumber3Controller.text}"); + widget.onTap(_businessNameController.text, selectedValue, selectedValue2, + "${_portNumber1Controller.text}/${_portNumber2Controller.text}/${_portNumber3Controller.text}"); Navigator.pop(context); } @@ -106,7 +117,89 @@ class _AddNoteDialogState extends State { ), ), - ///端口号数 + ///设备型号 + 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( + 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>((String value) { + return DropdownMenuItem( + 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( + 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>((String value) { + return DropdownMenuItem( + value: value, + child: Text( + value, + style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w400), + ), + ); + }).toList(), + ), + ), + + /// Container( alignment: Alignment.centerLeft, margin: EdgeInsets.all(10), diff --git a/lib/dialog/modify_info_dialog.dart b/lib/dialog/modify_info_dialog.dart index 5ee9eae..a5d2b6f 100644 --- a/lib/dialog/modify_info_dialog.dart +++ b/lib/dialog/modify_info_dialog.dart @@ -42,8 +42,10 @@ class _ModifyInfoDialogState extends State { bool isConnect = false; bool isLoad = false; - String equipmentModel = ""; + String businessName = ""; + String deviceModel = ""; String businessType = ""; + String portNumber = ""; // 用列表存储所有输入框的值,通过索引区分不同输入框 late List _controllers; @@ -84,8 +86,6 @@ class _ModifyInfoDialogState extends State { // TODO: implement initState super.initState(); - equipmentModel = NetworkConfig.diverItems.first; - businessType = NetworkConfig.businessItems.first; subscription = _viewmodel.streamController.stream.listen((event) { String code = event['code']; @@ -115,14 +115,6 @@ class _ModifyInfoDialogState extends State { (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": //保存信息 @@ -163,13 +155,12 @@ class _ModifyInfoDialogState extends State { } if (_items.isNotEmpty) { - // every()检查所有元素的faultTime是否为空 bool allFaultTimeEmpty = _items.every((bean) { - // 判断faultTime为null或空字符串 - return bean.faultTime == null || bean.faultTime!.trim().isEmpty; + // 检查faultTime是否不为null且不是空字符串(去除空格后) + return bean.faultTime != null && bean.faultTime!.trim().isNotEmpty; }); - if (allFaultTimeEmpty) { + if (!allFaultTimeEmpty) { EasyLoading.showToast("请选择障碍发生时间!"); return; } @@ -177,7 +168,7 @@ class _ModifyInfoDialogState extends State { EasyLoading.show(status: "loading..."); _viewmodel.save(widget.id, isConnect ? 1 : 0, _remarksController.text, _opticalAttenuationController.text, _historyRemarksController.text, _items, - _opticalCableOffRemarksController.text, equipmentModel, businessType); + _opticalCableOffRemarksController.text); } @override @@ -219,9 +210,15 @@ class _ModifyInfoDialogState extends State { FunctionUtil.popDialog2( context, AddNoteDialog( - onTap: (value1, value2) { - print("$value1-$value2-"); - appendTextWithNewline("$value1 $value2"); + onTap: (value1, value2, value3, value4) { + print("$value1-$value2-$value3-$value4"); + + appendTextWithNewline("$value1 $value2 $value3 $value4"); + + businessName = value1; + deviceModel = value2; + businessType = value3; + portNumber = value4; setState(() {}); }, ), @@ -357,88 +354,6 @@ class _ModifyInfoDialogState extends State { ), ), - ///设备型号 - 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( - value: equipmentModel, - // 当前选中的值 - 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(() { - equipmentModel = newValue!; - }); - }, - items: NetworkConfig.diverItems.map>((String value) { - return DropdownMenuItem( - 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( - 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>((String value) { - return DropdownMenuItem( - value: value, - child: Text( - value, - style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w400), - ), - ); - }).toList(), - ), - ), - Container( alignment: Alignment.centerLeft, margin: EdgeInsets.all(10), diff --git a/lib/tools/machine/machine_model.dart b/lib/tools/machine/machine_model.dart index b97a4c3..48a2f17 100644 --- a/lib/tools/machine/machine_model.dart +++ b/lib/tools/machine/machine_model.dart @@ -103,7 +103,7 @@ class MachineModel { } ///机架接口信息保存 - Future save(id, status, remarks, opticalAttenuation, historyRemarks, historyFault, opticalCableOffRemarks,equipmentModel,businessType) async { + Future save(id, status, remarks, opticalAttenuation, historyRemarks, historyFault, opticalCableOffRemarks) async { RequestCenter.instance.request(NetworkConfig.save, { "Id": id, "Status": status, @@ -112,8 +112,6 @@ class MachineModel { "HistoryRemarks": historyRemarks, "HistoryFault": historyFault, "OpticalCableOffRemarks": opticalCableOffRemarks, - "EquipmentModel": equipmentModel, - "BusinessType": businessType, }, (dataEntity) { if (dataEntity.code == 200) { // OdfDetailsBean odfDetailsBean = OdfDetailsBean.fromJson(dataEntity.data);