添加 未巡检状态

对接:开始巡检
对接:巡检管理:根据巡检执行情况主键id查询巡检点部分信息(开始巡检后调用)
hmxc
张萌 4 years ago
parent e743c55541
commit 496e0edee4

@ -146,6 +146,13 @@ class _Manage {
///id ///id
String get inspectionPointByPlanId => '/user/inspection/findPointByPlanId'; String get inspectionPointByPlanId => '/user/inspection/findPointByPlanId';
///
String get inspectionStart => '/user/inspection/startInspection';
///id
String get inspecntionFindPointByExecuteId =>
'/user/inspection/findPointByExecuteId';
} }
class _Upload { class _Upload {

@ -7,6 +7,8 @@ class InspectionDetailModel {
String endDate; String endDate;
String actualBeginDate; String actualBeginDate;
String actualEndDate; String actualEndDate;
int sort;
int status;
InspectionDetailModel( InspectionDetailModel(
{this.id, {this.id,
@ -16,7 +18,9 @@ class InspectionDetailModel {
this.beginDate, this.beginDate,
this.endDate, this.endDate,
this.actualBeginDate, this.actualBeginDate,
this.actualEndDate}); this.actualEndDate,
this.sort,
this.status});
InspectionDetailModel.fromJson(Map<String, dynamic> json) { InspectionDetailModel.fromJson(Map<String, dynamic> json) {
id = json['id']; id = json['id'];
@ -27,6 +31,8 @@ class InspectionDetailModel {
endDate = json['endDate']; endDate = json['endDate'];
actualBeginDate = json['actualBeginDate']; actualBeginDate = json['actualBeginDate'];
actualEndDate = json['actualEndDate']; actualEndDate = json['actualEndDate'];
sort = json['sort'];
status = json['status'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -39,6 +45,8 @@ class InspectionDetailModel {
data['endDate'] = this.endDate; data['endDate'] = this.endDate;
data['actualBeginDate'] = this.actualBeginDate; data['actualBeginDate'] = this.actualBeginDate;
data['actualEndDate'] = this.actualEndDate; data['actualEndDate'] = this.actualEndDate;
data['sort'] = this.sort;
data['status'] = this.status;
return data; return data;
} }
} }

@ -51,7 +51,6 @@ class _InspectionManageCardState extends State<InspectionManageCard> {
onPressed: () { onPressed: () {
Get.to( Get.to(
InspectionManageDetailsPage( InspectionManageDetailsPage(
inspectionStatus: widget.cardModel.status,
executeId: widget.cardModel.id, executeId: widget.cardModel.id,
), ),
); );

@ -1,8 +1,12 @@
// Flutter imports: // Flutter imports:
import 'package:aku_community_manager/const/api.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/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_community_manager/utils/network/base_model.dart';
import 'package:aku_community_manager/utils/network/net_util.dart';
import 'package:aku_ui/aku_ui.dart'; import 'package:aku_ui/aku_ui.dart';
import 'package:bot_toast/bot_toast.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';
@ -18,11 +22,9 @@ import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
class InspectionManageDetailsPage extends StatefulWidget { class InspectionManageDetailsPage extends StatefulWidget {
final int executeId; final int executeId;
final int inspectionStatus;
InspectionManageDetailsPage({ InspectionManageDetailsPage({
Key key, Key key,
@required this.executeId, @required this.executeId,
@required this.inspectionStatus,
}) : super(key: key); }) : super(key: key);
@override @override
@ -83,23 +85,16 @@ class _InspectionManageDetailsPageState
onRefresh: () async { onRefresh: () async {
_detailModel = _detailModel =
await ManageFunc.getInspectionDetail(widget.executeId); await ManageFunc.getInspectionDetail(widget.executeId);
await ManageFunc.getInspectionPoint(_detailModel.inspectionPlanId) _pointModels = await (_detailModel.status == 1
.then( ? ManageFunc.getInspectionPointByPlanId(
(value) { planId: _detailModel.inspectionPlanId)
if (value == null) { : ManageFunc.getInspectionPointByExcuteId(
_pointModels = []; excuteId: widget.executeId));
} else {
_pointModels = value
.map((e) => InspectionPointModel.fromJson(e))
.toList();
}
},
);
_onload = false; _onload = false;
setState(() {}); setState(() {});
}, },
child: _onload child: _onload
? SizedBox() ? _emptyWidget()
: Column( : Column(
children: [ children: [
_inspectionHeadCard(), _inspectionHeadCard(),
@ -127,17 +122,32 @@ class _InspectionManageDetailsPageState
], ],
), ),
), ),
bottom: AkuButton( bottom: (!_onload) &&
onPressed: () {}, (_detailModel.status != 2) &&
(_detailModel.status != 4)
? AkuButton(
onPressed: _detailModel.status == 1
? () async {
BaseModel _baseModel = await NetUtil().get(
API.manage.inspectionStart,
params: {"executeId": widget.executeId});
if (_baseModel.status) {
setState(() {});
} else {
BotToast.showText(text: _baseModel.message);
}
}
: () {},
padding: EdgeInsets.symmetric(vertical: 26.w), padding: EdgeInsets.symmetric(vertical: 26.w),
color: kPrimaryColor, color: kPrimaryColor,
child: (widget.inspectionStatus == 1 ? '开始巡检' : '立即扫码') child: (_detailModel.status == 1 ? '开始巡检' : '立即扫码')
.text .text
.black .black
.bold .bold
.size(32.sp) .size(32.sp)
.make(), .make(),
).pOnly(bottom: MediaQuery.of(context).padding.bottom)); ).pOnly(bottom: MediaQuery.of(context).padding.bottom)
: SizedBox());
} }
Widget _inspectionHeadCard() { Widget _inspectionHeadCard() {
@ -167,9 +177,9 @@ class _InspectionManageDetailsPageState
fontWeight: FontWeight.bold), fontWeight: FontWeight.bold),
), ),
Spacer(), Spacer(),
_inspectionStatus[widget.inspectionStatus] _inspectionStatus[_detailModel.status]
.text .text
.color(_inspectionColor(widget.inspectionStatus)) .color(_inspectionColor(_detailModel.status))
.bold .bold
.size(28.sp) .size(28.sp)
.make() .make()
@ -313,11 +323,11 @@ class _InspectionManageDetailsPageState
], ],
), ),
Spacer(), Spacer(),
_inspectionStatus[widget.inspectionStatus] _inspectionStatus[_detailModel.status]
.text .text
.size(24.sp) .size(24.sp)
.bold .bold
.color(_inspectionColor(widget.inspectionStatus)) .color(_inspectionColor(_detailModel.status))
.make(), .make(),
14.w.widthBox, 14.w.widthBox,
Icon( Icon(

@ -31,9 +31,9 @@ class _InspectionManagePageState extends State<InspectionManagePage>
UserProvider _userProvider = UserProvider _userProvider =
Provider.of<UserProvider>(context, listen: false); Provider.of<UserProvider>(context, listen: false);
if (_userProvider.infoModel.canOperation) { if (_userProvider.infoModel.canOperation) {
return ['待巡检', '已巡检', '巡检中', '全部']; return ['待巡检', '已巡检', '巡检中', '未巡检'];
} else { } else {
return ['待巡检', '已巡检', '巡检中', '全部']; return ['待巡检', '已巡检', '巡检中', '未巡检'];
} }
} }

@ -5,6 +5,7 @@ import 'package:aku_community_manager/models/manager/inspection/inspection_point
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';
import 'package:flutter/material.dart';
class ManageFunc { class ManageFunc {
static Future<DecorationDetailModel> getDetcorationDetail(int id) async { static Future<DecorationDetailModel> getDetcorationDetail(int id) async {
@ -35,11 +36,25 @@ class ManageFunc {
return InspectionDetailModel.fromJson(baseModel.data); return InspectionDetailModel.fromJson(baseModel.data);
} }
static Future<List> getInspectionPoint(int id) async { static Future<List<InspectionPointModel>> getInspectionPointByPlanId(
{@required int planId}) async {
BaseModel baseModel = BaseModel baseModel =
await NetUtil().get(API.manage.inspectionPointByPlanId, params: { await NetUtil().get(API.manage.inspectionPointByPlanId, params: {
"planId": id, "planId": planId,
}); });
return baseModel.data as List; return (baseModel.data as List)
.map((e) => InspectionPointModel.fromJson(e))
.toList();
}
static Future<List<InspectionPointModel>> getInspectionPointByExcuteId(
{@required int excuteId}) async {
BaseModel baseModel = await NetUtil()
.get(API.manage.inspecntionFindPointByExecuteId, params: {
"planId": excuteId,
});
return (baseModel.data as List)
.map((e) => InspectionPointModel.fromJson(e))
.toList();
} }
} }

Loading…
Cancel
Save