对接 卫生管理

hmxc
张萌 4 years ago
parent f13732ac5d
commit 02cf6543d9

@ -218,6 +218,12 @@ class _Manage {
///app绿 ///app绿
String get greenManageComplete => '/user/green/complete'; String get greenManageComplete => '/user/green/complete';
///app
String get hygienceList => '/user/hygiene/list';
///app
String get hygienceComplete => '/user/hygiene/complete';
} }
class _Upload { class _Upload {

@ -0,0 +1,54 @@
import 'package:common_utils/common_utils.dart';
class HygienceListModel {
int id;
String hygieneAreaName;
String content;
String directorName;
int status;
String completeDate;
String endDate;
String createDate;
HygienceListModel(
{this.id,
this.hygieneAreaName,
this.content,
this.directorName,
this.status,
this.completeDate,
this.endDate,
this.createDate});
HygienceListModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
hygieneAreaName = json['hygieneAreaName'];
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['hygieneAreaName'] = this.hygieneAreaName;
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 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: // Flutter imports:
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/hygience_manage/heygience_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'; import 'package:flutter/material.dart';
// Package imports: // Package imports:
@ -14,7 +19,10 @@ import 'package:aku_community_manager/ui/manage_pages/hygience_manage/hygience_m
class HyginecManageCard extends StatefulWidget { class HyginecManageCard extends StatefulWidget {
final int index; final int index;
HyginecManageCard({Key key, this.index}) : super(key: key); final HygienceListModel model;
final VoidCallback callRefresh;
HyginecManageCard({Key key, this.index, this.model, this.callRefresh})
: super(key: key);
@override @override
_HyginecManageCardState createState() => _HyginecManageCardState(); _HyginecManageCardState createState() => _HyginecManageCardState();
@ -40,7 +48,7 @@ class _HyginecManageCardState extends State<HyginecManageCard> {
child: Row( child: Row(
children: [ children: [
Text( Text(
'cardModel.title', widget.model.hygieneAreaName,
style: TextStyle( style: TextStyle(
color: AppStyle.primaryTextColor, color: AppStyle.primaryTextColor,
fontSize: 32.w, fontSize: 32.w,
@ -75,7 +83,7 @@ class _HyginecManageCardState extends State<HyginecManageCard> {
)), )),
Spacer(), Spacer(),
Text( Text(
'cardModel.task', widget.model.content,
style: AppStyle().primaryStyle, style: AppStyle().primaryStyle,
), ),
], ],
@ -95,7 +103,7 @@ class _HyginecManageCardState extends State<HyginecManageCard> {
)), )),
Spacer(), Spacer(),
Text( Text(
'cardModel.name', widget.model.directorName,
style: AppStyle().primaryStyle, style: AppStyle().primaryStyle,
), ),
], ],
@ -113,7 +121,7 @@ class _HyginecManageCardState extends State<HyginecManageCard> {
color: AppStyle.primaryTextColor, fontSize: 28.sp)), color: AppStyle.primaryTextColor, fontSize: 28.sp)),
Spacer(), Spacer(),
Text( Text(
'${'cardModel.timestart'}${'cardModel.timeend'}', '${widget.model.createDateString}${widget.model.endDateString}',
style: AppStyle().primaryStyle, style: AppStyle().primaryStyle,
), ),
], ],
@ -147,7 +155,16 @@ class _HyginecManageCardState extends State<HyginecManageCard> {
.color(kTextPrimaryColor) .color(kTextPrimaryColor)
.bold .bold
.make(), .make(),
onPressed: () {}, onPressed: () async {
BaseModel baseModel = await NetUtil()
.post(API.manage.hygienceComplete, params: {
"id": widget.model.id,
});
if (baseModel.status) {
widget.callRefresh();
}
BotToast.showText(text: baseModel.message);
},
) )
], ],
) )

@ -36,7 +36,7 @@ class _HygienceManagePageState extends State<HygienceManagePage>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AkuScaffold( return AkuScaffold(
title: '绿化管理', title: '卫生管理',
appBarBottom: PreferredSize( appBarBottom: PreferredSize(
preferredSize: Size.fromHeight(88.w), preferredSize: Size.fromHeight(88.w),
child: AkuTabBar(controller: _tabController, tabs: _tabs)), child: AkuTabBar(controller: _tabController, tabs: _tabs)),

@ -1,8 +1,14 @@
// Flutter imports: // Flutter imports:
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/hygience_manage/heygience_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';
// Project imports: // Project imports:
import 'package:aku_community_manager/ui/manage_pages/hygience_manage/hygience_manage_card.dart'; import 'package:aku_community_manager/ui/manage_pages/hygience_manage/hygience_manage_card.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class HygienceManageView extends StatefulWidget { class HygienceManageView extends StatefulWidget {
final int index; final int index;
@ -13,14 +19,48 @@ class HygienceManageView extends StatefulWidget {
} }
class _HygienceManageViewState extends State<HygienceManageView> { class _HygienceManageViewState extends State<HygienceManageView> {
EasyRefreshController _refreshController;
@override
void initState() {
super.initState();
_refreshController = EasyRefreshController();
}
@override
void dispose() {
_refreshController.dispose();
super.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListView( return BeeListView(
children: [ path: API.manage.hygienceList,
HyginecManageCard( controller: _refreshController,
index: widget.index, extraParams: {
) "hygieneStatus":widget.index+1,
], },
); convert: (models) {
return models.tableList
.map((e) => HygienceListModel.fromJson(e))
.toList();
},
builder: (items) {
return ListView.separated(
padding: EdgeInsets.all(24.w),
itemBuilder: (context, index) {
return HyginecManageCard(
index: widget.index,
model: items[index],
callRefresh: () {
_refreshController.callRefresh();
},
);
},
separatorBuilder: (_, __) {
return 24.w.heightBox;
},
itemCount: items.length);
});
} }
} }

Loading…
Cancel
Save