feat(mkmjPassage): 新增通道名称唯一性校验功能
- 在新增和编辑通道时增加名称重复检查 - 调整通道类型和状态字段为字符串形式 -优化表单项布局与渲染逻辑- 移除不必要的组件引用和冗余代码- 改进地图组件使用方式及位置展示逻辑- 更新列表数据显示格式并增强可读性master
parent
aa6a44789d
commit
b15c8696b7
|
|
@ -23,3 +23,5 @@ export const mkmjPassageBatchDelete = declareRequest(
|
||||||
export const mkmjPassageInfo = declareRequest('mkmjPassageLoading', 'Get > /primeport/mkmjPassage/{id}');
|
export const mkmjPassageInfo = declareRequest('mkmjPassageLoading', 'Get > /primeport/mkmjPassage/{id}');
|
||||||
|
|
||||||
export const getStatistics = declareRequest('mkmjPassageLoading', 'Post > @/primeport/mkmjPassage/statistics');
|
export const getStatistics = declareRequest('mkmjPassageLoading', 'Post > @/primeport/mkmjPassage/statistics');
|
||||||
|
|
||||||
|
export const hasName = declareRequest('mkmjPassageLoading','Get > /primeport/mkmjPassage/hasName/{name}')
|
||||||
|
|
@ -182,8 +182,8 @@ function AddModalComponent(props) {
|
||||||
if (props.currentId) {
|
if (props.currentId) {
|
||||||
props["mkmjAreaInfo"]({id: props.currentId}).then((res) => {
|
props["mkmjAreaInfo"]({id: props.currentId}).then((res) => {
|
||||||
form.setFieldsValue({...res.data,
|
form.setFieldsValue({...res.data,
|
||||||
areaType: Number(res.data.areaType),
|
areaType: res.data.areaType + "",
|
||||||
areaStatus: Number(res.data.areaStatus),
|
areaStatus: res.data.areaStatus + "",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -176,9 +176,9 @@ function AddModalComponent(props) {
|
||||||
if (props.currentId) {
|
if (props.currentId) {
|
||||||
props["mkmjAreaGateInfo"]({id: props.currentId}).then((res) => {
|
props["mkmjAreaGateInfo"]({id: props.currentId}).then((res) => {
|
||||||
form.setFieldsValue({...res.data,
|
form.setFieldsValue({...res.data,
|
||||||
gateType: Number(res.data.gateType),
|
gateType: res.data.gateType + "",
|
||||||
gateStatus: Number(res.data.gateStatus),
|
gateStatus: res.data.gateStatus + "",
|
||||||
gateCategory: Number(res.data.gateCategory),
|
gateCategory: res.data.gateCategory + "",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ import { NS_MKMJGATEVIDEO } from "~/enumerate/namespace";
|
||||||
import AddIcon from "zy-react-library/components/Icon/AddIcon";
|
import AddIcon from "zy-react-library/components/Icon/AddIcon";
|
||||||
import DeleteIcon from "zy-react-library/components/Icon/DeleteIcon";
|
import DeleteIcon from "zy-react-library/components/Icon/DeleteIcon";
|
||||||
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
|
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
|
||||||
import Map from "zy-react-library/components/Map";
|
|
||||||
import HeaderBack from "zy-react-library/components/HeaderBack";
|
import HeaderBack from "zy-react-library/components/HeaderBack";
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import {Connect} from "@cqsjjb/jjb-dva-runtime";
|
import {Connect} from "@cqsjjb/jjb-dva-runtime";
|
||||||
import {Button, Form, message, Modal, Space, Descriptions} from "antd";
|
import {Button, Descriptions, Form, message, Modal, Space} from "antd";
|
||||||
import {useEffect, useState} from "react";
|
import {useEffect, useState} from "react";
|
||||||
import FormBuilder from "zy-react-library/components/FormBuilder";
|
import FormBuilder from "zy-react-library/components/FormBuilder";
|
||||||
import Search from "zy-react-library/components/Search";
|
import Search from "zy-react-library/components/Search";
|
||||||
|
|
@ -9,7 +9,6 @@ import useTable from "zy-react-library/hooks/useTable";
|
||||||
import {NS_MKMJPASSAGE} from "~/enumerate/namespace";
|
import {NS_MKMJPASSAGE} from "~/enumerate/namespace";
|
||||||
import AddIcon from "zy-react-library/components/Icon/AddIcon";
|
import AddIcon from "zy-react-library/components/Icon/AddIcon";
|
||||||
import DeleteIcon from "zy-react-library/components/Icon/DeleteIcon";
|
import DeleteIcon from "zy-react-library/components/Icon/DeleteIcon";
|
||||||
import DictionarySelect from "zy-react-library/components/Select/Dictionary";
|
|
||||||
import Map from "zy-react-library/components/Map";
|
import Map from "zy-react-library/components/Map";
|
||||||
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
|
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
|
||||||
import LocationIcon from "zy-react-library/components/Icon/LocationIcon";
|
import LocationIcon from "zy-react-library/components/Icon/LocationIcon";
|
||||||
|
|
@ -44,7 +43,7 @@ function MkmjPassage(props) {
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
<div style={{padding: 10}}>
|
<div style={{padding: 10}}>
|
||||||
<HeaderBack title={`口门管理`} />
|
<HeaderBack title={`口门管理`}/>
|
||||||
<Search
|
<Search
|
||||||
form={form}
|
form={form}
|
||||||
onFinish={getData}
|
onFinish={getData}
|
||||||
|
|
@ -85,11 +84,21 @@ function MkmjPassage(props) {
|
||||||
)}
|
)}
|
||||||
columns={[
|
columns={[
|
||||||
{dataIndex: "passageName", title: "通道名称"},
|
{dataIndex: "passageName", title: "通道名称"},
|
||||||
{dataIndex: "passageType", title: "通道类型",render: (_, record) => record.passageType === 1 ? "人行通道" : record.passageType === 2 ? "车行通道" : "综合通道"},
|
{
|
||||||
{dataIndex: "passageStatus", title: "通道状态",render: (_, record) => record.passageStatus === 0 ? "停用" : record.passageStatus === 1 ? "正常" : "暂时关闭"},
|
dataIndex: "passageType",
|
||||||
{dataIndex: "gateNum", title: "视频个数",render:(_,record)=>{
|
title: "通道类型",
|
||||||
return record.gateNum || 0;
|
render: (_, record) => record.passageType === 1 ? "人行通道" : record.passageType === 2 ? "车行通道" : "综合通道"
|
||||||
}},
|
},
|
||||||
|
{
|
||||||
|
dataIndex: "passageStatus",
|
||||||
|
title: "通道状态",
|
||||||
|
render: (_, record) => record.passageStatus === 0 ? "停用" : record.passageStatus === 1 ? "正常" : "暂时关闭"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataIndex: "gateNum", title: "视频个数", render: (_, record) => {
|
||||||
|
return record.gateNum || 0;
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: "操作",
|
title: "操作",
|
||||||
align: "center",
|
align: "center",
|
||||||
|
|
@ -170,12 +179,21 @@ function MkmjPassage(props) {
|
||||||
|
|
||||||
function AddModalComponent(props) {
|
function AddModalComponent(props) {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
|
|
||||||
|
const hasName = async (rule, value) => {
|
||||||
|
const {data} = await props["hasName"]({name: value})
|
||||||
|
if (data && data.id !== props.currentId) {
|
||||||
|
return Promise.reject(new Error('通道名已存在'))
|
||||||
|
}
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (props.currentId) {
|
if (props.currentId) {
|
||||||
props["mkmjPassageInfo"]({id: props.currentId}).then((res) => {
|
props["mkmjPassageInfo"]({id: props.currentId}).then((res) => {
|
||||||
form.setFieldsValue({...res.data,
|
form.setFieldsValue({
|
||||||
passageType: Number(res.data.passageType),
|
...res.data,
|
||||||
passageStatus: Number(res.data.passageStatus),
|
passageType: res.data.passageType + "",
|
||||||
|
passageStatus: res.data.passageStatus + "",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -185,7 +203,11 @@ function AddModalComponent(props) {
|
||||||
props.onCancel();
|
props.onCancel();
|
||||||
};
|
};
|
||||||
const submit = async (values) => {
|
const submit = async (values) => {
|
||||||
await props[!props.currentId ? "mkmjPassageAdd" : "mkmjPassageEdit"]({...values, areaId: props.areaId, id: props.currentId});
|
await props[!props.currentId ? "mkmjPassageAdd" : "mkmjPassageEdit"]({
|
||||||
|
...values,
|
||||||
|
areaId: props.areaId,
|
||||||
|
id: props.currentId
|
||||||
|
});
|
||||||
onCancel();
|
onCancel();
|
||||||
props.getData();
|
props.getData();
|
||||||
};
|
};
|
||||||
|
|
@ -199,16 +221,16 @@ function AddModalComponent(props) {
|
||||||
width={800}
|
width={800}
|
||||||
>
|
>
|
||||||
<FormBuilder
|
<FormBuilder
|
||||||
labelCol={{ span: 6 }}
|
labelCol={{span: 6}}
|
||||||
form={form}
|
form={form}
|
||||||
span={24}
|
span={24}
|
||||||
onFinish={submit}
|
onFinish={submit}
|
||||||
showActionButtons={false}
|
showActionButtons={false}
|
||||||
options={[
|
options={[
|
||||||
{name: "passageName", label: "通道名称"},
|
{name: "passageName", label: "通道名称", rules: [{validator: hasName, trigger: 'blur'}]},
|
||||||
{name: "passageType", label: "通道类型",render: FORM_ITEM_RENDER_ENUM.SELECT, items: PASSAGE_TYPE},
|
{name: "passageType", label: "通道类型", render: FORM_ITEM_RENDER_ENUM.SELECT, items: PASSAGE_TYPE},
|
||||||
{name: "passageStatus", label: "通道状态",render: FORM_ITEM_RENDER_ENUM.SELECT, items: PASSAGE_STATUS},
|
{name: "passageStatus", label: "通道状态", render: FORM_ITEM_RENDER_ENUM.SELECT, items: PASSAGE_STATUS},
|
||||||
{key:"map",customizeRender:true,render:<Map/>}
|
{key: "map", customizeRender: true, render: <Map/>}
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
@ -240,15 +262,23 @@ function InfoModalComponent(props) {
|
||||||
bordered
|
bordered
|
||||||
items={[
|
items={[
|
||||||
{children: info.passageName, label: "通道名称"},
|
{children: info.passageName, label: "通道名称"},
|
||||||
{children: info.passageType===1?"人行通道":info.passageType===2?"车行通道":"综合通道", label: "通道类型"},
|
{
|
||||||
{children: info.passageStatus===0?"停用":info.passageStatus===1?"正常":"暂时关闭", label: "通道状态"},
|
children: info.passageType === 1 ? "人行通道" : info.passageType === 2 ? "车行通道" : "综合通道",
|
||||||
{children: <LocationIcon onClick={() => {
|
label: "通道类型"
|
||||||
setMapVisible(true);
|
},
|
||||||
}}/>, label: "位置"},
|
{
|
||||||
|
children: info.passageStatus === 0 ? "停用" : info.passageStatus === 1 ? "正常" : "暂时关闭",
|
||||||
|
label: "通道状态"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
children: <LocationIcon onClick={() => {
|
||||||
|
setMapVisible(true);
|
||||||
|
}}/>, label: "位置"
|
||||||
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<MapSelector
|
<MapSelector
|
||||||
visible={mapVisible}
|
visible={mapVisible}
|
||||||
onClose={() => setMapVisible(false)}
|
onClose={() => setMapVisible(false)}
|
||||||
longitude={info.longitude}
|
longitude={info.longitude}
|
||||||
|
|
|
||||||
|
|
@ -34,10 +34,6 @@ function MkmjPassage(props) {
|
||||||
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
|
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
|
||||||
const [listData, setListData] = useState([]);
|
const [listData, setListData] = useState([]);
|
||||||
|
|
||||||
const getStatistics = async (ids) => {
|
|
||||||
const { data } = await props["getStatistics"]({ ids })
|
|
||||||
setStatistics(data)
|
|
||||||
}
|
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
|
|
||||||
const {tableProps, getData} = useTable(props["mkmjPassageList"], {
|
const {tableProps, getData} = useTable(props["mkmjPassageList"], {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue