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 b8eae81..d11f040 100644 --- a/lib/ui/manage_pages/inspection_manage/inspection_manage_card.dart +++ b/lib/ui/manage_pages/inspection_manage/inspection_manage_card.dart @@ -47,170 +47,163 @@ class _InspectionManageCardState extends State { @override Widget build(BuildContext context) { - return Column( - mainAxisSize: MainAxisSize.min, - children: [ - 16.w.heightBox, - AkuButton( - onPressed: () { - Get.to( - InspectionManageDetailsPage( - inspectionStatus: widget.cardModel.status, - executeId: widget.cardModel.id, - ), - ); - }, - child: Container( - alignment: Alignment.centerLeft, - padding: EdgeInsets.only(left: 24.w, right: 24.w, bottom: 40.w), + return AkuButton( + onPressed: () { + Get.to( + InspectionManageDetailsPage( + inspectionStatus: widget.cardModel.status, + executeId: widget.cardModel.id, + ), + ); + }, + child: 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: 93.w, width: double.infinity, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.w), - color: Color(0xFFFFFFFF)), - child: Column(children: [ - Container( - height: 93.w, - width: double.infinity, - alignment: Alignment.centerLeft, - child: Row( - children: [ - Text( - '${widget.cardModel.name}', - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: AppStyle.primaryTextColor, - fontSize: 32.sp, - fontWeight: FontWeight.bold), - ).expand(), - _inspectionStatus[widget.cardModel.status] - .text - .color(_inspectionColor(widget.cardModel.status)) - .bold - .size(28.sp) - .make() - ], - ), + alignment: Alignment.centerLeft, + child: Row( + children: [ + Text( + '${widget.cardModel.name}', + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 32.sp, + fontWeight: FontWeight.bold), + ).expand(), + _inspectionStatus[widget.cardModel.status] + .text + .color(_inspectionColor(widget.cardModel.status)) + .bold + .size(28.sp) + .make() + ], + ), + ), + Divider(height: 1.w), + 24.w.heightBox, + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset( + R.ASSETS_MANAGE_IC_RENWU_PNG, + width: 40.w, + height: 40.w, ), - Divider(height: 1.w), - 24.w.heightBox, + 4.w.widthBox, Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Image.asset( - R.ASSETS_MANAGE_IC_RENWU_PNG, - width: 40.w, - height: 40.w, + Text( + '巡检编号', + style: _textstyle, ), - 4.w.widthBox, + ], + ), + 36.w.widthBox, + Text( + widget.cardModel.code, + maxLines: 2, + textAlign: TextAlign.right, + style: AppStyle().primaryStyle, + ).expand() + ], + ), + 12.w.heightBox, + ...isManager + ? [ Row( - crossAxisAlignment: CrossAxisAlignment.start, children: [ + Image.asset( + R.ASSETS_MANAGE_IC_RENWU_PNG, + width: 40.w, + height: 40.w, + ), + 4.w.widthBox, Text( - '巡检编号', + '巡检人', style: _textstyle, ), + Spacer(), + Text( + widget.cardModel.inspectorName, + style: AppStyle().primaryStyle, + ) ], ), - 36.w.widthBox, - Text( - widget.cardModel.code, - maxLines: 2, - textAlign: TextAlign.right, - style: AppStyle().primaryStyle, - ).expand() - ], + 12.w.heightBox, + ] + : [SizedBox()], + Row( + children: [ + Image.asset( + R.ASSETS_INSPECTION_IC_XUNJIAN_PNG, + width: 40.w, + height: 40.w, ), - 12.w.heightBox, - ...isManager - ? [ - Row( - children: [ - Image.asset( - R.ASSETS_MANAGE_IC_RENWU_PNG, - width: 40.w, - height: 40.w, - ), - 4.w.widthBox, - Text( - '巡检人', - style: _textstyle, - ), - Spacer(), - Text( - widget.cardModel.inspectorName, - style: AppStyle().primaryStyle, - ) - ], - ), - 12.w.heightBox, - ] - : [SizedBox()], - Row( - children: [ - Image.asset( - R.ASSETS_INSPECTION_IC_XUNJIAN_PNG, - width: 40.w, - height: 40.w, - ), - 4.w.widthBox, - 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")}', - style: AppStyle().primaryStyle, - ), - ], + 4.w.widthBox, + 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")}', + style: AppStyle().primaryStyle, ), - 12.w.heightBox, - ...widget?.cardModel?.actualBeginDate == null - ? [SizedBox()] - : [ - Row( - children: [ - Image.asset( - R.ASSETS_MANAGE_IC_TIME_PNG, - width: 40.w, - height: 40.w, - ), - 4.w.widthBox, - Text( - '开始巡检时间', - style: _textstyle, - ), - Spacer(), - Text( - '${DateUtil.formatDateStr(widget.cardModel.actualBeginDate, format: "yyyy-MM-dd HH:mm")}', - style: AppStyle().primaryStyle, - ), - ], + ], + ), + 12.w.heightBox, + ...widget?.cardModel?.actualBeginDate == null + ? [SizedBox()] + : [ + Row( + children: [ + Image.asset( + R.ASSETS_MANAGE_IC_TIME_PNG, + width: 40.w, + height: 40.w, + ), + 4.w.widthBox, + Text( + '开始巡检时间', + style: _textstyle, + ), + Spacer(), + Text( + '${DateUtil.formatDateStr(widget.cardModel.actualBeginDate, format: "yyyy-MM-dd HH:mm")}', + style: AppStyle().primaryStyle, ), - 12.w.heightBox, ], - widget?.cardModel?.actualEndDate == null - ? SizedBox() - : Row( - children: [ - Image.asset( - R.ASSETS_MESSAGE_IC_PEOPLE_PNG, - width: 40.w, - height: 40.w, - ), - 4.w.widthBox, - Text( - '结束巡检时间', - style: _textstyle, - ), - Spacer(), - Text( - '${DateUtil.formatDateStr(widget.cardModel.actualEndDate, format: "yyyy-MM-dd HH:mm")}', - style: AppStyle().primaryStyle, - ), - ], - ) - ]), - ), - ), - ], + ), + 12.w.heightBox, + ], + widget?.cardModel?.actualEndDate == null + ? SizedBox() + : Row( + children: [ + Image.asset( + R.ASSETS_MESSAGE_IC_PEOPLE_PNG, + width: 40.w, + height: 40.w, + ), + 4.w.widthBox, + Text( + '结束巡检时间', + style: _textstyle, + ), + Spacer(), + Text( + '${DateUtil.formatDateStr(widget.cardModel.actualEndDate, format: "yyyy-MM-dd HH:mm")}', + 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 ae64c03..34ae2f7 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 @@ -83,10 +83,18 @@ class _InspectionManageDetailsPageState onRefresh: () async { _detailModel = await ManageFunc.getInspectionDetail(widget.executeId); - ManageFunc.getInspectionPoint(widget.executeId).then((value) { - _pointModels = - value.map((e) => InspectionPointModel.fromJson(e)).toList(); - }); + await ManageFunc.getInspectionPoint(_detailModel.inspectionPlanId) + .then( + (value) { + if (value == null) { + _pointModels = []; + } else { + _pointModels = value + .map((e) => InspectionPointModel.fromJson(e)) + .toList(); + } + }, + ); _onload = false; setState(() {}); }, @@ -108,6 +116,11 @@ class _InspectionManageDetailsPageState crossAxisAlignment: CrossAxisAlignment.start, children: [ '巡检站点'.text.black.size(32.sp).bold.make(), + ..._pointModels + ?.map((e) => _buildInspectionTile( + e.name, e.checkNum, e.id)) + ?.toList() ?? + [] ].sepWidget(separate: 16.w.heightBox), ), ) @@ -118,7 +131,12 @@ class _InspectionManageDetailsPageState onPressed: () {}, padding: EdgeInsets.symmetric(vertical: 26.w), color: kPrimaryColor, - child: '开始巡检'.text.black.bold.size(32.sp).make(), + child: (widget.inspectionStatus == 1 ? '开始巡检' : '立即扫码') + .text + .black + .bold + .size(32.sp) + .make(), ).pOnly(bottom: MediaQuery.of(context).padding.bottom)); } @@ -217,7 +235,7 @@ class _InspectionManageDetailsPageState Text('规定巡检时间', style: _textstyle), Spacer(), Text( - '${DateUtil.formatDateStr(_detailModel.beginDate, format: "yyyy-MM-dd HH:mm")}~${_detailModel?.endDate == null ? '' : DateUtil.formatDateStr(_detailModel.endDate, format: "HH:mm")}', + '${DateUtil.formatDateStr(_detailModel.beginDate, format: "yyyy-MM-dd HH:mm")}${_detailModel?.endDate == null ? '' : '~'}${_detailModel?.endDate == null ? '' : DateUtil.formatDateStr(_detailModel.endDate, format: "HH:mm")}', style: AppStyle().primaryStyle, ), ], diff --git a/lib/ui/manage_pages/inspection_manage/inspection_manage_view.dart b/lib/ui/manage_pages/inspection_manage/inspection_manage_view.dart index 922fa07..da52bbf 100644 --- a/lib/ui/manage_pages/inspection_manage/inspection_manage_view.dart +++ b/lib/ui/manage_pages/inspection_manage/inspection_manage_view.dart @@ -43,12 +43,12 @@ class _InspectionMangeViewState extends State { }, builder: (items) { return ListView.separated( - padding: EdgeInsets.symmetric(horizontal: 32.w), + padding: EdgeInsets.fromLTRB(32.w, 16.w, 32.w, 16.w), itemBuilder: (context, index) { return InspectionManageCard(cardModel: items[index]); }, separatorBuilder: (context, index) { - return 8.w.heightBox; + return 16.w.heightBox; }, itemCount: items.length, );