parent
8d5a88d5bb
commit
9e5b915a93
@ -1,3 +1,2 @@
|
||||
analyzer:
|
||||
errors:
|
||||
unused_import: error
|
After Width: | Height: | Size: 2.1 KiB |
@ -0,0 +1,275 @@
|
||||
import 'package:aku_community_manager/const/api.dart';
|
||||
import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_list_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/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/inner/aku_chip_box.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
|
||||
class EngineerRepairCard extends StatelessWidget {
|
||||
final EngineerRepairListModel model;
|
||||
final VoidCallback callRefresh;
|
||||
|
||||
const EngineerRepairCard(
|
||||
{Key? key, required this.model, required this.callRefresh})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () async {
|
||||
callRefresh();
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(24.w),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
AkuChipBox(title: '公区维修'),
|
||||
16.w.widthBox,
|
||||
Expanded(
|
||||
child: Text(
|
||||
model.createDate,
|
||||
style: TextStyle(
|
||||
color: AppStyle.minorTextColor,
|
||||
fontSize: 22.sp,
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'${ERMap.statusString(model.status)}',
|
||||
style: TextStyle(
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
24.w.heightBox,
|
||||
Text(
|
||||
model.reportDetail,
|
||||
overflow: TextOverflow.visible,
|
||||
style: TextStyle(
|
||||
color: AppStyle.primaryTextColor,
|
||||
fontSize: 28.sp,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
16.w.heightBox,
|
||||
_buildImgs(),
|
||||
_getBottomCard(),
|
||||
],
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8.w),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_buildImgs() {
|
||||
return Container(
|
||||
height: 168.w,
|
||||
child: ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemBuilder: (context, index) {
|
||||
var imgObj = model.imgUrls[index].url;
|
||||
return Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 8.w),
|
||||
height: 168.w,
|
||||
width: 168.w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(4.w),
|
||||
),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: FadeInImage.assetNetwork(
|
||||
placeholder: R.ASSETS_PLACEHOLDER_WEBP,
|
||||
image: API.image(imgObj ?? '')),
|
||||
);
|
||||
},
|
||||
itemCount: model.imgUrls.length,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_getBottomCard() {
|
||||
return Column(
|
||||
children: [
|
||||
Divider(height: 48.w),
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: _getButtons())),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
_getButtons() {
|
||||
switch (model.status) {
|
||||
case 1:
|
||||
return [
|
||||
AkuMaterialButton(
|
||||
height: 64.w,
|
||||
onPressed: () async {
|
||||
callRefresh();
|
||||
},
|
||||
radius: 4,
|
||||
color: AppStyle.primaryColor,
|
||||
padding: EdgeInsets.symmetric(horizontal: 24.w),
|
||||
child: Text(
|
||||
(UserTool.userProvider.infoModel!.engineeringRepairAuthority ==
|
||||
ERAUTH.SENDTOCOMPANY
|
||||
? '分派单位'
|
||||
: '查看详情'),
|
||||
style: TextStyle(
|
||||
color: AppStyle.primaryTextColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 28.sp,
|
||||
height: 40 / 28,
|
||||
),
|
||||
),
|
||||
),
|
||||
];
|
||||
case 2:
|
||||
return [
|
||||
AkuMaterialButton(
|
||||
height: 64.w,
|
||||
onPressed: () async {
|
||||
callRefresh();
|
||||
},
|
||||
radius: 4,
|
||||
color: AppStyle.primaryColor,
|
||||
padding: EdgeInsets.symmetric(horizontal: 24.w),
|
||||
child: Text(
|
||||
(UserTool.userProvider.infoModel!.engineeringRepairAuthority ==
|
||||
ERAUTH.SENDTOPERSON
|
||||
? '指派人员'
|
||||
: '查看详情'),
|
||||
style: TextStyle(
|
||||
color: AppStyle.primaryTextColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 28.sp,
|
||||
height: 40 / 28,
|
||||
),
|
||||
),
|
||||
),
|
||||
];
|
||||
case 3:
|
||||
return [
|
||||
UserTool.userProvider.infoModel!.engineeringRepairAuthority ==
|
||||
ERAUTH.PICK
|
||||
? AkuMaterialButton(
|
||||
height: 64.w,
|
||||
onPressed: () async {
|
||||
callRefresh();
|
||||
},
|
||||
radius: 4,
|
||||
color: AppStyle.primaryColor,
|
||||
padding: EdgeInsets.symmetric(horizontal: 24.w),
|
||||
child: Text(
|
||||
('立即接单'),
|
||||
style: TextStyle(
|
||||
color: AppStyle.primaryTextColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 28.sp,
|
||||
height: 40 / 28,
|
||||
),
|
||||
),
|
||||
)
|
||||
: SizedBox(),
|
||||
12.w.widthBox,
|
||||
AkuMaterialButton(
|
||||
height: 64.w,
|
||||
onPressed: () async {
|
||||
callRefresh();
|
||||
},
|
||||
radius: 4,
|
||||
color: AppStyle.primaryColor,
|
||||
padding: EdgeInsets.symmetric(horizontal: 24.w),
|
||||
child: Text(
|
||||
('查看详情'),
|
||||
style: TextStyle(
|
||||
color: AppStyle.primaryTextColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 28.sp,
|
||||
height: 40 / 28,
|
||||
),
|
||||
),
|
||||
),
|
||||
];
|
||||
case 4:
|
||||
return [
|
||||
AkuMaterialButton(
|
||||
height: 64.w,
|
||||
onPressed: () async {
|
||||
callRefresh();
|
||||
},
|
||||
radius: 4,
|
||||
color: AppStyle.primaryColor,
|
||||
padding: EdgeInsets.symmetric(horizontal: 24.w),
|
||||
child: Text(
|
||||
('汇报进度'),
|
||||
style: TextStyle(
|
||||
color: AppStyle.primaryTextColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 28.sp,
|
||||
height: 40 / 28,
|
||||
),
|
||||
),
|
||||
),
|
||||
];case 5:
|
||||
case 6:
|
||||
return [
|
||||
AkuMaterialButton(
|
||||
height: 64.w,
|
||||
onPressed: () async {
|
||||
callRefresh();
|
||||
},
|
||||
radius: 4,
|
||||
color: AppStyle.primaryColor,
|
||||
padding: EdgeInsets.symmetric(horizontal: 24.w),
|
||||
child: Text(
|
||||
('验收记录'),
|
||||
style: TextStyle(
|
||||
color: AppStyle.primaryTextColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 28.sp,
|
||||
height: 40 / 28,
|
||||
),
|
||||
),
|
||||
),
|
||||
];
|
||||
case 7:
|
||||
return [
|
||||
AkuMaterialButton(
|
||||
height: 64.w,
|
||||
onPressed: () async {
|
||||
callRefresh();
|
||||
},
|
||||
radius: 4,
|
||||
color: AppStyle.primaryColor,
|
||||
padding: EdgeInsets.symmetric(horizontal: 24.w),
|
||||
child: Text(
|
||||
('查看详情'),
|
||||
style: TextStyle(
|
||||
color: AppStyle.primaryTextColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 28.sp,
|
||||
height: 40 / 28,
|
||||
),
|
||||
),
|
||||
),
|
||||
];
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
import 'package:aku_community_manager/const/api.dart';
|
||||
import 'package:aku_community_manager/utils/network/net_util.dart';
|
||||
|
||||
class EngineerRepairFunc {
|
||||
static Future addEngineerRepair(
|
||||
String area, int type, String reportDetail, List<String> urls) async {
|
||||
var model =
|
||||
await NetUtil().post(API.engineerRepair.engineerRepairInsert, params: {
|
||||
'repairArea': area,
|
||||
'type': type,
|
||||
'reportDetail': reportDetail,
|
||||
'fileUrls': urls,
|
||||
});
|
||||
return model.status ?? false;
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
class ERMap {
|
||||
static statusString(int status) {
|
||||
switch (status) {
|
||||
case 1:
|
||||
return '待派单';
|
||||
case 2:
|
||||
return '待派单';
|
||||
case 3:
|
||||
return '待接单';
|
||||
case 4:
|
||||
return '处理中';
|
||||
case 5:
|
||||
return '待验收';
|
||||
case 6:
|
||||
return '验收失败';
|
||||
case 7:
|
||||
return '验收成功';
|
||||
case 8:
|
||||
return '已作废';
|
||||
case 9:
|
||||
return '已取消';
|
||||
default:
|
||||
return '未知';
|
||||
}
|
||||
}
|
||||
}
|
@ -1,15 +1,74 @@
|
||||
import 'package:aku_community_manager/const/api.dart';
|
||||
import 'package:aku_community_manager/json_models/manager/engineer_repair/engineer_repair_list_model.dart';
|
||||
import 'package:aku_community_manager/models/user/user_info_model.dart';
|
||||
import 'package:aku_community_manager/tools/user_tool.dart';
|
||||
import 'package:aku_community_manager/ui/manage_pages/engineer_repair/engineer_repair_card.dart';
|
||||
import 'package:aku_community_manager/ui/widgets/common/bee_list_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
|
||||
class EngineerRepairView extends StatefulWidget {
|
||||
EngineerRepairView({Key? key}) : super(key: key);
|
||||
final int index;
|
||||
final EasyRefreshController controller;
|
||||
EngineerRepairView({Key? key, required this.index, required this.controller})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_EngineerRepairViewState createState() => _EngineerRepairViewState();
|
||||
}
|
||||
|
||||
class _EngineerRepairViewState extends State<EngineerRepairView> {
|
||||
int? get repairEngineeringStatus {
|
||||
if (widget.index == 0) {
|
||||
return null;
|
||||
} else if (widget.index == 1) {
|
||||
switch (UserTool.userProvider.infoModel!.engineeringRepairAuthority) {
|
||||
case ERAUTH.SENDTOCOMPANY:
|
||||
return 1;
|
||||
case ERAUTH.SENDTOPERSON:
|
||||
return 2;
|
||||
case ERAUTH.PICK:
|
||||
return 3;
|
||||
case ERAUTH.HIDE:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
UserTool.userProvider.infoModel!.engineeringRepairAuthority == ERAUTH.PICK
|
||||
? widget.index + 2
|
||||
: widget.index + 1;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView();
|
||||
return BeeListView(
|
||||
path: API.engineerRepair.engineerRepairList,
|
||||
extraParams: {
|
||||
'repairStatus': repairEngineeringStatus,
|
||||
},
|
||||
controller: widget.controller,
|
||||
convert: (models) {
|
||||
return models.tableList!
|
||||
.map((e) => EngineerRepairListModel.fromJson(e))
|
||||
.toList();
|
||||
},
|
||||
builder: (items) {
|
||||
return ListView.separated(
|
||||
padding: EdgeInsets.all(32.w),
|
||||
itemBuilder: (context, index) {
|
||||
var model = items[index];
|
||||
return EngineerRepairCard(
|
||||
model: model,
|
||||
callRefresh: () {
|
||||
widget.controller.callRefresh();
|
||||
});
|
||||
},
|
||||
separatorBuilder: (_, __) {
|
||||
return 16.w.heightBox;
|
||||
},
|
||||
itemCount: items.length);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in new issue