diff --git a/lib/customWidget/department_picker_enterprise.dart b/lib/customWidget/department_picker_enterprise.dart index b9b4d0d..64ef987 100644 --- a/lib/customWidget/department_picker_enterprise.dart +++ b/lib/customWidget/department_picker_enterprise.dart @@ -2,6 +2,7 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:qhd_prevention/customWidget/search_bar_widget.dart'; import 'package:qhd_prevention/http/ApiService.dart'; +import 'package:qhd_prevention/http/modules/doorAndCar_api.dart'; import 'package:qhd_prevention/services/SessionService.dart'; import '../tools/tools.dart'; // 包含 SessionService @@ -21,8 +22,8 @@ class CategoryEnterpriseType { factory CategoryEnterpriseType.fromJson(Map json) { return CategoryEnterpriseType( - id: json['id'] != null ? json['id'].toString() : "", - name: json['corpName'] != null ? json['corpName'].toString() : "", + id: json['jurisdictionalCorpId'] != null ? json['jurisdictionalCorpId'].toString() : "", + name: json['jurisdictionalCorpName'] != null ? json['jurisdictionalCorpName'].toString() : "", pdId: json['parentId'] != null ? json['parentId'].toString() : "", children: _safeParseChildren(json['childrenList']), ); @@ -106,7 +107,7 @@ class _DepartmentPickerEnterpriseState extends State // raw = result['data']; // } - final result = await HiddenDangerApi.getCorpInfoListTree(); + final result = await DoorAndCarApi.getJurisdictionalAuthorityListTree(widget.jurisdictionalAuthorityId); raw = result['data']; setState(() { diff --git a/lib/http/modules/doorAndCar_api.dart b/lib/http/modules/doorAndCar_api.dart index e48913d..1fa44e9 100644 --- a/lib/http/modules/doorAndCar_api.dart +++ b/lib/http/modules/doorAndCar_api.dart @@ -224,7 +224,17 @@ class DoorAndCarApi { } + /// 跟据港区查询管辖单位 + static Future> getJurisdictionalAuthorityListTree(String id) { + return HttpManager().request( + '${ApiService.basePath}/primeport', + '/closedArea/listAllByhgAuthArea?hgAuthArea=$id', + method: Method.get, + data: { + }, + ); + } diff --git a/lib/http/modules/hidden_danger_api.dart b/lib/http/modules/hidden_danger_api.dart index dc822cc..9815eab 100644 --- a/lib/http/modules/hidden_danger_api.dart +++ b/lib/http/modules/hidden_danger_api.dart @@ -40,17 +40,17 @@ class HiddenDangerApi { ); } - /// 获取企业 - static Future> getCorpInfoListTree() { - return HttpManager().request( - ApiService.basePath, - '/basicInfo/corpInfo/listAll', - method: Method.get, - data: { - "inType": '0,1', - }, - ); - } + // /// 获取企业 + // static Future> getCorpInfoListTree() { + // return HttpManager().request( + // ApiService.basePath, + // '/basicInfo/corpInfo/listAll', + // method: Method.get, + // data: { + // "inType": '0,1', + // }, + // ); + // } /// 获取部门 static Future> getHiddenTreatmentListTree(String id) { diff --git a/lib/pages/home/doorAndCar/car/doorArea_car_add_page.dart b/lib/pages/home/doorAndCar/car/doorArea_car_add_page.dart index c90a44d..cb27b44 100644 --- a/lib/pages/home/doorAndCar/car/doorArea_car_add_page.dart +++ b/lib/pages/home/doorAndCar/car/doorArea_car_add_page.dart @@ -829,7 +829,7 @@ class _DoorareaCarAddPageState extends State { return; } - if(addData['vehicleBelongType'].isEmpty){ + if(addData['vehicleTypeName'].isEmpty){ ToastUtil.showNormal(context, '请选择车辆类型'); return; } @@ -887,7 +887,7 @@ class _DoorareaCarAddPageState extends State { LoadingDialogHelper.show(); final result = await DoorAndCarApi.enclosedAreaCarSave(addData); LoadingDialogHelper.hide(); - if (result['success'] == true) { + if (result['success'] ) { ToastUtil.showNormal(context, '提交成功'); Navigator.pop(context); } else { @@ -938,7 +938,7 @@ class _DoorareaCarAddPageState extends State { "projectId": "", //项目id "projectName": "", //项目名称 "applyReason": "", //申请理由 - "entourage": "", //随行人员 + // "entourage": null, //随行人员 "informSignId": "", //告知签字 "drivingLicenseId": "", //行驶证照片 "attachmentId": "", //车辆照片 diff --git a/lib/pages/home/doorAndCar/car/firstlevel_car_add_page.dart b/lib/pages/home/doorAndCar/car/firstlevel_car_add_page.dart index 072ab97..3acc367 100644 --- a/lib/pages/home/doorAndCar/car/firstlevel_car_add_page.dart +++ b/lib/pages/home/doorAndCar/car/firstlevel_car_add_page.dart @@ -767,7 +767,7 @@ class _FirstlevelCarAddPageState extends State { return; } - if(addData['vehicleBelongType'].isEmpty){ + if(addData['vehicleTypeName'].isEmpty){ ToastUtil.showNormal(context, '请选择车辆类型'); return; } @@ -859,7 +859,7 @@ class _FirstlevelCarAddPageState extends State { "licenceNo": "", //车牌号 "vehicleType": "", //车辆类型 "vehicleTypeName": "", //车辆类型-名字 - "vehicleBelongType": "", //车辆所属类型 1-股份员工车辆,2-股份单位车辆,3-分公司员工车辆,4-分公司单位车辆 ,5-相关方车辆, 6:临时车辆,7检查部门车辆 + "vehicleBelongType": "5", //车辆所属类型 1-股份员工车辆,2-股份单位车辆,3-分公司员工车辆,4-分公司单位车辆 ,5-相关方车辆, 6:临时车辆,7检查部门车辆 "gateLevelAuthArea": "", //授权范围港区与区域 "visitStartTime": "", //访问起始时间 "visitEndTime": "", //访问结束时间 diff --git a/lib/pages/home/doorAndCar/car/onlyLook_car_application.dart b/lib/pages/home/doorAndCar/car/onlyLook_car_application.dart index 16dd7e2..f0abdaa 100644 --- a/lib/pages/home/doorAndCar/car/onlyLook_car_application.dart +++ b/lib/pages/home/doorAndCar/car/onlyLook_car_application.dart @@ -158,7 +158,7 @@ class _OnlylookCarApplicationState extends State { label: '审核人员:', isEditable: false, horizontalnum: 0, - text: personnelList[0]['auditUserName'] ?? '', + text: personnelList.isNotEmpty? personnelList[0]['auditUserName'] ?? '':'', onTap: () {}, ), const Divider(), @@ -234,6 +234,8 @@ class _OnlylookCarApplicationState extends State { _buildPhotoItem(2,attachmentList), const Divider(), // _buildPhotoItem(3), + + if(signList.isNotEmpty) Container( height: 150, padding: EdgeInsets.all(8), @@ -351,8 +353,9 @@ class _OnlylookCarApplicationState extends State { Future _getXgfApplyInfoById() async { try { - + LoadingDialogHelper.show(); final Map result= await DoorAndCarApi.getLevelCarInfoById(widget.id); + LoadingDialogHelper.hide(); if (result['success'] ) { // final dynamic newList = result['data'] ; @@ -387,6 +390,7 @@ class _OnlylookCarApplicationState extends State { // _showMessage('加载数据失败'); } } catch (e) { + LoadingDialogHelper.hide(); // 出错时可以 Toast 或者在页面上显示错误状态 print('加载数据失败:$e'); } diff --git a/lib/pages/home/doorAndCar/car/onlyLook_doorarea_car.dart b/lib/pages/home/doorAndCar/car/onlyLook_doorarea_car.dart index b0db68f..ed2857c 100644 --- a/lib/pages/home/doorAndCar/car/onlyLook_doorarea_car.dart +++ b/lib/pages/home/doorAndCar/car/onlyLook_doorarea_car.dart @@ -354,6 +354,7 @@ class _OnlylookDoorareaCarState extends State { // ), const Divider(), + if(signList.isNotEmpty) Container( height: 150, padding: EdgeInsets.all(8), @@ -402,8 +403,9 @@ class _OnlylookDoorareaCarState extends State { Future _getXgfApplyInfoById() async { try { - + LoadingDialogHelper.show(); final Map result= await DoorAndCarApi.getEnclosedCarById(widget.id); + LoadingDialogHelper.hide(); if (result['success'] ) { // final dynamic newList = result['data'] ; @@ -438,6 +440,7 @@ class _OnlylookDoorareaCarState extends State { // _showMessage('加载数据失败'); } } catch (e) { + LoadingDialogHelper.hide(); // 出错时可以 Toast 或者在页面上显示错误状态 print('加载数据失败:$e'); } diff --git a/lib/pages/home/doorAndCar/doorArea_type_page.dart b/lib/pages/home/doorAndCar/doorArea_type_page.dart index 2dfe43e..3534d96 100644 --- a/lib/pages/home/doorAndCar/doorArea_type_page.dart +++ b/lib/pages/home/doorAndCar/doorArea_type_page.dart @@ -70,7 +70,7 @@ class _DoorareaTypePageState extends State { } }, - text: '', + text: ' ', ), const Divider(), @@ -90,7 +90,7 @@ class _DoorareaTypePageState extends State { } }, - text: '', + text: ' ', ), const Divider(), diff --git a/lib/pages/home/doorAndCar/person/doorArea_person_add_page.dart b/lib/pages/home/doorAndCar/person/doorArea_person_add_page.dart index 11a8062..1e6d025 100644 --- a/lib/pages/home/doorAndCar/person/doorArea_person_add_page.dart +++ b/lib/pages/home/doorAndCar/person/doorArea_person_add_page.dart @@ -767,7 +767,9 @@ class _DoorareaPersonApplyPageState extends State { } // 将 List 转换为 List> - addData['entourage'] = _personList.map((person) => person.toJson()).toList(); + List> jsonList = _personList.map((person) => person.toJson()).toList(); + // 再转换为 JSON 字符串 + addData['entourage'] = jsonEncode(jsonList); if(signImages.isEmpty){ ToastUtil.showNormal(context, '请阅读《安全进港须知》并签字'); diff --git a/lib/pages/home/doorAndCar/person/doorArea_person_record_page.dart b/lib/pages/home/doorAndCar/person/doorArea_person_record_page.dart index 9a0d790..b88483c 100644 --- a/lib/pages/home/doorAndCar/person/doorArea_person_record_page.dart +++ b/lib/pages/home/doorAndCar/person/doorArea_person_record_page.dart @@ -218,7 +218,7 @@ class _DoorareaPersonRecordPageState extends State { break; case 5: case 6: - await pushPage(OnlylookCarApplication(4,item['id']), context); + await pushPage(OnlylookCarApplication(4,item['vehicleApplyId']), context); break; case 7: case 8: @@ -251,7 +251,7 @@ class _DoorareaPersonRecordPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - item['projectName'], + item['projectName']??'', // '${item['name']??''}', style: const TextStyle( fontSize: 16, @@ -261,7 +261,10 @@ class _DoorareaPersonRecordPageState extends State { const SizedBox(height: 8), - Text('申请人:${item['applyUserName']??""}',), + if(widget.type==1||widget.type==2||widget.type==5||widget.type==6) + Text('审核人:${item['auditUserName']??""}',), + if(widget.type==3||widget.type==4||widget.type==7||widget.type==8) + Text('审核人:${item['auditPersonUserName']??""}',), if(widget.type==5||widget.type==6||widget.type==7||widget.type==8)...[ const SizedBox(height: 8), Text('车牌号:${item['licenceNo']??""}',), @@ -272,7 +275,7 @@ class _DoorareaPersonRecordPageState extends State { Text('时间范围:自${item['visitStartTime']??""}至${item['visitEndTime']??""}止'), const SizedBox(height: 8), Text('审核状态:${_getReviewStatus(item)}',), - if(widget.type==2||widget.type==4||widget.type==6||widget.type==8&&(item['reasonsRefusal']??"").isNotEmpty)...[ + if((widget.type==2||widget.type==4||widget.type==6||widget.type==8)&&(item['reasonsRefusal']??"").isNotEmpty)...[ const SizedBox(height: 8), Text('驳回原因:${item['reasonsRefusal']??""}',), ], @@ -366,33 +369,33 @@ class _DoorareaPersonRecordPageState extends State { child: Row( children: [ // 可点击的筛选图标 - GestureDetector( - onTap: () { - // 筛选逻辑 - }, - child: Container( - padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), - child: Row( - children: [ - Text( - '筛选', - style: TextStyle( - fontSize: 14, - color: Colors.black, - ), - ), - const SizedBox(width: 2), - Icon( - Icons.expand_more, - size: 20, - color: Colors.black, - ), - - ], - ), - ), - ), - const SizedBox(width: 8), + // GestureDetector( + // onTap: () { + // // 筛选逻辑 + // }, + // child: Container( + // padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), + // child: Row( + // children: [ + // Text( + // '筛选', + // style: TextStyle( + // fontSize: 14, + // color: Colors.black, + // ), + // ), + // const SizedBox(width: 2), + // Icon( + // Icons.expand_more, + // size: 20, + // color: Colors.black, + // ), + // + // ], + // ), + // ), + // ), + // const SizedBox(width: 8), // 搜索框 Expanded( child: SearchBarWidget( @@ -426,22 +429,35 @@ class _DoorareaPersonRecordPageState extends State { String _getAccessArea(final item) { //审核状态(1:审核中;2审核通过; 3:审核驳回,4无需审批(检查部门车辆)) - String type = item["gateLevelAuthArea"]??''; - if(type.isNotEmpty){ - // 解析 JSON - Map jsonData = json.decode(type); - List areaList = jsonData['area']; - // 提取 value 值列表 - List targetValues = areaList.map((item) => item['value'].toString()).toList(); - return targetValues.join(','); + String type =''; + if(widget.type==1||widget.type==2||widget.type==5||widget.type==6){ + type = item["gateLevelAuthArea"]??''; + if(type.isNotEmpty){ + // 解析 JSON + Map jsonData = json.decode(type); + List areaList = jsonData['area']; + // 提取 value 值列表 + List targetValues = areaList.map((item) => item['value'].toString()).toList(); + return targetValues.join(','); + }else{ + return ''; + } }else{ - return ''; + return item["closedAreaName"]??''; } + } String _getReviewStatus(final item) { //审核状态(1:审核中;2审核通过; 3:审核驳回,4无需审批(长期人员)) - int type = item['auditFlag']??""; + // int type = item['auditFlag']??""; + + int type =0; + if(widget.type==1||widget.type==2||widget.type==3||widget.type==4){ + type = int.tryParse(item['auditFlag']?.toString() ?? '') ?? 0; + }else{ + type = int.tryParse(item['auditStatus']?.toString() ?? '') ?? 0; + } if (1 == type) { return "待审核"; } else if (2 == type) { diff --git a/lib/pages/home/doorAndCar/person/onlyLook_doorarea_person.dart b/lib/pages/home/doorAndCar/person/onlyLook_doorarea_person.dart index 135140f..afdb26f 100644 --- a/lib/pages/home/doorAndCar/person/onlyLook_doorarea_person.dart +++ b/lib/pages/home/doorAndCar/person/onlyLook_doorarea_person.dart @@ -246,6 +246,7 @@ class _OnlylookDoorareaPersonState extends State { // 人员列表 ...personnelList.map((person) => _buildPersonCard(person)), + if(signList.isNotEmpty) Container( height: 150, padding: EdgeInsets.all(8), @@ -352,8 +353,9 @@ class _OnlylookDoorareaPersonState extends State { Future _getXgfApplyInfoById() async { try { - + LoadingDialogHelper.show(); final Map result= await DoorAndCarApi.getEnclosedPersonById(widget.id); + LoadingDialogHelper.hide(); if (result['success'] ) { // final dynamic newList = result['data'] ; @@ -380,6 +382,7 @@ class _OnlylookDoorareaPersonState extends State { // _showMessage('加载数据失败'); } } catch (e) { + LoadingDialogHelper.hide(); // 出错时可以 Toast 或者在页面上显示错误状态 print('加载数据失败:$e'); } diff --git a/lib/pages/home/doorAndCar/person/onlyLook_person_application.dart b/lib/pages/home/doorAndCar/person/onlyLook_person_application.dart index fe5d3dd..340d8d0 100644 --- a/lib/pages/home/doorAndCar/person/onlyLook_person_application.dart +++ b/lib/pages/home/doorAndCar/person/onlyLook_person_application.dart @@ -10,6 +10,7 @@ import 'package:qhd_prevention/http/ApiService.dart'; import 'package:qhd_prevention/http/modules/doorAndCar_api.dart'; import 'package:qhd_prevention/pages/my_appbar.dart'; import 'package:qhd_prevention/tools/h_colors.dart'; +import 'package:qhd_prevention/tools/tools.dart'; class OnlylookPersonApplication extends StatefulWidget { @@ -31,7 +32,7 @@ class _OnlylookPersonApplicationState extends State { List personnelList = []; //签字图片 - List signList = []; + late List signList = []; @override void initState() { @@ -62,6 +63,7 @@ class _OnlylookPersonApplicationState extends State { // 人员列表 ...personnelList.map((person) => _buildPersonCard(person)), + if (signList.isNotEmpty) Container( height: 150, padding: EdgeInsets.all(8), @@ -215,7 +217,7 @@ class _OnlylookPersonApplicationState extends State { ); } - Widget _buildPersonCard(Map person) { + Widget _buildPersonCard(Map person) { return Card( margin: EdgeInsets.only(bottom: 12), color: Colors.white, @@ -255,8 +257,9 @@ class _OnlylookPersonApplicationState extends State { // _buildInfoItem('部门:', person['部门'] ?? ''), ], ), - SizedBox(height: 12), + + SizedBox(height: 12), // 第二行:是否培训和权限范围 Row( crossAxisAlignment: CrossAxisAlignment.start, @@ -272,6 +275,7 @@ class _OnlylookPersonApplicationState extends State { ), ], ), + ], ), ), @@ -344,8 +348,9 @@ class _OnlylookPersonApplicationState extends State { Future _getXgfApplyInfoById() async { try { - + LoadingDialogHelper.show(); final Map result= await DoorAndCarApi.getXgfAuditInfoById(widget.id); + LoadingDialogHelper.hide(); if (result['success'] ) { // final dynamic newList = result['data'] ; @@ -372,6 +377,7 @@ class _OnlylookPersonApplicationState extends State { // _showMessage('加载数据失败'); } } catch (e) { + LoadingDialogHelper.hide(); // 出错时可以 Toast 或者在页面上显示错误状态 print('加载数据失败:$e'); } diff --git a/lib/pages/home/doorAndCar/person_selection_page.dart b/lib/pages/home/doorAndCar/person_selection_page.dart index 902d8ef..c22c8ce 100644 --- a/lib/pages/home/doorAndCar/person_selection_page.dart +++ b/lib/pages/home/doorAndCar/person_selection_page.dart @@ -114,7 +114,7 @@ class _PersonSelectionPageState extends State { groupedPersons = {}; for (var item in list) { - String id = item['id']??''; + String id = item['userId']??''; String name = item['userName']??''; // 使用lpinyin获取姓名首字母 @@ -506,6 +506,7 @@ class _PersonSelectionPageState extends State { if(widget.isMoreSelect){ selectedStates[person.employeePersonUserId] = value ?? false; + _updateGroupSelection(person.group); }else{ // 清空所有选中状态 for (var group in groupedPersons.keys) { @@ -517,7 +518,7 @@ class _PersonSelectionPageState extends State { selectedStates[person.employeePersonUserId] = true; } - _updateGroupSelection(person.group); + }); },