From d363c404083cb5605a27af928b7b4a72b1d3b65f Mon Sep 17 00:00:00 2001 From: xufei <727302827@qq.com> Date: Wed, 25 Mar 2026 16:09:17 +0800 Subject: [PATCH] =?UTF-8?q?2026.3.25=20=E5=88=97=E8=A1=A8=E6=9D=83?= =?UTF-8?q?=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../department_picker_enterprise.dart | 6 +- lib/http/modules/basic_info_api.dart | 14 + lib/http/modules/doorAndCar_api.dart | 11 +- .../doorAndCar/car/doorArea_car_add_page.dart | 198 ++++---- .../car/firstlevel_car_add_page.dart | 4 +- .../person/doorArea_person_add_page.dart | 176 ++++---- .../person/doorArea_person_record_page.dart | 23 +- .../person/firstlevel_person_add_page.dart | 2 +- lib/pages/home/home_page.dart | 425 +++++++++++------- 9 files changed, 497 insertions(+), 362 deletions(-) diff --git a/lib/customWidget/department_picker_enterprise.dart b/lib/customWidget/department_picker_enterprise.dart index 97f835d..b9b4d0d 100644 --- a/lib/customWidget/department_picker_enterprise.dart +++ b/lib/customWidget/department_picker_enterprise.dart @@ -21,7 +21,7 @@ class CategoryEnterpriseType { factory CategoryEnterpriseType.fromJson(Map json) { return CategoryEnterpriseType( - id: json['corpinfoId'] != null ? json['corpinfoId'].toString() : "", + id: json['id'] != null ? json['id'].toString() : "", name: json['corpName'] != null ? json['corpName'].toString() : "", pdId: json['parentId'] != null ? json['parentId'].toString() : "", children: _safeParseChildren(json['childrenList']), @@ -54,8 +54,10 @@ typedef DeptSelectCallback = void Function(String id, String name,String pdId); class DepartmentPickerEnterprise extends StatefulWidget { /// 回调,返回选中部门 id 与 name final DeptSelectCallback onSelected; + ///港区id + final String jurisdictionalAuthorityId; - const DepartmentPickerEnterprise({Key? key, required this.onSelected}) : super(key: key); + const DepartmentPickerEnterprise(this.jurisdictionalAuthorityId,{Key? key, required this.onSelected}) : super(key: key); @override _DepartmentPickerEnterpriseState createState() => _DepartmentPickerEnterpriseState(); diff --git a/lib/http/modules/basic_info_api.dart b/lib/http/modules/basic_info_api.dart index 36da5f5..6985658 100644 --- a/lib/http/modules/basic_info_api.dart +++ b/lib/http/modules/basic_info_api.dart @@ -221,3 +221,17 @@ class CertificateApi { } } + +// 待办事项 +class TodoApi { + static Future> getTodoList(Map data) { + return HttpManager().request( + ApiService.basePath + '/appmenu', + '/todoList/list', + method: Method.post, + data: { + ...data + }, + ); + } +} diff --git a/lib/http/modules/doorAndCar_api.dart b/lib/http/modules/doorAndCar_api.dart index df17984..e48913d 100644 --- a/lib/http/modules/doorAndCar_api.dart +++ b/lib/http/modules/doorAndCar_api.dart @@ -60,10 +60,17 @@ class DoorAndCarApi { /// 审批人所有数据 - static Future> getApproverList(String corpId,String deptId) { + static Future> getApproverList(String corpId,String deptId, + String personnelPermissionFlag, //人员审核权限(1-无权限,2-有权限) + String vehiclePermissionFlag,//车辆审核权限(1-无权限,2-有权限) + String temporaryPermissionFlag,//临时审核权限(1-无权限,2-有权限) + ) { return HttpManager().request( '${ApiService.basePath}/primeport', - '/mkmjApprovalUser/listAll?corpId=$corpId', + '/mkmjApprovalUser/listAll?corpId=$corpId' + '&personnelPermissionFlag=$personnelPermissionFlag' + '&vehiclePermissionFlag=$vehiclePermissionFlag' + '&temporaryPermissionFlag=$temporaryPermissionFlag', method: Method.get, data: { // ...data 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 0822f77..c90a44d 100644 --- a/lib/pages/home/doorAndCar/car/doorArea_car_add_page.dart +++ b/lib/pages/home/doorAndCar/car/doorArea_car_add_page.dart @@ -82,15 +82,27 @@ class _DoorareaCarAddPageState extends State { ListItemFactory.createBuildSimpleSection('申请信息'), - - const Divider(), + ItemListWidget.selectableLineTitleTextRightButton( + label: '选择港区:', + isEditable: true, + text: addData['portAreaName'] ?? '请选择', + isRequired: true, + onTap: () async { + _getPortAreaType(); + }, + ), + const Divider(), ItemListWidget.selectableLineTitleTextRightButton( label: '选择管辖单位:', isEditable: true, text: addData['jurisdictionalCorpName'] ?? '请选择', isRequired: true, onTap: () { + if( addData['portAreaId'].isEmpty){ + ToastUtil.showNormal(context, '请先选择港区'); + return; + } showModalBottomSheet( context: context, isScrollControlled: true, @@ -98,6 +110,7 @@ class _DoorareaCarAddPageState extends State { backgroundColor: Colors.transparent, builder: (ctx) => DepartmentPickerEnterprise( + addData['portAreaId'], onSelected: (id, name,pdId) async { setState(() { addData['jurisdictionalCorpId']= id; @@ -495,94 +508,54 @@ class _DoorareaCarAddPageState extends State { Future _getVisitPortArea() async { + try { + LoadingDialogHelper.show(); + final raw = await DoorAndCarApi.getEnclosedAreaById(addData['jurisdictionalCorpId']); + LoadingDialogHelper.hide(); + if (raw['success'] ) { + List newList = raw['data'] ?? []; - List result = []; - // 计算预选索引 - final List initialIndices = []; - - final resultList = await DoorAndCarApi.getEnclosedAreaById(addData['jurisdictionalCorpName']); - List raw = resultList["data"] as List; - - result = raw.map((item) => item['closedAreaName'].toString()).toList(); - - if(addData['gateLevelAuthArea'].isNotEmpty){ - // 解析 JSON - Map jsonData = json.decode(addData['gateLevelAuthArea']); - List areaList = jsonData['area']; - // 提取 value 值列表 - List targetValues = areaList.map((item) => item['value'].toString()).toList(); - - // 遍历目标值,在 raw 中查找匹配 - for (String targetValue in targetValues) { - for (int i = 0; i < raw.length; i++) { - var item = raw[i]; - if (item != null && item is Map && item.containsKey('dictLabel')) { - if (item['dictLabel'].toString() == targetValue) { - initialIndices.add(i);// 记录索引位置(从0开始) - break; - } - } + for(int i=0;i DepartmentPickerThree( + listdata: newList, + onSelected: (id, name,pdId) async { + setState(() { + addData['closedAreaId']=id;//封闭区域id + addData['closedAreaName']=name;//封闭区域名称 + + }); + }, + ), + ); + }else{ + ToastUtil.showNormal(context, "获取列表失败"); + LoadingDialogHelper.hide(); + // _showMessage('反馈提交失败'); + // return ""; } + } catch (e) { + // 出错时可以 Toast 或者在页面上显示错误状态 + print('加载首页数据失败:$e'); + // return ""; + LoadingDialogHelper.hide(); } - - - // 显示选择器 - final selectedItems = await CenterMultiPicker.show( - context, - items: result, - itemBuilder: (item) => Text( - item, - style: const TextStyle(fontSize: 16), - ), - initialSelectedIndices: initialIndices, // 设置预选索引 - maxSelection: null, // 不限制选择数量 - allowEmpty: true, - title: '管辖区域', - ); - - // 处理选择结果 - if (selectedItems != null) { - setState(() { - addData['gateLevelAuthAreaName'] = selectedItems.join(','); - - // 构建新的 JSON 数据 - List> areaList = []; - - // 遍历选中的项目,在 raw 中查找对应的完整数据 - for (String selectedItem in selectedItems) { - for (var item in raw) { - if (item != null && item is Map && item.containsKey('dictLabel')) { - if (item['dictLabel'].toString() == selectedItem) { - // 找到匹配的数据,添加 value(dictLabel) 和 bianma(dictValue) - areaList.add({ - 'value': item['dictLabel'].toString(), - 'bianma': item['dictValue'].toString(), // 或者使用 toString() 如果需要字符串 - }); - break; - } - } - } - } - - // 构建最终的 JSON 字符串 - Map jsonData = { - 'area': areaList - }; - - // 将 Map 转换为 JSON 字符串并保存 - addData['gateLevelAuthArea'] = json.encode(jsonData); - - }); - } - } Future _getApproverList() async { try { LoadingDialogHelper.show(); - final raw = await DoorAndCarApi.getApproverList( addData['auditPersonCorpId'],'');//addData['auditDeptId'] + final raw = await DoorAndCarApi.getApproverList( addData['auditPersonCorpId'],'','','1','');//addData['auditDeptId'] LoadingDialogHelper.hide(); if (raw['success'] ) { List newList = raw['data'] ?? []; @@ -703,6 +676,31 @@ class _DoorareaCarAddPageState extends State { }); } + + Future _getPortAreaType() async { + showModalBottomSheet( + context: context, + isScrollControlled: true, + barrierColor: Colors.black54, + backgroundColor: Colors.transparent, + builder: + (_) => MultiDictValuesPicker( + title: '港区', + dictType: 'HG_AUTH_AREA', + allowSelectParent: false, + onSelected: (id, name, extraData) { + setState(() { + addData['portAreaId'] = extraData?['dictValue'];//港区id + addData['portAreaName'] = name;//港区名称 + + }); + }, + ), + ).then((_) { + // 可选:FocusHelper.clearFocus(context); + }); + } + Future _getLicensePlateType() async { showModalBottomSheet( context: context, @@ -789,19 +787,24 @@ class _DoorareaCarAddPageState extends State { Future _saveSuccess() async { try { - if(addData['projectName'].isEmpty){ - ToastUtil.showNormal(context, '请选择选择项目名称'); + if(addData['jurisdictionalCorpId'].isEmpty){ + ToastUtil.showNormal(context, '请选择选择管辖单位'); return; } - if(addData['auditUserName'].isEmpty){ + if(addData['auditPersonUserName'].isEmpty){ ToastUtil.showNormal(context, '请选择审核人员'); return; } - if(addData['gateLevelAuthAreaName'].isEmpty){ - ToastUtil.showNormal(context, '请选择访问港区'); + if(addData['projectName'].isEmpty){ + ToastUtil.showNormal(context, '请选择项目'); + return; + } + + if(addData['applyReason'].isEmpty){ + ToastUtil.showNormal(context, '请填写申请原因'); return; } @@ -836,20 +839,6 @@ class _DoorareaCarAddPageState extends State { return; } - if(addData['licenceTypeName'].isEmpty){ - ToastUtil.showNormal(context, '请选择车牌类型'); - return; - } - - if(addData['vehicleBelongType'].isEmpty){ - ToastUtil.showNormal(context, '请选择车辆类型'); - return; - } - - if(addData['licenceNo'].isEmpty){ - ToastUtil.showNormal(context, '请输入车牌号'); - return; - } bool isLicenseTrue = isValidChineseLicensePlate(addData['licenceNo']); if(!isLicenseTrue){ @@ -857,6 +846,11 @@ class _DoorareaCarAddPageState extends State { return; } + if(_vehicleImages.isEmpty){ + ToastUtil.showNormal(context, '请上传车辆照片'); + return; + } + if(_vehicleLicenseImages.isEmpty){ ToastUtil.showNormal(context, '请上传行驶证照片'); return; @@ -865,10 +859,6 @@ class _DoorareaCarAddPageState extends State { return; } - if(_vehicleImages.isEmpty){ - ToastUtil.showNormal(context, '请上传车辆照片'); - return; - } if(signImages.isEmpty){ ToastUtil.showNormal(context, '请阅读《安全进港须知》并签字'); @@ -968,6 +958,8 @@ class _DoorareaCarAddPageState extends State { "userPhone": "", //申请人手机号 "userCard": "", //申请人身份证号码 + "portAreaId": '', //港区id + "portAreaName": '', //港区名称 "auditAllTime": '', //时间反显 }; 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 9870c77..072ab97 100644 --- a/lib/pages/home/doorAndCar/car/firstlevel_car_add_page.dart +++ b/lib/pages/home/doorAndCar/car/firstlevel_car_add_page.dart @@ -537,7 +537,7 @@ class _FirstlevelCarAddPageState extends State { Future _getApproverList() async { try { LoadingDialogHelper.show(); - final raw = await DoorAndCarApi.getApproverList( corpinfoId,''); + final raw = await DoorAndCarApi.getApproverList( corpinfoId,'','','1',''); LoadingDialogHelper.hide(); if (raw['success'] ) { List newList = raw['data'] ?? []; @@ -757,6 +757,8 @@ class _FirstlevelCarAddPageState extends State { return; } + addData['drivingUserId']=_personList[0].userPhone; + addData['drivingUserName']=_personList[0].userCard; addData['lsUserPhone']=_personList[0].userPhone; addData['lsUserIdcard']=_personList[0].userCard; 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 89f20b5..11a8062 100644 --- a/lib/pages/home/doorAndCar/person/doorArea_person_add_page.dart +++ b/lib/pages/home/doorAndCar/person/doorArea_person_add_page.dart @@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'package:qhd_prevention/constants/app_enums.dart'; import 'package:qhd_prevention/customWidget/ItemWidgetFactory.dart'; +import 'package:qhd_prevention/customWidget/MultiDictValuesPicker.dart'; import 'package:qhd_prevention/customWidget/bottom_picker.dart'; import 'package:qhd_prevention/customWidget/center_multi_picker.dart'; import 'package:qhd_prevention/customWidget/custom_alert_dialog.dart'; @@ -80,12 +81,26 @@ class _DoorareaPersonApplyPageState extends State { children: [ ListItemFactory.createBuildSimpleSection('申请信息'), const Divider(), + ItemListWidget.selectableLineTitleTextRightButton( + label: '选择港区:', + isEditable: true, + text: addData['portAreaName'] ?? '请选择', + isRequired: true, + onTap: () async { + _getPortAreaType(); + }, + ), + const Divider(), ItemListWidget.selectableLineTitleTextRightButton( label: '选择管辖单位:', isEditable: true, text: addData['jurisdictionalCorpName'] ?? '请选择', isRequired: true, onTap: () { + if( addData['portAreaId'].isEmpty){ + ToastUtil.showNormal(context, '请先选择港区'); + return; + } showModalBottomSheet( context: context, isScrollControlled: true, @@ -93,6 +108,7 @@ class _DoorareaPersonApplyPageState extends State { backgroundColor: Colors.transparent, builder: (ctx) => DepartmentPickerEnterprise( + addData['portAreaId'], onSelected: (id, name,pdId) async { setState(() { addData['jurisdictionalCorpId']= id; @@ -526,95 +542,81 @@ class _DoorareaPersonApplyPageState extends State { }); } - Future _getVisitPortArea() async { - List result = []; - // 计算预选索引 - final List initialIndices = []; + Future _getPortAreaType() async { + showModalBottomSheet( + context: context, + isScrollControlled: true, + barrierColor: Colors.black54, + backgroundColor: Colors.transparent, + builder: + (_) => MultiDictValuesPicker( + title: '港区', + dictType: 'HG_AUTH_AREA', + allowSelectParent: false, + onSelected: (id, name, extraData) { + setState(() { + addData['portAreaId'] = extraData?['dictValue'];//港区id + addData['portAreaName'] = name;//港区名称 - final resultList = await DoorAndCarApi.getEnclosedAreaById(addData['jurisdictionalCorpName']); - List raw = resultList["data"] as List; - - result = raw.map((item) => item['closedAreaName'].toString()).toList(); - - if(addData['gateLevelAuthArea'].isNotEmpty){ - // 解析 JSON - Map jsonData = json.decode(addData['gateLevelAuthArea']); - List areaList = jsonData['area']; - // 提取 value 值列表 - List targetValues = areaList.map((item) => item['value'].toString()).toList(); - - // 遍历目标值,在 raw 中查找匹配 - for (String targetValue in targetValues) { - for (int i = 0; i < raw.length; i++) { - var item = raw[i]; - if (item != null && item is Map && item.containsKey('dictLabel')) { - if (item['dictLabel'].toString() == targetValue) { - initialIndices.add(i);// 记录索引位置(从0开始) - break; - } - } - } - } - } - - - // 显示选择器 - final selectedItems = await CenterMultiPicker.show( - context, - items: result, - itemBuilder: (item) => Text( - item, - style: const TextStyle(fontSize: 16), + }); + }, ), - initialSelectedIndices: initialIndices, // 设置预选索引 - maxSelection: null, // 不限制选择数量 - allowEmpty: true, - title: '管辖区域', - ); + ).then((_) { + // 可选:FocusHelper.clearFocus(context); + }); + } - // 处理选择结果 - if (selectedItems != null) { - setState(() { - addData['gateLevelAuthAreaName'] = selectedItems.join(','); - // 构建新的 JSON 数据 - List> areaList = []; + Future _getVisitPortArea() async { + try { + LoadingDialogHelper.show(); + final raw = await DoorAndCarApi.getEnclosedAreaById(addData['jurisdictionalCorpId']); + LoadingDialogHelper.hide(); + if (raw['success'] ) { + List newList = raw['data'] ?? []; - // 遍历选中的项目,在 raw 中查找对应的完整数据 - for (String selectedItem in selectedItems) { - for (var item in raw) { - if (item != null && item is Map && item.containsKey('dictLabel')) { - if (item['dictLabel'].toString() == selectedItem) { - // 找到匹配的数据,添加 value(dictLabel) 和 bianma(dictValue) - areaList.add({ - 'value': item['dictLabel'].toString(), - 'bianma': item['dictValue'].toString(), // 或者使用 toString() 如果需要字符串 - }); - break; - } - } - } - } + for(int i=0;i jsonData = { - 'area': areaList - }; + showModalBottomSheet( + context: context, + isScrollControlled: true, + barrierColor: Colors.black54, + backgroundColor: Colors.transparent, + builder: + (ctx) => DepartmentPickerThree( + listdata: newList, + onSelected: (id, name,pdId) async { + setState(() { + addData['closedAreaId']=id;//封闭区域id + addData['closedAreaName']=name;//封闭区域名称 - // 将 Map 转换为 JSON 字符串并保存 - addData['gateLevelAuthArea'] = json.encode(jsonData); - - }); + }); + }, + ), + ); + }else{ + ToastUtil.showNormal(context, "获取列表失败"); + LoadingDialogHelper.hide(); + // _showMessage('反馈提交失败'); + // return ""; + } + } catch (e) { + // 出错时可以 Toast 或者在页面上显示错误状态 + print('加载首页数据失败:$e'); + // return ""; + LoadingDialogHelper.hide(); } - } Future _getApproverList() async { try { LoadingDialogHelper.show(); - final raw = await DoorAndCarApi.getApproverList( addData['auditPersonCorpId'],'');//addData['auditDeptId'] + final raw = await DoorAndCarApi.getApproverList( addData['auditPersonCorpId'],'','1','','');//addData['auditDeptId'] LoadingDialogHelper.hide(); if (raw['success'] ) { List newList = raw['data'] ?? []; @@ -765,7 +767,7 @@ class _DoorareaPersonApplyPageState extends State { } // 将 List 转换为 List> - addData['personApplyList'] = _personList.map((person) => person.toJson()).toList(); + addData['entourage'] = _personList.map((person) => person.toJson()).toList(); if(signImages.isEmpty){ ToastUtil.showNormal(context, '请阅读《安全进港须知》并签字'); @@ -839,21 +841,23 @@ class _DoorareaPersonApplyPageState extends State { "userPhone": "", //申请人手机号 "userCard": "", //申请人身份证号 + "portAreaId": '', //港区id + "portAreaName": '', //港区名称 "auditAllTime": '', //时间反显 "personApplyList": [], }; - Map addPersonData= { - "personCorpId": '', //待审批人员所属企业ID - "personCorpName": '', //待审批人员所属企业名称 - "personDepartmentId": '', //待审批人员所属部门id - "personDepartmentName": '', //待审批人员部门名称 - "employeePersonUserId": '', //待审批人员id - "employeePersonUserName": '', //待审批人员姓名 - "userFaceUrl": '', //头像 - "userPhone": '', //手机号 - "userCard": '', //身份证号码 - }; + // Map addPersonData= { + // "personCorpId": '', //待审批人员所属企业ID + // "personCorpName": '', //待审批人员所属企业名称 + // "personDepartmentId": '', //待审批人员所属部门id + // "personDepartmentName": '', //待审批人员部门名称 + // "employeePersonUserId": '', //待审批人员id + // "employeePersonUserName": '', //待审批人员姓名 + // "userFaceUrl": '', //头像 + // "userPhone": '', //手机号 + // "userCard": '', //身份证号码 + // }; 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 fbd2c6f..9a0d790 100644 --- a/lib/pages/home/doorAndCar/person/doorArea_person_record_page.dart +++ b/lib/pages/home/doorAndCar/person/doorArea_person_record_page.dart @@ -66,24 +66,34 @@ class _DoorareaPersonRecordPageState extends State { buttonName='查看'; isAdd=true; xgfDataApplyListData['processOrRecord']=1; + + xgfDataApplyListData['xgf-stk-personnel-application'] = '/primeport/container/stakeholder/firstLevelDoor/personnelApplication/list'; break; case 2:// 2 进港口门申请记录(人) titleName='人员审核记录'; buttonName='查看'; isAdd=false; xgfDataApplyListData['processOrRecord']=2; + + xgfDataApplyListData['xgf-stk-personnel-app-records'] = '/primeport/container/stakeholder/firstLevelDoor/personnelApplicationRecords/list'; break; case 3://3 封闭区域口门申请(人) titleName='人员审核'; buttonName='查看'; isAdd=true; xgfDataApplyListData['processOrRecord']=1; + xgfDataApplyListData['personBelongType']=3; + + xgfDataApplyListData['xgs-ren-yuan-feng-bi-qu-yu-shen-qing'] = '/primeport/container/stakeholder/enclosedArea/apply/personnel/list'; break; case 4://4 封闭区域口门申请记录(人) titleName='人员审核记录'; buttonName='查看'; isAdd=false; xgfDataApplyListData['processOrRecord']=2; + xgfDataApplyListData['personBelongType']=3; + + xgfDataApplyListData['xgs-ren-yuan-feng-bi-qu-yu-shen-qing-ji-lu'] = '/primeport/container/stakeholder/enclosedArea/apply/personnelRecords/list'; break; case 5: //5 进港口门申请(车) titleName='车辆审核'; @@ -91,6 +101,8 @@ class _DoorareaPersonRecordPageState extends State { isAdd=true; xgfDataApplyListData['processOrRecord']=1; xgfDataApplyListData['vehicleBelongType']='5'; + + xgfDataApplyListData['xgf-stk-vehicle-application'] = '/primeport/container/stakeholder/firstLevelDoor/vehicleApplication/list'; break; case 6: // 6 进港口门申请记录(车) titleName='车辆审核记录'; @@ -98,18 +110,26 @@ class _DoorareaPersonRecordPageState extends State { isAdd=false; xgfDataApplyListData['processOrRecord']=2; xgfDataApplyListData['vehicleBelongType']='5'; + + xgfDataApplyListData['xgf-stk-vehicle-app-records'] = '/primeport/container/stakeholder/firstLevelDoor/vehicleApplicationRecords/list'; break; case 7: // 7 封闭区域口门申请(车) titleName='车辆审核'; buttonName='查看'; isAdd=true; xgfDataApplyListData['processOrRecord']=1; + xgfDataApplyListData['personBelongType']=3; + + xgfDataApplyListData['xgs-che-liang-feng-bi-qu-yu-shen-qing'] = '/primeport/container/stakeholder/enclosedArea/apply/vehicle/list'; break; case 8: // 8 封闭区域口门申请记录(车) titleName='车辆审核记录'; buttonName='查看'; isAdd=false; xgfDataApplyListData['processOrRecord']=2; + xgfDataApplyListData['personBelongType']=3; + + xgfDataApplyListData['xgs-che-liang-feng-bi-qu-yu-shen-qing-ji-lu'] = '/primeport/container/stakeholder/enclosedArea/apply/vehicleRecords/list'; break; } @@ -190,7 +210,7 @@ class _DoorareaPersonRecordPageState extends State { switch(widget.type){ case 1: case 2: - await pushPage(OnlylookPersonApplication(3,item['id']), context);//重新写 + await pushPage(OnlylookPersonApplication(3,item['id']), context); break; case 3: case 4: @@ -446,6 +466,7 @@ class _DoorareaPersonRecordPageState extends State { "licenceNo": "", //车牌号 "vehicleBelongTypeArr": "", //车辆所属类型 1-股份员工车辆,2-股份单位车辆,3-分公司员工车辆,4-分公司单位车辆 ,5-相关方车辆, 6:临时车辆,7检查部门车辆 "vehicleBelongType": "", //车辆所属类型 1-股份员工车辆,2-股份单位车辆,3-分公司员工车辆,4-分公司单位车辆 ,5-相关方车辆, 6:临时车辆,7检查部门车辆 + "personBelongType": '', //1股份2分公司3相关方4临时人员 }; diff --git a/lib/pages/home/doorAndCar/person/firstlevel_person_add_page.dart b/lib/pages/home/doorAndCar/person/firstlevel_person_add_page.dart index 1bc4344..509b757 100644 --- a/lib/pages/home/doorAndCar/person/firstlevel_person_add_page.dart +++ b/lib/pages/home/doorAndCar/person/firstlevel_person_add_page.dart @@ -544,7 +544,7 @@ class _FirstlevelPersonAddPageState extends State { Future _getApproverList() async { try { LoadingDialogHelper.show(); - final raw = await DoorAndCarApi.getApproverList( corpinfoId,''); + final raw = await DoorAndCarApi.getApproverList( corpinfoId,'','1','',''); LoadingDialogHelper.hide(); if (raw['success'] ) { List newList = raw['data'] ?? []; diff --git a/lib/pages/home/home_page.dart b/lib/pages/home/home_page.dart index c43b26f..53a6a29 100644 --- a/lib/pages/home/home_page.dart +++ b/lib/pages/home/home_page.dart @@ -10,6 +10,7 @@ import 'package:qhd_prevention/customWidget/custom_button.dart'; import 'package:qhd_prevention/customWidget/toast_util.dart'; import 'package:qhd_prevention/http/ApiService.dart'; import 'package:qhd_prevention/pages/home/Study/study_tab_list_page.dart'; +import 'package:qhd_prevention/pages/home/doorAndCar/doorCar_tab_page.dart'; import 'package:qhd_prevention/pages/home/scan_page.dart'; import 'package:qhd_prevention/pages/home/unit/unit_tab_page.dart'; import 'package:qhd_prevention/pages/main_tab.dart'; @@ -60,28 +61,31 @@ class HomePageState extends RouteAwareState List totalList = []; - Map workStats = {'total': 36, 'processed': 30, 'pending': 6}; + // 工作统计(示例) + Map workStats = {'total': 0, 'processed': 0, 'pending': 0}; - List> checkLists = [ - { - "title": "电工班车间清单", - "type": "隐患排查", - "time": "2025-11-17", - "color": Color(0xFF4CAF50), - }, - { - "title": "工地区消防点检清单", - "type": "消防点检", - "time": "2025-11-17", - "color": Color(0xFF2196F3), - }, - { - "title": "消防专项检查清单", - "type": "重点作业", - "time": "2025-11-17", - "color": Color(0xFFFF9800), - }, - ]; + // 检查清单示例 + List checkLists = []; + // List> checkLists = [ + // { + // "title": "电工班车间清单", + // "type": "隐患排查", + // "time": "2025-11-17", + // "color": Color(0xFF4CAF50), + // }, + // { + // "title": "工地区消防点检清单", + // "type": "消防点检", + // "time": "2025-11-17", + // "color": Color(0xFF2196F3), + // }, + // { + // "title": "消防专项检查清单", + // "type": "安环检查", + // "time": "2025-11-17", + // "color": Color(0xFFFF9800), + // }, + // ]; final List _notifications = [ "系统通知:今晚20:00 将进行系统维护,请提前保存数据。", @@ -128,6 +132,8 @@ class HomePageState extends RouteAwareState "scan": "dashboard-scan", }; + int pcType=1; + @override void initState() { super.initState(); @@ -158,6 +164,10 @@ class HomePageState extends RouteAwareState Future.microtask(() { _updateModuleAndButtonVisibility(); }); + if(_isShowCheckLogin){ + _getToDoWorkList(pcType); + } + } @override @@ -622,6 +632,9 @@ class HomePageState extends RouteAwareState case "入港培训": pushPage(StudyTabListPage(), context); break; + case "口门门禁": + pushPage(DoorcarTabPage(), context); + break; default: ToastUtil.showNormal(context, '功能开发中...'); break; @@ -629,37 +642,79 @@ class HomePageState extends RouteAwareState } Widget _buildWorkStatsSection() { - double buttonHeight = 45.0; return Container( - padding: const EdgeInsets.all(1), + padding: const EdgeInsets.all(15), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(12), - boxShadow: const [BoxShadow(color: Colors.black12, blurRadius: 6, offset: Offset(0, 2))], + boxShadow: const [ + BoxShadow(color: Colors.black12, blurRadius: 6, offset: Offset(0, 2)), + ], ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container( + width: double.infinity, + padding: const EdgeInsets.symmetric(vertical: 0), + child: RichText( + text: TextSpan( + children: [ + TextSpan( + text: "今日有工作项", + style: TextStyle(fontSize: 16, color: Colors.black87), + ), + TextSpan( + text: " ${workStats['total']}", + style: const TextStyle( + fontSize: 16, + color: Color(0xFF2A75F8), + fontWeight: FontWeight.bold, + ), + ), + TextSpan( + text: "个", + style: TextStyle(fontSize: 16, color: Colors.black87), + ), + ], + ), + ), + ), + const SizedBox(height: 15), Container( width: screenWidth(context), - height: buttonHeight, + height: 36, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(20), + border: Border.all(color: Colors.grey[300]!, width: 1), + ), child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Expanded( child: GestureDetector( - onTap: () => setState(() => _isMobileSelected = true), + onTap: () { + setState(() { + _isMobileSelected = true; + }); + pcType=1; + _getToDoWorkList(pcType); + }, child: Container( decoration: BoxDecoration( - color: _isMobileSelected ? const Color(0xFFE9F4FE) : Colors.white, - borderRadius: const BorderRadius.only(topLeft: Radius.circular(12)), + color: + _isMobileSelected ? const Color(0xFF2A75F8) : Colors.white, + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(20), + bottomLeft: Radius.circular(20), + ), ), child: Center( child: Text( "手机端", style: TextStyle( fontSize: 14, - color: _isMobileSelected ? Colors.black : Colors.blue, + color: _isMobileSelected ? Colors.white : Colors.black87, fontWeight: FontWeight.w500, ), ), @@ -667,26 +722,29 @@ class HomePageState extends RouteAwareState ), ), ), - Image.asset( - 'assets/images/${_isMobileSelected ? 'img2.png' : 'img1.png'}', - fit: BoxFit.cover, - height: buttonHeight, - width: 30, - ), Expanded( child: GestureDetector( - onTap: () => setState(() => _isMobileSelected = false), + onTap: () { + setState(() { + _isMobileSelected = false; + }); + pcType=2; + _getToDoWorkList(pcType); + }, child: Container( decoration: BoxDecoration( - color: !_isMobileSelected ? const Color(0xFFE9F4FE) : Colors.white, - borderRadius: const BorderRadius.only(topRight: Radius.circular(12)), + color: !_isMobileSelected ? const Color(0xFF2A75F8) : Colors.white, + borderRadius: const BorderRadius.only( + topRight: Radius.circular(20), + bottomRight: Radius.circular(20), + ), ), child: Center( child: Text( "电脑端", style: TextStyle( - fontSize: 15, - color: !_isMobileSelected ? Colors.black : Colors.blue, + fontSize: 14, + color: !_isMobileSelected ? Colors.white : Colors.black87, fontWeight: FontWeight.w500, ), ), @@ -697,147 +755,182 @@ class HomePageState extends RouteAwareState ], ), ), - Padding( - padding: const EdgeInsets.all(15), - child: Column( - children: [ - Container( - width: double.infinity, - padding: const EdgeInsets.symmetric(vertical: 0), - child: RichText( - text: TextSpan( - children: [ - const TextSpan(text: "今日有工作项", style: TextStyle(fontSize: 16, color: Colors.black87)), - TextSpan( - text: " ${workStats['total']}", - style: const TextStyle(fontSize: 16, color: Color(0xFF2A75F8), fontWeight: FontWeight.bold), - ), - const TextSpan(text: "个", style: TextStyle(fontSize: 16, color: Colors.black87)), - ], - ), - ), - ), - const SizedBox(height: 15), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - RichText( - text: TextSpan( - children: [ - const TextSpan(text: "已处理工作项:", style: TextStyle(fontSize: 14, color: Colors.black87)), - TextSpan( - text: " ${workStats['processed']}", - style: const TextStyle(fontSize: 14, color: Colors.greenAccent, fontWeight: FontWeight.bold), - ), - const TextSpan(text: "个", style: TextStyle(fontSize: 14, color: Colors.black87)), - ], - ), - ), - RichText( - text: TextSpan( - children: [ - const TextSpan(text: "待处理工作项:", style: TextStyle(fontSize: 14, color: Colors.black87)), - TextSpan( - text: " ${workStats['pending']}", - style: const TextStyle(fontSize: 14, color: Colors.orange, fontWeight: FontWeight.bold), - ), - const TextSpan(text: "个", style: TextStyle(fontSize: 14, color: Colors.black87)), - ], - ), - ), - ], - ), - ], - ), - ), + // const SizedBox(height: 15), + // Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // RichText( + // text: TextSpan( + // children: [ + // TextSpan( + // text: "已处理工作项:", + // style: TextStyle(fontSize: 14, color: Colors.black87), + // ), + // TextSpan( + // text: " ${workStats['processed']}", + // style: const TextStyle( + // fontSize: 14, + // color: Colors.greenAccent, + // fontWeight: FontWeight.bold, + // ), + // ), + // TextSpan( + // text: "个", + // style: TextStyle(fontSize: 14, color: Colors.black87), + // ), + // ], + // ), + // ), + // RichText( + // text: TextSpan( + // children: [ + // TextSpan( + // text: "待处理工作项:", + // style: TextStyle(fontSize: 14, color: Colors.black87), + // ), + // TextSpan( + // text: " ${workStats['processed']}", + // style: const TextStyle( + // fontSize: 14, + // color: Colors.orange, + // fontWeight: FontWeight.bold, + // ), + // ), + // TextSpan( + // text: "个", + // style: TextStyle(fontSize: 14, color: Colors.black87), + // ), + // ], + // ), + // ), + // ], + // ), ], ), ); } + // Widget _buildCheckListSection() { + // return Column( + // children: [ + // Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: const [ + // Text(' 待办清单', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold)), + // SizedBox(), + // ], + // ), + // const SizedBox(height: 8), + // Container( + // decoration: BoxDecoration( + // color: Colors.white, + // borderRadius: BorderRadius.circular(12), + // boxShadow: const [BoxShadow(color: Colors.black12, blurRadius: 6, offset: Offset(0, 2))], + // ), + // child: Column(children: [...checkLists.map((item) => _buildCheckListItem(item))]), + // ), + // ], + // ); + // } + Widget _buildCheckListSection() { - return Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: const [ - Text(' 待办清单', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold)), - SizedBox(), - ], - ), - const SizedBox(height: 8), - Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(12), - boxShadow: const [BoxShadow(color: Colors.black12, blurRadius: 6, offset: Offset(0, 2))], - ), - child: Column(children: [...checkLists.map((item) => _buildCheckListItem(item))]), - ), - ], + return Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12), + boxShadow: const [ + BoxShadow(color: Colors.black12, blurRadius: 6, offset: Offset(0, 2)), + ], + ), + child: Column( + children: checkLists.map((item) => _buildCheckListItem(item)).toList(), + ), ); } Widget _buildCheckListItem(Map item) { - return Container( - padding: const EdgeInsets.all(15), - decoration: BoxDecoration( - border: Border(bottom: BorderSide(color: Colors.grey[200]!, width: 1)), - ), - child: Row( - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Flexible( - child: Text( + return GestureDetector( + onTap: () async { + if(pcType==2){ + return; + } + // if(item['appName']=="隐患治理"||item['appName']=="隐患管理"||item['appName']=="风险管控应用"){ + // await pushPage(ApplicationPageTwo(), context); + // }else if(item['appName']=="消防检查"){ + // await pushPage(FireManagementTabPage(), context); + // }else{ + // await pushPage(SafecheckTabList(), context); + // } + _getToDoWorkList(pcType); + // _getHiddenIssuesNum(); + + }, + child: Container( + padding: const EdgeInsets.all(15), + decoration: + BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey[200]!, width: 1))), + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( item['title'], style: const TextStyle(fontSize: 15, fontWeight: FontWeight.bold, color: Colors.black87), - overflow: TextOverflow.ellipsis, - maxLines: 1, ), - ), - const SizedBox(width: 8), - Text(item['type'], style: TextStyle(fontSize: 12, color: Colors.grey[500])), - ], - ), - const SizedBox(height: 8), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Flexible( - child: Container( - padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), - decoration: BoxDecoration( - color: Colors.grey[100], - borderRadius: BorderRadius.circular(4), - ), - child: Text( - "类型:${item['type']}", - style: const TextStyle(fontSize: 12, color: Colors.blue), - overflow: TextOverflow.ellipsis, - ), + Text(item['content'], style: TextStyle(fontSize: 12, color: Colors.grey[500])), + ], + ), + const Divider(), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Image.asset('assets/images/mine1.png', width: 15, height: 15), + Container( + padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), + decoration: BoxDecoration(color: Colors.grey[100], borderRadius: BorderRadius.circular(4)), + child: Text("类型:${item['appName']}", style: const TextStyle(fontSize: 12, color: Colors.blue)), + ), + ], ), - ), - const SizedBox(width: 8), - Flexible( - child: Text( - "时间:${item['time']}", - style: const TextStyle(fontSize: 12, color: Colors.grey), - overflow: TextOverflow.ellipsis, - ), - ), - ], - ), - ], + Text("时间:${item['createTime']}", style: const TextStyle(fontSize: 12, color: Colors.grey)), + ], + ), + ], + ), ), - ), - ], + ], + ), ), ); } + + + // 获取待办事项 + void _getToDoWorkList(int type) async { + Map data = { + "eqAppFlag": type==1?"1":"", + "eqPcFlag": type==1?"":"1", + "eqStatus": "1", + "pageIndex": '1', + "pageSize": '999', + }; + final result = await TodoApi.getTodoList(data); + if (result['success']) { + setState(() { + workStats['total'] =result['totalCount'] ; + checkLists=result['data']; + // checkLists = result['data']; + int m= checkLists.length; + }); + } + } + + } \ No newline at end of file