添加 装修管理model

修改装修管理界面
对接装修管理接口
hmxc
张萌 4 years ago
parent f9c6e3be9c
commit efa0141fed

@ -128,6 +128,12 @@ class _Manage {
/// ///
String get goodsOutNotRelease => '/user/articleOut/noRelease'; String get goodsOutNotRelease => '/user/articleOut/noRelease';
///list
String get decorationList => '/user/decoration/list';
///id
String get decorationFindByld => '/user/decoration/findById';
} }
class _Upload { class _Upload {
@ -160,8 +166,10 @@ class _Upload {
class _Message { class _Message {
/// ///
String get messageCenter => '/user/message/messageCenter'; String get messageCenter => '/user/message/messageCenter';
/// ///
String get systemList => '/user/message/sysMessageList'; String get systemList => '/user/message/sysMessageList';
/// ///
String get commentList => '/user/message/sysCommentMessageList'; String get commentList => '/user/message/sysCommentMessageList';
} }

@ -0,0 +1,224 @@
class DecorationDetailModel {
TrackInspectionFBIVo trackInspectionFBIVo;
DecorationFBIVo decorationFBIVo;
List<ChecksContentVos> checksContentVos;
List<TrackRecordVos> trackRecordVos;
DecorationDetailModel(
{this.trackInspectionFBIVo,
this.decorationFBIVo,
this.checksContentVos,
this.trackRecordVos});
DecorationDetailModel.fromJson(Map<String, dynamic> json) {
trackInspectionFBIVo = json['trackInspectionFBIVo'] != null
? new TrackInspectionFBIVo.fromJson(json['trackInspectionFBIVo'])
: null;
decorationFBIVo = json['decorationFBIVo'] != null
? new DecorationFBIVo.fromJson(json['decorationFBIVo'])
: null;
if (json['checksContentVos'] != null) {
checksContentVos = new List<ChecksContentVos>();
json['checksContentVos'].forEach((v) {
checksContentVos.add(new ChecksContentVos.fromJson(v));
});
}
if (json['trackRecordVos'] != null) {
trackRecordVos = new List<TrackRecordVos>();
json['trackRecordVos'].forEach((v) {
trackRecordVos.add(new TrackRecordVos.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.trackInspectionFBIVo != null) {
data['trackInspectionFBIVo'] = this.trackInspectionFBIVo.toJson();
}
if (this.decorationFBIVo != null) {
data['decorationFBIVo'] = this.decorationFBIVo.toJson();
}
if (this.checksContentVos != null) {
data['checksContentVos'] =
this.checksContentVos.map((v) => v.toJson()).toList();
}
if (this.trackRecordVos != null) {
data['trackRecordVos'] =
this.trackRecordVos.map((v) => v.toJson()).toList();
}
return data;
}
}
class TrackInspectionFBIVo {
int id;
int trackId;
String trackName;
String startDate;
int inspectionCycle;
TrackInspectionFBIVo(
{this.id,
this.trackId,
this.trackName,
this.startDate,
this.inspectionCycle});
TrackInspectionFBIVo.fromJson(Map<String, dynamic> json) {
id = json['id'];
trackId = json['trackId'];
trackName = json['trackName'];
startDate = json['startDate'];
inspectionCycle = json['inspectionCycle'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['trackId'] = this.trackId;
data['trackName'] = this.trackName;
data['startDate'] = this.startDate;
data['inspectionCycle'] = this.inspectionCycle;
return data;
}
}
class DecorationFBIVo {
int id;
String roomName;
String residentName;
String residentTel;
String constructionUnit;
String director;
String directorTel;
String actualBegin;
String expectedEnd;
int tracker;
DecorationFBIVo(
{this.id,
this.roomName,
this.residentName,
this.residentTel,
this.constructionUnit,
this.director,
this.directorTel,
this.actualBegin,
this.expectedEnd,
this.tracker});
DecorationFBIVo.fromJson(Map<String, dynamic> json) {
id = json['id'];
roomName = json['roomName'];
residentName = json['residentName'];
residentTel = json['residentTel'];
constructionUnit = json['constructionUnit'];
director = json['director'];
directorTel = json['directorTel'];
actualBegin = json['actualBegin'];
expectedEnd = json['expectedEnd'];
tracker = json['tracker'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['roomName'] = this.roomName;
data['residentName'] = this.residentName;
data['residentTel'] = this.residentTel;
data['constructionUnit'] = this.constructionUnit;
data['director'] = this.director;
data['directorTel'] = this.directorTel;
data['actualBegin'] = this.actualBegin;
data['expectedEnd'] = this.expectedEnd;
data['tracker'] = this.tracker;
return data;
}
}
class ChecksContentVos {
int id;
String name;
ChecksContentVos({this.id, this.name});
ChecksContentVos.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
return data;
}
}
class TrackRecordVos {
int id;
String trackDate;
int type;
String description;
int result;
List<RecordDetailVoList> recordDetailVoList;
TrackRecordVos(
{this.id,
this.trackDate,
this.type,
this.description,
this.result,
this.recordDetailVoList});
TrackRecordVos.fromJson(Map<String, dynamic> json) {
id = json['id'];
trackDate = json['trackDate'];
type = json['type'];
description = json['description'];
result = json['result'];
if (json['recordDetailVoList'] != null) {
recordDetailVoList = new List<RecordDetailVoList>();
json['recordDetailVoList'].forEach((v) {
recordDetailVoList.add(new RecordDetailVoList.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['trackDate'] = this.trackDate;
data['type'] = this.type;
data['description'] = this.description;
data['result'] = this.result;
if (this.recordDetailVoList != null) {
data['recordDetailVoList'] =
this.recordDetailVoList.map((v) => v.toJson()).toList();
}
return data;
}
}
class RecordDetailVoList {
int id;
String checksContent;
int isQualified;
RecordDetailVoList({this.id, this.checksContent, this.isQualified});
RecordDetailVoList.fromJson(Map<String, dynamic> json) {
id = json['id'];
checksContent = json['checksContent'];
isQualified = json['isQualified'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['checksContent'] = this.checksContent;
data['isQualified'] = this.isQualified;
return data;
}
}

@ -0,0 +1,40 @@
class DecorationListModel {
int id;
String roomName;
String constructionUnit;
int operationStatus;
int status;
int tracker;
String applicationDate;
DecorationListModel(
{this.id,
this.roomName,
this.constructionUnit,
this.operationStatus,
this.status,
this.tracker,
this.applicationDate});
DecorationListModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
roomName = json['roomName'];
constructionUnit = json['constructionUnit'];
operationStatus = json['operationStatus'];
status = json['status'];
tracker = json['tracker'];
applicationDate = json['applicationDate'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['roomName'] = this.roomName;
data['constructionUnit'] = this.constructionUnit;
data['operationStatus'] = this.operationStatus;
data['status'] = this.status;
data['tracker'] = this.tracker;
data['applicationDate'] = this.applicationDate;
return data;
}
}

@ -7,6 +7,9 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
export 'package:flutter_screenutil/flutter_screenutil.dart'; export 'package:flutter_screenutil/flutter_screenutil.dart';
export 'package:aku_community_manager/const/resource.dart'; export 'package:aku_community_manager/const/resource.dart';
//
const kEstateName = '深圳华茂悦峰';
class AppStyle { class AppStyle {
// //
static const primaryColor = Color(0xFFFDCF12); static const primaryColor = Color(0xFFFDCF12);

@ -1,4 +1,5 @@
// Flutter imports: // Flutter imports:
import 'package:aku_community_manager/models/manager/decoration/decoration_list_model.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// Package imports: // Package imports:
@ -20,7 +21,7 @@ import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration
import 'package:aku_community_manager/ui/widgets/inner/aku_chip_box.dart'; import 'package:aku_community_manager/ui/widgets/inner/aku_chip_box.dart';
class DecorationManagerCard extends StatefulWidget { class DecorationManagerCard extends StatefulWidget {
final DecorationModel model; final DecorationListModel model;
DecorationManagerCard({Key key, @required this.model}) : super(key: key); DecorationManagerCard({Key key, @required this.model}) : super(key: key);
@override @override
@ -42,10 +43,8 @@ class _DecorationManagerCardState extends State<DecorationManagerCard> {
AkuChipBox(title: '装修管理'), AkuChipBox(title: '装修管理'),
AkuBox.w(16), AkuBox.w(16),
Text( Text(
DateUtil.formatDate( DateUtil.formatDateStr(widget.model.applicationDate,
widget.model.decorationDate, format: 'yyyy-MM-dd HH:mm:ss'),
format: 'yyyy-MM-dd HH:mm:ss',
),
style: TextStyle( style: TextStyle(
color: AppStyle.minorTextColor, color: AppStyle.minorTextColor,
fontSize: 22.w, fontSize: 22.w,
@ -54,42 +53,35 @@ class _DecorationManagerCardState extends State<DecorationManagerCard> {
Spacer(), Spacer(),
Text( Text(
DecorationUIUtil(context).getTagName( DecorationUIUtil(context).getTagName(
widget.model.type, widget.model.operationStatus, widget.model.status,
widget.model.statusType, tracker: widget.model.tracker),
),
style: TextStyle( style: TextStyle(
color: DecorationUIUtil(context).getTagColor( color: DecorationUIUtil(context)
widget.model.type, .getTagColor(widget.model.operationStatus),
widget.model.statusType,
),
fontSize: 24.w, fontSize: 24.w,
), ),
), ),
], ],
), ),
AkuBox.h(24), AkuBox.h(24),
_buildTile( _buildTile(R.ASSETS_MANAGE_HOME_PNG, '小区名称', kEstateName),
R.ASSETS_MANAGE_HOME_PNG,
'小区名称',
widget.model.userHomeModel.plot,
),
AkuBox.h(12), AkuBox.h(12),
_buildTile( _buildTile(
R.ASSETS_MANAGE_ADDRESS_PNG, R.ASSETS_MANAGE_ADDRESS_PNG,
'详细地址', '详细地址',
widget.model.userHomeModel.detailAddr, widget.model.roomName,
), ),
AkuBox.h(12), AkuBox.h(12),
_buildTile( _buildTile(
R.ASSETS_MANAGE_DECORATION_PNG, R.ASSETS_MANAGE_DECORATION_PNG,
'装修公司', '装修公司',
widget.model.decorationTeamModel.name, widget.model.constructionUnit,
), ),
AkuBox.h(12), AkuBox.h(12),
_buildTile( _buildTile(
R.ASSETS_MANAGE_STATUS_PNG, R.ASSETS_MANAGE_STATUS_PNG,
'装修状态', '装修状态',
widget.model.statusTypeValue, DecorationUIUtil(context).getDecorationStatus(widget.model.status),
), ),
Divider( Divider(
height: 48.w, height: 48.w,
@ -98,7 +90,7 @@ class _DecorationManagerCardState extends State<DecorationManagerCard> {
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
child: AkuMaterialButton( child: AkuMaterialButton(
onPressed: () { onPressed: () {
Get.to(DecorationManagerDetailPage(model: widget.model)); // Get.to(DecorationManagerDetailPage(model: widget.model));
}, },
height: 64.w, height: 64.w,
minWidth: 160.w, minWidth: 160.w,

@ -111,15 +111,9 @@ class _DecorationManagerDetailStatePage
title: '装修信息', title: '装修信息',
spacing: 24, spacing: 24,
suffix: Text( suffix: Text(
DecorationUIUtil(context).getTagName( DecorationUIUtil(context).getTagName(1, 2),
widget.model.type,
widget.model.statusType,
),
style: TextStyle( style: TextStyle(
color: DecorationUIUtil(context).getTagColor( color: DecorationUIUtil(context).getTagColor(1),
widget.model.type,
widget.model.statusType,
),
fontSize: 24.w, fontSize: 24.w,
), ),
), ),

@ -1,5 +1,9 @@
// Flutter imports: // Flutter imports:
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/decoration/decoration_list_model.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';
// Package imports: // Package imports:
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -24,21 +28,17 @@ class DecorationManagerPage extends StatefulWidget {
class _DecorationManagerPageState extends State<DecorationManagerPage> class _DecorationManagerPageState extends State<DecorationManagerPage>
with TickerProviderStateMixin { with TickerProviderStateMixin {
TabController _tabController; TabController _tabController;
EasyRefreshController _refreshController;
USER_ROLE get role => USER_ROLE get role =>
Provider.of<UserProvider>(context, listen: false).userInfoModel.role; Provider.of<UserProvider>(context, listen: false).userInfoModel.role;
List<String> get tabs { List<String> get tabs {
switch (role) { final userProvider = Provider.of<UserProvider>(context, listen: false);
case USER_ROLE.MANAGER: if (userProvider?.infoModel?.canSendTicket != null &&
return ['待指派', '已指派', '已执行', '全部']; userProvider.infoModel.canSendTicket) {
break; return ['待指派', '已指派', '已执行', '全部'];
} else {
case USER_ROLE.PROPERTY: return ['待执行', '已执行', '全部'];
return ['待执行', '已执行', '全部'];
break;
default:
return ['装修中', '装修完成', '全部'];
break;
} }
} }
@ -47,6 +47,13 @@ class _DecorationManagerPageState extends State<DecorationManagerPage>
super.initState(); super.initState();
_tabController = TabController(length: tabs.length, vsync: this); _tabController = TabController(length: tabs.length, vsync: this);
_refreshController = EasyRefreshController();
}
@override
void dispose() {
_refreshController?.dispose();
super.dispose();
} }
@override @override
@ -68,41 +75,59 @@ class _DecorationManagerPageState extends State<DecorationManagerPage>
} }
List<Widget> _getViews() { List<Widget> _getViews() {
switch (role) { final userProvider = Provider.of<UserProvider>(context);
case USER_ROLE.MANAGER: if (userProvider?.infoModel?.canSendTicket != null &&
return [ userProvider.infoModel.canSendTicket) {
_getSingleListView( return [...List.generate(4, (index) => _getSingleListView(index))];
DecorationData.getModels(DecorationType.WAIT_HAND_OUT)), } else {
_getSingleListView(DecorationData.getModels(DecorationType.HAND_OUT)), return [...List.generate(3, (index) => _getSingleListView(index))];
_getSingleListView(DecorationData.getModels(DecorationType.DONE)),
_getSingleListView(DecorationData.allModels),
];
break;
case USER_ROLE.PROPERTY:
return [
_getSingleListView(DecorationData.getModels(DecorationType.HAND_OUT)),
_getSingleListView(DecorationData.getModels(DecorationType.DONE)),
_getSingleListView(DecorationData.allPropertyModels),
];
default:
return [
_getSingleListView(
DecorationData.getTypeModels(DecorationStatusType.PROGRESS)),
_getSingleListView(
DecorationData.getTypeModels(DecorationStatusType.DONE)),
_getSingleListView(DecorationData.allPropertyModels),
];
break;
} }
// switch (role) {
// case USER_ROLE.MANAGER:
// return [
// _getSingleListView(
// DecorationData.getModels(DecorationType.WAIT_HAND_OUT)),
// _getSingleListView(DecorationData.getModels(DecorationType.HAND_OUT)),
// _getSingleListView(DecorationData.getModels(DecorationType.DONE)),
// _getSingleListView(DecorationData.allModels),
// ];
// break;
// case USER_ROLE.PROPERTY:
// return [
// _getSingleListView(DecorationData.getModels(DecorationType.HAND_OUT)),
// _getSingleListView(DecorationData.getModels(DecorationType.DONE)),
// _getSingleListView(DecorationData.allPropertyModels),
// ];
// default:
// return [
// _getSingleListView(
// DecorationData.getTypeModels(DecorationStatusType.PROGRESS)),
// _getSingleListView(
// DecorationData.getTypeModels(DecorationStatusType.DONE)),
// _getSingleListView(DecorationData.allPropertyModels),
// ];
// break;
// }
} }
_getSingleListView(List<DecorationModel> models) { _getSingleListView(int index) {
return ListView.builder( return BeeListView(
itemBuilder: (context, index) { extraParams: {'operationStatus': index},
return DecorationManagerCard(model: models[index]); path: API.manage.decorationList,
}, controller: _refreshController,
itemCount: models.length, convert: (models) {
padding: EdgeInsets.symmetric(horizontal: 32.w), return models.tableList
); .map((e) => DecorationListModel.fromJson(e))
.toList();
},
builder: (items) {
return ListView.builder(
itemBuilder: (context, index) {
return DecorationManagerCard(model: items[index]);
},
itemCount: items.length,
padding: EdgeInsets.symmetric(horizontal: 32.w),
);
});
} }
} }

@ -12,52 +12,109 @@ import 'package:aku_community_manager/style/app_style.dart';
class DecorationUIUtil { class DecorationUIUtil {
BuildContext context; BuildContext context;
USER_ROLE get role => UserProvider get userProvider =>
Provider.of<UserProvider>(context, listen: false).userInfoModel.role; Provider.of<UserProvider>(context, listen: false);
DecorationUIUtil(this.context); DecorationUIUtil(this.context);
String getTagName(DecorationType type, DecorationStatusType statusType) { String getTagName(int operationStatus, int status, {int tracker}) {
Map<DecorationType, String> managerMap = { // Map<DecorationType, String> managerMap = {
DecorationType.WAIT_HAND_OUT: '待指派', // DecorationType.WAIT_HAND_OUT: '待指派',
DecorationType.HAND_OUT: '已指派', // DecorationType.HAND_OUT: '已指派',
DecorationType.DONE: '已执行', // DecorationType.DONE: '已执行',
}; // };
Map<DecorationType, String> fixerMap = { // Map<DecorationType, String> fixerMap = {
DecorationType.HAND_OUT: '待执行', // DecorationType.HAND_OUT: '待执行',
DecorationType.DONE: '已执行', // DecorationType.DONE: '已执行',
}; // };
Map<DecorationStatusType, String> defaultMap = { // Map<DecorationStatusType, String> defaultMap = {
DecorationStatusType.DONE: '装修完成', // DecorationStatusType.DONE: '装修完成',
DecorationStatusType.PROGRESS: '装修中', // DecorationStatusType.PROGRESS: '装修中',
}; // };
switch (role) { // switch (role) {
case USER_ROLE.MANAGER: // case USER_ROLE.MANAGER:
return managerMap[type]; // return managerMap[type];
// break;
// case USER_ROLE.PROPERTY:
// return fixerMap[type];
// break;
// default:
// return defaultMap[statusType];
// break;
// }
switch (operationStatus) {
case 1:
if (tracker == null && status > 1) {
return '待指派';
} else {
return '未知';
}
break; break;
case USER_ROLE.PROPERTY: case 2:
return fixerMap[type]; if (status < 5) {
if (userProvider?.infoModel?.canOperation != null &&
userProvider.infoModel.canOperation) {
return '已指派';
} else {
return '待执行';
}
} else {
return '未知';
}
break; break;
default: case 3:
return defaultMap[statusType]; if (status >= 5) {
return '已完成';
} else {
return '未知';
}
break; break;
default:
return '未知';
} }
} }
Color getTagColor(DecorationType type, DecorationStatusType statusType) { Color getTagColor(int operationStatus) {
if (role == USER_ROLE.MANAGER || role == USER_ROLE.PROPERTY) { // if (role == USER_ROLE.MANAGER || role == USER_ROLE.PROPERTY) {
if (type == DecorationType.WAIT_HAND_OUT || // if (type == DecorationType.WAIT_HAND_OUT ||
type == DecorationType.HAND_OUT) { // type == DecorationType.HAND_OUT) {
// return Color(0xFFFF4501);
// } else
// return AppStyle.minorTextColor;
// } else {
// if (statusType == DecorationStatusType.PROGRESS) {
// return Color(0xFFFF4501);
// } else
// return Color(0xFF32B814);
// }
// }
switch (operationStatus) {
case 1:
case 2:
return Color(0xFFFF4501); return Color(0xFFFF4501);
} else case 3:
return AppStyle.minorTextColor;
} else {
if (statusType == DecorationStatusType.PROGRESS) {
return Color(0xFFFF4501);
} else
return Color(0xFF32B814); return Color(0xFF32B814);
default:
return Color(0xFFFF4501);
} }
} }
Map<int, String> stautsToString = {
-1: '申请中',
-2: '申请未通过',
-3: '申请通过',
1: '已付押金',
2: '装修中',
3: '完工检查申请中',
4: '完工检查不通过',
5: '完工检查通过',
6: '申请退款中',
7: '装修结束',
8: '已作废',
};
String getDecorationStatus(int status) {
return stautsToString[status];
}
} }

@ -0,0 +1,15 @@
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/decoration/decoration_detail_model.dart';
import 'package:aku_community_manager/utils/network/net_util.dart';
import 'package:dio/dio.dart';
class ManageFunc {
static Future<DecorationDetailModel> getDetcorationDetail(int id) async {
Response response = await NetUtil()
.dio
.get(API.manage.decorationFindByld, queryParameters: {
'decorationId': id,
});
return DecorationDetailModel.fromJson(response.data);
}
}
Loading…
Cancel
Save