From 278a712ec609ddb2330f9b9a4989253d3aa816b7 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Mon, 29 Mar 2021 20:24:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=EF=BC=9A=E5=B7=A1=E6=A3=80?= =?UTF-8?q?=E7=AE=A1=E7=90=86=EF=BC=9A=E6=9F=A5=E8=AF=A2=E5=B7=A1=E6=A3=80?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E7=82=B9=E4=BF=A1=E6=81=AF=EF=BC=88=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E5=B7=B2=E5=B7=A1=E6=A3=80=E6=9F=A5=E7=9C=8B=E8=AF=A6?= =?UTF-8?q?=E6=83=85=EF=BC=89=20=E6=B7=BB=E5=8A=A0=20=E5=B7=A1=E6=A3=80?= =?UTF-8?q?=E7=82=B9=E8=AF=A6=E6=83=85=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/const/api.dart | 4 + .../inspection_check_detail_model.dart | 81 +++++ .../inspection_manage_details_page.dart | 9 +- .../inspection_point_detail_page.dart | 290 ++++++++++++++++++ .../inspection_point_input_page.dart | 21 +- lib/ui/sub_pages/manage_func.dart | 10 + 6 files changed, 398 insertions(+), 17 deletions(-) create mode 100644 lib/models/manager/inspection/inspection_check_detail_model.dart create mode 100644 lib/ui/manage_pages/inspection_manage/inspection_point_detail_page.dart diff --git a/lib/const/api.dart b/lib/const/api.dart index 8b00914..77d6ee2 100644 --- a/lib/const/api.dart +++ b/lib/const/api.dart @@ -160,6 +160,10 @@ class _Manage { ///巡检管理:提交巡检点信息 String get submitPointDetail => '/user/inspection/submitPointDetail'; + + ///巡检管理:查询巡检执行点信息(点击已巡检查看详情) + String get inspectionPointCheckDetail => + '/user/inspection/findCheckDetailById'; } class _Upload { diff --git a/lib/models/manager/inspection/inspection_check_detail_model.dart b/lib/models/manager/inspection/inspection_check_detail_model.dart new file mode 100644 index 0000000..39c2bc8 --- /dev/null +++ b/lib/models/manager/inspection/inspection_check_detail_model.dart @@ -0,0 +1,81 @@ +class InspectionCheckDetialModel { + int id; + int executeId; + String code; + String name; + int type; + String completeDate; + List checkFBIVoList; + List faceImg; + List spaceImg; + + InspectionCheckDetialModel( + {this.id, + this.executeId, + this.code, + this.name, + this.type, + this.completeDate, + this.checkFBIVoList, + this.faceImg, + this.spaceImg}); + + InspectionCheckDetialModel.fromJson(Map json) { + id = json['id']; + executeId = json['executeId']; + code = json['code']; + name = json['name']; + type = json['type']; + completeDate = json['completeDate']; + if (json['checkFBIVoList'] != null) { + checkFBIVoList = new List(); + json['checkFBIVoList'].forEach((v) { + checkFBIVoList.add(new CheckFBIVoList.fromJson(v)); + }); + } + faceImg = json['faceImg'].cast(); + spaceImg = json['spaceImg'].cast(); + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['executeId'] = this.executeId; + data['code'] = this.code; + data['name'] = this.name; + data['type'] = this.type; + data['completeDate'] = this.completeDate; + if (this.checkFBIVoList != null) { + data['checkFBIVoList'] = + this.checkFBIVoList.map((v) => v.toJson()).toList(); + } + data['faceImg'] = this.faceImg; + data['spaceImg'] = this.spaceImg; + return data; + } +} + +class CheckFBIVoList { + int id; + String name; + int status; + String remakes; + + CheckFBIVoList({this.id, this.name, this.status, this.remakes}); + + CheckFBIVoList.fromJson(Map json) { + id = json['id']; + name = json['name']; + status = json['status']; + remakes = json['remakes']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['status'] = this.status; + data['remakes'] = this.remakes; + return data; + } +} diff --git a/lib/ui/manage_pages/inspection_manage/inspection_manage_details_page.dart b/lib/ui/manage_pages/inspection_manage/inspection_manage_details_page.dart index 9505803..60b1e70 100644 --- a/lib/ui/manage_pages/inspection_manage/inspection_manage_details_page.dart +++ b/lib/ui/manage_pages/inspection_manage/inspection_manage_details_page.dart @@ -3,6 +3,7 @@ import 'package:aku_community_manager/const/api.dart'; import 'package:aku_community_manager/models/manager/inspection/inspection_detail_model.dart'; import 'package:aku_community_manager/models/manager/inspection/inspection_point_model.dart'; import 'package:aku_community_manager/models/manager/inspection/inspection_qrcode_model.dart'; +import 'package:aku_community_manager/ui/manage_pages/inspection_manage/inspection_point_detail_page.dart'; import 'package:aku_community_manager/ui/manage_pages/inspection_manage/inspection_point_input_page.dart'; import 'package:aku_community_manager/ui/manage_pages/inspection_manage/qr_code_parase.dart'; import 'package:aku_community_manager/ui/manage_pages/inspection_manage/qr_scanner_page.dart'; @@ -151,7 +152,6 @@ class _InspectionManageDetailsPageState QRCodeParase.getExecutePointId(result.code)); if (baseModel.status) { Get.to(() => InspectionPointInputPage( - hasScan: true, inspectionName: _detailModel.name, qrModel: InspectionQRCodeModel.fromJson( baseModel.data), @@ -396,7 +396,12 @@ class _InspectionManageDetailsPageState .withRounded(value: 4.w) .padding(EdgeInsets.all(24.w)) .make() - .onInkTap(() {}); + .onInkTap(() { + Get.to(() => InspectionPointDetailPage( + executePointId: index, + executeName: _detailModel.name, + )); + }); } } // Widget _inspectionPersons(){ diff --git a/lib/ui/manage_pages/inspection_manage/inspection_point_detail_page.dart b/lib/ui/manage_pages/inspection_manage/inspection_point_detail_page.dart new file mode 100644 index 0000000..8fb4af0 --- /dev/null +++ b/lib/ui/manage_pages/inspection_manage/inspection_point_detail_page.dart @@ -0,0 +1,290 @@ +import 'package:aku_community_manager/models/manager/inspection/inspection_check_detail_model.dart'; +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/ui/manage_pages/inspection_manage/inspection_utils.dart'; +import 'package:aku_community_manager/ui/sub_pages/manage_func.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:common_utils/common_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class InspectionPointDetailPage extends StatefulWidget { + final int executePointId; + final String executeName; + InspectionPointDetailPage({ + Key key, + this.executePointId, + this.executeName, + }) : super(key: key); + + @override + _InspectionPointDetailPageState createState() => + _InspectionPointDetailPageState(); +} + +class _InspectionPointDetailPageState extends State { + bool _onload = true; + EasyRefreshController _easyRefreshController; + InspectionCheckDetialModel _detialModel; + @override + void initState() { + super.initState(); + _easyRefreshController = EasyRefreshController(); + } + + @override + void dispose() { + _easyRefreshController?.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '巡检点', + body: EasyRefresh( + header: + MaterialHeader(valueColor: AlwaysStoppedAnimation(kPrimaryColor)), + firstRefresh: true, + onRefresh: () async { + _detialModel = await ManageFunc.getInspectionPointCheckDetail( + widget.executePointId); + _onload = false; + setState(() {}); + }, + controller: _easyRefreshController, + child: _onload + ? _emptyWidget() + : ListView( + children: [ + 16.w.heightBox, + _inspectionHeadCard(_detialModel), + 16.w.heightBox, + ..._detialModel.checkFBIVoList + .map((e) => _bodyCard(e)) + .toList(), + _selfPhotoCard(), + _selfPhotoCard(), + ], + ), + ), + ); + } + + Widget _selfPhotoCard() { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + '3.巡更人员自拍人脸'.text.color(kTextPrimaryColor).size(32.sp).bold.make() + ], + ), + 32.w.heightBox, + Container( + width: 320.w, + height: 320.w, + child: Placeholder(), + ) + ], + ) + .box + .color(Colors.white) + .padding(EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w)) + .make(); + } + + Widget _bodyCard(CheckFBIVoList model) { + return Column( + children: [ + Row( + children: [ + '2.${model.name}'.text.color(kTextPrimaryColor).size(32.sp).make() + ], + ), + 32.w.heightBox, + Row( + children: [ + Container( + width: 180.w, + height: 72.w, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4.w), + color: Color(0xFFFFF8E0), + border: Border.all(color: Color(0xFFFFC40C), width: 3.w), + ), + child: model.status == 1 + ? '正常'.text.color(kTextPrimaryColor).size(32.sp).bold.make() + : '异常'.text.color(kTextPrimaryColor).size(32.sp).bold.make(), + ), + ], + ), + 36.w.heightBox, + Container( + width: 686.w, + height: 120.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.w), + border: Border.all( + width: 2.w, + color: Color(0xFFE8E8E8), + ), + ), + padding: EdgeInsets.symmetric(vertical: 16.w, horizontal: 24.w), + child: + model.remakes.text.color(kTextPrimaryColor).size(28.sp).make()), + ], + ) + .box + .padding(EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w)) + .color(Colors.white) + .make(); + } + + Widget _emptyWidget() { + return Container(); + } + + Widget _inspectionHeadCard(InspectionCheckDetialModel model) { + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + 16.w.heightBox, + Container( + alignment: Alignment.centerLeft, + padding: EdgeInsets.only(left: 24.w, right: 24.w, bottom: 40.w), + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.w), + color: Color(0xFFFFFFFF)), + child: Column(children: [ + Container( + height: 86.w, + width: double.infinity, + alignment: Alignment.centerLeft, + child: Row( + children: [ + Text( + '巡检点信息', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 36.sp, + fontWeight: FontWeight.bold), + ), + ], + ), + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset( + R.ASSETS_MANAGE_IC_RENWU_PNG, + width: 40.w, + height: 40.w, + ), + 4.w.widthBox, + Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + '巡检名称', + style: InspectionUtils.textstyle, + ), + ], + ), + 36.w.widthBox, + Text( + model.name, + maxLines: 2, + textAlign: TextAlign.right, + style: AppStyle().primaryStyle, + ).expand() + ], + ), + 12.w.heightBox, + Row( + children: [ + Image.asset( + R.ASSETS_MANAGE_IC_RENWU_PNG, + width: 40.w, + height: 40.w, + ), + 4.w.widthBox, + Text( + '巡检点编号', + style: InspectionUtils.textstyle, + ), + Spacer(), + Text( + model.code, + style: AppStyle().primaryStyle, + ) + ], + ), + 12.w.heightBox, + Row( + children: [ + Image.asset( + R.ASSETS_INSPECTION_IC_XUNJIAN_PNG, + width: 40.w, + height: 40.w, + ), + 4.w.widthBox, + Text( + '巡检点名称', + style: InspectionUtils.textstyle, + ), + Spacer(), + Text( + '${model.name}', + style: AppStyle().primaryStyle, + ), + ], + ), + 12.w.heightBox, + Row( + children: [ + Image.asset( + R.ASSETS_MESSAGE_IC_PEOPLE_PNG, + width: 40.w, + height: 40.w, + ), + 4.w.widthBox, + Text( + '巡检模式', + style: InspectionUtils.textstyle, + ), + Spacer(), + Text( + '${model.type}', + style: AppStyle().primaryStyle, + ), + ], + ), + Row( + children: [ + Image.asset( + R.ASSETS_MESSAGE_IC_PEOPLE_PNG, + width: 40.w, + height: 40.w, + ), + 4.w.widthBox, + Text( + '扫码时间', + style: InspectionUtils.textstyle, + ), + Spacer(), + Text( + '${DateUtil.formatDateStr(model.completeDate, format: "yyyy-MM-dd HH:mm")}', + style: AppStyle().primaryStyle, + ), + ], + ) + ]), + ), + ], + ); + } +} diff --git a/lib/ui/manage_pages/inspection_manage/inspection_point_input_page.dart b/lib/ui/manage_pages/inspection_manage/inspection_point_input_page.dart index 9164804..95e7a70 100644 --- a/lib/ui/manage_pages/inspection_manage/inspection_point_input_page.dart +++ b/lib/ui/manage_pages/inspection_manage/inspection_point_input_page.dart @@ -1,5 +1,3 @@ -import 'dart:io'; - import 'package:aku_community_manager/models/manager/inspection/inspection_point_submit_model.dart'; import 'package:aku_community_manager/models/manager/inspection/inspection_qrcode_model.dart'; import 'package:aku_community_manager/style/app_style.dart'; @@ -13,11 +11,9 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:velocity_x/velocity_x.dart'; class InspectionPointInputPage extends StatefulWidget { - final bool hasScan; final InspectionQRCodeModel qrModel; final String inspectionName; - InspectionPointInputPage( - {Key key, this.hasScan = true, this.qrModel, this.inspectionName}) + InspectionPointInputPage({Key key, this.qrModel, this.inspectionName}) : super(key: key); @override @@ -48,16 +44,11 @@ class _InspectionPointInputPageState extends State { 16.w.heightBox, _inspectionHeadCard(), 16.w.heightBox, - ...widget.hasScan - ? [ - ..._model.checkVoList - .map((e) => - _meterCard(e.name, _model.checkVoList.indexOf(e))) - .toList(), - _selfPhotoCard(), - _scenePhotoCard(), - ] - : [] + ..._model.checkVoList + .map((e) => _meterCard(e.name, _model.checkVoList.indexOf(e))) + .toList(), + _selfPhotoCard(), + _scenePhotoCard(), ], ), bottom: AkuButton( diff --git a/lib/ui/sub_pages/manage_func.dart b/lib/ui/sub_pages/manage_func.dart index 6407fa9..b4a39cb 100644 --- a/lib/ui/sub_pages/manage_func.dart +++ b/lib/ui/sub_pages/manage_func.dart @@ -1,5 +1,6 @@ import 'package:aku_community_manager/const/api.dart'; import 'package:aku_community_manager/models/manager/decoration/decoration_detail_model.dart'; +import 'package:aku_community_manager/models/manager/inspection/inspection_check_detail_model.dart'; import 'package:aku_community_manager/models/manager/inspection/inspection_detail_model.dart'; import 'package:aku_community_manager/models/manager/inspection/inspection_point_model.dart'; import 'package:aku_community_manager/models/manager/inspection/inspection_point_submit_model.dart'; @@ -79,4 +80,13 @@ class ManageFunc { return response.data; } + + static Future getInspectionPointCheckDetail( + int executePointId) async { + BaseModel baseModel = + await NetUtil().get(API.manage.inspectionPointCheckDetail, params: { + "executePointId": executePointId, + }); + return InspectionCheckDetialModel.fromJson(baseModel.data); + } }