add fixed detail model

hmxc
张萌 4 years ago
parent 5fd4aa8790
commit 310ca9a353

@ -0,0 +1,88 @@
class FixedDetailModel {
AppReportRepairVo appReportRepairVo;
List<AppProcessRecordVo> appProcessRecordVo;
List<String> appMaintenanceResultVo; //
List<String> appDispatchListVo; //
FixedDetailModel(
{this.appReportRepairVo,
this.appProcessRecordVo,
this.appMaintenanceResultVo,
this.appDispatchListVo});
FixedDetailModel.fromJson(Map<String, dynamic> json) {
appReportRepairVo = json['appReportRepairVo'] != null
? new AppReportRepairVo.fromJson(json['appReportRepairVo'])
: null;
if (json['appProcessRecordVo'] != null) {
appProcessRecordVo = new List<AppProcessRecordVo>();
json['appProcessRecordVo'].forEach((v) {
appProcessRecordVo.add(new AppProcessRecordVo.fromJson(v));
});
}
appMaintenanceResultVo = json['appMaintenanceResultVo'].cast<String>();
appDispatchListVo = json['appDispatchListVo'].cast<String>();
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.appReportRepairVo != null) {
data['appReportRepairVo'] = this.appReportRepairVo.toJson();
}
if (this.appProcessRecordVo != null) {
data['appProcessRecordVo'] =
this.appProcessRecordVo.map((v) => v.toJson()).toList();
}
data['appMaintenanceResultVo'] = this.appMaintenanceResultVo;
data['appDispatchListVo'] = this.appDispatchListVo;
return data;
}
}
class AppReportRepairVo {
int id;
int type;
int status;
String reportDetail;
List<String> imgUrls;
AppReportRepairVo(
{this.id, this.type, this.status, this.reportDetail, this.imgUrls});
AppReportRepairVo.fromJson(Map<String, dynamic> json) {
id = json['id'];
type = json['type'];
status = json['status'];
reportDetail = json['reportDetail'];
imgUrls = json['imgUrls'].cast<String>();
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['type'] = this.type;
data['status'] = this.status;
data['reportDetail'] = this.reportDetail;
data['imgUrls'] = this.imgUrls;
return data;
}
}
class AppProcessRecordVo {
String operationDate;
int operationType;
AppProcessRecordVo({this.operationDate, this.operationType});
AppProcessRecordVo.fromJson(Map<String, dynamic> json) {
operationDate = json['operationDate'];
operationType = json['operationType'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['operationDate'] = this.operationDate;
data['operationType'] = this.operationType;
return data;
}
}

@ -1,5 +1,6 @@
import 'package:akuCommunity/constants/api.dart'; import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/model/manager/fixed_detail_model.dart';
import 'package:akuCommunity/utils/network/base_model.dart'; import 'package:akuCommunity/utils/network/base_model.dart';
import 'package:akuCommunity/utils/network/net_util.dart'; import 'package:akuCommunity/utils/network/net_util.dart';
import 'package:flustars/flustars.dart'; import 'package:flustars/flustars.dart';
@ -44,4 +45,15 @@ class ManagerFunc {
); );
return baseModel; return baseModel;
} }
static Future<FixedDetailModel> reportRepairFindBYLD(int id) async{
BaseModel baseModel = await NetUtil().post(
API.manager.reportRepairFindBYLD,
params: {
'repairId':id,
},
showMessage: false,
);
return FixedDetailModel.fromJson(baseModel.data);
}
} }

@ -5,6 +5,7 @@ import 'package:akuCommunity/pages/manager_func.dart';
import 'package:akuCommunity/pages/things_page/widget/add_fixed_submit_page.dart'; import 'package:akuCommunity/pages/things_page/widget/add_fixed_submit_page.dart';
import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart'; import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart';
import 'package:akuCommunity/pages/things_page/widget/fixed_check_box.dart'; import 'package:akuCommunity/pages/things_page/widget/fixed_check_box.dart';
import 'package:akuCommunity/pages/things_page/widget/fixed_detail_page.dart';
import 'package:akuCommunity/provider/user_provider.dart'; import 'package:akuCommunity/provider/user_provider.dart';
import 'package:akuCommunity/utils/bee_map.dart'; import 'package:akuCommunity/utils/bee_map.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart';
@ -82,64 +83,70 @@ class _FixedSubmitPageState extends State<FixedSubmitPage> {
bottom: 0, bottom: 0,
duration: Duration(milliseconds: 300), duration: Duration(milliseconds: 300),
curve: Curves.easeInOutCubic, curve: Curves.easeInOutCubic,
child: Container( child: GestureDetector(
width: 686.w, onTap: () {
decoration: BoxDecoration( FixedDetailPage(model.id).to();
color: kForeGroundColor, borderRadius: BorderRadius.circular(8.w)), },
child: Column( child: Container(
crossAxisAlignment: CrossAxisAlignment.start, width: 686.w,
children: [ decoration: BoxDecoration(
Padding( color: kForeGroundColor,
padding: EdgeInsets.fromLTRB(24.w, 24.w, 24.w, 0), borderRadius: BorderRadius.circular(8.w)),
child: Row( child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
BeeMap() children: [
.fixTag[model.type] Padding(
.text padding: EdgeInsets.fromLTRB(24.w, 24.w, 24.w, 0),
.color(ktextPrimary) child: Row(
.bold children: [
.size(32.sp) BeeMap()
.make(), .fixTag[model.type]
Spacer(), .text
BeeMap() .color(ktextPrimary)
.fixState[model.status] .bold
.text .size(32.sp)
.color(_getColor(model.status)) .make(),
.size(24.sp) Spacer(),
.make(), BeeMap()
], .fixState[model.status]
.text
.color(_getColor(model.status))
.size(24.sp)
.make(),
],
),
), ),
), 24.hb,
24.hb, Padding(
Padding( padding: EdgeInsets.symmetric(
padding: EdgeInsets.symmetric( horizontal: 24.w,
horizontal: 24.w, ),
child: Divider(
thickness: 1.w,
height: 0,
),
), ),
child: Divider( 24.hb,
thickness: 1.w, Padding(
height: 0, padding: EdgeInsets.symmetric(
horizontal: 24.w,
),
child: model.reportDetail.text
.color(ktextSubColor)
.size(28.sp)
.ellipsis
.make(),
), ),
), // 16.hb,
24.hb, Padding(
Padding( padding: EdgeInsets.only(left: 8.w),
padding: EdgeInsets.symmetric( child: model.imgUrls.length != 0
horizontal: 24.w, ? HorizontalImageView(List.generate(model.imgUrls.length,
(index) => model.imgUrls[index].url))
: SizedBox(),
), ),
child: model.reportDetail.text ],
.color(ktextSubColor) ),
.size(28.sp)
.ellipsis
.make(),
),
// 16.hb,
Padding(
padding: EdgeInsets.only(left: 8.w),
child: model.imgUrls.length != 0
? HorizontalImageView(List.generate(model.imgUrls.length,
(index) => model.imgUrls[index].url))
: SizedBox(),
),
],
), ),
), ),
); );
@ -179,8 +186,8 @@ class _FixedSubmitPageState extends State<FixedSubmitPage> {
.bold .bold
.isIntrinsic .isIntrinsic
.make(), .make(),
onPressed: () async{ onPressed: () async {
await ManagerFunc.reportRepairDelete(_selected); await ManagerFunc.reportRepairDelete(_selected);
Get.back(); Get.back();
_selected.clear(); _selected.clear();
_easyRefreshController.callRefresh(); _easyRefreshController.callRefresh();

@ -0,0 +1,142 @@
import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/model/manager/fixed_detail_model.dart';
import 'package:akuCommunity/pages/manager_func.dart';
import 'package:akuCommunity/utils/bee_map.dart';
import 'package:akuCommunity/widget/bee_divider.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:akuCommunity/widget/horizontal_image_view.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:akuCommunity/utils/headers.dart';
class FixedDetailPage extends StatefulWidget {
final int id;
FixedDetailPage(
this.id, {
Key key,
}) : super(key: key);
@override
_FixedDetailPageState createState() => _FixedDetailPageState();
}
class _FixedDetailPageState extends State<FixedDetailPage> {
EasyRefreshController _easyRefreshController;
FixedDetailModel _model;
Color _getColor(int state) {
switch (state) {
case 1:
case 2:
case 3:
return kDarkPrimaryColor;
case 4:
case 5:
case 6:
case 7:
return ktextSubColor;
default:
return kDangerColor;
}
}
Widget _buildHead(FixedDetailModel model) {
return Container(
child: Column(
children: [
Padding(
padding: EdgeInsets.fromLTRB(28.w, 20.w, 20.w, 24.w),
child: Row(
children: [
'报修信息'.text.black.size(32.sp).bold.make(),
8.widthBox,
Container(
padding:
EdgeInsets.symmetric(horizontal: 20.w, vertical: 4.w),
decoration: BoxDecoration(
border: Border.all(
color: kPrimaryColor,
width: 2.w,
),
borderRadius: BorderRadius.circular(36.w),
color: Colors.transparent,
),
child: BeeMap()
.fixTag[model.appReportRepairVo.type]
.text
.black
.size(20.sp)
.make(),
),
Spacer(),
BeeMap()
.fixState[model.appReportRepairVo.status]
.text
.color(_getColor(_model.appReportRepairVo.status))
.size(24.sp)
.bold
.make()
],
),
),
BeeDivider.horizontal(
indent: 24.w,
endIndent: 20.w,
),
24.heightBox,
Padding(
padding: EdgeInsets.symmetric(horizontal: 28.w),
child: model.appReportRepairVo.reportDetail.text.black
.size(28.sp)
.maxLines(8)
.overflow(TextOverflow.ellipsis)
.make(),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 8.w),
child: HorizontalImageView(model.appReportRepairVo.imgUrls),
)
],
),
);
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '报事报修',
body: Column(
children: [
EasyRefresh(
firstRefresh: true,
controller: _easyRefreshController,
onRefresh: () async {
_model = await ManagerFunc.reportRepairFindBYLD(widget.id);
},
child: ListView(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 36.w),
children: [
_buildHead(_model),
].sepWidget(separate: 16.heightBox),
),
).expand(),
Padding(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).padding.bottom + 39.w),
child: MaterialButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(48.w)),
color: kPrimaryColor,
padding: EdgeInsets.symmetric(horizontal: 278.w, vertical: 26.w),
elevation: 0,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
onPressed: () {},
child: '确认完成'.text.black.size(32.sp).bold.make(),
),
)
],
),
);
}
}

@ -16,17 +16,15 @@ class BeeDivider extends StatelessWidget {
this.isHorizontal}) this.isHorizontal})
: super(key: key); : super(key: key);
BeeDivider.horizontal({ BeeDivider.horizontal({
Key key, Key key, this.indent, this.endIndent,
}) : indent = 0, }) :
endIndent = 0,
thickness = 1.w, thickness = 1.w,
color = Color(0xFFE8E8E8), color = Color(0xFFE8E8E8),
isHorizontal = true, isHorizontal = true,
super(key: key); super(key: key);
BeeDivider.vertical({ BeeDivider.vertical({
Key key, Key key, this.indent, this.endIndent,
}) : indent = 0, }) :
endIndent = 0,
thickness = 1.w, thickness = 1.w,
color = Color(0xFFE8E8E8), color = Color(0xFFE8E8E8),
isHorizontal = false, isHorizontal = false,

Loading…
Cancel
Save