对接工程维修列表

完成工程维修列表页
新增 添加工程维修页
hmxc
张萌 3 years ago
parent 8d5a88d5bb
commit 9e5b915a93

1
.gitignore vendored

@ -41,3 +41,4 @@ app.*.symbols
app.*.map.json app.*.map.json
resource.dart resource.dart
flutter_sdk flutter_sdk
local.properties

@ -1,3 +1,2 @@
analyzer: analyzer:
errors: errors:
unused_import: error

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

@ -11,6 +11,7 @@ class API {
static String get resource => '$host/static'; static String get resource => '$host/static';
static String image(String path) => '$resource$path'; static String image(String path) => '$resource$path';
static String file(String path) => '$resource$path'; static String file(String path) => '$resource$path';
static const int networkTimeOut = 10000; static const int networkTimeOut = 10000;
@ -19,7 +20,7 @@ class API {
static _Manage manage = _Manage(); static _Manage manage = _Manage();
static _Upload upload = _Upload(); static _Upload upload = _Upload();
static _Message message = _Message(); static _Message message = _Message();
static _EngineerRepair engineerReapair = _EngineerRepair(); static _EngineerRepair engineerRepair = _EngineerRepair();
} }
class _Auth { class _Auth {
@ -353,6 +354,10 @@ class _Upload {
/// ///
String get uploadHandlerPhoto => String get uploadHandlerPhoto =>
'/user/upload/uploadHousekeepingServiceHandlerPhone'; '/user/upload/uploadHousekeepingServiceHandlerPhone';
///
String get uploadEngineerRepair =>
'/user/upload/uploadButlerAppEngineeringRepair';
} }
class _Message { class _Message {

@ -2,5 +2,8 @@ part of 'api.dart';
class _EngineerRepair { class _EngineerRepair {
///app ///app
String get engineerRepair => '/user/repairEngineering/list'; String get engineerRepairList => '/user/repairEngineering/list';
///app
String get engineerRepairInsert => '/user/repairEngineering/insert';
} }

@ -1,43 +1,43 @@
// Flutter imports: // 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: // Project imports:
import 'package:aku_community_manager/const/resource.dart'; 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/provider/app_provider.dart';
import 'package:aku_community_manager/style/app_style.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/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/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/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/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/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/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/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/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/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/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/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/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/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/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_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: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 { class AppApplication {
String name; String name;
String assetPath; String assetPath;
dynamic page; dynamic page;
AppApplication( AppApplication(
this.name, this.name,
this.assetPath, this.assetPath,
@ -100,6 +100,10 @@ class _ApplicationPageState extends State<ApplicationPage>
if (UserTool.userProvider.infoModel!.houseKeepingAuthority != HKAUTH.HIDE) if (UserTool.userProvider.infoModel!.houseKeepingAuthority != HKAUTH.HIDE)
AppApplication( AppApplication(
'家政服务', R.ASSETS_HOME_HOUSE_KEEPING_PNG, () => HouseKeepingPage()), '家政服务', R.ASSETS_HOME_HOUSE_KEEPING_PNG, () => HouseKeepingPage()),
if (UserTool.userProvider.infoModel!.engineeringRepairAuthority !=
ERAUTH.HIDE)
AppApplication(
'工程维修', R.ASSETS_HOME_IC_SERVICE_PNG, () => EngineerRepairPage()),
]; ];
@override @override

@ -1,23 +1,6 @@
// Flutter imports: // Flutter imports:
import 'dart:async'; 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: // Project imports:
import 'package:aku_community_manager/const/api.dart'; import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/const/resource.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_model.dart';
import 'package:aku_community_manager/models/todo_bussiness/todo_outdoor_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/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/provider/user_provider.dart';
import 'package:aku_community_manager/style/app_style.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/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/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/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/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/base_list_model.dart';
import 'package:aku_community_manager/utils/network/net_util.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 { class HomePage extends StatefulWidget {
HomePage({ HomePage({

@ -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<AddEngineerRepairPage> {
int _serviceType = 1;
List<File> _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<String> 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();
},
),
);
}
}

@ -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 [];
}
}
}

@ -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<String> urls) async {
var model =
await NetUtil().post(API.engineerRepair.engineerRepairInsert, params: {
'repairArea': area,
'type': type,
'reportDetail': reportDetail,
'fileUrls': urls,
});
return model.status ?? false;
}
}

@ -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 '未知';
}
}
}

@ -1,10 +1,14 @@
import 'package:aku_community_manager/models/user/user_info_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/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/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/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:aku_community_manager/ui/widgets/inner/aku_tab_bar.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
class EngineerRepairPage extends StatefulWidget { class EngineerRepairPage extends StatefulWidget {
@ -30,10 +34,22 @@ class _EngineerRepairPageState extends State<EngineerRepairPage>
} }
late TabController _tabController; late TabController _tabController;
List<EasyRefreshController> _controllers = [];
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_tabController = TabController(length: _tabs.length, vsync: this); _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 @override
@ -42,12 +58,27 @@ class _EngineerRepairPageState extends State<EngineerRepairPage>
title: '工程维修', title: '工程维修',
appBarBottom: PreferredSize( appBarBottom: PreferredSize(
preferredSize: Size.fromHeight(88.w), preferredSize: Size.fromHeight(88.w),
child: AkuTabBar(controller: _tabController, tabs: _tabs), child: AkuTabBar(
controller: _tabController,
tabs: _tabs,
isScrollable: true,
),
), ),
body: TabBarView( body: TabBarView(
controller: _tabController, controller: _tabController,
children: _tabs.mapIndexed((currentValue, index) => EngineerRepairView()).toList()), 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();
},
),
); );
} }
} }

@ -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/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 { 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 @override
_EngineerRepairViewState createState() => _EngineerRepairViewState(); _EngineerRepairViewState createState() => _EngineerRepairViewState();
} }
class _EngineerRepairViewState extends State<EngineerRepairView> { class _EngineerRepairViewState extends State<EngineerRepairView> {
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 @override
Widget build(BuildContext context) { 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);
});
} }
} }

Loading…
Cancel
Save