Commit 4805690c authored by cellee's avatar cellee

Merge branch 'final' of http://120.77.240.215:9701/Maple/tostumi.git into final

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