修复了一些问题

对接:巡检管理:根据巡检计划主键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
String get inspectionFindDetailByld => '/user/inspection/findDetailById';
///id
String get inspectionPointByPlanId => '/user/inspection/findPointByPlanId';
}
class _Upload {

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

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

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

@ -43,14 +43,15 @@ class _InspectionMangeViewState extends State<InspectionMangeView> {
},
builder: (items) {
return ListView.separated(
padding: EdgeInsets.symmetric(horizontal: 32.w),
itemBuilder: (context, index) {
return InspectionManageCard(cardModel: items[index]);
},
separatorBuilder: (_, __) {
return 8.w.heightBox;
},
itemCount: items.length);
padding: EdgeInsets.symmetric(horizontal: 32.w),
itemBuilder: (context, index) {
return InspectionManageCard(cardModel: items[index]);
},
separatorBuilder: (context, index) {
return 8.w.heightBox;
},
itemCount: items.length,
);
},
);
}

@ -1,6 +1,7 @@
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/models/manager/inspection/inspection_point_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';
@ -33,4 +34,12 @@ class ManageFunc {
});
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