diff --git a/lib/const/api.dart b/lib/const/api.dart index 6f1a3b0..8b00914 100644 --- a/lib/const/api.dart +++ b/lib/const/api.dart @@ -157,6 +157,9 @@ class _Manage { ///巡检管理:扫码二维码查询巡检信息 String get inspectionFindCheckDetailByQR => '/user/inspection/findCheckDetailByQR'; + + ///巡检管理:提交巡检点信息 + String get submitPointDetail => '/user/inspection/submitPointDetail'; } class _Upload { diff --git a/lib/models/manager/inspection/inspection_point_submit_model.dart b/lib/models/manager/inspection/inspection_point_submit_model.dart new file mode 100644 index 0000000..e85a8dc --- /dev/null +++ b/lib/models/manager/inspection/inspection_point_submit_model.dart @@ -0,0 +1,16 @@ +import 'dart:io'; + +class InspectionPointSubmitModel { + int executePointId; + List executeCheckList; + File inspectionFaceImg; + File inspectionSpaceImg; + InspectionPointSubmitModel(); +} + +class ExecuteCheckList { + int id; + int status; + String remarks; + ExecuteCheckList(); +} diff --git a/lib/models/manager/inspection/inspection_qrcode_model.dart b/lib/models/manager/inspection/inspection_qrcode_model.dart new file mode 100644 index 0000000..9675e15 --- /dev/null +++ b/lib/models/manager/inspection/inspection_qrcode_model.dart @@ -0,0 +1,54 @@ +class InspectionQRCodeModel { + int id; + String code; + String name; + int type; + List checkVoList; + + InspectionQRCodeModel( + {this.id, this.code, this.name, this.type, this.checkVoList}); + + InspectionQRCodeModel.fromJson(Map json) { + id = json['id']; + code = json['code']; + name = json['name']; + type = json['type']; + if (json['checkVoList'] != null) { + checkVoList = new List(); + json['checkVoList'].forEach((v) { + checkVoList.add(new CheckVoList.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['code'] = this.code; + data['name'] = this.name; + data['type'] = this.type; + if (this.checkVoList != null) { + data['checkVoList'] = this.checkVoList.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class CheckVoList { + int id; + String name; + + CheckVoList({this.id, this.name}); + + CheckVoList.fromJson(Map json) { + id = json['id']; + name = json['name']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + 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 ee26389..9505803 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 @@ -2,6 +2,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_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'; @@ -149,7 +150,12 @@ class _InspectionManageDetailsPageState _detailModel.id, QRCodeParase.getExecutePointId(result.code)); if (baseModel.status) { - Get.to(() => InspectionPointInputPage()); + Get.to(() => InspectionPointInputPage( + hasScan: true, + inspectionName: _detailModel.name, + qrModel: InspectionQRCodeModel.fromJson( + baseModel.data), + )); } else { showCupertinoDialog( context: context, 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 22d60da..9164804 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,29 +1,23 @@ import 'dart:io'; -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'; +import 'package:aku_community_manager/models/manager/inspection/inspection_qrcode_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/widgets/app_widgets/aku_pick_image_widget.dart'; import 'package:aku_community_manager/ui/widgets/app_widgets/aku_single_check_button.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; -import 'package:common_utils/common_utils.dart'; +import 'package:aku_ui/aku_ui.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:velocity_x/velocity_x.dart'; class InspectionPointInputPage extends StatefulWidget { final bool hasScan; - final InspectionDetailModel detailModel; - final int inspectionStatus; - final InspectionPointModel pointModel; + final InspectionQRCodeModel qrModel; + final String inspectionName; InspectionPointInputPage( - {Key key, - this.hasScan, - this.detailModel, - this.inspectionStatus, - this.pointModel}) + {Key key, this.hasScan = true, this.qrModel, this.inspectionName}) : super(key: key); @override @@ -32,26 +26,16 @@ class InspectionPointInputPage extends StatefulWidget { } class _InspectionPointInputPageState extends State { - TextEditingController _cleaningExtraController; - TextEditingController _meterExtraController; - TextEditingController _meterCountContrlller; - int _cleaningStatus; - int _meterStatus; - File _selfPhoto; - File _scenePhoto; + InspectionPointSubmitModel _submitModel; + InspectionQRCodeModel _model; @override void initState() { super.initState(); - _cleaningExtraController = TextEditingController(); - _meterExtraController = TextEditingController(); - _meterCountContrlller = TextEditingController(); + _model = widget.qrModel; } @override void dispose() { - _cleaningExtraController?.dispose(); - _meterExtraController?.dispose(); - _meterCountContrlller?.dispose(); super.dispose(); } @@ -64,12 +48,25 @@ class _InspectionPointInputPageState extends State { 16.w.heightBox, _inspectionHeadCard(), 16.w.heightBox, - _cleaningCard(), - _meterCard(), - _selfPhotoCard(), - _scenePhotoCard(), + ...widget.hasScan + ? [ + ..._model.checkVoList + .map((e) => + _meterCard(e.name, _model.checkVoList.indexOf(e))) + .toList(), + _selfPhotoCard(), + _scenePhotoCard(), + ] + : [] ], ), + bottom: AkuButton( + width: double.infinity, + height: 100.w, + child: '立即提交'.text.color(kTextPrimaryColor).bold.size(32.sp).make(), + color: kPrimaryColor, + padding: EdgeInsets.symmetric(vertical: 26.w), + ).pOnly(bottom: MediaQuery.of(context).padding.bottom), ); } @@ -84,7 +81,7 @@ class _InspectionPointInputPageState extends State { 32.w.heightBox, AkuPickImageWidget( onChanged: (file) { - _scenePhoto = file; + _submitModel.inspectionFaceImg = file; }, ), ], @@ -102,19 +99,22 @@ class _InspectionPointInputPageState extends State { 32.w.heightBox, AkuPickImageWidget( onChanged: (file) { - _selfPhoto = file; + _submitModel.inspectionSpaceImg = file; }, ), ], ).box.color(Colors.white).make(); } - Widget _meterCard() { + Widget _meterCard( + String title, + int index, + ) { return Column( children: [ Row( children: [ - '2.检查小区南门抄表数据'.text.color(kTextPrimaryColor).size(32.sp).make() + '2.$title'.text.color(kTextPrimaryColor).size(32.sp).make() ], ), 32.w.heightBox, @@ -123,48 +123,48 @@ class _InspectionPointInputPageState extends State { AkuSingleCheckButton( text: '正常', value: 0, - gropValue: _meterStatus, + gropValue: _submitModel.executeCheckList[index].status, onPressed: () { - _cleaningStatus = 0; + _submitModel.executeCheckList[index].status = 0; }, ), 80.w.widthBox, AkuSingleCheckButton( text: '异常', value: 0, - gropValue: _meterStatus, + gropValue: _submitModel.executeCheckList[index].status, onPressed: () { - _cleaningStatus = 1; + _submitModel.executeCheckList[index].status = 1; }, ), ], ), 36.w.heightBox, - Row( - children: [ - '抄表值'.text.color(kTextPrimaryColor).size(28.sp).make(), - Spacer(), - TextField( - controller: _meterCountContrlller, - textAlign: TextAlign.end, - inputFormatters: [ - FilteringTextInputFormatter.allow(RegExp('[0-9]*')) - ], - decoration: InputDecoration( - border: InputBorder.none, - hintText: '请输入抄表值', - hintStyle: TextStyle( - fontSize: 28.sp, - color: kTextSubColor, - ), - contentPadding: EdgeInsets.zero, - isDense: true, - ), - ) - ], - ), - 28.w.heightBox, - Divider(), + // Row( + // children: [ + // '抄表值'.text.color(kTextPrimaryColor).size(28.sp).make(), + // Spacer(), + // TextField( + // controller: _meterCountContrlller, + // textAlign: TextAlign.end, + // inputFormatters: [ + // FilteringTextInputFormatter.allow(RegExp('[0-9]*')) + // ], + // decoration: InputDecoration( + // border: InputBorder.none, + // hintText: '请输入抄表值', + // hintStyle: TextStyle( + // fontSize: 28.sp, + // color: kTextSubColor, + // ), + // contentPadding: EdgeInsets.zero, + // isDense: true, + // ), + // ) + // ], + // ), + // 28.w.heightBox, + // Divider(), Container( width: 686.w, height: 120.w, @@ -177,7 +177,9 @@ class _InspectionPointInputPageState extends State { ), child: TextField( minLines: 5, - controller: _meterExtraController, + onChanged: (value) { + _submitModel.executeCheckList[index].remarks = value; + }, decoration: InputDecoration( hintText: '请输入备注信息', hintStyle: TextStyle( @@ -198,71 +200,6 @@ class _InspectionPointInputPageState extends State { .make(); } - Widget _cleaningCard() { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - '1.${widget.pointModel.name}'.text.black.size(32.sp).bold.make() - ], - ), - 32.w.heightBox, - Row( - children: [ - AkuSingleCheckButton( - text: '正常', - value: 0, - gropValue: _cleaningStatus, - onPressed: () { - _cleaningStatus = 0; - }, - ), - 80.w.widthBox, - AkuSingleCheckButton( - text: '异常', - value: 0, - gropValue: _cleaningStatus, - onPressed: () { - _cleaningStatus = 1; - }, - ), - ], - ), - 32.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), - ), - ), - child: TextField( - minLines: 5, - controller: _cleaningExtraController, - decoration: InputDecoration( - hintText: '请输入备注信息', - hintStyle: TextStyle( - fontSize: 28.sp, - color: kTextSubColor, - ), - contentPadding: EdgeInsets.zero, - border: InputBorder.none, - isDense: true, - ), - ), - ), - ], - ) - .box - .color(Colors.white) - .padding(EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w)) - .make(); - } - Widget _inspectionHeadCard() { return Column( mainAxisSize: MainAxisSize.min, @@ -283,18 +220,18 @@ class _InspectionPointInputPageState extends State { child: Row( children: [ Text( - '${widget.detailModel.name}', + '巡检点信息', style: TextStyle( color: AppStyle.primaryTextColor, fontSize: 36.sp, fontWeight: FontWeight.bold), ), - Spacer(), - InspectionUtils.status[widget.inspectionStatus].text - .color(InspectionUtils.color(widget.inspectionStatus)) - .bold - .size(28.sp) - .make() + // Spacer(), + // InspectionUtils.status[widget.detailModel.status].text + // .color(InspectionUtils.color(widget.detailModel.status)) + // .bold + // .size(28.sp) + // .make() ], ), ), @@ -318,7 +255,7 @@ class _InspectionPointInputPageState extends State { ), 36.w.widthBox, Text( - widget.detailModel.name, + widget.inspectionName, maxLines: 2, textAlign: TextAlign.right, style: AppStyle().primaryStyle, @@ -335,12 +272,12 @@ class _InspectionPointInputPageState extends State { ), 4.w.widthBox, Text( - '巡检编号', + '巡检点编号', style: InspectionUtils.textstyle, ), Spacer(), Text( - widget.detailModel.code, + widget.qrModel.code, style: AppStyle().primaryStyle, ) ], @@ -355,62 +292,36 @@ class _InspectionPointInputPageState extends State { ), 4.w.widthBox, Text( - '规定巡检时间', + '巡检点名称', style: InspectionUtils.textstyle, ), Spacer(), Text( - '${DateUtil.formatDateStr(widget.detailModel.beginDate, format: "yyyy-MM-dd HH:mm")}~${widget.detailModel?.endDate == null ? '' : DateUtil.formatDateStr(widget.detailModel.endDate, format: "HH:mm")}', + '${widget.qrModel.name}', style: AppStyle().primaryStyle, ), ], ), 12.w.heightBox, - ...widget.detailModel?.actualBeginDate == null - ? [SizedBox()] - : [ - Row( - children: [ - Image.asset( - R.ASSETS_MANAGE_IC_TIME_PNG, - width: 40.w, - height: 40.w, - ), - 4.w.widthBox, - Text( - '开始巡检时间', - style: InspectionUtils.textstyle, - ), - Spacer(), - Text( - '${DateUtil.formatDateStr(widget.detailModel.actualBeginDate, format: "yyyy-MM-dd HH:mm")}', - style: AppStyle().primaryStyle, - ), - ], - ), - 12.w.heightBox, - ], - widget.detailModel?.actualEndDate == null - ? SizedBox() - : 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(widget.detailModel.actualEndDate, format: "yyyy-MM-dd HH:mm")}', - 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( + '${widget.qrModel.type}', + style: AppStyle().primaryStyle, + ), + ], + ) ]), ), ], diff --git a/lib/ui/sub_pages/manage_func.dart b/lib/ui/sub_pages/manage_func.dart index 9dfeef9..6407fa9 100644 --- a/lib/ui/sub_pages/manage_func.dart +++ b/lib/ui/sub_pages/manage_func.dart @@ -2,6 +2,7 @@ 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_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'; import 'package:aku_community_manager/utils/network/base_model.dart'; import 'package:aku_community_manager/utils/network/net_util.dart'; import 'package:dio/dio.dart'; @@ -65,4 +66,17 @@ class ManageFunc { params: {"executeId": executeId, "executePointId": excutePointId}); return baseModel; } + + static Future getSubmitPoint(InspectionPointSubmitModel model) async { + Response response = await NetUtil() + .dio + .post(API.manage.submitPointDetail, queryParameters: { + "executePointId": model.executePointId, + "executeCheckList": model.executeCheckList, + "inspectionFaceImg": [], + "inspectionSpaceImg": [] + }); + + return response.data; + } }