Commit ae8fef3d authored by Sixiang_Zzb's avatar Sixiang_Zzb

住户卡申请列表bug处理完成

parent de18cd4d
...@@ -97,6 +97,15 @@ const TitleSearch = (props: any) => { ...@@ -97,6 +97,15 @@ const TitleSearch = (props: any) => {
}); });
}; };
// 小区默认值
const communityDef = () => {
if (defaultValue != null && defaultValue.communityName) {
return defaultValue.communityName;
} else {
return undefined;
}
};
return ( return (
<> <>
<Form form={form} name="basic" onFinish={onFinish} onFinishFailed={onFinishFailed}> <Form form={form} name="basic" onFinish={onFinish} onFinishFailed={onFinishFailed}>
...@@ -104,7 +113,11 @@ const TitleSearch = (props: any) => { ...@@ -104,7 +113,11 @@ const TitleSearch = (props: any) => {
{communitySelect != null ? ( {communitySelect != null ? (
<Col key={'communitySelect_'}> <Col key={'communitySelect_'}>
<Form.Item name={'communityName'}> <Form.Item name={'communityName'}>
<SearchOptionsCommnity titleSearch={true} opname={opname} /> <SearchOptionsCommnity
defaultName={communityDef}
titleSearch={true}
opname={opname}
/>
</Form.Item> </Form.Item>
</Col> </Col>
) : null} ) : null}
......
...@@ -12,11 +12,17 @@ import TitleSearch from '../../components/TitleSearch/TitleSearch'; ...@@ -12,11 +12,17 @@ import TitleSearch from '../../components/TitleSearch/TitleSearch';
import { RA, SA, urlEncode, filterObj, filterObjbyTg } from '@/utils/method'; import { RA, SA, urlEncode, filterObj, filterObjbyTg } from '@/utils/method';
let readyData: any = {
communityName: '',
ownerName: '',
handleStatus: '',
pageNum: 1,
};
const module = 'CommunityService'; const module = 'CommunityService';
const Card = (props: any) => { const Card = (props: any) => {
const { dispatch, Data7 } = props; const { dispatch, Data7, location } = props;
const [readyData, setReadyData] = useState(null);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
// const apply_status = [[0, "审核中"], [1, "批准"], [2, "拒绝"], [3, "领取"]] // const apply_status = [[0, "审核中"], [1, "批准"], [2, "拒绝"], [3, "领取"]]
const apply_status = [ const apply_status = [
...@@ -51,42 +57,36 @@ const Card = (props: any) => { ...@@ -51,42 +57,36 @@ const Card = (props: any) => {
], ],
[ [
'Actions', 'Actions',
null, 'apply_status',
(text: any, record: any) => ( (text: any, record: any) => (
<Space size="middle"> <Space size="middle">
{' '}
<a onClick={goToDetail.bind(this, record)}>Detail</a> <a onClick={goToDetail.bind(this, record)}>Detail</a>
</Space> </Space>
), ),
], ],
]); ]);
useEffect(() => {
if (Data7 != null) {
setLoading(false);
}
}, [Data7]);
useEffect(() => { useEffect(() => {
//前置数据 //前置数据
console.log('前置数据'); console.log('前置数据');
let tmp: any = filterObjbyTg(location.query, [ readyData = {
'handleStatus', pageNum: 1,
'ownerName', ...location.query,
'communityName', };
'current',
]);
tmp.handleStatus = apply_status[parseInt(tmp.handleStatus)]; //特殊处理
setReadyData(tmp);
//获取数据 //获取数据
setLoading(true); setLoading(true);
RA(31, { serviceType: '7', id: '' }, module, dispatch); RA(
}, []); 31,
{ ...filterObjbyTg(readyData, ['handleStatus', 'ownerName', 'communityName', 'pageNum']) },
module,
dispatch,
);
}, [location]);
// 监听数据返回
useEffect(() => { useEffect(() => {
if (Data7 != null) { if (Data7 != null) {
console.log('首页信息'); setLoading(false);
console.log(Data7);
} }
}, [Data7]); }, [Data7]);
...@@ -95,17 +95,26 @@ const Card = (props: any) => { ...@@ -95,17 +95,26 @@ const Card = (props: any) => {
history.push('./AccessCardApplication/Detail'); history.push('./AccessCardApplication/Detail');
}; };
const goToAdd = (values: any, e: any) => { const goToAdd = () => {
history.push('./AccessCardApplication/Add'); history.push('./AccessCardApplication/Add');
}; };
//页面搜索 //页面搜索
const ClickTitleSearch = (comment: any) => { const ClickTitleSearch = (comment: any) => {
let tmp = filterObjbyTg(comment, ['handleStatus', 'ownerName', 'communityName']); let tmp = filterObjbyTg(comment, ['handleStatus', 'ownerName', 'communityName']);
tmp['current'] = 1; tmp['pageNum'] = 1;
console.log(tmp);
history.push(location.pathname + urlEncode(tmp)); history.push(location.pathname + urlEncode(tmp));
}; };
// 切换页码
const changePage = (values: any) => {
let tmp = {
...location.query,
pageNum: values.current,
};
history.push(location.pathname + urlEncode(tmp));
};
return ( return (
<div style={{ width: '100%', minWidth: 1020, padding: 34, backgroundColor: '#ffffff' }}> <div style={{ width: '100%', minWidth: 1020, padding: 34, backgroundColor: '#ffffff' }}>
{Data7 != null ? ( {Data7 != null ? (
...@@ -115,8 +124,12 @@ const Card = (props: any) => { ...@@ -115,8 +124,12 @@ const Card = (props: any) => {
listkey={['ownerName']} listkey={['ownerName']}
list={['Owner Name']} list={['Owner Name']}
status={[{ name: ['handleStatus', 'Status'], data: apply_status }]} status={[{ name: ['handleStatus', 'Status'], data: apply_status }]}
defaultValue={readyData}
onSubmit={ClickTitleSearch} onSubmit={ClickTitleSearch}
defaultValue={{
ownerName: readyData.ownerName,
handleStatus: apply_status[parseInt(readyData.handleStatus)],
communityName: readyData.communityName,
}}
/> />
<div style={{ height: 80, position: 'relative' }}> <div style={{ height: 80, position: 'relative' }}>
...@@ -131,9 +144,14 @@ const Card = (props: any) => { ...@@ -131,9 +144,14 @@ const Card = (props: any) => {
loading={loading} loading={loading}
rowKey="id" rowKey="id"
style={{ marginTop: 16 }} style={{ marginTop: 16 }}
dataSource={Data7.data.rows} dataSource={Data7.data.list}
columns={columns} columns={columns}
pagination={{ defaultCurrent: 1, total: Data7.total }} pagination={{
defaultPageSize: 15,
total: Data7.data.page.totalRow,
showSizeChanger: false,
}}
onChange={changePage}
/> />
</> </>
) : null} ) : null}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment