添加工程维修 /工作汇报/维修完成

hmxc
张萌 3 years ago
parent 7f94ba8d90
commit 0167be1542

@ -358,6 +358,14 @@ class _Upload {
///
String get uploadEngineerRepair =>
'/user/upload/uploadButlerAppEngineeringRepair';
///
String get uploadEngineerRepairReport =>
'/user/upload/uploadButlerAppWorkReport';
///
String get engineerRepairComplete =>
'/user/upload/uploadButlerAppCompleteMaintenance';
}
class _Message {

@ -33,4 +33,14 @@ class _EngineerRepair {
///app
String get personPick => '/user/repairEngineering/maintenanceStaffPickSingle';
///app
String get submitReport => '/user/repairEngineering/submitReport';
///app 2021-08-09 15:56:12
String get complete => '/user/repairEngineering/completeMaintenance';
///app id
String get repairResult =>
'/user/repairEngineering/findNewResultByRepairEngineeringId';
}

@ -0,0 +1,116 @@
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_detail_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/widgets/common/aku_scaffold.dart';
import 'package:aku_community_manager/ui/widgets/inner/aku_title_box.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'engineer_repair_map.dart';
class EngineerRepairAcceptancePage extends StatefulWidget {
final EngineerRepairDetailModel detailModel;
const EngineerRepairAcceptancePage({Key? key, required this.detailModel})
: super(key: key);
@override
_EngineerRepairAcceptancePageState createState() =>
_EngineerRepairAcceptancePageState();
}
class _EngineerRepairAcceptancePageState
extends State<EngineerRepairAcceptancePage> {
@override
Widget build(BuildContext context) {
return AkuScaffold(
title: '验收审核',
body: ListView(
children: [],
),
);
}
_buildInfo() {
return AkuTitleBox(
title: '报修信息',
suffix: Text(
ERMap.statusString(widget.detailModel.status),
style: TextStyle(color: Color(0xFFFF4501)),
),
children: [
AkuBox.h(16),
_buildTile(
R.ASSETS_MESSAGE_IC_PEOPLE_PNG,
'报修人',
widget.detailModel.createName,
),
_buildTile(
R.ASSETS_MESSAGE_IC_PHONE_PNG,
'联系电话',
widget.detailModel.createTel,
),
_buildTile(R.ASSETS_MESSAGE_IC_AREA_PNG, '报修区域',
'${S.of(context)!.tempPlotName}'),
AkuBox.h(8),
Text(
widget.detailModel.reportDetail,
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.detailModel.imgUrls.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,
),
),
],
);
}
}

@ -0,0 +1,211 @@
import 'dart:io';
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_detail_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_func.dart';
import 'package:aku_community_manager/ui/manage_pages/engineer_repair/engineer_repair_map.dart';
import 'package:aku_community_manager/ui/widgets/app_widgets/aku_pick_image_widget.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:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
class EngineerRepairCompletePage extends StatefulWidget {
final EngineerRepairDetailModel detailModel;
const EngineerRepairCompletePage({Key? key, required this.detailModel})
: super(key: key);
@override
_EngineerRepairCompletePageState createState() =>
_EngineerRepairCompletePageState();
}
class _EngineerRepairCompletePageState
extends State<EngineerRepairCompletePage> {
TextEditingController _reportDetailController = TextEditingController();
TextEditingController _materialController = TextEditingController();
List<File> _files = [];
@override
void dispose() {
_materialController.dispose();
_reportDetailController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return AkuScaffold(
title: '维修完成',
body: ListView(
padding: EdgeInsets.symmetric(vertical: 16.w),
children: [
_buildInfo(),
16.w.heightBox,
Container(
width: double.infinity,
color: Colors.white,
child: Column(
children: [
'维修结果'.text.size(36.sp).color(kTextPrimaryColor).make(),
40.w.heightBox,
'处理描述'.text.size(28.sp).color(kTextPrimaryColor).make(),
24.w.heightBox,
_buildTextField(_reportDetailController),
24.w.heightBox,
'材料清单'.text.size(28.sp).color(kTextPrimaryColor).make(),
24.w.heightBox,
_buildTextField(_materialController),
40.w.heightBox,
'上传维修完成照片'.text.size(28.sp).color(kTextPrimaryColor).make(),
24.w.heightBox,
AkuPickImageWidget(onChanged: (value) {
_files.clear();
_files.addAll(value);
setState(() {});
}),
],
),
),
],
),
bottom: AkuBottomButton(
title: '立即提交',
onTap: () async {
Function cancel = BotToast.showLoading();
List<String> urls = [];
urls = await EngineerRepairFunc.uploadCompleteImages(_files);
var result = await EngineerRepairFunc.complete(widget.detailModel.id,
_reportDetailController.text, _materialController.text, urls);
if (result) {
Get.back();
Get.back();
}
},
),
);
}
Widget _buildTextField(TextEditingController controller) {
return 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(() {});
},
decoration: InputDecoration(
hintText: '请简要描述一下维修结果',
hintStyle: TextStyle(
fontSize: 28.sp,
color: kTextSubColor,
),
contentPadding:
EdgeInsets.symmetric(vertical: 16.w, horizontal: 24.w),
border: InputBorder.none,
isDense: true,
),
),
);
}
_buildInfo() {
return AkuTitleBox(
title: '报修信息',
suffix: Text(
ERMap.statusString(widget.detailModel.status),
style: TextStyle(color: Color(0xFFFF4501)),
),
children: [
AkuBox.h(16),
_buildTile(
R.ASSETS_MESSAGE_IC_PEOPLE_PNG,
'报修人',
widget.detailModel.createName,
),
_buildTile(
R.ASSETS_MESSAGE_IC_PHONE_PNG,
'联系电话',
widget.detailModel.createTel,
),
_buildTile(R.ASSETS_MESSAGE_IC_AREA_PNG, '报修区域',
'${S.of(context)!.tempPlotName}'),
AkuBox.h(8),
Text(
widget.detailModel.reportDetail,
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.detailModel.imgUrls.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,
),
),
],
);
}
}

@ -3,11 +3,15 @@ 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_process_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/style/app_style.dart';
import 'package:aku_community_manager/tools/user_tool.dart';
import 'package:aku_community_manager/tools/widget_tool.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_person_page.dart';
import 'package:aku_community_manager/ui/manage_pages/engineer_repair/engineer_repair_func.dart';
import 'package:aku_community_manager/ui/manage_pages/engineer_repair/engineer_repair_report_page.dart';
import 'package:aku_community_manager/ui/widgets/app_widgets/bee_grid_image_view.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_material_button.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
@ -144,17 +148,40 @@ class _EngineerRepairDetailPageState extends State<EngineerRepairDetailPage> {
children: [
AkuMaterialButton(
minWidth: 287.w,
onPressed: () {},
onPressed: () async {
await Get.to(
() => EngineerRepairCompletePage(detailModel: _model!));
},
color: Colors.black,
child: '维修完成'.text.size(32.sp).color(Colors.white).make()),
AkuMaterialButton(
color: kPrimaryColor,
onPressed: () {
//TODO:
onPressed: () async {
await Get.to(
() => EngineerRepairReportPage(repairId: _model!.id));
},
child: '汇报进度'.text.size(32.sp).color(Colors.black).make()),
],
);
case 5:
return UserTool.userProvider.infoModel!.engineeringRepairAuthority ==
ERAUTH.SENDTOCOMPANY
? AkuMaterialButton(
color: kPrimaryColor,
onPressed: () async {
await Get.to(
() => EngineerRepairReportPage(repairId: _model!.id));
},
child: '验收审核'.text.size(32.sp).color(Colors.black).make())
: SizedBox();
case 6:
return AkuMaterialButton(
color: kPrimaryColor,
onPressed: () async {
await Get.to(
() => EngineerRepairReportPage(repairId: _model!.id));
},
child: '验收结果'.text.size(32.sp).color(Colors.black).make());
default:
return SizedBox();
}

@ -1,3 +1,5 @@
import 'dart:io';
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_organization_model.dart';
@ -105,4 +107,41 @@ class EngineerRepairFunc {
});
return model.status ?? false;
}
static Future uploadReportImages(List<File> files) async {
var model = await NetUtil()
.uploadFiles(files, API.upload.uploadEngineerRepairReport);
return model;
}
static Future submitReport(
int repairId, String detail, List<String> urls) async {
var model = await NetUtil().post(API.engineerRepair.submitReport, params: {
'repairEngineeringId': repairId,
'content': detail,
'workReportImgUrls': urls,
});
return model.status ?? false;
}
static Future complete(
int repairId,
String detail,
String material,
List<String> urls,
) async {
var model = await NetUtil().post(API.engineerRepair.complete, params: {
'repairEngineeringId': repairId,
'content': detail,
'billMaterials': material,
'maintenanceImgUrls': urls,
});
return model.status ?? false;
}
static Future uploadCompleteImages(List<File> files) async {
var model =
await NetUtil().uploadFiles(files, API.upload.engineerRepairComplete);
return model;
}
}

@ -0,0 +1,107 @@
import 'dart:io';
import 'package:aku_community_manager/style/app_style.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/common/aku_scaffold.dart';
import 'package:aku_community_manager/ui/widgets/inner/aku_bottom_button.dart';
import 'package:bot_toast/bot_toast.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 EngineerRepairReportPage extends StatefulWidget {
final int repairId;
const EngineerRepairReportPage({Key? key, required this.repairId})
: super(key: key);
@override
_EngineerRepairReportPageState createState() =>
_EngineerRepairReportPageState();
}
class _EngineerRepairReportPageState extends State<EngineerRepairReportPage> {
String _reportDetail = '';
List<File> _files = [];
@override
Widget build(BuildContext context) {
return AkuScaffold(
title: '工作汇报',
body: ListView(
padding: EdgeInsets.symmetric(vertical: 16.w),
children: [
Container(
width: double.infinity,
color: Colors.white,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'维修进度'.text.size(36.sp).color(kTextPrimaryColor).make(),
40.w.heightBox,
'工作描述'.text.size(28.sp).color(kTextPrimaryColor).make(),
24.w.heightBox,
Container(
width: 686.w,
height: 87.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
border: Border.all(
width: 2.w,
color: Color(0xFFE8E8E8),
),
),
child: TextField(
autofocus: false,
onChanged: (value) {
setState(() {
_reportDetail = value;
});
},
minLines: 5,
decoration: InputDecoration(
hintText: '请输入具体描述',
hintStyle: TextStyle(
fontSize: 28.sp,
color: kTextSubColor,
),
contentPadding: EdgeInsets.symmetric(
vertical: 24.w, horizontal: 24.w),
border: InputBorder.none,
isDense: true,
),
),
)
],
),
),
40.w.heightBox,
'上传照片'.text.size(28.sp).color(kTextPrimaryColor).make(),
24.w.heightBox,
AkuPickImageWidget(onChanged: (files) {
_files.clear();
_files.addAll(files);
setState(() {});
}),
],
),
bottom: AkuBottomButton(
title: '立即提交',
onTap: () async {
List<String> urls = [];
Function cancel = BotToast.showLoading();
urls = await EngineerRepairFunc.uploadReportImages(_files);
var result = await EngineerRepairFunc.submitReport(
widget.repairId, _reportDetail, urls);
if (result) {
Get.back();
Get.back();
}
cancel();
},
),
);
}
}
Loading…
Cancel
Save