From 4cd42d56f6e577a031c0c953747333071ecae9d6 Mon Sep 17 00:00:00 2001 From: laiiihz Date: Thu, 5 Nov 2020 21:31:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A3=85=E4=BF=AE=E7=AE=A1=E7=90=86=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../decoration/decoration_data.dart | 95 ++++++ .../decoration_follow_check.dart | 270 ++++++++++++++++++ .../decoration_manager_detail_page.dart | 22 +- .../decoration_success_page.dart | 71 +++++ 4 files changed, 453 insertions(+), 5 deletions(-) create mode 100644 lib/ui/sub_pages/decoration_manager/decoration_follow_check.dart create mode 100644 lib/ui/sub_pages/decoration_manager/decoration_success_page.dart diff --git a/lib/mock_models/decoration/decoration_data.dart b/lib/mock_models/decoration/decoration_data.dart index e607017..e5a11e7 100644 --- a/lib/mock_models/decoration/decoration_data.dart +++ b/lib/mock_models/decoration/decoration_data.dart @@ -20,6 +20,101 @@ class DecorationData { ), cycleCheck: CycleCheck(), ), + DecorationModel( + decorationDate: DateTime(2020, 1, 23, 12, 23, 0), + type: DecorationType.HAND_OUT, + statusType: DecorationStatusType.DONE, + userHomeModel: UserHomeModel( + userName: '李慧珍', + plot: '深圳华茂悦峰', + detailAddr: '1幢-1单元-302室', + phone: '18201939840', + ), + decorationTeamModel: DecorationTeamModel( + name: '深圳莫川装修有限公司', + userName: '李惠政', + phone: '19298540192', + ), + cycleCheck: CycleCheck( + authPerson: FixerModel(name: '林鸿章', phone: '18294859301'), + startDate: DateTime(2020, 1, 23, 20, 23, 0), + checkCycle: 7, + checkDetails: [ + CHECK_TYPE.ELECTRIC, + CHECK_TYPE.WATER, + CHECK_TYPE.WALL, + CHECK_TYPE.DOOR_AND_WINDOWS, + ], + ), + workFinishCheck: WorkFinishCheck( + authPerson: FixerModel(name: '林鸿章', phone: '18294859301'), + startDate: DateTime(2020, 1, 23, 20, 23, 0), + checkDetails: [ + CHECK_TYPE.ELECTRIC, + CHECK_TYPE.WATER, + CHECK_TYPE.WALL, + CHECK_TYPE.DOOR_AND_WINDOWS, + CHECK_TYPE.SECURITY, + ], + ), + checkInfomations: [ + CheckInfomation( + checkDate: DateTime(2020, 3, 20, 12, 00), + info: '正常', + checkType: '完工检查', + details: [ + CheckDetail(type: CHECK_TYPE.ELECTRIC), + CheckDetail(type: CHECK_TYPE.WATER), + CheckDetail(type: CHECK_TYPE.WALL), + CheckDetail(type: CHECK_TYPE.DOOR_AND_WINDOWS), + ], + ), + CheckInfomation( + checkDate: DateTime(2020, 2, 14, 12, 00), + info: '正常', + checkType: '周期检查', + details: [ + CheckDetail(type: CHECK_TYPE.ELECTRIC), + CheckDetail(type: CHECK_TYPE.WATER), + CheckDetail(type: CHECK_TYPE.WALL), + CheckDetail(type: CHECK_TYPE.DOOR_AND_WINDOWS), + ], + ), + CheckInfomation( + checkDate: DateTime(2020, 2, 7, 12, 00), + info: '厨房水路异常', + checkType: '周期检查', + details: [ + CheckDetail(type: CHECK_TYPE.ELECTRIC), + CheckDetail(type: CHECK_TYPE.WATER, status: false), + CheckDetail(type: CHECK_TYPE.WALL), + CheckDetail(type: CHECK_TYPE.DOOR_AND_WINDOWS), + ], + ), + CheckInfomation( + checkDate: DateTime(2020, 1, 30, 12, 00), + info: '正常', + checkType: '周期检查', + details: [ + CheckDetail(type: CHECK_TYPE.ELECTRIC), + CheckDetail(type: CHECK_TYPE.WATER), + CheckDetail(type: CHECK_TYPE.WALL), + CheckDetail(type: CHECK_TYPE.DOOR_AND_WINDOWS), + ], + ), + CheckInfomation( + checkDate: DateTime(2020, 1, 23, 12, 00), + info: '正常', + checkType: '周期检查', + details: [ + CheckDetail(type: CHECK_TYPE.ELECTRIC), + CheckDetail(type: CHECK_TYPE.WATER), + CheckDetail(type: CHECK_TYPE.WALL), + CheckDetail(type: CHECK_TYPE.DOOR_AND_WINDOWS), + ], + ), + ], + ), DecorationModel( decorationDate: DateTime(2020, 1, 23, 12, 23, 0), type: DecorationType.DONE, diff --git a/lib/ui/sub_pages/decoration_manager/decoration_follow_check.dart b/lib/ui/sub_pages/decoration_manager/decoration_follow_check.dart new file mode 100644 index 0000000..6b75ea0 --- /dev/null +++ b/lib/ui/sub_pages/decoration_manager/decoration_follow_check.dart @@ -0,0 +1,270 @@ +import 'package:aku_community_manager/mock_models/decoration/decoration_model.dart'; +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/tools/widget_tool.dart'; +import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_checkbox.dart'; +import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_success_page.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:aku_community_manager/ui/widgets/inner/aku_bottom_button.dart'; +import 'package:common_utils/common_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +class DecorationFollowCheck extends StatefulWidget { + final DecorationModel model; + DecorationFollowCheck({Key key, @required this.model}) : super(key: key); + + @override + _DecorationFollowCheckState createState() => _DecorationFollowCheckState(); +} + +class _DecorationFollowCheckState extends State { + Map checkStatus = { + CHECK_TYPE.ELECTRIC: true, + CHECK_TYPE.WATER: true, + CHECK_TYPE.WALL: true, + CHECK_TYPE.DOOR_AND_WINDOWS: true, + CHECK_TYPE.SECURITY: true, + }; + + bool get success { + for (var item in checkStatus.keys) { + if (checkStatus[item] == false) return false; + } + return true; + } + + TextEditingController _textEditingController = TextEditingController(); + @override + void dispose() { + _textEditingController?.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '跟踪检查', + body: ListView( + padding: EdgeInsets.symmetric(vertical: 16.w), + children: [ + Container( + color: Colors.white, + padding: EdgeInsets.symmetric( + horizontal: 32.w, + vertical: 16.w, + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + child: Row( + children: [ + Container( + height: 56.w, + width: 56.w, + alignment: Alignment.center, + child: Text( + '家', + style: TextStyle( + color: AppStyle.secondaryColor, + fontSize: 24.sp, + fontWeight: FontWeight.bold, + ), + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(28.w), + color: Color(0xFFE9F2FF), + ), + ), + AkuBox.w(30), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.model.userHomeModel.plot, + style: TextStyle( + fontWeight: FontWeight.bold, + color: AppStyle.primaryTextColor, + fontSize: 24.sp, + ), + ), + Text( + widget.model.userHomeModel.detailAddr, + style: TextStyle( + fontWeight: FontWeight.bold, + color: AppStyle.primaryTextColor, + fontSize: 24.sp, + ), + ), + ], + ), + ), + ], + ), + padding: EdgeInsets.symmetric( + vertical: 26.w, + horizontal: 32.w, + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.w), + color: Color(0xFFF9F9F9), + ), + ), + AkuBox.h(16), + Container( + child: Row( + children: [ + Container( + height: 56.w, + width: 56.w, + alignment: Alignment.center, + child: Text( + '装', + style: TextStyle( + color: AppStyle.secondaryColor, + fontSize: 24.sp, + fontWeight: FontWeight.bold, + ), + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(28.w), + color: Color(0xFFE9F2FF), + ), + ), + AkuBox.w(30), + Expanded( + child: Text( + widget.model.decorationTeamModel.name, + style: TextStyle( + fontWeight: FontWeight.bold, + color: AppStyle.primaryTextColor, + fontSize: 24.sp, + ), + ), + ), + ], + ), + padding: EdgeInsets.symmetric( + vertical: 26.w, + horizontal: 32.w, + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.w), + color: Color(0xFFF9F9F9), + ), + ), + AkuBox.h(16), + Row( + children: [ + Text( + '${DateUtil.formatDate( + DateTime.now(), + format: 'yyyy-MM-dd', + )} 周期检查', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.w, + fontWeight: FontWeight.bold, + ), + ), + Spacer(), + AkuBox.h(96), + Text( + success ? '正常' : '异常', + style: TextStyle( + color: success + ? AppStyle.successColor + : AppStyle.failColor, + fontSize: 28.w, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + _buildRow(CHECK_TYPE.ELECTRIC), + _buildRow(CHECK_TYPE.WATER), + _buildRow(CHECK_TYPE.WALL), + _buildRow(CHECK_TYPE.DOOR_AND_WINDOWS), + _buildRow(CHECK_TYPE.SECURITY), + TextField( + minLines: 3, + maxLines: 99, + controller: _textEditingController, + decoration: InputDecoration( + contentPadding: EdgeInsets.symmetric( + vertical: 16.w, + horizontal: 24.w, + ), + hintText: '请输入检查描述', + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(8.w), + borderSide: BorderSide( + width: 2.w, + color: Color(0xFFE8E8E8), + ), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(8.w), + borderSide: BorderSide( + width: 2.w, + color: Color(0xFFE8E8E8), + ), + ), + ), + ), + ], + ), + ), + ], + ), + bottom: AkuBottomButton( + onTap: () { + widget.model.checkInfomations.add( + CheckInfomation( + checkDate: DateTime.now(), + checkType: '周期检查', + info: _textEditingController.text, + details: checkStatus.entries.map((e) { + return CheckDetail(type: e.key, status: e.value); + }).toList(), + ), + ); + widget.model.type = DecorationType.DONE; + Get.off(DecorationSuccessPage()); + }, + title: '确认提交', + ), + ); + } + + _buildRow( + CHECK_TYPE type, + ) { + return Row( + children: [ + Image.asset( + checkAssetMap[type], + height: 40.w, + width: 40.w, + ), + Text( + checkTypeMap[type], + style: TextStyle( + fontSize: 28.w, + color: AppStyle.primaryTextColor, + ), + ), + Spacer(), + DecorationCheckBox( + initValue: checkStatus[type], + onChange: (state) { + checkStatus[type] = state; + setState(() {}); + }, + ), + Spacer(), + ], + ); + } +} diff --git a/lib/ui/sub_pages/decoration_manager/decoration_manager_detail_page.dart b/lib/ui/sub_pages/decoration_manager/decoration_manager_detail_page.dart index 1525299..b2679ed 100644 --- a/lib/ui/sub_pages/decoration_manager/decoration_manager_detail_page.dart +++ b/lib/ui/sub_pages/decoration_manager/decoration_manager_detail_page.dart @@ -6,6 +6,7 @@ import 'package:aku_community_manager/tools/widget_tool.dart'; import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_check_row.dart'; import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_checkbox.dart'; import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_department_page.dart'; +import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_follow_check.dart'; import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_util.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_back_button.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; @@ -49,8 +50,7 @@ class _DecorationManagerDetailStatePage ? SizedBox() : _buildFinishWorkCheck(), _buildCycleCheck(), - widget.model.type == DecorationType.WAIT_HAND_OUT || - widget.model.type == DecorationType.HAND_OUT + widget.model.checkInfomations == null ? SizedBox() : _buildCheckDetail(), ], @@ -79,9 +79,21 @@ class _DecorationManagerDetailStatePage // else if(widget.model.type) } else if (role == USER_ROLE.PROPERTY) { - // return - } - // return + switch (widget.model.type) { + case DecorationType.HAND_OUT: + return AkuBottomButton( + title: '立即执行', + onTap: () { + Get.to(DecorationFollowCheck(model: widget.model)); + }, + ); + break; + default: + return SizedBox(); + break; + } + } else + return SizedBox(); }), ); } diff --git a/lib/ui/sub_pages/decoration_manager/decoration_success_page.dart b/lib/ui/sub_pages/decoration_manager/decoration_success_page.dart new file mode 100644 index 0000000..28f6ba6 --- /dev/null +++ b/lib/ui/sub_pages/decoration_manager/decoration_success_page.dart @@ -0,0 +1,71 @@ +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/tools/widget_tool.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:aku_ui/common_widgets/aku_material_button.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +class DecorationSuccessPage extends StatefulWidget { + DecorationSuccessPage({Key key}) : super(key: key); + + @override + _DecorationSuccessPageState createState() => _DecorationSuccessPageState(); +} + +class _DecorationSuccessPageState extends State { + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '跟踪检查', + backgroundColor: Color(0xFFF9F9F9), + body: Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + height: 100.w, + width: 100.w, + child: Placeholder(), + ), + Text( + '提交成功', + style: TextStyle( + fontWeight: FontWeight.bold, + color: AppStyle.primaryTextColor, + fontSize: 40.sp, + ), + ), + Text( + '你的装修跟踪检查记录已提交', + style: TextStyle( + fontWeight: FontWeight.bold, + color: AppStyle.minorTextColor, + fontSize: 26.sp, + ), + ), + AkuBox.h(80), + AkuMaterialButton( + height: 88.w, + minWidth: 280.w, + radius: 8.w, + onPressed: () { + Get.back(); + Get.back(); + }, + color: AppStyle.primaryColor, + child: Text( + '查看', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 32.w, + fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + ), + ); + } +}