patrol_job_detail.dart 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. import 'package:deus_app/common/style/TitleBar.dart';
  2. import 'package:deus_app/common/utils/ConstantString.dart';
  3. import 'package:deus_app/common/utils/ToastUtils.dart';
  4. import 'package:deus_app/model/drop_menu_item.dart';
  5. import 'package:flutter/material.dart';
  6. import 'package:deus_app/model/patrol_response_entity.dart';
  7. /**
  8. * 巡检任务详情页面
  9. */
  10. class PatrolJobDetail extends StatefulWidget {
  11. const PatrolJobDetail({super.key});
  12. static var routeName = '/PatrolJobDetail';
  13. @override
  14. State createState() {
  15. return _PatrolJobDetail();
  16. }
  17. }
  18. PatrolJobDeviceData p =
  19. PatrolJobDeviceData('设备名称1', '展示名称1', 'deviceKey1', '2023-05-28', '曹刚');
  20. PatrolJobDeviceData a =
  21. PatrolJobDeviceData('设备名称2', '展示名称2', 'deviceKey2', '2023-05-29', '曹刚');
  22. List<PatrolJobDeviceData> device_list = [p, a, a, a, a, a, a, a];
  23. PatrolJobDetailData patrolJobDetailData = PatrolJobDetailData(
  24. '巡检任务',
  25. 'XJRW10001',
  26. '巡检计划',
  27. 'XJJH10001',
  28. 1,
  29. '2023-05-29 00:00:00',
  30. '2023-05-29 23:59:59',
  31. '曹刚',
  32. '2023-05-29 14:00:35',
  33. 2,
  34. '备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注');
  35. PatrolJobItemData patrolJobItemData = PatrolJobItemData('巡检项目1', '结果1');
  36. PatrolJobItemData patrolJobItemData2 = PatrolJobItemData('巡检项目2', '结果2');
  37. List<PatrolJobItemData> item_list = [patrolJobItemData, patrolJobItemData2];
  38. PatrolJobImageData imageData = PatrolJobImageData(1,
  39. 'https://fqgz.flowbb.cn:7070/deus-test/image/59a75f5b80d7458c88f6b48608ee16eb.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=minioadmin%2F20230530%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230530T054753Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=cdc7f9501492ef218ce42d4f31c41ed01208802a88c9e9f7df5316251569664c');
  40. List<PatrolJobImageData> image_list = [
  41. imageData,
  42. imageData,
  43. imageData,
  44. imageData,
  45. imageData,
  46. imageData,
  47. imageData,
  48. imageData,
  49. imageData,
  50. imageData,
  51. imageData,
  52. imageData,
  53. imageData,
  54. imageData,
  55. ];
  56. DropMenuItem boy = DropMenuItem('男', 1);
  57. DropMenuItem girl = DropMenuItem('女', 2);
  58. List<DropMenuItem> sexMenuItems = [boy,girl];
  59. List<String> sexSelects = ['男','女','奥特曼'];
  60. class _PatrolJobDetail extends State<PatrolJobDetail> {
  61. @override
  62. Widget build(BuildContext context) {
  63. return Scaffold(
  64. appBar: TitleBar().backAppbar(context, "巡检任务详情"),
  65. body: Column(
  66. children: [
  67. Expanded(
  68. child: ListView(
  69. children: _Ws(),
  70. ),
  71. )
  72. ],
  73. ));
  74. }
  75. List<Widget> _Ws() {
  76. List<Widget> ws = [];
  77. ws.add(_patrolJobDetail(patrolJobDetailData));
  78. ws.add(_device());
  79. ws.add(_item());
  80. ws.add(_remark());
  81. ws.add(_url());
  82. return ws;
  83. }
  84. Widget _patrolJobDetail(PatrolJobDetailData patrolJobDetailData) {
  85. if (patrolJobDetailData.status == 2) {
  86. return Column(
  87. children: [
  88. Row(
  89. children: [
  90. Container(
  91. padding: EdgeInsets.fromLTRB(15, 20, 0, 0),
  92. alignment: Alignment.centerLeft,
  93. child: Text(
  94. '已完成',
  95. style: TextStyle(fontSize: 20, backgroundColor: Colors.red),
  96. ),
  97. ),
  98. Container(
  99. padding: EdgeInsets.fromLTRB(20, 0, 0, 0),
  100. alignment: Alignment.bottomLeft,
  101. child: Text(
  102. patrolJobDetailData.name,
  103. style: TextStyle(fontSize: 18),
  104. ),
  105. )
  106. ],
  107. ),
  108. Container(
  109. padding: EdgeInsets.fromLTRB(95, 0, 0, 20),
  110. alignment: Alignment.centerLeft,
  111. child: Text(
  112. '任务编号: ' + patrolJobDetailData.number,
  113. style: TextStyle(fontSize: 18),
  114. ),
  115. ),
  116. Divider(
  117. height: 0.8,
  118. indent: 5.0,
  119. endIndent: 5.0,
  120. color: Colors.grey,
  121. ),
  122. Container(
  123. padding: EdgeInsets.fromLTRB(65, 20, 0, 0),
  124. alignment: Alignment.centerLeft,
  125. child: Text(
  126. '巡检任务名称 ' + patrolJobDetailData.name,
  127. style: TextStyle(fontSize: 14),
  128. ),
  129. ),
  130. Container(
  131. padding: EdgeInsets.fromLTRB(65, 20, 0, 0),
  132. alignment: Alignment.centerLeft,
  133. child: Text(
  134. '巡检任务编号 ' + patrolJobDetailData.number,
  135. style: TextStyle(fontSize: 14),
  136. ),
  137. ),
  138. Container(
  139. padding: EdgeInsets.fromLTRB(65, 20, 0, 0),
  140. alignment: Alignment.centerLeft,
  141. child: Text(
  142. '巡检计划名称 ' + patrolJobDetailData.planName,
  143. style: TextStyle(fontSize: 14),
  144. ),
  145. ),
  146. Container(
  147. padding: EdgeInsets.fromLTRB(65, 20, 0, 0),
  148. alignment: Alignment.centerLeft,
  149. child: Text(
  150. '巡检计划编号 ' + patrolJobDetailData.planNumber,
  151. style: TextStyle(fontSize: 14),
  152. ),
  153. ),
  154. Container(
  155. padding: EdgeInsets.fromLTRB(92, 20, 0, 0),
  156. alignment: Alignment.centerLeft,
  157. child: Text(
  158. '周期类型 ' + (patrolJobDetailData.termType == 1 ? '日计划' : '暂无'),
  159. style: TextStyle(fontSize: 14),
  160. ),
  161. ),
  162. Container(
  163. padding: EdgeInsets.fromLTRB(65, 20, 0, 0),
  164. alignment: Alignment.centerLeft,
  165. child: Text(
  166. '任务开始时间 ' + patrolJobDetailData.startDate,
  167. style: TextStyle(fontSize: 14),
  168. ),
  169. ),
  170. Container(
  171. padding: EdgeInsets.fromLTRB(65, 20, 0, 0),
  172. alignment: Alignment.centerLeft,
  173. child: Text(
  174. '任务结束时间 ' + patrolJobDetailData.endDate,
  175. style: TextStyle(fontSize: 14),
  176. ),
  177. ),
  178. Container(
  179. padding: EdgeInsets.fromLTRB(65, 20, 0, 0),
  180. alignment: Alignment.centerLeft,
  181. child: Text(
  182. '实际完成时间 ' + patrolJobDetailData.finishTime,
  183. style: TextStyle(fontSize: 14),
  184. ),
  185. ),
  186. Container(
  187. padding: EdgeInsets.fromLTRB(92, 20, 0, 20),
  188. alignment: Alignment.centerLeft,
  189. child: Text(
  190. '巡检人员 ' + patrolJobDetailData.personnel,
  191. style: TextStyle(fontSize: 14),
  192. ),
  193. ),
  194. ],
  195. );
  196. } else {
  197. return Text('暂无数据');
  198. }
  199. }
  200. Widget _device() {
  201. return ExpansionTile(
  202. title: Container(
  203. child: Text(
  204. '巡检设备',
  205. style: TextStyle(color: Colors.blue, fontSize: 20),
  206. )),
  207. children: device_list.map((e) => _buildDevice(e)).toList(),
  208. initiallyExpanded: true);
  209. }
  210. Widget _buildDevice(PatrolJobDeviceData device) {
  211. return FractionallySizedBox(
  212. widthFactor: 1,
  213. child: Container(
  214. height: 160,
  215. margin: EdgeInsets.only(bottom: 5),
  216. decoration: BoxDecoration(color: Colors.white),
  217. child: Column(
  218. children: [
  219. Container(
  220. margin: const EdgeInsets.fromLTRB(0, 20.0, 0, 0),
  221. padding: const EdgeInsets.fromLTRB(30.0, 0.0, 0.0, 0.0),
  222. alignment: Alignment.centerLeft,
  223. child: Text(device.showName, style: TextStyle(fontSize: 14)),
  224. ),
  225. Container(
  226. margin: const EdgeInsets.fromLTRB(0, 10.0, 0, 0),
  227. padding: const EdgeInsets.fromLTRB(30.0, 0.0, 0.0, 0.0),
  228. alignment: Alignment.centerLeft,
  229. child: Text('设备名称: ' + device.name,
  230. style: TextStyle(fontSize: 14)),
  231. ),
  232. Container(
  233. margin: const EdgeInsets.fromLTRB(0, 10.0, 0, 0),
  234. padding: const EdgeInsets.fromLTRB(30.0, 0.0, 0.0, 0.0),
  235. alignment: Alignment.centerLeft,
  236. child: Text('deviceKey: ' + device.deviceKey,
  237. style: TextStyle(fontSize: 14)),
  238. ),
  239. Container(
  240. margin: const EdgeInsets.fromLTRB(0, 10.0, 0, 20),
  241. padding: const EdgeInsets.fromLTRB(30.0, 0.0, 0.0, 10.0),
  242. alignment: Alignment.centerLeft,
  243. child: Text('完成时间: ' + device.itemCompleteTime,
  244. style: TextStyle(fontSize: 14)),
  245. ),
  246. Divider(
  247. height: 0.8,
  248. indent: 10.0,
  249. endIndent: 10.0,
  250. color: Colors.grey,
  251. ),
  252. ],
  253. ),
  254. ));
  255. }
  256. Widget _item() {
  257. return ExpansionTile(
  258. title: Container(
  259. child: Text(
  260. '巡检项目',
  261. style: TextStyle(color: Colors.blue, fontSize: 20),
  262. )),
  263. children: item_list.map((e) => _buildItem(e)).toList(),
  264. initiallyExpanded: true);
  265. }
  266. Widget _buildItem(PatrolJobItemData item) {
  267. return FractionallySizedBox(
  268. widthFactor: 1,
  269. child: Container(
  270. height: 100,
  271. margin: EdgeInsets.only(bottom: 5),
  272. decoration: BoxDecoration(color: Colors.white),
  273. child: Column(
  274. children: [
  275. Container(
  276. margin: const EdgeInsets.fromLTRB(0, 15.0, 0, 0),
  277. padding: const EdgeInsets.fromLTRB(30.0, 0.0, 0.0, 0.0),
  278. alignment: Alignment.centerLeft,
  279. child: Text(item.name, style: TextStyle(fontSize: 14)),
  280. ),
  281. Container(
  282. margin: const EdgeInsets.fromLTRB(0, 10.0, 0, 20),
  283. padding: const EdgeInsets.fromLTRB(30.0, 0.0, 0.0, 0.0),
  284. alignment: Alignment.centerLeft,
  285. child: Text(item.result, style: TextStyle(fontSize: 14)),
  286. ),
  287. Divider(
  288. height: 0.8,
  289. indent: 10.0,
  290. endIndent: 10.0,
  291. color: Colors.grey,
  292. ),
  293. ],
  294. ),
  295. ));
  296. }
  297. Widget _remark() {
  298. return ExpansionTile(
  299. title: Container(
  300. child: Text(
  301. '任务结果备注',
  302. style: TextStyle(color: Colors.blue, fontSize: 20),
  303. )),
  304. children: [_buildRemark(patrolJobDetailData)],
  305. initiallyExpanded: true);
  306. }
  307. Widget _buildRemark(PatrolJobDetailData patrolJobDetailData) {
  308. return FractionallySizedBox(
  309. widthFactor: 1,
  310. child: Container(
  311. margin: EdgeInsets.only(bottom: 5),
  312. decoration: BoxDecoration(color: Colors.white),
  313. child: Column(
  314. children: [
  315. Container(
  316. margin: const EdgeInsets.fromLTRB(0, 15.0, 0, 15.0),
  317. padding: const EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0),
  318. alignment: Alignment.centerLeft,
  319. child: Text(patrolJobDetailData.remark,
  320. style: TextStyle(fontSize: 14)),
  321. )
  322. ],
  323. ),
  324. ));
  325. }
  326. Widget _url() {
  327. return ExpansionTile(
  328. title: Container(
  329. child: Text(
  330. '任务图片',
  331. style: TextStyle(color: Colors.blue, fontSize: 20),
  332. )),
  333. children: [
  334. Wrap(children: image_list.map((e) => _buildImage(e)).toList()),
  335. ],
  336. initiallyExpanded: true);
  337. }
  338. Widget _buildImage(PatrolJobImageData imageData) {
  339. return Container(
  340. width: 150,
  341. margin: EdgeInsets.only(bottom: 5),
  342. alignment: Alignment.centerLeft,
  343. decoration: BoxDecoration(color: Colors.white),
  344. child: Image.network(imageData.url));
  345. }
  346. }