Commit 5d6b38fb authored by Sixiang_Zzb's avatar Sixiang_Zzb

新增会计详情页 处理其他页面的bug

parent d9e51e4e
......@@ -2,8 +2,6 @@
import { defineConfig } from 'umi';
import defaultSettings from './defaultSettings';
import proxy from './proxy';
import component from '@/locales/en-US/component';
import route from 'mock/route';
const { REACT_APP_ENV } = process.env;
......@@ -138,6 +136,14 @@ export default defineConfig({
path: './Services',
component: './UserManagement/ServiceProviderManagement/Services',
},
{
path: './AccoutingDetail',
component: './UserManagement/ServiceProviderManagement/AccoutingContent',
},
// {
// path: './AccoutingEdit',
// component: './UserManagement/ServiceProviderManagement/AccoutingContent',
// },
],
},
],
......@@ -148,8 +154,8 @@ export default defineConfig({
icon: 'ReconciliationOutlined',
routes: [
{ path: './', component: './PropertyManagement/ChargeManager' },
{ path: './AccoutingDetail', component: './PropertyManagement/AccoutingContent' },
{ path: './AccoutingEdit', component: './PropertyManagement/AccoutingContent' },
// { path: './AccoutingDetail', component: './PropertyManagement/AccoutingContent' },
// { path: './AccoutingEdit', component: './PropertyManagement/AccoutingContent' },
],
},
{ path: '/PropertyManagementDetail', component: './PropertyManagement/ChargeDetail' },
......@@ -260,8 +266,14 @@ export default defineConfig({
'./CommunityManagement/CommunityAnnouncement/CommunityAnnouncement',
},
{ path: './Add', component: './CommunityManagement/CommunityAnnouncement/Add' },
{ path: './Edit', component: './CommunityManagement/CommunityAnnouncement/Add' },
{ path: './Detail', component: './CommunityManagement/CommunityAnnouncement/Detail' },
{
path: './Edit',
component: './CommunityManagement/CommunityAnnouncement/Add',
},
{
path: './Detail',
component: './CommunityManagement/CommunityAnnouncement/Detail',
},
],
},
{
......
import * as service from '../services/tos';
import { message } from 'antd';
import { routerRedux } from 'dva/router';
export default {
namespace: 'ServiceProvider',
state: {
......@@ -10,34 +8,35 @@ export default {
CurDataFollow: null,
SaveChooseData: null,
CurData: null,
Result: null,
},
reducers: {
returnPage(state, { Data }) {
console.log(state);
console.log(Data);
returnPage(state: object, { Data }: any) {
return { ...state, Data };
},
returnCurDataFollow(state, { CurDataFollow }) {
returnCurDataFollow(state: object, { CurDataFollow }: any) {
return { ...state, CurDataFollow };
},
returnCurDataFollowDetail(state, { CurDataFollowDetail }) {
returnCurDataFollowDetail(state: object, { CurDataFollowDetail }: any) {
return { ...state, CurDataFollowDetail };
},
returnSaveChooseData(state, { SaveChooseData }) {
returnSaveChooseData(state: object, { SaveChooseData }: any) {
return { ...state, SaveChooseData };
},
returnCurData(state, CurData) {
console.log(CurData);
returnCurData(state: object, { CurData }: any) {
return { ...state, CurData };
},
returnResult(state: object, { Result }: any) {
return { ...state, Result };
},
},
effects: {
// 获取服务商
*TosTosServiceProviderGet({ playload }, { call, put }) {
*TosTosServiceProviderGet({ playload }: any, { call, put }: any) {
const resp = yield call(service.TosTosServiceProviderGet, playload);
console.log(resp);
if (resp.error_code == '0000') {
......@@ -51,7 +50,7 @@ export default {
}
},
// 新建服务商
*TosTosServiceProviderSave({ playload }, { call, put }) {
*TosTosServiceProviderSave({ playload }: any, { call, put }: any) {
console.log(playload);
const resp = yield call(service.TosTosServiceProviderSave, playload);
console.log(resp);
......@@ -70,7 +69,7 @@ export default {
},
//获取服务商保安根据服务商名
*TosSecurityGuarderGet({ playload }, { call, put }) {
*TosSecurityGuarderGet({ playload }: any, { call, put }: any) {
console.log(playload);
const resp = yield call(service.TosSecurityGuarderGet, playload);
console.log(resp);
......@@ -79,13 +78,32 @@ export default {
},
//获取服务商保安详情根据服务商名
*GuarderById({ playload }, { call, put }) {
*GuarderById({ playload }: any, { call, put }: any) {
let CurDataFollowDetail = playload;
yield put({ type: 'returnCurDataFollowDetail', CurDataFollowDetail });
},
*SaveChooseData({ playload }, { call, put }) {
*SaveChooseData({ playload }: any, { call, put }: any) {
let SaveChooseData = playload;
yield put({ type: 'returnSaveChooseData', SaveChooseData });
},
// 注销服务商
*DelServiceProvider({ playload }: any, { call, put }: any) {
const resp = yield call(service.TosTosServiceProviderDel, playload);
if (resp.error_code === '0000') {
let Result = true;
yield put({ type: 'returnResult', Result });
} else {
let Result = false;
yield put({ type: 'returnResult', Result });
}
},
*ResultClear({ playload }: any, { call, put }: any) {
console.log('清除数据');
let Result = null;
yield put({ type: 'returnResult', Result });
},
},
};
@import '~antd/lib/style/themes/default.less';
//基石
.base {
width: 100%;
background-color: #ffffff;
padding: 34px;
min-width: 1020px;
}
//头部组件
.box{
width: 100%;
height: 64px;
position: relative;
}
.item1{
position: absolute;
width: 320px;
text-indent: 15px;
border-left: 5px solid rgba(24,144,255,1);
font-family:'Source Han Sans CN';
font-size: 18px;
font-weight: 600;
color: #000000;
}
.item3{
width:80px;
height: 32px;
position: absolute;
right: 0;
outline: none;
background:none;
cursor: pointer;
border:1px solid rgba(217,217,217,1);
border-radius:2px;
}
.box1{
width: 100%;
height: 34px;
position: relative;
}
.box1item1{
position: absolute;
}
.box1item2{
position: absolute;
left: 154px;
}
.box1item3{
position: absolute;
left: 499px;
}
.box1item4{
position: absolute;
left: 648px;
}
.box2{
width: 100%;
height: 34px;
position: relative;
margin-top: 28px;
}
.box2item1{
position: absolute;
}
.box2item2{
position: absolute;
left: 189px;
}
.box3{
width: 100%;
height: 34px;
position: relative;
margin-top: 28px;
}
.box3item1{
position: absolute;
}
.box3item2{
position: absolute;
left: 189px;
}
.box3item3{
position: absolute;
left: 405px;
}
\ No newline at end of file
import React, { useState, useEffect } from 'react';
import styles from './AccoutingContent.less';
import { Input, Button, Table, Space, Pagination, Tooltip } from 'antd';
import { Link, useIntl, connect, Dispatch } from 'umi';
import Line from '../../components/Line/Line';
import SelectOptions from '../../components/SelectOptions/index';
import { indexOf } from 'lodash';
const AccoutingContent = (props: { location: any; }) => {
const { location } = props;
const goToReturn = () => {
history.back()
};
const [editFlag, setEditFlag] = useState(false);
useEffect(() => {
if ((location.pathname).indexOf("/AccoutingDetail") > -1) {
setEditFlag(true)
} else {
setEditFlag(false)
}
}, [location.pathname]);
const printContent = (comment: any) => {
console.log(comment)
}
return (
<div className={styles.base}>
{/* 头部组件 */}
<div className={styles.box}>
<div className={styles.item1}>Add Accounting</div>
<button className={styles.item3} onClick={goToReturn}>Return</button>
</div>
<div className={styles.box1}>
<div className={styles.box1item1}>Company Name</div>
<div className={styles.box1item2}>{editFlag ? (<Input style={{ width: 260 }} placeholder="Please enter company name" />) : ("123")}</div>
<div className={styles.box1item3}>Office Address</div>
<div className={styles.box1item4}>{editFlag ? (<Input style={{ width: 200 }} placeholder="Single Line Input" />) : ("123")}</div>
</div>
<Line />
<div style={{ marginBottom: 28 }}>Service Community</div>
<SelectOptions list={["美国", "美丽的", "美好", "加拿大", "加油", "XO"].sort()} onSubmit={printContent} />
<div className={styles.box2}>
<div className={styles.box2item1}>Services Available</div>
<div className={styles.box2item2}>Accounting</div>
</div>
<div className={styles.box2}>
<div className={styles.box2item1}>Person In Charge</div>
<div className={styles.box2item2}>{editFlag ? (<Input placeholder="Please enter a name" style={{ width: 200 }} />) : ("123")}</div>
</div>
<div className={styles.box3}>
<div className={styles.box3item1}>Contact Details</div>
<div className={styles.box3item2}>{editFlag ? (<Input placeholder="Telephone" style={{ width: 200 }} />) : ("123")}</div>
<div className={styles.box3item3}>{editFlag ? (<Input placeholder="E-mail" style={{ width: 200 }} />) : ("123")}</div>
</div>
{
editFlag ? (
<div>
<Line />
<Button type="primary" size="large">submit</Button>
</div>
) : (<div />)
}
</div>
);
};
export default AccoutingContent;
......@@ -46,7 +46,9 @@ const UsersAdd = (props: any) => {
if (postman.extend != null) {
formRef.current.setFieldsValue({
addressAndpostalCode:
communityInfo.data.rows.residentialAddress + communityInfo.data.rows.residentialZipCode,
communityInfo.data.rows.residentialAddress +
' ' +
communityInfo.data.rows.residentialZipCode,
});
}
}
......
@import '~antd/lib/style/themes/default.less';
//基石
.base {
width: 100%;
background-color: #ffffff;
padding: 34px;
min-width: 1020px;
}
//头部组件
.box {
width: 100%;
height: 64px;
position: relative;
}
.item1 {
position: absolute;
width: 320px;
text-indent: 15px;
border-left: 5px solid rgba(24, 144, 255, 1);
font-family: 'Source Han Sans CN';
font-size: 18px;
font-weight: 600;
color: #000000;
}
.item3 {
width: 80px;
height: 32px;
position: absolute;
right: 0;
outline: none;
background: none;
cursor: pointer;
border: 1px solid rgba(217, 217, 217, 1);
border-radius: 2px;
}
.box1 {
width: 100%;
height: 34px;
position: relative;
}
.box1item1 {
position: absolute;
}
.box1item2 {
position: absolute;
left: 154px;
}
.box1item3 {
position: absolute;
left: 499px;
}
.box1item4 {
position: absolute;
left: 648px;
}
.box2 {
width: 100%;
height: 34px;
position: relative;
margin-top: 28px;
}
.box2item1 {
position: absolute;
}
.box2item2 {
position: absolute;
left: 189px;
}
.box3 {
width: 100%;
height: 34px;
position: relative;
margin-top: 28px;
}
.box3item1 {
position: absolute;
}
.box3item2 {
position: absolute;
left: 189px;
}
.box3item3 {
position: absolute;
left: 405px;
}
.box4 {
width: 100%;
height: 34px;
position: relative;
margin-top: 28px;
}
.writeOff {
position: absolute;
top: 34px;
right: 150px;
}
import React, { useEffect } from 'react';
import styles from './AccoutingContent.less';
import { Button, Modal, message } from 'antd';
import { connect } from 'umi';
import Line from '@/components/Line/Line';
import ShowOptions from '@/components/ShowOptions/index';
import { PoweroffOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
const { confirm } = Modal;
const AccoutingContent = (props: {
SaveChooseData: any;
dispatch: any;
Result: Boolean;
history: any;
}) => {
const { SaveChooseData, dispatch, Result, history } = props;
const goToReturn = () => {
history.goBack();
};
useEffect(() => {
console.log(SaveChooseData);
if (!SaveChooseData) {
goToReturn();
}
}, []);
const handleClick = (id: string) => {
confirm({
title: 'Warning',
icon: <ExclamationCircleOutlined />,
content: 'Are you sure want to write off?',
onOk() {
dispatch({ type: 'ServiceProvider/DelServiceProvider', playload: { id } });
},
onCancel() {
console.log('Cancel');
},
});
};
useEffect(() => {
console.log(Result);
if (Result !== null) {
if (Result) {
dispatch({ type: 'ServiceProvider/ResultClear' });
message.success('Logout successful!', 3, () => {
history.goBack();
});
} else {
message.error('Logout failed. Please try again!', 3);
dispatch({ type: 'ServiceProvider/ResultClear', playload: '' });
}
}
}, [Result]);
return (
<div className={styles.base}>
{/* 头部组件 */}
<div className={styles.box}>
<div className={styles.item1}>Accounting information</div>
<button className={styles.item3} onClick={goToReturn}>
Back
</button>
</div>
{SaveChooseData.enable}
{SaveChooseData.enable === 'normal' ? (
<div className={styles.writeOff}>
<Button
icon={<PoweroffOutlined />}
type="primary"
danger
onClick={handleClick.bind(this, SaveChooseData.id)}
>
Write Off
</Button>
</div>
) : (
<div />
)}
<div className={styles.box1}>
<div className={styles.box1item1}>Company Name</div>
<div className={styles.box1item2}>{SaveChooseData.providerName}</div>
<div className={styles.box1item3}>Office Address</div>
<div className={styles.box1item4}>{SaveChooseData.providerAddress}</div>
</div>
<Line />
<div style={{ marginBottom: 28 }}>Service Community</div>
<ShowOptions list={SaveChooseData.serviceCommunityList} />
<div className={styles.box2}>
<div className={styles.box2item1}>Services Available</div>
<div className={styles.box2item2}>Accounting</div>
</div>
<div className={styles.box2}>
<div className={styles.box2item1}>Person In Charge</div>
<div className={styles.box2item2}>{SaveChooseData.contactName}</div>
</div>
<div className={styles.box3}>
<div className={styles.box3item1}>Contact Details</div>
<div className={styles.box3item2}>{SaveChooseData.contactPhone}</div>
<div className={styles.box3item3}>{SaveChooseData.contactEmail}</div>
</div>
<div className={styles.box4}>
<div className={styles.box3item1}>Upload the address</div>
<div></div>
</div>
</div>
);
};
function mapStateToProps(state: { ServiceProvider: any }) {
const { SaveChooseData, Result } = state.ServiceProvider;
return {
SaveChooseData,
Result,
};
}
export default connect(mapStateToProps)(AccoutingContent);
import React, { useState, useEffect } from 'react';
import styles from './Detail.less';
import { Input, Button, Table, Space, Pagination, Tooltip, Checkbox } from 'antd';
import { Button, Table, Space, message, Modal } from 'antd';
import { Link, useIntl, connect, Dispatch, history } from 'umi';
import ShowOptions from '../../../components/ShowOptions/index';
import TitleBack from '../../../components/TitleBack/TitleBack';
import { PoweroffOutlined } from '@ant-design/icons';
import { PoweroffOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
const { confirm } = Modal;
const Detail = (props: any) => {
const { dispatch, Data, CurDataFollow, location, SaveChooseData } = props;
const { dispatch, Data, CurDataFollow, location, SaveChooseData, Result } = props;
const TosSecurityGuarderGet = (values: any) => {
dispatch({ type: 'ServiceProvider/TosSecurityGuarderGet', playload: values });
......@@ -32,7 +34,7 @@ const Detail = (props: any) => {
history.push(location.pathname + '/Guard?saferName=' + values.saferName);
};
const pagination = {
defaultCurrent: 1,
current: 1,
total: CurDataFollow != null ? CurDataFollow.length : CurDataFollow,
};
......@@ -52,20 +54,54 @@ const Detail = (props: any) => {
},
];
const handleClick = () => {
console.log('注销单元');
const handleClick = (id: string) => {
confirm({
title: 'Warning',
icon: <ExclamationCircleOutlined />,
content: 'Are you sure want to write off?',
onOk() {
dispatch({ type: 'ServiceProvider/DelServiceProvider', playload: { id } });
},
onCancel() {
console.log('Cancel');
},
});
};
useEffect(() => {
console.log(Result);
if (Result !== null) {
if (Result) {
dispatch({ type: 'ServiceProvider/ResultClear' });
message.success('Logout successful!', 3, () => {
history.goBack();
});
} else {
message.error('Logout failed. Please try again!', 3);
dispatch({ type: 'ServiceProvider/ResultClear', playload: '' });
}
}
}, [Result]);
return (
<div className={styles.base}>
{SaveChooseData !== null ? (
<>
<TitleBack title="Service Provider Details" />
{/* <div className={styles.writeOff}>
<Button icon={<PoweroffOutlined />} type="primary" danger onClick={handleClick}>
{SaveChooseData.enable === 'normal' ? (
<div className={styles.writeOff}>
<Button
icon={<PoweroffOutlined />}
type="primary"
danger
onClick={handleClick.bind(this, SaveChooseData.id)}
>
Write Off
</Button>
</div> */}
</div>
) : (
<div />
)}
<div className={styles.bigbox}>
<div className={styles.box0}>
<div className={styles.box0item1}></div>
......@@ -131,11 +167,12 @@ const Detail = (props: any) => {
};
function mapStateToProps(state: any) {
const { Data, CurDataFollow, SaveChooseData } = state.ServiceProvider;
const { Data, CurDataFollow, SaveChooseData, Result } = state.ServiceProvider;
return {
Data,
CurDataFollow,
SaveChooseData,
Result,
};
}
export default connect(mapStateToProps)(Detail);
......@@ -37,15 +37,27 @@ const ServiceProviderManagement = (props: any) => {
const goToDetail = (values: any, e: any) => {
values.serviceScope = options[values.serviceScopeList[0]][1];
SaveChooseData(values);
if (values.serviceScopeList[0] === '0') {
history.push(location.pathname + '/Detail');
};
const goToCreate = () => {
SaveChooseData(null);
history.push(location.pathname + '/Edit');
} else if (values.serviceScopeList[0] === '1') {
history.push(location.pathname + '/AccoutingDetail');
} else {
history.push('/404');
}
};
const goToEdit = (values: any, e: any) => {
SaveChooseData(values);
history.push(location.pathname + '/Edit');
// if (values.serviceScopeList[0] === '0') {
// } else if (values.serviceScopeList[0] === '1') {
// history.push(location.pathname + '/AccoutingEdit');
// } else {
// history.push('/404');
// }
};
const goToCreate = () => {
SaveChooseData(null);
history.push(location.pathname + '/Edit');
};
const goToServices = () => {
history.push(location.pathname + '/Services');
......@@ -74,7 +86,12 @@ const ServiceProviderManagement = (props: 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>
<a
disabled={record.enable == 'Deregistered' ? true : false}
onClick={goToEdit.bind(this, record)}
>
edit
</a>
</Space>
),
},
......@@ -142,10 +159,14 @@ const ServiceProviderManagement = (props: any) => {
//页面搜索
const CallBackTitleSearch = (comment: any) => {
readyData.serviceCommunityList = comment.serviceCommunityList;
console.log(comment);
if (comment.status == undefined) {
comment.status = '';
}
console.log(comment);
// if (comment.status) {
// }
history.push(
location.pathname +
urlEncode(
......@@ -171,10 +192,10 @@ const ServiceProviderManagement = (props: any) => {
for (let items in tmp) {
switch (tmp[items].enable) {
case 0:
tmp[items].enable = 'unregistered';
tmp[items].enable = 'normal';
break;
case 1:
tmp[items].enable = 'registered';
tmp[items].enable = 'Deregistered';
break;
case 2:
break;
......@@ -191,15 +212,19 @@ const ServiceProviderManagement = (props: any) => {
list={['Service Provider']}
status={[
{
name: ['status', 'services'],
data: [[null, 'All'], ...options],
name: ['status', 'Services'],
data: [...options],
},
]}
community={'serviceCommunityList'}
onSubmit={CallBackTitleSearch}
defaultValue={{
providerName: readyData.providerName,
status: readyData.serviceScope ? parseInt(readyData.serviceScope) : null,
status: readyData.serviceScope
? parseInt(readyData.serviceScope) === 0
? 'SecurutyGuard'
: 'Accountant'
: null,
}}
checklist={
readyData.serviceCommunityList.length !== 0 ? readyData.serviceCommunityList : null
......
......@@ -2,7 +2,7 @@ import React, { useState, useEffect, useRef } from 'react';
import styles from './Services.less';
import { Form, Button, Modal, Space, Pagination, Tooltip, Checkbox } from 'antd';
import { Link, useIntl, connect, Dispatch } from 'umi';
import { connect } from 'umi';
import Line from '../../../components/Line/Line';
import TagSelect from '../../../components/TagSelect/index';
......@@ -11,11 +11,9 @@ import TitleBack from '@/components/TitleBack/TitleBack';
const module = 'User';
const services = ['Security Guards', 'Accountant', 'repair', 'Clean'];
const Services = (props: any) => {
const { dispatch, DataServices } = props;
const formRef = useRef(null);
const formRef = useRef(null as any);
useEffect(() => {
RA(43, { serviceName: '' }, module, dispatch);
......@@ -23,25 +21,26 @@ const Services = (props: any) => {
useEffect(() => {
if (DataServices != null) {
var tmp = DataServices.data.rows.map((v: any) => {
return services[v.serviceCode - 1];
console.log(DataServices);
let tmp = DataServices.data.rows.map((v: object, i: number) => {
return v['serviceName'];
});
console.log(tmp);
formRef.current.setFieldsValue({ services: tmp });
formRef.current['setFieldsValue']({ serviceName: tmp });
}
}, [DataServices]);
const onFinish = (values: any) => {
console.log(values);
RA(
44,
{
id: '5',
serviceName: '律政',
},
module,
dispatch,
);
// RA(
// 44,
// {
// id: '5',
// serviceName: '律政',
// },
// module,
// dispatch,
// );
};
const Add = (values: any) => {
console.log(values);
......@@ -53,7 +52,7 @@ const Services = (props: any) => {
<Form ref={formRef} name="basic" onFinish={onFinish}>
{DataServices != null ? (
<Form.Item label="Available Services" name="serviceCode">
<Form.Item label="Available Services" name="serviceName">
<TagSelect onAdd={Add} onRemove={Remove} />
</Form.Item>
) : null}
......
......@@ -70,7 +70,13 @@ export function TosTosServiceProviderSave(values: any) {
headers: { 'Content-Type': 'application/json' },
});
}
export function TosTosServiceProviderDel(values: any) {
return request('/tos/tosServiceProvider/del', {
method: 'POST',
body: JSON.stringify(values),
headers: { 'Content-Type': 'application/json' },
});
}
// /tos/community/facilities/fuzzy/query
//配置文件
// const yellowcolor ="\033[40;33m"
......
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