|
@@ -1,30 +1,31 @@
|
|
|
import { useState, Fragment } from 'react';
|
|
|
-import { useRequest } from '@umijs/max';
|
|
|
+import { useNavigate, useRequest } from '@umijs/max';
|
|
|
import styles from './index.less';
|
|
|
import { Button, Input, Pagination, Select, Table } from 'antd';
|
|
|
import PageContent from '@/components/PageContent';
|
|
|
-import {
|
|
|
- queryPsrList
|
|
|
-} from '@/services/psr';
|
|
|
+import { queryPsrList } from '@/services/psr';
|
|
|
const page_size = 10;
|
|
|
const PSRManage = () => {
|
|
|
+ const navigate = useNavigate();
|
|
|
const [searchData, setSearchData] = useState({
|
|
|
name: undefined,
|
|
|
code: undefined,
|
|
|
});
|
|
|
const { run, data, loading } = useRequest(queryPsrList, {
|
|
|
- defaultParams: [{
|
|
|
- name: undefined,
|
|
|
- code: undefined,
|
|
|
- current_page: 1,
|
|
|
- page_size
|
|
|
- }],
|
|
|
+ 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)
|
|
|
+ console.log(data?.list);
|
|
|
const columns = [
|
|
|
{
|
|
|
title: '项目编号',
|
|
@@ -36,12 +37,15 @@ const PSRManage = () => {
|
|
|
},
|
|
|
{
|
|
|
title: '操作',
|
|
|
- render: (text, record) => (
|
|
|
+ render: (record) => (
|
|
|
<Fragment>
|
|
|
<>
|
|
|
<a
|
|
|
style={{ color: '#4096ff' }}
|
|
|
onClick={() => {
|
|
|
+ navigate(`/psrManage/detail/${record.id}`, {
|
|
|
+ project_name: record.project_name,
|
|
|
+ });
|
|
|
}}
|
|
|
>
|
|
|
进入
|
|
@@ -54,12 +58,12 @@ const PSRManage = () => {
|
|
|
const projectData = [];
|
|
|
|
|
|
const handleSearch = () => {
|
|
|
- run({ ...searchData })
|
|
|
+ run({ ...searchData });
|
|
|
+ };
|
|
|
+ const onTableChange = (pagination) => {
|
|
|
+ console.log(pagination);
|
|
|
+ run({ ...searchData, current_page: pagination.current });
|
|
|
};
|
|
|
- const onTableChange = pagination => {
|
|
|
- console.log(pagination)
|
|
|
- run({ ...searchData, current_page: pagination.current })
|
|
|
- }
|
|
|
return (
|
|
|
<PageContent>
|
|
|
<div className={styles.searchContent}>
|
|
@@ -103,7 +107,12 @@ const PSRManage = () => {
|
|
|
columns={columns}
|
|
|
dataSource={data?.list}
|
|
|
onChange={onTableChange}
|
|
|
- pagination={{ current: data?.pagination?.current, pageSize: page_size, total: data?.pagination?.total }} />
|
|
|
+ pagination={{
|
|
|
+ current: data?.pagination?.current,
|
|
|
+ pageSize: page_size,
|
|
|
+ total: data?.pagination?.total,
|
|
|
+ }}
|
|
|
+ />
|
|
|
</PageContent>
|
|
|
);
|
|
|
};
|