|
|
@ -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 ( |
|
|
|
<div> |
|
|
|
<div className="channel-page-modal"> |
|
|
|
<header style={{ margin: "10px 0" }}> |
|
|
|
<Form> |
|
|
|
<Form |
|
|
|
form={form} |
|
|
|
onFinish={onFinish} |
|
|
|
> |
|
|
|
<Row> |
|
|
|
<Col span="4_8" style={{ width: "30%" }}> |
|
|
|
<Form.Item label="通信名称"> |
|
|
|
<Form.Item label="通信名称" name="name"> |
|
|
|
<Input /> |
|
|
|
</Form.Item> |
|
|
|
</Col> |
|
|
|
<Form.Item> |
|
|
|
<Button type="primary">查询</Button> |
|
|
|
<Form.Item className="submitBtn"> |
|
|
|
<Button type="primary" className="submit" htmlType="submit">查询</Button> |
|
|
|
</Form.Item> |
|
|
|
</Row> |
|
|
|
</Form> |
|
|
|
</header> |
|
|
|
<main> |
|
|
|
<Table |
|
|
|
columns={columns} |
|
|
|
// className="yisa-table" |
|
|
|
></Table> |
|
|
|
<Table |
|
|
|
columns={columns} |
|
|
|
// className="yisa-table" |
|
|
|
dataSource={dataSource} |
|
|
|
pagination={false} |
|
|
|
></Table> |
|
|
|
<Pagination |
|
|
|
className="pagination-common" |
|
|
|
showSizeChanger={true} |
|
|
|
showQuickJumper={true} |
|
|
|
// showTotal={() => `共 ${total_records} 条`} |
|
|
|
total={total} |
|
|
|
current={pageData.pn} |
|
|
|
pageSize={pageData.page_size} |
|
|
|
pageSizeOptions={dictionary?.pageSizeOptions1} |
|
|
|
onChange={onShowSizeChange} |
|
|
|
onShowSizeChange={onShowSizeChange} |
|
|
|
/> |
|
|
|
</main> |
|
|
|
</div> |
|
|
|
); |
|
|
|