Ver Fonte

bug修复

yangyang há 2 anos atrás
pai
commit
25ed6b6b08

BIN
android/app/Keystore.jks


+ 9 - 0
android/app/build.gradle

@@ -52,6 +52,15 @@ android {
             signingConfig signingConfigs.debug
         }
     }
+
+    signingConfigs {
+        debug {
+            storeFile file('keystore.jks')
+            storePassword "123456"
+            keyAlias "keystore"
+            keyPassword "123456"
+        }
+    }
 }
 
 flutter {

+ 17 - 1
android/app/src/debug/AndroidManifest.xml

@@ -4,5 +4,21 @@
          the Flutter tool needs it to communicate with the running application
          to allow setting breakpoints, to provide hot reload, etc.
     -->
-    <uses-permission android:name="android.permission.INTERNET"/>
+    <uses-feature android:name="android.hardware.camera" />
+
+    <uses-feature android:name="android.hardware.camera.autofocus" />
+    <uses-permission android:name="android.permission.INTERNET" />
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.RECORD_AUDIO" />
+    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
+    <uses-permission android:name="android.permission.BLUETOOTH" />
+    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
+    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
+    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
+    <uses-permission android:name="android.permission.CAMERA" />
+
+    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
 </manifest>

+ 18 - 0
android/app/src/main/AndroidManifest.xml

@@ -33,4 +33,22 @@
             android:name="flutterEmbedding"
             android:value="2" />
     </application>
+
+    <uses-feature android:name="android.hardware.camera" />
+
+    <uses-feature android:name="android.hardware.camera.autofocus" />
+    <uses-permission android:name="android.permission.INTERNET" />
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.RECORD_AUDIO" />
+    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
+    <uses-permission android:name="android.permission.BLUETOOTH" />
+    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
+    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
+    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
+    <uses-permission android:name="android.permission.CAMERA" />
+
+    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
 </manifest>

BIN
images/head.png


+ 8 - 1
lib/PhotoTool.dart

@@ -9,11 +9,16 @@ class PhotoTool extends StatefulWidget {
   @required final int imageCount;//最多几张
   @required  final int lineCount;//一行几个
 
+  @required final FocusNode focusNode;
+
   final _AddCall addCall;
   final _RemoveCall removeCall;
   //注:最好把图片和文字这些都拿出来,方便更改,这里就不搞了
+  // const PhotoTool({required this.imageCount,required this.lineCount
+  //   ,required this.addCall,required this.removeCall});
+
   const PhotoTool({required this.imageCount,required this.lineCount
-    ,required this.addCall,required this.removeCall});
+    ,required this.addCall,required this.removeCall,required this.focusNode});
   @override
   _PhotoToolState createState() => _PhotoToolState();
 }
@@ -145,6 +150,7 @@ class _PhotoToolState extends State<PhotoTool> {
   }
   /// 选择图片
   _onPickImage() async {
+    widget.focusNode.unfocus();
     List<AssetEntity>? assets = await AssetPicker.pickAssets(
       context,
       pickerConfig:AssetPickerConfig(maxAssets:widget.imageCount - _imageFiles.length,themeColor: Theme.of(context).primaryColor, requestType: RequestType.image,)
@@ -159,6 +165,7 @@ class _PhotoToolState extends State<PhotoTool> {
   }
   /// 删除图片
   _deleteImage(int index) {
+    widget.focusNode.unfocus();
     if (_imageFiles == null || _imageFiles.length <= index) return;
     setState(() {
       _imageFiles.removeAt(index);

+ 3 - 3
lib/common/utils/ConstantString.dart

@@ -13,8 +13,8 @@ class ConstantString {
   static const String maintJobText = "维保任务";
   static const String repairJobText = "报修管理";
 
-  static const String patrolJobTitle = "巡检任务来自于'巡检计划管理',计划信息请登录pc端查看";
-  static const String maintJobTitle = "维保任务来自于'维保计划管理',计划信息请登录pc端查看";
+  static const String patrolJobTitle = "巡检任务来自于巡检计划,请登录PC端查看";
+  static const String maintJobTitle = "维保任务来自于巡检计划,请登录PC端查看";
   static const String repairJobTitle = "巡检任务来自于'巡检计划管理',计划信息请登录pc端查看";
   static const String patrolListTitle = "请针对以下设备进行巡检记录";
 
@@ -56,7 +56,7 @@ class ConstantString {
 
   static const String patrolAddNull = "请输入活选择结果";
 
-  static const String newRepair = "新建修单";
+  static const String newRepair = "新建修单";
 
   static const String submit = "提交";
 

+ 14 - 0
lib/common/utils/DioUtil.dart

@@ -1,5 +1,7 @@
 import 'package:deus_app/common/local/StoreHelper.dart';
 import 'package:deus_app/common/utils/ConstantString.dart';
+import 'package:deus_app/main.dart';
+import 'package:deus_app/page/login/login_page.dart';
 import 'package:dio/dio.dart';
 import 'package:flutter_easyloading/flutter_easyloading.dart';
 import 'package:pretty_dio_logger/pretty_dio_logger.dart';
@@ -111,10 +113,22 @@ class DioUtil {
           onSendProgress: onSendProgress,
           onReceiveProgress: onReceiveProgress);
       EasyLoading.dismiss();
+      if(response.data['code']==403){
+        // 跳转登录页面并清空栈
+        globalNavigatorKey.currentState
+            ?.pushNamedAndRemoveUntil(LoginPage.routeName, (route) => false);
+        // showToast('登录超时,请重新登录');
+      }
         return response.data;
     } on DioError catch (e) {
       EasyLoading.dismiss();
       // showToast(e.message);
+      if(e.response?.data['code']==403){
+        // 跳转登录页面并清空栈
+        globalNavigatorKey.currentState
+            ?.pushNamedAndRemoveUntil(LoginPage.routeName, (route) => false);
+        // showToast('登录超时,请重新登录');
+      }
       return e.response?.data;
     }
   }

+ 5 - 0
lib/main.dart

@@ -16,6 +16,8 @@ void main() {
 //创建EventBus对象
 final EventBus eventBus = EventBus();
 
+final GlobalKey<NavigatorState> globalNavigatorKey = GlobalKey();
+
 class MyApp extends StatelessWidget {
   const MyApp({super.key});
 
@@ -24,6 +26,7 @@ class MyApp extends StatelessWidget {
   Widget build(BuildContext context) {
     return MaterialApp(
       title: 'Flutter Demo',
+      navigatorKey: globalNavigatorKey,
       theme: ThemeData(
         // This is the theme of your application.
         //
@@ -42,6 +45,8 @@ class MyApp extends StatelessWidget {
       builder: EasyLoading.init(),
       routes: <String, WidgetBuilder>{
         // 对应路由/NavigatorPushNamedPage
+        LoginPage.routeName: (BuildContext context) =>
+            LoginPage(),
         HomePage.routeName: (BuildContext context) =>
             HomePage(),
         PatrolJobPage.routeName: (BuildContext context) =>

+ 6 - 6
lib/model/equipment_info_entity.dart

@@ -27,12 +27,12 @@ class EquipmentInfoData with JsonConvert<EquipmentInfoData> {
 	late String activationOn='';
 	late dynamic positionId;
 	late dynamic number;
-	late String speedA;
-	late String speedB;
-	late String finenessA;
-	late String finenessB;
-	late String holeCountA;
-	late String holeCountB;
+	late String speedA='';
+	late String speedB='';
+	late String finenessA='';
+	late String finenessB='';
+	late String holeCountA='';
+	late String holeCountB='';
 	late dynamic activePeriod;
 	late String createdOn;
 	late String lastOnlineOn='';

+ 1 - 1
lib/model/maint_job_detail_response.dart

@@ -260,7 +260,7 @@ class DeviceList {
     productName = json['productName'];
     productKey = json['productKey'];
     if(null==json['finishTime']){
-      finishTime='暂无';
+      finishTime='--';
     }else{
       finishTime = json['finishTime'];
     }

+ 1 - 1
lib/model/patrol_job_detail_response_entity.dart

@@ -51,7 +51,7 @@ class PatrolJobDetailResponseDataEquipmentVOS with JsonConvert<PatrolJobDetailRe
 	late String showName;
 	late String deviceKey;
 	late String productName;
-	late String itemCompleteTime='';
+	late String itemCompleteTime='--';
 	late String itemPerson;
 	late int patrolJobId;
 	late int isComplete;

+ 7 - 7
lib/page/device/device_manage_detail_page.dart

@@ -202,7 +202,7 @@ class _DeviceManageDetailPage extends State<DeviceManageDetailPage> {
                   mainAxisAlignment: MainAxisAlignment.spaceBetween,
                   children: [
                     new Text('A侧速度:', style: GSYConstant.smallTextLight),
-                    new Text(data.speedA, style: GSYConstant.smallTextLight,textAlign: TextAlign.right),
+                    new Text(data.speedA==''?'未设置':data.speedA, style: GSYConstant.smallTextLight,textAlign: TextAlign.right),
                   ],
                 ),
                 SizedBox(
@@ -212,7 +212,7 @@ class _DeviceManageDetailPage extends State<DeviceManageDetailPage> {
                   mainAxisAlignment: MainAxisAlignment.spaceBetween,
                   children: [
                     new Text('B侧速度:', style: GSYConstant.smallTextLight),
-                    new Text(data.speedB, style: GSYConstant.smallTextLight,textAlign: TextAlign.right),
+                    Text(data.speedB==''?'未设置':data.speedB, style: GSYConstant.smallTextLight,textAlign: TextAlign.right),
                   ],
                 ),
                 SizedBox(
@@ -222,7 +222,7 @@ class _DeviceManageDetailPage extends State<DeviceManageDetailPage> {
                   mainAxisAlignment: MainAxisAlignment.spaceBetween,
                   children: [
                     new Text('A侧纤度:', style: GSYConstant.smallTextLight),
-                    new Text(data.finenessA, style: GSYConstant.smallTextLight,textAlign: TextAlign.right),
+                    Text(data.finenessA==''?'未设置':data.finenessA, style: GSYConstant.smallTextLight,textAlign: TextAlign.right),
                   ],
                 ),
                 SizedBox(
@@ -231,8 +231,8 @@ class _DeviceManageDetailPage extends State<DeviceManageDetailPage> {
                 Row(
                   mainAxisAlignment: MainAxisAlignment.spaceBetween,
                   children: [
-                    new Text('B侧纤度:', style: GSYConstant.smallTextLight),
-                    new Text(data.finenessB, style: GSYConstant.smallTextLight,textAlign: TextAlign.right),
+                    const Text('B侧纤度:', style: GSYConstant.smallTextLight),
+                    Text(data.finenessB==''?'未设置':data.finenessB, style: GSYConstant.smallTextLight,textAlign: TextAlign.right),
                   ],
                 ),
                 SizedBox(
@@ -242,7 +242,7 @@ class _DeviceManageDetailPage extends State<DeviceManageDetailPage> {
                   mainAxisAlignment: MainAxisAlignment.spaceBetween,
                   children: [
                     new Text('A侧孔数:', style: GSYConstant.smallTextLight),
-                    new Text(data.holeCountA, style: GSYConstant.smallTextLight,textAlign: TextAlign.right),
+                    new Text(data.holeCountA==''?'未设置':data.holeCountA, style: GSYConstant.smallTextLight,textAlign: TextAlign.right),
                   ],
                 ),
                 SizedBox(
@@ -252,7 +252,7 @@ class _DeviceManageDetailPage extends State<DeviceManageDetailPage> {
                   mainAxisAlignment: MainAxisAlignment.spaceBetween,
                   children: [
                     new Text('B侧孔数:', style: GSYConstant.smallTextLight),
-                    new Text(data.holeCountB, style: GSYConstant.smallTextLight,textAlign: TextAlign.right),
+                    new Text(data.holeCountB==''?'未设置':data.holeCountB, style: GSYConstant.smallTextLight,textAlign: TextAlign.right),
                   ],
                 )
               ],

+ 2 - 1
lib/page/device/device_manage_page.dart

@@ -236,12 +236,13 @@ class _DeviceManage extends State<DeviceManagePage> {
   equipmentList() async {
     // LoadingDialogHelper.showLoading(context);
     var result = await DioUtil().request("equipment/equipmentList",
-        method: DioMethod.post, data: {'index': 1, 'size': 50,'query':{'status':_satus,'name':_username,'isEnable':_isEnabled,'showName':_device}});
+        method: DioMethod.post, data: {'index': 1, 'size': 50,'query':{'status':_satus,'name':_device,'isEnable':_isEnabled,'showName':_username}});
     EquipmentListEntity entity =
         equipmentListEntityFromJson(EquipmentListEntity(), result,);
     // LoadingDialogHelper.dismissLoading(context);
     if (entity.code == 0) {
       setState(() {
+        deviceNum=entity.data.total.toString();
         equipmentVOS.clear();
         equipmentVOS.addAll(entity.data.equipmentVOS);
       });

+ 0 - 2
lib/page/device/device_manage_update_page.dart

@@ -252,11 +252,9 @@ class _DeviceManageUpdatePage extends State<DeviceManageUpdatePage>{
   }
 
   parameter() async {
-    // LoadingDialogHelper.showLoading(context);
     var result = await DioUtil().request("equipment/parameter",
         method: DioMethod.post, data: {'id':data.id,'finenessA':data.finenessA,'finenessB':data.finenessB
     ,'holeCountA':data.holeCountA,'holeCountB':data.holeCountB,'speedA':data.speedA,'speedB':data.speedB});
-    // LoadingDialogHelper.dismissLoading(context);
     if (result['code']== 0) {
       setState(() {
         //发出事件

+ 13 - 12
lib/page/home/home_page.dart

@@ -112,18 +112,19 @@ class _MineViewPageState extends State<HomePage> {
                   ),
                   child: Column(
                     children: [
+                      // Row(
+                      //   mainAxisAlignment: MainAxisAlignment.end,
+                      //   children: [
+                      //     IconButton(
+                      //       icon: Icon(Icons.settings),
+                      //       color: Colors.white,
+                      //       onPressed: () => {},
+                      //     ),
+                      //   ],
+                      // ),
+                      SizedBox(height: 35),
                       Row(
-                        mainAxisAlignment: MainAxisAlignment.end,
-                        children: [
-                          IconButton(
-                            icon: Icon(Icons.settings),
-                            color: Colors.white,
-                            onPressed: () => {},
-                          ),
-                        ],
-                      ),
-                      SizedBox(width: 5),
-                      Row(
+                        crossAxisAlignment:CrossAxisAlignment.start,
                         children: [
                           Image.asset(
                             "images/head.png",
@@ -136,7 +137,7 @@ class _MineViewPageState extends State<HomePage> {
                             style: TextStyle(
                                 color: Colors.white,
                                 fontWeight: FontWeight.bold,
-                                fontSize: 15),
+                                fontSize: 18),
                           )
                         ],
                       ),

+ 1 - 0
lib/page/login/login_page.dart

@@ -19,6 +19,7 @@ import '../../generated/json/login_response_entity_helper.dart';
 /// Created by Ocean
 class LoginPage extends StatefulWidget {
   static const String sName = "login";
+  static var routeName = '/LoginPage';
 
   const LoginPage({super.key});
 

+ 12 - 9
lib/page/maint/maint_job_detail.dart

@@ -62,6 +62,8 @@ class _MaintJobDetail extends State<MaintJobDetail> {
       }
       if (maintJobDetail.status == 1 || maintJobDetail.status == 3|| maintJobDetail.status == 4) {
         type = true;
+      }else{
+        type = false;
       }
     });
   }
@@ -166,7 +168,7 @@ class _MaintJobDetail extends State<MaintJobDetail> {
     ws.add(_maintJobDetail(maintJobDetail));
     ws.add(_device());
     ws.add(_item());
-    if ('' != maintJobDetail.remarks) {
+    if (null!= maintJobDetail.remarks&&'' != maintJobDetail.remarks) {
       ws.add(_remark());
     }
     ws.add(_url());
@@ -446,16 +448,17 @@ class _MaintJobDetail extends State<MaintJobDetail> {
                 child: Row(
                     mainAxisAlignment: MainAxisAlignment.spaceBetween,
                     children: [
-                      new Text(
-                        '设备名称:',
+                      Text(
+                        device.showName!,
                         style: GSYConstant.smallTextBold,
                       ),
-                      Container(
-                        child: Text(
-                          device.showName!,
-                          style: GSYConstant.smallTextBold,
-                          textAlign: TextAlign.right,
-                        ),
+                      Text(
+                        device.isMainted == 0 ? '未完成' : '已完成',
+                        style: TextStyle(
+                            fontSize: GSYConstant.smallTextSize,
+                            color: device.isMainted == 0
+                                ? Colors.red
+                                : Colors.blue),
                       ),
                     ]),
               ),

+ 88 - 72
lib/page/maint/maint_job_edit.dart

@@ -21,32 +21,34 @@ import 'package:flutter/cupertino.dart';
 import 'package:flutter/material.dart';
 import 'package:wechat_assets_picker/wechat_assets_picker.dart';
 
-
 class MairintJobEdit extends StatefulWidget {
-
   static var routeName = "/PatrolJobEdit";
 
   var id;
+
   @override
   State createState() {
     return _MairintJobEdit(id);
   }
+
   MairintJobEdit({super.key, @required this.id});
 }
 
 class _MairintJobEdit extends State<MairintJobEdit> {
-
-  List<MaintJobItemsListResponseData> patrolItemVOS = <MaintJobItemsListResponseData>[];
+  List<MaintJobItemsListResponseData> patrolItemVOS =
+      <MaintJobItemsListResponseData>[];
 
   List<AssetEntity> imageFiles = [];
 
-  List<int>mList=[];
+  List<int> mList = [];
 
   var id;
 
   var _event;
 
-  String note='';
+  String note = '';
+
+  FocusNode focusNode = FocusNode();
 
   _MairintJobEdit(this.id);
 
@@ -73,7 +75,9 @@ class _MairintJobEdit extends State<MairintJobEdit> {
                     child: SizedBox(
                       height: 50,
                       child: TextButton(
-                        onPressed: () {},
+                        onPressed: () {
+                          Navigator.pop(context);
+                        },
                         child: Text(ConstantString.back),
                         style: ButtonStyle(
                           backgroundColor: MaterialStateProperty.all<Color>(
@@ -82,7 +86,7 @@ class _MairintJobEdit extends State<MairintJobEdit> {
                               BeveledRectangleBorder(
                                   borderRadius: BorderRadius.circular(0))),
                           foregroundColor:
-                          MaterialStateProperty.all<Color>(Colors.white),
+                              MaterialStateProperty.all<Color>(Colors.white),
                           // padding: MaterialStateProperty.all(EdgeInsets.zero)
                         ),
                       ),
@@ -90,29 +94,29 @@ class _MairintJobEdit extends State<MairintJobEdit> {
                   ),
                   Expanded(
                       child: SizedBox(
-                        height: 50,
-                        child: TextButton(
-                          onPressed: () {
-                            CloseTaskDialog.showAlertDialog(context, () {
-                              if(imageFiles.isNotEmpty){
-                                uploadList();
-                              }else{
-                                patrolJobRemark();
-                              }
-                            }, '您确认完成维保?');
-                          },
-                          child: Text(ConstantString.complete),
-                          style: ButtonStyle(
-                            backgroundColor:
+                    height: 50,
+                    child: TextButton(
+                      onPressed: () {
+                        CloseTaskDialog.showAlertDialog(context, () {
+                          if (imageFiles.isNotEmpty) {
+                            uploadList();
+                          } else {
+                            patrolJobRemark();
+                          }
+                        }, '您确认完成维保?');
+                      },
+                      child: Text(ConstantString.complete),
+                      style: ButtonStyle(
+                        backgroundColor:
                             MaterialStateProperty.all<Color>(Colors.blue),
-                            foregroundColor:
+                        foregroundColor:
                             MaterialStateProperty.all<Color>(Colors.white),
-                            shape: MaterialStateProperty.all(BeveledRectangleBorder(
-                                borderRadius: BorderRadius.circular(0))),
-                            // padding: MaterialStateProperty.all(EdgeInsets.zero)
-                          ),
-                        ),
-                      )),
+                        shape: MaterialStateProperty.all(BeveledRectangleBorder(
+                            borderRadius: BorderRadius.circular(0))),
+                        // padding: MaterialStateProperty.all(EdgeInsets.zero)
+                      ),
+                    ),
+                  )),
                 ],
               ),
             )
@@ -130,34 +134,39 @@ class _MairintJobEdit extends State<MairintJobEdit> {
     return ws;
   }
 
-  Widget _picture(){
+  Widget _picture() {
     return Container(
         child: Column(
-          children: [
-            Container(
-              height: 50,
-              padding: EdgeInsets.only(left: 12),
-              alignment: Alignment.centerLeft,
-              child: Text('巡检图片',style: TextStyle(
+      children: [
+        Container(
+          height: 50,
+          padding: EdgeInsets.only(left: 12),
+          alignment: Alignment.centerLeft,
+          child: Text('巡检图片',
+              style: TextStyle(
                 color: Colors.black,
                 fontSize: GSYConstant.TextSize15,
               )),
-            ),
-            Container(
-              // padding: EdgeInsets.only(left: 12,right: 12),
-              decoration: BoxDecoration(color: Colors.white),
-              child: PhotoTool(imageCount: 5, lineCount: 5, addCall: (List<AssetEntity> _imageFiles){
+        ),
+        Container(
+          padding: EdgeInsets.only(left: 12, right: 12),
+          decoration: BoxDecoration(color: Colors.white),
+          child: PhotoTool(
+              imageCount: 5,
+              lineCount: 5,
+              addCall: (List<AssetEntity> _imageFiles) {
                 imageFiles.addAll(_imageFiles);
-              }, removeCall:(int index){
+              },
+              removeCall: (int index) {
                 imageFiles.remove(index);
-              }),
-            )
-          ],
+              },
+              focusNode: focusNode),
         )
-    );
+      ],
+    ));
   }
 
-  Widget _notes(){
+  Widget _notes() {
     return Container(
       child: Column(
         children: <Widget>[
@@ -165,13 +174,14 @@ class _MairintJobEdit extends State<MairintJobEdit> {
             height: 50,
             padding: EdgeInsets.only(left: 12),
             alignment: Alignment.centerLeft,
-            child: Text('任务结果备注',style: TextStyle(
-              color: Colors.black,
-              fontSize: GSYConstant.TextSize15,
-            )),
+            child: Text('任务结果备注',
+                style: TextStyle(
+                  color: Colors.black,
+                  fontSize: GSYConstant.TextSize15,
+                )),
           ),
           Container(
-            padding: EdgeInsets.only(left: 12,right: 12,bottom: 12),
+            padding: EdgeInsets.only(left: 12, right: 12, bottom: 12),
             decoration: BoxDecoration(color: Colors.white),
             child: Column(
               children: [
@@ -180,6 +190,7 @@ class _MairintJobEdit extends State<MairintJobEdit> {
                 ),
                 TextField(
                   maxLines: 5,
+                  focusNode: focusNode,
                   decoration: InputDecoration(border: OutlineInputBorder()),
                   style: TextStyle(fontSize: 14),
                   onChanged: (value) {
@@ -194,11 +205,11 @@ class _MairintJobEdit extends State<MairintJobEdit> {
     );
   }
 
-  Widget _mainPatrolAdd(){
+  Widget _mainPatrolAdd() {
     return Column(
       children: [
         Container(
-          padding: EdgeInsets.fromLTRB(12,0, 12, 0),
+          padding: EdgeInsets.fromLTRB(12, 0, 12, 0),
           height: 50,
           child: Row(
             mainAxisAlignment: MainAxisAlignment.spaceBetween,
@@ -213,11 +224,13 @@ class _MairintJobEdit extends State<MairintJobEdit> {
               Container(
                 child: TextButton(
                   onPressed: () {
+                    focusNode.unfocus();
                     Navigator.push(
                         context,
                         MaterialPageRoute(
-                            builder: (context) =>
-                                MaintJobSelect(id: id,)));
+                            builder: (context) => MaintJobSelect(
+                                  id: id,
+                                )));
                   },
                   child: Row(
                     children: [
@@ -261,12 +274,13 @@ class _MairintJobEdit extends State<MairintJobEdit> {
                         style: TextStyle(
                             fontSize: GSYConstant.middleTextWhiteSize,
                             fontWeight: FontWeight.bold)),
-                    IconButton(onPressed: (){
-                      deletePatrolItem(item.id);
-                    }, icon: new Icon(Icons.delete))
+                    IconButton(
+                        onPressed: () {
+                          deletePatrolItem(item.id);
+                        },
+                        icon: new Icon(Icons.delete))
                   ],
                 ),
-
               ),
               Container(
                 margin: const EdgeInsets.fromLTRB(0, 10.0, 0, 0),
@@ -292,7 +306,9 @@ class _MairintJobEdit extends State<MairintJobEdit> {
     var result = await DioUtil().request('maintJob/app-items-list',
         method: DioMethod.get, params: {'maintJobId': id});
     if (0 == result['code']) {
-      MaintJobItemsListResponseEntity jobEdit=maintJobItemsListResponseEntityFromJson(MaintJobItemsListResponseEntity(),result);
+      MaintJobItemsListResponseEntity jobEdit =
+          maintJobItemsListResponseEntityFromJson(
+              MaintJobItemsListResponseEntity(), result);
       setState(() {
         patrolItemVOS.clear();
         patrolItemVOS.addAll(jobEdit.data);
@@ -315,7 +331,7 @@ class _MairintJobEdit extends State<MairintJobEdit> {
 
   deletePatrolItem(int itemId) async {
     var result = await DioUtil().request('maintJob/deleteItems',
-        method: DioMethod.post, data: {'id': itemId,'jobId':id});
+        method: DioMethod.post, data: {'id': itemId, 'jobId': id});
     if (result['code'] == 0) {
       setState(() {
         patrolItem();
@@ -335,17 +351,16 @@ class _MairintJobEdit extends State<MairintJobEdit> {
     List<MultipartFile> files = [];
     for (var element in imageFiles) {
       File? imgFile = await element.file;
-      String? s=imgFile?.path;
-      MultipartFile file =MultipartFile.fromFileSync(s!);
+      String? s = imgFile?.path;
+      MultipartFile file = MultipartFile.fromFileSync(s!);
       files.add(file);
     }
-    var formData =FormData.fromMap({
-      'files': files
-    });
+    var formData = FormData.fromMap({'files': files});
     var result = await DioUtil().request('uploadImg/uploadList',
         method: DioMethod.post, data: formData);
     if (result['code'] == 0) {
-      UploadListEntityEntity data=uploadListEntityEntityFromJson(UploadListEntityEntity(), result);
+      UploadListEntityEntity data =
+          uploadListEntityEntityFromJson(UploadListEntityEntity(), result);
       setState(() {
         mList.clear();
         mList.addAll(data.data);
@@ -358,17 +373,18 @@ class _MairintJobEdit extends State<MairintJobEdit> {
 
   patrolJobRemark() async {
     var result = await DioUtil().request('maintJob/complete',
-        method: DioMethod.post, data: {'id': id,'fileIds':mList,'remarks':note});
+        method: DioMethod.post,
+        data: {'id': id, 'fileIds': mList, 'remarks': note});
     if (result['code'] == 0) {
       setState(() {
         eventBus.fire(RefreshMaintDetail());
         eventBus.fire(RefreshMaintPage());
-        Navigator.of(context)..pop()..pop();
+        Navigator.of(context)
+          ..pop()
+          ..pop();
       });
     } else {
       showToast(result['msg']);
     }
   }
-
-
 }

+ 2 - 2
lib/page/maint/maint_job_list.dart

@@ -1,4 +1,4 @@
-import 'package:deus_app/common/event/RefreshPatrolEdit.dart';
+import 'package:deus_app/common/event/RefreshMaintDetail.dart';
 import 'package:deus_app/common/style/TitleBar.dart';
 import 'package:deus_app/common/style/gsy_style.dart';
 import 'package:deus_app/common/utils/ConstantString.dart';
@@ -148,7 +148,7 @@ class _MaintlJobList extends State<MaintlJobList> {
           ],
         ))
         , onWillPop: () async{
-          eventBus.fire(RefreshPatrolEdit());
+          eventBus.fire(RefreshMaintDetail());
           return true;
         });
   }

+ 3 - 3
lib/page/maint/maint_job_page.dart

@@ -110,7 +110,7 @@ class _MaintJobPage extends State<MaintJobPage> {
             _device = device;
             _num = num;
             _stase = stase;
-            index = 0;
+            index = 1;
             _load();
           },
         ),
@@ -212,7 +212,7 @@ class _MaintJobPage extends State<MaintJobPage> {
                     style: TextStyle(
                       color: maintJobVO.status == 0 || maintJobVO.status == 4
                           ? Colors.red
-                          : maintJobVO.status == 3
+                          :maintJobVO.status == 1|| maintJobVO.status == 3
                               ? Colors.orange
                               : maintJobVO.status == 2
                                   ? Colors.blue
@@ -224,7 +224,7 @@ class _MaintJobPage extends State<MaintJobPage> {
                     border: new Border.all(
                       color: maintJobVO.status == 0 || maintJobVO.status == 4
                           ? Colors.red
-                          : maintJobVO.status == 3
+                          :maintJobVO.status == 1|| maintJobVO.status == 3
                               ? Colors.orange
                               : maintJobVO.status == 2
                                   ? Colors.blue

+ 21 - 25
lib/page/patrol/patrol_job_detail.dart

@@ -62,6 +62,8 @@ class _PatrolJobDetail extends State<PatrolJobDetail> {
         fileUrls.addAll(responseData.fileUrls);
         if (responseData.status == 1 || responseData.status == 4) {
           type = true;
+        }else{
+          type = false;
         }
       });
     } else {
@@ -474,31 +476,25 @@ class _PatrolJobDetail extends State<PatrolJobDetail> {
                       ),
                     ]),
               ),
-              Container(
-                margin: const EdgeInsets.only(top: 10),
-                // padding: const EdgeInsets.fromLTRB(30.0, 0.0, 0.0, 10.0),
-                // alignment: Alignment.centerLeft,
-                child: Row(
-                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
-                    children: [
-                      new Text(
-                        '完成时间:',
-                        style: GSYConstant.smallTextLight,
-                      ),
-                      Container(
-                        child: Text(
-                          device.itemCompleteTime,
-                          style: GSYConstant.smallTextLight,
-                          textAlign: TextAlign.right,
-                        ),
-                      ),
-                    ]),
-              ),
-              // Divider(
-              //   height: 0.8,
-              //   indent: 10.0,
-              //   endIndent: 10.0,
-              //   color: Colors.grey,
+              // Container(
+              //   margin: const EdgeInsets.only(top: 10),
+              //   // padding: const EdgeInsets.fromLTRB(30.0, 0.0, 0.0, 10.0),
+              //   // alignment: Alignment.centerLeft,
+              //   child: Row(
+              //       mainAxisAlignment: MainAxisAlignment.spaceBetween,
+              //       children: [
+              //         new Text(
+              //           '完成时间:',
+              //           style: GSYConstant.smallTextLight,
+              //         ),
+              //         Container(
+              //           child: Text(
+              //             device.itemCompleteTime,
+              //             style: GSYConstant.smallTextLight,
+              //             textAlign: TextAlign.right,
+              //           ),
+              //         ),
+              //       ]),
               // ),
             ],
           ),

+ 88 - 72
lib/page/patrol/patrol_job_edit.dart

@@ -2,6 +2,7 @@ import 'dart:io';
 
 import 'package:deus_app/PhotoTool.dart';
 import 'package:deus_app/common/dialog/CloseTaskDialog.dart';
+import 'package:deus_app/common/event/RefreshPatrol.dart';
 import 'package:deus_app/common/event/RefreshPatrolEdit.dart';
 import 'package:deus_app/common/style/TitleBar.dart';
 import 'package:deus_app/common/style/gsy_style.dart';
@@ -19,32 +20,33 @@ import 'package:flutter/cupertino.dart';
 import 'package:flutter/material.dart';
 import 'package:wechat_assets_picker/wechat_assets_picker.dart';
 
-
 class PatrolJobEdit extends StatefulWidget {
-
   static var routeName = "/PatrolJobEdit";
 
   var id;
+
   @override
   State createState() {
     return _PatrolJobEdit(id);
   }
+
   PatrolJobEdit({super.key, @required this.id});
 }
 
-class _PatrolJobEdit extends State<PatrolJobEdit> {
-
+class _PatrolJobEdit extends State<PatrolJobEdit> with WidgetsBindingObserver {
   List<PatrolJobEditEmtityData> patrolItemVOS = <PatrolJobEditEmtityData>[];
 
   List<AssetEntity> imageFiles = [];
 
-  List<int>mList=[];
+  List<int> mList = [];
 
   var id;
 
   var _event;
 
-  String note='';
+  String note = '';
+
+  FocusNode focusNode = FocusNode();
 
   _PatrolJobEdit(this.id);
 
@@ -71,7 +73,9 @@ class _PatrolJobEdit extends State<PatrolJobEdit> {
                     child: SizedBox(
                       height: 50,
                       child: TextButton(
-                        onPressed: () {},
+                        onPressed: () {
+                          Navigator.pop(context);
+                        },
                         child: Text(ConstantString.back),
                         style: ButtonStyle(
                           backgroundColor: MaterialStateProperty.all<Color>(
@@ -80,7 +84,7 @@ class _PatrolJobEdit extends State<PatrolJobEdit> {
                               BeveledRectangleBorder(
                                   borderRadius: BorderRadius.circular(0))),
                           foregroundColor:
-                          MaterialStateProperty.all<Color>(Colors.white),
+                              MaterialStateProperty.all<Color>(Colors.white),
                           // padding: MaterialStateProperty.all(EdgeInsets.zero)
                         ),
                       ),
@@ -88,29 +92,29 @@ class _PatrolJobEdit extends State<PatrolJobEdit> {
                   ),
                   Expanded(
                       child: SizedBox(
-                        height: 50,
-                        child: TextButton(
-                          onPressed: () {
-                            CloseTaskDialog.showAlertDialog(context, () {
-                              if(imageFiles.isNotEmpty){
-                                uploadList();
-                              }else{
-                                patrolJobRemark();
-                              }
-                            }, '您确认完成当前巡检?');
-                          },
-                          child: Text(ConstantString.complete),
-                          style: ButtonStyle(
-                            backgroundColor:
+                    height: 50,
+                    child: TextButton(
+                      onPressed: () {
+                        CloseTaskDialog.showAlertDialog(context, () {
+                          if (imageFiles.isNotEmpty) {
+                            uploadList();
+                          } else {
+                            patrolJobRemark();
+                          }
+                        }, '您确认完成当前巡检?');
+                      },
+                      child: Text(ConstantString.complete),
+                      style: ButtonStyle(
+                        backgroundColor:
                             MaterialStateProperty.all<Color>(Colors.blue),
-                            foregroundColor:
+                        foregroundColor:
                             MaterialStateProperty.all<Color>(Colors.white),
-                            shape: MaterialStateProperty.all(BeveledRectangleBorder(
-                                borderRadius: BorderRadius.circular(0))),
-                            // padding: MaterialStateProperty.all(EdgeInsets.zero)
-                          ),
-                        ),
-                      )),
+                        shape: MaterialStateProperty.all(BeveledRectangleBorder(
+                            borderRadius: BorderRadius.circular(0))),
+                        // padding: MaterialStateProperty.all(EdgeInsets.zero)
+                      ),
+                    ),
+                  )),
                 ],
               ),
             )
@@ -128,34 +132,38 @@ class _PatrolJobEdit extends State<PatrolJobEdit> {
     return ws;
   }
 
-  Widget _picture(){
+  Widget _picture() {
     return Container(
         child: Column(
-          children: [
-            Container(
-              height: 50,
-              padding: EdgeInsets.only(left: 12),
-              alignment: Alignment.centerLeft,
-              child: Text('巡检图片',style: TextStyle(
+      children: [
+        Container(
+          height: 50,
+          padding: EdgeInsets.only(left: 12),
+          alignment: Alignment.centerLeft,
+          child: Text('巡检图片',
+              style: TextStyle(
                 color: Colors.black,
                 fontSize: GSYConstant.TextSize15,
               )),
-            ),
-            Container(
-              // padding: EdgeInsets.only(left: 12,right: 12),
-              decoration: BoxDecoration(color: Colors.white),
-              child: PhotoTool(imageCount: 5, lineCount: 5, addCall: (List<AssetEntity> _imageFiles){
+        ),
+        Container(
+          // padding: EdgeInsets.only(left: 12,right: 12),
+          decoration: BoxDecoration(color: Colors.white),
+          child: PhotoTool(
+              imageCount: 5,
+              lineCount: 5,
+              addCall: (List<AssetEntity> _imageFiles) {
                 imageFiles.addAll(_imageFiles);
-              }, removeCall:(int index){
+              },
+              removeCall: (int index) {
                 imageFiles.remove(index);
-              }),
-            )
-          ],
+              },focusNode:focusNode),
         )
-    );
+      ],
+    ));
   }
 
-  Widget _notes(){
+  Widget _notes() {
     return Container(
       child: Column(
         children: <Widget>[
@@ -163,13 +171,14 @@ class _PatrolJobEdit extends State<PatrolJobEdit> {
             height: 50,
             padding: EdgeInsets.only(left: 12),
             alignment: Alignment.centerLeft,
-            child: Text('任务结果备注',style: TextStyle(
-              color: Colors.black,
-              fontSize: GSYConstant.TextSize15,
-            )),
+            child: Text('任务结果备注',
+                style: TextStyle(
+                  color: Colors.black,
+                  fontSize: GSYConstant.TextSize15,
+                )),
           ),
           Container(
-            padding: EdgeInsets.only(left: 12,right: 12,bottom: 12),
+            padding: EdgeInsets.only(left: 12, right: 12, bottom: 12),
             decoration: BoxDecoration(color: Colors.white),
             child: Column(
               children: [
@@ -178,6 +187,7 @@ class _PatrolJobEdit extends State<PatrolJobEdit> {
                 ),
                 TextField(
                   maxLines: 5,
+                  focusNode: focusNode,
                   decoration: InputDecoration(border: OutlineInputBorder()),
                   style: TextStyle(fontSize: 14),
                   onChanged: (value) {
@@ -192,11 +202,11 @@ class _PatrolJobEdit extends State<PatrolJobEdit> {
     );
   }
 
-  Widget _mainPatrolAdd(){
+  Widget _mainPatrolAdd() {
     return Column(
       children: [
         Container(
-          padding: EdgeInsets.fromLTRB(12,0, 12, 0),
+          padding: EdgeInsets.fromLTRB(12, 0, 12, 0),
           height: 50,
           child: Row(
             mainAxisAlignment: MainAxisAlignment.spaceBetween,
@@ -211,11 +221,13 @@ class _PatrolJobEdit extends State<PatrolJobEdit> {
               Container(
                 child: TextButton(
                   onPressed: () {
+                    focusNode.unfocus();
                     Navigator.push(
                         context,
                         MaterialPageRoute(
-                            builder: (context) =>
-                            PatrolJobSelect(id: id,)));
+                            builder: (context) => PatrolJobSelect(
+                                  id: id,
+                                )));
                   },
                   child: Row(
                     children: [
@@ -259,12 +271,13 @@ class _PatrolJobEdit extends State<PatrolJobEdit> {
                         style: TextStyle(
                             fontSize: GSYConstant.middleTextWhiteSize,
                             fontWeight: FontWeight.bold)),
-                    IconButton(onPressed: (){
-                      deletePatrolItem(item.id);
-                    }, icon: new Icon(Icons.delete))
+                    IconButton(
+                        onPressed: () {
+                          deletePatrolItem(item.id);
+                        },
+                        icon: new Icon(Icons.delete))
                   ],
                 ),
-
               ),
               Container(
                 margin: const EdgeInsets.fromLTRB(0, 10.0, 0, 0),
@@ -290,7 +303,8 @@ class _PatrolJobEdit extends State<PatrolJobEdit> {
     var result = await DioUtil().request('patrolItem/list',
         method: DioMethod.post, data: {'patrolJobId': id});
     if (0 == result['code']) {
-      PatrolJobEditEmtityEntity jobEdit=patrolJobEditEmtityEntityFromJson(PatrolJobEditEmtityEntity(),result);
+      PatrolJobEditEmtityEntity jobEdit = patrolJobEditEmtityEntityFromJson(
+          PatrolJobEditEmtityEntity(), result);
       setState(() {
         patrolItemVOS.clear();
         patrolItemVOS.addAll(jobEdit.data);
@@ -329,21 +343,21 @@ class _PatrolJobEdit extends State<PatrolJobEdit> {
     _event.cancel();
   }
 
+
   uploadList() async {
     List<MultipartFile> files = [];
     for (var element in imageFiles) {
       File? imgFile = await element.file;
-      String? s=imgFile?.path;
-      MultipartFile file =MultipartFile.fromFileSync(s!);
+      String? s = imgFile?.path;
+      MultipartFile file = MultipartFile.fromFileSync(s!);
       files.add(file);
-     }
-    var formData =FormData.fromMap({
-      'files': files
-    });
+    }
+    var formData = FormData.fromMap({'files': files});
     var result = await DioUtil().request('uploadImg/uploadList',
         method: DioMethod.post, data: formData);
     if (result['code'] == 0) {
-      UploadListEntityEntity data=uploadListEntityEntityFromJson(UploadListEntityEntity(), result);
+      UploadListEntityEntity data =
+          uploadListEntityEntityFromJson(UploadListEntityEntity(), result);
       setState(() {
         mList.clear();
         mList.addAll(data.data);
@@ -356,16 +370,18 @@ class _PatrolJobEdit extends State<PatrolJobEdit> {
 
   patrolJobRemark() async {
     var result = await DioUtil().request('patrolJob/patrolJobRemark',
-        method: DioMethod.post, data: {'id': id,'fileIds':mList,'remarks':note});
+        method: DioMethod.post,
+        data: {'id': id, 'fileIds': mList, 'remarks': note});
     if (result['code'] == 0) {
       setState(() {
         eventBus.fire(RefreshPatrolEdit());
-        Navigator.of(context)..pop()..pop();
+        eventBus.fire(RefreshPatrol());
+        Navigator.of(context)
+          ..pop()
+          ..pop();
       });
     } else {
       showToast(result['msg']);
     }
   }
-
-
 }

+ 148 - 117
lib/page/patrol/patrol_job_list.dart

@@ -1,8 +1,10 @@
+import 'package:deus_app/common/event/RefreshPatrolEdit.dart';
 import 'package:deus_app/common/style/TitleBar.dart';
 import 'package:deus_app/common/style/gsy_style.dart';
 import 'package:deus_app/common/utils/ConstantString.dart';
 import 'package:deus_app/common/utils/DioUtil.dart';
 import 'package:deus_app/common/utils/ToastUtils.dart';
+import 'package:deus_app/main.dart';
 import 'package:deus_app/model/patrol_job_detail_response_entity.dart';
 import 'package:deus_app/page/patrol/patrol_job_edit.dart';
 import 'package:flutter/material.dart';
@@ -25,126 +27,154 @@ class _PatrolJobList extends State<PatrolJobList> {
 
   @override
   Widget build(BuildContext context) {
-    return Scaffold(
-        appBar: TitleBar().backAppbar("巡检设备详情"),
-        backgroundColor: const Color(0xfff2f2f2),
-        body: Stack(
-          children: [
-            Column(
+    return WillPopScope(
+        child: Scaffold(
+            appBar: TitleBar().backAppbar("巡检设备详情"),
+            backgroundColor: const Color(0xfff2f2f2),
+            body: Stack(
               children: [
-                SizedBox(
-                  height: 10,
-                ),
-                Row(
-                  mainAxisAlignment: MainAxisAlignment.start,
+                Column(
                   children: [
                     SizedBox(
-                      width: 15,
+                      height: 10,
+                    ),
+                    Row(
+                      mainAxisAlignment: MainAxisAlignment.start,
+                      children: [
+                        SizedBox(
+                          width: 15,
+                        ),
+                        Text(ConstantString.patrolJobTitle,
+                            style: GSYConstant.smallActionLightText),
+                      ],
                     ),
-                    Text(ConstantString.patrolJobTitle,
-                        style: GSYConstant.smallActionLightText),
+                    Expanded(
+                      child: Container(
+                          margin: EdgeInsets.only(bottom: 50),
+                          child: ListView.builder(
+                            itemCount: responseData.equipmentVOS.length,
+                            itemBuilder: (context, index) {
+                              return Container(
+                                  margin: EdgeInsets.only(
+                                      top: 12, left: 10, right: 10),
+                                  padding: EdgeInsets.only(top: 12, bottom: 10),
+                                  color: Colors.white,
+                                  child: ListTile(
+                                    title: Column(
+                                      children: [
+                                        Container(
+                                          // padding: const EdgeInsets.fromLTRB(30.0, 0.0, 0.0, 0.0),
+                                          alignment: Alignment.centerLeft,
+                                          child: Row(
+                                              mainAxisAlignment:
+                                                  MainAxisAlignment
+                                                      .spaceBetween,
+                                              children: [
+                                                Text(
+                                                    responseData
+                                                        .equipmentVOS[index]
+                                                        .showName,
+                                                    style: GSYConstant
+                                                        .smallTextBold),
+                                                Text(
+                                                  responseData
+                                                              .equipmentVOS[
+                                                                  index]
+                                                              .isComplete ==
+                                                          0
+                                                      ? '未完成'
+                                                      : '已完成',
+                                                  style: TextStyle(
+                                                      fontSize: GSYConstant
+                                                          .smallTextSize,
+                                                      color: responseData
+                                                                  .equipmentVOS[
+                                                                      index]
+                                                                  .isComplete ==
+                                                              0
+                                                          ? Colors.red
+                                                          : Colors.blue),
+                                                ),
+                                              ]),
+                                        ),
+                                        Container(
+                                          margin:
+                                              const EdgeInsets.only(top: 10),
+                                          // padding: const EdgeInsets.fromLTRB(30.0, 0.0, 0.0, 10.0),
+                                          // alignment: Alignment.centerLeft,
+                                          child: Row(
+                                              mainAxisAlignment:
+                                                  MainAxisAlignment
+                                                      .spaceBetween,
+                                              children: [
+                                                new Text(
+                                                  '完成时间:',
+                                                  style: GSYConstant
+                                                      .smallTextLight,
+                                                ),
+                                                Container(
+                                                  child: Text(
+                                                    responseData
+                                                        .equipmentVOS[index]
+                                                        .itemCompleteTime,
+                                                    style: GSYConstant
+                                                        .smallTextLight,
+                                                    textAlign: TextAlign.right,
+                                                  ),
+                                                ),
+                                              ]),
+                                        ),
+                                        SizedBox(
+                                          height: 5,
+                                        ),
+                                      ],
+                                    ),
+                                    onTap: () {
+                                      completeEquipment(index);
+                                    },
+                                  ));
+                            },
+                          )),
+                    )
                   ],
                 ),
-                Expanded(
-                  child:  Container(
-                      margin: EdgeInsets.only(bottom: 50),
-                      child: ListView.builder(
-                        itemCount: responseData.equipmentVOS.length,
-                        itemBuilder: (context, index) {
-                          return Container(
-                              margin: EdgeInsets.only(top: 12, left: 10, right: 10),
-                              padding: EdgeInsets.only(top: 12, bottom: 10),
-                              color: Colors.white,
-                              child: ListTile(
-                                title: Column(
-                                  children: [
-                                    Container(
-                                      // padding: const EdgeInsets.fromLTRB(30.0, 0.0, 0.0, 0.0),
-                                      alignment: Alignment.centerLeft,
-                                      child: Row(
-                                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
-                                          children: [
-                                            Text(responseData.equipmentVOS[index].showName,
-                                                style: GSYConstant.smallTextBold),
-                                            Text(
-                                              responseData
-                                                  .equipmentVOS[index].isComplete==0?'未完成':'已完成',
-                                              style: TextStyle(
-                                                  fontSize: GSYConstant.smallTextSize,
-                                                  color: responseData.equipmentVOS[index].isComplete==0?Colors.red:Colors.blue),
-                                            ),
-                                          ]),
-                                    ),
-                                    Container(
-                                      margin: const EdgeInsets.only(top: 10),
-                                      // padding: const EdgeInsets.fromLTRB(30.0, 0.0, 0.0, 10.0),
-                                      // alignment: Alignment.centerLeft,
-                                      child: Row(
-                                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
-                                          children: [
-                                            new Text(
-                                              '完成时间:',
-                                              style: GSYConstant.smallTextLight,
-                                            ),
-                                            Container(
-                                              child: Text(
-                                                responseData.equipmentVOS[index].itemCompleteTime,
-                                                style: GSYConstant.smallTextLight,
-                                                textAlign: TextAlign.right,
-                                              ),
-                                            ),
-                                          ]),
-                                    ),
-                                    SizedBox(
-                                      height: 5,
-                                    ),
-                                  ],
-                                ),
-                                onTap: () {
-                                  completeEquipment(index);
-                                },
-                              ));
-                        },
-                      )
+                Positioned(
+                  left: 0,
+                  right: 0,
+                  bottom: 0,
+                  // flex: 7,
+                  child: SizedBox(
+                    height: 50,
+                    width: double.infinity,
+                    child: TextButton(
+                      onPressed: () {
+                        if (next()) {
+                          Navigator.push(
+                              context,
+                              MaterialPageRoute(
+                                  builder: (context) =>
+                                      PatrolJobEdit(id: responseData.id)));
+                        }
+                      },
+                      style: ButtonStyle(
+                        backgroundColor:
+                            MaterialStateProperty.all<Color>(Color(0xFF4875EC)),
+                        shape: MaterialStateProperty.all(BeveledRectangleBorder(
+                            borderRadius: BorderRadius.circular(0))),
+                        foregroundColor:
+                            MaterialStateProperty.all<Color>(Colors.white),
+                        // padding: MaterialStateProperty.all(EdgeInsets.zero)
+                      ),
+                      child: const Text(ConstantString.next),
+                    ),
                   ),
                 )
-
               ],
-            ),
-            Positioned(
-              left: 0,
-              right: 0,
-              bottom:0,
-              // flex: 7,
-              child:SizedBox(
-              height: 50,
-              width: double.infinity,
-              child: TextButton(
-                onPressed: () {
-                  if(next()){
-                    Navigator.push(
-                        context,
-                        MaterialPageRoute(
-                            builder: (context) =>
-                                PatrolJobEdit(id: responseData.id)));
-                  }
-                },
-                style: ButtonStyle(
-                  backgroundColor: MaterialStateProperty.all<Color>(
-                      Color(0xFF4875EC)),
-                  shape: MaterialStateProperty.all(
-                      BeveledRectangleBorder(
-                          borderRadius: BorderRadius.circular(0))),
-                  foregroundColor:
-                  MaterialStateProperty.all<Color>(Colors.white),
-                  // padding: MaterialStateProperty.all(EdgeInsets.zero)
-                ),
-                child: const Text(ConstantString.next),
-              ),
-            ),
-            )
-          ],
-        ));
+            )),
+        onWillPop: () async {
+          eventBus.fire(RefreshPatrolEdit());
+          return true;
+        });
   }
 
   completeEquipment(int index) async {
@@ -155,6 +185,7 @@ class _PatrolJobList extends State<PatrolJobList> {
       if (result['code'] == 0) {
         setState(() {
           responseData.equipmentVOS[index].isComplete = 1;
+          responseData.equipmentVOS[index].itemCompleteTime = result['data'];
         });
       } else {
         showToast(result['msg']);
@@ -162,13 +193,13 @@ class _PatrolJobList extends State<PatrolJobList> {
     }
   }
 
-  bool next(){
-    bool isNext=true;
+  bool next() {
+    bool isNext = true;
     for (var element in responseData.equipmentVOS) {
-        if(element.isComplete==0){
-          isNext=false;
-          break;
-        }
+      if (element.isComplete == 0) {
+        isNext = false;
+        break;
+      }
     }
     return isNext;
   }

+ 2 - 3
lib/page/patrol/patrol_job_page.dart

@@ -62,7 +62,6 @@ class _PatrolJobPage extends State<PatrolJobPage> {
 
   @override
   void initState() {
-    // TODO: implement initState
     super.initState();
     _load();
     _event = eventBus.on<RefreshPatrol>().listen((event) {
@@ -187,7 +186,7 @@ class _PatrolJobPage extends State<PatrolJobPage> {
                       color:
                           patrolJobData.status == 0 || patrolJobData.status == 4
                               ? Colors.red
-                              : patrolJobData.status == 1
+                              : patrolJobData.status == 1||patrolJobData.status == 3
                                   ? Colors.orange
                                   : patrolJobData.status == 2
                                       ? Colors.blue
@@ -200,7 +199,7 @@ class _PatrolJobPage extends State<PatrolJobPage> {
                       color:
                           patrolJobData.status == 0 || patrolJobData.status == 4
                               ? Colors.red
-                              : patrolJobData.status == 1
+                              : patrolJobData.status == 1 ||patrolJobData.status == 3
                                   ? Colors.orange
                                   : patrolJobData.status == 2
                                       ? Colors.blue

+ 80 - 67
lib/page/repair/repair_add_page.dart

@@ -27,13 +27,15 @@ class RepairAddPage extends StatefulWidget {
 }
 
 class _RepairAddPage extends State<RepairAddPage> {
-
   int groupValue = 1;
-  String note='',theme='';
+  String note = '', theme = '';
   List<AssetEntity> imageFiles = [];
-  List<int>mList=[];
+  List<int> mList = [];
   var _event;
-  RepairQueryDeviceResponseDataList _dataList=RepairQueryDeviceResponseDataList();
+  RepairQueryDeviceResponseDataList _dataList =
+      RepairQueryDeviceResponseDataList();
+
+  FocusNode focusNode = FocusNode();
 
   @override
   Widget build(BuildContext context) {
@@ -54,31 +56,30 @@ class _RepairAddPage extends State<RepairAddPage> {
           Positioned(
             left: 0,
             right: 0,
-            bottom:0,
+            bottom: 0,
             // flex: 7,
-            child:SizedBox(
+            child: SizedBox(
               height: 50,
               width: double.infinity,
               child: TextButton(
                 onPressed: () {
-                  if(isAddDevice){
-                    if(imageFiles.isNotEmpty){
+                  if (isAddDevice) {
+                    if (imageFiles.isNotEmpty) {
                       uploadList();
-                    }else{
+                    } else {
                       patrolJobRemark();
                     }
-                  }else{
+                  } else {
                     showToast('请选择设备');
                   }
                 },
                 style: ButtonStyle(
-                  backgroundColor: MaterialStateProperty.all<Color>(
-                      Color(0xFF4875EC)),
-                  shape: MaterialStateProperty.all(
-                      BeveledRectangleBorder(
-                          borderRadius: BorderRadius.circular(0))),
+                  backgroundColor:
+                      MaterialStateProperty.all<Color>(Color(0xFF4875EC)),
+                  shape: MaterialStateProperty.all(BeveledRectangleBorder(
+                      borderRadius: BorderRadius.circular(0))),
                   foregroundColor:
-                  MaterialStateProperty.all<Color>(Colors.white),
+                      MaterialStateProperty.all<Color>(Colors.white),
                 ),
                 child: const Text(ConstantString.submit),
               ),
@@ -92,24 +93,26 @@ class _RepairAddPage extends State<RepairAddPage> {
     super.initState();
     _event = eventBus.on<RepairQueryDeviceResponseDataList>().listen((event) {
       setState(() {
-        _dataList=event;
-        isAddDevice=true;
+        _dataList = event;
+        isAddDevice = true;
       });
     });
   }
-  bool isAddDevice=false;
+
+  bool isAddDevice = false;
+
   List<Widget> _Ws() {
     List<Widget> ws = [];
     ws.add(_basicInformation());
     ws.add(_patrolAddTitle());
-    if(isAddDevice){
+    if (isAddDevice) {
       ws.add(_patrolAdd());
     }
     ws.add(_notes());
     return ws;
   }
 
-  Widget _notes(){
+  Widget _notes() {
     return Container(
       child: Column(
         children: <Widget>[
@@ -117,13 +120,14 @@ class _RepairAddPage extends State<RepairAddPage> {
             height: 50,
             padding: EdgeInsets.only(left: 12),
             alignment: Alignment.centerLeft,
-            child: Text('报修说明',style: TextStyle(
-              color: Colors.black,
-              fontSize: GSYConstant.TextSize15,
-            )),
+            child: Text('报修说明',
+                style: TextStyle(
+                  color: Colors.black,
+                  fontSize: GSYConstant.TextSize15,
+                )),
           ),
           Container(
-            padding: EdgeInsets.only(left: 12,right: 12,bottom: 12),
+            padding: EdgeInsets.only(left: 12, right: 12, bottom: 12),
             decoration: BoxDecoration(color: Colors.white),
             child: Column(
               children: [
@@ -134,6 +138,7 @@ class _RepairAddPage extends State<RepairAddPage> {
                   maxLines: 5,
                   decoration: InputDecoration(border: OutlineInputBorder()),
                   style: TextStyle(fontSize: 14),
+                  focusNode: focusNode,
                   onChanged: (value) {
                     note = value;
                   },
@@ -144,11 +149,16 @@ class _RepairAddPage extends State<RepairAddPage> {
           Container(
             // padding: EdgeInsets.only(left: 12,right: 12),
             decoration: BoxDecoration(color: Colors.white),
-            child: PhotoTool(imageCount: 5, lineCount: 5, addCall: (List<AssetEntity> _imageFiles){
-              imageFiles.addAll(_imageFiles);
-            }, removeCall:(int index){
-              imageFiles.remove(index);
-            }),
+            child: PhotoTool(
+                imageCount: 5,
+                lineCount: 5,
+                addCall: (List<AssetEntity> _imageFiles) {
+                  imageFiles.addAll(_imageFiles);
+                },
+                removeCall: (int index) {
+                  imageFiles.remove(index);
+                },
+                focusNode: focusNode),
           )
         ],
       ),
@@ -244,7 +254,7 @@ class _RepairAddPage extends State<RepairAddPage> {
                   textAlignVertical: TextAlignVertical.center,
                   textAlign: TextAlign.left,
                   onChanged: (value) {
-                    theme=value;
+                    theme = value;
                   },
                 ),
               )
@@ -275,11 +285,11 @@ class _RepairAddPage extends State<RepairAddPage> {
           Container(
             child: TextButton(
               onPressed: () {
+                focusNode.unfocus();
                 Navigator.push(
                     context,
                     MaterialPageRoute(
-                        builder: (context) =>
-                        new RepairJobDeviceList()));
+                        builder: (context) => new RepairJobDeviceList()));
               },
               child: Row(
                 children: [
@@ -320,37 +330,37 @@ class _RepairAddPage extends State<RepairAddPage> {
           padding: EdgeInsets.only(top: 3, bottom: 3, left: 5, right: 5),
           child: Text(
             _dataList.status == 0
-                  ? '在线'
-                  : _dataList.status == 1
-                  ? '离线'
-                  : _dataList.status == 2
-                  ? '未激活'
-                  : '未知',
-              textAlign: TextAlign.right,
-              style: TextStyle(
-                color: _dataList.status == 0
-                    ? Colors.blue
-                    : _dataList.status == 1
-                    ? Colors.orange
+                ? '在线'
+                : _dataList.status == 1
+                    ? '离线'
                     : _dataList.status == 2
-                    ? Colors.red
-                    : Colors.black,
-                fontSize: GSYConstant.minTextSize,
-              ),
-              ),
+                        ? '未激活'
+                        : '未知',
+            textAlign: TextAlign.right,
+            style: TextStyle(
+              color: _dataList.status == 0
+                  ? Colors.blue
+                  : _dataList.status == 1
+                      ? Colors.orange
+                      : _dataList.status == 2
+                          ? Colors.red
+                          : Colors.black,
+              fontSize: GSYConstant.minTextSize,
+            ),
+          ),
           decoration: BoxDecoration(
             border: new Border.all(
               color: _dataList.status == 0
                   ? Colors.blue
                   : _dataList.status == 1
-                  ? Colors.orange
-                  : _dataList.status == 2
-                  ? Colors.red
-                  : Colors.black, //边框颜色
+                      ? Colors.orange
+                      : _dataList.status == 2
+                          ? Colors.red
+                          : Colors.black, //边框颜色
               width: 1.0, //边框粗细
             ),
-            borderRadius: const BorderRadius.all(
-                const Radius.circular(3.0)), //边框的弧度
+            borderRadius:
+                const BorderRadius.all(const Radius.circular(3.0)), //边框的弧度
           ),
         )
       ]),
@@ -364,9 +374,14 @@ class _RepairAddPage extends State<RepairAddPage> {
   }
 
   patrolJobRemark() async {
-    var result = await DioUtil().request('repair-bill/create',
-        method: DioMethod.post, data: {'deviceId': _dataList.id,'repairImgIds':mList,'instructions':note,
-          'urg':groupValue,'theme':theme});
+    var result = await DioUtil()
+        .request('repair-bill/create', method: DioMethod.post, data: {
+      'deviceId': _dataList.id,
+      'repairImgIds': mList,
+      'instructions': note,
+      'urg': groupValue,
+      'theme': theme
+    });
     if (result['code'] == 0) {
       setState(() {
         eventBus.fire(RefreshRepairPage());
@@ -381,17 +396,16 @@ class _RepairAddPage extends State<RepairAddPage> {
     List<MultipartFile> files = [];
     for (var element in imageFiles) {
       File? imgFile = await element.file;
-      String? s=imgFile?.path;
-      MultipartFile file =MultipartFile.fromFileSync(s!);
+      String? s = imgFile?.path;
+      MultipartFile file = MultipartFile.fromFileSync(s!);
       files.add(file);
     }
-    var formData =FormData.fromMap({
-      'files': files
-    });
+    var formData = FormData.fromMap({'files': files});
     var result = await DioUtil().request('uploadImg/uploadList',
         method: DioMethod.post, data: formData);
     if (result['code'] == 0) {
-      UploadListEntityEntity data=uploadListEntityEntityFromJson(UploadListEntityEntity(), result);
+      UploadListEntityEntity data =
+          uploadListEntityEntityFromJson(UploadListEntityEntity(), result);
       setState(() {
         mList.clear();
         mList.addAll(data.data);
@@ -401,5 +415,4 @@ class _RepairAddPage extends State<RepairAddPage> {
       showToast(result['msg']);
     }
   }
-
 }

+ 2 - 0
lib/page/repair/repair_detail.dart

@@ -521,6 +521,8 @@ class _RepairDetail extends State<RepairDetail> {
           }else if(responseData.status==3){
             buttonText='登记维修';
           }
+        }else{
+          type = false;
         }
       });
     } else {

+ 4 - 1
lib/page/repair/repair_job_edit.dart

@@ -45,6 +45,8 @@ class _RepairJobEdit extends State<RepairJobEdit> {
 
   String note='';
 
+  FocusNode focusNode = FocusNode();
+
   _RepairJobEdit(this.responseData);
 
   @override
@@ -127,7 +129,7 @@ class _RepairJobEdit extends State<RepairJobEdit> {
                 imageFiles.addAll(_imageFiles);
               }, removeCall:(int index){
                 imageFiles.remove(index);
-              }),
+              },  focusNode: focusNode),
             )
           ],
         )
@@ -159,6 +161,7 @@ class _RepairJobEdit extends State<RepairJobEdit> {
                   maxLines: 5,
                   decoration: InputDecoration(border: OutlineInputBorder()),
                   style: TextStyle(fontSize: 14),
+                  focusNode: focusNode,
                   onChanged: (value) {
                     note = value;
                   },

+ 1 - 1
lib/widget/MaintJobDrawer.dart

@@ -20,7 +20,7 @@ DropMenuItem close = DropMenuItem('已完成', 2);
 DropMenuItem on = DropMenuItem('执行中', 1);
 DropMenuItem overdue = DropMenuItem('待执行', 3);
 DropMenuItem complete = DropMenuItem('已逾期', 4);
-List<DropMenuItem> sexMenuItems = [not, close, on, overdue, complete];
+List<DropMenuItem> sexMenuItems = [not, close, on, complete];
 
 typedef _CallBack = void Function(String device, String name,dynamic stase);
 

+ 1 - 0
lib/widget/MyDrawer.dart

@@ -176,6 +176,7 @@ class _myDrawer extends State<MyDrawer> {
                   onPressed: () {
                     if (widget.callback != null) {
                       widget.callback(_device,_username,satus,isEnabled);
+                      Navigator.pop(context);
                     }
                   },
                   child: Text(ConstantString.query),

+ 1 - 23
lib/widget/PatrolJobDrawer.dart

@@ -20,7 +20,7 @@ DropMenuItem close = DropMenuItem('已完成', 2);
 DropMenuItem on = DropMenuItem('执行中', 1);
 DropMenuItem overdue = DropMenuItem('待执行', 3);
 DropMenuItem complete = DropMenuItem('已逾期', 4);
-List<DropMenuItem> sexMenuItems = [not, close, on, overdue, complete];
+List<DropMenuItem> sexMenuItems = [not, close, on, complete];
 
 DropMenuItem day = DropMenuItem('日计划', 0);
 DropMenuItem circumference = DropMenuItem('周计划', 1);
@@ -122,28 +122,6 @@ class _patrolJobDrawer extends State<PatrolJobDrawer> {
                 ),
               ]),
             ),
-            Padding(
-              padding: const EdgeInsets.only(top: 20.0, left: 10, right: 10),
-              child: Row(children: [
-                Expanded(
-                  flex: 2,
-                  child: Text(
-                    '周期规则',
-                    style: TextStyle(
-                      color: Colors.black,
-                      fontSize: GSYConstant.minTextSize,
-                      fontWeight: FontWeight.bold,
-                    ),
-                  ),
-                ),
-                Expanded(
-                  flex: 7,
-                  child: Container(
-                    child: dropDownButtonsColumn(sexMenuItems2, '请选择周期规则', 1),
-                  ),
-                ),
-              ]),
-            ),
             SizedBox(
               height: 80,
             ),

+ 1 - 1
lib/widget/RepairJobDrawer.dart

@@ -20,7 +20,7 @@ DropMenuItem close = DropMenuItem('待执行', 2);
 DropMenuItem on = DropMenuItem('维修中', 3);
 DropMenuItem overdue = DropMenuItem('已关闭', 4);
 DropMenuItem complete = DropMenuItem('已完成', 5);
-List<DropMenuItem> sexMenuItems = [not, close, on, overdue, complete];
+List<DropMenuItem> sexMenuItems = [not, on, overdue, complete];
 
 typedef _CallBack = void Function(String device, String name,dynamic stase);