parent
c2829ca922
commit
f7250cfae3
@ -0,0 +1,50 @@
|
||||
import 'package:common_utils/common_utils.dart';
|
||||
|
||||
class VisitorItemModel {
|
||||
int id;
|
||||
String roomName;
|
||||
String name;
|
||||
int isDrive;
|
||||
String carNum;
|
||||
String effectiveTime;
|
||||
String visitDate;
|
||||
int visitorStatus;
|
||||
|
||||
DateTime get effective => DateUtil.getDateTime(effectiveTime);
|
||||
DateTime get visit =>
|
||||
visitDate == null ? null : DateUtil.getDateTime(visitDate);
|
||||
|
||||
VisitorItemModel(
|
||||
{this.id,
|
||||
this.roomName,
|
||||
this.name,
|
||||
this.isDrive,
|
||||
this.carNum,
|
||||
this.effectiveTime,
|
||||
this.visitDate,
|
||||
this.visitorStatus});
|
||||
|
||||
VisitorItemModel.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
roomName = json['roomName'];
|
||||
name = json['name'];
|
||||
isDrive = json['isDrive'];
|
||||
carNum = json['carNum'];
|
||||
effectiveTime = json['effectiveTime'];
|
||||
visitDate = json['visitDate'];
|
||||
visitorStatus = json['visitorStatus'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['roomName'] = this.roomName;
|
||||
data['name'] = this.name;
|
||||
data['isDrive'] = this.isDrive;
|
||||
data['carNum'] = this.carNum;
|
||||
data['effectiveTime'] = this.effectiveTime;
|
||||
data['visitDate'] = this.visitDate;
|
||||
data['visitorStatus'] = this.visitorStatus;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
import 'package:aku_community_manager/const/api.dart';
|
||||
import 'package:aku_community_manager/models/manager/visitor_item_model.dart';
|
||||
import 'package:aku_community_manager/ui/sub_pages/visitor_manager/visitor_manager_card.dart';
|
||||
import 'package:aku_community_manager/ui/sub_pages/visitor_manager/visitor_manager_page.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';
|
||||
|
||||
class VisitorManagerView extends StatefulWidget {
|
||||
final int status;
|
||||
VisitorManagerView({Key key, @required this.status}) : super(key: key);
|
||||
|
||||
@override
|
||||
_VisitorManagerViewState createState() => _VisitorManagerViewState();
|
||||
}
|
||||
|
||||
class _VisitorManagerViewState extends State<VisitorManagerView>
|
||||
with AutomaticKeepAliveClientMixin {
|
||||
EasyRefreshController _refreshController = EasyRefreshController();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return BeeListView(
|
||||
path: API.manage.visitorList,
|
||||
controller: _refreshController,
|
||||
convert: (model) {
|
||||
return model.tableList
|
||||
.map((e) => VisitorItemModel.fromJson(e))
|
||||
.toList();
|
||||
},
|
||||
extraParams: {'visitorStatus': widget.status},
|
||||
builder: (items) {
|
||||
return ListView.builder(
|
||||
itemBuilder: (context, index) {
|
||||
final VisitorItemModel item = items[index];
|
||||
return VisitorManagerCard(model: item);
|
||||
},
|
||||
itemCount: items.length,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
}
|
Loading…
Reference in new issue