From 648f3b759dd2e18046946410697266a2ed259fd0 Mon Sep 17 00:00:00 2001 From: LiuJiaNan <15703339975@163.com> Date: Tue, 24 Mar 2026 17:52:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=81=E9=97=AD=E5=8C=BA=E5=9F=9F=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=EF=BC=9AH5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- router.md | 4 +- src/api/global/index.js | 6 - src/api/mobile/index.js | 13 + src/enumerate/namespace/index.js | 1 + .../PersonnelApplication/Apply/index.js | 555 ++++++++++++++---- .../PersonnelApplication/ApplyList/index.js | 203 ++++--- .../PersonnelApplication/Success/index.js | 2 +- 8 files changed, 561 insertions(+), 225 deletions(-) create mode 100644 src/api/mobile/index.js diff --git a/package.json b/package.json index 182f8dd..d0c2fd0 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-signature-canvas": "^1.1.0-alpha.2", - "zy-react-library": "^1.2.8" + "zy-react-library": "^1.2.9" }, "devDependencies": { "@antfu/eslint-config": "^5.4.1", diff --git a/router.md b/router.md index bd5835e..c3cd03f 100644 --- a/router.md +++ b/router.md @@ -163,7 +163,7 @@ ### H5 端 -- 人员申请/申请 +- 人员申请/申请 ## `/primeport/container/mobile/firstLevelDoor/personnelApplication/apply` -- 人员申请/申请记录 +- 人员申请/申请记录 ## `/primeport/container/mobile/firstLevelDoor/personnelApplication/applyList` diff --git a/src/api/global/index.js b/src/api/global/index.js index 444a64f..cb0ff5c 100644 --- a/src/api/global/index.js +++ b/src/api/global/index.js @@ -1,7 +1 @@ -import { declareRequest } from "@cqsjjb/jjb-dva-runtime"; - export {}; - -export const getDepartmentListTree = declareRequest( - "Post > @/basicInfo/department/listAllTreeByCorpType", -); diff --git a/src/api/mobile/index.js b/src/api/mobile/index.js new file mode 100644 index 0000000..9f18e7d --- /dev/null +++ b/src/api/mobile/index.js @@ -0,0 +1,13 @@ +import { declareRequest } from "@cqsjjb/jjb-dva-runtime"; + +export const getDepartmentListTree = declareRequest( + "Post > @/basicInfo/department/listAllTreeByCorpType", +); +export const temporaryVisitorApplySave = declareRequest( + "temporaryVisitorLoading", + "Post > @/primeport/closedTmpApply/save", +); +export const temporaryVisitorApplyInfo = declareRequest( + "temporaryVisitorLoading", + "Get > /primeport/closedTmpApply/getInfoById", +); diff --git a/src/enumerate/namespace/index.js b/src/enumerate/namespace/index.js index 81a951e..db1fca1 100644 --- a/src/enumerate/namespace/index.js +++ b/src/enumerate/namespace/index.js @@ -29,3 +29,4 @@ export const NS_ENCLOSED_PERSONNEL_AND_VEHICLE_STATISTICS = defineNamespace("enc export const NS_ENCLOSED_ENTERPRISE_PERSONNEL_PERMISSIONS = defineNamespace("enclosedEnterprisePersonnelPermissions"); export const NS_ENCLOSED_TEMPORARY_PERSONNEL_REVIEW = defineNamespace("enclosedTemporaryPersonnelReview"); export const NS_ENCLOSED_TEMPORARY_VEHICLE_REVIEW = defineNamespace("enclosedTemporaryVehicleReview"); +export const NS_MOBILE = defineNamespace("mobile"); diff --git a/src/pages/Container/Mobile/firstLevelDoor/PersonnelApplication/Apply/index.js b/src/pages/Container/Mobile/firstLevelDoor/PersonnelApplication/Apply/index.js index 4010894..c790410 100644 --- a/src/pages/Container/Mobile/firstLevelDoor/PersonnelApplication/Apply/index.js +++ b/src/pages/Container/Mobile/firstLevelDoor/PersonnelApplication/Apply/index.js @@ -4,28 +4,55 @@ import { Cascader, Checkbox, DatePicker, + DotLoading, Form, Image, ImageUploader, Input, + Mask, Picker, Popup, + TextArea, Toast, } from "antd-mobile"; import dayjs from "dayjs"; import { useEffect, useRef, useState } from "react"; +import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj"; import useDictionary from "zy-react-library/hooks/useDictionary"; +import useUploadFile from "zy-react-library/hooks/useUploadFile"; import { ID_NUMBER, LICENSE_PLATE_NUMBER, PHONE } from "zy-react-library/regular"; -import { validatorEndTime } from "zy-react-library/utils"; +import { getLabelName, validatorEndTime } from "zy-react-library/utils"; import SignatureH5 from "~/components/SignatureH5"; -import { NS_GLOBAL } from "~/enumerate/namespace"; +import { + NS_APPROVER_USER, + NS_ENCLOSED_AREA, + NS_FIRST_LEVEL_DOOR_INFO, + NS_MOBILE, +} from "~/enumerate/namespace"; import "../../../index.less"; +export const ACCESS_TYPE_ENUM = [ + { label: "车辆", value: "CAR_APPLY" }, + { label: "人员", value: "PERSON_APPLY" }, +]; +export const APPLICATION_GATE_PERSON_TYPE_ENUM = [ + { label: "一级口门", value: "ONE_LEVEL_PERSON_APPLY" }, + { label: "封闭区域口门", value: "TWO_LEVEL_PERSON_APPLY" }, +]; +export const APPLICATION_GATE_CAR_TYPE_ENUM = [ + { label: "一级口门", value: "ONE_LEVEL_CAR_APPLY" }, + { label: "封闭区域口门", value: "TWO_LEVEL_CAR_APPLY" }, +]; + function Apply(props) { const [primeportAreaList, setPrimeportAreaList] = useState([]); const [vehicleTypeList, setVehicleTypeList] = useState([]); const [licensePlateTypeList, setLicensePlateTypeList] = useState([]); + const [firstLevelDoorInfoListAll, setFirstLevelDoorInfoListAll] = useState([]); + const [twoLevelDoorInfoListAll, setTwoLevelDoorInfoListAll] = useState([]); + const [approvalUserListAll, setApprovalUserListAll] = useState([]); const [departmentList, setDepartmentList] = useState([]); + const [enclosedAreaList, setEnclosedAreaList] = useState([]); const [noticePopupVisible, setNoticePopupVisible] = useState(false); const [signatureUrl, setSignatureUrl] = useState(""); @@ -33,15 +60,16 @@ function Apply(props) { const checkboxRef = useRef(null); const [form] = Form.useForm(); - const accessType = Form.useWatch("accessType", form); - const doorType = Form.useWatch("doorType", form); + const tmpApplyType = Form.useWatch("tmpApplyType", form); + const tmpMkmjType = Form.useWatch("tmpMkmjType", form); const { getDictionary } = useDictionary(); + const { loading: uploadFileLoading, uploadFile } = useUploadFile(); - const transformDepartmentList = (list) => { + const transformTreeList = (list, nameKey, idKey) => { return list.map(item => ({ - label: item.name, - value: item.id, - children: item.childrenList ? transformDepartmentList(item.childrenList) : undefined, + label: item[nameKey], + value: item[idKey], + children: item.childrenList ? transformTreeList(item.childrenList) : undefined, })); }; @@ -52,16 +80,61 @@ function Apply(props) { setVehicleTypeList(vehicleTypeData); const licensePlateTypeData = await getDictionary({ dictValue: "LICENSE_PLATE_TYPE" }); setLicensePlateTypeList(licensePlateTypeData); - const { data: departmentList } = await props["getDepartmentListTree"]({ enterpriseType: [1, 2] }); - const transformedDepartmentList = transformDepartmentList(departmentList); + const { data: approvalUserListAll } = await props["approvalUserListAll"]({ temporaryPermissionFlag: 1 }); + setApprovalUserListAll(approvalUserListAll); + const { data: departmentList } = await props["getDepartmentListTree"]({ enterpriseType: [2] }); + const transformedDepartmentList = transformTreeList(departmentList, "name", "id"); setDepartmentList(transformedDepartmentList); }; + const getFirstLevelDoorInfoListAll = async (gateLevelAuthArea) => { + const { data } = await props["firstLevelDoorInfoListAll"]({ mkmjLevel: 1, hgAuthArea: gateLevelAuthArea }); + setFirstLevelDoorInfoListAll(data); + }; + + const getTwoLevelDoorInfoListAll = async (gateLevelAuthArea) => { + const { data } = await props["firstLevelDoorInfoListAll"]({ mkmjLevel: 2, hgAuthArea: gateLevelAuthArea }); + setTwoLevelDoorInfoListAll(data); + }; + + const getEnclosedAreaList = async (jurisdictionalCorpId) => { + const { data } = await props["enclosedAreaDetailListTree"]({ jurisdictionalCorpId }); + const transformedEnclosedAreaList = transformTreeList(data, "closedAreaName", "id"); + setEnclosedAreaList(transformedEnclosedAreaList); + }; + useEffect(() => { getData(); }, []); - const onFinish = (values) => { + const getTreeLabelName = (treeList, value, idKey = "value", nameKey = "label") => { + if (!treeList || !Array.isArray(treeList) || !value) { + return ""; + } + + let result = ""; + + const findNodeInTree = (tree, targetValue) => { + for (const node of tree) { + if (node[idKey] === targetValue) { + result = node[nameKey]; + return true; + } + if (node.children && node.children.length > 0) { + const found = findNodeInTree(node.children, targetValue); + if (found) { + return true; + } + } + } + return false; + }; + + findNodeInTree(treeList, value); + return result; + }; + + const onFinish = async (values) => { if (!values.safetyNoticeAgreed || !values.signature) { Toast.show({ icon: "fail", @@ -69,19 +142,66 @@ function Apply(props) { }); return; } - if (values.accessType === "1" && values.vehicleLicensePhoto.length !== 2) { + if (values.tmpApplyType === "CAR_APPLY" && values.vehicleLicensePhoto.length !== 2) { Toast.show({ icon: "fail", content: "请上传两张行驶证照片", }); return; } - console.log(values); - props.history.push(`./success?accessType=${values.accessType}&text=${values.accessType === "1" ? values.licensePlateNumber : values.phoneNumber}`); + const tmpMkmjType = values.tmpMkmjType; + const informSignType = { + ONE_LEVEL_PERSON_APPLY: 611, + TWO_LEVEL_PERSON_APPLY: 609, + ONE_LEVEL_CAR_APPLY: 606, + TWO_LEVEL_CAR_APPLY: 610, + }[tmpMkmjType]; + const { id: drivingLicenseId } = await uploadFile({ + single: false, + files: (values.vehicleLicensePhoto || []).map(item => ({ ...item, originFileObj: item.file })), + params: { type: UPLOAD_FILE_TYPE_ENUM[601], foreignKey: "" }, + }); + const { id: attachmentId } = await uploadFile({ + single: false, + files: (values.vehiclePhoto || []).map(item => ({ ...item, originFileObj: item.file })), + params: { type: UPLOAD_FILE_TYPE_ENUM[602], foreignKey: "" }, + }); + const { filePath: userFaceUrl } = await uploadFile({ + files: (values.facePhoto || []).map(item => ({ ...item, originFileObj: item.file })), + params: { type: UPLOAD_FILE_TYPE_ENUM[608], foreignKey: "" }, + }); + const { id: informSignId } = await uploadFile({ + single: false, + files: [{ originFileObj: values.signature }], + params: { type: informSignType, foreignKey: "" }, + }); + const { success, data } = await props["temporaryVisitorApplySave"]({ + ...values, + drivingLicenseId, + attachmentId, + userFaceUrl, + informSignId, + }); + if (success) { + props.history.push(`./success?id=${data.id}&tmpApplyType=${values.tmpApplyType}&tmpMkmjType=${values.tmpMkmjType}`); + } }; return (
+ +
+ +
加载中...
+
+
[value]} > { + form.setFieldValue("tmpMkmjType", ""); + form.setFieldValue("vehicleTypeName", ""); + form.setFieldValue("licenceTypeName", ""); + form.setFieldValue("hgAuthAreaName", ""); + form.setFieldValue("levelOneMkmjName", ""); + form.setFieldValue("auditPersonUserName", ""); + form.setFieldValue("auditPersonCorpId", ""); + form.setFieldValue("auditPersonCorpName", ""); + form.setFieldValue("auditPersonDepartmentId", ""); + form.setFieldValue("auditPersonDepartmentName", ""); + form.setFieldValue("jurisdictionalCorpName", ""); + form.setFieldValue("closedAreaId", ""); + form.setFieldValue("closedAreaName", ""); + form.setFieldValue("levelTwoMkmjId", ""); + form.setFieldValue("levelTwoMkmjName", ""); + setFirstLevelDoorInfoListAll([]); + setEnclosedAreaList([]); + setTwoLevelDoorInfoListAll([]); + }} > {value => value?.[0]?.label || "请选择访问类型"} - { - pickerRef.current?.open(); - }} - getValueFromEvent={value => value[0]} - getValueProps={value => [value]} - > - { + pickerRef.current?.open(); + }} + getValueFromEvent={value => value[0]} + getValueProps={value => [value]} > - {value => value?.[0]?.label || "请选择选择申请口门"} - - + { + form.setFieldValue("vehicleTypeName", ""); + form.setFieldValue("licenceTypeName", ""); + form.setFieldValue("hgAuthAreaName", ""); + form.setFieldValue("levelOneMkmjName", ""); + form.setFieldValue("auditPersonUserName", ""); + form.setFieldValue("auditPersonCorpId", ""); + form.setFieldValue("auditPersonCorpName", ""); + form.setFieldValue("auditPersonDepartmentId", ""); + form.setFieldValue("auditPersonDepartmentName", ""); + form.setFieldValue("jurisdictionalCorpName", ""); + form.setFieldValue("closedAreaId", ""); + form.setFieldValue("closedAreaName", ""); + form.setFieldValue("levelTwoMkmjId", ""); + form.setFieldValue("levelTwoMkmjName", ""); + setFirstLevelDoorInfoListAll([]); + setEnclosedAreaList([]); + setTwoLevelDoorInfoListAll([]); + }} + > + {value => value?.[0]?.label || "请选择选择申请口门"} + + + )} { - accessType === "1" + tmpApplyType === "CAR_APPLY" && ( <> - + @@ -154,12 +309,23 @@ function Apply(props) { > ({ label: item.dictLabel, value: item.dictValue }))]} + onConfirm={(value) => { + form.setFieldValue("vehicleTypeName", getLabelName({ + list: vehicleTypeList, + status: value[0], + idKey: "dictValue", + nameKey: "dictLabel", + })); + }} > {value => value?.[0]?.label || "请选择车辆类型"} + + + ({ label: item.dictLabel, value: item.dictValue }))]} + onConfirm={(value) => { + form.setFieldValue("licenceTypeName", getLabelName({ + list: licensePlateTypeList, + status: value[0], + idKey: "dictValue", + nameKey: "dictLabel", + })); + }} > {value => value?.[0]?.label || "请选择车牌类型"} - + + + + - - + + ({ url: URL.createObjectURL(file), file })} maxCount={2} @@ -192,7 +389,10 @@ function Apply(props) { maxCount={4} /> - + +