From 9e5b915a9391995b53386288d0c956e8a06503ae Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Fri, 13 Aug 2021 16:07:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E5=B7=A5=E7=A8=8B=E7=BB=B4?= =?UTF-8?q?=E4=BF=AE=E5=88=97=E8=A1=A8=20=E5=AE=8C=E6=88=90=E5=B7=A5?= =?UTF-8?q?=E7=A8=8B=E7=BB=B4=E4=BF=AE=E5=88=97=E8=A1=A8=E9=A1=B5=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E6=B7=BB=E5=8A=A0=E5=B7=A5=E7=A8=8B?= =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + analysis_options.yaml | 3 +- assets/manage/estate.png | Bin 0 -> 2142 bytes lib/const/api.dart | 7 +- lib/const/engineer_repair.dart | 5 +- .../home/application/applications_page.dart | 32 +- lib/ui/home/home_page.dart | 32 +- .../add_engineer_repair_page.dart | 194 ++++++++++++ .../engineer_repair/engineer_repair_card.dart | 275 ++++++++++++++++++ .../engineer_repair/engineer_repair_func.dart | 16 + .../engineer_repair/engineer_repair_map.dart | 26 ++ .../engineer_repair/engineer_repair_page.dart | 39 ++- .../engineer_repair/engineer_repair_view.dart | 63 +++- 13 files changed, 652 insertions(+), 41 deletions(-) create mode 100644 assets/manage/estate.png create mode 100644 lib/ui/manage_pages/engineer_repair/add_engineer_repair_page.dart create mode 100644 lib/ui/manage_pages/engineer_repair/engineer_repair_card.dart create mode 100644 lib/ui/manage_pages/engineer_repair/engineer_repair_func.dart create mode 100644 lib/ui/manage_pages/engineer_repair/engineer_repair_map.dart diff --git a/.gitignore b/.gitignore index 2113af3..8e9efbc 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ app.*.symbols app.*.map.json resource.dart flutter_sdk +local.properties diff --git a/analysis_options.yaml b/analysis_options.yaml index f08dcc0..0bf0251 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,3 +1,2 @@ analyzer: - errors: - unused_import: error \ No newline at end of file + errors: \ No newline at end of file diff --git a/assets/manage/estate.png b/assets/manage/estate.png new file mode 100644 index 0000000000000000000000000000000000000000..f305c2ea95c667631c1ef2e1a06f958511416dab GIT binary patch literal 2142 zcmZuzXEYlO8;u%GXb~euwb~ddCEC&kL8-(jVkK6r7_VKVui5n?2-;GsN{rSh6|>Z; z(R`>~)i?G?HAbnn;kAR;_v<_7JNuh0FnDIIE<}ie;u0~cdQI=0xE~3z8woLFFi9o0H7wBk4@kP z08VZgqx7)h9Ba8XL}6pWIDD=CYmAui^d2Zh*%95XDXWPLdK7-*jC05O89Vd8q^v_S zIo(Dja6I@@Q23YDp*7+4PHNG8LxkTC4J$f{5Gj0I*m50iY=1LSQ7`QLGJHWvetL=fNn!jT zd=lpGQaZNVc%9W_8JaRL<7Z-G@{!f3msj9f^Vq=sq=0gtO7t3ELTL1>PdSLdmqpvu zii&Hj>StE2fsX5@1VVAt9xUGDY4C-I2Yd7!m|v$e&xbkM;*&+Z8?fc(xyv{^O1dVd z?^3N-F?bS5p2)TB@hRx1)ABvdyTOSwVTz8OJoO+cF{AXk-HL^g54%G|KuNd3M=bS9PIkBU;{!I>CPd(zwI;L=%FnS?U}XZ1)7;Ceec|5!E43dsb)HGI(?c^dYZqDxax-pO8_{qZw#X8OoQi zktKyP%Q2o8AX3_@cWNBqS<0d>Z>RetCX{0}gyaVYQpqd)I8;JN?pXqT-!qrB1jRLu zS$G-BifYQL>*G}GRMyyzwqF`=7)^p~&OT*`IM80sjmf-M5W2e(okOn9gVG`sfvXBo z>Z|_~!WJfIioxAA%=3;8qt;K}zp!-RR6HERaaEC;-QWL4HGBeP^VzKJMK0dXUAW*H zq1B8$kj59zA#N`JGnG?Z7y^soUa$ffOiSvtd)8!f9mUBbP|%9x_9>cs-sSTA9`Hw;j0v4-$_$R}f-6GLUkc<%#nhDQ;;zc^6b}-rgB3T2u;i z?S(~{n_gZ>tY5VBj8c?Ie^p&bDndEq@n7ZOXW1+a#@xIj*(*nAwB)W5Q_A%Tl@$~e z64I3^<-RWt4f9V>nmLQ)@QX5>+?*@o`YblqeQzFKl z?m(GF2r!g3#Nl$J?)7MtH2#oSEFnpjO0yr2zClZqtMtrdC~&4HF|Sj%CMkuQlWD91&ldI2(9 zO%Pf+E~J>zQ<3Y5NNkDm9rpD5C!}UvN<5(&(P$@5-2o}vJn$Cgp#NCrYqD2bFL@tx zQXtxXpUvL=yxU}G{Ae>HzP`YEJELhuV0P}Tyz08Cg;so!?DR|MG=CY1tXNutzgu3C zm{zlybP2BLA0g%RnK4=O)YzE@ zCN#mTW1sSutmz*ds(D9VRE6{(Tp{;2S;~CPSbwBB4S-1LrEn0&9rh4S{DWOKItAE)Ux6q4PzW(MC^4yvmf##Eu{;m%Kuq519bhk$^ z_?(zp{Rl-2-nF{AijSZ|!Z>6qvp#V4-rM~Pu)AC+m6)U+RYpLr?K72uEqhn_xn$iG z!)xswWg9#*(cS6Q#VYVr#K;Uw1Uzc(VQDku9~gMF#qLTHOXs$7^uP?qSIQXIF4y36 z?(GEabHywtpVMBMZMw4*X&F`AXmkr(HoLT}zcH`SmtE!3-tE$MFXC-OLs(sV)wQWV zp~S~#Ae1&V2ItNwKB2|lSYPN*f#{OVI7W(;yp14sYP~YF65Vb2J_)d|sY6a8Fz3V+ zBFfIm>9jWnWoHg1XroD+BE4Fkj~vQ71O8yf==|c9K#>N;f!)_2`2&-NqWrr?JYd`J zzuVUD66I=hnyz>pVrs7a;aKFyt*xzrh_d4j8p~_Y+&dUZmcH@ltU-oB;R{vw*D=A} z=0%{na9#KOJcHaW-TJapH_9a4hSe&dKq&cA_YsRAl)~;kpjw`^U%^>xGLqSdzHu=i;57`=RcemkTS^7ebuT)mP zee>Ct=X|-?OdKq##S&N*M~7?c>$TcS`a9C>KJpf`0i$*N4gieN7*yp=*XVx%#rpfi literal 0 HcmV?d00001 diff --git a/lib/const/api.dart b/lib/const/api.dart index b07ad2a..3c06ca0 100644 --- a/lib/const/api.dart +++ b/lib/const/api.dart @@ -11,6 +11,7 @@ class API { static String get resource => '$host/static'; static String image(String path) => '$resource$path'; + static String file(String path) => '$resource$path'; static const int networkTimeOut = 10000; @@ -19,7 +20,7 @@ class API { static _Manage manage = _Manage(); static _Upload upload = _Upload(); static _Message message = _Message(); - static _EngineerRepair engineerReapair = _EngineerRepair(); + static _EngineerRepair engineerRepair = _EngineerRepair(); } class _Auth { @@ -353,6 +354,10 @@ class _Upload { ///家政服务 上传处理完成照片 String get uploadHandlerPhoto => '/user/upload/uploadHousekeepingServiceHandlerPhone'; + + ///上传报事报修工程维修照片 + String get uploadEngineerRepair => + '/user/upload/uploadButlerAppEngineeringRepair'; } class _Message { diff --git a/lib/const/engineer_repair.dart b/lib/const/engineer_repair.dart index 7b4bee1..803873c 100644 --- a/lib/const/engineer_repair.dart +++ b/lib/const/engineer_repair.dart @@ -2,5 +2,8 @@ part of 'api.dart'; class _EngineerRepair { ///管家app 报事报修工程维修:查询所有的报事报修工程维修信息 - String get engineerRepair => '/user/repairEngineering/list'; + String get engineerRepairList => '/user/repairEngineering/list'; + + ///管家app 报事报修工程维修:添加报事报修工程维修 + String get engineerRepairInsert => '/user/repairEngineering/insert'; } diff --git a/lib/ui/home/application/applications_page.dart b/lib/ui/home/application/applications_page.dart index 3d443af..8cba679 100644 --- a/lib/ui/home/application/applications_page.dart +++ b/lib/ui/home/application/applications_page.dart @@ -1,43 +1,43 @@ // Flutter imports: -import 'package:aku_community_manager/models/user/user_info_model.dart'; -import 'package:aku_community_manager/tools/user_tool.dart'; -import 'package:aku_community_manager/ui/manage_pages/clock_in_out/clock_in_out_page.dart'; -import 'package:aku_community_manager/ui/manage_pages/facilities/facilities_select_page.dart'; -import 'package:aku_community_manager/ui/manage_pages/house_keeping/house_keeping_page.dart'; -import 'package:aku_community_manager/ui/manage_pages/interview/interview_page.dart'; -import 'package:aku_community_manager/ui/sub_pages/decoration_manager/new_renovation/new_renovation_page.dart'; -import 'package:aku_community_manager/ui/widgets/common/aku_material_button.dart'; -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:get/get.dart'; -import 'package:provider/provider.dart'; - // Project imports: import 'package:aku_community_manager/const/resource.dart'; +import 'package:aku_community_manager/models/user/user_info_model.dart'; import 'package:aku_community_manager/provider/app_provider.dart'; import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/tools/screen_tool.dart'; +import 'package:aku_community_manager/tools/user_tool.dart'; import 'package:aku_community_manager/tools/widget_tool.dart'; +import 'package:aku_community_manager/ui/manage_pages/clock_in_out/clock_in_out_page.dart'; +import 'package:aku_community_manager/ui/manage_pages/engineer_repair/engineer_repair_page.dart'; +import 'package:aku_community_manager/ui/manage_pages/facilities/facilities_select_page.dart'; import 'package:aku_community_manager/ui/manage_pages/green_manage/green_manage_page.dart'; +import 'package:aku_community_manager/ui/manage_pages/house_keeping/house_keeping_page.dart'; import 'package:aku_community_manager/ui/manage_pages/hygience_manage/hygience_manage_page.dart'; import 'package:aku_community_manager/ui/manage_pages/inspection_manage/inspection_manage_page.dart'; +import 'package:aku_community_manager/ui/manage_pages/interview/interview_page.dart'; import 'package:aku_community_manager/ui/manage_pages/key_manage/key_manage_page.dart'; import 'package:aku_community_manager/ui/manage_pages/packages_manage/packages_manage_page.dart'; import 'package:aku_community_manager/ui/manage_pages/rules_manage/rules_manage_page.dart'; import 'package:aku_community_manager/ui/sub_pages/activity_manager/activity_manager_page.dart'; import 'package:aku_community_manager/ui/sub_pages/borrow_manager/borrow_manager_page.dart'; import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_and_fix_page.dart'; +import 'package:aku_community_manager/ui/sub_pages/decoration_manager/new_renovation/new_renovation_page.dart'; import 'package:aku_community_manager/ui/sub_pages/items_outdoor/items_outdoor_page.dart'; import 'package:aku_community_manager/ui/sub_pages/visitor_manager/visitor_manager_page.dart'; import 'package:aku_community_manager/ui/tool_pages/warning/warning_page.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_back_button.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_material_button.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:flutter/material.dart'; +// Package imports: +import 'package:get/get.dart'; +import 'package:provider/provider.dart'; class AppApplication { String name; String assetPath; dynamic page; + AppApplication( this.name, this.assetPath, @@ -100,6 +100,10 @@ class _ApplicationPageState extends State if (UserTool.userProvider.infoModel!.houseKeepingAuthority != HKAUTH.HIDE) AppApplication( '家政服务', R.ASSETS_HOME_HOUSE_KEEPING_PNG, () => HouseKeepingPage()), + if (UserTool.userProvider.infoModel!.engineeringRepairAuthority != + ERAUTH.HIDE) + AppApplication( + '工程维修', R.ASSETS_HOME_IC_SERVICE_PNG, () => EngineerRepairPage()), ]; @override diff --git a/lib/ui/home/home_page.dart b/lib/ui/home/home_page.dart index ba3de52..164138e 100644 --- a/lib/ui/home/home_page.dart +++ b/lib/ui/home/home_page.dart @@ -1,23 +1,6 @@ // Flutter imports: import 'dart:async'; -import 'package:aku_community_manager/provider/message_provider.dart'; -import 'package:aku_community_manager/ui/widgets/common/aku_button.dart'; -import 'package:aku_community_manager/ui/widgets/common/aku_material_button.dart'; -import 'package:aku_community_manager/utils/websocket/web_socket_util.dart'; -import 'package:bot_toast/bot_toast.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; - -// Package imports: -import 'package:badges/badges.dart'; -import 'package:carousel_slider/carousel_slider.dart'; -import 'package:dio/dio.dart'; -import 'package:flutter_easyrefresh/easy_refresh.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart' hide Response; -import 'package:provider/provider.dart'; - // Project imports: import 'package:aku_community_manager/const/api.dart'; import 'package:aku_community_manager/const/resource.dart'; @@ -27,6 +10,7 @@ import 'package:aku_community_manager/models/manager/item_num_model.dart'; import 'package:aku_community_manager/models/todo_bussiness/todo_model.dart'; import 'package:aku_community_manager/models/todo_bussiness/todo_outdoor_model.dart'; import 'package:aku_community_manager/provider/app_provider.dart'; +import 'package:aku_community_manager/provider/message_provider.dart'; import 'package:aku_community_manager/provider/user_provider.dart'; import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/tools/screen_tool.dart'; @@ -47,8 +31,22 @@ import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_fix import 'package:aku_community_manager/ui/sub_pages/visitor_manager/visitor_manager_page.dart'; import 'package:aku_community_manager/ui/tool_pages/warning/warning_page.dart'; import 'package:aku_community_manager/ui/widgets/app_widgets/aku_avatar.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_button.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_material_button.dart'; import 'package:aku_community_manager/utils/network/base_list_model.dart'; import 'package:aku_community_manager/utils/network/net_util.dart'; +import 'package:aku_community_manager/utils/websocket/web_socket_util.dart'; +// Package imports: +import 'package:badges/badges.dart'; +import 'package:bot_toast/bot_toast.dart'; +import 'package:carousel_slider/carousel_slider.dart'; +import 'package:dio/dio.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart' hide Response; +import 'package:provider/provider.dart'; class HomePage extends StatefulWidget { HomePage({ diff --git a/lib/ui/manage_pages/engineer_repair/add_engineer_repair_page.dart b/lib/ui/manage_pages/engineer_repair/add_engineer_repair_page.dart new file mode 100644 index 0000000..419dc22 --- /dev/null +++ b/lib/ui/manage_pages/engineer_repair/add_engineer_repair_page.dart @@ -0,0 +1,194 @@ +import 'dart:io'; + +import 'package:aku_community_manager/const/api.dart'; +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/ui/manage_pages/engineer_repair/engineer_repair_func.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:aku_community_manager/ui/widgets/inner/aku_bottom_button.dart'; +import 'package:aku_community_manager/utils/network/net_util.dart'; +import 'package:bot_toast/bot_toast.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:power_logger/power_logger.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class AddEngineerRepairPage extends StatefulWidget { + const AddEngineerRepairPage({Key? key}) : super(key: key); + + @override + _AddEngineerRepairPageState createState() => _AddEngineerRepairPageState(); +} + +class _AddEngineerRepairPageState extends State { + int _serviceType = 1; + List _photos = []; + String _area = ''; + String _detail = ''; + + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '工程报修', + backgroundColor: Colors.white, + body: ListView( + padding: EdgeInsets.symmetric(vertical: 32.w, horizontal: 32.w), + children: [ + '报修区域'.text.size(28.sp).color(kTextSubColor).make(), + 55.w.heightBox, + Row( + children: [ + Image.asset( + R.ASSETS_MANAGE_ESTATE_PNG, + width: 60.w, + height: 60.w, + ), + 36.w.widthBox, + '${S.of(context)!.tempPlotName}'.text.size(28.sp).make(), + ], + ), + 24.w.heightBox, + Container( + width: 686.w, + height: 87.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.w), + border: Border.all( + width: 2.w, + color: Color(0xFFE8E8E8), + ), + ), + child: TextField( + autofocus: false, + inputFormatters: [LengthLimitingTextInputFormatter(12)], + onChanged: (value) { + setState(() { + _area = value; + }); + }, + decoration: InputDecoration( + hintText: '请填写需要维修的区域,不超过12个字', + hintStyle: TextStyle( + fontSize: 28.sp, + color: kTextSubColor, + ), + contentPadding: + EdgeInsets.symmetric(vertical: 24.w, horizontal: 24.w), + border: InputBorder.none, + isDense: true, + ), + ), + ), + 40.w.heightBox, + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + '请选择服务类型'.text.color(kTextPrimaryColor).size(32.sp).make() + ], + ), + 32.w.heightBox, + Row( + children: [ + AkuSingleCheckButton( + text: '工程维修', + value: 1, + gropValue: _serviceType, + onPressed: () {}, + ), + 80.w.widthBox, + // AkuSingleCheckButton( + // text: '异常', + // value: 1, + // gropValue: 1, + // onPressed: () { + // }, + // ), + ], + ), + 36.w.heightBox, + '请输入报修内容'.text.size(28.sp).color(kTextPrimaryColor).make(), + 36.w.heightBox, + Container( + width: 686.w, + height: 300.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.w), + border: Border.all( + width: 2.w, + color: Color(0xFFE8E8E8), + ), + ), + child: TextField( + minLines: 5, + maxLines: 10, + autofocus: false, + onChanged: (value) { + setState(() { + _detail = value; + }); + }, + decoration: InputDecoration( + hintText: '请简要描述一下你要告知我的事情,以便于我们更好地处理…', + hintStyle: TextStyle( + fontSize: 28.sp, + color: kTextSubColor, + ), + contentPadding: + EdgeInsets.symmetric(vertical: 16.w, horizontal: 24.w), + border: InputBorder.none, + isDense: true, + ), + ), + ), + ], + ).box.make(), + 36.w.heightBox, + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + '添加照片信息'.text.color(kTextPrimaryColor).size(32.sp).make() + ], + ), + 32.w.heightBox, + AkuPickImageWidget( + onChanged: (files) { + _photos = files; + setState(() {}); + }, + ) + ], + ).box.make(), + ], + ), + bottom: AkuBottomButton( + title: '确认提交', + onTap: () async { + Function cancel = BotToast.showLoading(); + List urls = []; + try { + urls = await NetUtil().uploadFiles( + _photos, + API.upload.uploadEngineerRepair, + ); + } catch (e) { + LoggerData.addData(e.toString()); + } + var result = await EngineerRepairFunc.addEngineerRepair( + _area, _serviceType, _detail, urls); + if (result) { + Get.back(); + } + cancel(); + }, + ), + ); + } +} diff --git a/lib/ui/manage_pages/engineer_repair/engineer_repair_card.dart b/lib/ui/manage_pages/engineer_repair/engineer_repair_card.dart new file mode 100644 index 0000000..74f3854 --- /dev/null +++ b/lib/ui/manage_pages/engineer_repair/engineer_repair_card.dart @@ -0,0 +1,275 @@ +import 'package:aku_community_manager/const/api.dart'; +import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_list_model.dart'; +import 'package:aku_community_manager/models/user/user_info_model.dart'; +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/tools/user_tool.dart'; +import 'package:aku_community_manager/ui/manage_pages/engineer_repair/engineer_repair_map.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_material_button.dart'; +import 'package:aku_community_manager/ui/widgets/inner/aku_chip_box.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class EngineerRepairCard extends StatelessWidget { + final EngineerRepairListModel model; + final VoidCallback callRefresh; + + const EngineerRepairCard( + {Key? key, required this.model, required this.callRefresh}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: () async { + callRefresh(); + }, + child: Container( + padding: EdgeInsets.all(24.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Row( + children: [ + AkuChipBox(title: '公区维修'), + 16.w.widthBox, + Expanded( + child: Text( + model.createDate, + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 22.sp, + ), + ), + ), + Text( + '${ERMap.statusString(model.status)}', + style: TextStyle( + color: Colors.red, + ), + ), + ], + ), + 24.w.heightBox, + Text( + model.reportDetail, + overflow: TextOverflow.visible, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + fontWeight: FontWeight.bold, + ), + ), + 16.w.heightBox, + _buildImgs(), + _getBottomCard(), + ], + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.w), + ), + ), + ); + } + + _buildImgs() { + return Container( + height: 168.w, + child: ListView.builder( + scrollDirection: Axis.horizontal, + itemBuilder: (context, index) { + var imgObj = model.imgUrls[index].url; + return Container( + margin: EdgeInsets.symmetric(horizontal: 8.w), + height: 168.w, + width: 168.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4.w), + ), + clipBehavior: Clip.antiAlias, + child: FadeInImage.assetNetwork( + placeholder: R.ASSETS_PLACEHOLDER_WEBP, + image: API.image(imgObj ?? '')), + ); + }, + itemCount: model.imgUrls.length, + ), + ); + } + + _getBottomCard() { + return Column( + children: [ + Divider(height: 48.w), + Align( + alignment: Alignment.centerRight, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: _getButtons())), + ], + ); + } + + _getButtons() { + switch (model.status) { + case 1: + return [ + AkuMaterialButton( + height: 64.w, + onPressed: () async { + callRefresh(); + }, + radius: 4, + color: AppStyle.primaryColor, + padding: EdgeInsets.symmetric(horizontal: 24.w), + child: Text( + (UserTool.userProvider.infoModel!.engineeringRepairAuthority == + ERAUTH.SENDTOCOMPANY + ? '分派单位' + : '查看详情'), + style: TextStyle( + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + fontSize: 28.sp, + height: 40 / 28, + ), + ), + ), + ]; + case 2: + return [ + AkuMaterialButton( + height: 64.w, + onPressed: () async { + callRefresh(); + }, + radius: 4, + color: AppStyle.primaryColor, + padding: EdgeInsets.symmetric(horizontal: 24.w), + child: Text( + (UserTool.userProvider.infoModel!.engineeringRepairAuthority == + ERAUTH.SENDTOPERSON + ? '指派人员' + : '查看详情'), + style: TextStyle( + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + fontSize: 28.sp, + height: 40 / 28, + ), + ), + ), + ]; + case 3: + return [ + UserTool.userProvider.infoModel!.engineeringRepairAuthority == + ERAUTH.PICK + ? AkuMaterialButton( + height: 64.w, + onPressed: () async { + callRefresh(); + }, + radius: 4, + color: AppStyle.primaryColor, + padding: EdgeInsets.symmetric(horizontal: 24.w), + child: Text( + ('立即接单'), + style: TextStyle( + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + fontSize: 28.sp, + height: 40 / 28, + ), + ), + ) + : SizedBox(), + 12.w.widthBox, + AkuMaterialButton( + height: 64.w, + onPressed: () async { + callRefresh(); + }, + radius: 4, + color: AppStyle.primaryColor, + padding: EdgeInsets.symmetric(horizontal: 24.w), + child: Text( + ('查看详情'), + style: TextStyle( + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + fontSize: 28.sp, + height: 40 / 28, + ), + ), + ), + ]; + case 4: + return [ + AkuMaterialButton( + height: 64.w, + onPressed: () async { + callRefresh(); + }, + radius: 4, + color: AppStyle.primaryColor, + padding: EdgeInsets.symmetric(horizontal: 24.w), + child: Text( + ('汇报进度'), + style: TextStyle( + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + fontSize: 28.sp, + height: 40 / 28, + ), + ), + ), + ];case 5: + case 6: + return [ + AkuMaterialButton( + height: 64.w, + onPressed: () async { + callRefresh(); + }, + radius: 4, + color: AppStyle.primaryColor, + padding: EdgeInsets.symmetric(horizontal: 24.w), + child: Text( + ('验收记录'), + style: TextStyle( + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + fontSize: 28.sp, + height: 40 / 28, + ), + ), + ), + ]; + case 7: + return [ + AkuMaterialButton( + height: 64.w, + onPressed: () async { + callRefresh(); + }, + radius: 4, + color: AppStyle.primaryColor, + padding: EdgeInsets.symmetric(horizontal: 24.w), + child: Text( + ('查看详情'), + style: TextStyle( + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + fontSize: 28.sp, + height: 40 / 28, + ), + ), + ), + ]; + default: + return []; + } + } +} diff --git a/lib/ui/manage_pages/engineer_repair/engineer_repair_func.dart b/lib/ui/manage_pages/engineer_repair/engineer_repair_func.dart new file mode 100644 index 0000000..d92ebdb --- /dev/null +++ b/lib/ui/manage_pages/engineer_repair/engineer_repair_func.dart @@ -0,0 +1,16 @@ +import 'package:aku_community_manager/const/api.dart'; +import 'package:aku_community_manager/utils/network/net_util.dart'; + +class EngineerRepairFunc { + static Future addEngineerRepair( + String area, int type, String reportDetail, List urls) async { + var model = + await NetUtil().post(API.engineerRepair.engineerRepairInsert, params: { + 'repairArea': area, + 'type': type, + 'reportDetail': reportDetail, + 'fileUrls': urls, + }); + return model.status ?? false; + } +} diff --git a/lib/ui/manage_pages/engineer_repair/engineer_repair_map.dart b/lib/ui/manage_pages/engineer_repair/engineer_repair_map.dart new file mode 100644 index 0000000..12f01b1 --- /dev/null +++ b/lib/ui/manage_pages/engineer_repair/engineer_repair_map.dart @@ -0,0 +1,26 @@ +class ERMap { + static statusString(int status) { + switch (status) { + case 1: + return '待派单'; + case 2: + return '待派单'; + case 3: + return '待接单'; + case 4: + return '处理中'; + case 5: + return '待验收'; + case 6: + return '验收失败'; + case 7: + return '验收成功'; + case 8: + return '已作废'; + case 9: + return '已取消'; + default: + return '未知'; + } + } +} diff --git a/lib/ui/manage_pages/engineer_repair/engineer_repair_page.dart b/lib/ui/manage_pages/engineer_repair/engineer_repair_page.dart index 6b55cff..c518798 100644 --- a/lib/ui/manage_pages/engineer_repair/engineer_repair_page.dart +++ b/lib/ui/manage_pages/engineer_repair/engineer_repair_page.dart @@ -1,10 +1,14 @@ import 'package:aku_community_manager/models/user/user_info_model.dart'; import 'package:aku_community_manager/tools/user_tool.dart'; +import 'package:aku_community_manager/ui/manage_pages/engineer_repair/add_engineer_repair_page.dart'; import 'package:aku_community_manager/ui/manage_pages/engineer_repair/engineer_repair_view.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: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:get/get.dart'; import 'package:velocity_x/velocity_x.dart'; class EngineerRepairPage extends StatefulWidget { @@ -30,10 +34,22 @@ class _EngineerRepairPageState extends State } late TabController _tabController; + List _controllers = []; + @override void initState() { super.initState(); _tabController = TabController(length: _tabs.length, vsync: this); + _tabs.forEach((element) { + _controllers.add(EasyRefreshController()); + }); + } + + @override + void dispose() { + _tabController.dispose(); + _controllers.map((e) => e.dispose()); + super.dispose(); } @override @@ -42,12 +58,27 @@ class _EngineerRepairPageState extends State title: '工程维修', appBarBottom: PreferredSize( preferredSize: Size.fromHeight(88.w), - child: AkuTabBar(controller: _tabController, tabs: _tabs), - + child: AkuTabBar( + controller: _tabController, + tabs: _tabs, + isScrollable: true, + ), ), body: TabBarView( - controller: _tabController, - children: _tabs.mapIndexed((currentValue, index) => EngineerRepairView()).toList()), + controller: _tabController, + children: _tabs + .mapIndexed((currentValue, index) => EngineerRepairView( + index: index, + controller: _controllers[index], + )) + .toList()), + bottom: AkuBottomButton( + title: '新增', + onTap: () async { + await Get.to(() => AddEngineerRepairPage()); + _controllers[_tabController.index].callRefresh(); + }, + ), ); } } diff --git a/lib/ui/manage_pages/engineer_repair/engineer_repair_view.dart b/lib/ui/manage_pages/engineer_repair/engineer_repair_view.dart index 2d02508..760f5fd 100644 --- a/lib/ui/manage_pages/engineer_repair/engineer_repair_view.dart +++ b/lib/ui/manage_pages/engineer_repair/engineer_repair_view.dart @@ -1,15 +1,74 @@ +import 'package:aku_community_manager/const/api.dart'; +import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_list_model.dart'; +import 'package:aku_community_manager/models/user/user_info_model.dart'; +import 'package:aku_community_manager/tools/user_tool.dart'; +import 'package:aku_community_manager/ui/manage_pages/engineer_repair/engineer_repair_card.dart'; +import 'package:aku_community_manager/ui/widgets/common/bee_list_view.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 EngineerRepairView extends StatefulWidget { - EngineerRepairView({Key? key}) : super(key: key); + final int index; + final EasyRefreshController controller; + EngineerRepairView({Key? key, required this.index, required this.controller}) + : super(key: key); @override _EngineerRepairViewState createState() => _EngineerRepairViewState(); } class _EngineerRepairViewState extends State { + int? get repairEngineeringStatus { + if (widget.index == 0) { + return null; + } else if (widget.index == 1) { + switch (UserTool.userProvider.infoModel!.engineeringRepairAuthority) { + case ERAUTH.SENDTOCOMPANY: + return 1; + case ERAUTH.SENDTOPERSON: + return 2; + case ERAUTH.PICK: + return 3; + case ERAUTH.HIDE: + break; + } + } else { + UserTool.userProvider.infoModel!.engineeringRepairAuthority == ERAUTH.PICK + ? widget.index + 2 + : widget.index + 1; + } + } + @override Widget build(BuildContext context) { - return ListView(); + return BeeListView( + path: API.engineerRepair.engineerRepairList, + extraParams: { + 'repairStatus': repairEngineeringStatus, + }, + controller: widget.controller, + convert: (models) { + return models.tableList! + .map((e) => EngineerRepairListModel.fromJson(e)) + .toList(); + }, + builder: (items) { + return ListView.separated( + padding: EdgeInsets.all(32.w), + itemBuilder: (context, index) { + var model = items[index]; + return EngineerRepairCard( + model: model, + callRefresh: () { + widget.controller.callRefresh(); + }); + }, + separatorBuilder: (_, __) { + return 16.w.heightBox; + }, + itemCount: items.length); + }); } }