添加 未巡检状态

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

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

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

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

@ -1,8 +1,12 @@
// 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_point_model.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:bot_toast/bot_toast.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/cupertino.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 {
final int executeId;
final int inspectionStatus;
InspectionManageDetailsPage({
Key key,
@required this.executeId,
@required this.inspectionStatus,
}) : super(key: key);
@override
@ -83,23 +85,16 @@ class _InspectionManageDetailsPageState
onRefresh: () async {
_detailModel =
await ManageFunc.getInspectionDetail(widget.executeId);
await ManageFunc.getInspectionPoint(_detailModel.inspectionPlanId)
.then(
(value) {
if (value == null) {
_pointModels = [];
} else {
_pointModels = value
.map((e) => InspectionPointModel.fromJson(e))
.toList();
}
},
);
_pointModels = await (_detailModel.status == 1
? ManageFunc.getInspectionPointByPlanId(
planId: _detailModel.inspectionPlanId)
: ManageFunc.getInspectionPointByExcuteId(
excuteId: widget.executeId));
_onload = false;
setState(() {});
},
child: _onload
? SizedBox()
? _emptyWidget()
: Column(
children: [
_inspectionHeadCard(),
@ -127,17 +122,32 @@ class _InspectionManageDetailsPageState
],
),
),
bottom: AkuButton(
onPressed: () {},
padding: EdgeInsets.symmetric(vertical: 26.w),
color: kPrimaryColor,
child: (widget.inspectionStatus == 1 ? '开始巡检' : '立即扫码')
.text
.black
.bold
.size(32.sp)
.make(),
).pOnly(bottom: MediaQuery.of(context).padding.bottom));
bottom: (!_onload) &&
(_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),
color: kPrimaryColor,
child: (_detailModel.status == 1 ? '开始巡检' : '立即扫码')
.text
.black
.bold
.size(32.sp)
.make(),
).pOnly(bottom: MediaQuery.of(context).padding.bottom)
: SizedBox());
}
Widget _inspectionHeadCard() {
@ -167,9 +177,9 @@ class _InspectionManageDetailsPageState
fontWeight: FontWeight.bold),
),
Spacer(),
_inspectionStatus[widget.inspectionStatus]
_inspectionStatus[_detailModel.status]
.text
.color(_inspectionColor(widget.inspectionStatus))
.color(_inspectionColor(_detailModel.status))
.bold
.size(28.sp)
.make()
@ -313,11 +323,11 @@ class _InspectionManageDetailsPageState
],
),
Spacer(),
_inspectionStatus[widget.inspectionStatus]
_inspectionStatus[_detailModel.status]
.text
.size(24.sp)
.bold
.color(_inspectionColor(widget.inspectionStatus))
.color(_inspectionColor(_detailModel.status))
.make(),
14.w.widthBox,
Icon(

@ -31,9 +31,9 @@ class _InspectionManagePageState extends State<InspectionManagePage>
UserProvider _userProvider =
Provider.of<UserProvider>(context, listen: false);
if (_userProvider.infoModel.canOperation) {
return ['待巡检', '已巡检', '巡检中', '全部'];
return ['待巡检', '已巡检', '巡检中', '未巡检'];
} 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/net_util.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
class ManageFunc {
static Future<DecorationDetailModel> getDetcorationDetail(int id) async {
@ -35,11 +36,25 @@ class ManageFunc {
return InspectionDetailModel.fromJson(baseModel.data);
}
static Future<List> getInspectionPoint(int id) async {
static Future<List<InspectionPointModel>> getInspectionPointByPlanId(
{@required int planId}) async {
BaseModel baseModel =
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