From 09dbf76ab271c71100c220af751dfbbd63d9a51d Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Tue, 30 Mar 2021 10:38:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9C=AA=E5=B7=A1=E6=A3=80?= =?UTF-8?q?=E6=97=B6=E5=B7=A1=E6=A3=80=E7=82=B9=E7=8A=B6=E6=80=81=E5=92=8C?= =?UTF-8?q?=E5=B7=A1=E6=A3=80=E8=AF=A6=E6=83=85=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inspection_manage_card.dart | 3 +- .../inspection_manage_details_page.dart | 42 ++-- .../inspection_manage_page.dart | 7 - .../inspection_point_detail_page.dart | 195 +++++++++++++++--- lib/utils/extension/aku_date.dart | 7 + 5 files changed, 196 insertions(+), 58 deletions(-) create mode 100644 lib/utils/extension/aku_date.dart diff --git a/lib/ui/manage_pages/inspection_manage/inspection_manage_card.dart b/lib/ui/manage_pages/inspection_manage/inspection_manage_card.dart index 34aacf5..0adafa7 100644 --- a/lib/ui/manage_pages/inspection_manage/inspection_manage_card.dart +++ b/lib/ui/manage_pages/inspection_manage/inspection_manage_card.dart @@ -8,6 +8,7 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:provider/provider.dart'; import 'package:velocity_x/velocity_x.dart'; +import 'package:aku_community_manager/utils/extension/aku_date.dart'; class InspectionManageCard extends StatefulWidget { final InspectionListModel cardModel; @@ -150,7 +151,7 @@ class _InspectionManageCardState extends State { Text('规定巡检时间', style: _textstyle), Spacer(), Text( - '${DateUtil.formatDateStr(widget.cardModel.beginDate, format: "yyyy-MM-dd HH:mm")}~${widget.cardModel?.endDate == null ? '' : DateUtil.formatDateStr(widget.cardModel.endDate, format: "HH:mm")}', + '${widget.cardModel.beginDate.akuDate()}${widget.cardModel?.endDate == null ? '' : '~'}${widget.cardModel?.endDate == null ? '' : widget.cardModel.endDate.akuDate()}', style: AppStyle().primaryStyle, ), ], 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 60b1e70..1073c32 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 @@ -119,10 +119,9 @@ class _InspectionManageDetailsPageState children: [ '巡检站点'.text.black.size(32.sp).bold.make(), ..._pointModels - ?.map((e) => _buildInspectionTile( - e.name, e.checkNum, e.id)) - ?.toList() ?? - [] + .map((e) => _buildInspectionTile( + e, _pointModels.indexOf(e))) + .toList() ].sepWidget(separate: 16.w.heightBox), ), ) @@ -356,32 +355,42 @@ class _InspectionManageDetailsPageState ); } - Widget _buildInspectionTile( - String inspectionStation, - int inspectionCount, - int index, - ) { + Widget _buildInspectionTile(InspectionPointModel model, int index) { return Row( children: [ CircleAvatar( - child: - '巡$index'.text.color(Color(0xFF3F8FFE)).size(28.sp).bold.make(), + child: '巡$index' + .text + .color(model.completeDate == null + ? Color(0xFFA6CBFF) + : Color(0xFF3F8FFE)) + .size(28.sp) + .bold + .make(), radius: 48.w, backgroundColor: Color(0xFFE9F2FF), ), 24.w.widthBox, Column( children: [ - inspectionStation.text.black.size(28.sp).bold.make(), - '$inspectionCount项检查'.text.color(kTextSubColor).size(24.sp).make() + model.name.text + .color(model.completeDate == null + ? kTextPrimaryColor + : kTextSubColor) + .size(28.sp) + .bold + .make(), + '${model.checkNum}项检查'.text.color(kTextSubColor).size(24.sp).make() ], ), Spacer(), - _inspectionStatus[_detailModel.status] + (model.completeDate == null ? '待巡检' : '已巡检') .text .size(24.sp) .bold - .color(_inspectionColor(_detailModel.status)) + .color(model.completeDate == null + ? Color(0xFFFF4501) + : Color(0xFF52C41A)) .make(), 14.w.widthBox, Icon( @@ -398,7 +407,8 @@ class _InspectionManageDetailsPageState .make() .onInkTap(() { Get.to(() => InspectionPointDetailPage( - executePointId: index, + hasScan: model.completeDate == null ? false : true, + executePointId: model.id, executeName: _detailModel.name, )); }); diff --git a/lib/ui/manage_pages/inspection_manage/inspection_manage_page.dart b/lib/ui/manage_pages/inspection_manage/inspection_manage_page.dart index c20d207..44f145c 100644 --- a/lib/ui/manage_pages/inspection_manage/inspection_manage_page.dart +++ b/lib/ui/manage_pages/inspection_manage/inspection_manage_page.dart @@ -1,17 +1,10 @@ // Flutter imports: -import 'package:aku_community_manager/const/api.dart'; -import 'package:aku_community_manager/models/manager/inspection/inspection_list_model.dart'; -import 'package:aku_community_manager/provider/app_provider.dart'; import 'package:aku_community_manager/provider/user_provider.dart'; -import 'package:aku_community_manager/ui/manage_pages/inspection_manage/inspection_manage_card.dart'; import 'package:aku_community_manager/ui/manage_pages/inspection_manage/inspection_manage_view.dart'; -import 'package:aku_community_manager/ui/widgets/common/bee_list_view.dart'; import 'package:aku_community_manager/ui/widgets/inner/aku_tab_bar.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:provider/provider.dart'; -import 'package:velocity_x/velocity_x.dart'; // Package imports: 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 index 8fb4af0..e472a51 100644 --- a/lib/ui/manage_pages/inspection_manage/inspection_point_detail_page.dart +++ b/lib/ui/manage_pages/inspection_manage/inspection_point_detail_page.dart @@ -4,6 +4,7 @@ import 'package:aku_community_manager/ui/manage_pages/inspection_manage/inspecti 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:dotted_border/dotted_border.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -12,10 +13,12 @@ import 'package:velocity_x/velocity_x.dart'; class InspectionPointDetailPage extends StatefulWidget { final int executePointId; final String executeName; + final hasScan; InspectionPointDetailPage({ Key key, this.executePointId, this.executeName, + @required this.hasScan, }) : super(key: key); @override @@ -65,7 +68,7 @@ class _InspectionPointDetailPageState extends State { .map((e) => _bodyCard(e)) .toList(), _selfPhotoCard(), - _selfPhotoCard(), + _scenePhotoCard(), ], ), ), @@ -82,11 +85,34 @@ class _InspectionPointDetailPageState extends State { ], ), 32.w.heightBox, - Container( - width: 320.w, - height: 320.w, - child: Placeholder(), - ) + widget.hasScan + ? Container( + width: 320.w, + height: 320.w, + child: Placeholder(), + ) + : DottedBorder( + color: Color(0xFF999999), + strokeWidth: 2.w, + radius: Radius.circular(8.w), + child: Container( + width: 160.w, + height: 160.w, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + R.ASSETS_MANAGE_IC_IMAGE_PNG, + width: 60.w, + height: 60.w, + ), + 4.w.heightBox, + '上传图片'.text.color(kTextSubColor).size(22.sp).bold.make(), + ], + ), + ), + ) ], ) .box @@ -95,46 +121,147 @@ class _InspectionPointDetailPageState extends State { .make(); } - Widget _bodyCard(CheckFBIVoList model) { + Widget _scenePhotoCard() { return Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ - '2.${model.name}'.text.color(kTextPrimaryColor).size(32.sp).make() + '3.巡更人员拍摄现场'.text.color(kTextPrimaryColor).size(32.sp).bold.make() ], ), 32.w.heightBox, + widget.hasScan + ? Container( + width: 320.w, + height: 320.w, + child: Placeholder(), + ) + : DottedBorder( + color: Color(0xFF999999), + strokeWidth: 2.w, + radius: Radius.circular(8.w), + child: Container( + width: 160.w, + height: 160.w, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + R.ASSETS_MANAGE_IC_IMAGE_PNG, + width: 60.w, + height: 60.w, + ), + 4.w.heightBox, + '上传图片'.text.color(kTextSubColor).size(22.sp).bold.make(), + ], + ), + ), + ) + ], + ) + .box + .color(Colors.white) + .padding(EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w)) + .make(); + } + + Widget _bodyCard(CheckFBIVoList model) { + return Column( + children: [ 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(), - ), + '2.${model.name}'.text.color(kTextPrimaryColor).size(32.sp).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), + 32.w.heightBox, + widget.hasScan + ? 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(), + ), + ], + ) + : Row( + children: [ + Container( + width: 180.w, + height: 72.w, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4.w), + color: Color(0xFFF9F9F9), + border: + Border.all(color: Color(0xFF999999), width: 3.w), + ), + child: '正常' + .text + .color(kTextSubColor) + .size(32.sp) + .bold + .make()), + Container( + width: 180.w, + height: 72.w, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4.w), + color: Color(0xFFF9F9F9), + border: + Border.all(color: Color(0xFF999999), width: 3.w), + ), + child: '异常' + .text + .color(kTextSubColor) + .size(32.sp) + .bold + .make()), + ], ), - ), - padding: EdgeInsets.symmetric(vertical: 16.w, horizontal: 24.w), - child: - model.remakes.text.color(kTextPrimaryColor).size(28.sp).make()), + ...!widget.hasScan + ? [] + : [ + 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 diff --git a/lib/utils/extension/aku_date.dart b/lib/utils/extension/aku_date.dart new file mode 100644 index 0000000..367e168 --- /dev/null +++ b/lib/utils/extension/aku_date.dart @@ -0,0 +1,7 @@ +import 'package:common_utils/common_utils.dart'; + +extension DateExt on String { + String akuDate({String format}) { + return DateUtil.formatDateStr(this, format: format ?? "yyyy-MM-dd HH:mm"); + } +}