maint_job_detail.dart 23 KB

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