修复了一些问题

hmxc
张萌 4 years ago
parent ad9d4febc9
commit 9d14c37c82

@ -47,170 +47,163 @@ class _InspectionManageCardState extends State<InspectionManageCard> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return AkuButton(
mainAxisSize: MainAxisSize.min, onPressed: () {
children: [ Get.to(
16.w.heightBox, InspectionManageDetailsPage(
AkuButton( inspectionStatus: widget.cardModel.status,
onPressed: () { executeId: widget.cardModel.id,
Get.to( ),
InspectionManageDetailsPage( );
inspectionStatus: widget.cardModel.status, },
executeId: widget.cardModel.id, child: Container(
), alignment: Alignment.centerLeft,
); padding: EdgeInsets.only(left: 24.w, right: 24.w, bottom: 40.w),
}, width: double.infinity,
child: Container( decoration: BoxDecoration(
alignment: Alignment.centerLeft, borderRadius: BorderRadius.circular(8.w), color: Color(0xFFFFFFFF)),
padding: EdgeInsets.only(left: 24.w, right: 24.w, bottom: 40.w), child: Column(children: [
Container(
height: 93.w,
width: double.infinity, width: double.infinity,
decoration: BoxDecoration( alignment: Alignment.centerLeft,
borderRadius: BorderRadius.circular(8.w), child: Row(
color: Color(0xFFFFFFFF)), children: [
child: Column(children: [ Text(
Container( '${widget.cardModel.name}',
height: 93.w, overflow: TextOverflow.ellipsis,
width: double.infinity, style: TextStyle(
alignment: Alignment.centerLeft, color: AppStyle.primaryTextColor,
child: Row( fontSize: 32.sp,
children: [ fontWeight: FontWeight.bold),
Text( ).expand(),
'${widget.cardModel.name}', _inspectionStatus[widget.cardModel.status]
overflow: TextOverflow.ellipsis, .text
style: TextStyle( .color(_inspectionColor(widget.cardModel.status))
color: AppStyle.primaryTextColor, .bold
fontSize: 32.sp, .size(28.sp)
fontWeight: FontWeight.bold), .make()
).expand(), ],
_inspectionStatus[widget.cardModel.status] ),
.text ),
.color(_inspectionColor(widget.cardModel.status)) Divider(height: 1.w),
.bold 24.w.heightBox,
.size(28.sp) Row(
.make() crossAxisAlignment: CrossAxisAlignment.start,
], children: [
), Image.asset(
R.ASSETS_MANAGE_IC_RENWU_PNG,
width: 40.w,
height: 40.w,
), ),
Divider(height: 1.w), 4.w.widthBox,
24.w.heightBox,
Row( Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Image.asset( Text(
R.ASSETS_MANAGE_IC_RENWU_PNG, '巡检编号',
width: 40.w, style: _textstyle,
height: 40.w,
), ),
4.w.widthBox, ],
),
36.w.widthBox,
Text(
widget.cardModel.code,
maxLines: 2,
textAlign: TextAlign.right,
style: AppStyle().primaryStyle,
).expand()
],
),
12.w.heightBox,
...isManager
? [
Row( Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Image.asset(
R.ASSETS_MANAGE_IC_RENWU_PNG,
width: 40.w,
height: 40.w,
),
4.w.widthBox,
Text( Text(
'巡检编号', '巡检',
style: _textstyle, style: _textstyle,
), ),
Spacer(),
Text(
widget.cardModel.inspectorName,
style: AppStyle().primaryStyle,
)
], ],
), ),
36.w.widthBox, 12.w.heightBox,
Text( ]
widget.cardModel.code, : [SizedBox()],
maxLines: 2, Row(
textAlign: TextAlign.right, children: [
style: AppStyle().primaryStyle, Image.asset(
).expand() R.ASSETS_INSPECTION_IC_XUNJIAN_PNG,
], width: 40.w,
height: 40.w,
), ),
12.w.heightBox, 4.w.widthBox,
...isManager Text('规定巡检时间', style: _textstyle),
? [ Spacer(),
Row( Text(
children: [ '${DateUtil.formatDateStr(widget.cardModel.beginDate, format: "yyyy-MM-dd HH:mm")}${widget.cardModel?.endDate == null ? '' : DateUtil.formatDateStr(widget.cardModel.endDate, format: "HH:mm")}',
Image.asset( style: AppStyle().primaryStyle,
R.ASSETS_MANAGE_IC_RENWU_PNG,
width: 40.w,
height: 40.w,
),
4.w.widthBox,
Text(
'巡检人',
style: _textstyle,
),
Spacer(),
Text(
widget.cardModel.inspectorName,
style: AppStyle().primaryStyle,
)
],
),
12.w.heightBox,
]
: [SizedBox()],
Row(
children: [
Image.asset(
R.ASSETS_INSPECTION_IC_XUNJIAN_PNG,
width: 40.w,
height: 40.w,
),
4.w.widthBox,
Text('规定巡检时间', style: _textstyle),
Spacer(),
Text(
'${DateUtil.formatDateStr(widget.cardModel.beginDate, format: "yyyy-MM-dd HH:mm")}${widget.cardModel?.endDate == null ? '' : DateUtil.formatDateStr(widget.cardModel.endDate, format: "HH:mm")}',
style: AppStyle().primaryStyle,
),
],
), ),
12.w.heightBox, ],
...widget?.cardModel?.actualBeginDate == null ),
? [SizedBox()] 12.w.heightBox,
: [ ...widget?.cardModel?.actualBeginDate == null
Row( ? [SizedBox()]
children: [ : [
Image.asset( Row(
R.ASSETS_MANAGE_IC_TIME_PNG, children: [
width: 40.w, Image.asset(
height: 40.w, R.ASSETS_MANAGE_IC_TIME_PNG,
), width: 40.w,
4.w.widthBox, height: 40.w,
Text( ),
'开始巡检时间', 4.w.widthBox,
style: _textstyle, Text(
), '开始巡检时间',
Spacer(), style: _textstyle,
Text( ),
'${DateUtil.formatDateStr(widget.cardModel.actualBeginDate, format: "yyyy-MM-dd HH:mm")}', Spacer(),
style: AppStyle().primaryStyle, Text(
), '${DateUtil.formatDateStr(widget.cardModel.actualBeginDate, format: "yyyy-MM-dd HH:mm")}',
], style: AppStyle().primaryStyle,
), ),
12.w.heightBox,
], ],
widget?.cardModel?.actualEndDate == null ),
? SizedBox() 12.w.heightBox,
: Row( ],
children: [ widget?.cardModel?.actualEndDate == null
Image.asset( ? SizedBox()
R.ASSETS_MESSAGE_IC_PEOPLE_PNG, : Row(
width: 40.w, children: [
height: 40.w, Image.asset(
), R.ASSETS_MESSAGE_IC_PEOPLE_PNG,
4.w.widthBox, width: 40.w,
Text( height: 40.w,
'结束巡检时间', ),
style: _textstyle, 4.w.widthBox,
), Text(
Spacer(), '结束巡检时间',
Text( style: _textstyle,
'${DateUtil.formatDateStr(widget.cardModel.actualEndDate, format: "yyyy-MM-dd HH:mm")}', ),
style: AppStyle().primaryStyle, Spacer(),
), Text(
], '${DateUtil.formatDateStr(widget.cardModel.actualEndDate, format: "yyyy-MM-dd HH:mm")}',
) style: AppStyle().primaryStyle,
]), ),
), ],
), )
], ]),
),
); );
} }
} }

@ -83,10 +83,18 @@ class _InspectionManageDetailsPageState
onRefresh: () async { onRefresh: () async {
_detailModel = _detailModel =
await ManageFunc.getInspectionDetail(widget.executeId); await ManageFunc.getInspectionDetail(widget.executeId);
ManageFunc.getInspectionPoint(widget.executeId).then((value) { await ManageFunc.getInspectionPoint(_detailModel.inspectionPlanId)
_pointModels = .then(
value.map((e) => InspectionPointModel.fromJson(e)).toList(); (value) {
}); if (value == null) {
_pointModels = [];
} else {
_pointModels = value
.map((e) => InspectionPointModel.fromJson(e))
.toList();
}
},
);
_onload = false; _onload = false;
setState(() {}); setState(() {});
}, },
@ -108,6 +116,11 @@ class _InspectionManageDetailsPageState
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
'巡检站点'.text.black.size(32.sp).bold.make(), '巡检站点'.text.black.size(32.sp).bold.make(),
..._pointModels
?.map((e) => _buildInspectionTile(
e.name, e.checkNum, e.id))
?.toList() ??
[]
].sepWidget(separate: 16.w.heightBox), ].sepWidget(separate: 16.w.heightBox),
), ),
) )
@ -118,7 +131,12 @@ class _InspectionManageDetailsPageState
onPressed: () {}, onPressed: () {},
padding: EdgeInsets.symmetric(vertical: 26.w), padding: EdgeInsets.symmetric(vertical: 26.w),
color: kPrimaryColor, color: kPrimaryColor,
child: '开始巡检'.text.black.bold.size(32.sp).make(), child: (widget.inspectionStatus == 1 ? '开始巡检' : '立即扫码')
.text
.black
.bold
.size(32.sp)
.make(),
).pOnly(bottom: MediaQuery.of(context).padding.bottom)); ).pOnly(bottom: MediaQuery.of(context).padding.bottom));
} }
@ -217,7 +235,7 @@ class _InspectionManageDetailsPageState
Text('规定巡检时间', style: _textstyle), Text('规定巡检时间', style: _textstyle),
Spacer(), Spacer(),
Text( Text(
'${DateUtil.formatDateStr(_detailModel.beginDate, format: "yyyy-MM-dd HH:mm")}${_detailModel?.endDate == null ? '' : DateUtil.formatDateStr(_detailModel.endDate, format: "HH:mm")}', '${DateUtil.formatDateStr(_detailModel.beginDate, format: "yyyy-MM-dd HH:mm")}${_detailModel?.endDate == null ? '' : ''}${_detailModel?.endDate == null ? '' : DateUtil.formatDateStr(_detailModel.endDate, format: "HH:mm")}',
style: AppStyle().primaryStyle, style: AppStyle().primaryStyle,
), ),
], ],

@ -43,12 +43,12 @@ class _InspectionMangeViewState extends State<InspectionMangeView> {
}, },
builder: (items) { builder: (items) {
return ListView.separated( return ListView.separated(
padding: EdgeInsets.symmetric(horizontal: 32.w), padding: EdgeInsets.fromLTRB(32.w, 16.w, 32.w, 16.w),
itemBuilder: (context, index) { itemBuilder: (context, index) {
return InspectionManageCard(cardModel: items[index]); return InspectionManageCard(cardModel: items[index]);
}, },
separatorBuilder: (context, index) { separatorBuilder: (context, index) {
return 8.w.heightBox; return 16.w.heightBox;
}, },
itemCount: items.length, itemCount: items.length,
); );

Loading…
Cancel
Save