parent
9e5b915a93
commit
7f94ba8d90
@ -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(),
|
||||
);
|
||||
}
|
@ -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,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue