对接报事报修:查询 维修部组织信息及人员接口

hmxc
小赖 4 years ago
parent 68b3236218
commit 86cfd241d3

@ -13,6 +13,7 @@ class API {
static const int networkTimeOut = 10000; static const int networkTimeOut = 10000;
static _Auth auth = _Auth(); static _Auth auth = _Auth();
static _User user = _User(); static _User user = _User();
static _Manage manage = _Manage();
} }
class _Auth { class _Auth {
@ -33,3 +34,8 @@ class _User {
/// ///
String get info => '/user/personalData/getUserDetail'; String get info => '/user/personalData/getUserDetail';
} }
class _Manage {
///
String get fixers => '/user/repair/findRepairOrganization';
}

@ -12,6 +12,8 @@ enum FIXER_TYPE {
PROPERTY, PROPERTY,
} }
//TODO CLEAN BOTTOM CODES.
@Deprecated("fixer_model need to be cleaned.")
class FixerModel { class FixerModel {
String name; String name;
String phone; String phone;

@ -40,7 +40,7 @@ class UserInfoModel {
UserInfoModel.empty({ UserInfoModel.empty({
this.nickName = '', this.nickName = '',
this.avatar, this.avatar,
this.role = USER_ROLE.EMPTY, this.role = USER_ROLE.MANAGER,
this.phone = '', this.phone = '',
}); });

@ -0,0 +1,51 @@
class FixerItemModel {
int id;
String name;
List<RepairmanVos> repairmanVos;
FixerItemModel({this.id, this.name, this.repairmanVos});
FixerItemModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
if (json['repairmanVos'] != null) {
repairmanVos = new List<RepairmanVos>();
json['repairmanVos'].forEach((v) {
repairmanVos.add(new RepairmanVos.fromJson(v));
});
} else
repairmanVos = [];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
if (this.repairmanVos != null) {
data['repairmanVos'] = this.repairmanVos.map((v) => v.toJson()).toList();
}
return data;
}
}
class RepairmanVos {
int id;
String name;
String tel;
RepairmanVos({this.id, this.name, this.tel});
RepairmanVos.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
tel = json['tel'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
data['tel'] = this.tel;
return data;
}
}

@ -10,6 +10,8 @@ import 'package:aku_community_manager/mock_models/fix/fixer_model.dart';
import 'package:aku_community_manager/mock_models/users/user_info_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/provider/user_provider.dart';
//TODO CLEAN BOTTOM CODES.
@Deprecated("fix_provider need to be cleaned.")
class FixProvider extends ChangeNotifier { class FixProvider extends ChangeNotifier {
List<FixModel> _fixModels = FixModel.initList(); List<FixModel> _fixModels = FixModel.initList();
List<FixModel> get fixModels => _fixModels; List<FixModel> get fixModels => _fixModels;

@ -2,7 +2,6 @@
import 'dart:io'; import 'dart:io';
// Flutter imports: // Flutter imports:
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// Project imports: // Project imports:

@ -1,17 +1,19 @@
// Flutter imports: // Flutter imports:
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/fixer_item_model.dart';
import 'package:aku_community_manager/utils/network/base_model.dart';
import 'package:aku_community_manager/utils/network/net_util.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// Package imports: // Package imports:
import 'package:aku_ui/common_widgets/aku_material_button.dart'; import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:expandable/expandable.dart'; import 'package:expandable/expandable.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart'; 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/mock_models/fix/fix_model.dart'; import 'package:aku_community_manager/mock_models/fix/fix_model.dart';
import 'package:aku_community_manager/mock_models/fix/fixer_model.dart';
import 'package:aku_community_manager/provider/fix_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/widget_tool.dart'; import 'package:aku_community_manager/tools/widget_tool.dart';
@ -28,19 +30,30 @@ class FixerDepartmentPage extends StatefulWidget {
} }
class _FixerDepartmentPageState extends State<FixerDepartmentPage> { class _FixerDepartmentPageState extends State<FixerDepartmentPage> {
List<FixerModel> _pickedFixers = []; List<RepairmanVos> _pickedFixers = [];
List<FixerItemModel> _fixerItems = [];
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final fixProvider = Provider.of<FixProvider>(context);
return AkuScaffold( return AkuScaffold(
title: '房屋管理维修部', title: '房屋管理维修部',
body: ListView.builder( body: EasyRefresh(
firstRefresh: true,
header: MaterialHeader(),
onRefresh: () async {
BaseModel model = await NetUtil().get(API.manage.fixers);
_fixerItems = (model.data as List)
.map((e) => FixerItemModel.fromJson(e))
.toList();
setState(() {});
},
child: ListView.builder(
padding: EdgeInsets.symmetric(vertical: 16.w), padding: EdgeInsets.symmetric(vertical: 16.w),
itemBuilder: (context, index) { itemBuilder: (context, index) {
return _buildItem(fixProvider.fixerModels[index], index); return _buildItem(_fixerItems[index], index);
}, },
itemCount: fixProvider.fixerModels.length, itemCount: _fixerItems.length,
),
), ),
bottom: AkuMaterialButton( bottom: AkuMaterialButton(
height: 96.w, height: 96.w,
@ -83,7 +96,7 @@ class _FixerDepartmentPageState extends State<FixerDepartmentPage> {
); );
} }
_buildItem(FixerTypedModel model, int index) { _buildItem(FixerItemModel model, int index) {
return Container( return Container(
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border( border: Border(
@ -102,7 +115,7 @@ class _FixerDepartmentPageState extends State<FixerDepartmentPage> {
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
padding: EdgeInsets.symmetric(horizontal: 32.w), padding: EdgeInsets.symmetric(horizontal: 32.w),
child: Text( child: Text(
model.typeName, model.name,
style: TextStyle( style: TextStyle(
color: AppStyle.primaryTextColor, color: AppStyle.primaryTextColor,
fontSize: 32.sp, fontSize: 32.sp,
@ -119,14 +132,16 @@ class _FixerDepartmentPageState extends State<FixerDepartmentPage> {
height: 1.w, height: 1.w,
thickness: 1.w, thickness: 1.w,
), ),
...model.fixers.map((e) { ...model.repairmanVos.map((e) {
return Column( return Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
AkuMaterialButton( AkuMaterialButton(
height: 96.w, height: 96.w,
onPressed: () { onPressed: () {
if (_pickedFixers.indexOf(e) == -1) { if (_pickedFixers
.indexWhere((element) => element.id == e.id) ==
-1) {
_pickedFixers.add(e); _pickedFixers.add(e);
} else { } else {
_pickedFixers.remove(e); _pickedFixers.remove(e);
@ -171,7 +186,7 @@ class _FixerDepartmentPageState extends State<FixerDepartmentPage> {
width: 40.w, width: 40.w,
), ),
Text( Text(
e.phone, e.tel,
style: TextStyle( style: TextStyle(
color: AppStyle.primaryTextColor, color: AppStyle.primaryTextColor,
fontSize: 28.w, fontSize: 28.w,
@ -182,7 +197,7 @@ class _FixerDepartmentPageState extends State<FixerDepartmentPage> {
], ],
), ),
), ),
model.fixers.last == e model.repairmanVos.last == e
? SizedBox() ? SizedBox()
: Divider( : Divider(
indent: 32.w, indent: 32.w,

Loading…
Cancel
Save