完成 工程维修-详情页/公司派单/维修人员派单/接单 等功能

hmxc
张萌 3 years ago
parent 9e5b915a93
commit 7f94ba8d90

@ -6,4 +6,31 @@ class _EngineerRepair {
///app ///app
String get engineerRepairInsert => '/user/repairEngineering/insert'; String get engineerRepairInsert => '/user/repairEngineering/insert';
///app id
String get detail => '/user/repairEngineering/findById';
///app id
String get process => '/user/repairEngineering/findProcessRecordById';
///app id
String get workReport =>
'/user/repairEngineering/findReportByRepairEngineeringId';
///app
String get organization => '/user/repairEngineering/findRepairOrganization';
///app
String get companySend =>
'/user/repairEngineering/maintenanceCompanySendSingle';
///app id
String get persons => '/user/repairEngineering/findSysUserByOrganizationId';
///app
String get personSend =>
'/user/repairEngineering/maintenancePersonnelSendSingle';
///app
String get personPick => '/user/repairEngineering/maintenanceStaffPickSingle';
} }

@ -0,0 +1,61 @@
import 'package:aku_community_manager/models/common/img_model.dart';
import 'package:json_annotation/json_annotation.dart';
part 'engineer_repair_detail_model.g.dart';
@JsonSerializable()
class EngineerRepairDetailModel {
final int id;
final String createName;
final String createTel;
final String repairArea;
final String code;
final int type;
final String reportDetail;
final int status;
final int? organizationId;
final String? organizationName;
final String? organizationLeadingName;
final String? organizationLeadingTel;
final int? maintenanceStaff;
final String? maintenanceStaffOrganizationName;
final String? maintenanceStaffName;
final String? maintenanceStaffTel;
final String? maintenanceStaffPickSingleDate;
final int? maintenanceCompanySendSingle;
final String? maintenanceCompanySendSingleDate;
final int? maintenancePersonnelSendSingle;
final String? maintenancePersonnelSendSingleDate;
final List<ImgModel> imgUrls;
final int createId;
final String createDate;
factory EngineerRepairDetailModel.fromJson(Map<String, dynamic> json) =>
_$EngineerRepairDetailModelFromJson(json);
EngineerRepairDetailModel(
this.id,
this.createName,
this.createTel,
this.repairArea,
this.code,
this.type,
this.reportDetail,
this.status,
this.organizationId,
this.organizationName,
this.organizationLeadingName,
this.organizationLeadingTel,
this.maintenanceStaff,
this.maintenanceStaffOrganizationName,
this.maintenanceStaffName,
this.maintenanceStaffTel,
this.maintenanceStaffPickSingleDate,
this.maintenanceCompanySendSingle,
this.maintenanceCompanySendSingleDate,
this.maintenancePersonnelSendSingle,
this.maintenancePersonnelSendSingleDate,
this.imgUrls,
this.createId,
this.createDate);
}

@ -0,0 +1,39 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'engineer_repair_detail_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
EngineerRepairDetailModel _$EngineerRepairDetailModelFromJson(
Map<String, dynamic> json) {
return EngineerRepairDetailModel(
json['id'] as int,
json['createName'] as String,
json['createTel'] as String,
json['repairArea'] as String,
json['code'] as String,
json['type'] as int,
json['reportDetail'] as String,
json['status'] as int,
json['organizationId'] as int?,
json['organizationName'] as String?,
json['organizationLeadingName'] as String?,
json['organizationLeadingTel'] as String?,
json['maintenanceStaff'] as int?,
json['maintenanceStaffOrganizationName'] as String?,
json['maintenanceStaffName'] as String?,
json['maintenanceStaffTel'] as String?,
json['maintenanceStaffPickSingleDate'] as String?,
json['maintenanceCompanySendSingle'] as int?,
json['maintenanceCompanySendSingleDate'] as String?,
json['maintenancePersonnelSendSingle'] as int?,
json['maintenancePersonnelSendSingleDate'] as String?,
(json['imgUrls'] as List<dynamic>)
.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
json['createId'] as int,
json['createDate'] as String,
);
}

@ -0,0 +1,37 @@
import 'package:json_annotation/json_annotation.dart';
part 'engineer_repair_organization_model.g.dart';
@JsonSerializable()
class EngineerRepairOrganizationModel {
final int id;
final String name;
final String? code;
final int parentId;
final int? leadingId;
final int status;
final int sort;
final String? remake;
final int categoryId;
final int createId;
final String createDate;
final int? modifyId;
final String? modifyDate;
factory EngineerRepairOrganizationModel.fromJson(Map<String, dynamic> json) =>
_$EngineerRepairOrganizationModelFromJson(json);
EngineerRepairOrganizationModel(
this.id,
this.name,
this.code,
this.parentId,
this.leadingId,
this.status,
this.sort,
this.remake,
this.categoryId,
this.createId,
this.createDate,
this.modifyId,
this.modifyDate);
}

@ -0,0 +1,26 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'engineer_repair_organization_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
EngineerRepairOrganizationModel _$EngineerRepairOrganizationModelFromJson(
Map<String, dynamic> json) {
return EngineerRepairOrganizationModel(
json['id'] as int,
json['name'] as String,
json['code'] as String?,
json['parentId'] as int,
json['leadingId'] as int?,
json['status'] as int,
json['sort'] as int,
json['remake'] as String?,
json['categoryId'] as int,
json['createId'] as int,
json['createDate'] as String,
json['modifyId'] as int?,
json['modifyDate'] as String?,
);
}

@ -0,0 +1,66 @@
import 'package:json_annotation/json_annotation.dart';
part 'engineer_repair_person_model.g.dart';
@JsonSerializable()
class EngineerRepairPersonModel {
final int id;
final String userName;
final String pwd;
final String actualName;
final String tel;
final int sex;
final String userCode;
final String birthday;
final String email;
final String idCard;
final int organizationId;
final String organizationPath;
final int positionId;
final int roleId;
final int status;
final int isDelete;
final int createId;
final String createDate;
final int modifyId;
final String modifyDate;
final int lastLoginIp;
final String lastLoginDate;
final String nickName;
final String code;
final String codeSendDate;
final String remake;
final int reportTo;
final String entryDate;
factory EngineerRepairPersonModel.fromJson(Map<String, dynamic> json) =>
_$EngineerRepairPersonModelFromJson(json);
EngineerRepairPersonModel(
this.id,
this.userName,
this.pwd,
this.actualName,
this.tel,
this.sex,
this.userCode,
this.birthday,
this.email,
this.idCard,
this.organizationId,
this.organizationPath,
this.positionId,
this.roleId,
this.status,
this.isDelete,
this.createId,
this.createDate,
this.modifyId,
this.modifyDate,
this.lastLoginIp,
this.lastLoginDate,
this.nickName,
this.code,
this.codeSendDate,
this.remake,
this.reportTo,
this.entryDate);
}

@ -0,0 +1,41 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'engineer_repair_person_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
EngineerRepairPersonModel _$EngineerRepairPersonModelFromJson(
Map<String, dynamic> json) {
return EngineerRepairPersonModel(
json['id'] as int,
json['userName'] as String,
json['pwd'] as String,
json['actualName'] as String,
json['tel'] as String,
json['sex'] as int,
json['userCode'] as String,
json['birthday'] as String,
json['email'] as String,
json['idCard'] as String,
json['organizationId'] as int,
json['organizationPath'] as String,
json['positionId'] as int,
json['roleId'] as int,
json['status'] as int,
json['isDelete'] as int,
json['createId'] as int,
json['createDate'] as String,
json['modifyId'] as int,
json['modifyDate'] as String,
json['lastLoginIp'] as int,
json['lastLoginDate'] as String,
json['nickName'] as String,
json['code'] as String,
json['codeSendDate'] as String,
json['remake'] as String,
json['reportTo'] as int,
json['entryDate'] as String,
);
}

@ -0,0 +1,26 @@
import 'package:json_annotation/json_annotation.dart';
part 'engineer_repair_process_model.g.dart';
@JsonSerializable()
class EngineerRepairProcessModel {
final int id;
final int repairEngineeringId;
final String operationDate;
final int operationType;
final int operator;
final int operatorType;
final String operatorContent;
factory EngineerRepairProcessModel.fromJson(Map<String, dynamic> json) =>
_$EngineerRepairProcessModelFromJson(json);
EngineerRepairProcessModel(
this.id,
this.repairEngineeringId,
this.operationDate,
this.operationType,
this.operator,
this.operatorType,
this.operatorContent);
}

@ -0,0 +1,20 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'engineer_repair_process_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
EngineerRepairProcessModel _$EngineerRepairProcessModelFromJson(
Map<String, dynamic> json) {
return EngineerRepairProcessModel(
json['id'] as int,
json['repairEngineeringId'] as int,
json['operationDate'] as String,
json['operationType'] as int,
json['operator'] as int,
json['operatorType'] as int,
json['operatorContent'] as String,
);
}

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

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

@ -3,11 +3,14 @@ import 'package:aku_community_manager/json_models/manager/engineer_repair/engine
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/ui/manage_pages/engineer_repair/engineer_repair_depart_company_page.dart';
import 'package:aku_community_manager/ui/manage_pages/engineer_repair/engineer_repair_detail_page.dart';
import 'package:aku_community_manager/ui/manage_pages/engineer_repair/engineer_repair_map.dart'; import 'package:aku_community_manager/ui/manage_pages/engineer_repair/engineer_repair_map.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_material_button.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_material_button.dart';
import 'package:aku_community_manager/ui/widgets/inner/aku_chip_box.dart'; import 'package:aku_community_manager/ui/widgets/inner/aku_chip_box.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.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 'package:velocity_x/velocity_x.dart';
class EngineerRepairCard extends StatelessWidget { class EngineerRepairCard extends StatelessWidget {
@ -22,6 +25,8 @@ class EngineerRepairCard extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GestureDetector( return GestureDetector(
onTap: () async { onTap: () async {
await Get.to(
() => EngineerRepairDetailPage(repairEngineerId: model.id));
callRefresh(); callRefresh();
}, },
child: Container( child: Container(
@ -119,6 +124,12 @@ class EngineerRepairCard extends StatelessWidget {
AkuMaterialButton( AkuMaterialButton(
height: 64.w, height: 64.w,
onPressed: () async { onPressed: () async {
(UserTool.userProvider.infoModel!.engineeringRepairAuthority ==
ERAUTH.SENDTOCOMPANY)
? await Get.to(
() => EngineerRepairDepartCompany(repairId: model.id))
: await Get.to(() =>
EngineerRepairDetailPage(repairEngineerId: model.id));
callRefresh(); callRefresh();
}, },
radius: 4, radius: 4,
@ -143,6 +154,12 @@ class EngineerRepairCard extends StatelessWidget {
AkuMaterialButton( AkuMaterialButton(
height: 64.w, height: 64.w,
onPressed: () async { onPressed: () async {
(UserTool.userProvider.infoModel!.engineeringRepairAuthority ==
ERAUTH.SENDTOPERSON)
? await Get.to(() =>
EngineerRepairDetailPage(repairEngineerId: model.id))
: await Get.to(() =>
EngineerRepairDetailPage(repairEngineerId: model.id));
callRefresh(); callRefresh();
}, },
radius: 4, radius: 4,
@ -225,28 +242,29 @@ class EngineerRepairCard extends StatelessWidget {
), ),
), ),
), ),
];case 5: ];
case 5:
case 6: case 6:
return [ return [
AkuMaterialButton( AkuMaterialButton(
height: 64.w, height: 64.w,
onPressed: () async { onPressed: () async {
callRefresh(); callRefresh();
}, },
radius: 4, radius: 4,
color: AppStyle.primaryColor, color: AppStyle.primaryColor,
padding: EdgeInsets.symmetric(horizontal: 24.w), padding: EdgeInsets.symmetric(horizontal: 24.w),
child: Text( child: Text(
('验收记录'), ('验收记录'),
style: TextStyle( style: TextStyle(
color: AppStyle.primaryTextColor, color: AppStyle.primaryTextColor,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 28.sp, fontSize: 28.sp,
height: 40 / 28, height: 40 / 28,
),
), ),
), ),
), ];
];
case 7: case 7:
return [ return [
AkuMaterialButton( AkuMaterialButton(

@ -0,0 +1,86 @@
import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_organization_model.dart';
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/aku_divider.dart';
import 'package:aku_community_manager/tools/extensions/list_extension_tool.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:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
class EngineerRepairDepartCompany extends StatefulWidget {
final int repairId;
const EngineerRepairDepartCompany({Key? key, required this.repairId})
: super(key: key);
@override
_EngineerRepairDepartCompanyState createState() =>
_EngineerRepairDepartCompanyState();
}
class _EngineerRepairDepartCompanyState
extends State<EngineerRepairDepartCompany> {
bool _onLoad = true;
List<EngineerRepairOrganizationModel> _models = [];
int _selectId = 0;
@override
Widget build(BuildContext context) {
return AkuScaffold(
title: '选择维修公司',
body: EasyRefresh(
firstRefresh: true,
header: MaterialHeader(),
onRefresh: () async {
_models.addAll(await EngineerRepairFunc.getOrganization());
_onLoad = false;
setState(() {});
},
child: _onLoad
? Container()
: ListView(
children: [
16.w.heightBox,
..._models.map((e) => _buildTile(e)).toList()
].sepWidget(separate: AkuDivider.horizontal()),
),
),
bottom: AkuBottomButton(
title: '立即派单',
onTap: _selectId == 0
? null
: () async {
var result = await EngineerRepairFunc.companySend(
widget.repairId, _selectId);
if (result) {
Get.back();
}
},
),
);
}
Widget _buildTile(EngineerRepairOrganizationModel model) {
return Row(
children: [
Checkbox(
value: _selectId == model.id,
onChanged: (value) {
if (value ?? false) {
_selectId = model.id;
} else {
_selectId = 0;
}
setState(() {});
},
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
).box.width(28.w).height(28.sp).make(),
8.w.widthBox,
model.name.text.size(32.sp).color(kTextPrimaryColor).make(),
],
).box.color(Colors.white).padding(EdgeInsets.all(32.w)).make();
}
}

@ -0,0 +1,184 @@
import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_person_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/widgets/common/aku_material_button.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:expandable/expandable.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
class EngineerRepairDepartPersonPage extends StatefulWidget {
final int organizationId;
final String organizationName;
final int repairId;
const EngineerRepairDepartPersonPage(
{Key? key,
required this.organizationId,
required this.organizationName,
required this.repairId})
: super(key: key);
@override
_EngineerRepairDepartPersonPageState createState() =>
_EngineerRepairDepartPersonPageState();
}
class _EngineerRepairDepartPersonPageState
extends State<EngineerRepairDepartPersonPage> {
bool _onLoad = true;
List<EngineerRepairPersonModel> _models = [];
int _selectId = 0;
@override
Widget build(BuildContext context) {
return AkuScaffold(
title: '选择维修人员',
body: EasyRefresh(
firstRefresh: true,
header: MaterialHeader(),
onRefresh: () async {
_models.addAll(
await EngineerRepairFunc.getPersons(widget.organizationId));
if (_models.isNotEmpty) {
_onLoad = false;
setState(() {});
}
},
child: _onLoad
? Container()
: ListView(
padding: EdgeInsets.only(top: 16.w),
children: [_buildBody()],
),
),
bottom: AkuBottomButton(
title: '立即派单',
onTap: _selectId == 0
? null
: () async {
var result = await EngineerRepairFunc.personSend(
widget.repairId, _selectId);
if (result) {
Get.back();
}
},
),
);
}
Widget _buildBody() {
return Material(
color: Colors.white,
child: ExpandablePanel(
controller: ExpandableController(initialExpanded: true),
header: Container(
height: 96.w,
alignment: Alignment.centerLeft,
padding: EdgeInsets.symmetric(horizontal: 32.w),
child: Text(
widget.organizationName,
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 32.sp,
fontWeight: FontWeight.bold,
),
),
),
collapsed: SizedBox(),
expanded: Column(
mainAxisSize: MainAxisSize.min,
children: [
Divider(
color: Color(0xFFE8E8E8),
height: 1.w,
thickness: 1.w,
),
..._models.map((e) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
AkuMaterialButton(
height: 96.w,
onPressed: () {
_selectId = e.id;
setState(() {});
},
child: Row(
children: [
AkuBox.w(72),
Checkbox(
checkColor: AppStyle.primaryTextColor,
activeColor: AppStyle.primaryColor,
value: _selectId == e.id,
onChanged: (state) {
if (!(state ?? false)) {
_selectId = 0;
} else {
_selectId = e.id;
}
setState(() {});
},
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
),
Image.asset(
R.ASSETS_MESSAGE_IC_PEOPLE_PNG,
height: 40.w,
width: 40.w,
),
Text(
e.userName,
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.w,
fontWeight: FontWeight.bold,
),
),
Spacer(),
Image.asset(
R.ASSETS_MESSAGE_IC_PHONE_PNG,
height: 40.w,
width: 40.w,
),
Text(
e.tel,
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.w,
fontWeight: FontWeight.bold,
),
),
AkuBox.w(101),
],
),
),
_models.last == e
? SizedBox()
: Divider(
indent: 32.w,
endIndent: 32.w,
height: 1.w,
thickness: 1.w,
color: Color(0xFFE8E8E8),
),
],
);
}).toList()
],
),
theme: ExpandableThemeData(
tapHeaderToExpand: true,
iconPlacement: ExpandablePanelIconPlacement.right,
iconPadding: EdgeInsets.only(top: 32.w, right: 32.w),
iconSize: 32.w,
iconColor: AppStyle.minorTextColor,
),
),
);
}
}

@ -0,0 +1,360 @@
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/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/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_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/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';
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_easyrefresh/easy_refresh.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
import 'engineer_repair_map.dart';
class EngineerRepairDetailPage extends StatefulWidget {
final int repairEngineerId;
const EngineerRepairDetailPage({Key? key, required this.repairEngineerId})
: super(key: key);
@override
_EngineerRepairDetailPageState createState() =>
_EngineerRepairDetailPageState();
}
class _EngineerRepairDetailPageState extends State<EngineerRepairDetailPage> {
EasyRefreshController _refreshController = EasyRefreshController();
bool _onLoad = true;
EngineerRepairDetailModel? _model;
List<EngineerRepairProcessModel> _processModels = [];
List<EngineerRepairWorkReportModel> _reportModels = [];
@override
void dispose() {
_refreshController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return AkuScaffold(
title: '工程维修',
body: EasyRefresh(
firstRefresh: true,
header: MaterialHeader(),
onRefresh: () async {
_model = await EngineerRepairFunc.getEngineerRepairDetail(
widget.repairEngineerId);
_processModels.addAll(
await EngineerRepairFunc.getProcess(widget.repairEngineerId));
_reportModels.addAll(
await EngineerRepairFunc.getWorkReport(widget.repairEngineerId));
if (_model != null) {
_onLoad = false;
setState(() {});
}
},
controller: _refreshController,
child: _onLoad
? Container()
: ListView(
padding: EdgeInsets.symmetric(vertical: 16.w),
children: [
_buildInfo(),
16.w.heightBox,
if (_model!.maintenanceStaff != null) _buildOperator(),
if (_model!.organizationId != null) _buildOrganization(),
if (_processModels.isNotEmpty) _buildProcess(),
if (_reportModels.isNotEmpty) _buildReport(),
GestureDetector(
onTap: () {
// TODO:
},
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: _bottomButtons(),
);
}
Widget _bottomButtons() {
if (_model != null) {
switch (_model!.status) {
case 1:
return AkuBottomButton(
title: '立即派单',
onTap: () async {
await Get.off(EngineerRepairDepartCompany(
repairId: widget.repairEngineerId));
},
);
case 2:
return AkuBottomButton(
title: '立即派单',
onTap: () async {
await Get.off(EngineerRepairDepartPersonPage(
organizationId: _model!.organizationId!,
organizationName: _model!.organizationName!,
repairId: _model!.id));
},
);
case 3:
return AkuBottomButton(
title: '立即接单',
onTap: () async {
var result = await EngineerRepairFunc.personPick(_model!.id);
if (result) {
Get.back();
}
},
);
case 4:
return Row(
children: [
AkuMaterialButton(
minWidth: 287.w,
onPressed: () {},
color: Colors.black,
child: '维修完成'.text.size(32.sp).color(Colors.white).make()),
AkuMaterialButton(
color: kPrimaryColor,
onPressed: () {
//TODO:
},
child: '汇报进度'.text.size(32.sp).color(Colors.black).make()),
],
);
default:
return SizedBox();
}
} else {
return SizedBox();
}
}
Widget _buildReport() {
return AkuTitleBox(
title: '工作日志',
children: _reportModels
.mapIndexed(
(currentValue, index) => _buildReportTile(currentValue, index))
.toList(),
).pOnly(bottom: 16.w);
}
Widget _buildReportTile(EngineerRepairWorkReportModel model, int index) {
return Column(
children: [
Row(
children: [
Container(
margin: EdgeInsets.all(8.w),
width: 24.w,
height: 24.w,
decoration: BoxDecoration(
color: index == 0 ? Color(0xFFFFC40C) : Color(0xFFD8D8D8),
borderRadius: BorderRadius.circular(12.w)),
),
18.w.widthBox,
model.createDate.text.size(28.sp).color(kTextSubColor).make(),
],
),
16.w.heightBox,
'${model.content}'
.text
.size(28.sp)
.color(kTextSubColor)
.make()
.pOnly(left: 58.w),
18.w.heightBox,
BeeGridImageView(
urls: model.workReportImgLists.map((e) => e.url ?? '').toList())
],
);
}
Widget _buildProcess() {
return AkuTitleBox(
title: '报修进程',
children: _processModels.map((e) {
return _buildProcessTile(
ERMap.operationType(e.operationType),
e.operationDate,
);
}).toList(),
).pOnly(bottom: 16.w);
}
Widget _buildProcessTile(String title, String date) {
return Row(
children: [
AkuBox.h(56),
Text(
title,
style: TextStyle(
color: AppStyle.minorTextColor,
fontSize: 28.w,
),
),
Spacer(),
Text(
date,
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.w,
),
),
],
);
}
_buildOperator() {
return AkuTitleBox(
title: '维修人员',
children: [
16.w.heightBox,
_buildTile(R.ASSETS_MESSAGE_IC_PEOPLE_PNG, '所属部门',
_model!.maintenanceStaffOrganizationName!),
16.w.heightBox,
_buildTile(R.ASSETS_MESSAGE_IC_PEOPLE_PNG, '主要负责人',
_model!.maintenanceStaffName!),
16.w.heightBox,
_buildTile(
R.ASSETS_MESSAGE_IC_PHONE_PNG, '联系电话', _model!.maintenanceStaffTel!)
],
).pOnly(bottom: 16.w);
}
_buildOrganization() {
return AkuTitleBox(
title: '负责单位',
children: [
16.w.heightBox,
_buildTile(
R.ASSETS_MESSAGE_IC_PEOPLE_PNG, '维修单位', _model!.organizationName!),
16.w.heightBox,
_buildTile(R.ASSETS_MESSAGE_IC_PEOPLE_PNG, '主要负责人',
_model!.organizationLeadingName!),
16.w.heightBox,
_buildTile(R.ASSETS_MESSAGE_IC_PHONE_PNG, '联系电话',
_model!.organizationLeadingTel!)
],
).pOnly(bottom: 16.w);
}
_buildInfo() {
return AkuTitleBox(
title: '报修信息',
suffix: fixTypeWidget(),
children: [
AkuBox.h(16),
_buildTile(
R.ASSETS_MESSAGE_IC_PEOPLE_PNG,
'报修人',
_model!.createName,
),
_buildTile(
R.ASSETS_MESSAGE_IC_PHONE_PNG,
'联系电话',
_model!.createTel,
),
_buildTile(R.ASSETS_MESSAGE_IC_AREA_PNG, '报修区域',
'${S.of(context)!.tempPlotName}'),
AkuBox.h(8),
Text(
_model!.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: _model!.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 fixTypeWidget() {
return Text(
ERMap.statusString(_model!.status),
style: TextStyle(color: Color(0xFFFF4501)),
);
}
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,
),
),
],
);
}
}

@ -1,4 +1,9 @@
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_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_process_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';
class EngineerRepairFunc { class EngineerRepairFunc {
@ -13,4 +18,91 @@ class EngineerRepairFunc {
}); });
return model.status ?? false; return model.status ?? false;
} }
static Future<EngineerRepairDetailModel?> getEngineerRepairDetail(
int repairEngineeringId) async {
var model = await NetUtil().get(API.engineerRepair.detail,
params: {'repairEngineeringId': repairEngineeringId});
if (model.status ?? false) {
return EngineerRepairDetailModel.fromJson(model.data);
} else {
return null;
}
}
static Future<List<EngineerRepairProcessModel>> getProcess(
int repairEngineeringId) async {
var model = await NetUtil().get(API.engineerRepair.process,
params: {'repairEngineeringId': repairEngineeringId});
if (model.status ?? false) {
return (model.data as List)
.map((e) => EngineerRepairProcessModel.fromJson(e))
.toList();
} else {
return [];
}
}
static Future<List<EngineerRepairWorkReportModel>> getWorkReport(
int repairEngineeringId) async {
var model = await NetUtil().get(API.engineerRepair.workReport,
params: {'repairEngineeringId': repairEngineeringId});
if (model.status ?? false) {
return (model.data as List)
.map((e) => EngineerRepairWorkReportModel.fromJson(e))
.toList();
} else {
return [];
}
}
static Future<List<EngineerRepairOrganizationModel>> getOrganization() async {
var model = await NetUtil().get(
API.engineerRepair.organization,
);
if (model.status ?? false) {
return (model.data as List)
.map((e) => EngineerRepairOrganizationModel.fromJson(e))
.toList();
} else {
return [];
}
}
static Future<List<EngineerRepairPersonModel>> getPersons(
int organizationId) async {
var model = await NetUtil().get(API.engineerRepair.persons,
params: {'repairOrganizationId': organizationId});
if (model.status ?? false) {
return (model.data as List)
.map((e) => EngineerRepairPersonModel.fromJson(e))
.toList();
} else {
return [];
}
}
static Future companySend(int repairId, int organizationId) async {
var model = await NetUtil().post(API.engineerRepair.companySend,
params: {'id': repairId, 'organizationId': organizationId});
return model.status ?? false;
}
static Future<bool> personSend(int repairId, int maintenanceStaffId) async {
var model = await NetUtil().post(API.engineerRepair.personSend,
params: {'id': repairId, 'maintenanceStaff': maintenanceStaffId});
return model.status ?? false;
}
static Future<bool> personPick(int repairId) async {
var model = await NetUtil().post(API.engineerRepair.personPick, params: {
'id': repairId,
});
return model.status ?? false;
}
} }

@ -23,4 +23,25 @@ class ERMap {
return '未知'; return '未知';
} }
} }
static operationType(int type) {
switch (type) {
case 1:
return '提交工程维修';
case 2:
return '维修公司派单';
case 3:
return '维修人员派单';
case 4:
return '维修人员接单';
case 5:
return '处理完成';
case 8:
return '作废';
case 9:
return '取消';
default:
return '未知';
}
}
} }

@ -2,12 +2,13 @@ import 'dart:io';
import 'package:common_utils/common_utils.dart'; import 'package:common_utils/common_utils.dart';
import 'package:grinder/grinder.dart'; import 'package:grinder/grinder.dart';
import 'package:path/path.dart';
import 'package:pub_semver/pub_semver.dart'; import 'package:pub_semver/pub_semver.dart';
import 'package:yaml/yaml.dart'; import 'package:yaml/yaml.dart';
import 'package:path/path.dart';
import 'config.dart'; import 'config.dart';
import 'version_tool.dart'; import 'version_tool.dart';
part '_add_version.dart'; part '_add_version.dart';
main(args) => grind(args); main(args) => grind(args);

Loading…
Cancel
Save