diff --git a/src/pages/OutRoadMgm/OutSegmentMgm/OutSegment/ConfigParking/ChannelManagement.jsx b/src/pages/OutRoadMgm/OutSegmentMgm/OutSegment/ConfigParking/ChannelManagement.jsx index 7ae8b9d..13f5dbe 100644 --- a/src/pages/OutRoadMgm/OutSegmentMgm/OutSegment/ConfigParking/ChannelManagement.jsx +++ b/src/pages/OutRoadMgm/OutSegmentMgm/OutSegment/ConfigParking/ChannelManagement.jsx @@ -1,29 +1,40 @@ -import React from "react"; -import { Input, Form, Button, Table, Row, Col } from "antd"; -function ChannelManagement() { +import React, { useEffect, useState } from "react"; +import { Input, Form, Button, Table, Row, Col, Pagination } from "antd"; +import ajax from "@/services"; +import { dictionary, utils } from "@/config/common"; +function ChannelManagement(props) { + const { id } = props + const [dataSource, setDataSource] = useState([]) + const [pageData, setPageData] = useState({ + pn: 1, + page_size: dictionary?.pageSizeOptions1[0], + }) + const [total, setTotal] = useState(0) + const [form] = Form.useForm() const columns = [ { title: "序号", dataIndex: "id", key: "id", align: "center", + render: (text, record, index) => index + 1, }, { title: "通道名称", - dataIndex: "channelName", - key: "channelName", + dataIndex: "name", + key: "name", align: "center", }, { title: "通道编码", - dataIndex: "channelCode", - key: "channelCode", + dataIndex: "code", + key: "code", align: "center", }, { title: "出入口类型", - dataIndex: "entryType", - key: "entryType", + dataIndex: "type_name", + key: "type_name", align: "center", }, { @@ -33,27 +44,91 @@ function ChannelManagement() { align: "center", }, ]; + const getChannelTable = (pageData) => { + ajax + .getChannelTable({ ...pageData, road_id: id, }) + .then((res) => { + if (res.status === 20000) { + setDataSource(res.data.list) + setTotal(res.data.total) + } else { + message.warning(res.message) + } + }) + .catch((err) => { + console.error(err); + }); + } + //分页 + function onShowSizeChange(pn, page_size) { + let temFormData = {}; + if (pageData.page_size == page_size) { + temFormData = { + ...pageData, + pn, + }; + } else { + temFormData = { + ...pageData, + pn: 1, + page_size, + }; + } + setPageData(temFormData); + getChannelTable(temFormData) + } + const onFinish = (value) => { + setPageData({ + pn: 1, + page_size: dictionary?.pageSizeOptions1[0], + }) + getChannelTable({ + ...value, + pn: 1, + page_size: dictionary?.pageSizeOptions1[0], + }) + } + useEffect(() => { + getChannelTable() + }, []) return ( -