Commit 52713595 authored by Sixiang_Zzb's avatar Sixiang_Zzb

服务商管理模块bug处理

parent 13de2441
...@@ -25,10 +25,10 @@ const Card = (props: any) => { ...@@ -25,10 +25,10 @@ const Card = (props: any) => {
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 = [
[0, 'Under review'], [0, 'Pending'],
[1, 'Approval'], [1, 'Approval'],
[2, 'Reject'], [2, 'Reject'],
[3, 'Claim'], [3, 'Received'],
]; ];
const columns = objectColumns([ const columns = objectColumns([
['Community Name', 'community_name'], ['Community Name', 'community_name'],
...@@ -119,45 +119,43 @@ const Card = (props: any) => { ...@@ -119,45 +119,43 @@ const Card = (props: any) => {
return ( return (
<div style={{ width: '100%', minWidth: 1020, padding: 34, backgroundColor: '#ffffff' }}> <div style={{ width: '100%', minWidth: 1020, padding: 34, backgroundColor: '#ffffff' }}>
{Data7 != null ? ( <>
<> <TitleSearch
<TitleSearch communitySelect={true}
communitySelect={true} listkey={['ownerName']}
listkey={['ownerName']} list={['Owner Name']}
list={['Owner Name']} status={[{ name: ['handleStatus', 'Status'], data: apply_status }]}
status={[{ name: ['handleStatus', 'Status'], data: apply_status }]} onSubmit={ClickTitleSearch}
onSubmit={ClickTitleSearch} defaultValue={{
defaultValue={{ ownerName: readyData.ownerName,
ownerName: readyData.ownerName, handleStatus: apply_status[parseInt(readyData.handleStatus)],
handleStatus: apply_status[parseInt(readyData.handleStatus)], communityName: readyData.communityName,
communityName: readyData.communityName, }}
}} />
/>
<div style={{ height: 80, position: 'relative' }}>
<div style={{ height: 80, position: 'relative' }}> <div style={{ position: 'absolute', right: 0 }}>
<div style={{ position: 'absolute', right: 0 }}> <Button type="primary" onClick={goToAdd}>
<Button type="primary" onClick={goToAdd}> Apply Card
Apply Card </Button>
</Button>
</div>
</div> </div>
</div>
<Table
loading={loading} <Table
rowKey="id" loading={loading}
style={{ marginTop: 16 }} rowKey="id"
dataSource={Data7.data.list} style={{ marginTop: 16 }}
columns={columns} dataSource={Data7 !== null ? Data7.data.list : []}
pagination={{ columns={columns}
defaultCurrent: readyData.pageNum, pagination={{
defaultPageSize: 15, defaultCurrent: readyData.pageNum,
total: Data7.data.page.totalRow, defaultPageSize: 15,
showSizeChanger: false, total: Data7 !== null ? Data7.data.page.totalRow : null,
}} showSizeChanger: false,
onChange={changePage} }}
/> onChange={changePage}
</> />
) : null} </>
</div> </div>
); );
}; };
......
...@@ -42,6 +42,7 @@ const CardAdd = (props: any) => { ...@@ -42,6 +42,7 @@ const CardAdd = (props: any) => {
message.warning('Please enter the complete!'); message.warning('Please enter the complete!');
return; return;
} }
values.communityName = communityName; values.communityName = communityName;
setLoading(true); setLoading(true);
RA(35, values, module, dispatch); RA(35, values, module, dispatch);
...@@ -85,7 +86,7 @@ const CardAdd = (props: any) => { ...@@ -85,7 +86,7 @@ const CardAdd = (props: any) => {
}; };
return ( return (
<div style={{ width: '100%', minWidth: 1020, padding: 34, backgroundColor: '#ffffff' }}> <div style={{ width: '100%', minWidth: 1020, padding: 34, backgroundColor: '#ffffff' }}>
<TitleBack title={'Apply Card'}></TitleBack> <TitleBack title={'Apply Card Add'}></TitleBack>
<Form form={form} name="basic" onFinish={onFinish} validateMessages={validateMessages}> <Form form={form} name="basic" onFinish={onFinish} validateMessages={validateMessages}>
<Spin spinning={loading}> <Spin spinning={loading}>
...@@ -182,7 +183,12 @@ const CardAdd = (props: any) => { ...@@ -182,7 +183,12 @@ const CardAdd = (props: any) => {
<Form.Item labelCol={{ span: 3 }} name="applyRelationOwner" label={'Relationship'}> <Form.Item labelCol={{ span: 3 }} name="applyRelationOwner" label={'Relationship'}>
<Relationship /> <Relationship />
</Form.Item> </Form.Item>
<Form.Item labelCol={{ span: 3 }} name="applyReasonContent" label={'Reason'}> <Form.Item
labelCol={{ span: 3 }}
name="applyReasonContent"
label={'Reason'}
rules={[{ required: true, max: 500 }]}
>
<TextArea style={{ width: 400 }}></TextArea> <TextArea style={{ width: 400 }}></TextArea>
</Form.Item> </Form.Item>
<Line></Line> <Line></Line>
......
...@@ -41,6 +41,10 @@ const CardDetail = (props: any) => { ...@@ -41,6 +41,10 @@ const CardDetail = (props: any) => {
}, []); }, []);
const onFinish = (values: any) => { const onFinish = (values: any) => {
if (values.applyStatus === '2' && !values.replyContent) {
message.error('Replies must be filled in!', 3);
return;
}
let tmp = { let tmp = {
communityId: DataSave.communityId, communityId: DataSave.communityId,
id: DataSave.id, id: DataSave.id,
...@@ -66,7 +70,7 @@ const CardDetail = (props: any) => { ...@@ -66,7 +70,7 @@ const CardDetail = (props: any) => {
'Status : ' + apply_status[DataSave.apply_status][1], 'Status : ' + apply_status[DataSave.apply_status][1],
'Time : ' + moment(DataSave.create_time.time).format('DD-MM-YYYY'), 'Time : ' + moment(DataSave.create_time.time).format('DD-MM-YYYY'),
]} ]}
title="Apply Card" title="Apply Card Detail"
></TitleBack> ></TitleBack>
<Row gutter={8}> <Row gutter={8}>
<Col>Community:</Col> <Col>Community:</Col>
...@@ -206,7 +210,7 @@ const CardDetail = (props: any) => { ...@@ -206,7 +210,7 @@ const CardDetail = (props: any) => {
<Col span={3}>Received:</Col> <Col span={3}>Received:</Col>
<Col span={4}> <Col span={4}>
<Radio.Group value={DataSave.apply_status === 3 ? '3' : ''}> <Radio.Group value={DataSave.apply_status === 3 ? '3' : ''}>
<Radio value={'3'}>Agree</Radio> <Radio value={'3'}>Receive</Radio>
</Radio.Group> </Radio.Group>
</Col> </Col>
</Row> </Row>
......
...@@ -58,7 +58,6 @@ const Renovation = (props: any) => { ...@@ -58,7 +58,6 @@ const Renovation = (props: any) => {
]); ]);
const { dispatch, Data8, location } = props; const { dispatch, Data8, location } = props;
console.log(Data8);
useEffect(() => { useEffect(() => {
//分页设置 //分页设置
if (location.query.pageNum != null) { if (location.query.pageNum != null) {
...@@ -102,7 +101,7 @@ const Renovation = (props: any) => { ...@@ -102,7 +101,7 @@ const Renovation = (props: any) => {
}; };
const goToDetail = (values: any, e: any) => { const goToDetail = (values: any, e: any) => {
// SA(values, module, dispatch); SA(values, module, dispatch);
history.push('./RenovationApplication/Detail?id=' + values.id); history.push('./RenovationApplication/Detail?id=' + values.id);
}; };
...@@ -114,32 +113,30 @@ const Renovation = (props: any) => { ...@@ -114,32 +113,30 @@ const Renovation = (props: any) => {
}; };
return ( return (
<div style={{ width: '100%', minWidth: 1020, padding: 34, backgroundColor: '#ffffff' }}> <div style={{ width: '100%', minWidth: 1020, padding: 34, backgroundColor: '#ffffff' }}>
{Data8 != null ? ( <>
<> <TitleSearch
<TitleSearch communitySelect={true}
communitySelect={true} listkey={['applyforName']}
listkey={['applyforName']} list={['Owner Name']}
list={['Owner Name']} status={[{ name: ['handleStatus', 'Status'], data: decoration_status }]}
status={[{ name: ['handleStatus', 'Status'], data: decoration_status }]} defaultValue={readyData}
defaultValue={readyData} onSubmit={ClickTitleSearch}
onSubmit={ClickTitleSearch} />
/> <Table
<Table loading={loading}
loading={loading} rowKey="id"
rowKey="id" style={{ marginTop: 16 }}
style={{ marginTop: 16 }} dataSource={Data8 !== null ? Data8.data.rows : null}
dataSource={Data8.data.rows} columns={columns}
columns={columns} onChange={PageChange}
onChange={PageChange} pagination={{
pagination={{ current: pageNum,
current: pageNum, defaultPageSize: 15,
defaultPageSize: 15, total: Data8 !== null ? Data8.data.page.totalRow : null,
total: Data8.data.page.totalRow, showSizeChanger: false,
showSizeChanger: false, }}
}} />
/> </>
</>
) : null}
</div> </div>
); );
}; };
......
...@@ -19,36 +19,16 @@ import { values } from 'lodash'; ...@@ -19,36 +19,16 @@ import { values } from 'lodash';
const module = 'CommunityService'; const module = 'CommunityService';
let DataSave: any = null; let DataSave: any = null;
const RenovationDetail = (props: any) => { const RenovationDetail = (props: any) => {
const { dispatch, DataSaveDetail, location } = props; const { dispatch, DataSaveDetail, location, DataSave } = props;
const formRef = useRef(null); const formRef = useRef(null);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
useEffect(() => { useEffect(() => {
if (location.query.id) { if (!DataSave) {
setLoading(true);
RA(37, { id: location.query.id }, module, dispatch);
} else {
history.go(-1); history.go(-1);
} }
}, []); }, []);
useEffect(() => {
if (DataSaveDetail) {
setLoading(false);
DataSave = {
...DataSaveDetail.data.rows.list[0],
ownerAddress:
DataSaveDetail.data.rows.onwerDetail.addressAndpostalCode +
' ' +
DataSaveDetail.data.rows.onwerDetail.buildingNumber +
'#' +
DataSaveDetail.data.rows.onwerDetail.floorNumber +
'-' +
DataSaveDetail.data.rows.onwerDetail.roomNumber,
};
}
}, [DataSaveDetail]);
const onFinish = (values: any) => { const onFinish = (values: any) => {
if ( if (
values.decorationStatus === '2' && values.decorationStatus === '2' &&
...@@ -181,9 +161,9 @@ const RenovationDetail = (props: any) => { ...@@ -181,9 +161,9 @@ const RenovationDetail = (props: any) => {
<Row gutter={8} style={{ marginTop: 16 }}> <Row gutter={8} style={{ marginTop: 16 }}>
<Col span={3}>Approval For Application:</Col> <Col span={3}>Approval For Application:</Col>
<Col> <Col>
<Radio.Group value={DataSave.decoration_status === 2 ? '1' : '2'}> <Radio.Group value={DataSave.decoration_status}>
<Radio.Button value={'1'}>Agree</Radio.Button>{' '} <Radio.Button value={1}>Agree</Radio.Button>{' '}
<Radio.Button style={{ marginLeft: 10 }} value={'2'}> <Radio.Button style={{ marginLeft: 10 }} value={2}>
Reject Reject
</Radio.Button> </Radio.Button>
</Radio.Group> </Radio.Group>
...@@ -210,7 +190,7 @@ const RenovationDetail = (props: any) => { ...@@ -210,7 +190,7 @@ const RenovationDetail = (props: any) => {
}; };
function map(state: any) { function map(state: any) {
const { DataSaveDetail } = state[module]; const { DataSaveDetail, DataSave } = state[module];
return { DataSaveDetail }; return { DataSaveDetail, DataSave };
} }
export default connect(map)(RenovationDetail); export default connect(map)(RenovationDetail);
...@@ -55,7 +55,7 @@ const ChargeDetail = (props: any) => { ...@@ -55,7 +55,7 @@ const ChargeDetail = (props: any) => {
<div className={styles.time2}>{timestampToTime(CurData.createTime.time)}</div> <div className={styles.time2}>{timestampToTime(CurData.createTime.time)}</div>
<div className={styles.item21}>Project (community)</div> <div className={styles.item21}>Project (community)</div>
<div className={styles.item22}>{CurData.communityName}</div> <div className={styles.item22}>{CurData.communityName}</div>
<div className={styles.item23}>Street name</div> <div className={styles.item23}>{CurData.streetName}</div>
<div className={styles.item24}>{CurData.buildingNumber}</div> <div className={styles.item24}>{CurData.buildingNumber}</div>
<div className={styles.item234}>#</div> <div className={styles.item234}>#</div>
<div className={styles.item25}>{CurData.floorNumber}</div> <div className={styles.item25}>{CurData.floorNumber}</div>
......
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import styles from './index.less'; import styles from './index.less';
import { Table, Space } from 'antd';
import { useIntl, connect, history } from 'umi'; import { useIntl, connect, history } from 'umi';
import { Button, Tag, Table, Space, message } from 'antd';
import { timestampToTime } from '../../utils/time'; import { timestampToTime } from '../../utils/time';
import { filterObj, urlEncode, filterObjbyTg } from '@/utils/method'; import { filterObj, urlEncode, filterObjbyTg } from '@/utils/method';
import TitleSearch from '../../components/TitleSearch/TitleSearch'; import TitleSearch from '../../components/TitleSearch/TitleSearch';
import ProTable, { ProColumns, TableDropdown, ActionType } from '@ant-design/pro-table';
interface readyData { interface readyData {
[key: string]: any; [key: string]: any;
} }
...@@ -45,82 +46,101 @@ const ChargeManager = (props: any) => { ...@@ -45,82 +46,101 @@ const ChargeManager = (props: any) => {
const get = (values: any) => { const get = (values: any) => {
dispatch({ type: 'PropertyManagement/get', playload: values }); dispatch({ type: 'PropertyManagement/get', playload: values });
}; };
// 进入页面先请求一次
const pagination = {
defaultPageSize: 15,
total: Data && Data.page.totalRow,
showSizeChanger: false,
// current: 1,
};
// 监听路由变化
useEffect(() => { useEffect(() => {
console.log(location.query); setLoading(true);
if (location.query) { get({
readyData = { communityName: '',
...readyData, tosOwnerName: '',
...location.query, pageNum: 1,
}; });
setLoading(true); }, [1]);
get({
...readyData,
});
}
}, [location]);
// 监听数据返回 // 监听数据返回
useEffect(() => { useEffect(() => {
if (Data != null) { if (Data != null) {
console.log(Data);
setLoading(false); setLoading(false);
} }
}, [Data]); }, [Data]);
// 搜索按钮 // 搜索按钮
const TitleSearchContent = (comment: any) => { const TitleSearchContent = (comment: any) => {
readyData = { setLoading(true);
...comment, get({
}; communityName: comment.communityName,
let tmp = filterObjbyTg(comment, ['communityName', 'tosOwnerName']); tosOwnerName: comment.tosOwnerName,
tmp['pageNum'] = 1; pageNum: 1,
history.push(location.pathname + urlEncode(tmp)); });
};
// 切换页码
const changePage = (values: any) => {
let tmp = {
...location.query,
pageNum: values.current,
};
history.push(location.pathname + urlEncode(filterObj(tmp)));
}; };
const columns = [ interface GithubIssueItem {
{ title: username, dataIndex: 'tosOwnerName' }, url: string;
{ title: project, dataIndex: 'communityName' }, id: number;
number: number;
title: string;
labels: {
name: string;
color: string;
}[];
state: string;
comments: number;
created_at: string;
updated_at: string;
closed_at?: string;
}
const columns: ProColumns<GithubIssueItem>[] = [
{
title: 'User Name',
dataIndex: 'tosOwnerName',
},
{
title: 'Community Name',
dataIndex: 'communityName',
},
{ {
title: unit, title: 'Unit',
dataIndex: 'buildingNumber', dataIndex: 'buildingNumber',
render: (text: any, record: any) => ( render: (text: any, record: any) => (
<div>{record.buildingNumber + '#' + record.floorNumber + '-' + record.roomNumber}</div> <div>{`${record.buildingNumber}#${record.floorNumber}-${record.roomNumber}`}</div>
), ),
}, },
{ {
title: submissionTime, title: 'Submission Time',
render: (text: any, record: any) => ( dataIndex: 'createTime',
<Space size="middle">{timestampToTime(record.createTime.time)}</Space> valueType: 'date',
), render: (text: any, record: any) => <div>{timestampToTime(record.createTime.time)}</div>,
}, },
{ {
title: actions, title: 'Actions',
render: (text: any, record: any) => ( dataIndex: 'action',
<Space size="middle"> valueType: 'option',
<a onClick={goToDetail.bind(this, record)}>Detail</a> render: (text, record) => [<a onClick={goToDetail.bind(this, record)}>Detail</a>],
</Space>
),
}, },
]; ];
// 重置表单触发
const resetHandler = () => {
setLoading(true);
readyData = {
communityName: '',
pageNum: 1,
tosOwnerName: '',
};
get({
...readyData,
});
};
// 切换页码
const changePage = (value: any) => {
readyData.pageNum = value.current;
setLoading(true);
get({
...readyData,
});
};
return ( return (
<div className={styles.base}> <div className={styles.base}>
<TitleSearch <TitleSearch
...@@ -128,18 +148,30 @@ const ChargeManager = (props: any) => { ...@@ -128,18 +148,30 @@ const ChargeManager = (props: any) => {
list={['TosOwnerName']} list={['TosOwnerName']}
communitySelect={true} communitySelect={true}
onSubmit={TitleSearchContent} onSubmit={TitleSearchContent}
defaultValue={{ ...readyData }} // defaultValue={{ ...readyData }}
/> />
{/* 列表组件 */} <ProTable<GithubIssueItem>
<Table columns={columns}
style={{ marginTop: 16 }} dataSource={Data !== null ? Data.list : []}
rowKey={'id'} rowKey={'id'}
search={false}
loading={loading} loading={loading}
dataSource={Data != null ? Data.list : []}
columns={columns}
pagination={pagination}
onChange={changePage} onChange={changePage}
pagination={{
defaultPageSize: 15,
showSizeChanger: false,
total: Data !== null ? Data.page.totalRow : '',
current: Data !== null ? Data.page.currentPage : 1,
}}
options={{
density: true,
fullScreen: true,
reload: () => {
resetHandler();
},
setting: false,
}}
/> />
</div> </div>
); );
......
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