system-copyright-react/src/route/proj/edit/ProjConfigModListShow.tsx

151 lines
4.6 KiB
TypeScript
Raw Normal View History

2024-03-26 11:54:30 +08:00
import './proj-config-list-mod.css';
import {
Alert,
2024-05-28 18:00:42 +08:00
Button,
2024-03-26 11:54:30 +08:00
message,
2024-05-28 18:00:42 +08:00
Table, TableProps, Modal
2024-03-26 11:54:30 +08:00
} from "antd";
2024-05-28 18:00:42 +08:00
import { useParams } from "react-router-dom";
import { useEffect, useState } from "react";
import { SearchOutlined } from "@ant-design/icons";
import { get } from "../../../util/AjaxUtils.ts";
import ConfigModShow from '../../proj/edit/ProjConfigModShow.tsx'
2024-03-26 11:54:30 +08:00
interface DataType {
projModId: string;
projId: string;
modContext: string;
modName: string;
modUrl: string;
modDesc: string;
modIcon: string;
}
2024-05-28 18:00:42 +08:00
export default function ProjConfigModListShow(props:any) {
const [projModId, setprojModId] = useState('')
const [configModShow, setConfigModShow] = useState(false)
// const nav = useNavigate();
2024-03-26 11:54:30 +08:00
const pathParams = useParams();
2024-05-28 18:00:42 +08:00
const [projId] = useState(pathParams.projId ? pathParams.projId : props.projId)
2024-03-26 11:54:30 +08:00
const [messageApi, contextHolder] = message.useMessage();
const [dataArray, setDataArray] = useState<DataType[]>();
2024-05-28 18:00:42 +08:00
const height = window.innerHeight - 210;
2024-03-26 11:54:30 +08:00
const renderData = () => {
2024-04-01 20:39:22 +08:00
get<DataType[]>({
2024-03-26 11:54:30 +08:00
messageApi,
url: '/api/proj-mod/list',
config: {
params: {
2024-05-28 18:00:42 +08:00
projId: projId
2024-03-26 11:54:30 +08:00
}
},
2024-05-28 18:00:42 +08:00
onSuccess({ data }) {
2024-03-26 11:54:30 +08:00
setDataArray([...data]);
}
})
}
const columns: TableProps<DataType>['columns'] = [
{
title: '菜单标题',
dataIndex: 'modName',
align: 'center',
width: 180
},
{
title: '菜单说明',
dataIndex: 'modDesc',
align: 'center',
},
{
title: '图标',
dataIndex: 'modIcon',
align: 'center',
width: 80,
render: (_text) => {
return <i className={_text}> </i>
}
},
{
title: '菜单地址',
dataIndex: 'menuUrl',
align: 'center',
},
{
title: '创建时间',
dataIndex: 'gmtCreate',
align: 'center',
width: 180
},
{
title: '操作',
dataIndex: 'option',
align: 'center',
width: 100,
render: (_text, record) => {
return (
<>
<Button type="default" size="small"
2024-05-28 18:00:42 +08:00
style={{ marginRight: '5px' }}
onClick={() => {
setprojModId(record.projModId)
// lyp
// nav(`/proj-edit/config-mod-show/${pathParams.projId}/${record.projModId}`)
setConfigModShow(true);
}}>
<SearchOutlined />
2024-03-26 11:54:30 +08:00
</Button>
</>
)
}
},
];
useEffect(() => {
renderData();
}, [])
return (
<>
{contextHolder}
2024-05-21 15:24:48 +08:00
{/* <Breadcrumb
2024-03-26 11:54:30 +08:00
items={[
{title: <Link to={'/'}></Link>},
{title: <Link to={'/proj-create'}></Link>},
2024-04-12 18:18:14 +08:00
{title: <a onClick={() => {nav(-1)}}></a>},
2024-03-26 11:54:30 +08:00
{title: '系统菜单查看'},
]}
2024-05-21 15:24:48 +08:00
/> */}
2024-05-28 18:00:42 +08:00
<div className="mod-list-container" style={{ height: `${height}px`, marginTop: '17px', overflow: 'auto' }}>
<Alert message="菜单指的是系统的功能最少10个菜单最多15个菜单" type="info" />
<div className="mod-list" style={{ marginTop: '15px' }}>
<Table columns={columns} dataSource={dataArray} pagination={{ pageSize: 20 }}
scroll={{ y: height - 210 }} size="middle" bordered key="dataTable" rowKey="projModId" />
2024-03-26 11:54:30 +08:00
</div>
</div>
2024-05-28 18:00:42 +08:00
<Modal open={configModShow}
title="查看"
width={1500}
onCancel={() => {
// setprojModId('')
// console.log(projModId);
setConfigModShow(false);
}}
footer={null}
>
<ConfigModShow
key={projModId}
// closeModal={() => { setConfigModShow(false)
// renderData()
// }}
projModId={projModId} ></ConfigModShow>
</Modal>
2024-03-26 11:54:30 +08:00
</>
)
}