对接绿化管理接口

hmxc
张萌 4 years ago
parent 4e1aa84306
commit f13732ac5d

@ -212,6 +212,12 @@ class _Manage {
///app
String get keyRecordList => '/user/key/record';
///app绿绿
String get greenManageList => '/user/green/list';
///app绿
String get greenManageComplete => '/user/green/complete';
}
class _Upload {

@ -0,0 +1,82 @@
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
class GreenManageListModel {
int id;
String greenAreaName;
String content;
String directorName;
int status;
String completeDate;
String endDate;
String createDate;
GreenManageListModel(
{this.id,
this.greenAreaName,
this.content,
this.directorName,
this.status,
this.completeDate,
this.endDate,
this.createDate});
GreenManageListModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
greenAreaName = json['greenAreaName'];
content = json['content'];
directorName = json['directorName'];
status = json['status'];
completeDate = json['completeDate'];
endDate = json['endDate'];
createDate = json['createDate'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['greenAreaName'] = this.greenAreaName;
data['content'] = this.content;
data['directorName'] = this.directorName;
data['status'] = this.status;
data['completeDate'] = this.completeDate;
data['endDate'] = this.endDate;
data['createDate'] = this.createDate;
return data;
}
String get statusString {
switch (this.status) {
case 1:
return '待处理';
case 2:
return '已完成';
case 3:
return '未完成';
default:
return '未知';
}
}
Color get statusColor {
switch (this.status) {
case 1:
return Color(0xFFFF8200);
case 2:
return Color(0xFF999999);
case 3:
return Color(0xFFE60E0E);
default:
Colors.black;
}
}
String get createDateString =>
DateUtil.formatDateStr(this.createDate, format: 'yy-MM-dd HH:mm');
String get endDateString =>
DateUtil.formatDateStr(this.endDate, format: 'yy-MM-dd HH:mm');
String get completeDateString =>
DateUtil.formatDateStr(this.completeDate, format: 'yy-MM-dd HH:mm');
}

@ -1,4 +1,9 @@
// Flutter imports:
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/green_manage/green_manage_list_model.dart';
import 'package:aku_community_manager/utils/network/base_model.dart';
import 'package:aku_community_manager/utils/network/net_util.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
// Package imports:
@ -15,7 +20,10 @@ import 'package:aku_community_manager/ui/manage_pages/green_manage/green_manage_
class GreenManageCard extends StatefulWidget {
final int index;
GreenManageCard({Key key, this.index}) : super(key: key);
final GreenManageListModel model;
final VoidCallback callRefresh;
GreenManageCard({Key key, this.index, this.model, this.callRefresh})
: super(key: key);
@override
_GreenManageCardState createState() => _GreenManageCardState();
@ -41,17 +49,17 @@ class _GreenManageCardState extends State<GreenManageCard> {
child: Row(
children: [
Text(
'cardModel.title',
widget.model.greenAreaName,
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 32.w,
fontWeight: FontWeight.bold),
),
Spacer(),
GreenManageMap.statusString(widget.index + 1)
GreenManageMap.statusString(widget.model.status)
.text
.size(28.sp)
.color(GreenManageMap.statusColor(widget.index + 1))
.color(GreenManageMap.statusColor(widget.model.status))
.bold
.make(),
],
@ -76,7 +84,7 @@ class _GreenManageCardState extends State<GreenManageCard> {
)),
Spacer(),
Text(
'cardModel.task',
widget.model.content,
style: AppStyle().primaryStyle,
),
],
@ -96,7 +104,7 @@ class _GreenManageCardState extends State<GreenManageCard> {
)),
Spacer(),
Text(
'cardModel.name',
widget.model.directorName,
style: AppStyle().primaryStyle,
),
],
@ -114,7 +122,7 @@ class _GreenManageCardState extends State<GreenManageCard> {
color: AppStyle.primaryTextColor, fontSize: 28.sp)),
Spacer(),
Text(
'${'cardModel.timestart'}${'cardModel.timeend'}',
'${widget.model.createDateString}${widget.model.endDateString}',
style: AppStyle().primaryStyle,
),
],
@ -128,7 +136,7 @@ class _GreenManageCardState extends State<GreenManageCard> {
}
List<Widget> _buttomButtons() {
return widget.index != 0
return widget.model.status != 1
? [SizedBox()]
: [
40.w.heightBox,
@ -148,7 +156,16 @@ class _GreenManageCardState extends State<GreenManageCard> {
.color(kTextPrimaryColor)
.bold
.make(),
onPressed: () {},
onPressed: () async {
BaseModel baseModel = await NetUtil()
.post(API.manage.greenManageComplete, params: {
"id": widget.model.id,
});
if (baseModel.status) {
widget.callRefresh();
}
BotToast.showText(text: baseModel.message);
},
)
],
)

@ -1,8 +1,14 @@
// Flutter imports:
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/green_manage/green_manage_list_model.dart';
import 'package:aku_community_manager/ui/widgets/common/bee_list_view.dart';
import 'package:flutter/material.dart';
// Project imports:
import 'package:aku_community_manager/ui/manage_pages/green_manage/green_manage_card.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
class GreenManageView extends StatefulWidget {
final int index;
@ -13,14 +19,48 @@ class GreenManageView extends StatefulWidget {
}
class _GreenManageViewState extends State<GreenManageView> {
EasyRefreshController _refreshController;
@override
void initState() {
super.initState();
_refreshController = EasyRefreshController();
}
@override
void dispose() {
_refreshController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return ListView(
children: [
GreenManageCard(
return BeeListView(
path: API.manage.greenManageList,
extraParams: {
"greenStatus": widget.index + 1,
},
controller: _refreshController,
convert: (models) {
return models.tableList
.map((e) => GreenManageListModel.fromJson(e))
.toList();
},
builder: (items) {
return ListView.separated(
padding: EdgeInsets.all(24.w),
itemBuilder: (contex, index) {
return GreenManageCard(
index: widget.index,
)
],
model: items[index],
callRefresh: () {
_refreshController.callRefresh();
},
);
},
separatorBuilder: (_, __) {
return 24.w.heightBox;
},
itemCount: items.length);
});
}
}

@ -18,7 +18,7 @@ class KeyApplyRecordPage extends StatefulWidget {
class _KeyApplyRecordPageState extends State<KeyApplyRecordPage>
with TickerProviderStateMixin {
List<String> _tabs = [ '审核中', '已通过', '已驳回','已归还'];
List<String> _tabs = ['全部', '审核中', '已通过', '已驳回','已归还'];
TabController _tabController;
@override
void initState() {

@ -39,6 +39,9 @@ class _KeyApplyRecordViewState extends State<KeyApplyRecordView>
Widget build(BuildContext context) {
return BeeListView(
path: API.manage.keyRecordList,
extraParams: {
"recordStatus": widget.index == 0 ? null : widget.index,
},
controller: _refreshController,
convert: (models) {
return models.tableList

Loading…
Cancel
Save