|
@@ -2,16 +2,15 @@
|
|
|
import 'package:deus_app/common/style/TitleBar.dart';
|
|
import 'package:deus_app/common/style/TitleBar.dart';
|
|
|
import 'package:deus_app/model/maint_pesonse_entity.dart';
|
|
import 'package:deus_app/model/maint_pesonse_entity.dart';
|
|
|
import 'package:deus_app/page/maint/maint_job_detail.dart';
|
|
import 'package:deus_app/page/maint/maint_job_detail.dart';
|
|
|
-import 'package:deus_app/page/patrol/patrol_job_detail.dart';
|
|
|
|
|
|
|
+import 'package:flutter/cupertino.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
+import 'package:pull_to_refresh/pull_to_refresh.dart';
|
|
|
|
|
+
|
|
|
import '../../common/style/gsy_style.dart';
|
|
import '../../common/style/gsy_style.dart';
|
|
|
import '../../common/utils/ConstantString.dart';
|
|
import '../../common/utils/ConstantString.dart';
|
|
|
import '../../common/utils/DioUtil.dart';
|
|
import '../../common/utils/DioUtil.dart';
|
|
|
-import '../../common/utils/ToastUtils.dart';
|
|
|
|
|
-import '../../model/patrol_response_entity.dart';
|
|
|
|
|
import '../../widget/MaintJobDrawer.dart';
|
|
import '../../widget/MaintJobDrawer.dart';
|
|
|
|
|
|
|
|
-
|
|
|
|
|
class MaintJobPage extends StatefulWidget {
|
|
class MaintJobPage extends StatefulWidget {
|
|
|
const MaintJobPage({super.key});
|
|
const MaintJobPage({super.key});
|
|
|
|
|
|
|
@@ -23,31 +22,70 @@ class MaintJobPage extends StatefulWidget {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-List<MaintJobVO> maint_job_list = [];
|
|
|
|
|
|
|
+List<MaintJobVO> maint_job_list = <MaintJobVO>[];
|
|
|
|
|
+
|
|
|
|
|
+int index = 1;
|
|
|
|
|
+
|
|
|
class _MaintJobPage extends State<MaintJobPage> {
|
|
class _MaintJobPage extends State<MaintJobPage> {
|
|
|
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
|
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
|
|
|
|
+ final RefreshController _refreshController =
|
|
|
|
|
+ RefreshController(initialRefresh: false);
|
|
|
|
|
|
|
|
- _load() async {
|
|
|
|
|
- var result = await DioUtil().request('maintJob/list',
|
|
|
|
|
- method: DioMethod.post, data: {'query': {}, 'index': 1, 'size': 5});
|
|
|
|
|
|
|
+ MaintJobList maintJobList = MaintJobList();
|
|
|
|
|
|
|
|
|
|
+ String _device = '', _num = '';
|
|
|
|
|
+ dynamic _stase;
|
|
|
|
|
|
|
|
- MaintJobResponse maintJobResponse= MaintJobResponse.fromJson(result);
|
|
|
|
|
|
|
+ _load() async {
|
|
|
|
|
+ var result = await DioUtil().request('maintJob/list',
|
|
|
|
|
+ method: DioMethod.post,
|
|
|
|
|
+ data: {'query': {'jobName':_device,'jobNum':_num,'status':_stase}, 'index': index, 'size': 20});
|
|
|
|
|
+ _refreshController.loadComplete();
|
|
|
|
|
+ _refreshController.refreshCompleted();
|
|
|
|
|
+ MaintJobResponse maintJobResponse = MaintJobResponse.fromJson(result);
|
|
|
|
|
+ maintJobList = maintJobResponse.data!;
|
|
|
|
|
+ setState(() {
|
|
|
|
|
+ if(index==1){
|
|
|
|
|
+ maint_job_list.clear();
|
|
|
|
|
+ }
|
|
|
|
|
+ maint_job_list.addAll(maintJobList.list!);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- MaintJobList maintJobList = maintJobResponse.data!;
|
|
|
|
|
|
|
+ void _onRefresh() async {
|
|
|
|
|
+ // monitor network fetch
|
|
|
|
|
+ // await Future.delayed(Duration(milliseconds: 1000));
|
|
|
|
|
+ // if failed,use refreshFailed()
|
|
|
|
|
+ if (mounted) {
|
|
|
|
|
+ setState(() {
|
|
|
|
|
+ index = 0;
|
|
|
|
|
+ _load();
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- maint_job_list = maintJobList.list!;
|
|
|
|
|
|
|
+ void _onLoading() async {
|
|
|
|
|
+ // monitor network fetch
|
|
|
|
|
+ // await Future.delayed(Duration(milliseconds: 1000));
|
|
|
|
|
+ // if failed,use loadFailed(),if no data return,use LoadNodata()
|
|
|
|
|
+ // items.add((items.length+1).toString());
|
|
|
|
|
+ if (mounted) {
|
|
|
|
|
+ setState(() {
|
|
|
|
|
+ if (maintJobList.total! > maint_job_list.length) {
|
|
|
|
|
+ index++;
|
|
|
|
|
+ _load();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ _refreshController.loadNoData();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
@override
|
|
|
void initState() {
|
|
void initState() {
|
|
|
// TODO: implement initState
|
|
// TODO: implement initState
|
|
|
super.initState();
|
|
super.initState();
|
|
|
- Future.delayed(
|
|
|
|
|
- Duration.zero,
|
|
|
|
|
- () => setState(() {
|
|
|
|
|
- _load();
|
|
|
|
|
- }));
|
|
|
|
|
|
|
+ _load();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
@override
|
|
@@ -58,20 +96,24 @@ class _MaintJobPage extends State<MaintJobPage> {
|
|
|
_scaffoldKey.currentState?.openEndDrawer();
|
|
_scaffoldKey.currentState?.openEndDrawer();
|
|
|
}),
|
|
}),
|
|
|
endDrawer: MaintJobDrawer(
|
|
endDrawer: MaintJobDrawer(
|
|
|
- callback: (index, str) {
|
|
|
|
|
- showToast(str);
|
|
|
|
|
|
|
+ callback: (String device, String num, dynamic stase) {
|
|
|
|
|
+ _device = device;
|
|
|
|
|
+ _num = num;
|
|
|
|
|
+ _stase = stase;
|
|
|
|
|
+ index = 0;
|
|
|
|
|
+ _load();
|
|
|
},
|
|
},
|
|
|
),
|
|
),
|
|
|
//抽屉
|
|
//抽屉
|
|
|
backgroundColor: const Color(0xfff2f2f2),
|
|
backgroundColor: const Color(0xfff2f2f2),
|
|
|
body: Column(
|
|
body: Column(
|
|
|
children: [
|
|
children: [
|
|
|
- SizedBox(
|
|
|
|
|
|
|
+ const SizedBox(
|
|
|
height: 10,
|
|
height: 10,
|
|
|
),
|
|
),
|
|
|
Row(
|
|
Row(
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
- children: [
|
|
|
|
|
|
|
+ children: const [
|
|
|
SizedBox(
|
|
SizedBox(
|
|
|
width: 15,
|
|
width: 15,
|
|
|
),
|
|
),
|
|
@@ -81,13 +123,43 @@ class _MaintJobPage extends State<MaintJobPage> {
|
|
|
),
|
|
),
|
|
|
Expanded(
|
|
Expanded(
|
|
|
child: Container(
|
|
child: Container(
|
|
|
- child: ListView.builder(
|
|
|
|
|
- itemCount: maint_job_list.length,
|
|
|
|
|
- itemBuilder: (context, index) {
|
|
|
|
|
- MaintJobVO maintJobVO = maint_job_list[index];
|
|
|
|
|
- return _maint_job_list(maintJobVO);
|
|
|
|
|
- },
|
|
|
|
|
- )))
|
|
|
|
|
|
|
+ child: SmartRefresher(
|
|
|
|
|
+ enablePullDown: true,
|
|
|
|
|
+ enablePullUp: true,
|
|
|
|
|
+ header: WaterDropHeader(),
|
|
|
|
|
+ footer: CustomFooter(
|
|
|
|
|
+ builder: (BuildContext context, LoadStatus? mode) {
|
|
|
|
|
+ Widget body;
|
|
|
|
|
+ if (mode == LoadStatus.idle) {
|
|
|
|
|
+ body = Text("上拉加载");
|
|
|
|
|
+ } else if (mode == LoadStatus.loading) {
|
|
|
|
|
+ body = CupertinoActivityIndicator();
|
|
|
|
|
+ } else if (mode == LoadStatus.failed) {
|
|
|
|
|
+ body = Text("加载失败!点击重试!");
|
|
|
|
|
+ } else if (mode == LoadStatus.canLoading) {
|
|
|
|
|
+ body = Text("松手,加载更多!");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ body = Text("没有更多数据了!");
|
|
|
|
|
+ }
|
|
|
|
|
+ return Container(
|
|
|
|
|
+ height: 55.0,
|
|
|
|
|
+ child: Center(child: body),
|
|
|
|
|
+ );
|
|
|
|
|
+ },
|
|
|
|
|
+ ),
|
|
|
|
|
+ controller: _refreshController,
|
|
|
|
|
+ onRefresh: _onRefresh,
|
|
|
|
|
+ onLoading: _onLoading,
|
|
|
|
|
+ // child:Expanded(
|
|
|
|
|
+ // child: Container(
|
|
|
|
|
+ child: ListView.builder(
|
|
|
|
|
+ itemCount: maint_job_list.length,
|
|
|
|
|
+ itemBuilder: (context, index) {
|
|
|
|
|
+ MaintJobVO maintJobVO = maint_job_list[index];
|
|
|
|
|
+ return _maint_job_list(maintJobVO);
|
|
|
|
|
+ },
|
|
|
|
|
+ ),
|
|
|
|
|
+ )))
|
|
|
],
|
|
],
|
|
|
));
|
|
));
|
|
|
}
|
|
}
|
|
@@ -113,42 +185,40 @@ class _MaintJobPage extends State<MaintJobPage> {
|
|
|
),
|
|
),
|
|
|
Container(
|
|
Container(
|
|
|
padding:
|
|
padding:
|
|
|
- EdgeInsets.only(top: 3, bottom: 3, left: 5, right: 5),
|
|
|
|
|
|
|
+ EdgeInsets.only(top: 3, bottom: 3, left: 5, right: 5),
|
|
|
child: Text(
|
|
child: Text(
|
|
|
- maintJobVO.status == 2
|
|
|
|
|
|
|
+ maintJobVO.status == 0
|
|
|
? '已关闭'
|
|
? '已关闭'
|
|
|
- : maintJobVO.status == 3
|
|
|
|
|
- ? '执行中'
|
|
|
|
|
- : maintJobVO.status == 5
|
|
|
|
|
- ? '已完成'
|
|
|
|
|
: maintJobVO.status == 1
|
|
: maintJobVO.status == 1
|
|
|
- ? '待执行'
|
|
|
|
|
- : maintJobVO.status == 4
|
|
|
|
|
- ? '已逾期'
|
|
|
|
|
- : '未知',
|
|
|
|
|
|
|
+ ? '执行中'
|
|
|
|
|
+ : maintJobVO.status == 2
|
|
|
|
|
+ ? '已完成'
|
|
|
|
|
+ : maintJobVO.status == 3
|
|
|
|
|
+ ? '待执行'
|
|
|
|
|
+ : maintJobVO.status == 4
|
|
|
|
|
+ ? '已逾期'
|
|
|
|
|
+ : '未知',
|
|
|
textAlign: TextAlign.right,
|
|
textAlign: TextAlign.right,
|
|
|
style: TextStyle(
|
|
style: TextStyle(
|
|
|
- color:
|
|
|
|
|
- maintJobVO.status == 0 || maintJobVO.status == 4
|
|
|
|
|
|
|
+ color: maintJobVO.status == 0 || maintJobVO.status == 4
|
|
|
? Colors.red
|
|
? Colors.red
|
|
|
: maintJobVO.status == 3
|
|
: maintJobVO.status == 3
|
|
|
- ? Colors.orange
|
|
|
|
|
- : maintJobVO.status == 2
|
|
|
|
|
- ? Colors.green
|
|
|
|
|
- : Colors.black, //边框颜色
|
|
|
|
|
|
|
+ ? Colors.orange
|
|
|
|
|
+ : maintJobVO.status == 2
|
|
|
|
|
+ ? Colors.blue
|
|
|
|
|
+ : Colors.black, //边框颜色
|
|
|
fontSize: GSYConstant.minTextSize,
|
|
fontSize: GSYConstant.minTextSize,
|
|
|
),
|
|
),
|
|
|
),
|
|
),
|
|
|
decoration: BoxDecoration(
|
|
decoration: BoxDecoration(
|
|
|
border: new Border.all(
|
|
border: new Border.all(
|
|
|
- color:
|
|
|
|
|
- maintJobVO.status == 0 || maintJobVO.status == 4
|
|
|
|
|
|
|
+ color: maintJobVO.status == 0 || maintJobVO.status == 4
|
|
|
? Colors.red
|
|
? Colors.red
|
|
|
: maintJobVO.status == 3
|
|
: maintJobVO.status == 3
|
|
|
- ? Colors.orange
|
|
|
|
|
- : maintJobVO.status == 2
|
|
|
|
|
- ? Colors.green
|
|
|
|
|
- : Colors.black, //边框颜色
|
|
|
|
|
|
|
+ ? Colors.orange
|
|
|
|
|
+ : maintJobVO.status == 2
|
|
|
|
|
+ ? Colors.blue
|
|
|
|
|
+ : Colors.black, //边框颜色
|
|
|
width: 1.0, //边框粗细
|
|
width: 1.0, //边框粗细
|
|
|
),
|
|
),
|
|
|
borderRadius: const BorderRadius.all(
|
|
borderRadius: const BorderRadius.all(
|
|
@@ -165,7 +235,7 @@ class _MaintJobPage extends State<MaintJobPage> {
|
|
|
'任务编号:',
|
|
'任务编号:',
|
|
|
style: TextStyle(
|
|
style: TextStyle(
|
|
|
color: GSYColors.primaryLightValue,
|
|
color: GSYColors.primaryLightValue,
|
|
|
- fontSize: GSYConstant.middleTextWhiteSize,
|
|
|
|
|
|
|
+ fontSize: GSYConstant.smallTextSize,
|
|
|
),
|
|
),
|
|
|
),
|
|
),
|
|
|
),
|
|
),
|
|
@@ -175,7 +245,7 @@ class _MaintJobPage extends State<MaintJobPage> {
|
|
|
textAlign: TextAlign.right,
|
|
textAlign: TextAlign.right,
|
|
|
style: TextStyle(
|
|
style: TextStyle(
|
|
|
color: GSYColors.primaryLightValue,
|
|
color: GSYColors.primaryLightValue,
|
|
|
- fontSize: GSYConstant.middleTextWhiteSize,
|
|
|
|
|
|
|
+ fontSize: GSYConstant.smallTextSize,
|
|
|
),
|
|
),
|
|
|
),
|
|
),
|
|
|
),
|
|
),
|
|
@@ -189,7 +259,7 @@ class _MaintJobPage extends State<MaintJobPage> {
|
|
|
'任务开始时间:',
|
|
'任务开始时间:',
|
|
|
style: TextStyle(
|
|
style: TextStyle(
|
|
|
color: GSYColors.primaryLightValue,
|
|
color: GSYColors.primaryLightValue,
|
|
|
- fontSize: GSYConstant.middleTextWhiteSize,
|
|
|
|
|
|
|
+ fontSize: GSYConstant.smallTextSize,
|
|
|
),
|
|
),
|
|
|
),
|
|
),
|
|
|
),
|
|
),
|
|
@@ -199,7 +269,7 @@ class _MaintJobPage extends State<MaintJobPage> {
|
|
|
textAlign: TextAlign.right,
|
|
textAlign: TextAlign.right,
|
|
|
style: TextStyle(
|
|
style: TextStyle(
|
|
|
color: GSYColors.primaryLightValue,
|
|
color: GSYColors.primaryLightValue,
|
|
|
- fontSize: GSYConstant.middleTextWhiteSize,
|
|
|
|
|
|
|
+ fontSize: GSYConstant.smallTextSize,
|
|
|
),
|
|
),
|
|
|
),
|
|
),
|
|
|
),
|
|
),
|
|
@@ -213,7 +283,7 @@ class _MaintJobPage extends State<MaintJobPage> {
|
|
|
'任务结束时间:',
|
|
'任务结束时间:',
|
|
|
style: TextStyle(
|
|
style: TextStyle(
|
|
|
color: GSYColors.primaryLightValue,
|
|
color: GSYColors.primaryLightValue,
|
|
|
- fontSize: GSYConstant.middleTextWhiteSize,
|
|
|
|
|
|
|
+ fontSize: GSYConstant.smallTextSize,
|
|
|
),
|
|
),
|
|
|
),
|
|
),
|
|
|
),
|
|
),
|
|
@@ -223,7 +293,7 @@ class _MaintJobPage extends State<MaintJobPage> {
|
|
|
textAlign: TextAlign.right,
|
|
textAlign: TextAlign.right,
|
|
|
style: TextStyle(
|
|
style: TextStyle(
|
|
|
color: GSYColors.primaryLightValue,
|
|
color: GSYColors.primaryLightValue,
|
|
|
- fontSize: GSYConstant.middleTextWhiteSize,
|
|
|
|
|
|
|
+ fontSize: GSYConstant.smallTextSize,
|
|
|
),
|
|
),
|
|
|
),
|
|
),
|
|
|
),
|
|
),
|
|
@@ -237,7 +307,8 @@ class _MaintJobPage extends State<MaintJobPage> {
|
|
|
Navigator.push(
|
|
Navigator.push(
|
|
|
context,
|
|
context,
|
|
|
MaterialPageRoute(
|
|
MaterialPageRoute(
|
|
|
- builder: (context) => new MaintJobDetail(id:maintJobVO.id)));
|
|
|
|
|
|
|
+ builder: (context) =>
|
|
|
|
|
+ new MaintJobDetail(id: maintJobVO.id)));
|
|
|
},
|
|
},
|
|
|
));
|
|
));
|
|
|
}
|
|
}
|