保存代码

dev
陈博文 3 years ago
parent 201ad07cd0
commit 008dd0f51c

@ -14,16 +14,22 @@
} }
} }
.box { .btn {
height: 500px; padding: 13px 20px;
margin-top: 20px;
i {
font-size: 14px;
margin-right: 5px;
}
} }
.btn { .action {
border-top: 1px solid #ebf3ff; cursor: pointer;
height: 58px; color: #6b758b;
display: flex; padding: 0 10px;
align-items: center;
padding: 0 20px; &:hover {
color: @primary-color;
}
} }
} }

@ -1,48 +1,150 @@
import styles from './index.less'; import styles from './index.less';
import { import { Button, Select, Row, Modal, Form, message, Empty, Table } from 'antd';
InputNumber,
Input,
Button,
Select,
Row,
Modal,
Form,
message,
Empty,
Spin,
} from 'antd';
import Fetch from '@/utils/fetch'; import Fetch from '@/utils/fetch';
import { useEffect, useState, FC, useRef } from 'react'; import { useEffect, useState, FC, useRef } from 'react';
import { Link } from 'umi';
import { downLoadLink } from '@/utils/download'; import { downLoadLink } from '@/utils/download';
import url from '@/utils/url'; import url from '@/utils/url';
import ReactEcharts from 'echarts-for-react'; import { ColumnsType } from 'antd/lib/table';
interface PageProps {} interface PageProps {}
const Page: FC<PageProps> = () => { const Page: FC<PageProps> = () => {
const [data, setData] = useState<any>([]); const [data, setData] = useState<any>([]);
const [loading, setLoading] = useState<boolean>(true);
const [total, setTotal] = useState<number>(0);
const [params, setParams] = useState<any>({
pageNumber: 1,
pageSize: 20,
});
useEffect(() => { useEffect(() => {
getData(); getData(params);
}, []); }, []);
const getData = async () => { const getData = async (record: any) => {
const res = await Fetch('/openi/secretKey/statistics', { setLoading(true);
const res = await Fetch('/openi/producer/page', {
method: 'get', method: 'get',
params: {}, params: record,
}); });
if (res.result === 'success') { if (res.result === 'success') {
setData(res?.data?.[0]); setData(res?.data?.[0]?.list);
setTotal(res?.data?.[0]?.total);
} }
setLoading(false);
};
const columns: ColumnsType<any> = [
{
title: '序号',
align: 'center',
dataIndex: 'index',
render: (text: string, record: any, index: number) =>
params.pageSize * (params.pageNumber - 1) + index + 1,
},
{
title: '厂商编号',
dataIndex: 'producerNumber',
},
{
title: '生产厂商全名',
dataIndex: 'name',
},
{
title: '生产厂商简称',
dataIndex: 'simpleName',
},
{
title: '生产厂商地址',
dataIndex: 'address',
},
{
title: '联系人1姓名',
dataIndex: 'contacts1',
},
{
title: '联系人1电话',
dataIndex: 'phone1',
},
{
title: '联系人1手机',
dataIndex: 'tel1',
},
{
title: '联系人2姓名',
dataIndex: 'contacts2',
render: (text: string) => text || '--',
},
{
title: '联系人2电话',
dataIndex: 'phone2',
render: (text: string) => text || '--',
},
{
title: '联系人2手机',
dataIndex: 'tel2',
render: (text: string) => text || '--',
},
{
title: '操作',
dataIndex: 'action',
align: 'center',
fixed: 'right',
width: 110,
render: () => (
<span>
<i
title="修改"
className={'iconfont icon-xiugaikucundixian ' + styles.action}
/>
<i
title="删除"
className={'iconfont icon-shanchuzhuangbeixinghao ' + styles.action}
/>
</span>
),
},
];
const handleChangePage = (param: any) => {
params.pageNumber = param?.current;
params.pageSize = param?.pageSize;
setParams({ ...params });
getData(params);
}; };
return ( return (
<div className={styles.page}> <div className={styles.page}>
<div className={styles.title}> <div className={styles.title}>
<span> </span> <span></span>
<i onClick={() => getData()} className="iconfont icon-a-shuaxin2" /> <i
onClick={() => getData(params)}
className="iconfont icon-a-shuaxin2"
/>
</div> </div>
<Row justify="end" className={styles.btn}>
<Button icon={<i className="iconfont icon-tianjia" />}></Button>
{/* <Button icon={<i className='iconfont icon-daorushuju2' />} className='ml10'>导出厂商信息</Button> */}
</Row>
<Table
dataSource={data}
bordered={false}
rowKey="id"
columns={columns}
scroll={{ x: 1800 }}
loading={loading}
className="pr20 pl20"
onChange={handleChangePage}
pagination={{
pageSize: params.per_page,
total: total,
current: params.page,
showQuickJumper: true,
hideOnSinglePage: true,
position: ['bottomCenter'],
// showTotal: total => <span className="mr10">共<span>{total}</span>条数据</span>
}}
/>
</div> </div>
); );
}; };

@ -11,12 +11,12 @@ const Page = ({ ...props }) => {
key: '/register', key: '/register',
}, },
{ {
icon: 'iconfont icon-peifaguanli', icon: 'iconfont icon-xinghaoguanli',
name: '型号管理', name: '型号管理',
key: '/model', key: '/model',
}, },
{ {
icon: 'iconfont icon-suanfacanshuziyuan', icon: 'iconfont icon-peifaguanli',
name: '配发管理', name: '配发管理',
key: '/allotment', key: '/allotment',
}, },

@ -46,7 +46,7 @@ const Page: FC<PageProps> = () => {
const item: any = [ const item: any = [
{ {
icon: 'iconfont icon-yuzhimiyuejiami', icon: 'iconfont icon-yuzhiziyuan',
name: '预制资源', name: '预制资源',
key: '1', key: '1',
}, },

Loading…
Cancel
Save