对接 :巡检管理首页

对接:巡检管理详情
添加:巡检管理model
修改:巡检管理详情页
hmxc
张萌 4 years ago
parent 7a561e3614
commit 81e2aff102

@ -140,6 +140,9 @@ class _Manage {
///
String get inspectionList => '/user/inspection/list';
///id
String get inspectionFindDetailByld => '/user/inspection/findDetailById';
}
class _Upload {

@ -0,0 +1,44 @@
class InspectionDetailModel {
int id;
int inspectionPlanId;
String code;
String name;
String beginDate;
String endDate;
String actualBeginDate;
String actualEndDate;
InspectionDetailModel(
{this.id,
this.inspectionPlanId,
this.code,
this.name,
this.beginDate,
this.endDate,
this.actualBeginDate,
this.actualEndDate});
InspectionDetailModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
inspectionPlanId = json['inspectionPlanId'];
code = json['code'];
name = json['name'];
beginDate = json['beginDate'];
endDate = json['endDate'];
actualBeginDate = json['actualBeginDate'];
actualEndDate = json['actualEndDate'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['inspectionPlanId'] = this.inspectionPlanId;
data['code'] = this.code;
data['name'] = this.name;
data['beginDate'] = this.beginDate;
data['endDate'] = this.endDate;
data['actualBeginDate'] = this.actualBeginDate;
data['actualEndDate'] = this.actualEndDate;
return data;
}
}

@ -1,8 +1,10 @@
import 'package:aku_community_manager/models/manager/inspection/inspection_list_model.dart';
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/ui/manage_pages/inspection_manage/inspection_manage_details_page.dart';
import 'package:aku_ui/aku_ui.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
class InspectionManageCard extends StatefulWidget {
@ -43,11 +45,12 @@ class _InspectionManageCardState extends State<InspectionManageCard> {
AkuButton(
onPressed: widget.extra
? () {
// Get.to(
// InspectionManageDetailsPage(
// widget.cardModel: widget.cardModel,
// ),
// );
Get.to(
InspectionManageDetailsPage(
inspectionStatus: widget.cardModel.status,
executeId: widget.cardModel.id,
),
);
}
: () {},
child: Container(

@ -1,8 +1,10 @@
// Flutter imports:
import 'package:aku_community_manager/models/manager/inspection/inspection_list_model.dart';
import 'package:aku_community_manager/ui/manage_pages/inspection_manage/inspection_manage_card.dart';
import 'package:aku_community_manager/models/manager/inspection/inspection_detail_model.dart';
import 'package:aku_community_manager/ui/sub_pages/manage_func.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:aku_community_manager/utils/extension/list_extension.dart';
import 'package:aku_community_manager/style/app_style.dart';
@ -13,8 +15,13 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
class InspectionManageDetailsPage extends StatefulWidget {
final InspectionListModel cardModel;
InspectionManageDetailsPage({Key key, this.cardModel}) : super(key: key);
final int executeId;
final int inspectionStatus;
InspectionManageDetailsPage({
Key key,
@required this.executeId,
@required this.inspectionStatus,
}) : super(key: key);
@override
_InspectionManageDetailsPageState createState() =>
@ -23,7 +30,8 @@ class InspectionManageDetailsPage extends StatefulWidget {
class _InspectionManageDetailsPageState
extends State<InspectionManageDetailsPage> {
bool get _isFinishInspection => widget.cardModel.status == 2;
TextStyle _textstyle =
TextStyle(color: AppStyle.minorTextColor, fontSize: 28.sp);
Map<int, String> _inspectionStatus = {
1: '待巡检',
2: '已巡检',
@ -40,16 +48,46 @@ class _InspectionManageDetailsPageState
}
}
InspectionDetailModel _detailModel;
bool _onload = true;
EasyRefreshController _refreshController;
@override
void initState() {
super.initState();
_refreshController = EasyRefreshController();
}
@override
void dispose() {
_refreshController?.dispose();
super.dispose();
}
Widget _emptyWidget() {
return Container();
}
@override
Widget build(BuildContext context) {
return AkuScaffold(
title: '巡检详情',
body: Column(
body: EasyRefresh(
controller: _refreshController,
firstRefresh: true,
onRefresh: () async {
_detailModel = await ManageFunc.getInspectionDetail(widget.executeId);
_onload = false;
setState(() {});
},
child: _onload
? SizedBox()
: Column(
children: [
InspectionManageCard(cardModel: widget.cardModel, extra: false),
_inspectionHeadCard(),
16.w.heightBox,
Container(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
padding:
EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
decoration: BoxDecoration(color: Color(0xFFFFFF)),
child: Column(
children: <Widget>[
@ -64,6 +102,151 @@ class _InspectionManageDetailsPageState
)
],
),
),
);
}
Widget _inspectionHeadCard() {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
16.w.heightBox,
Container(
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(left: 24.w, right: 24.w, bottom: 40.w),
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
color: Color(0xFFFFFFFF)),
child: Column(children: [
Container(
height: 86.w,
width: double.infinity,
alignment: Alignment.centerLeft,
child: Row(
children: [
Text(
'${_detailModel.name}',
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 36.sp,
fontWeight: FontWeight.bold),
),
Spacer(),
_inspectionStatus[widget.inspectionStatus]
.text
.color(_inspectionColor(widget.inspectionStatus))
.bold
.size(28.sp)
.make()
],
),
),
Row(
children: [
Image.asset(
R.ASSETS_MANAGE_IC_RENWU_PNG,
width: 40.w,
height: 40.w,
),
4.w.widthBox,
Text(
'巡检名称',
style: _textstyle,
),
Spacer(),
Text(
_detailModel.name,
style: AppStyle().primaryStyle,
)
],
),
12.w.heightBox,
Row(
children: [
Image.asset(
R.ASSETS_MANAGE_IC_RENWU_PNG,
width: 40.w,
height: 40.w,
),
4.w.widthBox,
Text(
'巡检编号',
style: _textstyle,
),
Spacer(),
Text(
_detailModel.code,
style: AppStyle().primaryStyle,
)
],
),
12.w.heightBox,
Row(
children: [
Image.asset(
R.ASSETS_INSPECTION_IC_XUNJIAN_PNG,
width: 40.w,
height: 40.w,
),
4.w.widthBox,
Text('规定巡检时间', style: _textstyle),
Spacer(),
Text(
'${DateUtil.formatDateStr(_detailModel.beginDate, format: "yyyy-MM-dd HH:mm")}${_detailModel?.endDate == null ? '' : DateUtil.formatDateStr(_detailModel.endDate, format: "HH:mm")}',
style: AppStyle().primaryStyle,
),
],
),
12.w.heightBox,
..._detailModel?.actualBeginDate == null
? [SizedBox()]
: [
Row(
children: [
Image.asset(
R.ASSETS_MANAGE_IC_TIME_PNG,
width: 40.w,
height: 40.w,
),
4.w.widthBox,
Text(
'开始巡检时间',
style: _textstyle,
),
Spacer(),
Text(
'${DateUtil.formatDateStr(_detailModel.actualBeginDate, format: "yyyy-MM-dd HH:mm")}',
style: AppStyle().primaryStyle,
),
],
),
12.w.heightBox,
],
_detailModel?.actualEndDate == null
? SizedBox()
: Row(
children: [
Image.asset(
R.ASSETS_MESSAGE_IC_PEOPLE_PNG,
width: 40.w,
height: 40.w,
),
4.w.widthBox,
Text(
'结束巡检时间',
style: _textstyle,
),
Spacer(),
Text(
'${DateUtil.formatDateStr(_detailModel.actualEndDate, format: "yyyy-MM-dd HH:mm")}',
style: AppStyle().primaryStyle,
),
],
)
]),
),
],
);
}
@ -87,11 +270,11 @@ class _InspectionManageDetailsPageState
],
),
Spacer(),
_inspectionStatus[widget.cardModel.status]
_inspectionStatus[widget.inspectionStatus]
.text
.size(24.sp)
.bold
.color(_inspectionColor(widget.cardModel.status))
.color(_inspectionColor(widget.inspectionStatus))
.make(),
14.w.widthBox,
Icon(

@ -37,8 +37,6 @@ class _InspectionManagePageState extends State<InspectionManagePage>
}
}
int _selectIndex = 0;
TabController _tabController;
@override
void initState() {

@ -1,5 +1,6 @@
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/models/manager/inspection/inspection_detail_model.dart';
import 'package:aku_community_manager/utils/network/base_model.dart';
import 'package:aku_community_manager/utils/network/net_util.dart';
import 'package:dio/dio.dart';
@ -23,4 +24,13 @@ class ManageFunc {
);
return baseModel.data;
}
static Future<InspectionDetailModel> getInspectionDetail(
int executeId) async {
BaseModel baseModel =
await NetUtil().get(API.manage.inspectionFindDetailByld, params: {
"executeId": executeId,
});
return InspectionDetailModel.fromJson(baseModel.data);
}
}

Loading…
Cancel
Save