Commit 64e50d1e authored by cellee's avatar cellee

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

parent 059303cf
......@@ -86,15 +86,15 @@ export default {
changeOrigin: true,
pathRewrite: { '^': '' },
},
// '/tos/': {
// target: 'http://47.74.233.180:8651',
// changeOrigin: true,
// pathRewrite: { '^': '' },
// },
'/tos/': {
target: 'http://192.168.1.28:8651',
target: 'http://47.74.233.180:8651',
changeOrigin: true,
pathRewrite: { '^': '' },
},
// '/tos/': {
// target: 'http://192.168.1.28:8651',
// changeOrigin: true,
// pathRewrite: { '^': '' },
// },
},
};
/*
* @Author: your name
* @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
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\models\CommunityManagement\VisitorRecord.ts
......@@ -53,8 +53,7 @@ export default {
case 26:
{
// 总数据
let Data = resp.data.rows;
console.log('??');
let Data = resp.data;
yield put({ type: 'returnPage', Data });
}
break;
......
......@@ -673,7 +673,7 @@ const Account = (props: any) => {
};
const AccountProps = (state: any) => {
console.log(state.loading);
// console.log(state.loading);
const { Data, DataSave, DataSaveDetail, Result, SubResult, Permission, Info } = state.Account;
const loading = state.loading.global;
const { user } = state;
......
import React, { useEffect } from 'react';
import { Input, Form, Button, DatePicker } from 'antd';
import React, { useEffect, useState } from 'react';
import { Input, Form, Button, DatePicker, Pagination } from 'antd';
import { connect } from 'umi';
import ProTable from '@ant-design/pro-table';
import { RA, SA } from '@/utils/method';
......@@ -14,16 +14,12 @@ const module = 'VisitorRecord';
const VisitorRecord = (props: any) => {
const { dispatch, Data, DataSave, loading, CommunityList } = props;
const [term, setTerm] = useState({ communityNames: CommunityList, pageNum: 1 }); // 搜索条件
// 新增搜索的时间 原来时间是时间戳格式
useEffect(() => {
if (Data != null && CommunityList != null) {
// Data.forEach((item: any) => {
// item.showTime = moment(item.updateTime).format('YYYY-MM-DD');
// });
} else {
RA(26, { communityNames: CommunityList }, module, dispatch);
}
}, [Data, CommunityList]);
RA(26, term, module, dispatch);
}, [1]);
// 表头
const columns: any = [
......@@ -32,7 +28,6 @@ const VisitorRecord = (props: any) => {
{ title: 'Security Guard', dataIndex: 'securityGuardName' },
{ title: 'Car Number', dataIndex: 'numberPlate' },
{ title: 'Telephone', dataIndex: 'inviterPhone' },
// 隐藏的搜索框
{
title: 'Visiting Time',
dataIndex: 'updateTime',
......@@ -47,39 +42,32 @@ const VisitorRecord = (props: any) => {
];
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) => {
console.log(value);
let obj = {
communityNames: value.community.value,
inviterName: value.inviterName ? value.inviterName : '',
showTime: value.showTime ? moment(value.showTime).format('YYYY-MM-DD') : '',
inviterName: value.inviterName ? value.inviterName : null,
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);
};
......@@ -122,10 +110,9 @@ const VisitorRecord = (props: any) => {
<ProTable
loading={loading}
rowKey="id"
dataSource={Data != null ? Data.rows : ''}
dataSource={Data != null ? Data.list : null}
columns={columns}
pagination={pagination}
// pagination={{ current: 1, total: Data.total}}
pagination={false} // 隐藏默认分页
search={false}
toolBarRender={false}
headerTitle="Visitor List"
......@@ -133,6 +120,17 @@ const VisitorRecord = (props: any) => {
onSubmit={onSubmitForm}
/>
</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 { Input, Form, Button, DatePicker } from 'antd';
import React, { useEffect, useState } from 'react';
import { Input, Form, Button, DatePicker, Pagination } from 'antd';
import { connect } from 'umi';
import ProTable from '@ant-design/pro-table';
import { RA, SA } from '@/utils/method';
......@@ -14,16 +14,12 @@ const module = 'VisitorRecord';
const VisitorRecord = (props: any) => {
const { dispatch, Data, DataSave, loading, CommunityList } = props;
const [term, setTerm] = useState({ communityNames: CommunityList, pageNum: 1 }); // 搜索条件
// 新增搜索的时间 原来时间是时间戳格式
useEffect(() => {
if (Data != null && CommunityList != null) {
// Data.forEach((item: any) => {
// item.showTime = moment(item.updateTime).format('YYYY-MM-DD');
// });
} else {
RA(26, { communityNames: CommunityList }, module, dispatch);
}
}, [Data, CommunityList]);
RA(26, term, module, dispatch);
}, [1]);
// 表头
const columns: any = [
......@@ -32,7 +28,6 @@ const VisitorRecord = (props: any) => {
{ title: 'Security Guard', dataIndex: 'securityGuardName' },
{ title: 'Car Number', dataIndex: 'numberPlate' },
{ title: 'Telephone', dataIndex: 'inviterPhone' },
// 隐藏的搜索框
{
title: 'Visiting Time',
dataIndex: 'updateTime',
......@@ -47,39 +42,32 @@ const VisitorRecord = (props: any) => {
];
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) => {
console.log(value);
let obj = {
communityNames: value.community.value,
inviterName: value.inviterName ? value.inviterName : '',
showTime: value.showTime ? moment(value.showTime).format('YYYY-MM-DD') : '',
inviterName: value.inviterName ? value.inviterName : null,
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);
};
......@@ -122,10 +110,9 @@ const VisitorRecord = (props: any) => {
<ProTable
loading={loading}
rowKey="id"
dataSource={Data != null ? Data.rows : ''}
dataSource={Data != null ? Data.list : null}
columns={columns}
pagination={pagination}
// pagination={{ current: 1, total: Data.total}}
pagination={false} // 隐藏默认分页
search={false}
toolBarRender={false}
headerTitle="Visitor List"
......@@ -133,6 +120,17 @@ const VisitorRecord = (props: any) => {
onSubmit={onSubmitForm}
/>
</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