patrol_job_detail.dart 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. import 'package:deus_app/common/style/TitleBar.dart';
  2. import 'package:deus_app/common/style/gsy_style.dart';
  3. import 'package:deus_app/common/utils/ConstantString.dart';
  4. import 'package:deus_app/model/drop_menu_item.dart';
  5. import 'package:deus_app/model/patrol_response_entity.dart';
  6. import 'package:flutter/material.dart';
  7. import '../../common/utils/DioUtil.dart';
  8. /**
  9. * 巡检任务详情页面
  10. */
  11. class PatrolJobDetail extends StatefulWidget {
  12. var id ;
  13. PatrolJobDetail({super.key, @required this.id});
  14. static var routeName = '/PatrolJobDetail';
  15. @override
  16. State createState() {
  17. print(id);
  18. return new _PatrolJobDetail(id);
  19. }
  20. }
  21. PatrolJobDeviceData p =
  22. PatrolJobDeviceData('设备名称1', '展示名称1', 'deviceKey1', '2023-05-28', '曹刚', 0);
  23. PatrolJobDeviceData a =
  24. PatrolJobDeviceData('设备名称2', '展示名称2', 'deviceKey2', '2023-05-29', '曹刚', 1);
  25. List<PatrolJobDeviceData> device_list = [a, a, a, a, a, a, a, p];
  26. PatrolJobDetailData patrolJobDetailData = PatrolJobDetailData(
  27. '巡检任务',
  28. 'XJRW10001',
  29. '巡检计划',
  30. 'XJJH10001',
  31. 1,
  32. '2023-05-29 00:00:00',
  33. '2023-05-29 23:59:59',
  34. '曹刚',
  35. '2023-05-29 14:00:35',
  36. 2,
  37. '备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注备注');
  38. PatrolJobItemData patrolJobItemData = PatrolJobItemData('巡检项目1', '结果1', 0);
  39. PatrolJobItemData patrolJobItemData2 = PatrolJobItemData('巡检项目2', '结果2', 1);
  40. List<PatrolJobItemData> item_list = [patrolJobItemData, patrolJobItemData2];
  41. PatrolJobImageData imageData = PatrolJobImageData(1,
  42. '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');
  43. List<PatrolJobImageData> image_list = [
  44. imageData,
  45. imageData,
  46. imageData,
  47. imageData,
  48. imageData,
  49. imageData,
  50. imageData,
  51. imageData,
  52. imageData,
  53. imageData,
  54. imageData,
  55. imageData,
  56. imageData,
  57. imageData,
  58. ];
  59. DropMenuItem boy = DropMenuItem('男', 1);
  60. DropMenuItem girl = DropMenuItem('女', 2);
  61. List<DropMenuItem> sexMenuItems = [boy, girl];
  62. List<String> sexSelects = ['男', '女', '奥特曼'];
  63. DropMenuItem sexSelect = DropMenuItem('男', 1);
  64. class _PatrolJobDetail extends State<PatrolJobDetail> {
  65. var id;
  66. _PatrolJobDetail(this.id);
  67. _load() async {
  68. var result = await DioUtil().request('patrolJob/appPatrolJobList',
  69. method: DioMethod.get, params: {'id':id});
  70. PatrolJobResponse patrolJobResponse = PatrolJobResponse.fromJson(result);
  71. //var patrolJobResponse = PatrolJobResponse.fromJson(result);
  72. //print(patrolJobResponse);
  73. }
  74. @override
  75. void initState() {
  76. // TODO: implement initState
  77. super.initState();
  78. Future.delayed(
  79. Duration.zero,
  80. () => setState(() {
  81. _load();
  82. }));
  83. }
  84. @override
  85. Widget build(BuildContext context) {
  86. return Scaffold(
  87. appBar: TitleBar().backAppbar(context, "巡检任务详情"),
  88. backgroundColor: const Color(0xfff2f2f2),
  89. body: Column(
  90. children: [
  91. Expanded(
  92. // flex: 7,
  93. child: ListView(
  94. children: _Ws(),
  95. ),
  96. ),
  97. Container(
  98. height: 50,
  99. // flex: 7,
  100. child: Row(
  101. children: [
  102. Expanded(
  103. child: SizedBox(
  104. height: 50,
  105. child: TextButton(
  106. onPressed: () {},
  107. child: Text(ConstantString.cancel),
  108. style: ButtonStyle(
  109. backgroundColor: MaterialStateProperty.all<Color>(
  110. Color(0xFF4875EC)),
  111. shape: MaterialStateProperty.all(
  112. BeveledRectangleBorder(
  113. borderRadius: BorderRadius.circular(0))),
  114. foregroundColor:
  115. MaterialStateProperty.all<Color>(Colors.white),
  116. // padding: MaterialStateProperty.all(EdgeInsets.zero)
  117. ),
  118. ),
  119. ),
  120. ),
  121. Expanded(
  122. child: SizedBox(
  123. height: 50,
  124. child: TextButton(
  125. onPressed: () {},
  126. child: Text(ConstantString.query),
  127. style: ButtonStyle(
  128. backgroundColor:
  129. MaterialStateProperty.all<Color>(Colors.blue),
  130. foregroundColor:
  131. MaterialStateProperty.all<Color>(Colors.white),
  132. shape: MaterialStateProperty.all(BeveledRectangleBorder(
  133. borderRadius: BorderRadius.circular(0))),
  134. // padding: MaterialStateProperty.all(EdgeInsets.zero)
  135. ),
  136. ),
  137. )),
  138. ],
  139. ),
  140. )
  141. ],
  142. ));
  143. }
  144. List<Widget> _Ws() {
  145. List<Widget> ws = [];
  146. ws.add(_patrolJobDetail(patrolJobDetailData));
  147. ws.add(_device());
  148. ws.add(_item());
  149. ws.add(_remark());
  150. ws.add(_url());
  151. return ws;
  152. }
  153. Widget _patrolJobDetail(PatrolJobDetailData patrolJobDetailData) {
  154. if (patrolJobDetailData.status == 2) {
  155. return Column(
  156. children: [
  157. Row(
  158. children: [
  159. Container(
  160. margin: EdgeInsets.only(top: 10, left: 12),
  161. // padding: EdgeInsets.fromLTRB(12, 0, 0, 0),
  162. alignment: Alignment.bottomLeft,
  163. child: Text(
  164. patrolJobDetailData.name,
  165. style: TextStyle(
  166. fontSize: GSYConstant.middleTextWhiteSize,
  167. fontWeight: FontWeight.bold),
  168. ),
  169. ),
  170. Container(
  171. margin: EdgeInsets.only(top: 10, left: 10),
  172. padding: EdgeInsets.fromLTRB(3, 2, 3, 2),
  173. alignment: Alignment.centerLeft,
  174. child: Text(
  175. '已完成',
  176. style: TextStyle(
  177. fontSize: GSYConstant.minTextSize, color: Colors.blue),
  178. ),
  179. decoration: BoxDecoration(
  180. border: new Border.all(
  181. color: Colors.blue, //边框颜色
  182. width: 1.0, //边框粗细
  183. ),
  184. borderRadius: const BorderRadius.all(
  185. const Radius.circular(3.0)), //边框的弧度
  186. ),
  187. )
  188. ],
  189. ),
  190. Container(
  191. margin: EdgeInsets.only(top: 10, left: 12, bottom: 12),
  192. alignment: Alignment.centerLeft,
  193. child: Text(
  194. '任务编号: ' + patrolJobDetailData.number,
  195. style: TextStyle(
  196. fontSize: GSYConstant.smallTextSize,
  197. ),
  198. ),
  199. ),
  200. // Divider(
  201. // height: 0.8,
  202. // indent: 5.0,
  203. // endIndent: 5.0,
  204. // color: Colors.grey,
  205. // ),
  206. Container(
  207. decoration: BoxDecoration(color: Colors.white),
  208. child: Column(
  209. children: [
  210. Container(
  211. padding: EdgeInsets.fromLTRB(12, 20, 12, 0),
  212. alignment: Alignment.centerLeft,
  213. child: Row(
  214. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  215. children: [
  216. new Text(
  217. '巡检任务名称:',
  218. style: GSYConstant.smallTextLight,
  219. ),
  220. Container(
  221. child: Text(
  222. patrolJobDetailData.name,
  223. style: GSYConstant.smallTextLight,
  224. textAlign: TextAlign.right,
  225. ),
  226. ),
  227. ],
  228. ),
  229. ),
  230. Container(
  231. padding: EdgeInsets.fromLTRB(12, 15, 12, 0),
  232. child: Row(
  233. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  234. children: [
  235. new Text(
  236. '巡检任务编号:',
  237. style: GSYConstant.smallTextLight,
  238. ),
  239. Container(
  240. child: Text(
  241. patrolJobDetailData.number,
  242. style: GSYConstant.smallTextLight,
  243. textAlign: TextAlign.right,
  244. ),
  245. ),
  246. ],
  247. ),
  248. ),
  249. Container(
  250. padding: EdgeInsets.fromLTRB(12, 15, 12, 0),
  251. child: Row(
  252. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  253. children: [
  254. new Text(
  255. '巡检计划名称:',
  256. style: GSYConstant.smallTextLight,
  257. ),
  258. Container(
  259. child: Text(
  260. patrolJobDetailData.planName,
  261. style: GSYConstant.smallTextLight,
  262. textAlign: TextAlign.right,
  263. ),
  264. ),
  265. ])),
  266. Container(
  267. padding: EdgeInsets.fromLTRB(12, 15, 12, 0),
  268. child: Row(
  269. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  270. children: [
  271. new Text(
  272. '巡检计划编号:',
  273. style: GSYConstant.smallTextLight,
  274. ),
  275. Container(
  276. child: Text(
  277. patrolJobDetailData.planNumber,
  278. style: GSYConstant.smallTextLight,
  279. textAlign: TextAlign.right,
  280. ),
  281. ),
  282. ])),
  283. Container(
  284. padding: EdgeInsets.fromLTRB(12, 15, 12, 0),
  285. child: Row(
  286. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  287. children: [
  288. new Text(
  289. '周期类型:',
  290. style: GSYConstant.smallTextLight,
  291. ),
  292. Container(
  293. child: Text(
  294. patrolJobDetailData.termType == 1 ? '日计划' : '暂无',
  295. style: GSYConstant.smallTextLight,
  296. textAlign: TextAlign.right,
  297. ),
  298. ),
  299. ])),
  300. Container(
  301. padding: EdgeInsets.fromLTRB(12, 15, 12, 0),
  302. child: Row(
  303. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  304. children: [
  305. new Text(
  306. '任务开始时间:',
  307. style: GSYConstant.smallTextLight,
  308. ),
  309. Container(
  310. child: Text(
  311. patrolJobDetailData.startDate,
  312. style: GSYConstant.smallTextLight,
  313. textAlign: TextAlign.right,
  314. ),
  315. ),
  316. ])),
  317. Container(
  318. padding: EdgeInsets.fromLTRB(12, 15, 12, 0),
  319. child: Row(
  320. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  321. children: [
  322. new Text(
  323. '任务结束时间:',
  324. style: GSYConstant.smallTextLight,
  325. ),
  326. Container(
  327. child: Text(
  328. patrolJobDetailData.endDate,
  329. style: GSYConstant.smallTextLight,
  330. textAlign: TextAlign.right,
  331. ),
  332. ),
  333. ])),
  334. Container(
  335. padding: EdgeInsets.fromLTRB(12, 15, 12, 0),
  336. child: Row(
  337. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  338. children: [
  339. new Text(
  340. '实际完成时间:',
  341. style: GSYConstant.smallTextLight,
  342. ),
  343. Container(
  344. child: Text(
  345. patrolJobDetailData.finishTime,
  346. style: GSYConstant.smallTextLight,
  347. textAlign: TextAlign.right,
  348. ),
  349. ),
  350. ])),
  351. Container(
  352. padding: EdgeInsets.fromLTRB(12, 15, 12, 15),
  353. child: Row(
  354. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  355. children: [
  356. new Text(
  357. '巡检人员:',
  358. style: GSYConstant.smallTextLight,
  359. ),
  360. Container(
  361. child: Text(
  362. patrolJobDetailData.personnel,
  363. style: GSYConstant.smallTextLight,
  364. textAlign: TextAlign.right,
  365. ),
  366. ),
  367. ])),
  368. ],
  369. ),
  370. ),
  371. ],
  372. );
  373. } else {
  374. return Text('暂无数据');
  375. }
  376. }
  377. Widget _device() {
  378. return ExpansionTile(
  379. title: Container(
  380. child: Text(
  381. '巡检设备',
  382. style: GSYConstant.normalTextActionWhiteBold,
  383. )),
  384. children: device_list.map((e) => _buildDevice(e)).toList(),
  385. initiallyExpanded: true);
  386. }
  387. Widget _buildDevice(PatrolJobDeviceData device) {
  388. return FractionallySizedBox(
  389. widthFactor: 1,
  390. child: Container(
  391. margin: device.id == device_list[device_list.length - 1].id
  392. ? EdgeInsets.only(bottom: 0)
  393. : EdgeInsets.only(bottom: 5),
  394. decoration: BoxDecoration(color: Colors.white),
  395. padding: const EdgeInsets.fromLTRB(12, 12, 12, 12),
  396. child: Column(
  397. children: [
  398. Container(
  399. // padding: const EdgeInsets.fromLTRB(30.0, 0.0, 0.0, 0.0),
  400. alignment: Alignment.centerLeft,
  401. child: Text(device.showName, style: GSYConstant.smallTextBold),
  402. ),
  403. Container(
  404. margin: const EdgeInsets.only(top: 10),
  405. // padding: const EdgeInsets.fromLTRB(30.0, 0.0, 0.0, 0.0),
  406. child: Row(
  407. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  408. children: [
  409. new Text(
  410. '设备名称:',
  411. style: GSYConstant.smallTextLight,
  412. ),
  413. Container(
  414. child: Text(
  415. device.name,
  416. style: GSYConstant.smallTextLight,
  417. textAlign: TextAlign.right,
  418. ),
  419. ),
  420. ]),
  421. ),
  422. Container(
  423. margin: const EdgeInsets.only(top: 10),
  424. // padding: const EdgeInsets.fromLTRB(30.0, 0.0, 0.0, 0.0),
  425. // alignment: Alignment.centerLeft,
  426. child: Row(
  427. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  428. children: [
  429. new Text(
  430. 'deviceKey:',
  431. style: GSYConstant.smallTextLight,
  432. ),
  433. Container(
  434. child: Text(
  435. device.deviceKey,
  436. style: GSYConstant.smallTextLight,
  437. textAlign: TextAlign.right,
  438. ),
  439. ),
  440. ]),
  441. ),
  442. Container(
  443. margin: const EdgeInsets.only(top: 10),
  444. // padding: const EdgeInsets.fromLTRB(30.0, 0.0, 0.0, 10.0),
  445. // alignment: Alignment.centerLeft,
  446. child: Row(
  447. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  448. children: [
  449. new Text(
  450. '完成时间:',
  451. style: GSYConstant.smallTextLight,
  452. ),
  453. Container(
  454. child: Text(
  455. device.itemCompleteTime,
  456. style: GSYConstant.smallTextLight,
  457. textAlign: TextAlign.right,
  458. ),
  459. ),
  460. ]),
  461. ),
  462. // Divider(
  463. // height: 0.8,
  464. // indent: 10.0,
  465. // endIndent: 10.0,
  466. // color: Colors.grey,
  467. // ),
  468. ],
  469. ),
  470. ));
  471. }
  472. Widget _item() {
  473. return ExpansionTile(
  474. title: Container(
  475. child: Text(
  476. '巡检项目',
  477. style: GSYConstant.normalTextActionWhiteBold,
  478. )),
  479. children: item_list.map((e) => _buildItem(e)).toList(),
  480. initiallyExpanded: true);
  481. }
  482. Widget _buildItem(PatrolJobItemData item) {
  483. return FractionallySizedBox(
  484. widthFactor: 1,
  485. child: Container(
  486. margin: item.id == item_list[item_list.length - 1].id
  487. ? EdgeInsets.only(bottom: 0)
  488. : EdgeInsets.only(bottom: 5),
  489. padding: const EdgeInsets.fromLTRB(12, 15, 15, 0),
  490. decoration: BoxDecoration(color: Colors.white),
  491. child: Column(
  492. children: [
  493. Container(
  494. alignment: Alignment.centerLeft,
  495. child: Text(item.name,
  496. style: TextStyle(
  497. fontSize: GSYConstant.middleTextWhiteSize,
  498. fontWeight: FontWeight.bold)),
  499. ),
  500. Container(
  501. margin: const EdgeInsets.fromLTRB(0, 10.0, 0, 0),
  502. alignment: Alignment.centerLeft,
  503. child: Text(
  504. item.result,
  505. style: GSYConstant.smallTextLight,
  506. ),
  507. ),
  508. // Divider(
  509. // height: 0.8,
  510. // indent: 10.0,
  511. // endIndent: 10.0,
  512. // color: Colors.grey,
  513. // ),
  514. ],
  515. ),
  516. ));
  517. }
  518. Widget _remark() {
  519. return ExpansionTile(
  520. title: Container(
  521. child: Text(
  522. '任务结果备注',
  523. style: GSYConstant.normalTextActionWhiteBold,
  524. )),
  525. children: [_buildRemark(patrolJobDetailData)],
  526. initiallyExpanded: true);
  527. }
  528. Widget _buildRemark(PatrolJobDetailData patrolJobDetailData) {
  529. return FractionallySizedBox(
  530. widthFactor: 1,
  531. child: Container(
  532. decoration: BoxDecoration(color: Colors.white),
  533. child: Column(
  534. children: [
  535. Container(
  536. margin: const EdgeInsets.fromLTRB(12, 15.0, 12, 15.0),
  537. alignment: Alignment.centerLeft,
  538. child: Text(patrolJobDetailData.remark,
  539. style: TextStyle(fontSize: 14)),
  540. )
  541. ],
  542. ),
  543. ));
  544. }
  545. Widget _url() {
  546. return ExpansionTile(
  547. title: Container(
  548. child: Text(
  549. '任务图片',
  550. style: GSYConstant.normalTextActionWhiteBold,
  551. )),
  552. children: [
  553. Wrap(children: image_list.map((e) => _buildImage(e)).toList()),
  554. ],
  555. initiallyExpanded: true);
  556. }
  557. Widget _buildImage(PatrolJobImageData imageData) {
  558. return Container(
  559. width: MediaQuery.of(context).size.width / 2,
  560. margin: EdgeInsets.only(bottom: 5),
  561. padding: EdgeInsets.only(left: 12, right: 12),
  562. alignment: Alignment.center,
  563. decoration: BoxDecoration(color: Colors.white),
  564. child: Image.network(imageData.url));
  565. }
  566. }