|
|
@@ -1,6 +1,11 @@
|
|
|
//巡检任务列表
|
|
|
import 'package:deus_app/common/style/TitleBar.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
|
+import '../../common/style/gsy_style.dart';
|
|
|
+import '../../common/utils/ConstantString.dart';
|
|
|
+import '../../common/utils/DioUtil.dart';
|
|
|
+import '../../model/patrol_response_entity.dart';
|
|
|
+import '../../widget/PatrolJobDrawer.dart';
|
|
|
|
|
|
class PatrolJobPage extends StatefulWidget {
|
|
|
const PatrolJobPage({super.key});
|
|
|
@@ -13,154 +18,265 @@ class PatrolJobPage extends StatefulWidget {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+Map<String,dynamic> map1 = {
|
|
|
+ 'name':'巡检任务',
|
|
|
+ 'number':'巡检任务编号',
|
|
|
+ 'count':3,
|
|
|
+ 'planName':'巡检计划名称',
|
|
|
+ 'planNumber':'巡检计划编号',
|
|
|
+ 'termType':1,
|
|
|
+ 'startDate':'2023-05-29 00:00:00',
|
|
|
+ 'endDate':'2023-05-20 23:59:59',
|
|
|
+ 'status':1
|
|
|
+};
|
|
|
+
|
|
|
+PatrolJobData p = PatrolJobData.toBean(map1);
|
|
|
+
|
|
|
+List<PatrolJobData> patrol_job_list = [p];
|
|
|
+
|
|
|
+
|
|
|
+PatrolJobData query = PatrolJobData();
|
|
|
+
|
|
|
class _PatrolJobPage extends State<PatrolJobPage> {
|
|
|
+ final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
|
|
+
|
|
|
+ _load() async {
|
|
|
+ var result = await DioUtil()
|
|
|
+ .request('patrolJob/getJobList', method: DioMethod.post, data: {
|
|
|
+ 'query': query,
|
|
|
+ 'index':1,
|
|
|
+ 'size':5
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @override
|
|
|
+ void initState() {
|
|
|
+ // TODO: implement initState
|
|
|
+ super.initState();
|
|
|
+ Future.delayed(Duration.zero,()=> setState((){
|
|
|
+ _load();
|
|
|
+ }));
|
|
|
+ }
|
|
|
+
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
return Scaffold(
|
|
|
- appBar: TitleBar().backAppbar(context, "巡检任务"),
|
|
|
+ key: _scaffoldKey,
|
|
|
+ appBar: TitleBar().drawAppBar(ConstantString.patrolJobText, () {
|
|
|
+ _scaffoldKey.currentState?.openEndDrawer();
|
|
|
+ }),
|
|
|
+ endDrawer: PatrolJobDrawer(), //抽屉
|
|
|
+ backgroundColor: const Color(0xfff2f2f2),
|
|
|
body: Column(
|
|
|
children: [
|
|
|
SizedBox(
|
|
|
- height: 1,
|
|
|
+ height: 10,
|
|
|
),
|
|
|
- Container(
|
|
|
- child: Text(
|
|
|
- '巡检任务来自于“巡检计划管理”,计划信息请登录pc端查看',
|
|
|
- style: TextStyle(fontSize: 14, color: Colors.white),
|
|
|
- ),
|
|
|
- height: 40,
|
|
|
- alignment: Alignment.center,
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: Colors.blueAccent, //背景色
|
|
|
- ),
|
|
|
+ Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ SizedBox(
|
|
|
+ width: 15,
|
|
|
+ ),
|
|
|
+ Text(ConstantString.patrolJobTitle,
|
|
|
+ style: GSYConstant.smallActionLightText),
|
|
|
+ ],
|
|
|
),
|
|
|
Expanded(
|
|
|
child: Container(
|
|
|
child: ListView.builder(
|
|
|
- itemCount: 20,
|
|
|
+ itemCount: patrol_job_list.length,
|
|
|
itemBuilder: (context, index) {
|
|
|
- if (index != null) {
|
|
|
- return Container(
|
|
|
- margin: EdgeInsets.only(top: 12),
|
|
|
- color: Colors.white,
|
|
|
- child: ListTile(
|
|
|
- title: Column(
|
|
|
- children: [
|
|
|
- SizedBox(
|
|
|
- width: 50,
|
|
|
- ),
|
|
|
- Row(
|
|
|
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
- children: [
|
|
|
- Container(
|
|
|
- padding: const EdgeInsets.all(10.0),
|
|
|
- alignment: Alignment.centerLeft,
|
|
|
- child: Text(
|
|
|
- '任务名称',
|
|
|
- style: TextStyle(fontSize: 18),
|
|
|
- ),
|
|
|
- ),
|
|
|
- Container(
|
|
|
- width: 100,
|
|
|
- height: 40,
|
|
|
- alignment: Alignment.center,
|
|
|
- child: Text(
|
|
|
- '已逾期',
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 20, color: Colors.white),
|
|
|
- ),
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: Colors.red, //背景色
|
|
|
- borderRadius:
|
|
|
- BorderRadius.all(Radius.circular(20.0)),
|
|
|
- ),
|
|
|
- )
|
|
|
- ],
|
|
|
- ),
|
|
|
- Container(
|
|
|
- padding: const EdgeInsets.all(10.0),
|
|
|
- alignment: Alignment.centerLeft,
|
|
|
- child: Text(
|
|
|
- '任务编号: $index',
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 18,
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- Container(
|
|
|
- padding: const EdgeInsets.all(10.0),
|
|
|
- alignment: Alignment.centerLeft,
|
|
|
- child: Text(
|
|
|
- '任务开始时间: $index',
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 18,
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- Container(
|
|
|
- padding: const EdgeInsets.all(10.0),
|
|
|
- alignment: Alignment.centerLeft,
|
|
|
- child: Text(
|
|
|
- '任务结束时间: $index',
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 18,
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- ],
|
|
|
- ),
|
|
|
- onTap: () {
|
|
|
- debugPrint("你点击了$index");
|
|
|
- },
|
|
|
- ));
|
|
|
- } else {
|
|
|
- return Container(
|
|
|
- margin: EdgeInsets.only(top: 12),
|
|
|
- color: Colors.white,
|
|
|
- child: ListTile(
|
|
|
- title: Column(
|
|
|
- children: [
|
|
|
- SizedBox(
|
|
|
- width: 50,
|
|
|
- ),
|
|
|
- Row(
|
|
|
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
- children: [
|
|
|
- Container(
|
|
|
- padding: const EdgeInsets.all(10.0),
|
|
|
- alignment: Alignment.centerLeft,
|
|
|
- child: Text(
|
|
|
- '任务名称',
|
|
|
- style: TextStyle(fontSize: 18),
|
|
|
- ),
|
|
|
- ),
|
|
|
- Container(
|
|
|
- width: 100,
|
|
|
- height: 40,
|
|
|
- alignment: Alignment.center,
|
|
|
- child: Text(
|
|
|
- '进行中',
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 20, color: Colors.white70),
|
|
|
- ),
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: Colors.green, //背景色
|
|
|
- borderRadius:
|
|
|
- BorderRadius.all(Radius.circular(20.0)),
|
|
|
- ),
|
|
|
- )
|
|
|
- ],
|
|
|
- ),
|
|
|
- ],
|
|
|
- ),
|
|
|
- onTap: () {
|
|
|
- debugPrint("你点击了$index");
|
|
|
- },
|
|
|
- ));
|
|
|
- }
|
|
|
+ PatrolJobData patrolJobData = patrol_job_list[index];
|
|
|
+ return _patrol_job_list(patrolJobData);
|
|
|
},
|
|
|
)))
|
|
|
],
|
|
|
));
|
|
|
}
|
|
|
+
|
|
|
+ Widget _patrol_job_list(PatrolJobData patrolJobData) {
|
|
|
+ return Container(
|
|
|
+ margin: EdgeInsets.only(top: 12, left: 10, right: 10),
|
|
|
+ padding: EdgeInsets.only(top: 12, bottom: 10),
|
|
|
+ color: Colors.white,
|
|
|
+ child: ListTile(
|
|
|
+ title: Column(
|
|
|
+ children: [
|
|
|
+ Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
|
|
+ Container(
|
|
|
+ child: Text(
|
|
|
+ '此处展示巡检任务名称',
|
|
|
+ style: TextStyle(
|
|
|
+ color: Colors.black,
|
|
|
+ fontSize: GSYConstant.middleTextWhiteSize,
|
|
|
+ fontWeight: FontWeight.bold,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Container(
|
|
|
+ padding:
|
|
|
+ EdgeInsets.only(top: 3, bottom: 3, left: 5, right: 5),
|
|
|
+ child: Text(
|
|
|
+ patrolJobData.status == 0
|
|
|
+ ? '已关闭'
|
|
|
+ : patrolJobData.status == 1
|
|
|
+ ? '执行中'
|
|
|
+ : patrolJobData.status == 2
|
|
|
+ ? '已完成'
|
|
|
+ : patrolJobData.status == 3
|
|
|
+ ? '待执行'
|
|
|
+ : patrolJobData.status == 4
|
|
|
+ ? '已逾期'
|
|
|
+ : '未知',
|
|
|
+ textAlign: TextAlign.right,
|
|
|
+ style: TextStyle(
|
|
|
+ color: patrolJobData.status == 0
|
|
|
+ ? Colors.red
|
|
|
+ : patrolJobData.status == 1
|
|
|
+ ? Colors.blue
|
|
|
+ : patrolJobData.status == 2
|
|
|
+ ? Colors.green
|
|
|
+ : patrolJobData.status == 3
|
|
|
+ ? Colors.pinkAccent
|
|
|
+ : patrolJobData.status == 4
|
|
|
+ ? Colors.purpleAccent
|
|
|
+ : Colors.black, //边框颜色
|
|
|
+ fontSize: GSYConstant.minTextSize,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ border: new Border.all(
|
|
|
+ color: patrolJobData.status == 0
|
|
|
+ ? Colors.red
|
|
|
+ : patrolJobData.status == 1
|
|
|
+ ? Colors.blue
|
|
|
+ : patrolJobData.status == 2
|
|
|
+ ? Colors.green
|
|
|
+ : patrolJobData.status == 3
|
|
|
+ ? Colors.pinkAccent
|
|
|
+ : patrolJobData.status == 4
|
|
|
+ ? Colors.purpleAccent
|
|
|
+ : Colors.black, //边框颜色
|
|
|
+ width: 1.0, //边框粗细
|
|
|
+ ),
|
|
|
+ borderRadius: const BorderRadius.all(
|
|
|
+ const Radius.circular(3.0)), //边框的弧度
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ]),
|
|
|
+ SizedBox(
|
|
|
+ height: 12,
|
|
|
+ ),
|
|
|
+ Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
|
|
+ Container(
|
|
|
+ child: Text(
|
|
|
+ '任务编号:',
|
|
|
+ style: TextStyle(
|
|
|
+ color: GSYColors.primaryLightValue,
|
|
|
+ fontSize: GSYConstant.middleTextWhiteSize,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Container(
|
|
|
+ child: Text(
|
|
|
+ '任务编号001',
|
|
|
+ textAlign: TextAlign.right,
|
|
|
+ style: TextStyle(
|
|
|
+ color: GSYColors.primaryLightValue,
|
|
|
+ fontSize: GSYConstant.middleTextWhiteSize,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ]),
|
|
|
+ SizedBox(
|
|
|
+ height: 10,
|
|
|
+ ),
|
|
|
+ Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
|
|
+ Container(
|
|
|
+ child: Text(
|
|
|
+ '巡检产品数量:',
|
|
|
+ style: TextStyle(
|
|
|
+ color: GSYColors.primaryLightValue,
|
|
|
+ fontSize: GSYConstant.middleTextWhiteSize,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Container(
|
|
|
+ child: Text(
|
|
|
+ '3',
|
|
|
+ textAlign: TextAlign.right,
|
|
|
+ style: TextStyle(
|
|
|
+ color: GSYColors.primaryLightValue,
|
|
|
+ fontSize: GSYConstant.middleTextWhiteSize,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ]),
|
|
|
+ SizedBox(
|
|
|
+ height: 10,
|
|
|
+ ),
|
|
|
+ Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
|
|
+ Container(
|
|
|
+ child: Text(
|
|
|
+ '任务开始时间:',
|
|
|
+ style: TextStyle(
|
|
|
+ color: GSYColors.primaryLightValue,
|
|
|
+ fontSize: GSYConstant.middleTextWhiteSize,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Container(
|
|
|
+ child: Text(
|
|
|
+ '2023-2-9',
|
|
|
+ textAlign: TextAlign.right,
|
|
|
+ style: TextStyle(
|
|
|
+ color: GSYColors.primaryLightValue,
|
|
|
+ fontSize: GSYConstant.middleTextWhiteSize,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ]),
|
|
|
+ SizedBox(
|
|
|
+ height: 10,
|
|
|
+ ),
|
|
|
+ Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
|
|
+ Container(
|
|
|
+ child: Text(
|
|
|
+ '任务结束时间:',
|
|
|
+ style: TextStyle(
|
|
|
+ color: GSYColors.primaryLightValue,
|
|
|
+ fontSize: GSYConstant.middleTextWhiteSize,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Container(
|
|
|
+ child: Text(
|
|
|
+ '2023-2-9',
|
|
|
+ textAlign: TextAlign.right,
|
|
|
+ style: TextStyle(
|
|
|
+ color: GSYColors.primaryLightValue,
|
|
|
+ fontSize: GSYConstant.middleTextWhiteSize,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ]),
|
|
|
+ SizedBox(
|
|
|
+ height: 5,
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ onTap: () {
|
|
|
+ /*Navigator.push(
|
|
|
+ context,
|
|
|
+ MaterialPageRoute(
|
|
|
+ builder: (context) => const PatrolJobDetail()));*/
|
|
|
+
|
|
|
+ },
|
|
|
+ ));
|
|
|
+ }
|
|
|
}
|