maint_job_detail.dart 22 KB

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