添加 验收记录/验收结果/提交验收/提交整改

hmxc
张萌 3 years ago
parent 2b5a699029
commit 57db1151a0

@ -366,6 +366,10 @@ class _Upload {
/// ///
String get engineerRepairComplete => String get engineerRepairComplete =>
'/user/upload/uploadButlerAppCompleteMaintenance'; '/user/upload/uploadButlerAppCompleteMaintenance';
///
String get engineerRepairAcceptance =>
'/user/upload/uploadButlerAppAcceptance';
} }
class _Message { class _Message {

@ -43,4 +43,18 @@ class _EngineerRepair {
///app id ///app id
String get repairResult => String get repairResult =>
'/user/repairEngineering/findNewResultByRepairEngineeringId'; '/user/repairEngineering/findNewResultByRepairEngineeringId';
///app
String get submitAcceptance => '/user/repairEngineering/submitAcceptance';
///app id()
String get acceptanceRecordNew =>
'/user/repairEngineering/findNewAcceptanceRecordByRepairEngineeringId';
///app id
String get acceptanceRecordList =>
'/user/repairEngineering/findAcceptanceRecordByRepairEngineeringId';
///app
String get startRectification => '/user/repairEngineering/startRectification';
} }

@ -0,0 +1,38 @@
import 'package:aku_community_manager/models/common/img_model.dart';
import 'package:json_annotation/json_annotation.dart';
part 'engineer_repair_new_acceptance_record_model.g.dart';
@JsonSerializable()
class EngineerRepairNewAcceptanceRecordModel {
final int id;
final int repairEngineeringId;
final String content;
final String billMaterials;
final List<ImgModel> maintenanceImgLists;
final String createName;
final String createDate;
final int results;
final String advice;
final String acceptancePeople;
final String acceptancePeopleName;
final String acceptanceDate;
final List<ImgModel> acceptanceImgLists;
factory EngineerRepairNewAcceptanceRecordModel.fromJson(
Map<String, dynamic> json) =>
_$EngineerRepairNewAcceptanceRecordModelFromJson(json);
EngineerRepairNewAcceptanceRecordModel(
this.id,
this.repairEngineeringId,
this.content,
this.billMaterials,
this.maintenanceImgLists,
this.createName,
this.createDate,
this.results,
this.advice,
this.acceptancePeople,
this.acceptancePeopleName,
this.acceptanceDate,
this.acceptanceImgLists);
}

@ -0,0 +1,31 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'engineer_repair_new_acceptance_record_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
EngineerRepairNewAcceptanceRecordModel
_$EngineerRepairNewAcceptanceRecordModelFromJson(
Map<String, dynamic> json) {
return EngineerRepairNewAcceptanceRecordModel(
json['id'] as int,
json['repairEngineeringId'] as int,
json['content'] as String,
json['billMaterials'] as String,
(json['maintenanceImgLists'] as List<dynamic>)
.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
json['createName'] as String,
json['createDate'] as String,
json['results'] as int,
json['advice'] as String,
json['acceptancePeople'] as String,
json['acceptancePeopleName'] as String,
json['acceptanceDate'] as String,
(json['acceptanceImgLists'] as List<dynamic>)
.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
);
}

@ -0,0 +1,27 @@
import 'package:aku_community_manager/models/common/img_model.dart';
import 'package:json_annotation/json_annotation.dart';
part 'engineer_repair_result_model.g.dart';
@JsonSerializable()
class EngineerRepairResultModel {
final int id;
final int repairEngineeringId;
final String content;
final String billMaterials;
final List<ImgModel> maintenanceImgLists;
final String createName;
final String createDate;
factory EngineerRepairResultModel.fromJson(Map<String, dynamic> json) =>
_$EngineerRepairResultModelFromJson(json);
EngineerRepairResultModel(
this.id,
this.repairEngineeringId,
this.content,
this.billMaterials,
this.maintenanceImgLists,
this.createName,
this.createDate);
}

@ -0,0 +1,22 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'engineer_repair_result_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
EngineerRepairResultModel _$EngineerRepairResultModelFromJson(
Map<String, dynamic> json) {
return EngineerRepairResultModel(
json['id'] as int,
json['repairEngineeringId'] as int,
json['content'] as String,
json['billMaterials'] as String,
(json['maintenanceImgLists'] as List<dynamic>)
.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
json['createName'] as String,
json['createDate'] as String,
);
}

@ -1,19 +1,34 @@
import 'dart:io';
import 'package:aku_community_manager/const/api.dart'; import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/const/resource.dart'; import 'package:aku_community_manager/const/resource.dart';
import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_detail_model.dart'; import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_detail_model.dart';
import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_new_acceptance_record_model.dart';
import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_result_model.dart';
import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/widget_tool.dart'; import 'package:aku_community_manager/tools/widget_tool.dart';
import 'package:aku_community_manager/ui/manage_pages/engineer_repair/engineer_repair_acceptance_record_list_page.dart';
import 'package:aku_community_manager/ui/manage_pages/engineer_repair/engineer_repair_func.dart';
import 'package:aku_community_manager/ui/widgets/app_widgets/aku_pick_image_widget.dart';
import 'package:aku_community_manager/ui/widgets/app_widgets/aku_single_check_button.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_community_manager/ui/widgets/inner/aku_bottom_button.dart';
import 'package:aku_community_manager/ui/widgets/inner/aku_title_box.dart'; import 'package:aku_community_manager/ui/widgets/inner/aku_title_box.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
import 'engineer_repair_map.dart'; import 'engineer_repair_map.dart';
class EngineerRepairAcceptancePage extends StatefulWidget { class EngineerRepairAcceptancePage extends StatefulWidget {
final EngineerRepairDetailModel detailModel; final EngineerRepairDetailModel detailModel;
const EngineerRepairAcceptancePage({Key? key, required this.detailModel}) final EngineerRepairResultModel resultModel;
const EngineerRepairAcceptancePage(
{Key? key, required this.detailModel, required this.resultModel})
: super(key: key); : super(key: key);
@override @override
@ -23,19 +38,145 @@ class EngineerRepairAcceptancePage extends StatefulWidget {
class _EngineerRepairAcceptancePageState class _EngineerRepairAcceptancePageState
extends State<EngineerRepairAcceptancePage> { extends State<EngineerRepairAcceptancePage> {
int _selectResult = 0;
String _reportDetail = '';
List<File> _files = [];
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AkuScaffold( return AkuScaffold(
title: '验收审核', title: '验收审核',
body: ListView( body: ListView(
children: [], children: [
_buildInfo(),
_buildCheckBox(),
],
),
bottom: AkuBottomButton(
title: '确认提交',
onTap: () async {
Function cancel = BotToast.showLoading();
List<String> urls = [];
urls = await EngineerRepairFunc.uploadAcceptanceImages(_files);
var result = await EngineerRepairFunc.submitAcceptance(
widget.resultModel.id,
widget.detailModel.id,
_selectResult,
_reportDetail,
urls);
cancel();
if (result) {
Get.back();
Get.back();
}
},
),
);
}
Widget _buildCheckBox() {
return AkuTitleBox(
title: '审核内容',
children: [
40.w.heightBox,
'审核结果'.text.size(28.sp).color(kTextPrimaryColor).make(),
16.w.heightBox,
Row(
children: [
AkuSingleCheckButton(
text: '工程维修',
value: 1,
gropValue: _selectResult,
onPressed: () {
_selectResult = 1;
setState(() {});
},
),
80.w.widthBox,
AkuSingleCheckButton(
text: '异常',
value: 2,
gropValue: _selectResult,
onPressed: () {
_selectResult = 2;
setState(() {});
},
), ),
],
),
40.w.heightBox,
'审核意见'.text.size(28.sp).color(kTextPrimaryColor).make(),
16.w.heightBox,
Container(
width: 686.w,
height: 300.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
border: Border.all(
width: 2.w,
color: Color(0xFFE8E8E8),
),
),
child: TextField(
minLines: 5,
maxLines: 10,
autofocus: false,
onChanged: (value) {
setState(() {
_reportDetail = value;
});
},
decoration: InputDecoration(
hintText: '请简要描述一下审核意见',
hintStyle: TextStyle(
fontSize: 28.sp,
color: kTextSubColor,
),
contentPadding:
EdgeInsets.symmetric(vertical: 16.w, horizontal: 24.w),
border: InputBorder.none,
isDense: true,
),
),
),
'上传到场验收照片'.text.size(28.sp).color(kTextPrimaryColor).make(),
16.w.heightBox,
AkuPickImageWidget(onChanged: (value) {
_files.clear();
_files.addAll(value);
setState(() {});
}),
16.w.heightBox,
GestureDetector(
onTap: () async {
List<EngineerRepairNewAcceptanceRecordModel> models = [];
models.addAll(await EngineerRepairFunc.getAcceptanceRecordList(
widget.detailModel.id));
await Get.to(
() => EngineerRepairAcceptanceRecordListPage(models: models));
},
child: Container(
color: Colors.white,
padding: EdgeInsets.all(32.w),
child: Row(
children: [
'查看验收记录'.text.size(28.sp).color(kTextPrimaryColor).make(),
Spacer(),
Icon(
CupertinoIcons.chevron_right,
size: 40.w,
)
],
),
),
)
],
); );
} }
_buildInfo() { _buildInfo() {
return AkuTitleBox( return AkuTitleBox(
title: '报修信息', title: '维修结果',
suffix: Text( suffix: Text(
ERMap.statusString(widget.detailModel.status), ERMap.statusString(widget.detailModel.status),
style: TextStyle(color: Color(0xFFFF4501)), style: TextStyle(color: Color(0xFFFF4501)),
@ -44,19 +185,19 @@ class _EngineerRepairAcceptancePageState
AkuBox.h(16), AkuBox.h(16),
_buildTile( _buildTile(
R.ASSETS_MESSAGE_IC_PEOPLE_PNG, R.ASSETS_MESSAGE_IC_PEOPLE_PNG,
'报修人', '处理描述',
widget.detailModel.createName, widget.resultModel.content,
), ),
_buildTile( _buildTile(
R.ASSETS_MESSAGE_IC_PHONE_PNG, R.ASSETS_MESSAGE_IC_PHONE_PNG,
'联系电话', '材料清单',
widget.detailModel.createTel, widget.resultModel.billMaterials,
), ),
_buildTile(R.ASSETS_MESSAGE_IC_AREA_PNG, '报修区域', _buildTile(R.ASSETS_MESSAGE_IC_AREA_PNG, '完成时间',
'${S.of(context)!.tempPlotName}'), widget.resultModel.createDate),
AkuBox.h(8), AkuBox.h(8),
Text( Text(
widget.detailModel.reportDetail, '现场照片',
style: TextStyle( style: TextStyle(
color: AppStyle.primaryTextColor, color: AppStyle.primaryTextColor,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -70,7 +211,7 @@ class _EngineerRepairAcceptancePageState
crossAxisSpacing: 16.w, crossAxisSpacing: 16.w,
mainAxisSpacing: 16.w, mainAxisSpacing: 16.w,
), ),
children: widget.detailModel.imgUrls.map((e) { children: widget.resultModel.maintenanceImgLists.map((e) {
return ClipRRect( return ClipRRect(
borderRadius: BorderRadius.circular(4.w), borderRadius: BorderRadius.circular(4.w),
child: FadeInImage.assetNetwork( child: FadeInImage.assetNetwork(

@ -0,0 +1,110 @@
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_new_acceptance_record_model.dart';
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
class EngineerRepairAcceptanceRecordListPage extends StatefulWidget {
final List<EngineerRepairNewAcceptanceRecordModel> models;
const EngineerRepairAcceptanceRecordListPage({Key? key, required this.models})
: super(key: key);
@override
_EngineerRepairAcceptanceRecordListPageState createState() =>
_EngineerRepairAcceptanceRecordListPageState();
}
class _EngineerRepairAcceptanceRecordListPageState
extends State<EngineerRepairAcceptanceRecordListPage> {
@override
Widget build(BuildContext context) {
return AkuScaffold(
title: '验收记录',
body: ListView(
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
children: widget.models
.mapIndexed(
(currentValue, index) => _buildCard(currentValue, index))
.toList(),
),
);
}
Widget _buildCard(EngineerRepairNewAcceptanceRecordModel model, index) {
return Container(
width: double.infinity,
color: Colors.white,
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
child: Column(
children: [
Row(
children: [
'${S.of(context)!.tempPlotName}'
.text
.size(32.sp)
.color(kTextPrimaryColor)
.make(),
Spacer(),
'${model.results == 1 ? '通过' : '驳回'}'
.text
.size(32.sp)
.color(Colors.red)
.make(),
],
),
40.w.heightBox,
Row(
children: [
'验收人'.text.size(28.sp).color(kTextSubColor).make(),
Spacer(),
model.acceptancePeopleName.text
.size(28.sp)
.color(kTextPrimaryColor)
.make(),
],
),
40.w.heightBox,
'现场情况'.text.size(28.sp).color(kTextSubColor).make(),
40.w.heightBox,
model.advice.text.size(28.sp).color(kTextPrimaryColor).make(),
40.w.heightBox,
'现场照片'.text.size(28.sp).color(kTextSubColor).make(),
24.w.heightBox,
GridView(
padding: EdgeInsets.only(top: 16.w),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
crossAxisSpacing: 16.w,
mainAxisSpacing: 16.w,
),
children: model.acceptanceImgLists.map((e) {
return ClipRRect(
borderRadius: BorderRadius.circular(4.w),
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_PLACEHOLDER_WEBP,
image: API.image(e.url!)),
);
}).toList(),
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
),
40.w.heightBox,
Row(
children: [
'反馈时间'.text.size(28.sp).color(kTextSubColor).make(),
Spacer(),
model.acceptanceDate.text
.size(28.sp)
.color(kTextPrimaryColor)
.make(),
],
),
],
),
);
}
}

@ -0,0 +1,223 @@
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/const/resource.dart';
import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_new_acceptance_record_model.dart';
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/widget_tool.dart';
import 'package:aku_community_manager/ui/manage_pages/engineer_repair/engineer_repair_acceptance_record_list_page.dart';
import 'package:aku_community_manager/ui/manage_pages/engineer_repair/engineer_repair_func.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_community_manager/ui/widgets/inner/aku_bottom_button.dart';
import 'package:aku_community_manager/ui/widgets/inner/aku_title_box.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
class EngineerRepairAcceptanceResultPage extends StatefulWidget {
final EngineerRepairNewAcceptanceRecordModel recordModel;
const EngineerRepairAcceptanceResultPage(
{Key? key, required this.recordModel})
: super(key: key);
@override
_EngineerRepairAcceptanceResultPageState createState() =>
_EngineerRepairAcceptanceResultPageState();
}
class _EngineerRepairAcceptanceResultPageState
extends State<EngineerRepairAcceptanceResultPage> {
@override
Widget build(BuildContext context) {
return AkuScaffold(
title: '验收结果',
body: ListView(
children: [
_buildAcceptanceResult(),
16.w.heightBox,
_buildRepairResult(),
16.w.heightBox,
GestureDetector(
onTap: () async {
List<EngineerRepairNewAcceptanceRecordModel> models = [];
models.addAll(await EngineerRepairFunc.getAcceptanceRecordList(
widget.recordModel.repairEngineeringId));
await Get.to(
() => EngineerRepairAcceptanceRecordListPage(models: models));
},
child: Container(
color: Colors.white,
padding: EdgeInsets.all(32.w),
child: Row(
children: [
'查看验收记录'.text.size(28.sp).color(kTextPrimaryColor).make(),
Spacer(),
Icon(
CupertinoIcons.chevron_right,
size: 40.w,
)
],
),
),
)
],
),
bottom: widget.recordModel.results == 1
? SizedBox()
: AkuBottomButton(
title: '开始整改',
onTap: () async {
var result = await EngineerRepairFunc.startRectification(
widget.recordModel.repairEngineeringId);
if (result) {
Get.back();
Get.back();
}
},
),
);
}
_buildAcceptanceResult() {
return Container(
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
width: double.infinity,
color: Colors.white,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'验收单位'.text.size(28.sp).color(kTextSubColor).make(),
24.w.heightBox,
'${widget.recordModel.acceptancePeopleName}'
.text
.size(32.sp)
.color(kTextPrimaryColor)
.bold
.make(),
40.w.heightBox,
'验收结果'.text.size(28.sp).color(kTextSubColor).make(),
24.w.heightBox,
'${widget.recordModel.results == 1 ? '通过' : '驳回'}'
.text
.size(32.sp)
.color(Colors.red)
.bold
.make(),
40.w.heightBox,
'反馈意见'.text.size(28.sp).color(kTextSubColor).make(),
24.w.heightBox,
widget.recordModel.advice.text
.size(28.sp)
.color(kTextPrimaryColor)
.make(),
40.w.heightBox,
'到现场验收照片'.text.size(28.sp).color(kTextSubColor).make(),
24.w.heightBox,
GridView(
padding: EdgeInsets.only(top: 16.w),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
crossAxisSpacing: 16.w,
mainAxisSpacing: 16.w,
),
children: widget.recordModel.acceptanceImgLists.map((e) {
return ClipRRect(
borderRadius: BorderRadius.circular(4.w),
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_PLACEHOLDER_WEBP,
image: API.image(e.url!)),
);
}).toList(),
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
),
40.w.heightBox,
'反馈时间'.text.size(28.sp).color(kTextSubColor).make(),
24.w.heightBox,
widget.recordModel.acceptanceDate.text
.size(28.sp)
.color(kTextPrimaryColor)
.make(),
],
),
);
}
_buildRepairResult() {
return AkuTitleBox(
title: '维修结果',
children: [
AkuBox.h(16),
_buildTile(
R.ASSETS_MESSAGE_IC_PEOPLE_PNG,
'处理描述',
widget.recordModel.content,
),
_buildTile(
R.ASSETS_MESSAGE_IC_PHONE_PNG,
'材料清单',
widget.recordModel.billMaterials,
),
_buildTile(R.ASSETS_MESSAGE_IC_AREA_PNG, '完成时间',
widget.recordModel.createDate),
AkuBox.h(8),
Text(
'现场照片',
style: TextStyle(
color: AppStyle.primaryTextColor,
fontWeight: FontWeight.bold,
fontSize: 28.w,
),
),
GridView(
padding: EdgeInsets.only(top: 16.w),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
crossAxisSpacing: 16.w,
mainAxisSpacing: 16.w,
),
children: widget.recordModel.maintenanceImgLists.map((e) {
return ClipRRect(
borderRadius: BorderRadius.circular(4.w),
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_PLACEHOLDER_WEBP,
image: API.image(e.url!)),
);
}).toList(),
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
),
],
);
}
Widget _buildTile(String asset, String title, String subTitle) {
return Row(
children: [
AkuBox.h(56),
Image.asset(
asset,
height: 40.w,
width: 40.w,
),
AkuBox.w(4),
Text(
title,
style: TextStyle(
fontSize: 28.sp,
color: AppStyle.minorTextColor,
),
),
Spacer(),
Text(
subTitle,
style: TextStyle(
fontSize: 28.sp,
color: AppStyle.primaryTextColor,
),
),
],
);
}
}

@ -86,6 +86,7 @@ class _EngineerRepairCompletePageState
urls = await EngineerRepairFunc.uploadCompleteImages(_files); urls = await EngineerRepairFunc.uploadCompleteImages(_files);
var result = await EngineerRepairFunc.complete(widget.detailModel.id, var result = await EngineerRepairFunc.complete(widget.detailModel.id,
_reportDetailController.text, _materialController.text, urls); _reportDetailController.text, _materialController.text, urls);
cancel();
if (result) { if (result) {
Get.back(); Get.back();
Get.back(); Get.back();

@ -35,6 +35,7 @@ class _EngineerRepairDepartCompanyState
firstRefresh: true, firstRefresh: true,
header: MaterialHeader(), header: MaterialHeader(),
onRefresh: () async { onRefresh: () async {
_models.clear();
_models.addAll(await EngineerRepairFunc.getOrganization()); _models.addAll(await EngineerRepairFunc.getOrganization());
_onLoad = false; _onLoad = false;
setState(() {}); setState(() {});

@ -1,12 +1,17 @@
import 'package:aku_community_manager/const/api.dart'; import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/const/resource.dart'; import 'package:aku_community_manager/const/resource.dart';
import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_detail_model.dart'; import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_detail_model.dart';
import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_new_acceptance_record_model.dart';
import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_process_model.dart'; import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_process_model.dart';
import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_result_model.dart';
import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_work_report_model.dart'; import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_work_report_model.dart';
import 'package:aku_community_manager/models/user/user_info_model.dart'; import 'package:aku_community_manager/models/user/user_info_model.dart';
import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/user_tool.dart'; import 'package:aku_community_manager/tools/user_tool.dart';
import 'package:aku_community_manager/tools/widget_tool.dart'; import 'package:aku_community_manager/tools/widget_tool.dart';
import 'package:aku_community_manager/ui/manage_pages/engineer_repair/engineer_repair_acceptance_page.dart';
import 'package:aku_community_manager/ui/manage_pages/engineer_repair/engineer_repair_acceptance_record_list_page.dart';
import 'package:aku_community_manager/ui/manage_pages/engineer_repair/engineer_repair_acceptance_result_page.dart';
import 'package:aku_community_manager/ui/manage_pages/engineer_repair/engineer_repair_complete_page.dart'; import 'package:aku_community_manager/ui/manage_pages/engineer_repair/engineer_repair_complete_page.dart';
import 'package:aku_community_manager/ui/manage_pages/engineer_repair/engineer_repair_depart_company_page.dart'; import 'package:aku_community_manager/ui/manage_pages/engineer_repair/engineer_repair_depart_company_page.dart';
import 'package:aku_community_manager/ui/manage_pages/engineer_repair/engineer_repair_depart_person_page.dart'; import 'package:aku_community_manager/ui/manage_pages/engineer_repair/engineer_repair_depart_person_page.dart';
@ -60,6 +65,8 @@ class _EngineerRepairDetailPageState extends State<EngineerRepairDetailPage> {
onRefresh: () async { onRefresh: () async {
_model = await EngineerRepairFunc.getEngineerRepairDetail( _model = await EngineerRepairFunc.getEngineerRepairDetail(
widget.repairEngineerId); widget.repairEngineerId);
_processModels.clear();
_reportModels.clear();
_processModels.addAll( _processModels.addAll(
await EngineerRepairFunc.getProcess(widget.repairEngineerId)); await EngineerRepairFunc.getProcess(widget.repairEngineerId));
_reportModels.addAll( _reportModels.addAll(
@ -78,13 +85,18 @@ class _EngineerRepairDetailPageState extends State<EngineerRepairDetailPage> {
children: [ children: [
_buildInfo(), _buildInfo(),
16.w.heightBox, 16.w.heightBox,
if (_model!.maintenanceStaff != null) _buildOperator(), if (_model?.maintenanceStaff != null) _buildOperator(),
if (_model!.organizationId != null) _buildOrganization(), if (_model?.organizationId != null) _buildOrganization(),
if (_processModels.isNotEmpty) _buildProcess(), if (_processModels.isNotEmpty) _buildProcess(),
if (_reportModels.isNotEmpty) _buildReport(), if (_reportModels.isNotEmpty) _buildReport(),
GestureDetector( GestureDetector(
onTap: () { onTap: () async {
// TODO: List<EngineerRepairNewAcceptanceRecordModel> models = [];
models.addAll(
await EngineerRepairFunc.getAcceptanceRecordList(
widget.repairEngineerId));
await Get.to(() => EngineerRepairAcceptanceRecordListPage(
models: models));
}, },
child: Container( child: Container(
color: Colors.white, color: Colors.white,
@ -116,15 +128,22 @@ class _EngineerRepairDetailPageState extends State<EngineerRepairDetailPage> {
if (_model != null) { if (_model != null) {
switch (_model!.status) { switch (_model!.status) {
case 1: case 1:
return AkuBottomButton( return UserTool.userProvider.infoModel!.engineeringRepairAuthority ==
ERAUTH.SENDTOCOMPANY
? AkuBottomButton(
title: '立即派单', title: '立即派单',
onTap: () async { onTap: () async {
await Get.off(EngineerRepairDepartCompany( await Get.off(EngineerRepairDepartCompany(
repairId: widget.repairEngineerId)); repairId: widget.repairEngineerId));
}, },
); )
: SizedBox();
case 2: case 2:
return AkuBottomButton( print(UserTool.userProvider.infoModel!.engineeringRepairAuthority ==
ERAUTH.SENDTOPERSON);
return UserTool.userProvider.infoModel!.engineeringRepairAuthority ==
ERAUTH.SENDTOPERSON
? AkuBottomButton(
title: '立即派单', title: '立即派单',
onTap: () async { onTap: () async {
await Get.off(EngineerRepairDepartPersonPage( await Get.off(EngineerRepairDepartPersonPage(
@ -132,56 +151,83 @@ class _EngineerRepairDetailPageState extends State<EngineerRepairDetailPage> {
organizationName: _model!.organizationName!, organizationName: _model!.organizationName!,
repairId: _model!.id)); repairId: _model!.id));
}, },
); )
: SizedBox();
case 3: case 3:
return AkuBottomButton( return UserTool.userProvider.infoModel!.engineeringRepairAuthority ==
ERAUTH.PICK
? AkuBottomButton(
title: '立即接单', title: '立即接单',
onTap: () async { onTap: () async {
var result = await EngineerRepairFunc.personPick(_model!.id); var result =
await EngineerRepairFunc.personPick(_model!.id);
if (result) { if (result) {
Get.back(); Get.back();
} }
}, },
); )
: SizedBox();
case 4: case 4:
return Row( return UserTool.userProvider.infoModel!.engineeringRepairAuthority ==
ERAUTH.PICK
? Row(
children: [ children: [
AkuMaterialButton( AkuMaterialButton(
minWidth: 287.w, minWidth: 287.w,
onPressed: () async { onPressed: () async {
await Get.to( await Get.to(() =>
() => EngineerRepairCompletePage(detailModel: _model!)); EngineerRepairCompletePage(detailModel: _model!));
}, },
color: Colors.black, color: Colors.black,
child: '维修完成'.text.size(32.sp).color(Colors.white).make()), child:
'维修完成'.text.size(32.sp).color(Colors.white).make()),
AkuMaterialButton( AkuMaterialButton(
color: kPrimaryColor, color: kPrimaryColor,
onPressed: () async { onPressed: () async {
await Get.to( await Get.to(() =>
() => EngineerRepairReportPage(repairId: _model!.id)); EngineerRepairReportPage(repairId: _model!.id));
}, },
child: '汇报进度'.text.size(32.sp).color(Colors.black).make()), child:
'汇报进度'.text.size(32.sp).color(Colors.black).make()),
], ],
); )
: SizedBox();
case 5: case 5:
return UserTool.userProvider.infoModel!.engineeringRepairAuthority == return UserTool.userProvider.infoModel!.engineeringRepairAuthority ==
ERAUTH.SENDTOCOMPANY ERAUTH.SENDTOCOMPANY
? AkuMaterialButton( ? AkuMaterialButton(
color: kPrimaryColor, color: kPrimaryColor,
onPressed: () async { onPressed: () async {
await Get.to( EngineerRepairResultModel? resultModel =
() => EngineerRepairReportPage(repairId: _model!.id)); await EngineerRepairFunc.getRepairResult(
widget.repairEngineerId);
if (resultModel != null) {
await Get.to(() => EngineerRepairAcceptancePage(
resultModel: resultModel,
detailModel: _model!,
));
}
}, },
child: '验收审核'.text.size(32.sp).color(Colors.black).make()) child: '验收审核'.text.size(32.sp).color(Colors.black).make())
: SizedBox(); : SizedBox();
case 6: case 6:
return AkuMaterialButton( return UserTool.userProvider.infoModel!.engineeringRepairAuthority ==
ERAUTH.PICK
? AkuMaterialButton(
color: kPrimaryColor, color: kPrimaryColor,
onPressed: () async { onPressed: () async {
await Get.to( EngineerRepairNewAcceptanceRecordModel?
() => EngineerRepairReportPage(repairId: _model!.id)); acceptanceRecordModel =
await EngineerRepairFunc.getAcceptanceRecord(
widget.repairEngineerId);
if (acceptanceRecordModel != null) {
await Get.to(() => EngineerRepairAcceptanceResultPage(
recordModel: acceptanceRecordModel,
));
}
}, },
child: '验收结果'.text.size(32.sp).color(Colors.black).make()); child: '验收结果'.text.size(32.sp).color(Colors.black).make())
: SizedBox();
default: default:
return SizedBox(); return SizedBox();
} }
@ -292,10 +338,10 @@ class _EngineerRepairDetailPageState extends State<EngineerRepairDetailPage> {
R.ASSETS_MESSAGE_IC_PEOPLE_PNG, '维修单位', _model!.organizationName!), R.ASSETS_MESSAGE_IC_PEOPLE_PNG, '维修单位', _model!.organizationName!),
16.w.heightBox, 16.w.heightBox,
_buildTile(R.ASSETS_MESSAGE_IC_PEOPLE_PNG, '主要负责人', _buildTile(R.ASSETS_MESSAGE_IC_PEOPLE_PNG, '主要负责人',
_model!.organizationLeadingName!), _model!.organizationLeadingName ?? ''),
16.w.heightBox, 16.w.heightBox,
_buildTile(R.ASSETS_MESSAGE_IC_PHONE_PNG, '联系电话', _buildTile(R.ASSETS_MESSAGE_IC_PHONE_PNG, '联系电话',
_model!.organizationLeadingTel!) _model!.organizationLeadingTel ?? '')
], ],
).pOnly(bottom: 16.w); ).pOnly(bottom: 16.w);
} }

@ -2,9 +2,11 @@ import 'dart:io';
import 'package:aku_community_manager/const/api.dart'; import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_detail_model.dart'; import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_detail_model.dart';
import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_new_acceptance_record_model.dart';
import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_organization_model.dart'; import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_organization_model.dart';
import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_person_model.dart'; import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_person_model.dart';
import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_process_model.dart'; import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_process_model.dart';
import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_result_model.dart';
import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_work_report_model.dart'; import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_work_report_model.dart';
import 'package:aku_community_manager/utils/network/net_util.dart'; import 'package:aku_community_manager/utils/network/net_util.dart';
@ -144,4 +146,69 @@ class EngineerRepairFunc {
await NetUtil().uploadFiles(files, API.upload.engineerRepairComplete); await NetUtil().uploadFiles(files, API.upload.engineerRepairComplete);
return model; return model;
} }
static Future getRepairResult(int repairId) async {
var model = await NetUtil().get(API.engineerRepair.repairResult, params: {
'repairEngineeringId': repairId,
});
if (model.status ?? false) {
return EngineerRepairResultModel.fromJson(model.data);
} else {
return null;
}
}
static Future submitAcceptance(int id, int repairId, int result,
String advice, List<String> urls) async {
var model =
await NetUtil().post(API.engineerRepair.submitAcceptance, params: {
'id': id,
'repairEngineeringId': repairId,
'results': result,
'advice': advice,
'acceptanceImgUrls': urls,
});
return model.status ?? false;
}
static Future uploadAcceptanceImages(List<File> files) async {
var model =
await NetUtil().uploadFiles(files, API.upload.engineerRepairAcceptance);
return model;
}
static Future getAcceptanceRecord(int repairId) async {
var model =
await NetUtil().get(API.engineerRepair.acceptanceRecordNew, params: {
'repairEngineeringId': repairId,
});
if (model.status ?? false) {
return EngineerRepairNewAcceptanceRecordModel.fromJson(model.data);
} else {
return null;
}
}
static Future<List<EngineerRepairNewAcceptanceRecordModel>>
getAcceptanceRecordList(int repairId) async {
var model =
await NetUtil().get(API.engineerRepair.acceptanceRecordList, params: {
'repairEngineeringId': repairId,
});
if (model.status ?? false) {
return (model.data as List)
.map((e) => EngineerRepairNewAcceptanceRecordModel.fromJson(e))
.toList();
} else {
return [];
}
}
static Future startRectification(int repairId) async {
var model =
await NetUtil().post(API.engineerRepair.startRectification, params: {
'id': repairId,
});
return model.status ?? false;
}
} }

Loading…
Cancel
Save