对接:报事报修:查询所有的报事报修信息(包含条件搜索)

修改报事报修页面
hmxc
张萌 4 years ago
parent 8314325dd2
commit fdf33b205b

@ -57,4 +57,7 @@ class _Manage {
///访app访
String get visitorList => '/user/visitor/list';
///()
String get repairList => '/user/repair/list';
}

@ -0,0 +1,75 @@
class BussinessAndFixModel {
int id;
int dispatchId;
String reportDetail;
String repairDate;
int status;
List<ImgUrls> imgUrls;
int type;
BussinessAndFixModel(
{this.id,
this.dispatchId,
this.reportDetail,
this.repairDate,
this.status,
this.imgUrls,
this.type});
BussinessAndFixModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
dispatchId = json['dispatchId'];
reportDetail = json['reportDetail'];
repairDate = json['repairDate'];
status = json['status'];
if (json['imgUrls'] != null) {
imgUrls = new List<ImgUrls>();
json['imgUrls'].forEach((v) {
imgUrls.add(new ImgUrls.fromJson(v));
});
}
type = json['type'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['dispatchId'] = this.dispatchId;
data['reportDetail'] = this.reportDetail;
data['repairDate'] = this.repairDate;
data['status'] = this.status;
if (this.imgUrls != null) {
data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList();
}
data['type'] = this.type;
return data;
}
}
class ImgUrls {
String url;
String size;
int longs;
int paragraph;
int sort;
ImgUrls({this.url, this.size, this.longs, this.paragraph, this.sort});
ImgUrls.fromJson(Map<String, dynamic> json) {
url = json['url'];
size = json['size'];
longs = json['longs'];
paragraph = json['paragraph'];
sort = json['sort'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['url'] = this.url;
data['size'] = this.size;
data['longs'] = this.longs;
data['paragraph'] = this.paragraph;
data['sort'] = this.sort;
return data;
}
}

@ -100,7 +100,7 @@ class UserProvider extends ChangeNotifier {
///
setTel(String tel){
_infoModel.tel=tel;
_profileModel.tel=tel;
notifyListeners();
}
}

@ -0,0 +1,60 @@
class AkuMap {
static String fixStatus(bool canOpention, bool canPickup, int status) {
if (canOpention) {
switch (status) {
case 1:
return '待派单';
break;
case 2:
return '已派单';
case 3:
return '处理中';
case 4:
case 5:
case 6:
return '已处理';
case 7:
return '已作废';
case 8:
return '已取消';
default:
return '';
}
} else if (canPickup) {
switch (status) {
case 2:
return '已派单';
case 3:
return '处理中';
case 4:
case 5:
case 6:
return '已处理';
case 7:
return '已作废';
case 8:
return '已取消';
default:
return '';
}
} else {
switch (status) {
case 1:
case 2:
return '未处理';
case 3:
return '处理中';
case 4:
case 5:
case 6:
return '已处理';
case 7:
return '已作废';
case 8:
return '已取消';
default:
return '';
}
}
}
}

@ -1,10 +1,10 @@
// Flutter imports:
import 'package:aku_community_manager/models/manager/bussiness_and_fix_model.dart';
import 'package:flutter/material.dart';
// Project imports:
import 'package:aku_community_manager/mock_models/all_model.dart';
import 'package:aku_community_manager/mock_models/decoration/decoration_model.dart';
import 'package:aku_community_manager/mock_models/fix/fix_model.dart';
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/screen_tool.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_fix_card.dart';
@ -72,7 +72,7 @@ class _BusinessPageState extends State<BusinessPage>
final item = list[index];
if (item is DecorationModel) {
return DecorationManagerCard(model: item);
} else if (item is FixModel) {
} else if (item is BussinessAndFixModel) {
return BusinessFixCard(model: item);
} else
return SizedBox();

@ -1,4 +1,5 @@
// Flutter imports:
import 'package:aku_community_manager/models/manager/bussiness_and_fix_model.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -14,7 +15,6 @@ import 'package:provider/provider.dart';
import 'package:aku_community_manager/const/resource.dart';
import 'package:aku_community_manager/mock_models/all_model.dart';
import 'package:aku_community_manager/mock_models/decoration/decoration_model.dart';
import 'package:aku_community_manager/mock_models/fix/fix_model.dart';
import 'package:aku_community_manager/provider/anouncement_provider.dart';
import 'package:aku_community_manager/provider/app_provider.dart';
import 'package:aku_community_manager/provider/user_provider.dart';
@ -504,7 +504,7 @@ class _HomePageState extends State<HomePage> {
final item = AllModel(context).waitThings[index];
if (item is DecorationModel) {
return DecorationManagerCard(model: item);
} else if (item is FixModel) {
} else if (item is BussinessAndFixModel) {
return BusinessFixCard(
model: item, homeDisplay: true);
} else

@ -1,16 +1,13 @@
// Flutter imports:
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/bussiness_and_fix_view.dart';
import 'package:flutter/material.dart';
// Package imports:
import 'package:provider/provider.dart';
// Project imports:
import 'package:aku_community_manager/mock_models/fix/fix_model.dart';
import 'package:aku_community_manager/mock_models/users/user_info_model.dart';
import 'package:aku_community_manager/provider/fix_provider.dart';
import 'package:aku_community_manager/provider/user_provider.dart';
import 'package:aku_community_manager/tools/screen_tool.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_fix_card.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_community_manager/ui/widgets/inner/aku_tab_bar.dart';
@ -27,16 +24,21 @@ class _BusinessAndFixPageState extends State<BusinessAndFixPage>
List<String> get _tabs {
final userProvider = Provider.of<UserProvider>(context, listen: false);
switch (userProvider.userInfoModel.role) {
case USER_ROLE.MANAGER:
// switch (userProvider.userInfoModel.role) {
// case USER_ROLE.MANAGER:
// return ['待派单', '已派单', '处理中', '已处理', '全部'];
// break;
// case USER_ROLE.FIXER:
// return ['待接单', '处理中', '已处理', '全部'];
// break;
// default:
// return ['待接单', '处理中', '已处理', '全部'];
// break;
// }
if (userProvider.infoModel.canOperation) {
return ['待派单', '已派单', '处理中', '已处理', '全部'];
break;
case USER_ROLE.FIXER:
} else {
return ['待接单', '处理中', '已处理', '全部'];
break;
default:
return ['待接单', '处理中', '已处理', '全部'];
break;
}
}
@ -54,6 +56,7 @@ class _BusinessAndFixPageState extends State<BusinessAndFixPage>
@override
Widget build(BuildContext context) {
final userProvider = Provider.of<UserProvider>(context, listen: false);
return AkuScaffold(
title: '报事报修',
appBarBottom: PreferredSize(
@ -65,20 +68,28 @@ class _BusinessAndFixPageState extends State<BusinessAndFixPage>
),
body: TabBarView(
controller: _tabController,
children: _tabs.map((e) => _buildTabView(_tabs.indexOf(e))).toList(),
children: [
...userProvider.infoModel.canOperation
? [
BussinessAndFixView(
status: 1,
)
]
: [],
BussinessAndFixView(
status: 2,
),
BussinessAndFixView(
status: 3,
),
BussinessAndFixView(
status: 4,
),
BussinessAndFixView(
status: null,
),
],
),
);
}
Widget _buildTabView(int index) {
final fixProvider = Provider.of<FixProvider>(context, listen: false);
List<FixModel> models = fixProvider.getFixModel(index, context);
return ListView.builder(
padding: EdgeInsets.symmetric(horizontal: 32.w),
itemBuilder: (context, index) {
return BusinessFixCard(model: models[index]);
},
itemCount: models.length,
);
}
}

@ -1,26 +1,23 @@
// Flutter imports:
import 'package:aku_community_manager/models/manager/bussiness_and_fix_model.dart';
import 'package:aku_community_manager/tools/aku_map.dart';
import 'package:flutter/material.dart';
// Package imports:
import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:common_utils/common_utils.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
// Project imports:
import 'package:aku_community_manager/mock_models/fix/fix_model.dart';
import 'package:aku_community_manager/mock_models/users/user_info_model.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';
import 'package:aku_community_manager/tools/widget_tool.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_and_fix_detail_page.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/fix_more_time_page.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/fix_work_finish_page.dart';
import 'package:aku_community_manager/ui/widgets/inner/aku_chip_box.dart';
class BusinessFixCard extends StatefulWidget {
final FixModel model;
final BussinessAndFixModel model;
final bool homeDisplay;
BusinessFixCard({Key key, @required this.model, this.homeDisplay = false})
: super(key: key);
@ -35,36 +32,37 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
return userProvider.userInfoModel.role;
}
String get dateStart => DateUtil.formatDate(widget.model.dateStart,
String get dateStart => DateUtil.formatDateStr(widget.model.repairDate,
format: 'yyyy-MM-dd HH:mm:ss');
Widget get fixTypeWidget {
if (userRole == USER_ROLE.MANAGER) {
return Text(
FixModel.managerRoleMap[widget.model.type],
style: TextStyle(
color: widget.model.type != FIX_ENUM.DONE
? Color(0XFFFF4501)
: AppStyle.minorTextColor,
),
);
} else {
return Text(
FixModel.otherRoleMap[widget.model.type],
style: TextStyle(
color: widget.model.type != FIX_ENUM.DONE
? Color(0XFFFF4501)
: AppStyle.minorTextColor,
),
);
}
}
// Widget get fixTypeWidget {
// if (userRole == USER_ROLE.MANAGER) {
// return Text(
// FixModel.managerRoleMap[widget.model.type],
// style: TextStyle(
// color: widget.model.status > 3
// ? Color(0XFFFF4501)
// : AppStyle.minorTextColor,
// ),
// );
// } else {
// return Text(
// FixModel.otherRoleMap[widget.model.type],
// style: TextStyle(
// color: widget.model.type > 3
// ? Color(0XFFFF4501)
// : AppStyle.minorTextColor,
// ),
// );
// }
// }
@override
Widget build(BuildContext context) {
final userProvider = Provider.of<UserProvider>(context, listen: false);
return GestureDetector(
onTap: () {
Get.to(BusinessAndFixDetailPage(model: widget.model));
// Get.to(BusinessAndFixDetailPage(model: widget.model));
},
child: Container(
padding: EdgeInsets.all(24.w),
@ -85,12 +83,22 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
),
),
),
fixTypeWidget,
Text(
AkuMap.fixStatus(
userProvider.infoModel.canOperation,
userProvider.infoModel.canPickUpTicket,
widget.model.status),
style: TextStyle(
color: widget.model.status <4
? Color(0XFFFF4501)
: AppStyle.minorTextColor,
),
),
],
),
widget.homeDisplay ? AkuBox.h(12) : AkuBox.h(24),
Text(
widget.model.title,
widget.model.reportDetail,
maxLines: widget.homeDisplay ? 1 : null,
overflow: !widget.homeDisplay
? TextOverflow.visible
@ -121,21 +129,20 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
var imgObj = widget.model.imgs[index];
var imgObj = widget.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),
image: DecorationImage(
image: (imgObj is String)
? AssetImage(imgObj)
: FileImage(imgObj)),
),
clipBehavior: Clip.antiAlias,
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_PLACEHOLDER_WEBP, image: imgObj),
);
},
itemCount: widget.model.imgs.length,
itemCount: widget.model.imgUrls.length,
),
);
}
@ -143,7 +150,7 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
_buildBottomCard() {
switch (userRole) {
case USER_ROLE.FIXER:
if (widget.model.type == FIX_ENUM.DONE) return SizedBox();
if (widget.model.status > 4) return SizedBox();
return Column(
children: [
Divider(
@ -152,7 +159,7 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
Row(
children: [
Spacer(),
widget.model.type == FIX_ENUM.PROCESSING
widget.model.status == 3
? MaterialButton(
padding: EdgeInsets.zero,
height: 64.w,
@ -172,17 +179,15 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
),
),
onPressed: () {
Get.to(FixMoreTimePage(model: widget.model));
// Get.to(FixMoreTimePage(model: widget.model));
},
)
: SizedBox(),
widget.model.type == FIX_ENUM.PROCESSING
? AkuBox.w(24)
: SizedBox(),
widget.model.type == FIX_ENUM.PROCESSING
widget.model.status == 3 ? AkuBox.w(24) : SizedBox(),
widget.model.status == 3
? AkuMaterialButton(
onPressed: () {
Get.to(FixWorkFinishPage(model: widget.model));
// Get.to(FixWorkFinishPage(model: widget.model));
},
radius: 4.w,
color: AppStyle.primaryColor,
@ -197,17 +202,17 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
),
)
: SizedBox(),
widget.model.type == FIX_ENUM.WAIT_PICKUP
widget.model.status == 2
? AkuMaterialButton(
onPressed: () {
final userProvider =
Provider.of<UserProvider>(context, listen: false);
widget.model.detail.fixStatuses.add(FixStatus(
title: '${userProvider.userInfoModel.nickName}已接单',
date: DateTime.now(),
));
widget.model.type = FIX_ENUM.PROCESSING;
Get.back();
// final userProvider =
// Provider.of<UserProvider>(context, listen: false);
// widget.model.detail.fixStatuses.add(FixStatus(
// title: '${userProvider.userInfoModel.nickName}已接单',
// date: DateTime.now(),
// ));
// widget.model.type = FIX_ENUM.PROCESSING;
// Get.back();
},
radius: 4.w,
color: AppStyle.primaryColor,
@ -236,7 +241,7 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
child: AkuMaterialButton(
height: 64.w,
onPressed: () {
Get.to(BusinessAndFixDetailPage(model: widget.model));
// Get.to(BusinessAndFixDetailPage(model: widget.model));
},
radius: 4,
color: AppStyle.primaryColor,

@ -0,0 +1,50 @@
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix_model.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_fix_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:velocity_x/velocity_x.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class BussinessAndFixView extends StatefulWidget {
final int status;
BussinessAndFixView({Key key, this.status}) : super(key: key);
@override
_BussinessAndFixViewState createState() => _BussinessAndFixViewState();
}
class _BussinessAndFixViewState extends State<BussinessAndFixView>
with AutomaticKeepAliveClientMixin {
EasyRefreshController _easyRefreshController;
@override
Widget build(BuildContext context) {
super.build(context);
return BeeListView(
path: API.manage.repairList,
extraParams: {
'repairStatus': widget.status,
},
controller: _easyRefreshController,
convert: (models) {
return models.tableList
.map((e) => BussinessAndFixModel.fromJson(e))
.toList();
},
builder: (items) {
return ListView.separated(
itemBuilder: (context, index) {
return BusinessFixCard(model: items[index]);
},
separatorBuilder: (_, __) {
return 16.w.heightBox;
},
itemCount: items.length);
});
}
@override
bool get wantKeepAlive => true;
}

@ -7,7 +7,6 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
// Project imports:
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/ui/sub_pages/visitor_manager/visitor_manager_card.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_community_manager/ui/widgets/inner/aku_tab_bar.dart';
@ -39,19 +38,6 @@ class _VisitorManagerPageState extends State<VisitorManagerPage>
with TickerProviderStateMixin {
List<String> _tabs = ['全部', '未到访', '已到访', '已过期'];
List<VisitorCardsModel> _cards = [
VisitorCardsModel(
adress: '深圳华悦茂峰1幢1单元702',
name: '马泽城',
status: VisitorStatus.VISIT_DONE,
plate: '浙BA9899',
time: '2020-10-24 12:00',
),
VisitorCardsModel(
adress: '深圳华悦茂峰2幢2单元702', name: '刘揪心', status: VisitorStatus.NOT_VISIT),
VisitorCardsModel(
adress: '深圳华悦茂峰3幢3单元602', name: '张空间', status: VisitorStatus.OUTDATE),
];
TabController _tabController;
@override

Loading…
Cancel
Save