车辆违规管理、车辆黑名单管理

master
LiuJiaNan 2026-03-12 10:33:04 +08:00
parent b137834fba
commit d8af77fa14
7 changed files with 165 additions and 90 deletions

View File

@ -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.4"
"zy-react-library": "^1.2.5"
},
"devDependencies": {
"@antfu/eslint-config": "^5.4.1",

View File

@ -2,17 +2,17 @@ import { declareRequest } from "@cqsjjb/jjb-dva-runtime";
export const vehicleBlacklistList = declareRequest(
"vehicleBlacklistLoading",
`Post > @/primeport/`,
`Post > @/primeport/vehicleBlack/list`,
);
export const vehicleBlacklistAdd = declareRequest(
"vehicleBlacklistLoading",
`Post > @/primeport/`,
`Post > @/primeport/vehicleBlack/save`,
);
export const vehicleBlacklistDelete = declareRequest(
"vehicleBlacklistLoading",
`Post > @/primeport/`,
`Delete > @/primeport/vehicleBlack/{id}`,
);
export const vehicleBlacklistInfo = declareRequest(
"vehicleBlacklistLoading",
`Post > @/primeport/`,
`Get > /primeport/vehicleBlack/{id}`,
);

View File

@ -2,21 +2,21 @@ import { declareRequest } from "@cqsjjb/jjb-dva-runtime";
export const vehiclesViolationList = declareRequest(
"vehiclesViolationLoading",
`Post > @/primeport/`,
`Post > @/primeport/vehicleViolations/list`,
);
export const vehiclesViolationAdd = declareRequest(
"vehiclesViolationLoading",
`Post > @/primeport/`,
`Post > @/primeport/vehicleViolations/save`,
);
export const vehiclesViolationViolationRecordsList = declareRequest(
"vehiclesViolationLoading",
`Post > @/primeport/`,
`Post > @/primeport/vehicleViolations/detailsRecordList`,
);
export const vehiclesViolationViolationRecordsDelete = declareRequest(
"vehiclesViolationLoading",
`Post > @/primeport/`,
`Delete > @/primeport/vehicleViolations/{id}`,
);
export const vehiclesViolationViolationRecordsInfo = declareRequest(
"vehiclesViolationLoading",
`Post > @/primeport/`,
`Get > /primeport/vehicleViolations/{id}`,
);

View File

@ -1,6 +1,6 @@
import useUrlState from "@ahooksjs/use-url-state";
import { Connect } from "@cqsjjb/jjb-dva-runtime";
import { Button, Descriptions, Form, message, Modal, Space, Tabs } from "antd";
import { Button, Descriptions, message, Modal, Space, Tabs } from "antd";
import { useEffect, useState } from "react";
import FormBuilder from "zy-react-library/components/FormBuilder";
import AddIcon from "zy-react-library/components/Icon/AddIcon";
@ -10,6 +10,8 @@ import Search from "zy-react-library/components/Search";
import DictionarySelect from "zy-react-library/components/Select/Dictionary";
import DepartmentSelectTree from "zy-react-library/components/SelectTree/Department/Gwj";
import Table from "zy-react-library/components/Table";
import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj";
import useGetFile from "zy-react-library/hooks/useGetFile";
import useTable from "zy-react-library/hooks/useTable";
import { LICENSE_PLATE_NUMBER } from "zy-react-library/regular";
import { NS_VEHICLE_BLACKLIST } from "~/enumerate/namespace";
@ -25,7 +27,7 @@ function List(props) {
const [viewModalVisible, setViewModalVisible] = useState(false);
const [currentId, setCurrentId] = useState("");
const [form] = Form.useForm();
const [form] = Search.useForm();
const [urlState, setUrlState] = useUrlState({
platform: props.platform || TABS_ENUM[0].key,
}, {
@ -39,7 +41,7 @@ function List(props) {
const onDelete = (record) => {
Modal.confirm({
title: "移除确认",
content: `确定要将车牌号 ${record.todo1} 从黑名单中移除吗?`,
content: `确定要将车牌号 ${record.licenceNo} 从黑名单中移除吗?`,
onOk: async () => {
const { success } = await props["vehicleBlacklistDelete"]({ id: record.id });
if (success) {
@ -55,13 +57,13 @@ function List(props) {
<Search
options={[
{
name: "todo2",
name: "vehicleDepartmentId",
label: "车辆所属部门",
render: (<DepartmentSelectTree searchType="inType" params={{ enterpriseType: [+urlState.platform] }} />),
},
{ name: "todo3", label: "车辆所属人" },
{ name: "todo4", label: "车牌号" },
{ name: "todo5", label: "车辆类型", render: (<DictionarySelect dictValue="VEHICLE_TYPE" />) },
{ name: "employeeVehicleUserName", label: "车辆所属人" },
{ name: "licenceNo", label: "车牌号" },
{ name: "vehicleType", label: "车辆类型", render: (<DictionarySelect dictValue="VEHICLE_TYPE" />) },
]}
form={form}
onFinish={getData}
@ -74,7 +76,7 @@ function List(props) {
items={TABS_ENUM}
onChange={(event) => {
setUrlState({ platform: event });
form.setFieldValue("todo2", "");
form.setFieldValue("vehicleDepartmentId", "");
getData();
}}
/>
@ -92,12 +94,12 @@ function List(props) {
</Button>
)}
columns={[
{ title: "车辆所属单位", dataIndex: "todo1" },
{ title: "车辆所属部门", dataIndex: "todo2" },
{ title: "车辆归属人", dataIndex: "todo3" },
{ title: "车牌号", dataIndex: "todo4" },
{ title: "车牌类型", dataIndex: "todo5" },
{ title: "车辆类型", dataIndex: "todo6" },
{ title: "车辆所属单位", dataIndex: "vehicleCorpName" },
{ title: "车辆所属部门", dataIndex: "vehicleDepartmentName" },
{ title: "车辆归属人", dataIndex: "employeeVehicleUserName" },
{ title: "车牌号", dataIndex: "licenceNo" },
{ title: "车牌类型", dataIndex: "licenceTypeName" },
{ title: "车辆类型", dataIndex: "vehicleTypeName" },
{
title: "操作",
width: 120,
@ -153,7 +155,7 @@ function List(props) {
}
const AddModalComponent = (props) => {
const [form] = Form.useForm();
const [form] = FormBuilder.useForm();
const onSubmit = async (values) => {
const { success } = await props["vehicleBlacklistAdd"]({ ...values });
@ -182,9 +184,29 @@ const AddModalComponent = (props) => {
labelCol={{ span: 8 }}
onFinish={onSubmit}
options={[
{ name: "todo2", label: "车牌号", rules: [{ pattern: LICENSE_PLATE_NUMBER, message: "请输入正确的车牌号" }] },
{ name: "todo1", label: "车牌类型", render: (<DictionarySelect dictValue="LICENSE_PLATE_TYPE" />) },
{ name: "todo3", label: "车辆类型", render: (<DictionarySelect dictValue="VEHICLE_TYPE" />) },
{ name: "licenceNo", label: "车牌号", rules: [{ pattern: LICENSE_PLATE_NUMBER, message: "请输入正确的车牌号" }] },
{
name: "licenceType",
label: "车牌类型",
render: (
<DictionarySelect
dictValue="LICENSE_PLATE_TYPE"
onGetLabel={label => form.setFieldValue("licenceTypeName", label)}
/>
),
},
{ name: "licenceTypeName", label: "车牌类型名称", onlyForLabel: true },
{
name: "vehicleType",
label: "车辆类型",
render: (
<DictionarySelect
dictValue="VEHICLE_TYPE"
onGetLabel={label => form.setFieldValue("vehicleTypeName", label)}
/>
),
},
{ name: "vehicleTypeName", label: "车辆类型名称", onlyForLabel: true },
]}
/>
</Modal>
@ -194,9 +216,17 @@ const AddModalComponent = (props) => {
const ViewModalComponent = (props) => {
const [info, setInfo] = useState({});
const { loading: getFileLoading, getFile } = useGetFile();
const getData = async () => {
const { data } = await props["vehicleBlacklistInfo"]({ id: props.id });
setInfo(data);
const drivingLicenseFile = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM[601], eqForeignKey: data.drivingLicenseId });
const attachmentFile = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM[602], eqForeignKey: data.attachmentId });
setInfo({
...data,
drivingLicenseFile,
attachmentFile,
});
};
useEffect(() => {
@ -213,22 +243,22 @@ const ViewModalComponent = (props) => {
footer={[
<Button key="cancel" onClick={props.onCancel}>取消</Button>,
]}
loading={props.vehicleBlacklist.vehicleBlacklistLoading}
loading={props.vehicleBlacklist.vehicleBlacklistLoading || getFileLoading}
>
<Descriptions
bordered
column={1}
styles={{ label: { width: 200 } }}
items={[
{ label: "车辆所属企业", children: info.todo1 },
{ label: "车辆所属部门", children: info.todo2 },
{ label: "车辆所属人", children: info.todo3 },
{ label: "车牌号", children: info.todo4 },
{ label: "车牌类型", children: info.todo5 },
{ label: "车辆类型", children: info.todo6 },
{ label: "访问港区范围", children: info.todo7 },
{ label: "车辆照片", children: (<PreviewImg files={info.todo8} />) },
{ label: "行驶证照片", children: (<PreviewImg files={info.todo9} />) },
{ label: "车辆所属企业", children: info.vehicleCorpName },
{ label: "车辆所属部门", children: info.vehicleDepartmentName },
{ label: "车辆所属人", children: info.employeeVehicleUserName },
{ label: "车牌号", children: info.licenceNo },
{ label: "车牌类型", children: info.licenceTypeName },
{ label: "车辆类型", children: info.vehicleTypeName },
{ label: "访问港区范围", children: JSON.parse(info.gateLevelAuthArea)?.area?.map(item => item.value)?.join("、") },
{ label: "车辆照片", children: (<PreviewImg files={info.attachmentFile} />) },
{ label: "行驶证照片", children: (<PreviewImg files={info.drivingLicenseFile} />) },
]}
/>
</Modal>

View File

@ -1,6 +1,6 @@
import useUrlState from "@ahooksjs/use-url-state";
import { Connect } from "@cqsjjb/jjb-dva-runtime";
import { Button, Form, message, Modal, Tabs } from "antd";
import { Button, message, Modal, Tabs } from "antd";
import { useState } from "react";
import FormBuilder from "zy-react-library/components/FormBuilder";
import AddIcon from "zy-react-library/components/Icon/AddIcon";
@ -11,7 +11,9 @@ import DepartmentSelectTree from "zy-react-library/components/SelectTree/Departm
import Table from "zy-react-library/components/Table";
import Upload from "zy-react-library/components/Upload";
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj";
import useTable from "zy-react-library/hooks/useTable";
import useUploadFile from "zy-react-library/hooks/useUploadFile";
import { LICENSE_PLATE_NUMBER } from "zy-react-library/regular";
import { NS_VEHICLES_VIOLATION } from "~/enumerate/namespace";
@ -24,7 +26,7 @@ const TABS_ENUM = [
function List(props) {
const [addModalVisible, setAddModalVisible] = useState(false);
const [form] = Form.useForm();
const [form] = Search.useForm();
const [urlState, setUrlState] = useUrlState({
platform: props.platform || TABS_ENUM[0].key,
}, {
@ -40,13 +42,13 @@ function List(props) {
<Search
options={[
{
name: "todo2",
name: "vehicleDepartmentId",
label: "车辆所属部门",
render: (<DepartmentSelectTree searchType="inType" params={{ enterpriseType: [+urlState.platform] }} />),
},
{ name: "todo3", label: "车辆所属人" },
{ name: "todo4", label: "车牌号" },
{ name: "todo5", label: "车辆类型", render: (<DictionarySelect dictValue="VEHICLE_TYPE" />) },
{ name: "employeeVehicleUserName", label: "车辆所属人" },
{ name: "licenceNo", label: "车牌号" },
{ name: "vehicleType", label: "车辆类型", render: (<DictionarySelect dictValue="VEHICLE_TYPE" />) },
]}
form={form}
onFinish={getData}
@ -59,7 +61,7 @@ function List(props) {
items={TABS_ENUM}
onChange={(event) => {
setUrlState({ platform: event });
form.setFieldValue("todo2", "");
form.setFieldValue("vehicleDepartmentId", "");
getData();
}}
/>
@ -77,13 +79,13 @@ function List(props) {
</Button>
)}
columns={[
{ title: "车辆所属单位", dataIndex: "todo1" },
{ title: "车辆所属部门", dataIndex: "todo2" },
{ title: "车辆归属人", dataIndex: "todo3" },
{ title: "车牌号", dataIndex: "todo4" },
{ title: "车牌类型", dataIndex: "todo5" },
{ title: "车辆类型", dataIndex: "todo6" },
{ title: "违规次数", dataIndex: "todo7" },
{ title: "车辆所属单位", dataIndex: "vehicleCorpName" },
{ title: "车辆所属部门", dataIndex: "vehicleDepartmentName" },
{ title: "车辆归属人", dataIndex: "employeeVehicleUserName" },
{ title: "车牌号", dataIndex: "licenceNo" },
{ title: "车牌类型", dataIndex: "licenceTypeName" },
{ title: "车辆类型", dataIndex: "vehicleTypeName" },
{ title: "违规次数", dataIndex: "violationCount" },
{
title: "操作",
width: 120,
@ -117,10 +119,16 @@ function List(props) {
}
const AddModalComponent = (props) => {
const [form] = Form.useForm();
const [form] = FormBuilder.useForm();
const { loading: uploadFileLoading, uploadFile } = useUploadFile();
const onSubmit = async (values) => {
const { success } = await props["vehiclesViolationAdd"]({ ...values });
const { id: illegalImagesId } = await uploadFile({
single: false,
files: values.illegalImages,
params: { foreignKey: "", type: UPLOAD_FILE_TYPE_ENUM[607] },
});
const { success } = await props["vehiclesViolationAdd"]({ ...values, illegalImagesId });
if (success) {
message.success("操作成功");
props.onCancel();
@ -136,29 +144,59 @@ const AddModalComponent = (props) => {
maskClosable={false}
onCancel={props.onCancel}
onOk={form.submit}
confirmLoading={props.vehiclesViolation.vehiclesViolationLoading}
confirmLoading={props.vehiclesViolation.vehiclesViolationLoading || uploadFileLoading}
>
<FormBuilder
loading={props.vehiclesViolation.vehiclesViolationLoading}
loading={props.vehiclesViolation.vehiclesViolationLoading || uploadFileLoading}
form={form}
showActionButtons={false}
span={24}
labelCol={{ span: 8 }}
onFinish={onSubmit}
options={[
{ name: "todo2", label: "车牌号", rules: [{ pattern: LICENSE_PLATE_NUMBER, message: "请输入正确的车牌号" }] },
{ name: "todo1", label: "车牌类型", render: (<DictionarySelect dictValue="LICENSE_PLATE_TYPE" />) },
{ name: "todo3", label: "车辆类型", render: (<DictionarySelect dictValue="VEHICLE_TYPE" />) },
{ name: "todo4", label: "违规时间", render: FORM_ITEM_RENDER_ENUM.DATETIME },
{ name: "todo5", label: "违规类型", render: (<DictionarySelect dictValue="VEHICLE_VIOLATION_TYPE" />) },
{ name: "licenceNo", label: "车牌号", rules: [{ pattern: LICENSE_PLATE_NUMBER, message: "请输入正确的车牌号" }] },
{
name: "todo6",
name: "licenceType",
label: "车牌类型",
render: (
<DictionarySelect
dictValue="LICENSE_PLATE_TYPE"
onGetLabel={label => form.setFieldValue("licenceTypeName", label)}
/>
),
},
{ name: "licenceTypeName", label: "车牌类型名称", onlyForLabel: true },
{
name: "vehicleType",
label: "车辆类型",
render: (
<DictionarySelect
dictValue="VEHICLE_TYPE"
onGetLabel={label => form.setFieldValue("vehicleTypeName", label)}
/>
),
},
{ name: "vehicleTypeName", label: "车辆类型名称", onlyForLabel: true },
{ name: "violationtime", label: "违规时间", render: FORM_ITEM_RENDER_ENUM.DATETIME },
{
name: "violationType",
label: "违规类型",
render: (
<DictionarySelect
dictValue="VEHICLE_VIOLATION_TYPE"
onGetLabel={label => form.setFieldValue("violationTypeName", label)}
/>
),
},
{ name: "violationTypeName", label: "违规类型名称", onlyForLabel: true },
{
name: "location",
label: "违规区域",
render: FORM_ITEM_RENDER_ENUM.TEXTAREA,
placeholder: "违规区域需明确车辆在港口内的具体违规位置如某一口门附近、某一码头区域、某一仓库通道等..",
},
{ name: "todo7", label: "违规照片", render: (<Upload />) },
{ name: "todo8", label: " 违规说明", render: FORM_ITEM_RENDER_ENUM.TEXTAREA, required: false },
{ name: "illegalImages", label: "违规照片", render: (<Upload />) },
{ name: "describeMessage", label: " 违规说明", render: FORM_ITEM_RENDER_ENUM.TEXTAREA, required: false },
]}
/>
</Modal>

View File

@ -1,11 +1,13 @@
import { Connect } from "@cqsjjb/jjb-dva-runtime";
import { Button, Descriptions, Form, message, Modal, Space } from "antd";
import { Button, Descriptions, message, Modal, Space } from "antd";
import { useEffect, useState } from "react";
import Page from "zy-react-library/components/Page";
import PreviewImg from "zy-react-library/components/PreviewImg";
import Search from "zy-react-library/components/Search";
import DictionarySelect from "zy-react-library/components/Select/Dictionary";
import Table from "zy-react-library/components/Table";
import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj";
import useGetFile from "zy-react-library/hooks/useGetFile";
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
import useTable from "zy-react-library/hooks/useTable";
import { NS_VEHICLES_VIOLATION } from "~/enumerate/namespace";
@ -15,10 +17,10 @@ function ViolationRecords(props) {
const [currentId, setCurrentId] = useState("");
const query = useGetUrlQuery();
const [form] = Form.useForm();
const [form] = Search.useForm();
const { tableProps, getData } = useTable(props["vehiclesViolationViolationRecordsList"], {
form,
params: { id: query.id },
params: { vehicleId: query.id },
});
const onDelete = (id) => {
@ -39,7 +41,7 @@ function ViolationRecords(props) {
<Page headerTitle="违规记录">
<Search
options={[
{ name: "todo5", label: "违规类型", render: (<DictionarySelect dictValue="VEHICLE_VIOLATION_TYPE" />) },
{ name: "violationType", label: "违规类型", render: (<DictionarySelect dictValue="VEHICLE_VIOLATION_TYPE" />) },
]}
labelCol={{ span: 4 }}
form={form}
@ -47,11 +49,11 @@ function ViolationRecords(props) {
/>
<Table
columns={[
{ title: "车牌号", dataIndex: "todo1" },
{ title: "违规类型", dataIndex: "todo2" },
{ title: "违规区域", dataIndex: "todo3" },
{ title: "违规时间", dataIndex: "todo4" },
{ title: "违规说明", dataIndex: "todo5" },
{ title: "车牌号", dataIndex: "licenceNo" },
{ title: "违规类型", dataIndex: "violationTypeName" },
{ title: "违规区域", dataIndex: "location" },
{ title: "违规时间", dataIndex: "violationtime" },
{ title: "违规说明", dataIndex: "describeMessage" },
{
title: "操作",
width: 200,
@ -99,9 +101,15 @@ function ViolationRecords(props) {
const InfoModalComponent = (props) => {
const [info, setInfo] = useState({});
const { loading: getFileLoading, getFile } = useGetFile();
const getData = async () => {
const { data } = await props["vehiclesViolationViolationRecordsInfo"]({ id: props.id });
setInfo(data);
const illegalImages = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM[607], eqForeignKey: data.illegalImagesId });
setInfo({
...data,
illegalImages,
});
};
useEffect(() => {
@ -110,7 +118,7 @@ const InfoModalComponent = (props) => {
return (
<Modal
loading={props.vehiclesViolation.vehiclesViolationLoading}
loading={props.vehiclesViolation.vehiclesViolationLoading || getFileLoading}
open
title="查看"
maskClosable={false}
@ -125,15 +133,15 @@ const InfoModalComponent = (props) => {
column={1}
styles={{ label: { width: 200 } }}
items={[
{ label: "车辆所属单位", children: info.todo1 },
{ label: "车辆所属部门", children: info.todo2 },
{ label: "车辆归属人", children: info.todo3 },
{ label: "车牌号", children: info.todo4 },
{ label: "违规类型", children: info.todo5 },
{ label: "违规时间", children: info.todo6 },
{ label: "违规区域", children: info.todo7 },
{ label: "违规照片", children: (<PreviewImg files={info.todo8} />) },
{ label: "违规说明", children: info.todo9 },
{ label: "车辆所属单位", children: info.vehicleCorpName },
{ label: "车辆所属部门", children: info.vehicleDepartmentName },
{ label: "车辆归属人", children: info.employeeVehicleUserName },
{ label: "车牌号", children: info.licenceNo },
{ label: "违规类型", children: info.violationTypeName },
{ label: "违规时间", children: info.violationtime },
{ label: "违规区域", children: info.location },
{ label: "违规照片", children: (<PreviewImg files={info.illegalImages} />) },
{ label: "违规说明", children: info.describeMessage },
]}
/>
</Modal>

View File

@ -248,15 +248,14 @@ const InfoModalComponent = (props) => {
const getData = async () => {
const { data } = await props["vehicleAuditInfo"]({ id: props.id });
const drivingLicenseFile = await getFile({
eqType: UPLOAD_FILE_TYPE_ENUM[601],
eqForeignKey: data.drivingLicenseId,
});
const drivingLicenseFile = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM[601], eqForeignKey: data.drivingLicenseId });
const attachmentFile = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM[602], eqForeignKey: data.attachmentId });
const informSignFile = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM[606], eqForeignKey: data.informSignId });
setInfo({
...data,
drivingLicenseFile,
attachmentFile,
informSignFile,
});
};
@ -284,7 +283,7 @@ const InfoModalComponent = (props) => {
{ label: "审核状态", children: getLabelName({ list: VEHICLE_AUDIT_STATUS_ENUM, status: info.auditStatus }) },
{ label: "车辆照片", children: (<PreviewImg files={info.attachmentFile} />) },
{ label: "车辆行驶证照片", children: (<PreviewImg files={info.drivingLicenseFile} />) },
{ label: "申请人签字", children: (<PreviewImg files={[info.informSignId]} />) }, // todo
{ label: "申请人签字", children: (<PreviewImg files={info.informSignFile} />) },
]}
/>
</div>