From efa0141fedb2cf6bfd92f950bbd8855a0da6fd03 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Fri, 19 Mar 2021 17:34:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E8=A3=85=E4=BF=AE?= =?UTF-8?q?=E7=AE=A1=E7=90=86model=20=E4=BF=AE=E6=94=B9=E8=A3=85=E4=BF=AE?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=95=8C=E9=9D=A2=20=E5=AF=B9=E6=8E=A5?= =?UTF-8?q?=E8=A3=85=E4=BF=AE=E7=AE=A1=E7=90=86=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/const/api.dart | 8 + .../decoration/decoration_detail_model.dart | 224 ++++++++++++++++++ .../decoration/decoration_list_model.dart | 40 ++++ lib/style/app_style.dart | 3 + .../decoration_manager_card.dart | 34 +-- .../decoration_manager_detail_page.dart | 10 +- .../decoration_manager_page.dart | 113 +++++---- .../decoration_manager/decoration_util.dart | 129 +++++++--- lib/ui/sub_pages/manage_func.dart | 15 ++ 9 files changed, 467 insertions(+), 109 deletions(-) create mode 100644 lib/models/manager/decoration/decoration_detail_model.dart create mode 100644 lib/models/manager/decoration/decoration_list_model.dart create mode 100644 lib/ui/sub_pages/manage_func.dart diff --git a/lib/const/api.dart b/lib/const/api.dart index 0e199b6..10cdd86 100644 --- a/lib/const/api.dart +++ b/lib/const/api.dart @@ -128,6 +128,12 @@ class _Manage { ///物品出户:不放行 String get goodsOutNotRelease => '/user/articleOut/noRelease'; + + ///装修管理:查询装修管理信息list列表 + String get decorationList => '/user/decoration/list'; + + ///装修管理:根据装修主键id查询装修详情 + String get decorationFindByld => '/user/decoration/findById'; } class _Upload { @@ -160,8 +166,10 @@ class _Upload { class _Message { ///消息中心 String get messageCenter => '/user/message/messageCenter'; + ///消息中心:查询所有的系统通知 String get systemList => '/user/message/sysMessageList'; + ///消息中心:查询所有的评论通知 String get commentList => '/user/message/sysCommentMessageList'; } diff --git a/lib/models/manager/decoration/decoration_detail_model.dart b/lib/models/manager/decoration/decoration_detail_model.dart new file mode 100644 index 0000000..fe024f3 --- /dev/null +++ b/lib/models/manager/decoration/decoration_detail_model.dart @@ -0,0 +1,224 @@ +class DecorationDetailModel { + TrackInspectionFBIVo trackInspectionFBIVo; + DecorationFBIVo decorationFBIVo; + List checksContentVos; + List trackRecordVos; + + DecorationDetailModel( + {this.trackInspectionFBIVo, + this.decorationFBIVo, + this.checksContentVos, + this.trackRecordVos}); + + DecorationDetailModel.fromJson(Map 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(); + json['checksContentVos'].forEach((v) { + checksContentVos.add(new ChecksContentVos.fromJson(v)); + }); + } + if (json['trackRecordVos'] != null) { + trackRecordVos = new List(); + json['trackRecordVos'].forEach((v) { + trackRecordVos.add(new TrackRecordVos.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + 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 json) { + id = json['id']; + trackId = json['trackId']; + trackName = json['trackName']; + startDate = json['startDate']; + inspectionCycle = json['inspectionCycle']; + } + + Map toJson() { + final Map data = new Map(); + 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 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 toJson() { + final Map data = new Map(); + 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 json) { + id = json['id']; + name = json['name']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + return data; + } +} + +class TrackRecordVos { + int id; + String trackDate; + int type; + String description; + int result; + List recordDetailVoList; + + TrackRecordVos( + {this.id, + this.trackDate, + this.type, + this.description, + this.result, + this.recordDetailVoList}); + + TrackRecordVos.fromJson(Map json) { + id = json['id']; + trackDate = json['trackDate']; + type = json['type']; + description = json['description']; + result = json['result']; + if (json['recordDetailVoList'] != null) { + recordDetailVoList = new List(); + json['recordDetailVoList'].forEach((v) { + recordDetailVoList.add(new RecordDetailVoList.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + 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 json) { + id = json['id']; + checksContent = json['checksContent']; + isQualified = json['isQualified']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['checksContent'] = this.checksContent; + data['isQualified'] = this.isQualified; + return data; + } +} diff --git a/lib/models/manager/decoration/decoration_list_model.dart b/lib/models/manager/decoration/decoration_list_model.dart new file mode 100644 index 0000000..0ac0118 --- /dev/null +++ b/lib/models/manager/decoration/decoration_list_model.dart @@ -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 json) { + id = json['id']; + roomName = json['roomName']; + constructionUnit = json['constructionUnit']; + operationStatus = json['operationStatus']; + status = json['status']; + tracker = json['tracker']; + applicationDate = json['applicationDate']; + } + + Map toJson() { + final Map data = new Map(); + 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; + } +} diff --git a/lib/style/app_style.dart b/lib/style/app_style.dart index d5eb2ee..c1d8355 100644 --- a/lib/style/app_style.dart +++ b/lib/style/app_style.dart @@ -7,6 +7,9 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; export 'package:flutter_screenutil/flutter_screenutil.dart'; export 'package:aku_community_manager/const/resource.dart'; +//默认小区名称 +const kEstateName = '深圳华茂悦峰'; + class AppStyle { //颜色,渐变主颜色和次级颜色 static const primaryColor = Color(0xFFFDCF12); diff --git a/lib/ui/sub_pages/decoration_manager/decoration_manager_card.dart b/lib/ui/sub_pages/decoration_manager/decoration_manager_card.dart index 407e648..0011695 100644 --- a/lib/ui/sub_pages/decoration_manager/decoration_manager_card.dart +++ b/lib/ui/sub_pages/decoration_manager/decoration_manager_card.dart @@ -1,4 +1,5 @@ // Flutter imports: +import 'package:aku_community_manager/models/manager/decoration/decoration_list_model.dart'; import 'package:flutter/material.dart'; // 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'; class DecorationManagerCard extends StatefulWidget { - final DecorationModel model; + final DecorationListModel model; DecorationManagerCard({Key key, @required this.model}) : super(key: key); @override @@ -42,10 +43,8 @@ class _DecorationManagerCardState extends State { AkuChipBox(title: '装修管理'), AkuBox.w(16), Text( - DateUtil.formatDate( - widget.model.decorationDate, - format: 'yyyy-MM-dd HH:mm:ss', - ), + DateUtil.formatDateStr(widget.model.applicationDate, + format: 'yyyy-MM-dd HH:mm:ss'), style: TextStyle( color: AppStyle.minorTextColor, fontSize: 22.w, @@ -54,42 +53,35 @@ class _DecorationManagerCardState extends State { Spacer(), Text( DecorationUIUtil(context).getTagName( - widget.model.type, - widget.model.statusType, - ), + widget.model.operationStatus, widget.model.status, + tracker: widget.model.tracker), style: TextStyle( - color: DecorationUIUtil(context).getTagColor( - widget.model.type, - widget.model.statusType, - ), + color: DecorationUIUtil(context) + .getTagColor(widget.model.operationStatus), fontSize: 24.w, ), ), ], ), AkuBox.h(24), - _buildTile( - R.ASSETS_MANAGE_HOME_PNG, - '小区名称', - widget.model.userHomeModel.plot, - ), + _buildTile(R.ASSETS_MANAGE_HOME_PNG, '小区名称', kEstateName), AkuBox.h(12), _buildTile( R.ASSETS_MANAGE_ADDRESS_PNG, '详细地址', - widget.model.userHomeModel.detailAddr, + widget.model.roomName, ), AkuBox.h(12), _buildTile( R.ASSETS_MANAGE_DECORATION_PNG, '装修公司', - widget.model.decorationTeamModel.name, + widget.model.constructionUnit, ), AkuBox.h(12), _buildTile( R.ASSETS_MANAGE_STATUS_PNG, '装修状态', - widget.model.statusTypeValue, + DecorationUIUtil(context).getDecorationStatus(widget.model.status), ), Divider( height: 48.w, @@ -98,7 +90,7 @@ class _DecorationManagerCardState extends State { alignment: Alignment.centerRight, child: AkuMaterialButton( onPressed: () { - Get.to(DecorationManagerDetailPage(model: widget.model)); + // Get.to(DecorationManagerDetailPage(model: widget.model)); }, height: 64.w, minWidth: 160.w, diff --git a/lib/ui/sub_pages/decoration_manager/decoration_manager_detail_page.dart b/lib/ui/sub_pages/decoration_manager/decoration_manager_detail_page.dart index a4531df..60f71a0 100644 --- a/lib/ui/sub_pages/decoration_manager/decoration_manager_detail_page.dart +++ b/lib/ui/sub_pages/decoration_manager/decoration_manager_detail_page.dart @@ -111,15 +111,9 @@ class _DecorationManagerDetailStatePage title: '装修信息', spacing: 24, suffix: Text( - DecorationUIUtil(context).getTagName( - widget.model.type, - widget.model.statusType, - ), + DecorationUIUtil(context).getTagName(1, 2), style: TextStyle( - color: DecorationUIUtil(context).getTagColor( - widget.model.type, - widget.model.statusType, - ), + color: DecorationUIUtil(context).getTagColor(1), fontSize: 24.w, ), ), diff --git a/lib/ui/sub_pages/decoration_manager/decoration_manager_page.dart b/lib/ui/sub_pages/decoration_manager/decoration_manager_page.dart index 23a4852..0a10fcc 100644 --- a/lib/ui/sub_pages/decoration_manager/decoration_manager_page.dart +++ b/lib/ui/sub_pages/decoration_manager/decoration_manager_page.dart @@ -1,5 +1,9 @@ // 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_easyrefresh/easy_refresh.dart'; // Package imports: import 'package:provider/provider.dart'; @@ -24,21 +28,17 @@ class DecorationManagerPage extends StatefulWidget { class _DecorationManagerPageState extends State with TickerProviderStateMixin { TabController _tabController; + EasyRefreshController _refreshController; USER_ROLE get role => Provider.of(context, listen: false).userInfoModel.role; List get tabs { - switch (role) { - case USER_ROLE.MANAGER: - return ['待指派', '已指派', '已执行', '全部']; - break; - - case USER_ROLE.PROPERTY: - return ['待执行', '已执行', '全部']; - break; - default: - return ['装修中', '装修完成', '全部']; - break; + final userProvider = Provider.of(context, listen: false); + if (userProvider?.infoModel?.canSendTicket != null && + userProvider.infoModel.canSendTicket) { + return ['待指派', '已指派', '已执行', '全部']; + } else { + return ['待执行', '已执行', '全部']; } } @@ -47,6 +47,13 @@ class _DecorationManagerPageState extends State super.initState(); _tabController = TabController(length: tabs.length, vsync: this); + _refreshController = EasyRefreshController(); + } + + @override + void dispose() { + _refreshController?.dispose(); + super.dispose(); } @override @@ -68,41 +75,59 @@ class _DecorationManagerPageState extends State } List _getViews() { - 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; + final userProvider = Provider.of(context); + if (userProvider?.infoModel?.canSendTicket != null && + userProvider.infoModel.canSendTicket) { + return [...List.generate(4, (index) => _getSingleListView(index))]; + } else { + return [...List.generate(3, (index) => _getSingleListView(index))]; } + // 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 models) { - return ListView.builder( - itemBuilder: (context, index) { - return DecorationManagerCard(model: models[index]); - }, - itemCount: models.length, - padding: EdgeInsets.symmetric(horizontal: 32.w), - ); + _getSingleListView(int index) { + return BeeListView( + extraParams: {'operationStatus': index}, + path: API.manage.decorationList, + controller: _refreshController, + convert: (models) { + 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), + ); + }); } } diff --git a/lib/ui/sub_pages/decoration_manager/decoration_util.dart b/lib/ui/sub_pages/decoration_manager/decoration_util.dart index be91a25..90fae8a 100644 --- a/lib/ui/sub_pages/decoration_manager/decoration_util.dart +++ b/lib/ui/sub_pages/decoration_manager/decoration_util.dart @@ -12,52 +12,109 @@ import 'package:aku_community_manager/style/app_style.dart'; class DecorationUIUtil { BuildContext context; - USER_ROLE get role => - Provider.of(context, listen: false).userInfoModel.role; + UserProvider get userProvider => + Provider.of(context, listen: false); DecorationUIUtil(this.context); - String getTagName(DecorationType type, DecorationStatusType statusType) { - Map managerMap = { - DecorationType.WAIT_HAND_OUT: '待指派', - DecorationType.HAND_OUT: '已指派', - DecorationType.DONE: '已执行', - }; - - Map fixerMap = { - DecorationType.HAND_OUT: '待执行', - DecorationType.DONE: '已执行', - }; - - Map defaultMap = { - DecorationStatusType.DONE: '装修完成', - DecorationStatusType.PROGRESS: '装修中', - }; - - switch (role) { - case USER_ROLE.MANAGER: - return managerMap[type]; + String getTagName(int operationStatus, int status, {int tracker}) { + // Map managerMap = { + // DecorationType.WAIT_HAND_OUT: '待指派', + // DecorationType.HAND_OUT: '已指派', + // DecorationType.DONE: '已执行', + // }; + + // Map fixerMap = { + // DecorationType.HAND_OUT: '待执行', + // DecorationType.DONE: '已执行', + // }; + + // Map defaultMap = { + // DecorationStatusType.DONE: '装修完成', + // DecorationStatusType.PROGRESS: '装修中', + // }; + + // switch (role) { + // case USER_ROLE.MANAGER: + // 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; - case USER_ROLE.PROPERTY: - return fixerMap[type]; + case 2: + if (status < 5) { + if (userProvider?.infoModel?.canOperation != null && + userProvider.infoModel.canOperation) { + return '已指派'; + } else { + return '待执行'; + } + } else { + return '未知'; + } break; - default: - return defaultMap[statusType]; + case 3: + if (status >= 5) { + return '已完成'; + } else { + return '未知'; + } break; + default: + return '未知'; } } - Color getTagColor(DecorationType type, DecorationStatusType statusType) { - if (role == USER_ROLE.MANAGER || role == USER_ROLE.PROPERTY) { - if (type == DecorationType.WAIT_HAND_OUT || - type == DecorationType.HAND_OUT) { + Color getTagColor(int operationStatus) { + // if (role == USER_ROLE.MANAGER || role == USER_ROLE.PROPERTY) { + // if (type == DecorationType.WAIT_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); - } else - return AppStyle.minorTextColor; - } else { - if (statusType == DecorationStatusType.PROGRESS) { - return Color(0xFFFF4501); - } else + case 3: return Color(0xFF32B814); + default: + return Color(0xFFFF4501); } } + + Map stautsToString = { + -1: '申请中', + -2: '申请未通过', + -3: '申请通过', + 1: '已付押金', + 2: '装修中', + 3: '完工检查申请中', + 4: '完工检查不通过', + 5: '完工检查通过', + 6: '申请退款中', + 7: '装修结束', + 8: '已作废', + }; + String getDecorationStatus(int status) { + return stautsToString[status]; + } } diff --git a/lib/ui/sub_pages/manage_func.dart b/lib/ui/sub_pages/manage_func.dart new file mode 100644 index 0000000..30230f8 --- /dev/null +++ b/lib/ui/sub_pages/manage_func.dart @@ -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 getDetcorationDetail(int id) async { + Response response = await NetUtil() + .dio + .get(API.manage.decorationFindByld, queryParameters: { + 'decorationId': id, + }); + return DecorationDetailModel.fromJson(response.data); + } +}