修复了一些问题

对接:巡检管理:根据巡检计划主键id查询巡检点部分信息
hmxc
张萌 4 years ago
parent 81e2aff102
commit ad9d4febc9

@ -1,3 +1,3 @@
{ {
"flutterSdkVersion": "2.0.2" "flutterSdkVersion": "2.0.0"
} }

@ -1,3 +1,3 @@
{ {
"dart.flutterSdkPath": "/Users/zhangmeng/fvm/versions/2.0.2" "dart.flutterSdkPath": "/Users/zhangmeng/fvm/versions/2.0.0"
} }

@ -143,6 +143,9 @@ class _Manage {
///id ///id
String get inspectionFindDetailByld => '/user/inspection/findDetailById'; String get inspectionFindDetailByld => '/user/inspection/findDetailById';
///id
String get inspectionPointByPlanId => '/user/inspection/findPointByPlanId';
} }
class _Upload { class _Upload {

@ -7,6 +7,7 @@ class InspectionListModel {
String actualBeginDate; String actualBeginDate;
String actualEndDate; String actualEndDate;
int status; int status;
String inspectorName;
InspectionListModel( InspectionListModel(
{this.id, {this.id,
@ -16,7 +17,8 @@ class InspectionListModel {
this.endDate, this.endDate,
this.actualBeginDate, this.actualBeginDate,
this.actualEndDate, this.actualEndDate,
this.status}); this.status,
this.inspectorName});
InspectionListModel.fromJson(Map<String, dynamic> json) { InspectionListModel.fromJson(Map<String, dynamic> json) {
id = json['id']; id = json['id'];
@ -27,6 +29,7 @@ class InspectionListModel {
actualBeginDate = json['actualBeginDate']; actualBeginDate = json['actualBeginDate'];
actualEndDate = json['actualEndDate']; actualEndDate = json['actualEndDate'];
status = json['status']; status = json['status'];
inspectorName = json['inspectorName'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -39,6 +42,7 @@ class InspectionListModel {
data['actualBeginDate'] = this.actualBeginDate; data['actualBeginDate'] = this.actualBeginDate;
data['actualEndDate'] = this.actualEndDate; data['actualEndDate'] = this.actualEndDate;
data['status'] = this.status; data['status'] = this.status;
data['inspectorName'] = this.inspectorName;
return data; return data;
} }
} }

@ -0,0 +1,24 @@
class InspectionPointModel {
int id;
String name;
int checkNum;
String completeDate;
InspectionPointModel({this.id, this.name, this.checkNum, this.completeDate});
InspectionPointModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
checkNum = json['checkNum'];
completeDate = json['completeDate'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
data['checkNum'] = this.checkNum;
data['completeDate'] = this.completeDate;
return data;
}
}

@ -1,58 +1,65 @@
import 'package:aku_community_manager/models/manager/inspection/inspection_list_model.dart'; import 'package:aku_community_manager/models/manager/inspection/inspection_list_model.dart';
import 'package:aku_community_manager/provider/user_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/ui/manage_pages/inspection_manage/inspection_manage_details_page.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:aku_ui/aku_ui.dart';
import 'package:common_utils/common_utils.dart'; import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
class InspectionManageCard extends StatefulWidget { class InspectionManageCard extends StatefulWidget {
final InspectionListModel cardModel; final InspectionListModel cardModel;
final bool extra; InspectionManageCard({
InspectionManageCard({Key key, this.cardModel, this.extra = true}) Key key,
: super(key: key); this.cardModel,
}) : super(key: key);
@override @override
_InspectionManageCardState createState() => _InspectionManageCardState(); _InspectionManageCardState createState() => _InspectionManageCardState();
} }
class _InspectionManageCardState extends State<InspectionManageCard> { class _InspectionManageCardState extends State<InspectionManageCard> {
@override
Widget build(BuildContext context) {
TextStyle _textstyle = TextStyle _textstyle =
TextStyle(color: AppStyle.minorTextColor, fontSize: 28.sp); TextStyle(color: AppStyle.minorTextColor, fontSize: 28.sp);
Map<int, String> _inspectionStatus = { Map<int, String> _inspectionStatus = {1: '待巡检', 2: '已巡检', 3: '巡检中', 4: '未巡检'};
1: '待巡检',
2: '已巡检',
};
Color _inspectionColor(int status) { Color _inspectionColor(int status) {
switch (status) { switch (status) {
case 1: case 1:
return Color(0xFF4501); return Color(0xFFFF4501);
break; break;
case 2: case 2:
return Color(0x999999); return Color(0xFF999999);
case 3:
return Color(0xFFFF4501);
case 4:
return Color(0xFFFF4501);
default: default:
return Colors.black; return Colors.blue;
}
} }
bool get isManager {
UserProvider userProvider = Provider.of<UserProvider>(context);
return userProvider.infoModel.canOperation;
} }
@override
Widget build(BuildContext context) {
return Column( return Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
16.w.heightBox, 16.w.heightBox,
AkuButton( AkuButton(
onPressed: widget.extra onPressed: () {
? () {
Get.to( Get.to(
InspectionManageDetailsPage( InspectionManageDetailsPage(
inspectionStatus: widget.cardModel.status, inspectionStatus: widget.cardModel.status,
executeId: widget.cardModel.id, executeId: widget.cardModel.id,
), ),
); );
} },
: () {},
child: Container( child: Container(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
padding: EdgeInsets.only(left: 24.w, right: 24.w, bottom: 40.w), padding: EdgeInsets.only(left: 24.w, right: 24.w, bottom: 40.w),
@ -62,19 +69,19 @@ class _InspectionManageCardState extends State<InspectionManageCard> {
color: Color(0xFFFFFFFF)), color: Color(0xFFFFFFFF)),
child: Column(children: [ child: Column(children: [
Container( Container(
height: widget.extra ? 93.w : 86.w, height: 93.w,
width: double.infinity, width: double.infinity,
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Row( child: Row(
children: [ children: [
Text( Text(
'${widget.cardModel.name}', '${widget.cardModel.name}',
overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
color: AppStyle.primaryTextColor, color: AppStyle.primaryTextColor,
fontSize: widget.extra ? 32.sp : 36.sp, fontSize: 32.sp,
fontWeight: FontWeight.bold), fontWeight: FontWeight.bold),
), ).expand(),
Spacer(),
_inspectionStatus[widget.cardModel.status] _inspectionStatus[widget.cardModel.status]
.text .text
.color(_inspectionColor(widget.cardModel.status)) .color(_inspectionColor(widget.cardModel.status))
@ -84,10 +91,10 @@ class _InspectionManageCardState extends State<InspectionManageCard> {
], ],
), ),
), ),
...widget.extra Divider(height: 1.w),
? <Widget>[Divider(height: 1.w), 24.w.heightBox] 24.w.heightBox,
: [
Row( Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Image.asset( Image.asset(
R.ASSETS_MANAGE_IC_RENWU_PNG, R.ASSETS_MANAGE_IC_RENWU_PNG,
@ -95,19 +102,27 @@ class _InspectionManageCardState extends State<InspectionManageCard> {
height: 40.w, height: 40.w,
), ),
4.w.widthBox, 4.w.widthBox,
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text( Text(
'巡检名称', '巡检编号',
style: _textstyle, style: _textstyle,
), ),
Spacer(), ],
),
36.w.widthBox,
Text( Text(
widget.cardModel.name, widget.cardModel.code,
maxLines: 2,
textAlign: TextAlign.right,
style: AppStyle().primaryStyle, style: AppStyle().primaryStyle,
) ).expand()
], ],
), ),
12.w.heightBox, 12.w.heightBox,
], ...isManager
? [
Row( Row(
children: [ children: [
Image.asset( Image.asset(
@ -117,17 +132,19 @@ class _InspectionManageCardState extends State<InspectionManageCard> {
), ),
4.w.widthBox, 4.w.widthBox,
Text( Text(
'巡检编号', '巡检人',
style: _textstyle, style: _textstyle,
), ),
Spacer(), Spacer(),
Text( Text(
widget.cardModel.code, widget.cardModel.inspectorName,
style: AppStyle().primaryStyle, style: AppStyle().primaryStyle,
) )
], ],
), ),
12.w.heightBox, 12.w.heightBox,
]
: [SizedBox()],
Row( Row(
children: [ children: [
Image.asset( Image.asset(
@ -145,7 +162,7 @@ class _InspectionManageCardState extends State<InspectionManageCard> {
], ],
), ),
12.w.heightBox, 12.w.heightBox,
...widget.cardModel?.actualBeginDate == null ...widget?.cardModel?.actualBeginDate == null
? [SizedBox()] ? [SizedBox()]
: [ : [
Row( Row(
@ -169,7 +186,7 @@ class _InspectionManageCardState extends State<InspectionManageCard> {
), ),
12.w.heightBox, 12.w.heightBox,
], ],
widget.cardModel?.actualEndDate == null widget?.cardModel?.actualEndDate == null
? SizedBox() ? SizedBox()
: Row( : Row(
children: [ children: [

@ -1,6 +1,8 @@
// Flutter imports: // Flutter imports:
import 'package:aku_community_manager/models/manager/inspection/inspection_detail_model.dart'; import 'package:aku_community_manager/models/manager/inspection/inspection_detail_model.dart';
import 'package:aku_community_manager/models/manager/inspection/inspection_point_model.dart';
import 'package:aku_community_manager/ui/sub_pages/manage_func.dart'; import 'package:aku_community_manager/ui/sub_pages/manage_func.dart';
import 'package:aku_ui/aku_ui.dart';
import 'package:common_utils/common_utils.dart'; import 'package:common_utils/common_utils.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -32,23 +34,25 @@ class _InspectionManageDetailsPageState
extends State<InspectionManageDetailsPage> { extends State<InspectionManageDetailsPage> {
TextStyle _textstyle = TextStyle _textstyle =
TextStyle(color: AppStyle.minorTextColor, fontSize: 28.sp); TextStyle(color: AppStyle.minorTextColor, fontSize: 28.sp);
Map<int, String> _inspectionStatus = { Map<int, String> _inspectionStatus = {1: '待巡检', 2: '已巡检', 3: '巡检中', 4: '未巡检'};
1: '待巡检',
2: '已巡检',
};
Color _inspectionColor(int status) { Color _inspectionColor(int status) {
switch (status) { switch (status) {
case 1: case 1:
return Color(0xFF4501); return Color(0xFFFF4501);
break; break;
case 2: case 2:
return Color(0x999999); return Color(0xFF999999);
case 3:
return Color(0xFFFF4501);
case 4:
return Color(0xFFFF4501);
default: default:
return Colors.black; return Colors.blue;
} }
} }
InspectionDetailModel _detailModel; InspectionDetailModel _detailModel;
List<InspectionPointModel> _pointModels;
bool _onload = true; bool _onload = true;
EasyRefreshController _refreshController; EasyRefreshController _refreshController;
@override @override
@ -74,8 +78,15 @@ class _InspectionManageDetailsPageState
body: EasyRefresh( body: EasyRefresh(
controller: _refreshController, controller: _refreshController,
firstRefresh: true, firstRefresh: true,
header:
MaterialHeader(valueColor: AlwaysStoppedAnimation(kPrimaryColor)),
onRefresh: () async { onRefresh: () async {
_detailModel = await ManageFunc.getInspectionDetail(widget.executeId); _detailModel =
await ManageFunc.getInspectionDetail(widget.executeId);
ManageFunc.getInspectionPoint(widget.executeId).then((value) {
_pointModels =
value.map((e) => InspectionPointModel.fromJson(e)).toList();
});
_onload = false; _onload = false;
setState(() {}); setState(() {});
}, },
@ -86,24 +97,29 @@ class _InspectionManageDetailsPageState
_inspectionHeadCard(), _inspectionHeadCard(),
16.w.heightBox, 16.w.heightBox,
Container( Container(
padding: padding: EdgeInsets.symmetric(
EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w), horizontal: 32.w, vertical: 24.w),
decoration: BoxDecoration(color: Color(0xFFFFFF)), decoration: BoxDecoration(color: Color(0xFFFFFFFF)),
width: double.infinity,
constraints: BoxConstraints(
minHeight: 85.w,
),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
'巡检站点'.text.black.size(32.sp).bold.make(), '巡检站点'.text.black.size(32.sp).bold.make(),
_buildInspectionTile(
'',
1,
1,
),
].sepWidget(separate: 16.w.heightBox), ].sepWidget(separate: 16.w.heightBox),
), ),
) )
], ],
), ),
), ),
); bottom: AkuButton(
onPressed: () {},
padding: EdgeInsets.symmetric(vertical: 26.w),
color: kPrimaryColor,
child: '开始巡检'.text.black.bold.size(32.sp).make(),
).pOnly(bottom: MediaQuery.of(context).padding.bottom));
} }
Widget _inspectionHeadCard() { Widget _inspectionHeadCard() {
@ -143,6 +159,7 @@ class _InspectionManageDetailsPageState
), ),
), ),
Row( Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Image.asset( Image.asset(
R.ASSETS_MANAGE_IC_RENWU_PNG, R.ASSETS_MANAGE_IC_RENWU_PNG,
@ -150,15 +167,22 @@ class _InspectionManageDetailsPageState
height: 40.w, height: 40.w,
), ),
4.w.widthBox, 4.w.widthBox,
Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text( Text(
'巡检名称', '巡检名称',
style: _textstyle, style: _textstyle,
), ),
Spacer(), ],
),
36.w.widthBox,
Text( Text(
_detailModel.name, _detailModel.name,
maxLines: 2,
textAlign: TextAlign.right,
style: AppStyle().primaryStyle, style: AppStyle().primaryStyle,
) ).expand()
], ],
), ),
12.w.heightBox, 12.w.heightBox,
@ -258,9 +282,10 @@ class _InspectionManageDetailsPageState
return Row( return Row(
children: [ children: [
CircleAvatar( CircleAvatar(
child: '$index'.text.color(Color(0x3F8FFE)).size(28.sp).bold.make(), child:
'$index'.text.color(Color(0xFF3F8FFE)).size(28.sp).bold.make(),
radius: 48.w, radius: 48.w,
backgroundColor: Color(0xE9F2FF), backgroundColor: Color(0xFFE9F2FF),
), ),
24.w.widthBox, 24.w.widthBox,
Column( Column(
@ -278,13 +303,14 @@ class _InspectionManageDetailsPageState
.make(), .make(),
14.w.widthBox, 14.w.widthBox,
Icon( Icon(
CupertinoIcons.chevron_right_circle, CupertinoIcons.chevron_right,
size: 14.w, size: 28.w,
color: Color(0xFF999999),
), ),
], ],
) )
.box .box
.color(Color(0xF9F9F9)) .color(Color(0xFFF9F9F9))
.withRounded(value: 4.w) .withRounded(value: 4.w)
.padding(EdgeInsets.all(24.w)) .padding(EdgeInsets.all(24.w))
.make() .make()

@ -63,7 +63,7 @@ class _InspectionManagePageState extends State<InspectionManagePage>
children: List.generate( children: List.generate(
_tabs.length, _tabs.length,
(index) => InspectionMangeView( (index) => InspectionMangeView(
inspectionStatus: index, inspectionStatus: index + 1,
), ),
), ),
), ),

@ -47,10 +47,11 @@ class _InspectionMangeViewState extends State<InspectionMangeView> {
itemBuilder: (context, index) { itemBuilder: (context, index) {
return InspectionManageCard(cardModel: items[index]); return InspectionManageCard(cardModel: items[index]);
}, },
separatorBuilder: (_, __) { separatorBuilder: (context, index) {
return 8.w.heightBox; return 8.w.heightBox;
}, },
itemCount: items.length); itemCount: items.length,
);
}, },
); );
} }

@ -1,6 +1,7 @@
import 'package:aku_community_manager/const/api.dart'; 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/decoration/decoration_detail_model.dart';
import 'package:aku_community_manager/models/manager/inspection/inspection_detail_model.dart'; import 'package:aku_community_manager/models/manager/inspection/inspection_detail_model.dart';
import 'package:aku_community_manager/models/manager/inspection/inspection_point_model.dart';
import 'package:aku_community_manager/utils/network/base_model.dart'; import 'package:aku_community_manager/utils/network/base_model.dart';
import 'package:aku_community_manager/utils/network/net_util.dart'; import 'package:aku_community_manager/utils/network/net_util.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
@ -33,4 +34,12 @@ class ManageFunc {
}); });
return InspectionDetailModel.fromJson(baseModel.data); return InspectionDetailModel.fromJson(baseModel.data);
} }
static Future<List> getInspectionPoint(int id) async {
BaseModel baseModel =
await NetUtil().get(API.manage.inspectionPointByPlanId, params: {
"planId": id,
});
return baseModel.data as List;
}
} }

Loading…
Cancel
Save