|
@@ -1,73 +1,92 @@
|
|
|
-import { useState } from 'react';
|
|
|
+import { useState, Fragment } from 'react';
|
|
|
+import { useRequest } from '@umijs/max';
|
|
|
import styles from './index.less';
|
|
|
-import { Button, Select, Table } from 'antd';
|
|
|
+import { Button, Input, Pagination, Select, Table } from 'antd';
|
|
|
import PageContent from '@/components/PageContent';
|
|
|
-
|
|
|
+import {
|
|
|
+ queryPsrList
|
|
|
+} from '@/services/psr';
|
|
|
+const page_size = 10;
|
|
|
const PSRManage = () => {
|
|
|
const [searchData, setSearchData] = useState({
|
|
|
- project_name: '',
|
|
|
- project_code: '',
|
|
|
+ name: undefined,
|
|
|
+ code: undefined,
|
|
|
+ });
|
|
|
+ const { run, data, loading } = useRequest(queryPsrList, {
|
|
|
+ defaultParams: [{
|
|
|
+ name: undefined,
|
|
|
+ code: undefined,
|
|
|
+ current_page: 1,
|
|
|
+ page_size
|
|
|
+ }],
|
|
|
+ onSuccess: (data) => {
|
|
|
+ console.log(data);
|
|
|
+ setSearchData({ ...searchData, current_page: 1, page_size });
|
|
|
+ },
|
|
|
});
|
|
|
+ console.log(data?.list)
|
|
|
const columns = [
|
|
|
{
|
|
|
title: '项目编号',
|
|
|
- dataIndex: 'code',
|
|
|
- key: 'code',
|
|
|
- render: (text) => <a>{text}</a>,
|
|
|
+ dataIndex: 'project_full_code',
|
|
|
},
|
|
|
{
|
|
|
title: '项目名称',
|
|
|
- dataIndex: 'name',
|
|
|
- key: 'name',
|
|
|
- render: (text) => <a>{text}</a>,
|
|
|
+ dataIndex: 'project_name',
|
|
|
},
|
|
|
{
|
|
|
title: '操作',
|
|
|
- render: (text) => <a>{text}</a>,
|
|
|
+ render: (text, record) => (
|
|
|
+ <Fragment>
|
|
|
+ <>
|
|
|
+ <a
|
|
|
+ style={{ color: '#4096ff' }}
|
|
|
+ onClick={() => {
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 进入
|
|
|
+ </a>
|
|
|
+ </>
|
|
|
+ </Fragment>
|
|
|
+ ),
|
|
|
},
|
|
|
];
|
|
|
const projectData = [];
|
|
|
|
|
|
- const handleSearch = () => {};
|
|
|
+ const handleSearch = () => {
|
|
|
+ run({ ...searchData })
|
|
|
+ };
|
|
|
+ const onTableChange = pagination => {
|
|
|
+ console.log(pagination)
|
|
|
+ run({ ...searchData, current_page: pagination.current })
|
|
|
+ }
|
|
|
return (
|
|
|
<PageContent>
|
|
|
<div className={styles.searchContent}>
|
|
|
<div className={styles.itemFlex}>
|
|
|
<div>项目编号:</div>
|
|
|
- <Select
|
|
|
+ <Input
|
|
|
style={{ width: 200 }}
|
|
|
- placeholder="请选择"
|
|
|
+ placeholder="请输入项目编号"
|
|
|
onChange={(e) => {
|
|
|
setSearchData({
|
|
|
...searchData,
|
|
|
- project_code: e,
|
|
|
+ code: e.target.value,
|
|
|
});
|
|
|
}}
|
|
|
- options={projectData?.list?.map((item) => {
|
|
|
- return {
|
|
|
- value: item.project_name,
|
|
|
- label: item.project_name,
|
|
|
- };
|
|
|
- })}
|
|
|
/>
|
|
|
</div>
|
|
|
<div className={styles.itemFlex}>
|
|
|
<div>项目名称:</div>
|
|
|
- <Select
|
|
|
+ <Input
|
|
|
style={{ width: 200 }}
|
|
|
- placeholder="请选择"
|
|
|
+ placeholder="请输入项目名称"
|
|
|
onChange={(e) => {
|
|
|
setSearchData({
|
|
|
...searchData,
|
|
|
- project_name: e,
|
|
|
+ name: e.target.value,
|
|
|
});
|
|
|
}}
|
|
|
- options={projectData?.list?.map((item) => {
|
|
|
- return {
|
|
|
- value: item.project_name,
|
|
|
- label: item.project_name,
|
|
|
- };
|
|
|
- })}
|
|
|
/>
|
|
|
</div>
|
|
|
|
|
@@ -75,11 +94,16 @@ const PSRManage = () => {
|
|
|
type="primary"
|
|
|
className={styles.searchBtnSty}
|
|
|
onClick={handleSearch}
|
|
|
+ loading={loading}
|
|
|
>
|
|
|
查询
|
|
|
</Button>
|
|
|
</div>
|
|
|
- <Table columns={columns} dataSource={[]}></Table>
|
|
|
+ <Table
|
|
|
+ columns={columns}
|
|
|
+ dataSource={data?.list}
|
|
|
+ onChange={onTableChange}
|
|
|
+ pagination={{ current: data?.pagination?.current, pageSize: page_size, total: data?.pagination?.total }} />
|
|
|
</PageContent>
|
|
|
);
|
|
|
};
|