对接 上传设施检查照片

对接 设施检查提交
hmxc
张萌 4 years ago
parent 179ff34094
commit 637c0910d0

@ -17,8 +17,12 @@ import 'package:aku_community_manager/tools/aku_divider.dart';
class FacilitiesCard extends StatefulWidget { class FacilitiesCard extends StatefulWidget {
final int index; final int index;
final int facilitiesType;
final FacilitiesCheckListModel model; final FacilitiesCheckListModel model;
FacilitiesCard({Key key, this.index, this.model}) : super(key: key); final VoidCallback callRefresh;
FacilitiesCard(
{Key key, this.index, this.model, this.facilitiesType, this.callRefresh})
: super(key: key);
@override @override
_FacilitiesCardState createState() => _FacilitiesCardState(); _FacilitiesCardState createState() => _FacilitiesCardState();
@ -64,8 +68,12 @@ class _FacilitiesCardState extends State<FacilitiesCard> {
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: 8.w, horizontal: 24.w), vertical: 8.w, horizontal: 24.w),
color: Color(0xFFFFC40C), color: Color(0xFFFFC40C),
onPressed: () { onPressed: () async {
Get.to(() => FacilitiesInspectReportPage()); await Get.to(() => FacilitiesInspectReportPage(
facilitiesType: widget.facilitiesType,
id: widget.model.id,
));
widget.callRefresh();
}, },
child: '填写报告' child: '填写报告'
.text .text
@ -84,8 +92,12 @@ class _FacilitiesCardState extends State<FacilitiesCard> {
.color(Colors.white) .color(Colors.white)
.padding(EdgeInsets.all(24.w)) .padding(EdgeInsets.all(24.w))
.make() .make()
.onInkTap(() { .onInkTap(() async {
Get.to(() => FacilitiesInspectReportPage()); await Get.to(() => FacilitiesInspectReportPage(
facilitiesType: widget.facilitiesType,
id: widget.model.id,
));
widget.callRefresh();
}); });
} }

@ -2,12 +2,17 @@
import 'dart:io'; import 'dart:io';
// Flutter imports: // Flutter imports:
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/ui/manage_pages/facilities/facilities_map.dart'; import 'package:aku_community_manager/ui/manage_pages/facilities/facilities_map.dart';
import 'package:aku_community_manager/utils/network/base_model.dart';
import 'package:aku_community_manager/utils/network/net_util.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// Package imports: // Package imports:
import 'package:aku_ui/common_widgets/aku_button.dart'; import 'package:aku_ui/common_widgets/aku_button.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';
// Project imports: // Project imports:
@ -17,7 +22,13 @@ import 'package:aku_community_manager/ui/widgets/app_widgets/aku_single_check_bu
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
class FacilitiesInspectReportPage extends StatefulWidget { class FacilitiesInspectReportPage extends StatefulWidget {
FacilitiesInspectReportPage({Key key}) : super(key: key); final int facilitiesType;
final int id;
FacilitiesInspectReportPage({
Key key,
@required this.facilitiesType,
@required this.id,
}) : super(key: key);
@override @override
_FacilitiesInspectReportPageState createState() => _FacilitiesInspectReportPageState createState() =>
@ -28,16 +39,20 @@ class _FacilitiesInspectReportPageState
extends State<FacilitiesInspectReportPage> { extends State<FacilitiesInspectReportPage> {
List<File> _selfPhotos; List<File> _selfPhotos;
List<File> _scenePhotos; List<File> _scenePhotos;
String _describtion;
int _scene = 0;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AkuScaffold( return AkuScaffold(
title: '检查报告', title: '检查报告',
body: ListView( body: ListView(
children: [ children: [
_basicMessageCard(), // _basicMessageCard(),
_descriptionCard('场地情况', 0), _descriptionCard(
widget.facilitiesType == 1 ? '设施情况' : '设备情况',
),
_scenePhotoCard(), _scenePhotoCard(),
_selfPhotoCard(), // _selfPhotoCard(),
], ],
), ),
bottom: _bottomSubmitButton(), bottom: _bottomSubmitButton(),
@ -46,7 +61,24 @@ class _FacilitiesInspectReportPageState
Widget _bottomSubmitButton() { Widget _bottomSubmitButton() {
return AkuButton( return AkuButton(
onPressed: () {}, onPressed: () async {
List<String> _scenePhotoUrl = await NetUtil().uploadFiles(
_scenePhotos,
API.upload.uploadFacilitiCheckPhoto,
);
BaseModel baseModel =
await NetUtil().post(API.manage.submitFacilitiesCheckInfo, params: {
"id": widget.id,
"situation": _scene,
"detail": _describtion,
"imgUrls": _scenePhotoUrl,
});
if (baseModel.status) {
Get.back();
}
BotToast.showText(text: baseModel.message);
},
width: double.infinity, width: double.infinity,
height: 100.w, height: 100.w,
child: '立即提交'.text.color(kTextPrimaryColor).bold.size(32.sp).make(), child: '立即提交'.text.color(kTextPrimaryColor).bold.size(32.sp).make(),
@ -104,11 +136,9 @@ class _FacilitiesInspectReportPageState
); );
} }
int _scene = 0;
Widget _descriptionCard( Widget _descriptionCard(
String title, String title,
int index, // int index,
) { ) {
return Column( return Column(
children: [ children: [
@ -156,7 +186,9 @@ class _FacilitiesInspectReportPageState
minLines: 5, minLines: 5,
maxLines: 10, maxLines: 10,
autofocus: false, autofocus: false,
onChanged: (value) {}, onChanged: (value) {
_describtion = value;
},
decoration: InputDecoration( decoration: InputDecoration(
hintText: '请详细描述异常情况', hintText: '请详细描述异常情况',
hintStyle: TextStyle( hintStyle: TextStyle(

@ -46,7 +46,8 @@ class _FacilitiesViewState extends State<FacilitiesView> {
controller: _refreshController, controller: _refreshController,
convert: (models) { convert: (models) {
return models.tableList return models.tableList
.map((e) => FacilitiesCheckListModel.fromJson(e)).toList(); .map((e) => FacilitiesCheckListModel.fromJson(e))
.toList();
}, },
builder: (items) { builder: (items) {
return ListView.separated( return ListView.separated(
@ -54,7 +55,11 @@ class _FacilitiesViewState extends State<FacilitiesView> {
itemBuilder: (context, index) { itemBuilder: (context, index) {
return FacilitiesCard( return FacilitiesCard(
index: widget.index, index: widget.index,
model:items[index], facilitiesType: widget.facilitiesType,
model: items[index],
callRefresh: () {
_refreshController.callRefresh();
},
); );
}, },
separatorBuilder: (_, __) { separatorBuilder: (_, __) {

Loading…
Cancel
Save