Commit 177a89dd authored by cellee's avatar cellee

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

parents 5b1d2f00 de18cd4d
...@@ -14,30 +14,25 @@ import { gray } from 'chalk'; ...@@ -14,30 +14,25 @@ import { gray } from 'chalk';
import SearchOptionsCommnity from '../SearchOptions/SearchOptionsCommnity'; import SearchOptionsCommnity from '../SearchOptions/SearchOptionsCommnity';
const TitleSearch = (props: any) => { const TitleSearch = (props: any) => {
// console.log("===================================", props) const {
dispatch,
const { dispatch, CommunityList } = props; CommunityList,
single,
checklist,
status,
communitySelect,
defaultValue,
time,
username,
} = props;
const key = props.listkey; const key = props.listkey;
console.log(props);
const name = props.list; const name = props.list;
// const single = props.single
// const checklist = props.checklist;
// const status = props.status;
// const communitySelect = props.communitySelect
// const defaultValue = props.defaultValue;
// const time = props.time;
// username 为 小区列表管理者名字筛选
const { single, checklist, status, communitySelect, defaultValue, time, username } = props;
const community = props.community; const community = props.community;
const [selectOptions, setSelectOptions] = useState(true); const [selectOptions, setSelectOptions] = useState(true);
const [communitys, setCommunitys] = useState(CommunityList); const [communitys, setCommunitys] = useState(CommunityList);
const [communitySingle, setCommunitySingle] = useState(null); const [datePicker, setDate] = useState(null as any);
const [datePicker, setDate] = useState(null);
const [form] = Form.useForm(); const [form] = Form.useForm();
...@@ -197,23 +192,9 @@ const TitleSearch = (props: any) => { ...@@ -197,23 +192,9 @@ const TitleSearch = (props: any) => {
); );
}; };
function mapStateToProps(state: any) { function mapStateToProps(state: any) {
// console.log("state参数",state)
const { CommunityList } = state.Init; const { CommunityList } = state.Init;
return { return {
CommunityList, CommunityList,
}; };
} }
export default connect(mapStateToProps)(TitleSearch); export default connect(mapStateToProps)(TitleSearch);
// time={["key","预订时间筛选"]}
// status = [{name:"status",data:["处理", "未处理"]}]
// listkey={['A', 'C']} list={['订单状态', '预订时间筛选']}
// <TitleSearch
// status={[{
// name: ["status", "订单状态"],
// data: [[0, "全部"], [1, "已申请"], [2, "已预订"], [3, "已使用"], [4, "已取消"]]
// }]}
// time={["key", "预订时间筛选"]}
// community={"communityName"}
// // single={true}
// onSubmit={CallBackTitleSearch} />
import * as service from '../services/PropertyManagementServices'; import * as service from '../services/PropertyManagementServices';
import { message } from 'antd';
import { routerRedux } from 'dva/router'
export default { export default {
namespace: 'PropertyManagement', namespace: 'PropertyManagement',
state: { state: {
Data: '', Data: null,
CurData:'', CurData: '',
}, },
reducers: { reducers: {
returnData(state, { Data }) { returnData(state: {}, { Data }: any) {
return { ...state, Data }; return { ...state, Data };
}, },
returnCurData(state, { CurData }) { returnCurData(state: {}, { CurData }: any) {
return { ...state, CurData }; return { ...state, CurData };
}, },
}, },
effects: { effects: {
//获取物业费列表 //获取物业费列表
*get({ playload }, { call, put }) { *get({ playload }: any, { call, put }: any) {
console.log(playload) console.log(playload);
const resp = yield call(service.get, playload); const resp = yield call(service.get, playload);
console.log(resp) console.log(resp);
let Data = resp.data.rows; let Data = resp.data;
yield put({ type: 'returnData', Data, }); yield put({ type: 'returnData', Data });
}, },
*getById({ playload }, { call, put }) { *getById({ playload }: any, { call, put }: any) {
let CurData = playload; let CurData = playload;
yield put({ type: 'returnCurData', CurData, }); yield put({ type: 'returnCurData', CurData });
}, },
}, },
}; };
...@@ -139,3 +139,15 @@ ...@@ -139,3 +139,15 @@
.box4 { .box4 {
padding-left: 200px; padding-left: 200px;
} }
.time1 {
position: absolute;
top: -60px;
left: 200px;
}
.time2 {
position: absolute;
top: -60px;
left: 285px;
}
...@@ -53,6 +53,8 @@ const ChargeDetail = (props: any) => { ...@@ -53,6 +53,8 @@ const ChargeDetail = (props: any) => {
/> />
<div className={styles.box2}> <div className={styles.box2}>
<div className={styles.time1}>uploadTime : </div>
<div className={styles.time2}>01-01-2020</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}>Street name</div>
...@@ -63,17 +65,19 @@ const ChargeDetail = (props: any) => { ...@@ -63,17 +65,19 @@ const ChargeDetail = (props: any) => {
<div className={styles.item26}>{CurData.roomNumber}</div> <div className={styles.item26}>{CurData.roomNumber}</div>
<div className={styles.item27}>业主姓名</div> <div className={styles.item27}>业主姓名</div>
</div> </div>
{/* <>{stringSplit(CurData.billFileUrl, 'm/cash')}</> */} <>{stringSplit(CurData.billFileUrl, 'm/cash')}</>
{/* <div className={styles.box4}> <div className={styles.box4}>
<Pagination simple defaultCurrent={curpage} total={pages * 10} onChange={pageChange} /> <Pagination simple defaultCurrent={curpage} total={pages * 10} onChange={pageChange} />
</div> */} </div>
<> <>
<Tooltip title={scale == 1.3 ? '点击放大查看' : '还原视图'}> <Tooltip title={scale == 1.3 ? '点击放大查看' : '还原视图'}>
<div className={scale == 1.3 ? styles.box3out : null}> <div className={scale == 1.3 ? styles.box3out : null}>
<div className={scale == 1.3 ? styles.box3 : styles.box3of} onClick={lookup}> <div className={scale == 1.3 ? styles.box3 : styles.box3of} onClick={lookup}>
<PDF <PDF
key="pdfjs" key="pdfjs"
file={stringSplit(CurData.billFileUrl, 'm/cash')} file={
'data:application/pdf;base64,' + stringSplit(CurData.billFileUrl, 'm/cash')
}
workerSrc="//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.2.228/pdf.worker.js" workerSrc="//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.2.228/pdf.worker.js"
scale={scale} scale={scale}
page={curpage} page={curpage}
......
...@@ -8,40 +8,28 @@ import { Link, useIntl, connect, Dispatch, history } from 'umi'; ...@@ -8,40 +8,28 @@ import { Link, useIntl, connect, Dispatch, history } from 'umi';
import { timestampToTime } from '../../utils/time'; import { timestampToTime } from '../../utils/time';
import { values } from 'lodash'; import { values } from 'lodash';
import { filterObj, urlEncode } from '@/utils/method';
import TitleSearch from '../../components/TitleSearch/TitleSearch'; import TitleSearch from '../../components/TitleSearch/TitleSearch';
let readyData: object = {
tosOwnerName: '',
communityName: '',
pageNum: 1,
};
const ChargeManager = (props: any) => { const ChargeManager = (props: any) => {
const { formatMessage } = useIntl();
const { dispatch, location, Data } = props; const { dispatch, location, Data } = props;
const get = (values: any) => { const { formatMessage } = useIntl();
dispatch({ type: 'PropertyManagement/get', playload: values });
};
const getById = (values: any) => {
dispatch({ type: 'PropertyManagement/getById', playload: values });
};
useEffect(() => {
get(null);
}, []);
const nameofowner = formatMessage({ id: 'R.charge.input.nameofowner' });
const inputProject = formatMessage({ id: 'R.charge.input.project' });
const username = formatMessage({ id: 'R.charge.username' }); const username = formatMessage({ id: 'R.charge.username' });
const project = formatMessage({ id: 'R.charge.project' }); const project = formatMessage({ id: 'R.charge.project' });
const unit = formatMessage({ id: 'R.charge.unit' }); const unit = formatMessage({ id: 'R.charge.unit' });
const status = formatMessage({ id: 'R.charge.status' });
const submissionTime = formatMessage({ id: 'R.charge.submissionTime' }); const submissionTime = formatMessage({ id: 'R.charge.submissionTime' });
const actions = formatMessage({ id: 'R.charge.actions' }); const actions = formatMessage({ id: 'R.charge.actions' });
const search = formatMessage({ id: 'R.charge.search' });
const addaccount = formatMessage({ id: 'R.charge.addaccount' }); const addaccount = formatMessage({ id: 'R.charge.addaccount' });
const paymentsetting = formatMessage({ id: 'R.charge.paymentsetting' });
const menuListNormal = ['A', 'Accounting company'];
const [display, setDisplay] = useState('A'); //小组件:线框
const pagination = { const [loading, setLoading] = useState(false);
defaultCurrent: 15,
total: 16,
};
const goToDetail = (values: any) => { const goToDetail = (values: any) => {
getById(values); getById(values);
...@@ -50,6 +38,55 @@ const ChargeManager = (props: any) => { ...@@ -50,6 +38,55 @@ const ChargeManager = (props: any) => {
const goToAddAccout = () => { const goToAddAccout = () => {
history.push(location.pathname + '/AccoutingDetail'); history.push(location.pathname + '/AccoutingDetail');
}; };
const getById = (values: any) => {
dispatch({ type: 'PropertyManagement/getById', playload: values });
};
const get = (values: any) => {
dispatch({ type: 'PropertyManagement/get', playload: values });
};
useEffect(() => {
if (location.query) {
readyData = {
...readyData,
...location.query,
};
setLoading(true);
get({
...readyData,
});
}
}, [location]);
useEffect(() => {
if (Data != null) {
console.log(Data);
setLoading(false);
}
}, [Data]);
const TitleSearchContent = (comment: any) => {
history.push(
location.pathname +
urlEncode(
filterObj({
...comment,
pageNum: 1,
}),
),
);
};
const changePage = (values: any) => {
let tmp = {
...location.query,
pageNum: values.current,
};
history.push(location.pathname + urlEncode(filterObj(tmp)));
};
const columns = [ const columns = [
{ title: username, dataIndex: 'tosOwnerName' }, { title: username, dataIndex: 'tosOwnerName' },
{ title: project, dataIndex: 'communityName' }, { title: project, dataIndex: 'communityName' },
...@@ -69,20 +106,25 @@ const ChargeManager = (props: any) => { ...@@ -69,20 +106,25 @@ const ChargeManager = (props: any) => {
), ),
}, },
]; ];
const TitleSearchContent = (comment: any) => {
console.log(comment); const pagination = {
defaultPageSize: 15,
total: Data && Data.page.totalRow,
showSizeChanger: false,
}; };
return ( return (
<div className={styles.base}> <div className={styles.base}>
<TitleSearch <TitleSearch
listkey={['tosOwnerName', 'communityName']} listkey={['tosOwnerName', 'communityName']}
list={['tosOwnerName', 'communityName']} list={['tosOwnerName', 'communityName']}
onSubmit={TitleSearchContent} onSubmit={TitleSearchContent}
defaultValue={{ ...readyData }}
/> />
{/* 内容组件 */} {/* 内容组件 */}
<div className={styles.box2}> <div className={styles.box2}>
{menuListNormal.map((item, index) => { {/* {menuListNormal.map((item, index) => {
return ( return (
<button <button
key={'bt' + index} key={'bt' + index}
...@@ -94,20 +136,22 @@ const ChargeManager = (props: any) => { ...@@ -94,20 +136,22 @@ const ChargeManager = (props: any) => {
{item} {item}
</button> </button>
); );
})} })} */}
<button className={styles.buttonAdd2} onClick={goToAddAccout}> <button className={styles.buttonAdd} onClick={goToAddAccout}>
+ {addaccount}{' '} + {addaccount}{' '}
</button> </button>
<button className={styles.buttonAdd}>{paymentsetting}</button> {/* <button className={styles.buttonAdd}>{paymentsetting}</button> */}
</div> </div>
{/* 列表组件 */} {/* 列表组件 */}
<Table <Table
style={{ marginTop: 16 }} style={{ marginTop: 16 }}
rowKey={'id'} rowKey={'id'}
dataSource={Data} loading={loading}
dataSource={Data != null ? Data.list : []}
columns={columns} columns={columns}
pagination={pagination} pagination={pagination}
onChange={changePage}
/> />
</div> </div>
); );
......
...@@ -8,64 +8,86 @@ import { Link, useIntl, connect, Dispatch, history } from 'umi'; ...@@ -8,64 +8,86 @@ import { Link, useIntl, connect, Dispatch, history } from 'umi';
import TitleSearch from '../../../components/TitleSearch/TitleSearch'; import TitleSearch from '../../../components/TitleSearch/TitleSearch';
import { timestampToTime } from '../../../utils/time'; import { timestampToTime } from '../../../utils/time';
import { PAGE, RA, URLCLEAR, getCookie, DataClear, URL, filterObjbyTg, urlEncode, filterObj } from '@/utils/method'; import {
PAGE,
RA,
URLCLEAR,
getCookie,
DataClear,
URL,
filterObjbyTg,
urlEncode,
filterObj,
} from '@/utils/method';
import PageData from '@/models/Common/PageData'; import PageData from '@/models/Common/PageData';
const module = "User" const module = 'User';
const module2 = "History" const module2 = 'History';
const module3 = "PageData" const module3 = 'PageData';
// const string2mean = [[0, "未注册"], [1, "注册"], [2, "注销"]]
const string2mean = [
[0, 'Unregistered'],
[1, 'Registered'],
[2, 'Deregistered'],
];
// 筛选条件对象
let readyData: any = {
pageNum: 1,
owerName: '',
communityArray: [],
};
// 节流阀
let flag: boolean = false;
const Users = (props: any) => { const Users = (props: any) => {
const { formatMessage } = useIntl(); const { formatMessage } = useIntl();
const { dispatch, location, Data, CommunityList, pageData, history_url } = props; const { dispatch, location, Data, CommunityList, pageData, history_url } = props;
const SA = (values: any) => { dispatch({ type: 'User/SA', playload: values }) }; const SA = (values: any) => {
dispatch({ type: 'User/SA', playload: values });
const nameofowner = formatMessage({ id: 'R.charge.input.nameofowner' }) };
const inputProject = formatMessage({ id: 'R.charge.input.project' })
const username = formatMessage({ id: 'R.charge.username' })
const project = formatMessage({ id: 'R.charge.project' })
const unit = formatMessage({ id: 'R.charge.unit' })
const status = formatMessage({ id: 'R.charge.status' })
const submissionTime = formatMessage({ id: 'R.charge.submissionTime' })
const actions = formatMessage({ id: 'R.charge.actions' })
const search = formatMessage({ id: 'R.charge.search' })
const addaccount = formatMessage({ id: 'R.charge.addaccount' })
const paymentsetting = formatMessage({ id: 'R.charge.paymentsetting' })
// const string2mean = [[0, "未注册"], [1, "注册"], [2, "注销"]]
const string2mean = [[0, "Unregistered"], [1, "Registered"], [2, "Deregistered"]]
const [curString, setCurString] = useState({ defaultCurrent: 1 })
const [loading, setLoading] = useState(false)
const [fileUploading, setFileUploading] = useState(false)
const [compent, setCompent] = useState({ loading: false, fileUploading: false }) const username = formatMessage({ id: 'R.charge.username' });
const [pageStart, setPageStart] = useState(false) const project = formatMessage({ id: 'R.charge.project' });
const unit = formatMessage({ id: 'R.charge.unit' });
const status = formatMessage({ id: 'R.charge.status' });
const submissionTime = formatMessage({ id: 'R.charge.submissionTime' });
const actions = formatMessage({ id: 'R.charge.actions' });
const [TestData, setTestData] = useState({}) const [loading, setLoading] = useState(false);
// 存储当前页码 const [fileUploading, setFileUploading] = useState(false);
const [pageNum, setPageNum] = useState(1) const [compent, setCompent] = useState({ loading: false, fileUploading: false });
// 存储小区筛选条件
const [readyData, setReadyData] = useState(null as any)
// 表格模块 // 表格模块
const columns = [ const columns = [
{ title: username, dataIndex: 'owerName', }, { title: username, dataIndex: 'owerName' },
{ title: project, dataIndex: 'communityName', }, { title: project, dataIndex: 'communityName' },
// { title: project, dataIndex: 'unit', }, {
// { title: unit, dataIndex: 'living', }, title: unit,
{ title: unit, render: (text: any, record: any) => (<div>{record.buildingNumber + "#" + record.floorNumber + "—" + record.roomNumber}</div>) }, render: (text: any, record: any) => (
{ title: status, dataIndex: 'enable', render: (text: any, record: any) => (<div>{string2mean[text][1]}</div>) }, <div>{record.buildingNumber + '#' + record.floorNumber + '—' + record.roomNumber}</div>
{ title: submissionTime, render: (text: any, record: any) => (<div>{timestampToTime(record.createTime.time)}</div>) }, ),
},
{
title: status,
dataIndex: 'enable',
render: (text: any, record: any) => <div>{string2mean[text][1]}</div>,
},
{
title: submissionTime,
render: (text: any, record: any) => <div>{timestampToTime(record.createTime.time)}</div>,
},
{ {
title: actions, title: actions,
render: (text: any, record: any) => ( render: (text: any, record: any) => (
<Space size="middle"> <Space size="middle">
<a onClick={goToEdit.bind(this, record)} disabled={record.enable == 2 ? true : false}>Edit</a> <a onClick={goToEdit.bind(this, record)} disabled={record.enable == 2 ? true : false}>
Edit
</a>
<a onClick={goToDetail.bind(this, record)}>Detail</a> <a onClick={goToDetail.bind(this, record)}>Detail</a>
</Space> </Space>
), ),
...@@ -75,132 +97,156 @@ const Users = (props: any) => { ...@@ -75,132 +97,156 @@ const Users = (props: any) => {
// 上传的模块 // 上传的模块
const propsUpload = { const propsUpload = {
name: 'file', name: 'file',
action: () => { return "http://47.74.233.180:8651/tos/excel/upload?userId=" + getCookie("id") }, action: () => {
return 'http://47.74.233.180:8651/tos/excel/upload?userId=' + getCookie('id');
},
beforeUpload: (file: any) => { beforeUpload: (file: any) => {
if (file.type !== "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") { if (file.type !== 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') {
message.error(`${file.name} file format is incorrect!`); message.error(`${file.name} file format is incorrect!`);
} }
return file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; return file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
}, },
onChange(info: any) { onChange(info: any) {
if (info.file.status == 'uploading') { if (info.file.status == 'uploading') {
setFileUploading(true) setFileUploading(true);
} }
if (info.file.status === 'done') { if (info.file.status === 'done') {
if (info.file.response.error_code == "0000") { if (info.file.response.error_code == '0000') {
history.push(location.pathname + "/Result") history.push(location.pathname + '/Result');
} else { } else {
history.push(location.pathname + "/ResultFailed") history.push(location.pathname + '/ResultFailed');
message.error(`${info.file.name} file upload failed.` + 'failed count is ' + info.file.response.data.count); message.error(
setFileUploading(false) `${info.file.name} file upload failed.` +
'failed count is ' +
info.file.response.data.count,
);
setFileUploading(false);
} }
} else if (info.file.status === 'error') { } else if (info.file.status === 'error') {
message.error(`${info.file.name} file upload failed.`); message.error(`${info.file.name} file upload failed.`);
setFileUploading(false) setFileUploading(false);
} }
}, },
showUploadList: false, showUploadList: false,
} };
// 判断数据是否回来 // 监听路由变化更新数据
useEffect(() => { useEffect(() => {
if (Data != null) { if (location.query) {
setLoading(false) readyData = {
...readyData,
...location.query,
};
} }
}, [Data])
useEffect(() => { if (CommunityList && flag === false) {
if (location.query.owerName) { flag = true;
setTestData({ getList(CommunityList);
OwnerName: location.query.owerName
})
} }
setPageNum(parseInt(location.query.pageNum) || 1) }, [location]);
setLoading(true) // 监听小区列表是否回来
useEffect(() => {
if (CommunityList && flag === false) {
flag = true;
getList(CommunityList);
}
}, [CommunityList]);
// 请求拿取数据
const getList = (CommunityList: []) => {
if (readyData.communityArray.length === 0) {
readyData.communityArray = CommunityList;
}
setLoading(true);
//获取数据 //获取数据
RA(12, { RA(
owerName: location.query.owerName !== undefined ? (location.query.owerName) : null, 12,
communityArray: (readyData === null || readyData.length === 0) ? CommunityList : readyData, {
pageNum: location.query.pageNum || 1 ...readyData,
}, module, dispatch); },
module,
dispatch,
);
};
}, [location]) // 判断数据是否回来
useEffect(() => {
if (Data != null) {
flag = false;
setLoading(false);
}
}, [Data]);
const goToDetail = (values: any, e: any) => { const goToDetail = (values: any, e: any) => {
SA(values) SA(values);
PAGE(readyData, module3, dispatch)//保存页面参数 history.push(location.pathname + '/Detail');
history.push(location.pathname + '/Detail') };
}
const goToEdit = (values: any, e: any) => { const goToEdit = (values: any, e: any) => {
SA(values) SA(values);
PAGE(readyData, module3, dispatch) URL({ pathname: location.pathname + '/Edit', status: 1 }, module2, dispatch);
URL({ pathname: location.pathname + '/Edit', status: 1 }, module2, dispatch) history.push(location.pathname + '/Edit');
history.push(location.pathname + '/Edit') };
}
const goToAdd = () => { const goToAdd = () => {
URL({ pathname: location.pathname + '/Add', status: 1 }, module2, dispatch) URL({ pathname: location.pathname + '/Add', status: 1 }, module2, dispatch);
history.push(location.pathname + '/Add') history.push(location.pathname + '/Add');
} };
// LIFE用户管理页面的搜索按钮 // LIFE用户管理页面的搜索按钮
const CallBackTitleSearch = (comment: any) => { const CallBackTitleSearch = (comment: any) => {
console.log(comment);
// 将筛选条件存储起来 readyData.communityArray = comment.serviceCommunityList;
setReadyData(comment.serviceCommunityList)
setPageNum(1)
/*页面跳转*/ /*页面跳转*/
if (comment.OwnerName) { history.push(
history.push(location.pathname + urlEncode(filterObj({ location.pathname +
owerName: comment.OwnerName, urlEncode(
pageNum: 1, filterObj({
}))) owerName: comment.OwnerName,
} else { pageNum: 1,
history.push(location.pathname + urlEncode(filterObj({ }),
pageNum: 1, ),
}))) );
} };
}
// 切换页码
const pageChange = (values: any) => { const pageChange = (values: any) => {
// 将当前页码存储起来 // 将当前页码存储起来
setPageNum(values.current) var tmp = filterObjbyTg(location.query, ['owerName']);
tmp['pageNum'] = values.current;
/*页面跳转*/ history.push(location.pathname + urlEncode(tmp));
var tmp = filterObjbyTg(location.query, []) };
tmp["pageNum"] = values.current
location.query.owerName ? tmp["owerName"] = location.query.owerName : null
history.push(location.pathname + urlEncode(tmp))
}
return ( return (
<div className={styles.base}> <div className={styles.base}>
{/* 头部组件 */} {/* 头部组件 */}
<TitleSearch <TitleSearch
listkey={["OwnerName"]} listkey={['OwnerName']}
list={["Owner Name"]} list={['Owner Name']}
community={"serviceCommunityList"} community={'serviceCommunityList'}
onSubmit={CallBackTitleSearch} onSubmit={CallBackTitleSearch}
defaultValue={TestData} defaultValue={{ OwnerName: readyData.owerName }}
checklist={pageData} checklist={readyData.communityArray.length !== 0 ? readyData.communityArray : null}
/> />
{/* 内容组件 */} {/* 内容组件 */}
<div className={styles.box2}> <div className={styles.box2}>
<button className={styles.buttonAdd2} onClick={goToAdd}>Create New Owner</button> <button className={styles.buttonAdd2} onClick={goToAdd}>
<div className={styles.buttonAdd} > Create New Owner
</button>
<div className={styles.buttonAdd}>
<Upload {...propsUpload}> <Upload {...propsUpload}>
<Button icon={compent.fileUploading ? null : <UploadOutlined />}> <Button icon={compent.fileUploading ? null : <UploadOutlined />}>
{compent.fileUploading ? {compent.fileUploading ? (
<> <>
<Spin indicator={<LoadingOutlined style={{ fontSize: 16 }} spin />} /> <Spin indicator={<LoadingOutlined style={{ fontSize: 16 }} spin />} />
Uploading Uploading
</> </>
: "Batch Upload"} ) : (
'Batch Upload'
)}
</Button> </Button>
</Upload> </Upload>
</div> </div>
...@@ -208,25 +254,31 @@ const Users = (props: any) => { ...@@ -208,25 +254,31 @@ const Users = (props: any) => {
{/* 列表组件 */} {/* 列表组件 */}
<Table <Table
rowKey={"id"} rowKey={'id'}
loading={loading} loading={loading}
style={{ marginTop: 16 }} style={{ marginTop: 16 }}
dataSource={Data != null ? Data.data.list : []} dataSource={Data != null ? Data.data.list : []}
columns={columns} columns={columns}
pagination={Data != null ? { current: pageNum, total: Data.data.page.totalRow, showSizeChanger: false, pageSize: Data.data.page.curPageSize } : {}} pagination={
onChange={pageChange} /> Data != null
? {
current: readyData.pageNum,
total: Data.data.page.totalRow,
showSizeChanger: false,
pageSize: Data.data.page.curPageSize,
}
: {}
}
onChange={pageChange}
/>
</div> </div>
); );
}; };
function mapStateToProps(state: any) { function mapStateToProps(state: any) {
const { sourceData, DataSave, Data } = state.User;
const { sourceData, DataSave, Data, } = state.User;
const { history_url } = state.History; const { history_url } = state.History;
const { pageData } = state.PageData; const { pageData } = state.PageData;
const { token } = state.login;
const { CommunityList } = state.Init; const { CommunityList } = state.Init;
return { return {
Data, Data,
...@@ -234,12 +286,8 @@ function mapStateToProps(state: any) { ...@@ -234,12 +286,8 @@ function mapStateToProps(state: any) {
sourceData, sourceData,
pageData, pageData,
history_url, history_url,
// token
CommunityList, CommunityList,
}; };
} }
export default connect(mapStateToProps)(Users); export default connect(mapStateToProps)(Users);
...@@ -88,31 +88,57 @@ ...@@ -88,31 +88,57 @@
} }
.box2item3 { .box2item3 {
position: absolute; position: absolute;
left: 362px; top: -15px;
} }
.box2item4 { .box2item4 {
position: absolute; position: absolute;
left: 461px; left: 100px;
top: -10px;
} }
.box2item5 { .box2item5 {
position: absolute; position: absolute;
left: 475px; left: 115px;
top: -15px;
} }
.box2item6 { .box2item6 {
position: absolute; position: absolute;
left: 561px; left: 200px;
top: -10px;
} }
.box2item7 { .box2item7 {
position: absolute; position: absolute;
left: 583px; left: 230px;
top: -15px;
} }
.box3 { .box3 {
width: 100%; width: 100%;
height: 34px; height: 34px;
position: relative; position: relative;
z-index: 40;
} }
.box3item1 { .box3item1 {
padding-left: 146px; padding-left: 146px;
} }
.box5 {
position: absolute;
left: 370px;
width: 340px;
height: 60px;
&::after {
content: '';
width: 100%;
height: 100%;
position: absolute;
top: 55px;
left: 0;
z-index: 20;
background-color: #fff;
}
}
.ant-form-item-explain {
margin-top: 5px;
}
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import styles from './UsersAdd.less'; import styles from './UsersAdd.less';
import { Input, Menu, Table, Space, Pagination, Spin, Button, Form, Row, Col, message } from 'antd'; import { Input, Spin, Button, Form, message } from 'antd';
import { Link, useIntl, connect, Dispatch } from 'umi'; import { connect } from 'umi';
import Line from '../../../components/Line/Line'; import Line from '../../../components/Line/Line';
import TitleBack from '../../../components/TitleBack/TitleBack'; import TitleBack from '../../../components/TitleBack/TitleBack';
...@@ -10,9 +10,8 @@ import SearchOptionsCommnity from '../../../components/SearchOptions/SearchOptio ...@@ -10,9 +10,8 @@ import SearchOptionsCommnity from '../../../components/SearchOptions/SearchOptio
import { checkParam, RA } from '../../../utils/method'; import { checkParam, RA } from '../../../utils/method';
import { validateMessages } from '@/utils/params'; import { validateMessages } from '@/utils/params';
// import "./UsersAddInput.less"
const module = 'User'; const module = 'User';
let verifyNum = 0;
const UsersAdd = (props: any) => { const UsersAdd = (props: any) => {
const { dispatch, communityInfo } = props; const { dispatch, communityInfo } = props;
...@@ -22,13 +21,11 @@ const UsersAdd = (props: any) => { ...@@ -22,13 +21,11 @@ const UsersAdd = (props: any) => {
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const onFinish = (values: any) => { const onFinish = (values: any) => {
console.log(values);
if (postman.extend != null) { if (postman.extend != null) {
values.communityName = postman.extend; values.communityName = postman.extend;
} else { } else {
values.communityName = null; values.communityName = null;
} }
// var tmp = Object.keys(values);
if (checkParam(values)) { if (checkParam(values)) {
values.owerPhone = null; values.owerPhone = null;
values.owerEmail = null; values.owerEmail = null;
...@@ -46,9 +43,7 @@ const UsersAdd = (props: any) => { ...@@ -46,9 +43,7 @@ const UsersAdd = (props: any) => {
setPostman(tmp); setPostman(tmp);
}; };
useEffect(() => { useEffect(() => {
console.log(communityInfo);
if (communityInfo != null) { if (communityInfo != null) {
console.log(communityInfo);
if (postman.extend != null) { if (postman.extend != null) {
formRef.current.setFieldsValue({ formRef.current.setFieldsValue({
addressAndpostalCode: addressAndpostalCode:
...@@ -61,7 +56,6 @@ const UsersAdd = (props: any) => { ...@@ -61,7 +56,6 @@ const UsersAdd = (props: any) => {
}, [communityInfo]); }, [communityInfo]);
const checkData = (rule: any, value: any, callback: any) => { const checkData = (rule: any, value: any, callback: any) => {
console.log(rule, value);
if (value) { if (value) {
if (/^[a-zA-Z0-9]+$/g.test(value)) { if (/^[a-zA-Z0-9]+$/g.test(value)) {
callback(); callback();
...@@ -97,21 +91,27 @@ const UsersAdd = (props: any) => { ...@@ -97,21 +91,27 @@ const UsersAdd = (props: any) => {
<div className={styles.box2item2}> <div className={styles.box2item2}>
<SearchOptionsCommnity alone={true} opname={extendName} /> <SearchOptionsCommnity alone={true} opname={extendName} />
</div> </div>
<div className={styles.box2item3}> <div className={styles.box5}>
<Form.Item name="buildingNumber" rules={[{ validator: checkData }]}> <Form.Item>
<Input placeholder="Building" style={{ width: 94 }} /> <Input.Group>
</Form.Item> <div className={styles.box2item3}>
</div> <Form.Item name="buildingNumber" noStyle rules={[{ validator: checkData }]}>
<div className={styles.box2item4}>#</div> <Input placeholder="Building" style={{ width: 94 }} />
<div className={styles.box2item5}> </Form.Item>
<Form.Item name="floorNumber" rules={[{ validator: checkData }]}> </div>
<Input placeholder="Floor" style={{ width: 80 }} /> <div className={styles.box2item4}>#</div>
</Form.Item> <div className={styles.box2item5}>
</div> <Form.Item name="floorNumber" noStyle rules={[{ validator: checkData }]}>
<div className={styles.box2item6}>——</div> <Input placeholder="Floor" style={{ width: 80 }} />
<div className={styles.box2item7}> </Form.Item>
<Form.Item name="roomNumber" rules={[{ validator: checkData }]}> </div>
<Input placeholder="Room" style={{ width: 112 }} /> <div className={styles.box2item6}>——</div>
<div className={styles.box2item7}>
<Form.Item name="roomNumber" noStyle rules={[{ validator: checkData }]}>
<Input placeholder="Room" style={{ width: 112 }} />
</Form.Item>
</div>
</Input.Group>
</Form.Item> </Form.Item>
</div> </div>
</div> </div>
...@@ -148,11 +148,3 @@ function mapStateToProps(state: any) { ...@@ -148,11 +148,3 @@ function mapStateToProps(state: any) {
}; };
} }
export default connect(mapStateToProps)(UsersAdd); export default connect(mapStateToProps)(UsersAdd);
// "owerName":"孟浩",
// "owerPhone":"18813787878",
// "owerEmail":"sale@huahuico.com",
// "communityName":"A7",
// "buildingNumber":"A1",
// "floorNumber":"11",
// "roomNumber":"388",
// "addressAndpostalCode":"工业大道3689561"
...@@ -8,68 +8,83 @@ import SelectOptions from '../../../components/SelectOptions/index'; ...@@ -8,68 +8,83 @@ import SelectOptions from '../../../components/SelectOptions/index';
import TitleBack from '../../../components/TitleBack/TitleBack'; import TitleBack from '../../../components/TitleBack/TitleBack';
import { RA } from '@/utils/method'; import { RA } from '@/utils/method';
const module = "User" const module = 'User';
let options: Array<{}> = [];
const Edit = (props: any) => { const Edit = (props: any) => {
const { dispatch, CurData, SaveChooseData, location, CommunityList, DataServices } = props; const { dispatch, CurData, SaveChooseData, location, CommunityList, DataServices } = props;
const TosTosServiceProviderSave = (values: any) => { dispatch({ type: 'ServiceProvider/TosTosServiceProviderSave', playload: values }) }; const TosTosServiceProviderSave = (values: any) => {
dispatch({ type: 'ServiceProvider/TosTosServiceProviderSave', playload: values });
};
const [CList, setCList] = useState(CommunityList); const [CList, setCList] = useState(CommunityList);
const [SList, setSList] = useState(["1"])
const [load, setload] = useState(false)
const printContent = (List: any) => { setCList(List) } const [load, setload] = useState(false);
const formRef = useRef(null);
const printContent = (List: any) => {
setCList(List);
};
const formRef = useRef(null as any);
useEffect(() => { useEffect(() => {
console.log(SaveChooseData) RA(43, {}, module, dispatch);
RA(43, { serviceName: "" }, module, dispatch)
}, []); }, []);
useEffect(() => { useEffect(() => {
if (DataServices != null) { if (DataServices != null) {
var tmp = DataServices.data.serviceScopeList;
options = tmp.map((v: string, i: number) => {
return {
label: v,
value: i.toString(),
};
});
}
}, [DataServices]);
console.log(DataServices) useEffect(() => {
var tmp = DataServices.data.serviceScopeList if (SaveChooseData != null) {
console.log(SaveChooseData);
console.log(tmp) console.log(options);
let arr: [] = [];
if (SaveChooseData != null) { SaveChooseData.serviceScopeList.forEach((v: any) => {
formRef.current.setFieldsValue(SaveChooseData) options.forEach((ele: any) => {
} if (v === ele.label) {
arr.push(ele.value as never);
}
});
});
SaveChooseData.serviceScopeList = arr;
formRef.current.setFieldsValue(SaveChooseData);
} }
}, [DataServices]) }, [SaveChooseData]);
const onFinish = (values: any) => { const onFinish = (values: any) => {
var val = values var val = values;
val.serviceCommunityList = CList val.serviceCommunityList = CList;
// val.serviceScopeList = SList val.creator = 'admin';
val.creator = "admin"; val.updater = 'admin';
val.updater = "admin"; setload(true);
setload(true) TosTosServiceProviderSave(val);
TosTosServiceProviderSave(val)
};
const onFinishFailed = (errorInfo: any) => {
console.log('Failed:', errorInfo)
}; };
return ( return (
<div className={styles.base}> <div className={styles.base}>
{/* 头部组件v1.2 */} {/* 头部组件v1.2 */}
<TitleBack title="Edit Service Provider" /> <TitleBack title="Edit Service Provider" />
<Form ref={formRef} name="basic" onFinish={onFinish} onFinishFailed={onFinishFailed}> <Form ref={formRef} name="basic" onFinish={onFinish}>
<Spin spinning={load} tip="In the submission,Please Wait..."> <Spin spinning={load} tip="In the submission,Please Wait...">
<div className={styles.box1}> <div className={styles.box1}>
<div className={styles.box1item1}>Company Name</div> <div className={styles.box1item1}>Company Name</div>
<div className={styles.box1item2}> <div className={styles.box1item2}>
<Form.Item name="providerName" <Form.Item
rules={[{ name="providerName"
required: true, rules={[
message: "Please enter the company name!" {
}]} required: true,
message: 'Please enter the company name!',
},
]}
> >
<Input style={{ width: 260 }} placeholder="Please enter company name" /> <Input style={{ width: 260 }} placeholder="Please enter company name" />
</Form.Item> </Form.Item>
...@@ -78,10 +93,12 @@ const Edit = (props: any) => { ...@@ -78,10 +93,12 @@ const Edit = (props: any) => {
<div className={styles.box1item4}> <div className={styles.box1item4}>
<Form.Item <Form.Item
name="providerAddress" name="providerAddress"
rules={[{ rules={[
required: true, {
message: "Please enter your office address!" required: true,
}]} message: 'Please enter your office address!',
},
]}
> >
<Input style={{ width: 200 }} placeholder="Single Line Input" /> <Input style={{ width: 200 }} placeholder="Single Line Input" />
</Form.Item> </Form.Item>
...@@ -90,19 +107,25 @@ const Edit = (props: any) => { ...@@ -90,19 +107,25 @@ const Edit = (props: any) => {
<div className={styles.line}></div> <div className={styles.line}></div>
<SelectOptions list={CommunityList.sort()} checklist={SaveChooseData != null ? SaveChooseData.serviceCommunityList : null} onSubmit={printContent} /> <SelectOptions
list={CommunityList ? CommunityList.sort() : []}
checklist={SaveChooseData != null ? SaveChooseData.serviceCommunityList : null}
onSubmit={printContent}
/>
<div className={styles.box2}> <div className={styles.box2}>
<div className={styles.box2item1}>Services Available</div> <div className={styles.box2item1}>Services Available</div>
<div className={styles.box2item2}> <div className={styles.box2item2}>
<Form.Item <Form.Item
name="serviceScopeList" name="serviceScopeList"
rules={[{ rules={[
required: true, {
message: "Please select at least one service available!" required: true,
}]} message: 'Please select at least one service available!',
},
]}
> >
<Checkbox.Group options={DataServices != null ? DataServices.data.serviceScopeList : null} /> <Checkbox.Group options={options as any} />
</Form.Item> </Form.Item>
</div> </div>
</div> </div>
...@@ -112,59 +135,63 @@ const Edit = (props: any) => { ...@@ -112,59 +135,63 @@ const Edit = (props: any) => {
<div className={styles.box3item2}> <div className={styles.box3item2}>
<Form.Item <Form.Item
name="contactName" name="contactName"
rules={[{ rules={[
required: true, {
message: "Please enter the name of the person in charge!" required: true,
}]} message: 'Please enter the name of the person in charge!',
},
]}
> >
<Input style={{ width: 200 }} <Input style={{ width: 200 }} placeholder="Please enter a name" />
placeholder="Please enter a name"
/>
</Form.Item> </Form.Item>
</div> </div>
</div> </div>
<div className={styles.box4}> <div className={styles.box4}>
<div className={styles.box4item1}>Contact Details</div> <div className={styles.box4item1}>Contact Details</div>
<div className={styles.box4item2}><Form.Item name="contactPhone"><Input style={{ width: 200 }} placeholder="Telephone" /></Form.Item></div> <div className={styles.box4item2}>
<Form.Item name="contactPhone">
<Input style={{ width: 200 }} placeholder="Telephone" />
</Form.Item>
</div>
<div className={styles.box4item3}> <div className={styles.box4item3}>
<Form.Item <Form.Item
name="contactEmail" name="contactEmail"
rules={[{ rules={[
required: true, {
type: "email", required: true,
message: "Please enter the correct email address!" type: 'email',
}]} message: 'Please enter the correct email address!',
},
]}
> >
<Input style={{ width: 200 }} placeholder="E-mail" /></Form.Item></div> <Input style={{ width: 200 }} placeholder="E-mail" />
</Form.Item>
</div>
</div> </div>
<div className={styles.line}></div> <div className={styles.line}></div>
<Form.Item> <Form.Item>
<Button type="primary" htmlType="submit">Submit</Button> <Button type="primary" htmlType="submit">
Submit
</Button>
</Form.Item> </Form.Item>
</Spin> </Spin>
</Form> </Form>
</div> </div>
); );
}; };
function mapStateToProps(state: any) { function mapStateToProps(state: any) {
const { CurData, SaveChooseData } = state.ServiceProvider; const { CurData, SaveChooseData } = state.ServiceProvider;
const { DataServices, } = state.User; const { DataServices } = state.User;
const { CommunityList } = state.Init; const { CommunityList } = state.Init;
return { return {
CurData, CurData,
SaveChooseData, SaveChooseData,
CommunityList, CommunityList,
DataServices DataServices,
}; };
} }
export default connect(mapStateToProps)(Edit); export default connect(mapStateToProps)(Edit);
...@@ -4,176 +4,243 @@ import styles from './index.less'; ...@@ -4,176 +4,243 @@ import styles from './index.less';
import { Form, Input, Spin, Table, Space, Button } from 'antd'; import { Form, Input, Spin, Table, Space, Button } from 'antd';
import { LoadingOutlined } from '@ant-design/icons'; import { LoadingOutlined } from '@ant-design/icons';
import { urlEncode, filterObj, filterObjbyTg } from '@/utils/method'; import { urlEncode, filterObj, filterObjbyTg, RA } from '@/utils/method';
import { Link, useIntl, connect, Dispatch, history } from 'umi'; import { Link, useIntl, connect, Dispatch, history } from 'umi';
import TitleSearch from '../../../components/TitleSearch/TitleSearch'; import TitleSearch from '../../../components/TitleSearch/TitleSearch';
import { TosSecurityGuarderGet } from '@/services/tos';
const module = 'User';
// 服务范围数据
let options: Array<[]> = [];
// 筛选参数
let readyData: any = {
pageNum: 1,
serviceCommunityList: [],
serviceScope: '',
providerName: '',
};
// 节流阀
let flag = false;
const ServiceProviderManagement = (props: any) => { const ServiceProviderManagement = (props: any) => {
const { formatMessage } = useIntl(); const [loading, setLoading] = useState(false);
const [pageNum, setPageNum] = useState(1)
const [loading, setLoading] = useState(false) const { dispatch, location, Data, CommunityList, DataServices } = props;
const [testData, setTestData] = useState(null as any); const SaveChooseData = (values: any) => {
dispatch({ type: 'ServiceProvider/SaveChooseData', playload: values });
const { dispatch, location, Data, CommunityList } = props;
const RA = (index: any, values: any) => { dispatch({ type: 'ServiceProvider/RA', playload: { index: index, body: values } }) };
const TosTosServiceProviderGet = (values: any) => {
dispatch({
type: 'ServiceProvider/TosTosServiceProviderGet',
playload: values
})
}; };
const SaveChooseData = (values: any) => { dispatch({ type: 'ServiceProvider/SaveChooseData', playload: values }) };
// const GetList = () => {
// if (CommunityList != null) {
// TosTosServiceProviderGet({
// providerName: "",
// serviceCommunityList: CommunityList
// })
// }
// }
// useEffect(() => {
// console.log(CommunityList)
// GetList()
// }, [CommunityList]);
const goToDetail = (values: any, e: any) => { const goToDetail = (values: any, e: any) => {
SaveChooseData(values) SaveChooseData(values);
history.push(location.pathname + '/Detail') history.push(location.pathname + '/Detail');
} };
const goToCreate = () => { const goToCreate = () => {
SaveChooseData(null) SaveChooseData(null);
history.push(location.pathname + '/Edit') history.push(location.pathname + '/Edit');
} };
const goToEdit = (values: any, e: any) => { const goToEdit = (values: any, e: any) => {
SaveChooseData(values) SaveChooseData(values);
history.push(location.pathname + '/Edit') history.push(location.pathname + '/Edit');
} };
const goToServices = () => { history.push(location.pathname + '/Services') } const goToServices = () => {
history.push(location.pathname + '/Services');
};
const columns = [ const columns = [
{ title: "Service Provider", dataIndex: 'providerName', }, { title: 'Service Provider', dataIndex: 'providerName' },
{ title: "contact Name", dataIndex: 'contactName', }, { title: 'contact Name', dataIndex: 'contactName' },
{ {
title: "Contacts", title: 'Contacts',
dataIndex: 'contactPhone', dataIndex: 'contactPhone',
}, },
/*{ title: "Contact Details",dataIndex: 'contactEmail',},*/
{ {
title: "Services Available", title: 'Services Available',
dataIndex: 'serviceScope', dataIndex: 'serviceScopeList',
render: (text: any, record: any) => {
let str: string = '';
text.forEach((v: string, i: number) => {
str += i === text.length - 1 ? v : v + ',';
});
return str;
},
}, },
{ title: "Account Status", dataIndex: 'enable', }, { title: 'Account Status', dataIndex: 'enable' },
{ {
title: "Actions", title: 'Actions',
render: (text: any, record: any) => ( render: (text: any, record: any) => (
<Space size="middle"><a onClick={goToDetail.bind(this, record)}>Detail</a><a onClick={goToEdit.bind(this, record)}>edit</a></Space> <Space size="middle">
<a onClick={goToDetail.bind(this, record)}>Detail</a>
<a onClick={goToEdit.bind(this, record)}>edit</a>
</Space>
), ),
}, },
]; ];
const dataSource = (values: any) => {
let tmp = values;
for (let items in tmp) {
switch (tmp[items].enable) {
case 0: tmp[items].enable = "unregistered"; break;
case 1: tmp[items].enable = "registered"; break;
case 2: break;
}
}
for (let items in tmp) {
switch (tmp[items].serviceScope) {
case 0: tmp[items].serviceScope = "清洁"; break;
case 1: tmp[items].serviceScope = "维修"; break;
case 2: tmp[items].serviceScope = "保安"; break;
case 3: tmp[items].serviceScope = "会计"; break;
}
}
return tmp; // 拿取服务商列表
} useEffect(() => {
RA(43, {}, module, dispatch);
}, []);
useEffect(() => { useEffect(() => {
if (Data != null) { if (DataServices) {
setLoading(false) options = DataServices.data.serviceScopeList.map((v: string, i: number) => {
console.log("核查的地方") return [i, v];
console.log(Data) });
}
}, [DataServices]);
// 请求
const TosTosServiceProviderGet = () => {
if (readyData.serviceCommunityList.length === 0) {
readyData.serviceCommunityList = CommunityList;
} }
}, [Data]) dispatch({
type: 'ServiceProvider/TosTosServiceProviderGet',
playload: { ...readyData },
});
};
// 监听路由url
useEffect(() => { useEffect(() => {
if (location.query) {
readyData = {
...readyData,
...location.query,
};
}
setPageNum(1) if (CommunityList && flag === false) {
setLoading(true) flag = true;
TosTosServiceProviderGet({ setLoading(true);
...location.query, TosTosServiceProviderGet();
serviceCommunityList: (testData === null || testData.length === 0) ? CommunityList : testData, }
pageNum: 1 }, [location]);
})
// 监听小区数据
useEffect(() => {
if (CommunityList && flag === false) {
flag = true;
setLoading(true);
TosTosServiceProviderGet();
}
}, [CommunityList]);
}, [location]) // 数据核查
useEffect(() => {
if (Data != null) {
flag = false;
setLoading(false);
}
}, [Data]);
//页面搜索
const CallBackTitleSearch = (comment: any) => { const CallBackTitleSearch = (comment: any) => {
console.log(comment) readyData.serviceCommunityList = comment.serviceCommunityList;
console.log(location.pathname) history.push(
location.pathname +
//页面搜索 urlEncode(
setTestData(comment.serviceCommunityList) filterObj({
history.push(location.pathname + urlEncode(filterObj({ providerName: comment.providerName,
providerName: comment.providerName, serviceScope: comment.status,
serviceScope: comment.status, pageNum: 1,
pageNum: location.query.pageNum || 1 }),
}))) ),
} );
};
// 切换页码
const pageChange = (values: any) => { const pageChange = (values: any) => {
// setPageNum(values.current) let tmp = filterObjbyTg(location.query, ['providerName', 'serviceScope']);
console.log(values) tmp['pageNum'] = values.current;
/*页面跳转*/ history.push(location.pathname + urlEncode(tmp));
var tmp = filterObjbyTg(location.query, []) };
tmp["pageNum"] = values.current
history.push(location.pathname + urlEncode(tmp))
}
// 数据处理
const dataSource = (values: any) => {
let tmp = values;
for (let items in tmp) {
switch (tmp[items].enable) {
case 0:
tmp[items].enable = 'unregistered';
break;
case 1:
tmp[items].enable = 'registered';
break;
case 2:
break;
}
}
for (let items in tmp) {
for (let items1 in tmp[items].serviceScopeList) {
switch (tmp[items].serviceScopeList[items1]) {
case '0':
tmp[items].serviceScopeList[items1] = '保安';
break;
case '1':
tmp[items].serviceScopeList[items1] = '会计';
break;
case '2':
tmp[items].serviceScopeList[items1] = '维修';
break;
case '3':
tmp[items].serviceScopeList[items1] = '清洁';
break;
}
}
}
return tmp;
};
// table组件配置
const pagination = { const pagination = {
current: pageNum, current: readyData.pageNum,
total: Data !== null ? Data.page.totalRow : null, total: Data !== null ? Data.page.totalRow : null,
showSizeChanger: false showSizeChanger: false,
} };
return ( return (
<div className={styles.base}> <div className={styles.base}>
{/* 头部组件 */} {/* 头部组件 */}
<TitleSearch <TitleSearch
listkey={["providerName"]} listkey={['providerName']}
list={["Service Provider"]} list={['Service Provider']}
status={[{ status={[
name: ["status", "服务范围"], {
data: [[null, "全部"], [0, "清洁"], [1, "维修"], [2, "保安"], [3, "会计"]] name: ['status', '服务范围'],
}]} data: [[null, '全部'], ...options],
community={"serviceCommunityList"} },
onSubmit={CallBackTitleSearch} /> ]}
community={'serviceCommunityList'}
onSubmit={CallBackTitleSearch}
defaultValue={{
providerName: readyData.providerName,
status: readyData.serviceScope ? parseInt(readyData.serviceScope) : undefined,
}}
checklist={
readyData.serviceCommunityList.length !== 0 ? readyData.serviceCommunityList : null
}
/>
{/* 内容组件 */} {/* 内容组件 */}
<div className={styles.box2}> <div className={styles.box2}>
<button className={styles.buttonAdd2} onClick={goToServices}>Avail Services</button> <button className={styles.buttonAdd2} onClick={goToServices}>
<button className={styles.buttonAdd} onClick={goToCreate}>Create New</button> Avail Services
</button>
<button className={styles.buttonAdd} onClick={goToCreate}>
Create New
</button>
</div> </div>
{/* 列表组件 */} {/* 列表组件 */}
<Spin spinning={Data != null ? false : true}> <Spin spinning={Data != null ? false : true}>
<Table size="small" rowKey={"id"} <Table
size="small"
rowKey={'id'}
style={{ marginTop: 16 }} style={{ marginTop: 16 }}
loading={loading} loading={loading}
columns={columns} columns={columns}
...@@ -182,20 +249,19 @@ const ServiceProviderManagement = (props: any) => { ...@@ -182,20 +249,19 @@ const ServiceProviderManagement = (props: any) => {
onChange={pageChange} onChange={pageChange}
/> />
</Spin> </Spin>
</div> </div>
); );
}; };
function mapStateToProps(state: any) { function mapStateToProps(state: any) {
const { Data } = state.ServiceProvider; const { Data } = state.ServiceProvider;
const { DataProvider } = state.User; const { DataProvider, DataServices } = state.User;
const { CommunityList } = state.Init; const { CommunityList } = state.Init;
return { return {
Data, Data,
DataProvider, DataProvider,
CommunityList CommunityList,
DataServices,
}; };
} }
......
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