Commit ae8fef3d authored by Sixiang_Zzb's avatar Sixiang_Zzb

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

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