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({
{
component: './404',
},
{
component: './403',
},
],
// Theme for antd: https://ant.design/docs/react/customize-theme-cn
......
......@@ -124,9 +124,9 @@ const PictureOptionsRow = (props: any) => {
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) {
message.error('Image must smaller than 2MB!');
message.error('Image must be less than or equal to 2MB!');
}
return isJpgOrPng && isLt2M;
}
......
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;
import { objectColumns } from '@/utils/string';
......@@ -9,6 +9,11 @@ const TableShow = (props: any) => {
const dataRow = data.rows;
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);
props.onSubmit(values);
};
......@@ -29,13 +34,13 @@ const TableShow = (props: any) => {
// const user_type_status = ["Registered", "Unregistered", "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([
['User Name', 'owner_family_name'],
['Contact Details', 'owner_family_phone'],
['Email', 'owner_family_email'],
[
'RelationShip',
'User Type',
null,
(text: any, record: any) => (
<Space size="middle">
......@@ -66,7 +71,7 @@ const TableShow = (props: any) => {
{dataRow.map((item: any, index: number) => {
return (
<TabPane tab={item.name} key={index}>
<Row gutter={16}>
<Row gutter={16} style={{ marginLeft: 9 }}>
<Col>Address:</Col>
<Col>
{item.owner.buildingNumber +
......@@ -88,7 +93,7 @@ const TableShow = (props: any) => {
return (
<div style={{ height: 80, position: 'relative' }}>
<div style={{ position: 'absolute', left: 0, bottom: 16 }}>
<Row gutter={32}>
<Row gutter={18}>
<Col>Unit No:</Col>
<Col>{unit.living}</Col>
</Row>
......@@ -114,13 +119,13 @@ const TableShow = (props: any) => {
pagination={false}
></Table>
</Col>
<Col>
<Row>
<img width={80} height={80} src={unit.imgUrl} />
</Row>
<Col style={{ textAlign: 'center' }}>
<Row style={{ marginTop: 8 }}>
<div style={{ width: 80, textAlign: 'center' }}>
{item.owner.cdkCode}({user_code[item.owner.cdkStatus]})
<div style={{ textAlign: 'center' }}>
<img width={80} height={80} src={unit.imgUrl} />
<br />
{item.owner.cdkCode}
<br />({user_code[item.owner.cdkStatus]})
</div>
</Row>
</Col>
......
import React from 'react';
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 { ConnectState } from '@/models/connect';
import { CurrentUser } from '@/models/user';
import { getCookie } from '@/utils/method';
import { Result, Button } from 'antd';
interface SecurityLayoutProps extends ConnectProps {
loading?: boolean;
......@@ -24,7 +25,7 @@ class SecurityLayout extends React.Component<SecurityLayoutProps, SecurityLayout
};
// componentDidMount() {
// console.log('componentDidMount触发了23333333');
// console.log('componentDidMount触发了23333333');
// this.setState({
// isReady: true,
......@@ -46,12 +47,73 @@ class SecurityLayout extends React.Component<SecurityLayoutProps, SecurityLayout
// }
render() {
const { isReady, token } = this.state;
const { children, loading, currentUser, login } = this.props;
const { children, loading } = this.props;
// You can replace it to your authentication rule (such as check token exists)
// 你可以把它替换成你自己的登录认证规则(比如判断 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为关键点
var isLogin = false;
......
......@@ -52,8 +52,8 @@ export default {
'menu.usemanagement': 'User Management',
'menu.monitoringcenter': 'Monitoring Center',
'menu.usemanagement.lifeusers': 'LIFE Users',
'menu.usemanagement.serviceproviders': 'Service Providers',
'menu.usemanagement.lifeusers': 'LIFE User Management',
'menu.usemanagement.serviceproviders': 'Service Provider Management',
'menu.propertymanagement': 'Property Management',
'menu.commercialservice': 'Commercial Service',
'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';
import { timestampToTime } from '../../../utils/time';
import { RA, getCookie, URL, filterObjbyTg, urlEncode, filterObj } from '@/utils/method';
console.log('检查是否有权限');
import { remove } from 'lodash';
const module = 'User';
const module2 = 'History';
......
......@@ -32,7 +32,7 @@ const UsersDetail = (props: any) => {
const MemberResultClear = () => {
dispatch({ type: 'User/MemberResultClear' });
};
const permissionArr = JSON.parse(localStorage.getItem('permission') || '[]');
const [memberDetail, setMemberDetail] = useState(false);
const [memberData, setMemberData] = useState(null as any);
const [editFlag, setEditFlag] = useState(false);
......@@ -140,7 +140,6 @@ const UsersDetail = (props: any) => {
};
const deleteUnit = (values: any) => {
const permissionArr = JSON.parse(localStorage.getItem('permission') || '[]');
if (permissionArr.indexOf('5') < 0) {
message.error('No Permissions!!!', 3);
return;
......@@ -169,6 +168,10 @@ const UsersDetail = (props: any) => {
const DeleteMember = (values: any, e: any) => {
console.log(values);
if (permissionArr.indexOf('7') < 0) {
message.error('No Permissions!!!', 3);
return;
}
RA(39, { id: values.id, ownerId: values.owner_id });
};
......
......@@ -47,7 +47,7 @@ const Detail = (props: any) => {
{ title: 'Job Title', dataIndex: 'cdkCode' },
{ title: 'User Status', dataIndex: 'cdkStatus' },
{
title: 'actions',
title: 'Actions',
render: (text: any, record: any) => (
<Space size="middle">
{' '}
......@@ -150,10 +150,7 @@ const Detail = (props: any) => {
<div className={styles.box1item1}>Service Community</div>
</div>
{SaveChooseData.serviceCommunityList != null ? (
<ShowOptions
list={SaveChooseData.serviceCommunityList}
defaultValue={'Put It Away'}
/>
<ShowOptions list={SaveChooseData.serviceCommunityList} defaultValue={'Close'} />
) : (
<></>
)}
......
......@@ -101,7 +101,7 @@ const Edit = (props: any) => {
<div className={styles.base}>
{/* 头部组件v1.2 */}
<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}>
......
import React, { useState, useEffect } from 'react';
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';
......@@ -10,45 +10,53 @@ import TitleGet from '../../../components/TitleGet/TitleGet';
import { timestampToTime } from '../../../utils/time';
const Guard = (props:any) => {
const Guard = (props: any) => {
const { CurDataFollowDetail } = props;
const {CurDataFollowDetail} = props;
return (
<div className={styles.base}>
console.log(CurDataFollowDetail);
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}>Registration Date:{timestampToTime(CurDataFollowDetail.createTime.time)}</div>
<div className={styles.item2}><BackButton/></div>
<div className={styles.item0_1}>
Registration Date:
{/* {timestampToTime(CurDataFollowDetail.createTime.time)} */}
</div>
<div className={styles.item2}>
<BackButton />
</div>
<div className={styles.clear0}></div>
<div className={styles.item1}>Company Name</div>
<div className={styles.item1_1} >{CurDataFollowDetail.companyName}</div>
<div className={styles.clear1}></div>
<div className={styles.item1} >Full Name</div>
<div className={styles.item1_1} >{CurDataFollowDetail.saferName}</div>
<div className={styles.clear1} ></div>
<div className={styles.item1} >Contact Details</div>
<div className={styles.item1_1} >{CurDataFollowDetail.saferPhone}</div>
<div className={styles.item1} style={{ marginLeft: 32,width:40}} >Email</div>
<div className={styles.item1_1} >{CurDataFollowDetail.saferEmail}</div>
<div className={styles.clear1}></div>
<div className={styles.item1}>Company Name</div>
<div className={styles.item1_1}>{CurDataFollowDetail.companyName}</div>
<div className={styles.clear1}></div>
<div className={styles.item1}>Full Name</div>
<div className={styles.item1_1}>{CurDataFollowDetail.saferName}</div>
<div className={styles.clear1}></div>
<div className={styles.item1}>Contact Details</div>
<div className={styles.item1_1}>{CurDataFollowDetail.saferPhone}</div>
<div className={styles.item1} style={{ marginLeft: 32, width: 40 }}>
Email
</div>
<div className={styles.item1_1}>{CurDataFollowDetail.saferEmail}</div>
<div className={styles.clear1}></div>
<Line />
<Button>Cancellation</Button>
<Button onClick={handleClickBtn}>Cancellation</Button>
</div>
);
};
function mapStateToProps(state:any) {
const {CurDataFollowDetail } = state.ServiceProvider;
function mapStateToProps(state: any) {
const { CurDataFollowDetail } = state.ServiceProvider;
return {
CurDataFollowDetail,
};
......
......@@ -77,6 +77,7 @@ const ServiceProviderManagement = (props: propsType) => {
SaveChooseData(values);
history.push(location.pathname + '/Edit');
};
const goToCreate = () => {
if (permissionArr.indexOf('8') < 0) {
message.error('No Permissions!!!', 3);
......@@ -85,13 +86,25 @@ const ServiceProviderManagement = (props: propsType) => {
SaveChooseData(null);
history.push(location.pathname + '/Edit');
};
const goToServices = () => {
history.push(location.pathname + '/Services');
};
// 请求
const TosTosServiceProviderGet = () => {
if (readyData.serviceCommunityList.length === 0) {
readyData.serviceCommunityList = CommunityList;
}
dispatch({
type: 'ServiceProvider/TosTosServiceProviderGet',
playload: { ...readyData },
});
};
const columns = [
{ title: 'Service Provider', dataIndex: 'providerName' },
{ title: 'contact Name', dataIndex: 'contactName' },
{ title: 'Contact Name', dataIndex: 'contactName' },
{
title: 'Contacts',
......@@ -142,17 +155,6 @@ const ServiceProviderManagement = (props: propsType) => {
}
}, [DataServices]);
// 请求
const TosTosServiceProviderGet = () => {
if (readyData.serviceCommunityList.length === 0) {
readyData.serviceCommunityList = CommunityList;
}
dispatch({
type: 'ServiceProvider/TosTosServiceProviderGet',
playload: { ...readyData },
});
};
// 监听路由url
useEffect(() => {
if (location.query) {
......@@ -161,7 +163,7 @@ const ServiceProviderManagement = (props: propsType) => {
...location.query,
};
}
console.log(CommunityList, flag);
// console.log(CommunityList, flag);
if (CommunityList && flag === false) {
flag = true;
setLoading(true);
......@@ -241,7 +243,7 @@ const ServiceProviderManagement = (props: propsType) => {
list={['Service Provider']}
status={[
{
name: ['status', 'Services'],
name: ['status', 'Services Available'],
data: [...options],
},
]}
......@@ -249,11 +251,7 @@ const ServiceProviderManagement = (props: propsType) => {
onSubmit={CallBackTitleSearch}
defaultValue={{
providerName: readyData.providerName,
status: readyData.serviceScope
? parseInt(readyData.serviceScope) === 0
? 'SecurutyGuard'
: 'Accountant'
: null,
// status:,
}}
checklist={
readyData.serviceCommunityList.length !== 0 ? readyData.serviceCommunityList : null
......@@ -263,7 +261,7 @@ const ServiceProviderManagement = (props: propsType) => {
{/* 内容组件 */}
<div className={styles.box2}>
<button className={styles.buttonAdd2} onClick={goToServices}>
Avail Services
Services Available
</button>
<button className={styles.buttonAdd} onClick={goToCreate}>
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