Commit 64e50d1e authored by cellee's avatar cellee

Signed-off-by: cellee <893264950@qq.com>

parent 059303cf
...@@ -86,15 +86,15 @@ export default { ...@@ -86,15 +86,15 @@ export default {
changeOrigin: true, changeOrigin: true,
pathRewrite: { '^': '' }, pathRewrite: { '^': '' },
}, },
// '/tos/': {
// target: 'http://47.74.233.180:8651',
// changeOrigin: true,
// pathRewrite: { '^': '' },
// },
'/tos/': { '/tos/': {
target: 'http://192.168.1.28:8651', target: 'http://47.74.233.180:8651',
changeOrigin: true, changeOrigin: true,
pathRewrite: { '^': '' }, pathRewrite: { '^': '' },
}, },
// '/tos/': {
// target: 'http://192.168.1.28:8651',
// changeOrigin: true,
// pathRewrite: { '^': '' },
// },
}, },
}; };
/* /*
* @Author: your name * @Author: your name
* @Date: 2020-11-19 16:54:53 * @Date: 2020-11-19 16:54:53
* @LastEditTime: 2021-02-03 17:43:00 * @LastEditTime: 2021-02-03 19:55:13
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @Description: In User Settings Edit * @Description: In User Settings Edit
* @FilePath: \tostumi\src\models\CommunityManagement\VisitorRecord.ts * @FilePath: \tostumi\src\models\CommunityManagement\VisitorRecord.ts
...@@ -53,8 +53,7 @@ export default { ...@@ -53,8 +53,7 @@ export default {
case 26: case 26:
{ {
// 总数据 // 总数据
let Data = resp.data.rows; let Data = resp.data;
console.log('??');
yield put({ type: 'returnPage', Data }); yield put({ type: 'returnPage', Data });
} }
break; break;
......
...@@ -673,7 +673,7 @@ const Account = (props: any) => { ...@@ -673,7 +673,7 @@ const Account = (props: any) => {
}; };
const AccountProps = (state: any) => { const AccountProps = (state: any) => {
console.log(state.loading); // console.log(state.loading);
const { Data, DataSave, DataSaveDetail, Result, SubResult, Permission, Info } = state.Account; const { Data, DataSave, DataSaveDetail, Result, SubResult, Permission, Info } = state.Account;
const loading = state.loading.global; const loading = state.loading.global;
const { user } = state; const { user } = state;
......
import React, { useEffect } from 'react'; import React, { useEffect, useState } from 'react';
import { Input, Form, Button, DatePicker } from 'antd'; import { Input, Form, Button, DatePicker, Pagination } from 'antd';
import { connect } from 'umi'; import { connect } from 'umi';
import ProTable from '@ant-design/pro-table'; import ProTable from '@ant-design/pro-table';
import { RA, SA } from '@/utils/method'; import { RA, SA } from '@/utils/method';
...@@ -14,16 +14,12 @@ const module = 'VisitorRecord'; ...@@ -14,16 +14,12 @@ const module = 'VisitorRecord';
const VisitorRecord = (props: any) => { const VisitorRecord = (props: any) => {
const { dispatch, Data, DataSave, loading, CommunityList } = props; const { dispatch, Data, DataSave, loading, CommunityList } = props;
const [term, setTerm] = useState({ communityNames: CommunityList, pageNum: 1 }); // 搜索条件
// 新增搜索的时间 原来时间是时间戳格式 // 新增搜索的时间 原来时间是时间戳格式
useEffect(() => { useEffect(() => {
if (Data != null && CommunityList != null) { RA(26, term, module, dispatch);
// Data.forEach((item: any) => { }, [1]);
// item.showTime = moment(item.updateTime).format('YYYY-MM-DD');
// });
} else {
RA(26, { communityNames: CommunityList }, module, dispatch);
}
}, [Data, CommunityList]);
// 表头 // 表头
const columns: any = [ const columns: any = [
...@@ -32,7 +28,6 @@ const VisitorRecord = (props: any) => { ...@@ -32,7 +28,6 @@ const VisitorRecord = (props: any) => {
{ title: 'Security Guard', dataIndex: 'securityGuardName' }, { title: 'Security Guard', dataIndex: 'securityGuardName' },
{ title: 'Car Number', dataIndex: 'numberPlate' }, { title: 'Car Number', dataIndex: 'numberPlate' },
{ title: 'Telephone', dataIndex: 'inviterPhone' }, { title: 'Telephone', dataIndex: 'inviterPhone' },
// 隐藏的搜索框
{ {
title: 'Visiting Time', title: 'Visiting Time',
dataIndex: 'updateTime', dataIndex: 'updateTime',
...@@ -47,39 +42,32 @@ const VisitorRecord = (props: any) => { ...@@ -47,39 +42,32 @@ const VisitorRecord = (props: any) => {
]; ];
const [form] = Form.useForm(); const [form] = Form.useForm();
// 分页
const pagination: any = {
defaultCurrent: 1,
// total: Data != null ? Data.length : 0,
defaultPageSize: 15,
showSizeChanger: false,
showTitle: false,
showTotal: false,
size: 'default',
};
// 多条件筛选
//@param condition 过滤条件
//@param data 需要过滤的数据
let filter = (condition: any, data: any) => {
return data.filter((item: any) => {
return Object.keys(condition).every((key) => {
return String(item[key])
.toLowerCase()
.includes(String(condition[key]).trim().toLowerCase());
});
});
};
// 点击搜索 // 点击搜索
const onSubmitForm = (value: any) => { const onSubmitForm = (value: any) => {
console.log(value);
let obj = { let obj = {
communityNames: value.community.value, communityNames: value.community.value,
inviterName: value.inviterName ? value.inviterName : '', inviterName: value.inviterName ? value.inviterName : null,
showTime: value.showTime ? moment(value.showTime).format('YYYY-MM-DD') : '', showTime: value.showTime ? moment(value.showTime).format('YYYY-MM-DD') : null,
pageNum: 1,
};
setTerm({ ...term, ...obj });
// SA(obj, module, dispatch);
RA(26, obj, module, dispatch);
}; };
SA(obj, module, dispatch);
// 页面切换
const paginationHandler = (page: number, pageSize?: number) => {
// // 要看是哪里分页
// let mlist = { ...DataSaveDetail };
// mlist.pageNum = page;
// // 把内容存进去
// SA(DetailPage(mlist), module, dispatch);
let obj = {
...term,
pageNum: page,
};
setTerm({ ...obj });
RA(26, obj, module, dispatch); RA(26, obj, module, dispatch);
}; };
...@@ -122,10 +110,9 @@ const VisitorRecord = (props: any) => { ...@@ -122,10 +110,9 @@ const VisitorRecord = (props: any) => {
<ProTable <ProTable
loading={loading} loading={loading}
rowKey="id" rowKey="id"
dataSource={Data != null ? Data.rows : ''} dataSource={Data != null ? Data.list : null}
columns={columns} columns={columns}
pagination={pagination} pagination={false} // 隐藏默认分页
// pagination={{ current: 1, total: Data.total}}
search={false} search={false}
toolBarRender={false} toolBarRender={false}
headerTitle="Visitor List" headerTitle="Visitor List"
...@@ -133,6 +120,17 @@ const VisitorRecord = (props: any) => { ...@@ -133,6 +120,17 @@ const VisitorRecord = (props: any) => {
onSubmit={onSubmitForm} onSubmit={onSubmitForm}
/> />
</div> </div>
<div style={{ textAlign: 'right', padding: 15 }}>
<Pagination
current={Data ? Data.page.currentPage : 0}
total={Data ? Data.page.totalRow : 0}
onChange={paginationHandler}
showSizeChanger={false}
// showSizeChanger={false}
pageSize={Data ? Data.page.curPageSize : 10}
/>
</div>
</> </>
); );
}; };
......
import React, { useEffect } from 'react'; import React, { useEffect, useState } from 'react';
import { Input, Form, Button, DatePicker } from 'antd'; import { Input, Form, Button, DatePicker, Pagination } from 'antd';
import { connect } from 'umi'; import { connect } from 'umi';
import ProTable from '@ant-design/pro-table'; import ProTable from '@ant-design/pro-table';
import { RA, SA } from '@/utils/method'; import { RA, SA } from '@/utils/method';
...@@ -14,16 +14,12 @@ const module = 'VisitorRecord'; ...@@ -14,16 +14,12 @@ const module = 'VisitorRecord';
const VisitorRecord = (props: any) => { const VisitorRecord = (props: any) => {
const { dispatch, Data, DataSave, loading, CommunityList } = props; const { dispatch, Data, DataSave, loading, CommunityList } = props;
const [term, setTerm] = useState({ communityNames: CommunityList, pageNum: 1 }); // 搜索条件
// 新增搜索的时间 原来时间是时间戳格式 // 新增搜索的时间 原来时间是时间戳格式
useEffect(() => { useEffect(() => {
if (Data != null && CommunityList != null) { RA(26, term, module, dispatch);
// Data.forEach((item: any) => { }, [1]);
// item.showTime = moment(item.updateTime).format('YYYY-MM-DD');
// });
} else {
RA(26, { communityNames: CommunityList }, module, dispatch);
}
}, [Data, CommunityList]);
// 表头 // 表头
const columns: any = [ const columns: any = [
...@@ -32,7 +28,6 @@ const VisitorRecord = (props: any) => { ...@@ -32,7 +28,6 @@ const VisitorRecord = (props: any) => {
{ title: 'Security Guard', dataIndex: 'securityGuardName' }, { title: 'Security Guard', dataIndex: 'securityGuardName' },
{ title: 'Car Number', dataIndex: 'numberPlate' }, { title: 'Car Number', dataIndex: 'numberPlate' },
{ title: 'Telephone', dataIndex: 'inviterPhone' }, { title: 'Telephone', dataIndex: 'inviterPhone' },
// 隐藏的搜索框
{ {
title: 'Visiting Time', title: 'Visiting Time',
dataIndex: 'updateTime', dataIndex: 'updateTime',
...@@ -47,39 +42,32 @@ const VisitorRecord = (props: any) => { ...@@ -47,39 +42,32 @@ const VisitorRecord = (props: any) => {
]; ];
const [form] = Form.useForm(); const [form] = Form.useForm();
// 分页
const pagination: any = {
defaultCurrent: 1,
// total: Data != null ? Data.length : 0,
defaultPageSize: 15,
showSizeChanger: false,
showTitle: false,
showTotal: false,
size: 'default',
};
// 多条件筛选
//@param condition 过滤条件
//@param data 需要过滤的数据
let filter = (condition: any, data: any) => {
return data.filter((item: any) => {
return Object.keys(condition).every((key) => {
return String(item[key])
.toLowerCase()
.includes(String(condition[key]).trim().toLowerCase());
});
});
};
// 点击搜索 // 点击搜索
const onSubmitForm = (value: any) => { const onSubmitForm = (value: any) => {
console.log(value);
let obj = { let obj = {
communityNames: value.community.value, communityNames: value.community.value,
inviterName: value.inviterName ? value.inviterName : '', inviterName: value.inviterName ? value.inviterName : null,
showTime: value.showTime ? moment(value.showTime).format('YYYY-MM-DD') : '', showTime: value.showTime ? moment(value.showTime).format('YYYY-MM-DD') : null,
pageNum: 1,
};
setTerm({ ...term, ...obj });
// SA(obj, module, dispatch);
RA(26, obj, module, dispatch);
}; };
SA(obj, module, dispatch);
// 页面切换
const paginationHandler = (page: number, pageSize?: number) => {
// // 要看是哪里分页
// let mlist = { ...DataSaveDetail };
// mlist.pageNum = page;
// // 把内容存进去
// SA(DetailPage(mlist), module, dispatch);
let obj = {
...term,
pageNum: page,
};
setTerm({ ...obj });
RA(26, obj, module, dispatch); RA(26, obj, module, dispatch);
}; };
...@@ -122,10 +110,9 @@ const VisitorRecord = (props: any) => { ...@@ -122,10 +110,9 @@ const VisitorRecord = (props: any) => {
<ProTable <ProTable
loading={loading} loading={loading}
rowKey="id" rowKey="id"
dataSource={Data != null ? Data.rows : ''} dataSource={Data != null ? Data.list : null}
columns={columns} columns={columns}
pagination={pagination} pagination={false} // 隐藏默认分页
// pagination={{ current: 1, total: Data.total}}
search={false} search={false}
toolBarRender={false} toolBarRender={false}
headerTitle="Visitor List" headerTitle="Visitor List"
...@@ -133,6 +120,17 @@ const VisitorRecord = (props: any) => { ...@@ -133,6 +120,17 @@ const VisitorRecord = (props: any) => {
onSubmit={onSubmitForm} onSubmit={onSubmitForm}
/> />
</div> </div>
<div style={{ textAlign: 'right', padding: 15 }}>
<Pagination
current={Data ? Data.page.currentPage : 0}
total={Data ? Data.page.totalRow : 0}
onChange={paginationHandler}
showSizeChanger={false}
// showSizeChanger={false}
pageSize={Data ? Data.page.curPageSize : 10}
/>
</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