Commit 13de2441 authored by Sixiang_Zzb's avatar Sixiang_Zzb

用户管理和物业费管理模块bug处理

parent feb9d58f
...@@ -57,8 +57,10 @@ const PropertyServices = (props: any) => { ...@@ -57,8 +57,10 @@ const PropertyServices = (props: any) => {
}, },
{ {
title: 'Handle status', title: 'Handle status',
dataIndex: 'handle_status', dataIndex: 'id',
render: (text: any, record: any) => <Space size="middle"> {handle_Status[text][1]}</Space>, render: (text: any, record: any) => (
<Space size="middle"> {handle_Status[record.handle_status][1]}</Space>
),
}, },
{ {
title: 'Actions', title: 'Actions',
......
...@@ -143,11 +143,11 @@ ...@@ -143,11 +143,11 @@
.time1 { .time1 {
position: absolute; position: absolute;
top: -60px; top: -60px;
left: 200px; left: 270px;
} }
.time2 { .time2 {
position: absolute; position: absolute;
top: -60px; top: -60px;
left: 285px; left: 360px;
} }
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import styles from './ChargeDetail.less'; import styles from './ChargeDetail.less';
import { Input, Menu, Table, Space, Pagination, Tooltip } from 'antd'; import { Pagination, Tooltip } from 'antd';
import { Link, useIntl, connect, Dispatch } from 'umi'; import { useIntl, connect } from 'umi';
import PDF from 'react-pdf-js'; import PDF from 'react-pdf-js';
import { render } from 'react-dom';
import { Document } from 'react-pdf/dist/entry.webpack';
import { stringSplit } from '../../utils/string'; import { stringSplit } from '../../utils/string';
import { timestampToTime } from '../../utils/time'; import { timestampToTime } from '../../utils/time';
...@@ -16,13 +13,13 @@ import TitleBack from '../../components/TitleBack/TitleBack'; ...@@ -16,13 +13,13 @@ import TitleBack from '../../components/TitleBack/TitleBack';
const ChargeDetail = (props: any) => { const ChargeDetail = (props: any) => {
const { CurData } = props; const { CurData } = props;
const { formatMessage } = useIntl();
const [scale, setState] = useState(1.3); const [scale, setState] = useState(1.3);
const [pages, setPages] = useState(1); const [pages, setPages] = useState(1);
const [curpage, setCurpage] = useState(1); const [curpage, setCurpage] = useState(1);
useEffect(() => { useEffect(() => {
console.log(CurData);
if (!CurData) { if (!CurData) {
history.back(); history.back();
} }
......
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import styles from './index.less'; import styles from './index.less';
import { Input, Menu, Table, Space } from 'antd'; import { Table, Space } from 'antd';
import { Link, useIntl, connect, Dispatch, history } from 'umi'; import { useIntl, connect, history } from 'umi';
import { timestampToTime } from '../../utils/time'; import { timestampToTime } from '../../utils/time';
import { values } from 'lodash';
import { filterObj, urlEncode, filterObjbyTg } from '@/utils/method'; import { filterObj, urlEncode, filterObjbyTg } from '@/utils/method';
import TitleSearch from '../../components/TitleSearch/TitleSearch'; import TitleSearch from '../../components/TitleSearch/TitleSearch';
let readyData: object = { interface readyData {
[key: string]: any;
}
let readyData = {
tosOwnerName: '', tosOwnerName: '',
communityName: '', communityName: '',
pageNum: 1, pageNum: 1,
...@@ -43,6 +46,14 @@ const ChargeManager = (props: any) => { ...@@ -43,6 +46,14 @@ const ChargeManager = (props: any) => {
dispatch({ type: 'PropertyManagement/get', playload: values }); dispatch({ type: 'PropertyManagement/get', playload: values });
}; };
const pagination = {
defaultPageSize: 15,
total: Data && Data.page.totalRow,
showSizeChanger: false,
// current: 1,
};
// 监听路由变化
useEffect(() => { useEffect(() => {
console.log(location.query); console.log(location.query);
if (location.query) { if (location.query) {
...@@ -57,6 +68,7 @@ const ChargeManager = (props: any) => { ...@@ -57,6 +68,7 @@ const ChargeManager = (props: any) => {
} }
}, [location]); }, [location]);
// 监听数据返回
useEffect(() => { useEffect(() => {
if (Data != null) { if (Data != null) {
console.log(Data); console.log(Data);
...@@ -64,14 +76,17 @@ const ChargeManager = (props: any) => { ...@@ -64,14 +76,17 @@ const ChargeManager = (props: any) => {
} }
}, [Data]); }, [Data]);
// 搜索按钮
const TitleSearchContent = (comment: any) => { const TitleSearchContent = (comment: any) => {
console.log(comment); readyData = {
readyData.communityName = comment.communityName; ...comment,
};
let tmp = filterObjbyTg(comment, ['communityName', 'tosOwnerName']); let tmp = filterObjbyTg(comment, ['communityName', 'tosOwnerName']);
tmp['pageNum'] = 1; tmp['pageNum'] = 1;
history.push(location.pathname + urlEncode(tmp)); history.push(location.pathname + urlEncode(tmp));
}; };
// 切换页码
const changePage = (values: any) => { const changePage = (values: any) => {
let tmp = { let tmp = {
...location.query, ...location.query,
...@@ -106,12 +121,6 @@ const ChargeManager = (props: any) => { ...@@ -106,12 +121,6 @@ const ChargeManager = (props: any) => {
}, },
]; ];
const pagination = {
defaultPageSize: 15,
total: Data && Data.page.totalRow,
showSizeChanger: false,
};
return ( return (
<div className={styles.base}> <div className={styles.base}>
<TitleSearch <TitleSearch
......
...@@ -49,7 +49,7 @@ const UsersDetail = (props: any) => { ...@@ -49,7 +49,7 @@ const UsersDetail = (props: any) => {
}; };
const [memberDetail, setMemberDetail] = useState(false); const [memberDetail, setMemberDetail] = useState(false);
const [memberData, setMemberData] = useState(null); const [memberData, setMemberData] = useState(null as any);
const [editFlag, setEditFlag] = useState(false); const [editFlag, setEditFlag] = useState(false);
// const user_status = [[1, "家属"], [2, "租户"]] // const user_status = [[1, "家属"], [2, "租户"]]
...@@ -63,7 +63,9 @@ const UsersDetail = (props: any) => { ...@@ -63,7 +63,9 @@ const UsersDetail = (props: any) => {
const [visible, setVisible] = useState(false); const [visible, setVisible] = useState(false);
const formRef = useRef(null); const formRef = useRef(null as any);
// 提交
const onFinish = (values: any) => { const onFinish = (values: any) => {
if (DataSave != null) { if (DataSave != null) {
values.id = DataSave.id; values.id = DataSave.id;
...@@ -83,6 +85,7 @@ const UsersDetail = (props: any) => { ...@@ -83,6 +85,7 @@ const UsersDetail = (props: any) => {
message.error('Error,Please finish it,not empty!', 3); message.error('Error,Please finish it,not empty!', 3);
} }
}; };
useEffect(() => { useEffect(() => {
if (Result != null) { if (Result != null) {
console.log(Result); console.log(Result);
...@@ -152,8 +155,6 @@ const UsersDetail = (props: any) => { ...@@ -152,8 +155,6 @@ const UsersDetail = (props: any) => {
}; };
const deleteUnit = (values: any) => { const deleteUnit = (values: any) => {
// console.log(values)
confirm({ confirm({
title: 'Are you sure delete this infomation?', title: 'Are you sure delete this infomation?',
icon: <ExclamationCircleOutlined />, icon: <ExclamationCircleOutlined />,
...@@ -180,9 +181,11 @@ const UsersDetail = (props: any) => { ...@@ -180,9 +181,11 @@ const UsersDetail = (props: any) => {
console.log(values); console.log(values);
RA(39, { id: values.id, ownerId: values.owner_id }); RA(39, { id: values.id, ownerId: values.owner_id });
}; };
const titleBackCallBack = () => { const titleBackCallBack = () => {
setMemberDetail(false); setMemberDetail(false);
}; };
useEffect(() => { useEffect(() => {
if (memberResult != null) { if (memberResult != null) {
setMemberDetail(false); setMemberDetail(false);
...@@ -261,26 +264,34 @@ const UsersDetail = (props: any) => { ...@@ -261,26 +264,34 @@ const UsersDetail = (props: any) => {
) : null} ) : null}
<Line /> <Line />
<Spin spinning={DataSaveLoading} tip="Loading Detial"> <div style={{ textAlign: 'center' }}>
{DataSaveDetail != null ? ( <Spin spinning={DataSaveLoading} tip="Loading Detial">
<TableShow {DataSaveDetail ? (
data={DataSaveDetail} <>
onSubmit={tableShowCallback} {DataSaveDetail.rows[0].owner.deleted !== 1 ? (
onChange={deleteUnit} <>
deleteDisable={editFlag} <TableShow
/> data={DataSaveDetail}
) : null} onSubmit={tableShowCallback}
{editFlag ? ( onChange={deleteUnit}
<> deleteDisable={editFlag}
<Line /> />
<Form.Item> </>
<Button type="primary" htmlType="submit"> ) : null}
Submit {editFlag && DataSaveDetail.rows[0].owner.deleted !== 1 ? (
</Button> <>
</Form.Item> <Line />
</> <Form.Item>
) : null} <Button type="primary" htmlType="submit">
</Spin> Submit
</Button>
</Form.Item>
</>
) : null}
</>
) : null}
</Spin>
</div>
</Form> </Form>
</> </>
) : null} ) : null}
...@@ -325,7 +336,6 @@ const UsersDetail = (props: any) => { ...@@ -325,7 +336,6 @@ const UsersDetail = (props: any) => {
function mapStateToProps(state: any) { function mapStateToProps(state: any) {
const { DataSave, DataSaveDetail, Result, returnValue, memberResult } = state.User; const { DataSave, DataSaveDetail, Result, returnValue, memberResult } = state.User;
console.log(state);
return { return {
DataSave, DataSave,
DataSaveDetail, DataSaveDetail,
......
...@@ -170,6 +170,6 @@ ...@@ -170,6 +170,6 @@
.writeOff { .writeOff {
position: absolute; position: absolute;
top: 100px; top: 34px;
right: 200px; right: 150px;
} }
...@@ -6,6 +6,7 @@ import { Link, useIntl, connect, Dispatch, history } from 'umi'; ...@@ -6,6 +6,7 @@ import { Link, useIntl, connect, Dispatch, history } from 'umi';
import ShowOptions from '../../../components/ShowOptions/index'; import ShowOptions from '../../../components/ShowOptions/index';
import TitleBack from '../../../components/TitleBack/TitleBack'; import TitleBack from '../../../components/TitleBack/TitleBack';
import { PoweroffOutlined } from '@ant-design/icons';
const Detail = (props: any) => { const Detail = (props: any) => {
const { dispatch, Data, CurDataFollow, location, SaveChooseData } = props; const { dispatch, Data, CurDataFollow, location, SaveChooseData } = props;
...@@ -19,14 +20,13 @@ const Detail = (props: any) => { ...@@ -19,14 +20,13 @@ const Detail = (props: any) => {
}; };
useEffect(() => { useEffect(() => {
TosSecurityGuarderGet({ companyName: SaveChooseData.providerName }); if (SaveChooseData) {
TosSecurityGuarderGet({ companyName: SaveChooseData.providerName });
} else {
history.goBack();
}
}, []); }, []);
const [showList, setShowList] = useState([]);
useEffect(() => {
console.log(CurDataFollow);
}, [CurDataFollow]);
const goToGuard = (values: any, e: any) => { const goToGuard = (values: any, e: any) => {
GuarderById(values); GuarderById(values);
history.push(location.pathname + '/Guard?saferName=' + values.saferName); history.push(location.pathname + '/Guard?saferName=' + values.saferName);
...@@ -52,66 +52,80 @@ const Detail = (props: any) => { ...@@ -52,66 +52,80 @@ const Detail = (props: any) => {
}, },
]; ];
const handleClick = () => {
console.log('注销单元');
};
return ( return (
<div className={styles.base}> <div className={styles.base}>
<TitleBack title="Service Provider Details" /> {SaveChooseData !== null ? (
<div className={styles.writeOff}> <>
<Button type="primary" danger> <TitleBack title="Service Provider Details" />
Write Off {/* <div className={styles.writeOff}>
</Button> <Button icon={<PoweroffOutlined />} type="primary" danger onClick={handleClick}>
</div> Write Off
<div className={styles.bigbox}> </Button>
<div className={styles.box0}> </div> */}
<div className={styles.box0item1}></div> <div className={styles.bigbox}>
{/* <div className={styles.box0item2}>{SaveChooseData.serviceCommunityList}</div> */} <div className={styles.box0}>
</div> <div className={styles.box0item1}></div>
<div className={styles.box1}> {/* <div className={styles.box0item2}>{SaveChooseData.serviceCommunityList}</div> */}
<div className={styles.box1item1}>Company Name</div> </div>
<div className={styles.box1item2}>{SaveChooseData.providerName}</div> <div className={styles.box1}>
</div> <div className={styles.box1item1}>Company Name</div>
<div className={styles.box1item2}>{SaveChooseData.providerName}</div>
<div className={styles.box2}> </div>
<div className={styles.box2item1}>Office Address</div>
<div className={styles.box2item2}>{SaveChooseData.providerAddress}</div> <div className={styles.box2}>
</div> <div className={styles.box2item1}>Office Address</div>
<div className={styles.box2item2}>{SaveChooseData.providerAddress}</div>
<div className={styles.box3}> </div>
<div className={styles.box3item1}>Person In Charge</div>
<div className={styles.box3item2}>{SaveChooseData.contactName}</div> <div className={styles.box3}>
</div> <div className={styles.box3item1}>Person In Charge</div>
<div className={styles.box3item2}>{SaveChooseData.contactName}</div>
<div className={styles.box4}> </div>
<div className={styles.box4item1}>Contact Details</div>
<div className={styles.box4item2}> <div className={styles.box4}>
{SaveChooseData.contactPhone} &nbsp;&nbsp;&nbsp;&nbsp; {SaveChooseData.contactEmail} <div className={styles.box4item1}>Contact Details</div>
<div className={styles.box4item2}>
{SaveChooseData.contactPhone} &nbsp;&nbsp;&nbsp;&nbsp; {SaveChooseData.contactEmail}
</div>
</div>
<div className={styles.box5}>
<div className={styles.box5item1}>Services Available</div>
<div className={styles.box5item2}>{SaveChooseData.serviceScope}</div>
</div>
<div className={styles.box6}>
<div className={styles.box1item1}>Service Community</div>
</div>
{SaveChooseData.serviceCommunityList != null ? (
<ShowOptions
list={SaveChooseData.serviceCommunityList}
defaultValue={'Put It Away'}
/>
) : (
<></>
)}
</div> </div>
</div> {SaveChooseData.serviceScopeList.some((v: any) => v === 'Security Guards') ? (
<>
<div className={styles.box5}> <div className={styles.box7}>
<div className={styles.box5item1}>Services Available</div> <div className={styles.box1item1}>Security Guard Account</div>
<div className={styles.box5item2}>Cleaning,Security Guard</div> </div>
</div> <Table
rowKey={'id'}
<div className={styles.box6}> style={{ marginTop: 16 }}
<div className={styles.box1item1}>Service Community</div> dataSource={CurDataFollow}
</div> columns={columns}
{SaveChooseData.serviceCommunityList != null ? ( pagination={pagination}
<ShowOptions list={SaveChooseData.serviceCommunityList} defaultValue={'Put It Away'} /> />
) : ( </>
<></> ) : null}
)} </>
) : null}
<div className={styles.box7}>
<div className={styles.box1item1}>Security Guard Account</div>
</div>
</div>
<Table
rowKey={'id'}
style={{ marginTop: 16 }}
dataSource={CurDataFollow}
columns={columns}
pagination={pagination}
/>
</div> </div>
); );
}; };
......
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import styles from './Edit.less'; import styles from './Edit.less';
import { Input, Button, Form, Result, Pagination, Tooltip, Checkbox, Spin } from 'antd'; import {
Input,
import { Link, useIntl, connect } from 'umi'; Button,
Form,
Result,
Pagination,
Tooltip,
Checkbox,
Spin,
Radio,
message,
} from 'antd';
import { Link, useIntl, connect, history } from 'umi';
import SelectOptions from '../../../components/SelectOptions/index'; 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<{}> = []; let options: Array<{ label: string; value: number }> = [];
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) => { const TosTosServiceProviderSave = (values: any) => {
...@@ -25,22 +36,30 @@ const Edit = (props: any) => { ...@@ -25,22 +36,30 @@ const Edit = (props: any) => {
}; };
const formRef = useRef(null as any); const formRef = useRef(null as any);
// 拿取服务范围数据
useEffect(() => { useEffect(() => {
RA(43, {}, module, dispatch); RA(43, {}, module, dispatch);
}, []); }, []);
// 处理服务范围数据
useEffect(() => { useEffect(() => {
if (DataServices != null) { if (DataServices != null) {
var tmp = DataServices.data.serviceScopeList; options = DataServices.data.rows.map((v: any) => {
options = tmp.map((v: string, i: number) => {
return { return {
label: v, label: v.serviceName,
value: i.toString(), value: v.serviceCode,
}; };
}); });
} }
}, [DataServices]); }, [DataServices]);
// 判断是否有小区列表数据返回
useEffect(() => {
if (!CommunityList) {
history.goBack();
}
}, []);
useEffect(() => { useEffect(() => {
console.log(CurData); console.log(CurData);
if (CurData != null) { if (CurData != null) {
...@@ -50,28 +69,37 @@ const Edit = (props: any) => { ...@@ -50,28 +69,37 @@ const Edit = (props: any) => {
useEffect(() => { useEffect(() => {
if (SaveChooseData != null) { if (SaveChooseData != null) {
console.log(SaveChooseData); // console.log(SaveChooseData);
console.log(options); // console.log(options);
let arr: [] = []; // let arr: Array<''> = [];
SaveChooseData.serviceScopeList.forEach((v: any) => { // SaveChooseData.serviceScopeList.forEach((v: any) => {
options.forEach((ele: any) => { // options.forEach((ele: any) => {
if (v === ele.label) { // if (v === ele.value) {
arr.push(ele.value as never); // arr.push(ele.value as never);
} // }
}); // });
}); // });
SaveChooseData.serviceScopeList = arr; // console.log(arr);
// SaveChooseData.serviceScopeList = arr;
SaveChooseData.serviceScopeList = SaveChooseData.serviceScopeList[0];
formRef.current.setFieldsValue(SaveChooseData); formRef.current.setFieldsValue(SaveChooseData);
} }
}, [SaveChooseData]); }, [SaveChooseData]);
// 提交按钮
const onFinish = (values: any) => { const onFinish = (values: any) => {
if (CList.length === 0) {
message.warning('Please select at least one service Community!', 3);
return;
}
var val = values; var val = values;
val.serviceCommunityList = CList; val.serviceCommunityList = CList;
val.creator = 'admin'; val.creator = 'admin';
val.updater = 'admin'; val.updater = 'admin';
console.log(val); val.serviceScopeList = [val.serviceScopeList];
return; if (SaveChooseData) {
val.id = SaveChooseData.id;
}
setload(true); setload(true);
TosTosServiceProviderSave(val); TosTosServiceProviderSave(val);
}; };
...@@ -136,7 +164,8 @@ const Edit = (props: any) => { ...@@ -136,7 +164,8 @@ const Edit = (props: any) => {
}, },
]} ]}
> >
<Checkbox.Group options={options as any} /> {/* <Checkbox.Group options={options as any} /> */}
<Radio.Group options={options as any} />
</Form.Item> </Form.Item>
</div> </div>
</div> </div>
...@@ -210,8 +239,6 @@ function mapStateToProps(state: any) { ...@@ -210,8 +239,6 @@ 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;
console.log(state.ServiceProvider);
console.log(CurData);
return { return {
CurData, CurData,
SaveChooseData, SaveChooseData,
......
...@@ -13,7 +13,7 @@ import { TosSecurityGuarderGet } from '@/services/tos'; ...@@ -13,7 +13,7 @@ import { TosSecurityGuarderGet } from '@/services/tos';
const module = 'User'; const module = 'User';
// 服务范围数据 // 服务范围数据
let options: Array<[]> = []; let options: Array<[number, string]> = [];
// 筛选参数 // 筛选参数
let readyData: any = { let readyData: any = {
...@@ -25,13 +25,6 @@ let readyData: any = { ...@@ -25,13 +25,6 @@ let readyData: any = {
// 节流阀 // 节流阀
let flag = false; let flag = false;
const services = [
[0, 'Security Guards'],
[0, 'Accountant'],
[0, 'repair'],
[0, 'Clean'],
];
const ServiceProviderManagement = (props: any) => { const ServiceProviderManagement = (props: any) => {
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
...@@ -42,6 +35,7 @@ const ServiceProviderManagement = (props: any) => { ...@@ -42,6 +35,7 @@ const ServiceProviderManagement = (props: any) => {
}; };
const goToDetail = (values: any, e: any) => { const goToDetail = (values: any, e: any) => {
values.serviceScope = options[values.serviceScopeList[0]][1];
SaveChooseData(values); SaveChooseData(values);
history.push(location.pathname + '/Detail'); history.push(location.pathname + '/Detail');
}; };
...@@ -69,11 +63,9 @@ const ServiceProviderManagement = (props: any) => { ...@@ -69,11 +63,9 @@ const ServiceProviderManagement = (props: any) => {
title: 'Services Available', title: 'Services Available',
dataIndex: 'serviceScopeList', dataIndex: 'serviceScopeList',
render: (text: any, record: any) => { render: (text: any, record: any) => {
let str: string = ''; if (options.length > 0) {
text.forEach((v: string, i: number) => { return options[text[0]][1];
str += i === text.length - 1 ? v : v + ','; }
});
return str;
}, },
}, },
{ title: 'Account Status', dataIndex: 'enable' }, { title: 'Account Status', dataIndex: 'enable' },
...@@ -93,13 +85,13 @@ const ServiceProviderManagement = (props: any) => { ...@@ -93,13 +85,13 @@ const ServiceProviderManagement = (props: any) => {
RA(43, {}, module, dispatch); RA(43, {}, module, dispatch);
}, []); }, []);
// 处理服务商数据
useEffect(() => { useEffect(() => {
if (DataServices) { if (DataServices) {
console.log(DataServices); console.log(DataServices);
options = DataServices.data.rows.map((v: any) => {
// options = DataServices.data.serviceScopeList.map((v: string, i: number) => { return [v.serviceCode, v.serviceName];
// return [i, v]; });
// });
} }
}, [DataServices]); }, [DataServices]);
...@@ -150,6 +142,10 @@ const ServiceProviderManagement = (props: any) => { ...@@ -150,6 +142,10 @@ const ServiceProviderManagement = (props: any) => {
//页面搜索 //页面搜索
const CallBackTitleSearch = (comment: any) => { const CallBackTitleSearch = (comment: any) => {
readyData.serviceCommunityList = comment.serviceCommunityList; readyData.serviceCommunityList = comment.serviceCommunityList;
console.log(comment);
if (comment.status == undefined) {
comment.status = '';
}
history.push( history.push(
location.pathname + location.pathname +
urlEncode( urlEncode(
...@@ -184,24 +180,6 @@ const ServiceProviderManagement = (props: any) => { ...@@ -184,24 +180,6 @@ const ServiceProviderManagement = (props: any) => {
break; break;
} }
} }
for (let items in tmp) {
for (let items1 in tmp[items].serviceScopeList) {
switch (tmp[items].serviceScopeList[items1]) {
case '0':
tmp[items].serviceScopeList[items1] = 'Security Guards';
break;
case '1':
tmp[items].serviceScopeList[items1] = 'Accountant';
break;
case '2':
tmp[items].serviceScopeList[items1] = 'repair';
break;
case '3':
tmp[items].serviceScopeList[items1] = 'Clean';
break;
}
}
}
return tmp; return tmp;
}; };
...@@ -228,7 +206,7 @@ const ServiceProviderManagement = (props: any) => { ...@@ -228,7 +206,7 @@ const ServiceProviderManagement = (props: any) => {
onSubmit={CallBackTitleSearch} onSubmit={CallBackTitleSearch}
defaultValue={{ defaultValue={{
providerName: readyData.providerName, providerName: readyData.providerName,
status: readyData.serviceScope ? parseInt(readyData.serviceScope) : undefined, status: readyData.serviceScope ? parseInt(readyData.serviceScope) : null,
}} }}
checklist={ checklist={
readyData.serviceCommunityList.length !== 0 ? readyData.serviceCommunityList : null readyData.serviceCommunityList.length !== 0 ? readyData.serviceCommunityList : null
......
...@@ -9,67 +9,65 @@ import TagSelect from '../../../components/TagSelect/index'; ...@@ -9,67 +9,65 @@ import TagSelect from '../../../components/TagSelect/index';
import { RA } from '@/utils/method'; import { RA } from '@/utils/method';
import TitleBack from '@/components/TitleBack/TitleBack'; import TitleBack from '@/components/TitleBack/TitleBack';
const module = "User" const module = 'User';
const Services = (props: any) => {
const services = ['Security Guards', 'Accountant', 'repair', 'Clean'];
const { dispatch, DataServices } = props const Services = (props: any) => {
const formRef = useRef(null) const { dispatch, DataServices } = props;
const formRef = useRef(null);
useEffect(() => { useEffect(() => {
RA(43, { serviceName: "" }, module, dispatch) RA(43, { serviceName: '' }, module, dispatch);
}, [location]) }, [location]);
useEffect(() => { useEffect(() => {
if (DataServices != null) { if (DataServices != null) {
var tmp = DataServices.data.serviceScopeList var tmp = DataServices.data.rows.map((v: any) => {
console.log(tmp) return services[v.serviceCode - 1];
console.log(formRef) });
formRef.current.setFieldsValue({ services: tmp }) console.log(tmp);
formRef.current.setFieldsValue({ services: tmp });
} }
}, [DataServices]) }, [DataServices]);
const onFinish = (values: any) => { const onFinish = (values: any) => {
console.log(values) console.log(values);
RA(44, { RA(
id: "5", 44,
serviceName: "律政" {
}, module, dispatch) id: '5',
} serviceName: '律政',
},
module,
dispatch,
);
};
const Add = (values: any) => { const Add = (values: any) => {
console.log(values) console.log(values);
} };
const Remove = (values: any) => { const Remove = (values: any) => {};
}
return ( return (
<div className={styles.base}> <div className={styles.base}>
<TitleBack title={'Services Available Management'}></TitleBack>
<TitleBack title={"Services Available Management"}></TitleBack>
<Form ref={formRef} name="basic" onFinish={onFinish}> <Form ref={formRef} name="basic" onFinish={onFinish}>
{DataServices != null ? {DataServices != null ? (
<Form.Item label="Available Services" name="services"><TagSelect onAdd={Add} onRemove={Remove} /></Form.Item> <Form.Item label="Available Services" name="serviceCode">
: null <TagSelect onAdd={Add} onRemove={Remove} />
} </Form.Item>
) : null}
<Line /> <Line />
{/* <Form.Item ><Button type="primary" htmlType="submit">Submit</Button></Form.Item> */} {/* <Form.Item ><Button type="primary" htmlType="submit">Submit</Button></Form.Item> */}
</Form> </Form>
</div> </div>
); );
}; };
function mapStateToProps(state: any) { function mapStateToProps(state: any) {
const { DataServices } = state.User const { DataServices } = state.User;
return { return {
DataServices DataServices,
} };
} }
export default connect(mapStateToProps)(Services) export default connect(mapStateToProps)(Services);
...@@ -152,7 +152,7 @@ export const filterObjbyTg = (obj: any, tg: any) => { ...@@ -152,7 +152,7 @@ export const filterObjbyTg = (obj: any, tg: any) => {
var tmp = {}; var tmp = {};
for (var item in obj) { for (var item in obj) {
if (tg.indexOf(item) > -1) { if (tg.indexOf(item) > -1) {
if ((obj[item] === 0 || obj[item]) && obj[item] != null) { if (obj[item] != null) {
tmp[item] = obj[item]; tmp[item] = obj[item];
} }
} }
......
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