Commit f4c7c6cc authored by cellee's avatar cellee

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

parents 2b7a1dde a2888ae6
...@@ -375,6 +375,9 @@ export default defineConfig({ ...@@ -375,6 +375,9 @@ export default defineConfig({
{ {
component: './404', component: './404',
}, },
{
component: './403',
},
], ],
// Theme for antd: https://ant.design/docs/react/customize-theme-cn // Theme for antd: https://ant.design/docs/react/customize-theme-cn
......
...@@ -124,9 +124,9 @@ const PictureOptionsRow = (props: any) => { ...@@ -124,9 +124,9 @@ const PictureOptionsRow = (props: any) => {
message.error('You can only upload JPG/PNG file!'); message.error('You can only upload JPG/PNG file!');
} }
// 文件大小判断 // 文件大小判断
const isLt2M = file.size / 1024 / 1024 < 2; const isLt2M = file.size / 1024 / 1024 <= 2;
if (!isLt2M) { if (!isLt2M) {
message.error('Image must smaller than 2MB!'); message.error('Image must be less than or equal to 2MB!');
} }
return isJpgOrPng && isLt2M; return isJpgOrPng && isLt2M;
} }
......
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import { Row, Col, Table, Space, Tabs, Button } from 'antd'; import { Row, Col, Table, Space, Tabs, Button, message } from 'antd';
const { TabPane } = Tabs; const { TabPane } = Tabs;
import { objectColumns } from '@/utils/string'; import { objectColumns } from '@/utils/string';
...@@ -9,6 +9,11 @@ const TableShow = (props: any) => { ...@@ -9,6 +9,11 @@ const TableShow = (props: any) => {
const dataRow = data.rows; const dataRow = data.rows;
const goTo = (values: any, e: any) => { const goTo = (values: any, e: any) => {
const permissionArr = JSON.parse(localStorage.getItem('permission') || '[]');
if (permissionArr.indexOf('6') < 0) {
message.error('No Permissions!!!', 3);
return;
}
console.log(values); console.log(values);
props.onSubmit(values); props.onSubmit(values);
}; };
...@@ -29,13 +34,13 @@ const TableShow = (props: any) => { ...@@ -29,13 +34,13 @@ const TableShow = (props: any) => {
// const user_type_status = ["Registered", "Unregistered", "Cancellation"] // const user_type_status = ["Registered", "Unregistered", "Cancellation"]
const user_type_status = ['Normal', 'Normal', 'Cancellation']; const user_type_status = ['Normal', 'Normal', 'Cancellation'];
const user_code = ['Not Used', 'Used']; const user_code = ['Activation Code Is Inactive', 'Activation Code Has Been Used'];
const key = objectColumns([ const key = objectColumns([
['User Name', 'owner_family_name'], ['User Name', 'owner_family_name'],
['Contact Details', 'owner_family_phone'], ['Contact Details', 'owner_family_phone'],
['Email', 'owner_family_email'], ['Email', 'owner_family_email'],
[ [
'RelationShip', 'User Type',
null, null,
(text: any, record: any) => ( (text: any, record: any) => (
<Space size="middle"> <Space size="middle">
...@@ -66,7 +71,7 @@ const TableShow = (props: any) => { ...@@ -66,7 +71,7 @@ const TableShow = (props: any) => {
{dataRow.map((item: any, index: number) => { {dataRow.map((item: any, index: number) => {
return ( return (
<TabPane tab={item.name} key={index}> <TabPane tab={item.name} key={index}>
<Row gutter={16}> <Row gutter={16} style={{ marginLeft: 9 }}>
<Col>Address:</Col> <Col>Address:</Col>
<Col> <Col>
{item.owner.buildingNumber + {item.owner.buildingNumber +
...@@ -88,7 +93,7 @@ const TableShow = (props: any) => { ...@@ -88,7 +93,7 @@ const TableShow = (props: any) => {
return ( return (
<div style={{ height: 80, position: 'relative' }}> <div style={{ height: 80, position: 'relative' }}>
<div style={{ position: 'absolute', left: 0, bottom: 16 }}> <div style={{ position: 'absolute', left: 0, bottom: 16 }}>
<Row gutter={32}> <Row gutter={18}>
<Col>Unit No:</Col> <Col>Unit No:</Col>
<Col>{unit.living}</Col> <Col>{unit.living}</Col>
</Row> </Row>
...@@ -114,13 +119,13 @@ const TableShow = (props: any) => { ...@@ -114,13 +119,13 @@ const TableShow = (props: any) => {
pagination={false} pagination={false}
></Table> ></Table>
</Col> </Col>
<Col> <Col style={{ textAlign: 'center' }}>
<Row>
<img width={80} height={80} src={unit.imgUrl} />
</Row>
<Row style={{ marginTop: 8 }}> <Row style={{ marginTop: 8 }}>
<div style={{ width: 80, textAlign: 'center' }}> <div style={{ textAlign: 'center' }}>
{item.owner.cdkCode}({user_code[item.owner.cdkStatus]}) <img width={80} height={80} src={unit.imgUrl} />
<br />
{item.owner.cdkCode}
<br />({user_code[item.owner.cdkStatus]})
</div> </div>
</Row> </Row>
</Col> </Col>
......
import React from 'react'; import React from 'react';
import { PageLoading } from '@ant-design/pro-layout'; import { PageLoading } from '@ant-design/pro-layout';
import { Redirect, connect, ConnectProps, StateType, history } from 'umi'; import { Redirect, connect, ConnectProps, StateType, history, Link } from 'umi';
import { stringify } from 'querystring'; import { stringify } from 'querystring';
import { ConnectState } from '@/models/connect'; import { ConnectState } from '@/models/connect';
import { CurrentUser } from '@/models/user'; import { CurrentUser } from '@/models/user';
import { getCookie } from '@/utils/method'; import { getCookie } from '@/utils/method';
import { Result, Button } from 'antd';
interface SecurityLayoutProps extends ConnectProps { interface SecurityLayoutProps extends ConnectProps {
loading?: boolean; loading?: boolean;
...@@ -24,7 +25,7 @@ class SecurityLayout extends React.Component<SecurityLayoutProps, SecurityLayout ...@@ -24,7 +25,7 @@ class SecurityLayout extends React.Component<SecurityLayoutProps, SecurityLayout
}; };
// componentDidMount() { // componentDidMount() {
// console.log('componentDidMount触发了23333333'); // console.log('componentDidMount触发了23333333');
// this.setState({ // this.setState({
// isReady: true, // isReady: true,
...@@ -46,12 +47,73 @@ class SecurityLayout extends React.Component<SecurityLayoutProps, SecurityLayout ...@@ -46,12 +47,73 @@ class SecurityLayout extends React.Component<SecurityLayoutProps, SecurityLayout
// } // }
render() { render() {
const { isReady, token } = this.state; const { children, loading } = this.props;
const { children, loading, currentUser, login } = this.props;
// You can replace it to your authentication rule (such as check token exists) // You can replace it to your authentication rule (such as check token exists)
// 你可以把它替换成你自己的登录认证规则(比如判断 token 是否存在) // 你可以把它替换成你自己的登录认证规则(比如判断 token 是否存在)
// console.log("是否已登录" + getCookie("token")) const perList = [
{
path: '/UserManagement/LIFEUserManagement',
key: '1',
},
{
path: '/UserManagement/ServiceProviderManagement',
key: '8',
},
{
path: '/PropertyManagement',
key: '15',
},
{
path: '/CommercialService/CommunityMaintenance',
key: '17',
},
{
path: '/CommercialService/OwnerComplaints',
key: '20',
},
{
path: '/CommercialService/ProblemFeedback',
key: '23',
},
{
path: '/CommercialService/RenovationApplication',
key: '26',
},
{
path: '/CommercialService/AccessCardApplication',
key: '29',
},
{
path: '/CommercialService/ReportOnline',
key: '33',
},
{
path: '/CommercialService/ShelfLifeService',
key: '36',
},
];
const permission = JSON.parse(localStorage.getItem('permission') || '[]');
console.log('验证权限' + location.pathname);
console.log('拿取所有权限' + permission);
// 判断是否有权限
// if (perList.indexOf("")) {
// }
let perObj = perList.filter((obj) => {
return obj.path === location.pathname;
});
console.log(perObj);
if (perObj.length !== 0) {
if (permission.indexOf(perObj[0].key) < 0) {
console.log('无权限');
history.push('/403');
}
}
// const isLogin = currentUser && currentUser.name;//isLogin为关键点 // const isLogin = currentUser && currentUser.name;//isLogin为关键点
var isLogin = false; var isLogin = false;
......
...@@ -52,8 +52,8 @@ export default { ...@@ -52,8 +52,8 @@ export default {
'menu.usemanagement': 'User Management', 'menu.usemanagement': 'User Management',
'menu.monitoringcenter': 'Monitoring Center', 'menu.monitoringcenter': 'Monitoring Center',
'menu.usemanagement.lifeusers': 'LIFE Users', 'menu.usemanagement.lifeusers': 'LIFE User Management',
'menu.usemanagement.serviceproviders': 'Service Providers', 'menu.usemanagement.serviceproviders': 'Service Provider Management',
'menu.propertymanagement': 'Property Management', 'menu.propertymanagement': 'Property Management',
'menu.commercialservice': 'Commercial Service', 'menu.commercialservice': 'Commercial Service',
'menu.commercialservice.communitymaintenance': 'Community maintenance', 'menu.commercialservice.communitymaintenance': 'Community maintenance',
......
import { Button, Result } from 'antd';
import React from 'react';
import { history } from 'umi';
const NoFoundPage: React.FC<{}> = () => (
<Result
status="403"
title="403"
subTitle="Sorry, you are not authorized to access this page."
extra={
<Button type="primary" onClick={() => history.push('/')}>
Back Home
</Button>
}
/>
);
export default NoFoundPage;
...@@ -10,8 +10,7 @@ import TitleSearch from '../../../components/TitleSearch/TitleSearch'; ...@@ -10,8 +10,7 @@ import TitleSearch from '../../../components/TitleSearch/TitleSearch';
import { timestampToTime } from '../../../utils/time'; import { timestampToTime } from '../../../utils/time';
import { RA, getCookie, URL, filterObjbyTg, urlEncode, filterObj } from '@/utils/method'; import { RA, getCookie, URL, filterObjbyTg, urlEncode, filterObj } from '@/utils/method';
import { remove } from 'lodash';
console.log('检查是否有权限');
const module = 'User'; const module = 'User';
const module2 = 'History'; const module2 = 'History';
......
...@@ -32,7 +32,7 @@ const UsersDetail = (props: any) => { ...@@ -32,7 +32,7 @@ const UsersDetail = (props: any) => {
const MemberResultClear = () => { const MemberResultClear = () => {
dispatch({ type: 'User/MemberResultClear' }); dispatch({ type: 'User/MemberResultClear' });
}; };
const permissionArr = JSON.parse(localStorage.getItem('permission') || '[]');
const [memberDetail, setMemberDetail] = useState(false); const [memberDetail, setMemberDetail] = useState(false);
const [memberData, setMemberData] = useState(null as any); const [memberData, setMemberData] = useState(null as any);
const [editFlag, setEditFlag] = useState(false); const [editFlag, setEditFlag] = useState(false);
...@@ -140,7 +140,6 @@ const UsersDetail = (props: any) => { ...@@ -140,7 +140,6 @@ const UsersDetail = (props: any) => {
}; };
const deleteUnit = (values: any) => { const deleteUnit = (values: any) => {
const permissionArr = JSON.parse(localStorage.getItem('permission') || '[]');
if (permissionArr.indexOf('5') < 0) { if (permissionArr.indexOf('5') < 0) {
message.error('No Permissions!!!', 3); message.error('No Permissions!!!', 3);
return; return;
...@@ -169,6 +168,10 @@ const UsersDetail = (props: any) => { ...@@ -169,6 +168,10 @@ const UsersDetail = (props: any) => {
const DeleteMember = (values: any, e: any) => { const DeleteMember = (values: any, e: any) => {
console.log(values); console.log(values);
if (permissionArr.indexOf('7') < 0) {
message.error('No Permissions!!!', 3);
return;
}
RA(39, { id: values.id, ownerId: values.owner_id }); RA(39, { id: values.id, ownerId: values.owner_id });
}; };
......
...@@ -47,7 +47,7 @@ const Detail = (props: any) => { ...@@ -47,7 +47,7 @@ const Detail = (props: any) => {
{ title: 'Job Title', dataIndex: 'cdkCode' }, { title: 'Job Title', dataIndex: 'cdkCode' },
{ title: 'User Status', dataIndex: 'cdkStatus' }, { title: 'User Status', dataIndex: 'cdkStatus' },
{ {
title: 'actions', title: 'Actions',
render: (text: any, record: any) => ( render: (text: any, record: any) => (
<Space size="middle"> <Space size="middle">
{' '} {' '}
...@@ -150,10 +150,7 @@ const Detail = (props: any) => { ...@@ -150,10 +150,7 @@ const Detail = (props: any) => {
<div className={styles.box1item1}>Service Community</div> <div className={styles.box1item1}>Service Community</div>
</div> </div>
{SaveChooseData.serviceCommunityList != null ? ( {SaveChooseData.serviceCommunityList != null ? (
<ShowOptions <ShowOptions list={SaveChooseData.serviceCommunityList} defaultValue={'Close'} />
list={SaveChooseData.serviceCommunityList}
defaultValue={'Put It Away'}
/>
) : ( ) : (
<></> <></>
)} )}
......
...@@ -101,7 +101,7 @@ const Edit = (props: any) => { ...@@ -101,7 +101,7 @@ const Edit = (props: any) => {
<div className={styles.base}> <div className={styles.base}>
{/* 头部组件v1.2 */} {/* 头部组件v1.2 */}
<TitleBack <TitleBack
title={SaveChooseData !== null ? 'Edit Service Provider' : 'Add service provider'} title={SaveChooseData !== null ? 'Edit Service Provider' : 'Create New Service Provider'}
/> />
<Form ref={formRef} name="basic" onFinish={onFinish}> <Form ref={formRef} name="basic" onFinish={onFinish}>
......
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import styles from './Guard.less'; import styles from './Guard.less';
import { Input ,Menu,Table,Space,Pagination,Tooltip, Button } from 'antd'; import { Input, Menu, Table, Space, Pagination, Tooltip, Button } from 'antd';
import { Link, useIntl, connect, Dispatch } from 'umi'; import { Link, useIntl, connect, Dispatch } from 'umi';
...@@ -10,45 +10,53 @@ import TitleGet from '../../../components/TitleGet/TitleGet'; ...@@ -10,45 +10,53 @@ import TitleGet from '../../../components/TitleGet/TitleGet';
import { timestampToTime } from '../../../utils/time'; import { timestampToTime } from '../../../utils/time';
const Guard = (props:any) => { const Guard = (props: any) => {
const { CurDataFollowDetail } = props;
const {CurDataFollowDetail} = props; console.log(CurDataFollowDetail);
return (
<div className={styles.base}>
const handleClickBtn = () => {};
<div className={styles.item0}><TitleGet title={"Edit Security Guard Account"}/></div> return (
<div className={styles.base}>
<div className={styles.item0}>
<TitleGet title={'Edit Security Guard Account'} />
</div>
<div className={styles.item0_1}>Status:Normal</div> <div className={styles.item0_1}>Status:Normal</div>
<div className={styles.item0_1}>Registration Date:{timestampToTime(CurDataFollowDetail.createTime.time)}</div> <div className={styles.item0_1}>
<div className={styles.item2}><BackButton/></div> Registration Date:
{/* {timestampToTime(CurDataFollowDetail.createTime.time)} */}
</div>
<div className={styles.item2}>
<BackButton />
</div>
<div className={styles.clear0}></div> <div className={styles.clear0}></div>
<div className={styles.item1}>Company Name</div> <div className={styles.item1}>Company Name</div>
<div className={styles.item1_1} >{CurDataFollowDetail.companyName}</div> <div className={styles.item1_1}>{CurDataFollowDetail.companyName}</div>
<div className={styles.clear1}></div> <div className={styles.clear1}></div>
<div className={styles.item1} >Full Name</div> <div className={styles.item1}>Full Name</div>
<div className={styles.item1_1} >{CurDataFollowDetail.saferName}</div> <div className={styles.item1_1}>{CurDataFollowDetail.saferName}</div>
<div className={styles.clear1} ></div> <div className={styles.clear1}></div>
<div className={styles.item1} >Contact Details</div> <div className={styles.item1}>Contact Details</div>
<div className={styles.item1_1} >{CurDataFollowDetail.saferPhone}</div> <div className={styles.item1_1}>{CurDataFollowDetail.saferPhone}</div>
<div className={styles.item1} style={{ marginLeft: 32,width:40}} >Email</div> <div className={styles.item1} style={{ marginLeft: 32, width: 40 }}>
<div className={styles.item1_1} >{CurDataFollowDetail.saferEmail}</div> Email
<div className={styles.clear1}></div> </div>
<div className={styles.item1_1}>{CurDataFollowDetail.saferEmail}</div>
<div className={styles.clear1}></div>
<Line /> <Line />
<Button>Cancellation</Button>
<Button onClick={handleClickBtn}>Cancellation</Button>
</div> </div>
); );
}; };
function mapStateToProps(state:any) { function mapStateToProps(state: any) {
const {CurDataFollowDetail } = state.ServiceProvider; const { CurDataFollowDetail } = state.ServiceProvider;
return { return {
CurDataFollowDetail, CurDataFollowDetail,
}; };
......
...@@ -77,6 +77,7 @@ const ServiceProviderManagement = (props: propsType) => { ...@@ -77,6 +77,7 @@ const ServiceProviderManagement = (props: propsType) => {
SaveChooseData(values); SaveChooseData(values);
history.push(location.pathname + '/Edit'); history.push(location.pathname + '/Edit');
}; };
const goToCreate = () => { const goToCreate = () => {
if (permissionArr.indexOf('8') < 0) { if (permissionArr.indexOf('8') < 0) {
message.error('No Permissions!!!', 3); message.error('No Permissions!!!', 3);
...@@ -85,13 +86,25 @@ const ServiceProviderManagement = (props: propsType) => { ...@@ -85,13 +86,25 @@ const ServiceProviderManagement = (props: propsType) => {
SaveChooseData(null); SaveChooseData(null);
history.push(location.pathname + '/Edit'); history.push(location.pathname + '/Edit');
}; };
const goToServices = () => { const goToServices = () => {
history.push(location.pathname + '/Services'); history.push(location.pathname + '/Services');
}; };
// 请求
const TosTosServiceProviderGet = () => {
if (readyData.serviceCommunityList.length === 0) {
readyData.serviceCommunityList = CommunityList;
}
dispatch({
type: 'ServiceProvider/TosTosServiceProviderGet',
playload: { ...readyData },
});
};
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',
...@@ -142,17 +155,6 @@ const ServiceProviderManagement = (props: propsType) => { ...@@ -142,17 +155,6 @@ const ServiceProviderManagement = (props: propsType) => {
} }
}, [DataServices]); }, [DataServices]);
// 请求
const TosTosServiceProviderGet = () => {
if (readyData.serviceCommunityList.length === 0) {
readyData.serviceCommunityList = CommunityList;
}
dispatch({
type: 'ServiceProvider/TosTosServiceProviderGet',
playload: { ...readyData },
});
};
// 监听路由url // 监听路由url
useEffect(() => { useEffect(() => {
if (location.query) { if (location.query) {
...@@ -161,7 +163,7 @@ const ServiceProviderManagement = (props: propsType) => { ...@@ -161,7 +163,7 @@ const ServiceProviderManagement = (props: propsType) => {
...location.query, ...location.query,
}; };
} }
console.log(CommunityList, flag); // console.log(CommunityList, flag);
if (CommunityList && flag === false) { if (CommunityList && flag === false) {
flag = true; flag = true;
setLoading(true); setLoading(true);
...@@ -241,7 +243,7 @@ const ServiceProviderManagement = (props: propsType) => { ...@@ -241,7 +243,7 @@ const ServiceProviderManagement = (props: propsType) => {
list={['Service Provider']} list={['Service Provider']}
status={[ status={[
{ {
name: ['status', 'Services'], name: ['status', 'Services Available'],
data: [...options], data: [...options],
}, },
]} ]}
...@@ -249,11 +251,7 @@ const ServiceProviderManagement = (props: propsType) => { ...@@ -249,11 +251,7 @@ const ServiceProviderManagement = (props: propsType) => {
onSubmit={CallBackTitleSearch} onSubmit={CallBackTitleSearch}
defaultValue={{ defaultValue={{
providerName: readyData.providerName, providerName: readyData.providerName,
status: readyData.serviceScope // status:,
? parseInt(readyData.serviceScope) === 0
? 'SecurutyGuard'
: 'Accountant'
: null,
}} }}
checklist={ checklist={
readyData.serviceCommunityList.length !== 0 ? readyData.serviceCommunityList : null readyData.serviceCommunityList.length !== 0 ? readyData.serviceCommunityList : null
...@@ -263,7 +261,7 @@ const ServiceProviderManagement = (props: propsType) => { ...@@ -263,7 +261,7 @@ const ServiceProviderManagement = (props: propsType) => {
{/* 内容组件 */} {/* 内容组件 */}
<div className={styles.box2}> <div className={styles.box2}>
<button className={styles.buttonAdd2} onClick={goToServices}> <button className={styles.buttonAdd2} onClick={goToServices}>
Avail Services Services Available
</button> </button>
<button className={styles.buttonAdd} onClick={goToCreate}> <button className={styles.buttonAdd} onClick={goToCreate}>
Create New Create New
......
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