|
|
@@ -21,32 +21,34 @@ import 'package:flutter/cupertino.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:wechat_assets_picker/wechat_assets_picker.dart';
|
|
|
|
|
|
-
|
|
|
class MairintJobEdit extends StatefulWidget {
|
|
|
-
|
|
|
static var routeName = "/PatrolJobEdit";
|
|
|
|
|
|
var id;
|
|
|
+
|
|
|
@override
|
|
|
State createState() {
|
|
|
return _MairintJobEdit(id);
|
|
|
}
|
|
|
+
|
|
|
MairintJobEdit({super.key, @required this.id});
|
|
|
}
|
|
|
|
|
|
class _MairintJobEdit extends State<MairintJobEdit> {
|
|
|
-
|
|
|
- List<MaintJobItemsListResponseData> patrolItemVOS = <MaintJobItemsListResponseData>[];
|
|
|
+ List<MaintJobItemsListResponseData> patrolItemVOS =
|
|
|
+ <MaintJobItemsListResponseData>[];
|
|
|
|
|
|
List<AssetEntity> imageFiles = [];
|
|
|
|
|
|
- List<int>mList=[];
|
|
|
+ List<int> mList = [];
|
|
|
|
|
|
var id;
|
|
|
|
|
|
var _event;
|
|
|
|
|
|
- String note='';
|
|
|
+ String note = '';
|
|
|
+
|
|
|
+ FocusNode focusNode = FocusNode();
|
|
|
|
|
|
_MairintJobEdit(this.id);
|
|
|
|
|
|
@@ -73,7 +75,9 @@ class _MairintJobEdit extends State<MairintJobEdit> {
|
|
|
child: SizedBox(
|
|
|
height: 50,
|
|
|
child: TextButton(
|
|
|
- onPressed: () {},
|
|
|
+ onPressed: () {
|
|
|
+ Navigator.pop(context);
|
|
|
+ },
|
|
|
child: Text(ConstantString.back),
|
|
|
style: ButtonStyle(
|
|
|
backgroundColor: MaterialStateProperty.all<Color>(
|
|
|
@@ -82,7 +86,7 @@ class _MairintJobEdit extends State<MairintJobEdit> {
|
|
|
BeveledRectangleBorder(
|
|
|
borderRadius: BorderRadius.circular(0))),
|
|
|
foregroundColor:
|
|
|
- MaterialStateProperty.all<Color>(Colors.white),
|
|
|
+ MaterialStateProperty.all<Color>(Colors.white),
|
|
|
// padding: MaterialStateProperty.all(EdgeInsets.zero)
|
|
|
),
|
|
|
),
|
|
|
@@ -90,29 +94,29 @@ class _MairintJobEdit extends State<MairintJobEdit> {
|
|
|
),
|
|
|
Expanded(
|
|
|
child: SizedBox(
|
|
|
- height: 50,
|
|
|
- child: TextButton(
|
|
|
- onPressed: () {
|
|
|
- CloseTaskDialog.showAlertDialog(context, () {
|
|
|
- if(imageFiles.isNotEmpty){
|
|
|
- uploadList();
|
|
|
- }else{
|
|
|
- patrolJobRemark();
|
|
|
- }
|
|
|
- }, '您确认完成维保?');
|
|
|
- },
|
|
|
- child: Text(ConstantString.complete),
|
|
|
- style: ButtonStyle(
|
|
|
- backgroundColor:
|
|
|
+ height: 50,
|
|
|
+ child: TextButton(
|
|
|
+ onPressed: () {
|
|
|
+ CloseTaskDialog.showAlertDialog(context, () {
|
|
|
+ if (imageFiles.isNotEmpty) {
|
|
|
+ uploadList();
|
|
|
+ } else {
|
|
|
+ patrolJobRemark();
|
|
|
+ }
|
|
|
+ }, '您确认完成维保?');
|
|
|
+ },
|
|
|
+ child: Text(ConstantString.complete),
|
|
|
+ style: ButtonStyle(
|
|
|
+ backgroundColor:
|
|
|
MaterialStateProperty.all<Color>(Colors.blue),
|
|
|
- foregroundColor:
|
|
|
+ foregroundColor:
|
|
|
MaterialStateProperty.all<Color>(Colors.white),
|
|
|
- shape: MaterialStateProperty.all(BeveledRectangleBorder(
|
|
|
- borderRadius: BorderRadius.circular(0))),
|
|
|
- // padding: MaterialStateProperty.all(EdgeInsets.zero)
|
|
|
- ),
|
|
|
- ),
|
|
|
- )),
|
|
|
+ shape: MaterialStateProperty.all(BeveledRectangleBorder(
|
|
|
+ borderRadius: BorderRadius.circular(0))),
|
|
|
+ // padding: MaterialStateProperty.all(EdgeInsets.zero)
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ )),
|
|
|
],
|
|
|
),
|
|
|
)
|
|
|
@@ -130,34 +134,39 @@ class _MairintJobEdit extends State<MairintJobEdit> {
|
|
|
return ws;
|
|
|
}
|
|
|
|
|
|
- Widget _picture(){
|
|
|
+ Widget _picture() {
|
|
|
return Container(
|
|
|
child: Column(
|
|
|
- children: [
|
|
|
- Container(
|
|
|
- height: 50,
|
|
|
- padding: EdgeInsets.only(left: 12),
|
|
|
- alignment: Alignment.centerLeft,
|
|
|
- child: Text('巡检图片',style: TextStyle(
|
|
|
+ children: [
|
|
|
+ Container(
|
|
|
+ height: 50,
|
|
|
+ padding: EdgeInsets.only(left: 12),
|
|
|
+ alignment: Alignment.centerLeft,
|
|
|
+ child: Text('巡检图片',
|
|
|
+ style: TextStyle(
|
|
|
color: Colors.black,
|
|
|
fontSize: GSYConstant.TextSize15,
|
|
|
)),
|
|
|
- ),
|
|
|
- Container(
|
|
|
- // padding: EdgeInsets.only(left: 12,right: 12),
|
|
|
- decoration: BoxDecoration(color: Colors.white),
|
|
|
- child: PhotoTool(imageCount: 5, lineCount: 5, addCall: (List<AssetEntity> _imageFiles){
|
|
|
+ ),
|
|
|
+ Container(
|
|
|
+ padding: EdgeInsets.only(left: 12, right: 12),
|
|
|
+ decoration: BoxDecoration(color: Colors.white),
|
|
|
+ child: PhotoTool(
|
|
|
+ imageCount: 5,
|
|
|
+ lineCount: 5,
|
|
|
+ addCall: (List<AssetEntity> _imageFiles) {
|
|
|
imageFiles.addAll(_imageFiles);
|
|
|
- }, removeCall:(int index){
|
|
|
+ },
|
|
|
+ removeCall: (int index) {
|
|
|
imageFiles.remove(index);
|
|
|
- }),
|
|
|
- )
|
|
|
- ],
|
|
|
+ },
|
|
|
+ focusNode: focusNode),
|
|
|
)
|
|
|
- );
|
|
|
+ ],
|
|
|
+ ));
|
|
|
}
|
|
|
|
|
|
- Widget _notes(){
|
|
|
+ Widget _notes() {
|
|
|
return Container(
|
|
|
child: Column(
|
|
|
children: <Widget>[
|
|
|
@@ -165,13 +174,14 @@ class _MairintJobEdit extends State<MairintJobEdit> {
|
|
|
height: 50,
|
|
|
padding: EdgeInsets.only(left: 12),
|
|
|
alignment: Alignment.centerLeft,
|
|
|
- child: Text('任务结果备注',style: TextStyle(
|
|
|
- color: Colors.black,
|
|
|
- fontSize: GSYConstant.TextSize15,
|
|
|
- )),
|
|
|
+ child: Text('任务结果备注',
|
|
|
+ style: TextStyle(
|
|
|
+ color: Colors.black,
|
|
|
+ fontSize: GSYConstant.TextSize15,
|
|
|
+ )),
|
|
|
),
|
|
|
Container(
|
|
|
- padding: EdgeInsets.only(left: 12,right: 12,bottom: 12),
|
|
|
+ padding: EdgeInsets.only(left: 12, right: 12, bottom: 12),
|
|
|
decoration: BoxDecoration(color: Colors.white),
|
|
|
child: Column(
|
|
|
children: [
|
|
|
@@ -180,6 +190,7 @@ class _MairintJobEdit extends State<MairintJobEdit> {
|
|
|
),
|
|
|
TextField(
|
|
|
maxLines: 5,
|
|
|
+ focusNode: focusNode,
|
|
|
decoration: InputDecoration(border: OutlineInputBorder()),
|
|
|
style: TextStyle(fontSize: 14),
|
|
|
onChanged: (value) {
|
|
|
@@ -194,11 +205,11 @@ class _MairintJobEdit extends State<MairintJobEdit> {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- Widget _mainPatrolAdd(){
|
|
|
+ Widget _mainPatrolAdd() {
|
|
|
return Column(
|
|
|
children: [
|
|
|
Container(
|
|
|
- padding: EdgeInsets.fromLTRB(12,0, 12, 0),
|
|
|
+ padding: EdgeInsets.fromLTRB(12, 0, 12, 0),
|
|
|
height: 50,
|
|
|
child: Row(
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
@@ -213,11 +224,13 @@ class _MairintJobEdit extends State<MairintJobEdit> {
|
|
|
Container(
|
|
|
child: TextButton(
|
|
|
onPressed: () {
|
|
|
+ focusNode.unfocus();
|
|
|
Navigator.push(
|
|
|
context,
|
|
|
MaterialPageRoute(
|
|
|
- builder: (context) =>
|
|
|
- MaintJobSelect(id: id,)));
|
|
|
+ builder: (context) => MaintJobSelect(
|
|
|
+ id: id,
|
|
|
+ )));
|
|
|
},
|
|
|
child: Row(
|
|
|
children: [
|
|
|
@@ -261,12 +274,13 @@ class _MairintJobEdit extends State<MairintJobEdit> {
|
|
|
style: TextStyle(
|
|
|
fontSize: GSYConstant.middleTextWhiteSize,
|
|
|
fontWeight: FontWeight.bold)),
|
|
|
- IconButton(onPressed: (){
|
|
|
- deletePatrolItem(item.id);
|
|
|
- }, icon: new Icon(Icons.delete))
|
|
|
+ IconButton(
|
|
|
+ onPressed: () {
|
|
|
+ deletePatrolItem(item.id);
|
|
|
+ },
|
|
|
+ icon: new Icon(Icons.delete))
|
|
|
],
|
|
|
),
|
|
|
-
|
|
|
),
|
|
|
Container(
|
|
|
margin: const EdgeInsets.fromLTRB(0, 10.0, 0, 0),
|
|
|
@@ -292,7 +306,9 @@ class _MairintJobEdit extends State<MairintJobEdit> {
|
|
|
var result = await DioUtil().request('maintJob/app-items-list',
|
|
|
method: DioMethod.get, params: {'maintJobId': id});
|
|
|
if (0 == result['code']) {
|
|
|
- MaintJobItemsListResponseEntity jobEdit=maintJobItemsListResponseEntityFromJson(MaintJobItemsListResponseEntity(),result);
|
|
|
+ MaintJobItemsListResponseEntity jobEdit =
|
|
|
+ maintJobItemsListResponseEntityFromJson(
|
|
|
+ MaintJobItemsListResponseEntity(), result);
|
|
|
setState(() {
|
|
|
patrolItemVOS.clear();
|
|
|
patrolItemVOS.addAll(jobEdit.data);
|
|
|
@@ -315,7 +331,7 @@ class _MairintJobEdit extends State<MairintJobEdit> {
|
|
|
|
|
|
deletePatrolItem(int itemId) async {
|
|
|
var result = await DioUtil().request('maintJob/deleteItems',
|
|
|
- method: DioMethod.post, data: {'id': itemId,'jobId':id});
|
|
|
+ method: DioMethod.post, data: {'id': itemId, 'jobId': id});
|
|
|
if (result['code'] == 0) {
|
|
|
setState(() {
|
|
|
patrolItem();
|
|
|
@@ -335,17 +351,16 @@ class _MairintJobEdit extends State<MairintJobEdit> {
|
|
|
List<MultipartFile> files = [];
|
|
|
for (var element in imageFiles) {
|
|
|
File? imgFile = await element.file;
|
|
|
- String? s=imgFile?.path;
|
|
|
- MultipartFile file =MultipartFile.fromFileSync(s!);
|
|
|
+ String? s = imgFile?.path;
|
|
|
+ MultipartFile file = MultipartFile.fromFileSync(s!);
|
|
|
files.add(file);
|
|
|
}
|
|
|
- var formData =FormData.fromMap({
|
|
|
- 'files': files
|
|
|
- });
|
|
|
+ var formData = FormData.fromMap({'files': files});
|
|
|
var result = await DioUtil().request('uploadImg/uploadList',
|
|
|
method: DioMethod.post, data: formData);
|
|
|
if (result['code'] == 0) {
|
|
|
- UploadListEntityEntity data=uploadListEntityEntityFromJson(UploadListEntityEntity(), result);
|
|
|
+ UploadListEntityEntity data =
|
|
|
+ uploadListEntityEntityFromJson(UploadListEntityEntity(), result);
|
|
|
setState(() {
|
|
|
mList.clear();
|
|
|
mList.addAll(data.data);
|
|
|
@@ -358,17 +373,18 @@ class _MairintJobEdit extends State<MairintJobEdit> {
|
|
|
|
|
|
patrolJobRemark() async {
|
|
|
var result = await DioUtil().request('maintJob/complete',
|
|
|
- method: DioMethod.post, data: {'id': id,'fileIds':mList,'remarks':note});
|
|
|
+ method: DioMethod.post,
|
|
|
+ data: {'id': id, 'fileIds': mList, 'remarks': note});
|
|
|
if (result['code'] == 0) {
|
|
|
setState(() {
|
|
|
eventBus.fire(RefreshMaintDetail());
|
|
|
eventBus.fire(RefreshMaintPage());
|
|
|
- Navigator.of(context)..pop()..pop();
|
|
|
+ Navigator.of(context)
|
|
|
+ ..pop()
|
|
|
+ ..pop();
|
|
|
});
|
|
|
} else {
|
|
|
showToast(result['msg']);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|