|
|
@@ -1,5 +1,5 @@ |
|
|
|
import { useRef, useState, useEffect } from 'react'; |
|
|
|
import { useSearchParams, connect } from '@umijs/max'; |
|
|
|
import { connect } from '@umijs/max'; |
|
|
|
import type { ActionType, ProFormInstance } from '@ant-design/pro-components'; |
|
|
|
import { |
|
|
|
ProTable |
|
|
@@ -13,12 +13,11 @@ import { Imageprefix } from '@/constants'; |
|
|
|
|
|
|
|
const CompanyListPage: React.FC = ({ dispatch, getId, openModel }: any) => { |
|
|
|
const actionRef = useRef<ActionType>(); |
|
|
|
const [searchParams, setSearchParams] = useSearchParams(); |
|
|
|
const [list, setList] = useState<object[]>([]) |
|
|
|
const [total, setTotal] = useState<number>(0) |
|
|
|
const [page, setPage] = useState<number>(1) |
|
|
|
const [pageSize, setPageSize] = useState<number>(10) |
|
|
|
|
|
|
|
const [fullname, setFullname] = useState<any>(sessionStorage.getItem('vip_company_info') ? JSON.parse(sessionStorage.getItem('vip_company_info')).full_name : '') |
|
|
|
|
|
|
|
const setId = (id: number) => { |
|
|
|
getId(id) |
|
|
@@ -29,6 +28,13 @@ const CompanyListPage: React.FC = ({ dispatch, getId, openModel }: any) => { |
|
|
|
actionRef.current?.reload(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return () => { |
|
|
|
sessionStorage.removeItem('company_info') |
|
|
|
sessionStorage.removeItem('post_company_info') |
|
|
|
sessionStorage.removeItem('vip_company_info') |
|
|
|
|
|
|
|
}; |
|
|
|
}, [openModel.openModal]) |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
@@ -70,7 +76,7 @@ const CompanyListPage: React.FC = ({ dispatch, getId, openModel }: any) => { |
|
|
|
actionRef={actionRef} |
|
|
|
dataSource={list} |
|
|
|
search={{ |
|
|
|
span: 8, labelWidth: 'auto', |
|
|
|
span: 8, labelWidth: 'auto' |
|
|
|
}} |
|
|
|
rowSelection={{ |
|
|
|
type: 'checkbox' |
|
|
@@ -84,14 +90,6 @@ const CompanyListPage: React.FC = ({ dispatch, getId, openModel }: any) => { |
|
|
|
dataIndex: 'date_range', |
|
|
|
hidden: true, |
|
|
|
valueType: 'dateRange', |
|
|
|
search: { |
|
|
|
transform: (value) => { |
|
|
|
return { |
|
|
|
start_date: value[0], |
|
|
|
end_date: value[1], |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: 'ID', |
|
|
@@ -102,17 +100,14 @@ const CompanyListPage: React.FC = ({ dispatch, getId, openModel }: any) => { |
|
|
|
title: '企业名称', |
|
|
|
dataIndex: 'full_name', |
|
|
|
width: 200, |
|
|
|
renderFormItem: (_, { type, defaultRender }) => { |
|
|
|
valueType: 'input', |
|
|
|
renderFormItem: () => { |
|
|
|
return ( |
|
|
|
<Input |
|
|
|
placeholder="请输入企业名称" |
|
|
|
defaultValue={searchParams.get('full_name')} |
|
|
|
onChange={(e) => { |
|
|
|
console.log(e.target.value); |
|
|
|
}} |
|
|
|
/> |
|
|
|
<><Input placeholder="请输入企业名称" value={fullname} onChange={(e) => { |
|
|
|
setFullname(e.target.value) |
|
|
|
}} /></> |
|
|
|
) |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '会员类型', |
|
|
@@ -202,16 +197,21 @@ const CompanyListPage: React.FC = ({ dispatch, getId, openModel }: any) => { |
|
|
|
pagesize: pageSize, |
|
|
|
sort: 'id', |
|
|
|
sortby: 'desc', |
|
|
|
keyword: searchParams.get('full_name') ? searchParams.get('full_name') : params.full_name, |
|
|
|
id: params.id, |
|
|
|
start_date: params.start_date, |
|
|
|
end_date: params.end_date, |
|
|
|
keyword: fullname, |
|
|
|
start_date: params.date_range ? params.date_range[0] : '', |
|
|
|
end_date: params.date_range ? params.date_range[1] : '', |
|
|
|
}).then(res => { |
|
|
|
setList(res.data.list) |
|
|
|
setTotal(res.data.total) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
onReset={() => { |
|
|
|
if (sessionStorage.getItem('vip_company_info')) { |
|
|
|
sessionStorage.removeItem('vip_company_info') |
|
|
|
} |
|
|
|
setFullname('') |
|
|
|
actionRef.current?.reload(); |
|
|
|
}} |
|
|
|
headerTitle="VIP企业列表" |
|
|
|
toolBarRender={() => [ |
|
|
|
<Button type="primary" onClick={() => { |
|
|
@@ -293,5 +293,4 @@ const CompanyListPage: React.FC = ({ dispatch, getId, openModel }: any) => { |
|
|
|
export default connect(({ dictModel, openModel }: any) => ({ |
|
|
|
dictModel, |
|
|
|
openModel |
|
|
|
}))(CompanyListPage); |
|
|
|
|
|
|
|
}))(CompanyListPage); |