Commit f6dae9f3 authored by 1271610056@qq.com's avatar 1271610056@qq.com

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

parents 3699ba57 e8a38aa7
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import styles from './index.less'; import styles from './index.less';
import { Row, Col, Table, Space,Tabs, Button } from 'antd'; import { Row, Col, Table, Space, Tabs, Button } from 'antd';
const { TabPane } = Tabs const { TabPane } = Tabs
import { objectColumns} from '@/utils/string'; import { objectColumns } from '@/utils/string';
import { size } from 'lodash'; import { size } from 'lodash';
import Toast from '../Toast/Toast'; import Toast from '../Toast/Toast';
const TableShow = (props:any) => { const TableShow = (props: any) => {
const { data } = props; const { data } = props;
const dataRow = data.rows; const dataRow = data.rows;
const goTo = (values:any,e:any) => { const goTo = (values: any, e: any) => {
console.log(values) console.log(values)
props.onSubmit(values) props.onSubmit(values)
} }
...@@ -24,17 +24,17 @@ const TableShow = (props:any) => { ...@@ -24,17 +24,17 @@ const TableShow = (props:any) => {
useEffect(() => { useEffect(() => {
console.log("组件入参") console.log("组件入参")
console.log(dataRow) console.log(dataRow)
},[]) }, [])
// //
// Contact Details // Contact Details
// Email // Email
// cdk_code // cdk_code
// Account Type // Account Type
// User Status // User Status
// ower_email: "535740436@qq.com" // ower_email: "535740436@qq.com"
// ower_name: "测试" // ower_name: "测试"
// ower_phone: "微微" // ower_phone: "微微"
// Owner/Family Member/Tenant // Owner/Family Member/Tenant
// const user_status = [[1, "家属"], [2, "租户"]] // const user_status = [[1, "家属"], [2, "租户"]]
...@@ -44,14 +44,14 @@ const TableShow = (props:any) => { ...@@ -44,14 +44,14 @@ 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 = ["Not Used", "Used"]
const key = objectColumns([ const key = objectColumns([
["User Name", "ower_name"], ["User Name", "ower_name"],
["Contact Details", "ower_phone"], ["Contact Details", "ower_phone"],
["Email", "ower_email"], ["Email", "ower_email"],
["RelationShip", null, (text: any, record: any) => (<Space size="middle">{record.owner_relationship != null ? user_status[(record.owner_relationship) - 1][1] : null}</Space>)], ["RelationShip", null, (text: any, record: any) => (<Space size="middle">{record.owner_relationship != null ? user_status[(record.owner_relationship) - 1][1] : null}</Space>)],
["status", null, (text: any, record: any) => (<Space size="middle">{user_type_status[record.enable]}</Space>)], ["status", null, (text: any, record: any) => (<Space size="middle">{user_type_status[record.enable]}</Space>)],
["Actions",null, (text: any, record: any) => (<Space size="middle"> <a onClick={goTo.bind(this,record)}>Detail</a></Space>)], ["Actions", null, (text: any, record: any) => (<Space size="middle"> <a onClick={goTo.bind(this, record)}>Detail</a></Space>)],
]) ])
...@@ -60,11 +60,11 @@ const TableShow = (props:any) => { ...@@ -60,11 +60,11 @@ const TableShow = (props:any) => {
<Tabs defaultActiveKey="0" > <Tabs defaultActiveKey="0" >
{ {
dataRow.map((item, index) => { dataRow.map((item, index) => {
return( return (
<TabPane tab={item.name} key={index}> <TabPane tab={item.name} key={index}>
<Row gutter={16}><Col>Address:</Col><Col>{((item).owner).addressAndpostalCode}</Col></Row> <Row gutter={16}><Col>Address:</Col><Col>{((item).owner).addressAndpostalCode + " " + ((item).owner).buildingNumber + "#" + ((item).owner).floorNumber + "-" + ((item).owner).roomNumber}</Col></Row>
{ {
(item.unit).map((unit:any, uindex:any) => { (item.unit).map((unit: any, uindex: any) => {
return ( return (
<div key={unit.living}> <div key={unit.living}>
<Row gutter={32}> <Row gutter={32}>
...@@ -72,11 +72,11 @@ const TableShow = (props:any) => { ...@@ -72,11 +72,11 @@ const TableShow = (props:any) => {
<Table title={() => { <Table title={() => {
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}><Col>Unit No:</Col><Col>{unit.living}</Col></Row> <Row gutter={32}><Col>Unit No:</Col><Col>{unit.living}</Col></Row>
</div> </div>
<div style={{ position: "absolute", right: 0,bottom:16 }}> <div style={{ position: "absolute", right: 0, bottom: 16 }}>
{props.deleteDisable ?<Button type="danger" onClick={deleteUnit.bind(this, unit.living)}>Delete</Button> : null} {props.deleteDisable ? null : <Button type="primary" danger onClick={deleteUnit.bind(this, unit.living)}>Delete</Button>}
</div> </div>
</div> </div>
) )
...@@ -95,7 +95,8 @@ const TableShow = (props:any) => { ...@@ -95,7 +95,8 @@ const TableShow = (props:any) => {
}) })
} }
</TabPane> </TabPane>
)}) )
})
} }
</Tabs> </Tabs>
......
...@@ -81,7 +81,8 @@ class TagSelect extends React.Component { ...@@ -81,7 +81,8 @@ class TagSelect extends React.Component {
const { value, inputVisible, inputValue, editInputIndex, editInputValue } = this.state; const { value, inputVisible, inputValue, editInputIndex, editInputValue } = this.state;
return ( return (
<> <>
{value.map((tag, index) => { {
value.map((tag, index) => {
if (editInputIndex === index) { if (editInputIndex === index) {
return ( return (
<Input <Input
...@@ -127,7 +128,9 @@ class TagSelect extends React.Component { ...@@ -127,7 +128,9 @@ class TagSelect extends React.Component {
) : ( ) : (
tagElem tagElem
); );
})} })
}
{inputVisible && ( {inputVisible && (
<Input <Input
ref={this.saveInputRef} ref={this.saveInputRef}
......
...@@ -4,19 +4,21 @@ import styles from './index.less'; ...@@ -4,19 +4,21 @@ import styles from './index.less';
import BackButton from '../BackButton/BackButton'; import BackButton from '../BackButton/BackButton';
import TitleGet from '../TitleGet/TitleGet'; import TitleGet from '../TitleGet/TitleGet';
const TitleBack = (props:any) => { const TitleBack = (props: any) => {
// <TitleBack sublist={['Handle Status : '+CurDataDetail.status,'Create Time : '+CurDataDetail.time]} title={headTitle} /> // <TitleBack sublist={['Handle Status : '+CurDataDetail.status,'Create Time : '+CurDataDetail.time]} title={headTitle} />
const backData = (values:any) => { console.log(props, "创建时间====================")
const backData = (values: any) => {
props.titleBack(values) props.titleBack(values)
} }
return ( return (
<> <>
<div className={styles.item0}><TitleGet title={props.title} /></div> <div className={styles.item0}><TitleGet title={props.title} /></div>
{ {
props.sublist!=null props.sublist != null && props.title == "Edit Owner Infomation"
? ?
(props.sublist).map((item:any,index:any)=>{ (props.sublist).map((item: any, index: any) => {
return ( return (
<div key={index} className={styles.item1}>{item}</div> <div key={index} className={styles.item1}>{item}</div>
) )
...@@ -24,7 +26,7 @@ const TitleBack = (props:any) => { ...@@ -24,7 +26,7 @@ const TitleBack = (props:any) => {
: :
<></> <></>
} }
<div className={styles.item2}><BackButton backFunction={backData} url={props.url}/></div> <div className={styles.item2}><BackButton backFunction={backData} url={props.url} /></div>
<div className={styles.clear0}></div> <div className={styles.clear0}></div>
</> </>
); );
......
import React, { useState,useEffect,useRef} from 'react'; import React, { useState, useEffect, useRef } from 'react';
import { Link, useIntl, connect, Dispatch, history } from 'umi'; import { Link, useIntl, connect, Dispatch, history } from 'umi';
import styles from './index.less'; import styles from './index.less';
...@@ -6,23 +6,24 @@ import styles from './index.less'; ...@@ -6,23 +6,24 @@ import styles from './index.less';
import BackButton from '../BackButton/BackButton'; import BackButton from '../BackButton/BackButton';
import TitleGet from '../TitleGet/TitleGet'; import TitleGet from '../TitleGet/TitleGet';
import { Input, Row, Col, Form, Select, Button,DatePicker } from 'antd'; import { Input, Row, Col, Form, Select, Button, DatePicker } from 'antd';
const { Option } = Select; const { Option } = Select;
import SelectOptions from '../../components/SelectOptions/index'; import SelectOptions from '../../components/SelectOptions/index';
import { gray } from 'chalk'; 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, CommunityList } = props; const { dispatch, CommunityList } = props;
const key = props.listkey const key = props.listkey
const name = props.list; const name = props.list;
const single = props.single const single = props.single
const checklist = props.checklist; const checklist = props.checklist;
const status = props.status; const status = props.status;
const communitySelect=props.communitySelect const communitySelect = props.communitySelect
const defaultValue = props.defaultValue const defaultValue = props.defaultValue
const time = props.time; const time = props.time;
...@@ -34,7 +35,7 @@ const TitleSearch= (props:any) => { ...@@ -34,7 +35,7 @@ const TitleSearch= (props:any) => {
const formRef = useRef(null) const formRef = useRef(null)
const tosCommunityget = (values:any) => {dispatch({type: 'Init/tosCommunityget',playload:values})}; const tosCommunityget = (values: any) => { dispatch({ type: 'Init/tosCommunityget', playload: values }) };
useEffect(() => { useEffect(() => {
// console.log("标题搜寻组件初始化") OK // console.log("标题搜寻组件初始化") OK
if (CommunityList == null) { if (CommunityList == null) {
...@@ -46,13 +47,15 @@ const TitleSearch= (props:any) => { ...@@ -46,13 +47,15 @@ const TitleSearch= (props:any) => {
} }
}, []); }, []);
useEffect(()=>{ useEffect(() => {
if (defaultValue != null) { if (defaultValue != null) {
formRef.current.setFieldsValue(defaultValue) formRef.current.setFieldsValue(defaultValue)
} }
},[defaultValue]) }, [defaultValue])
useEffect(()=>{ useEffect(() => {
console.log(CommunityList)
if (CommunityList != null) { if (CommunityList != null) {
// console.log("小区数量初始化完毕") OK // console.log("小区数量初始化完毕") OK
...@@ -61,30 +64,30 @@ const TitleSearch= (props:any) => { ...@@ -61,30 +64,30 @@ const TitleSearch= (props:any) => {
// props.onSubmit(tmp) 禁用 改用组件初始化 // props.onSubmit(tmp) 禁用 改用组件初始化
setCommunitys(CommunityList) setCommunitys(CommunityList)
} }
},[CommunityList]) }, [CommunityList])
const onFinish = (values:any) => { const onFinish = (values: any) => {
if (datePicker) { if (datePicker) {
values[time[0]] = datePicker; values[time[0]] = datePicker;
} }
if (community) { if (community) {
values[community]=communitys values[community] = communitys
} }
console.log('Success:', values); console.log('Success:', values);
props.onSubmit(values) props.onSubmit(values)
}; };
const onFinishFailed = (errorInfo:any) => { const onFinishFailed = (errorInfo: any) => {
console.log('Failed:', errorInfo); console.log('Failed:', errorInfo);
}; };
const onChange = (date:any,dateString:string) => { const onChange = (date: any, dateString: string) => {
setDate(dateString) setDate(dateString)
} }
const printContent = (comment: any)=>{ const printContent = (comment: any) => {
setCommunitys(comment) setCommunitys(comment)
} }
...@@ -99,20 +102,21 @@ const TitleSearch= (props:any) => { ...@@ -99,20 +102,21 @@ const TitleSearch= (props:any) => {
: null : null
} }
{ {
key!=null? key != null ?
key.map((item, index) => { key.map((item, index) => {
return ( return (
<Col key={"KeyCol_"+ index}><Form.Item name={item}><Input placeholder={name[index]} allowClear /></Form.Item></Col> <Col key={"KeyCol_" + index}><Form.Item name={item}><Input placeholder={name[index]} allowClear /></Form.Item></Col>
) )
}) })
:null : null
} }
{ {
status != null ? status != null ?
status.map((item, index) => { status.map((item, index) => {
return ( return (
<Col key={"StatusCol_" + index}><Form.Item name={item.name[0]}> <Col key={"StatusCol_" + index}>
<Select style={{width:160}} placeholder={item.name[1]} allowClear={true}> <Form.Item name={item.name[0]}>
<Select style={{ width: 160 }} placeholder={item.name[1]} allowClear={true}>
{ {
item.data.map(word => { item.data.map(word => {
return ( return (
...@@ -120,10 +124,12 @@ const TitleSearch= (props:any) => { ...@@ -120,10 +124,12 @@ const TitleSearch= (props:any) => {
) )
}) })
} }
</Select></Form.Item></Col> </Select>
</Form.Item>
</Col>
) )
}) })
:null : null
} }
{ {
time != null ? time != null ?
...@@ -141,11 +147,11 @@ const TitleSearch= (props:any) => { ...@@ -141,11 +147,11 @@ const TitleSearch= (props:any) => {
<> <>
{ {
CommunityList != null ? CommunityList != null ?
<SelectOptions checklist={checklist} single={single} list={CommunityList.sort()} show={selectOptions} onSubmit={printContent} />: <SelectOptions checklist={checklist} single={single} list={CommunityList.sort()} show={selectOptions} onSubmit={printContent} /> :
null null
} }
<Form.Item><Button type="primary" htmlType="submit" style={{ backgroundColor: "#e7f4ff",color:"rgba(24,144,255,1)"}}>Search</Button></Form.Item> <Form.Item><Button type="primary" htmlType="submit" style={{ backgroundColor: "#e7f4ff", color: "rgba(24,144,255,1)" }}>Search</Button></Form.Item>
</> : null </> : null
} }
...@@ -158,7 +164,8 @@ const TitleSearch= (props:any) => { ...@@ -158,7 +164,8 @@ 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 { export default {
'R.charge.input.project': 'Project', 'R.charge.input.project': 'Project',
'R.charge.input.nameofowner':'Name of Owner', 'R.charge.input.nameofowner': 'Name of Owner',
'R.charge.username': 'User Name', 'R.charge.username': 'User Name',
'R.charge.project': 'Project', 'R.charge.project': 'Project',
'R.charge.unit': 'Unit', 'R.charge.unit': 'Unit',
'R.charge.status': 'Status', 'R.charge.status': 'Status',
'R.charge.submissionTime': 'Submission Time', 'R.charge.submissionTime': 'Submission Time',
'R.charge.usertype': 'user Type',
'R.charge.actions': 'Actions', 'R.charge.actions': 'Actions',
'R.charge.search': 'Search', 'R.charge.search': 'Search',
'R.charge.addaccount': 'Add Account', 'R.charge.addaccount': 'Add Account',
'R.charge.paymentsetting': 'Payment Setting', 'R.charge.paymentsetting': 'Payment Setting',
'R.selectoptions.open': 'Open', 'R.selectoptions.open': 'Open',
'R.selectoptions.PutItAway':'Put It Away', 'R.selectoptions.PutItAway': 'Put It Away',
'R.selectoptions.Selected':'Selected', 'R.selectoptions.Selected': 'Selected',
'R.selectoptions.SelectNone': 'Select None', 'R.selectoptions.SelectNone': 'Select None',
'R.selectoptions.all':'All', 'R.selectoptions.all': 'All',
'R.selectoptions.SearchCell': 'Search cell', 'R.selectoptions.SearchCell': 'Search cell',
}; };
export default { export default {
'R.charge.input.project': '所在小区', 'R.charge.input.project': '所在小区',
'R.charge.input.nameofowner':'业主名称', 'R.charge.input.nameofowner': '业主名称',
'R.charge.username': '业主名称', 'R.charge.username': '业主名称',
'R.charge.project': '所在小区', 'R.charge.project': '所在小区',
'R.charge.unit': '所在单元', 'R.charge.unit': '所在单元',
'R.charge.status': '状态', 'R.charge.status': '状态',
'R.charge.submissionTime': '提交时间', 'R.charge.submissionTime': '提交时间',
'R.charge.usertype': '用户类型',
'R.charge.actions': '操作', 'R.charge.actions': '操作',
'R.charge.search': '搜索', 'R.charge.search': '搜索',
'R.charge.addaccount': '添加会计', 'R.charge.addaccount': '添加会计',
'R.charge.paymentsetting': '缴费设置', 'R.charge.paymentsetting': '缴费设置',
'R.selectoptions.open': '展开', 'R.selectoptions.open': '展开',
'R.selectoptions.PutItAway':'收起', 'R.selectoptions.PutItAway': '收起',
'R.selectoptions.Selected':'已选', 'R.selectoptions.Selected': '已选',
'R.selectoptions.SelectNone': '全不选', 'R.selectoptions.SelectNone': '全不选',
'R.selectoptions.all':'所有', 'R.selectoptions.all': '所有',
'R.selectoptions.SearchCell':'搜索小区', 'R.selectoptions.SearchCell': '搜索小区',
}; };
...@@ -2,13 +2,13 @@ import * as service from '../../services/tos'; ...@@ -2,13 +2,13 @@ import * as service from '../../services/tos';
import { message } from 'antd'; import { message } from 'antd';
import { Link, useIntl, connect, Dispatch, history } from 'umi'; import { Link, useIntl, connect, Dispatch, history } from 'umi';
import { routerRedux } from 'dva/router' import { routerRedux } from 'dva/router';
export default { export default {
namespace: 'User', namespace: 'User',
state: { state: {
Data: null, Data: null,
DataPage:{totalRow:0}, DataPage: { totalRow: 0 },
Data3Error: null, Data3Error: null,
DataSave: null, DataSave: null,
DataSaveDetail: null, DataSaveDetail: null,
...@@ -22,21 +22,21 @@ export default { ...@@ -22,21 +22,21 @@ export default {
returnValue: null, returnValue: null,
memberResult: null, memberResult: null,
DataServices:null, DataServices: null,
}, },
reducers: { reducers: {
returnPage(state, { Data,DataPage,DataSave}) { returnPage(state, { Data, DataPage, DataSave }) {
return { ...state, Data,DataPage,DataSave }; return { ...state, Data, DataPage, DataSave };
}, },
returnData3Error(state, { Data3Error }) { returnData3Error(state, { Data3Error }) {
return { ...state, Data3Error }; return { ...state, Data3Error };
}, },
returnDataSave(state, { DataSave }) { returnDataSave(state, { DataSave }) {
return { ...state, DataSave}; return { ...state, DataSave };
}, },
DataSaveDetail(state, { DataSaveDetail,returnValue}) { DataSaveDetail(state, { DataSaveDetail, returnValue }) {
return { ...state, DataSaveDetail,returnValue}; return { ...state, DataSaveDetail, returnValue };
}, },
returnSource(state, { sourceData }) { returnSource(state, { sourceData }) {
return { ...state, sourceData }; return { ...state, sourceData };
...@@ -45,157 +45,174 @@ export default { ...@@ -45,157 +45,174 @@ export default {
return { ...state, curString }; return { ...state, curString };
}, },
returnResult(state, { Result }) { returnResult(state, { Result }) {
return {...state,Result} return { ...state, Result };
}, },
returnCommunityInfo(state, { communityInfo }) { returnCommunityInfo(state, { communityInfo }) {
return {...state,communityInfo} return { ...state, communityInfo };
}, },
PageDate(state, { pageDate }) { PageDate(state, { pageDate }) {
return {...state,pageDate} return { ...state, pageDate };
}, },
ReturnValue(state, { returnValue }) { ReturnValue(state, { returnValue }) {
return{...state,returnValue} return { ...state, returnValue };
}, },
returnMemberResult(state, { memberResult }) { returnMemberResult(state, { memberResult }) {
return{...state,memberResult} return { ...state, memberResult };
}, },
returnDataServices(state, { DataServices }) { returnDataServices(state, { DataServices }) {
return{...state,DataServices} return { ...state, DataServices };
} },
}, },
effects: { effects: {
*RA({ playload }, { call, put }) { *RA({ playload }, { call, put }) {
switch (playload.index) { switch (playload.index) {
case 12: case 12:
{ {
let Data = null; let Data = null;
yield put({ type: 'returnPage', Data }); yield put({ type: 'returnPage', Data });
} break; }
case 13: { break;
case 13:
{
let DataSaveDetail = null; let DataSaveDetail = null;
let returnValue = null; let returnValue = null;
yield put({ type: 'DataSaveDetail', DataSaveDetail,returnValue }); yield put({ type: 'DataSaveDetail', DataSaveDetail, returnValue });
} break; }
case 43: { break;
case 43:
{
let DataServices = null; let DataServices = null;
yield put({ type: 'returnDataServices', DataServices }); yield put({ type: 'returnDataServices', DataServices });
} break;
} }
break;
}
const resp = yield call(service.RA, playload); const resp = yield call(service.RA, playload);
console.log(resp) console.log('resp', resp);
if (resp.code == 500 || resp.error_code != "0000") { if (resp.code == 500 || resp.error_code != '0000') {
// message.error("Server Error,try again,error code:500",3) // message.error("Server Error,try again,error code:500",3)
// window.location.href = '/500'; // window.location.href = '/500';
} }
if (resp.error_code != "0000") {
console.log("请求错误码:"+"("+playload.index+")" + resp.error_code) if (resp.error_code != '0000') {
console.log(playload) console.log('请求错误码:' + '(' + playload.index + ')' + resp.error_code);
var Data3Error = null console.log(playload);
var Result=null var Data3Error = null;
var Result = null;
switch (playload.index) { switch (playload.index) {
case 11: { case 11:
Data3Error = { msg: "Information Wrong!" }; {
Data3Error = { msg: 'Information Wrong!' };
yield put({ type: 'returnData3Error', Data3Error }); yield put({ type: 'returnData3Error', Data3Error });
} break; }
case 13: { break;
case 13:
{
// //
history.push("/UserManagement/LIFEUserManagement") history.push('/UserManagement/LIFEUserManagement');
} break; }
break;
// 删除失败的案例 // 删除失败的案例
// case 16:{ // case 16:{
// Result = resp; // Result = resp;
// yield put({ type: 'returnResult', Result }); // yield put({ type: 'returnResult', Result });
// } break; // } break;
} }
} } else {
else {
switch (playload.index) { switch (playload.index) {
case 12:
case 12:{ {
let Data = resp; let Data = resp;
yield put({ type: 'returnPage', Data}); yield put({ type: 'returnPage', Data });
} break; }
break;
case 18: case 18:
case 14:{ case 14:
message.success("Success Operation!",3) {
message.success('Success Operation!', 3);
// window.location.href = '/CommunityManagement/FacilityBookings'; // window.location.href = '/CommunityManagement/FacilityBookings';
history.push("/UserManagement/LIFEUserManagement") history.push('/UserManagement/LIFEUserManagement');
} break; }
case 13: { break;
case 13:
{
let DataSaveDetail = resp.data; let DataSaveDetail = resp.data;
yield put({ type: 'DataSaveDetail', DataSaveDetail }); yield put({ type: 'DataSaveDetail', DataSaveDetail });
} break; }
case 16: { break;
console.log("等待删除完成") case 16:
{
console.log('等待删除完成');
var returnValue = resp; var returnValue = resp;
yield put({ type: 'ReturnValue', returnValue }); yield put({ type: 'ReturnValue', returnValue });
} break; }
case 32: { break;
case 32:
{
let communityInfo = resp; let communityInfo = resp;
yield put({ type: 'returnCommunityInfo', communityInfo }); yield put({ type: 'returnCommunityInfo', communityInfo });
} break; }
case 39: { break;
case 39:
{
let memberResult = resp; let memberResult = resp;
yield put({ type: 'returnMemberResult', memberResult }); yield put({ type: 'returnMemberResult', memberResult });
} break; }
break;
case 43: { case 43:
{
let DataServices = resp; let DataServices = resp;
yield put({ type: 'returnDataServices', DataServices }); yield put({ type: 'returnDataServices', DataServices });
} break;
} }
break;
}
} }
}, },
*IA({ playload }, { call, put }) { *IA({ playload }, { call, put }) {
var Data3 = null var Data3 = null;
yield put({ type: 'returnPage3', Data3 }); yield put({ type: 'returnPage3', Data3 });
}, },
*IA2({ playload }, { call, put }) { *IA2({ playload }, { call, put }) {
var Data3Error = null var Data3Error = null;
yield put({ type: 'returnData3Error', Data3Error }); yield put({ type: 'returnData3Error', Data3Error });
}, },
*SA({ playload }, { call, put }) { *SA({ playload }, { call, put }) {
var DataSave = playload var DataSave = playload;
yield put({type: 'returnDataSave', DataSave} ) yield put({ type: 'returnDataSave', DataSave });
}, },
*CA({ playload }, { call, put }) { *CA({ playload }, { call, put }) {
var sourceData = playload var sourceData = playload;
yield put({type: 'returnSource',sourceData}) yield put({ type: 'returnSource', sourceData });
}, },
*QA({ playload }, { call, put }) { *QA({ playload }, { call, put }) {
var curString = playload var curString = playload;
yield put({type: 'returnCurString', curString} ) yield put({ type: 'returnCurString', curString });
}, },
*ResultClear({ }, { put }) { *ResultClear({}, { put }) {
var tmp=null var tmp = null;
yield put({type: 'returnResult', tmp} ) yield put({ type: 'returnResult', tmp });
}, },
*PAGE({ playload }, { put }) { *PAGE({ playload }, { put }) {
var pageDate = playload var pageDate = playload;
yield put({type: 'PageDate',pageDate}) yield put({ type: 'PageDate', pageDate });
}, },
*DataClear({ }, { put }) { *DataClear({}, { put }) {
var pageDate = null var pageDate = null;
yield put({type: 'returnPage',pageDate}) yield put({ type: 'returnPage', pageDate });
}, },
*MemberResultClear({ }, { put }) { *MemberResultClear({}, { put }) {
let memberResult = null; let memberResult = null;
yield put({ type: 'returnMemberResult', memberResult }); yield put({ type: 'returnMemberResult', memberResult });
}, },
}, },
}; };
import * as service from '../services/tos'; import * as service from '../services/tos';
import { message } from 'antd'; import { message } from 'antd';
import { routerRedux } from 'dva/router' import { routerRedux } from 'dva/router';
export default { export default {
namespace: 'ServiceProvider', namespace: 'ServiceProvider',
state: { state: {
Data: null, Data: null,
CurDataFollow: null, CurDataFollow: null,
SaveChooseData:null, SaveChooseData: null,
}, },
reducers: { reducers: {
...@@ -26,61 +26,57 @@ export default { ...@@ -26,61 +26,57 @@ export default {
returnSaveChooseData(state, { SaveChooseData }) { returnSaveChooseData(state, { SaveChooseData }) {
return { ...state, SaveChooseData }; return { ...state, SaveChooseData };
}, },
}, },
effects: { effects: {
// 获取服务商 // 获取服务商
*TosTosServiceProviderGet({ playload }, { call, put }) { *TosTosServiceProviderGet({ playload }, { call, put }) {
const resp = yield call(service.TosTosServiceProviderGet, playload); const resp = yield call(service.TosTosServiceProviderGet, playload);
console.log(resp) console.log(resp);
if (resp.code == 500) { if (resp.code == 500) {
// window.location.href = '/500'; // window.location.href = '/500';
} }
if (resp.error_code == "0000") { if (resp.error_code == '0000') {
let Data = resp.data.rows; let Data = resp.data.rows;
yield put({ type: 'returnPage', Data, }); yield put({ type: 'returnPage', Data });
} else { } else {
console.log("请求错误码:"+resp.error_code) console.log('请求错误码:' + resp.error_code);
let Data = null; let Data = null;
console.log(playload) console.log(playload);
yield put({ type: 'returnPage', Data, }); yield put({ type: 'returnPage', Data });
} }
}, },
// 新建服务商 // 新建服务商
*TosTosServiceProviderSave({ playload }, { call, put }) { *TosTosServiceProviderSave({ playload }, { call, put }) {
console.log(playload) console.log(playload);
const resp = yield call(service.TosTosServiceProviderSave, playload); const resp = yield call(service.TosTosServiceProviderSave, playload);
console.log(resp) console.log(resp);
if (resp.code == 500) { if (resp.code == 500) {
window.location.href = '/500'; window.location.href = '/500';
} else { } else {
message.success("operator success!", 2); message.success('operator success!', 2);
window.location.href = '/UserManagement/ServiceProviderManagement'; window.location.href = '/UserManagement/ServiceProviderManagement';
} }
}, },
//获取服务商保安根据服务商名 //获取服务商保安根据服务商名
*TosSecurityGuarderGet({ playload }, { call, put }) { *TosSecurityGuarderGet({ playload }, { call, put }) {
console.log(playload) console.log(playload);
const resp = yield call(service.TosSecurityGuarderGet, playload); const resp = yield call(service.TosSecurityGuarderGet, playload);
console.log(resp) console.log(resp);
let CurDataFollow = resp.data.rows; let CurDataFollow = resp.data.rows;
yield put({ type: 'returnCurDataFollow', CurDataFollow, }); yield put({ type: 'returnCurDataFollow', CurDataFollow });
}, },
//获取服务商保安详情根据服务商名 //获取服务商保安详情根据服务商名
*GuarderById({ playload }, { call, put }) { *GuarderById({ playload }, { call, put }) {
let CurDataFollowDetail = playload; let CurDataFollowDetail = playload;
yield put({ type: 'returnCurDataFollowDetail', CurDataFollowDetail, }); yield put({ type: 'returnCurDataFollowDetail', CurDataFollowDetail });
}, },
*SaveChooseData({ playload }, { call, put }) { *SaveChooseData({ playload }, { call, put }) {
let SaveChooseData = playload; let SaveChooseData = playload;
yield put({ type: 'returnSaveChooseData', SaveChooseData, }); yield put({ type: 'returnSaveChooseData', SaveChooseData });
}, },
}, },
}; };
...@@ -20,6 +20,7 @@ export default { ...@@ -20,6 +20,7 @@ export default {
//获取 //获取
*tosCommunityget({ playload }, { call, put }) { *tosCommunityget({ playload }, { call, put }) {
const resp = yield call(service.tosCommunityget, playload); const resp = yield call(service.tosCommunityget, playload);
let CommunityList = resp.data.communityList; let CommunityList = resp.data.communityList;
yield put({ type: 'returnCommunityList', CommunityList, }); yield put({ type: 'returnCommunityList', CommunityList, });
......
...@@ -28,7 +28,7 @@ export default{ ...@@ -28,7 +28,7 @@ export default{
}); });
if(callback) callback(response); if(callback) callback(response);
}, },
*saveOwner({callback,payload},{ call, put }) { *saveOwner({ callback, payload }, { call, put }) {
const response = yield call(saveOwner,payload); const response = yield call(saveOwner,payload);
yield put({ yield put({
type: "save", type: "save",
......
...@@ -40,7 +40,6 @@ const Order = (props:any) => { ...@@ -40,7 +40,6 @@ const Order = (props:any) => {
// } // }
// },[Data]) // },[Data])
const CallBackTitleSearch = (value: any) => { const CallBackTitleSearch = (value: any) => {
if (value.orderNumber != null || value.serviceType != null) { if (value.orderNumber != null || value.serviceType != null) {
RA(30, value, module, dispatch) RA(30, value, module, dispatch)
} }
...@@ -72,7 +71,7 @@ const Order = (props:any) => { ...@@ -72,7 +71,7 @@ const Order = (props:any) => {
); );
}; };
function map(state:any) { function map(state: any) {
const { Data} = state[module] const { Data} = state[module]
return { Data} return { Data}
} }
......
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import styles from './index.less'; import styles from './index.less';
import { Spin,Result,message,Upload ,Button,Table,Space} from 'antd'; import { Spin, Result, message, Upload, Button, Table, Space } from 'antd';
import { UploadOutlined, LoadingOutlined } from '@ant-design/icons'; import { UploadOutlined, LoadingOutlined } from '@ant-design/icons';
import { Link, useIntl, connect, Dispatch, history } from 'umi'; import { Link, useIntl, connect, Dispatch, history } from 'umi';
...@@ -10,17 +10,19 @@ import TitleSearch from '../../../components/TitleSearch/TitleSearch'; ...@@ -10,17 +10,19 @@ 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 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 nameofowner = formatMessage({ id: 'R.charge.input.nameofowner' })
const inputProject = formatMessage({ id: 'R.charge.input.project' }) const inputProject = formatMessage({ id: 'R.charge.input.project' })
...@@ -35,16 +37,16 @@ const Users = (props:any) => { ...@@ -35,16 +37,16 @@ const Users = (props:any) => {
const paymentsetting = formatMessage({ id: 'R.charge.paymentsetting' }) const paymentsetting = formatMessage({ id: 'R.charge.paymentsetting' })
// const string2mean = [[0, "未注册"], [1, "注册"], [2, "注销"]] // const string2mean = [[0, "未注册"], [1, "注册"], [2, "注销"]]
const string2mean=[[0, "Unregistered"],[1,"Registered"], [2,"Deregistered"]] const string2mean = [[0, "Unregistered"], [1, "Registered"], [2, "Deregistered"]]
const [curString, setCurString] = useState({ defaultCurrent: 1 }) const [curString, setCurString] = useState({ defaultCurrent: 1 })
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false)
const [fileUploading, setFileUploading] = useState(false) const [fileUploading, setFileUploading] = useState(false)
const [pageNum, setPageNum] = useState(1) const [pageNum, setPageNum] = useState(1)
const [readyData,setReadyData]=useState(null) const [readyData, setReadyData] = useState(null)
const [compent,setCompent]=useState({loading:false,fileUploading:false}) const [compent, setCompent] = useState({ loading: false, fileUploading: false })
const [TestData, setTestData] = useState(null)//{ rows: [], total:0,defaultCurrent:1 } const [TestData, setTestData] = useState(null)//{ rows: [], total:0,defaultCurrent:1 }
const [pageStart, setPageStart] = useState(false) const [pageStart, setPageStart] = useState(false)
...@@ -54,14 +56,15 @@ const Users = (props:any) => { ...@@ -54,14 +56,15 @@ const Users = (props:any) => {
{ title: project, dataIndex: 'communityName', }, { title: project, dataIndex: 'communityName', },
// { title: project, dataIndex: 'unit', }, // { title: project, dataIndex: 'unit', },
// { title: unit, dataIndex: 'living', }, // { title: unit, dataIndex: 'living', },
{title: unit,render:(text: any, record: any) => (<div>{record.buildingNumber+"#"+record.floorNumber+"—"+record.roomNumber}</div>)}, { title: unit, render: (text: any, record: any) => (<div>{record.buildingNumber + "#" + record.floorNumber + "—" + record.roomNumber}</div>) },
{ title: status, dataIndex: 'enable', render: (text: any, record: any) => (<div>{string2mean[text][1]}</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: 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>
), ),
}, },
...@@ -71,17 +74,17 @@ const Users = (props:any) => { ...@@ -71,17 +74,17 @@ 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") },
onChange(info) { onChange(info) {
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(`${info.file.name} file upload failed.` + 'failed count is ' + info.file.response.data.count);
setFileUploading(false) setFileUploading(false)
} }
} else if (info.file.status === 'error') { } else if (info.file.status === 'error') {
...@@ -89,7 +92,7 @@ const Users = (props:any) => { ...@@ -89,7 +92,7 @@ const Users = (props:any) => {
setFileUploading(false) setFileUploading(false)
} }
}, },
showUploadList:false, showUploadList: false,
} }
useEffect(() => { useEffect(() => {
...@@ -100,106 +103,74 @@ const Users = (props:any) => { ...@@ -100,106 +103,74 @@ const Users = (props:any) => {
} }
}, [Data]) }, [Data])
// if (pageStart == false) {
// console.log(location.pathname)
// if(history_url!=null){ console.log(history_url.pathname)}
// if (history_url != null && location.pathname != history_url.pathname) {
// console.log("来自上层数据")
// if (history_url.status == 0) {
// console.log("更新数据源")
// var tmp = Data
// tmp.defaultCurrent = pageData.defaultCurrent
// var tmp2 = curString; tmp2.defaultCurrent = pageData.defaultCurrent; setCurString(tmp2)
// setTestData(tmp)
// } else {
// console.log("异变数据源")
// console.log(history_url)
// RA(12, {
// ownerName:null,
// communityArray: CommunityList
// }, module, dispatch);
// changeValue("loading",true)
// }
// // URLCLEAR(module2, dispatch)
// }else {
// var tmp={rows:[], total:0,defaultCurrent:1}
// setTestData(tmp)
// }
// }
// if (pageStart == true) {
// if (Data != null) {
// console.log("可以接受值2")
// console.log(Data)
// changeValue("loading",false)
// setTestData(Data)
// }
// }
useEffect(() => { useEffect(() => {
//分页设置 //分页设置
if (location.query.current!=null) { if (location.query.pageNum != null) {
setPageNum(parseInt(location.query.current)) setPageNum(parseInt(location.query.pageNum))
} else { } else {
setPageNum(1) setPageNum(1)
} }
//前置数据 // 前置数据
console.log("前置数据"); var tmp = filterObjbyTg(location.query, ["owerName", "pageNum"])
var tmp = filterObjbyTg(location.query, ["ownerName"])
setReadyData(tmp) setReadyData(tmp)
//获取数据 //获取数据
setLoading(true) setLoading(true)
RA(12, { RA(12, {
ownerName:location.query.ownerName != undefined ? (location.query.ownerName) : null, owerName: location.query.owerName != undefined ? (location.query.owerName) : null,
communityArray: CommunityList communityArray: TestData != null ? TestData : CommunityList,
pageNum,
}, module, dispatch); }, module, dispatch);
console.log("发送请求了123123123123123") console.log("发送请求了123123123123123")
},[location]) }, [location])
const goToDetail = (values:any,e:any) => { const goToDetail = (values: any, e: any) => {
SA(values) SA(values)
PAGE(curString,module3,dispatch)//保存页面参数 PAGE(curString, 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(curString, module3, dispatch) PAGE(curString, 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')
} }
const CallBackTitleSearch = (comment: any)=>{
console.log(comment)
//页面搜索 // LIFE用户管理页面的搜索按钮
comment.current = 1 const CallBackTitleSearch = (comment: any) => {
history.push(location.pathname+urlEncode(filterObj({ ownerName: comment.OwnerName}))) console.log("触发了按钮", comment)
setTestData(comment.serviceCommunityList)
history.push(location.pathname + urlEncode(filterObj({
owerName: comment.OwnerName,
pageNum: 1,
})))
} }
const pageChange = (values: any) => { const pageChange = (values: any) => {
// var tmp = curString; tmp.defaultCurrent = values.current; setCurString(tmp)
setPageNum(values.current)
/*页面跳转*/ /*页面跳转*/
var tmp = filterObjbyTg(location.query, []) var tmp = filterObjbyTg(location.query, [])
tmp["current"]=values.current tmp["pageNum"] = values.current
history.push(location.pathname + urlEncode(tmp)) history.push(location.pathname + urlEncode(tmp))
} }
return ( return (
<div className={styles.base}> <div className={styles.base}>
{/* 头部组件 */} {/* 头部组件 */}
<TitleSearch listkey={["OwnerName"]} list={["Owner Name"]} <TitleSearch listkey={["OwnerName"]} list={["Owner Name"]}
community={"serviceCommunityList"} onSubmit={CallBackTitleSearch} /> community={"serviceCommunityList"} onSubmit={CallBackTitleSearch} />
...@@ -208,7 +179,7 @@ const Users = (props:any) => { ...@@ -208,7 +179,7 @@ const Users = (props:any) => {
<button className={styles.buttonAdd2} onClick={goToAdd}>Create New Owner</button> <button className={styles.buttonAdd2} onClick={goToAdd}>Create New Owner</button>
<div className={styles.buttonAdd} > <div className={styles.buttonAdd} >
<Upload {...propsUpload}> <Upload {...propsUpload}>
<Button icon={compent.fileUploading?null:<UploadOutlined />}>{compent.fileUploading?<><Spin indicator={<LoadingOutlined style={{ fontSize: 16 }} spin />} /> Uploading</>:"Batch Upload"}</Button> <Button icon={compent.fileUploading ? null : <UploadOutlined />}>{compent.fileUploading ? <><Spin indicator={<LoadingOutlined style={{ fontSize: 16 }} spin />} /> Uploading</> : "Batch Upload"}</Button>
</Upload> </Upload>
</div> </div>
</div> </div>
...@@ -218,19 +189,21 @@ const Users = (props:any) => { ...@@ -218,19 +189,21 @@ const Users = (props:any) => {
rowKey={"id"} rowKey={"id"}
loading={loading} loading={loading}
style={{ marginTop: 16 }} style={{ marginTop: 16 }}
dataSource={Data!=null?Data.data.rows:[]} dataSource={Data != null ? Data.data.list : []}
columns={columns} columns={columns}
pagination={Data!=null? { current: pageNum, total: Data.data.rows.length } : {}} pagination={Data != null ? { current: pageNum, total: Data.data.page.totalRow, showSizeChanger: false, pageSize: Data.data.page.curPageSize } : {}}
onChange={pageChange} /> 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 { token } = state.login;
const { CommunityList } = state.Init; const { CommunityList } = state.Init;
return { return {
...@@ -243,5 +216,8 @@ function mapStateToProps(state:any) { ...@@ -243,5 +216,8 @@ function mapStateToProps(state:any) {
CommunityList, CommunityList,
}; };
} }
export default connect(mapStateToProps)(Users); export default connect(mapStateToProps)(Users);
...@@ -9,110 +9,110 @@ ...@@ -9,110 +9,110 @@
} }
//头部组件 //头部组件
.box{ .box {
width: 100%; width: 100%;
height: 64px; height: 64px;
position: relative; position: relative;
} }
.item1{ .item1 {
position: absolute; position: absolute;
width: 400px; width: 400px;
text-indent: 15px; text-indent: 15px;
border-left: 5px solid rgba(24,144,255,1); border-left: 5px solid rgba(24, 144, 255, 1);
font-family:'Source Han Sans CN'; font-family: 'Source Han Sans CN';
font-size: 18px; font-size: 18px;
font-weight: 600; font-weight: 600;
color: #000000; color: #000000;
} }
.item3{ .item3 {
width:80px; width: 80px;
height: 32px; height: 32px;
position: absolute; position: absolute;
right: 0; right: 0;
outline: none; outline: none;
background:none; background: none;
cursor: pointer; cursor: pointer;
border:1px solid rgba(217,217,217,1); border: 1px solid rgba(217, 217, 217, 1);
border-radius:2px; border-radius: 2px;
} }
.box1{ .box1 {
width: 100%; width: 100%;
height: 34px; height: 34px;
line-height: 34px; line-height: 34px;
position: relative; position: relative;
margin-bottom: 28px; margin-bottom: 28px;
} }
.box1item1{ .box1item1 {
position: absolute; position: absolute;
} }
.box1item2{ .box1item2 {
position: absolute; position: absolute;
left: 146px; left: 146px;
} }
.box4{ .box4 {
width: 100%; width: 100%;
height: 34px; height: 34px;
line-height: 34px; line-height: 34px;
position: relative; position: relative;
margin-bottom: 28px; margin-bottom: 28px;
} }
.box4item0{ .box4item0 {
position: absolute; position: absolute;
} }
.box4item1{ .box4item1 {
position: absolute; position: absolute;
left: 146px; left: 146px;
} }
.box4item2{ .box4item2 {
position: absolute; position: absolute;
left: 346px; left: 346px;
} }
.box2{ .box2 {
width: 100%; width: 100%;
height: 34px; height: 34px;
line-height: 34px; line-height: 34px;
position: relative; position: relative;
margin-bottom: 28px; margin-bottom: 28px;
} }
.box2item1{ .box2item1 {
position: absolute; position: absolute;
} }
.box2item2{ .box2item2 {
position: absolute; position: absolute;
left: 146px; left: 146px;
} }
.box2item3{ .box2item3 {
position: absolute; position: absolute;
left: 362px; left: 362px;
} }
.box2item4{
.box2item4 {
position: absolute; position: absolute;
left: 461px; left: 461px;
} }
.box2item5{ .box2item5 {
position: absolute; position: absolute;
left: 475px; left: 475px;
} }
.box2item6{ .box2item6 {
position: absolute; position: absolute;
left: 561px; left: 561px;
} }
.box2item7{ .box2item7 {
position: absolute; position: absolute;
left: 583px; left: 583px;
} }
.box3{ .box3 {
width: 100%; width: 100%;
height: 34px; height: 34px;
position: relative; position: relative;
} }
.box3item1{ .box3item1 {
padding-left: 146px; padding-left: 146px;
} }
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, Menu, Table, Space, Pagination, Spin, Button, Form, Row, Col, message } from 'antd';
import { Link, useIntl, connect, Dispatch } from 'umi'; import { Link, useIntl, connect, Dispatch } from 'umi';
...@@ -10,17 +10,19 @@ import SearchOptionsCommnity from '../../../components/SearchOptions/SearchOptio ...@@ -10,17 +10,19 @@ 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 UsersAdd = (props:any) => {
const { dispatch,communityInfo} = props; const module = "User"
const UsersAdd = (props: any) => {
const [postman,setPostman]=useState({extend:null}) const { dispatch, communityInfo } = props;
const [postman, setPostman] = useState({ extend: null })
const formRef = useRef(null); const formRef = useRef(null);
const [loading,setLoading]=useState(false) const [loading, setLoading] = useState(false)
const onFinish=(values:any) => { const onFinish = (values: any) => {
if (postman.extend != null) { if (postman.extend != null) {
values.communityName = postman.extend values.communityName = postman.extend
...@@ -31,32 +33,32 @@ const UsersAdd = (props:any) => { ...@@ -31,32 +33,32 @@ const UsersAdd = (props:any) => {
console.log("添加业主提交的参数:" + tmp.length) console.log("添加业主提交的参数:" + tmp.length)
console.log(values) console.log(values)
if (checkParam(values)) { if (checkParam(values)) {
values.owerPhone =null values.owerPhone = null
values.owerEmail=null values.owerEmail = null
RA(14, values, module, dispatch) RA(14, values, module, dispatch)
setLoading(true) setLoading(true)
} else { } else {
setLoading(false) setLoading(false)
message.error("Error,Please finish it,not empty!",3) message.error("Error,Please finish it,not empty!", 3)
} }
} }
const extendName = (values: any) => { const extendName = (values: any) => {
var tmp = postman var tmp = postman
tmp.extend = values tmp.extend = values
RA(32, {communityName: values }, module, dispatch); RA(32, { communityName: values }, module, dispatch);
setPostman(tmp) setPostman(tmp)
} }
useEffect(()=>{ useEffect(() => {
if (communityInfo != null) { if (communityInfo != null) {
console.log(communityInfo) console.log(communityInfo)
if (postman.extend != null) { if (postman.extend != null) {
formRef.current.setFieldsValue({ addressAndpostalCode: communityInfo.data.rows[0].residentialAddress+" "+communityInfo.data.rows[0].residentialZipCode }) formRef.current.setFieldsValue({ addressAndpostalCode: communityInfo.data.rows[0].residentialAddress + " SINGAPORE" + communityInfo.data.rows[0].residentialZipCode })
} }
} }
},[communityInfo]) }, [communityInfo])
const checkData = (rule:any, value:any, callback:any) => { const checkData = (rule: any, value: any, callback: any) => {
if (value) { if (value) {
if (/^[a-zA-Z0-9]+$/g.test(value)) { if (/^[a-zA-Z0-9]+$/g.test(value)) {
callback(); callback();
...@@ -75,7 +77,7 @@ const UsersAdd = (props:any) => { ...@@ -75,7 +77,7 @@ const UsersAdd = (props:any) => {
<Form ref={formRef} name="basic" onFinish={onFinish} validateMessages={validateMessages}> <Form ref={formRef} name="basic" onFinish={onFinish} validateMessages={validateMessages}>
<div className={styles.box1}> <div className={styles.box1}>
<div className={styles.box1item1}>Owner's Name</div> <div className={styles.box1item1}>Owner's Name</div>
<div className={styles.box1item2}><Form.Item name="owerName" rules={[{required:true,min:2,max:30}]} ><Input placeholder="Ower Name" /></Form.Item></div> <div className={styles.box1item2}><Form.Item name="owerName" rules={[{ required: true, min: 2, max: 30 }]} ><Input placeholder="Ower Name" /></Form.Item></div>
</div> </div>
{/* <div className={styles.box4}> {/* <div className={styles.box4}>
...@@ -85,17 +87,18 @@ const UsersAdd = (props:any) => { ...@@ -85,17 +87,18 @@ const UsersAdd = (props:any) => {
</div> */} </div> */}
<div className={styles.box2}> <div className={styles.box2}>
<div className={styles.box2item1}>Contact Details</div>
<div className={styles.box2item2}><SearchOptionsCommnity alone={true} onSubmit={extendName} /></div> <div className={styles.box2item2}><SearchOptionsCommnity alone={true} onSubmit={extendName} /></div>
<div className={styles.box2item3}><Form.Item name="buildingNumber" rules={[{validator: checkData, trigger: 'blur'}]}><Input placeholder="Building" style={{width:94}}/></Form.Item></div> <div className={styles.box2item3}><Form.Item name="buildingNumber" rules={[{ validator: checkData }]}><Input placeholder="Building" style={{ width: 94 }} /></Form.Item></div>
<div className={styles.box2item4}>#</div> <div className={styles.box2item4}>#</div>
<div className={styles.box2item5}><Form.Item name="floorNumber" ><Input placeholder="Floor" style={{width:80}} /></Form.Item></div> <div className={styles.box2item5}><Form.Item name="floorNumber" rules={[{ validator: checkData }]}><Input placeholder="Floor" style={{ width: 80 }} /></Form.Item></div>
<div className={styles.box2item6}>——</div> <div className={styles.box2item6}>——</div>
<div className={styles.box2item7}><Form.Item name="roomNumber"><Input placeholder="Room" style={{width:112}}/></Form.Item></div> <div className={styles.box2item7}><Form.Item name="roomNumber" rules={[{ validator: checkData }]}><Input placeholder="Room" style={{ width: 112 }} /></Form.Item></div>
</div> </div>
<div className={styles.box3}> <div className={styles.box3}>
<div className={styles.box3item1}> <div className={styles.box3item1}>
<Form.Item name="addressAndpostalCode"><Input style={{width:680}} placeholder="Display the address and postcode automatically according to the"/></Form.Item> <Form.Item name="addressAndpostalCode"><Input style={{ width: 680 }} disabled placeholder="Display the address and postcode automatically according to the" /></Form.Item>
</div> </div>
</div> </div>
<Line /> <Line />
...@@ -107,8 +110,8 @@ const UsersAdd = (props:any) => { ...@@ -107,8 +110,8 @@ const UsersAdd = (props:any) => {
); );
}; };
function mapStateToProps(state:any) { function mapStateToProps(state: any) {
const { DataSave,communityInfo } = state.User; const { DataSave, communityInfo } = state.User;
return { return {
DataSave, DataSave,
......
.box2item3___3VsZz .ant-form-item-explain {
margin-left: -80px;
}
.box2item5___2AZ2K .ant-form-item-explain {
width: 1000px;
position: absolute;
top: -25px;
left: -55px;
}
.box2item7___ePaor .ant-form-item-explain {
margin-left: -30px;
}
.box2item3___3VsZz {
.ant-form-item-explain {
margin-left: -80px;
}
}
.box2item5___2AZ2K {
// position: relative;
.ant-form-item-explain {
width: 1000px;
position: absolute;
top: -25px;
left: -55px;
}
}
.box2item7___ePaor {
.ant-form-item-explain {
margin-left: -30px;
}
}
import React, { useState, useEffect,useRef } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import { Input, Tabs, Modal, Space, Pagination, Tooltip, Button, Form, Row, Col, message, Spin } from 'antd'; import {
Input,
Tabs,
Modal,
Space,
Pagination,
Tooltip,
Button,
Form,
Row,
Col,
message,
Spin,
} from 'antd';
const { confirm } = Modal; const { confirm } = Modal;
const { TabPane } = Tabs; const { TabPane } = Tabs;
import { ExclamationCircleOutlined } from '@ant-design/icons'; import { ExclamationCircleOutlined } from '@ant-design/icons';
...@@ -10,116 +23,131 @@ import styles from './UsersAdd.less'; ...@@ -10,116 +23,131 @@ import styles from './UsersAdd.less';
import Line from '../../../components/Line/Line'; import Line from '../../../components/Line/Line';
import TitleBack from '../../../components/TitleBack/TitleBack'; import TitleBack from '../../../components/TitleBack/TitleBack';
import SearchOptionsCommnity from '../../../components/SearchOptions/SearchOptionsCommnity'; import SearchOptionsCommnity from '../../../components/SearchOptions/SearchOptionsCommnity';
import { checkParam } from '../../../utils/method' import { checkParam } from '../../../utils/method';
import TableShow from '@/components/TableShow/TableShow'; import TableShow from '@/components/TableShow/TableShow';
import { values, fromPairs } from 'lodash'; import { values, fromPairs } from 'lodash';
import { timestampToTime } from '@/utils/time'; import { timestampToTime } from '@/utils/time';
import { validateMessages } from '@/utils/params'; import { validateMessages } from '@/utils/params';
const UsersDetail = (props:any) => { const UsersDetail = (props: any) => {
const { dispatch, DataSave, DataSaveDetail, Result, returnValue, memberResult } = props;
const { dispatch,DataSave,DataSaveDetail,Result,returnValue,memberResult} = props;
const RA = (index: any, values: any) => { dispatch({ type: 'User/RA', playload: { index: index, body: values } }) }; const RA = (index: any, values: any) => {
const ResultClear = () => { dispatch({ type: 'User/ResultClear' }) }; dispatch({
const MemberResultClear = () => { dispatch({ type: 'User/MemberResultClear' }) }; type: 'User/RA',
playload: {
index: index,
body: values,
},
});
};
const ResultClear = () => {
dispatch({ type: 'User/ResultClear' });
};
const MemberResultClear = () => {
dispatch({ type: 'User/MemberResultClear' });
};
const [memberDetail, setMemberDetail] = useState(false); const [memberDetail, setMemberDetail] = useState(false);
const [memberData, setMemberData] = useState(null); const [memberData, setMemberData] = useState(null);
const [editFlag, setEditFlag] = useState(false) const [editFlag, setEditFlag] = useState(false);
// const user_status = [[1, "家属"], [2, "租户"]] // const user_status = [[1, "家属"], [2, "租户"]]
const user_status = [[1, "Family Member"], [2, "Tenant"]] const user_status = [
const user_type_status = ["Unregistered", "registered", "Deregistered"] [1, 'Family Member'],
[2, 'Tenant'],
];
const user_type_status = ['Unregistered', 'registered', 'Deregistered'];
const [DataSaveLoading, setDataSaveLoading] = useState(false); const [DataSaveLoading, setDataSaveLoading] = useState(false);
const [visible, setVisible] = useState(false)
const [visible, setVisible] = useState(false);
const formRef = useRef(null); const formRef = useRef(null);
const onFinish=(values:any) => { const onFinish = (values: any) => {
if (DataSave != null) { if (DataSave != null) {
values.id = DataSave.id values.id = DataSave.id;
values.enable=DataSave.enable values.enable = DataSave.enable;
} else { } else {
values.id=null values.id = null;
} }
var tmp = Object.keys(values); var tmp = Object.keys(values);
console.log("添加业主提交的参数:" + tmp.length) console.log('添加业主提交的参数:' + tmp.length);
console.log(values) console.log(values);
if (checkParam(values)) { if (checkParam(values)) {
RA(18, values) setVisible(true);
RA(18, values);
} else { } else {
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);
if (Result.error_code == "0001") { if (Result.error_code == '0001') {
message.error(Result.error_msg, 3) message.error(Result.error_msg, 3);
ResultClear() ResultClear();
} }
} }
}, [Result]) }, [Result]);
useEffect(()=>{ useEffect(() => {
if (returnValue != null) { if (returnValue != null) {
message.success("Delete Successfully!") message.success('Delete Successfully!');
RA(13, { RA(13, {
id:DataSave.id, id: DataSave.id,
owerName: DataSave.owerName, owerName: DataSave.owerName,
enable:DataSave.enable, enable: DataSave.enable,
}) });
} }
}, [returnValue]) }, [returnValue]);
useEffect(() => { useEffect(() => {
if (DataSave != null) { if (DataSave != null) {
console.log("给予页面数据") console.log('给予页面数据');
console.log(DataSave) console.log(DataSave);
var tmp = { var tmp = {
owerName: DataSave.owerName, owerName: DataSave.owerName,
owerPhone: DataSave.owerPhone, owerPhone: DataSave.owerPhone,
owerEmail:DataSave.owerEmail owerEmail: DataSave.owerEmail,
} };
formRef.current.setFieldsValue(tmp) formRef.current.setFieldsValue(tmp);
RA(13, { RA(13, {
id:DataSave.id, id: DataSave.id,
owerName: DataSave.owerName, owerName: DataSave.owerName,
enable:DataSave.enable, enable: DataSave.enable,
}) });
} else { } else {
history.go(-1) history.go(-1);
} }
}, [DataSave]) }, [DataSave]);
useEffect(() => { useEffect(() => {
if (DataSaveDetail != null) {
if (DataSaveDetail!=null) { console.log('页面数据副歌');
console.log("页面数据副歌") console.log(DataSaveDetail);
console.log(DataSaveDetail) setDataSaveLoading(false);
setDataSaveLoading(false)
} }
}, [DataSaveDetail]);
}, [DataSaveDetail])
useEffect(() => { useEffect(() => {
if ((location.pathname).indexOf("Edit") > -1) { if (location.pathname.indexOf('Edit') > -1) {
setEditFlag(true) setEditFlag(true);
} }
setDataSaveLoading(true) setDataSaveLoading(true);
}, []) }, []);
const tableShowCallback = (values: any) => { const tableShowCallback = (values: any) => {
console.log("成员信息") console.log('成员信息');
console.log(values) console.log(values);
setMemberData(values) setMemberData(values);
setMemberDetail(true) setMemberDetail(true);
} };
const deleteUnit = (values:any) => { const deleteUnit = (values: any) => {
// console.log(values) // console.log(values)
confirm({ confirm({
...@@ -129,92 +157,147 @@ const UsersDetail = (props:any) => { ...@@ -129,92 +157,147 @@ const UsersDetail = (props:any) => {
okText: 'Confirm', okText: 'Confirm',
okType: 'danger', okType: 'danger',
cancelText: 'Cancel', cancelText: 'Cancel',
onCancel() {}, onCancel() { },
onOk() { onOk() {
if (DataSave != null) { if (DataSave != null) {
//console.log(DataSave) //console.log(DataSave)
var tmp = { var tmp = {
owerName: DataSave.owerName, owerName: DataSave.owerName,
communityName: DataSave.communityName, communityName: DataSave.communityName,
unit: values unit: values,
} };
RA(16, tmp); RA(16, tmp);
} }
}, },
}); });
} };
const DeleteMember = (values: any, e: any) => { const DeleteMember = (values: any, e: 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);
RA(13, { RA(13, {
id:DataSave.id, id: DataSave.id,
owerName: DataSave.owerName, owerName: DataSave.owerName,
enable:DataSave.enable, enable: DataSave.enable,
}) });
MemberResultClear() MemberResultClear();
} }
}, [memberResult]);
},[memberResult]) const checkData = (rule: any, value: any, callback: any) => {
if (value) {
if (/^\d{11}$/g.test(value)) {
callback();
} else {
callback(new Error('Please enter the correct cell phone number!'));
}
}
callback('*it is required!');
};
return ( return (
<div className={styles.base}> <div className={styles.base}>
<Spin spinning={visible} tip="Loading Submit">
{ {memberDetail == false ? (
memberDetail == false ? <> <>
{ {DataSave != null ? (
DataSave != null ? <> <>
<TitleBack sublist={['Status : '+user_type_status[DataSave.enable],'Create Time : '+timestampToTime(DataSave.createTime.time)]} title={editFlag?"Edit Owner Infomation":"Owner Detail"} /> <TitleBack
<Form ref={formRef} name="basic" onFinish={onFinish} validateMessages={validateMessages}> sublist={[
'Status : ' + user_type_status[DataSave.enable],
'Create Time : ' + timestampToTime(DataSave.createTime.time),
]}
title={editFlag ? 'Edit Owner Infomation' : 'Owner Detail'}
/>
<Form
ref={formRef}
name="basic"
onFinish={onFinish}
validateMessages={validateMessages}
>
<div className={styles.box1}> <div className={styles.box1}>
<div className={styles.box1item1}>Owner's Name</div> <div className={styles.box1item1}>Owner's Name</div>
<div className={styles.box1item2}><Form.Item name="owerName" rules={[{ required: true, min: 2, max: 30 }]} ><Input disabled={!editFlag} placeholder="Ower Name" /></Form.Item></div> <div className={styles.box1item2}>
<Form.Item name="owerName" rules={[{ required: true, min: 2, max: 30 }]}>
<Input disabled={!editFlag} placeholder="Ower Name" />
</Form.Item>
</div> </div>
{ </div>
DataSave.enable == 1 ? {DataSave.enable == 1 ? (
<> <>
<div className={styles.box4}> <div className={styles.box4}>
<div className={styles.box4item0}>Contact Details</div> <div className={styles.box4item0}>Contact Details</div>
<div className={styles.box4item1}><Form.Item name="owerPhone" ><Input disabled={!editFlag} placeholder="Phone Number" /></Form.Item></div> <div className={styles.box4item1}>
<div className={styles.box4item2}><Form.Item name="owerEmail" rules={[{required:true,type:"email"}]} ><Input disabled={!editFlag} placeholder="Email" /></Form.Item></div> <Form.Item name="owerPhone" rules={[{ validator: checkData }]}>
<Input
disabled={!editFlag}
placeholder="Phone Number"
style={{ width: 174 }}
/>
</Form.Item>
</div>
<div className={styles.box4item2}>
<Form.Item name="owerEmail" rules={[{ required: true, type: 'email' }]}>
<Input
disabled={!editFlag}
placeholder="Email"
style={{ width: 174 }}
/>
</Form.Item>
</div>
</div> </div>
</> </>
: null ) : null}
}
<Line /> <Line />
<Spin spinning={DataSaveLoading} tip="Loading Detial"> <Spin spinning={DataSaveLoading} tip="Loading Detial">
{ {DataSaveDetail != null ? (
DataSaveDetail != null ? <TableShow data={DataSaveDetail} onSubmit={tableShowCallback} onChange={deleteUnit} deleteDisable={editFlag}/> : null <TableShow
} data={DataSaveDetail}
{ onSubmit={tableShowCallback}
editFlag ? <> onChange={deleteUnit}
deleteDisable={editFlag}
/>
) : null}
{editFlag ? (
<>
<Line /> <Line />
<Form.Item ><Button type="primary" htmlType="submit">Submit</Button></Form.Item> <Form.Item>
</>:null <Button type="primary" htmlType="submit">
} Submit
</Button>
</Form.Item>
</>
) : null}
</Spin> </Spin>
</Form> </Form>
</>
</>:null ) : null}
} </>
) : (
</> :
<> <>
<div> <div>
<TitleBack title={"Member Detail"} url="none" titleBack={titleBackCallBack}></TitleBack> <TitleBack
title={'Member Detail'}
url="none"
titleBack={titleBackCallBack}
></TitleBack>
<Row> <Row>
<Col span={4}>Customer Type</Col> <Col span={4}>Customer Type</Col>
<Col span={4}>{memberData.owner_relationship!=null?user_status[(memberData.owner_relationship)-1][1]:null}</Col> <Col span={4}>
{memberData.owner_relationship != null
? user_status[memberData.owner_relationship - 1][1]
: null}
</Col>
</Row> </Row>
<Row gutter={16}> <Row gutter={16}>
<Col span={4}>User Name</Col> <Col span={4}>User Name</Col>
...@@ -226,18 +309,21 @@ const UsersDetail = (props:any) => { ...@@ -226,18 +309,21 @@ const UsersDetail = (props:any) => {
<Col span={4}>{memberData.ower_email}</Col> <Col span={4}>{memberData.ower_email}</Col>
</Row> </Row>
<Line></Line> <Line></Line>
<Button type="danger" onClick={DeleteMember.bind(this,memberData)}>Delete</Button>
<Button danger onClick={DeleteMember.bind(this, memberData)}>
Delete
</Button>
</div> </div>
</> </>
)}
} </Spin>
</div> </div>
); );
}; };
function mapStateToProps(state:any) { function mapStateToProps(state: any) {
const { DataSave,DataSaveDetail,Result,returnValue,memberResult} = state.User; const { DataSave, DataSaveDetail, Result, returnValue, memberResult } = state.User;
return { return {
DataSave, DataSave,
DataSaveDetail, DataSaveDetail,
......
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 } from 'antd'; import { Input, Button, Form, Result, Pagination, Tooltip, Checkbox } from 'antd';
import { Link, useIntl, connect } from 'umi'; import { Link, useIntl, connect } from 'umi';
...@@ -8,32 +8,36 @@ import SelectOptions from '../../../components/SelectOptions/index'; ...@@ -8,32 +8,36 @@ 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"
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 [SList, setSList] = useState(["1"])
const printContent = (List: any)=>{setCList(List)} const printContent = (List: any) => { setCList(List) }
const formRef = useRef(null); const formRef = useRef(null);
useEffect(() => { useEffect(() => {
console.log(SaveChooseData) console.log(SaveChooseData)
RA(43,{serviceName:""},module,dispatch) RA(43, { serviceName: "" }, module, dispatch)
}, []); }, []);
useEffect(()=>{ useEffect(() => {
if (DataServices != null) { if (DataServices != null) {
var tmp=DataServices.data.serviceScopeList var tmp = DataServices.data.serviceScopeList
if (SaveChooseData != null) { if (SaveChooseData != null) {
formRef.current.setFieldsValue(SaveChooseData) formRef.current.setFieldsValue(SaveChooseData)
} }
} }
},[DataServices]) }, [DataServices])
const onFinish = (values: any) => { const onFinish = (values: any) => {
console.log(values)
return;
var val = values var val = values
val.serviceCommunityList = CList val.serviceCommunityList = CList
// val.serviceScopeList = SList // val.serviceScopeList = SList
...@@ -42,7 +46,9 @@ const Edit= (props:any) => { ...@@ -42,7 +46,9 @@ const Edit= (props:any) => {
TosTosServiceProviderSave(val) TosTosServiceProviderSave(val)
}; };
const onFinishFailed = (errorInfo:any) => {console.log('Failed:', errorInfo) }; const onFinishFailed = (errorInfo: any) => {
console.log('Failed:', errorInfo)
};
return ( return (
<div className={styles.base}> <div className={styles.base}>
...@@ -53,29 +59,79 @@ const Edit= (props:any) => { ...@@ -53,29 +59,79 @@ const Edit= (props:any) => {
<Form ref={formRef} name="basic" initialValues={{}} onFinish={onFinish} onFinishFailed={onFinishFailed}> <Form ref={formRef} name="basic" initialValues={{}} onFinish={onFinish} onFinishFailed={onFinishFailed}>
<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}><Form.Item name="providerName" ><Input style={{width:260}} placeholder="Please enter company name" /></Form.Item></div> <div className={styles.box1item2}>
<Form.Item name="providerName"
rules={[{
required: true,
message: "Please enter the company name!"
}]}
>
<Input style={{ width: 260 }} placeholder="Please enter company name" />
</Form.Item>
</div>
<div className={styles.box1item3}>Office Address</div> <div className={styles.box1item3}>Office Address</div>
<div className={styles.box1item4}><Form.Item name="providerAddress"><Input style={{width:200}} placeholder="Single Line Input"/></Form.Item></div> <div className={styles.box1item4}>
<Form.Item
name="providerAddress"
rules={[{
required: true,
message: "Please enter your office address!"
}]}
>
<Input style={{ width: 200 }} placeholder="Single Line Input" />
</Form.Item>
</div>
</div> </div>
<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.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}><Form.Item name="serviceScopeList"><Checkbox.Group options={ DataServices!=null?DataServices.data.serviceScopeList:null} /></Form.Item></div> <div className={styles.box2item2}>
<Form.Item
name="serviceScopeList"
rules={[{
required: true,
message: "Please select at least one service available!"
}]}
>
<Checkbox.Group options={DataServices != null ? DataServices.data.serviceScopeList : null} />
</Form.Item>
</div>
</div> </div>
<div className={styles.box3}> <div className={styles.box3}>
<div className={styles.box3item1}>Person In Charge</div> <div className={styles.box3item1}>Person In Charge</div>
<div className={styles.box3item2}><Form.Item name="contactName"><Input style={{width:200}} placeholder="Please enter a name"/></Form.Item></div> <div className={styles.box3item2}>
<Form.Item
name="contactName"
rules={[{
required: true,
message: "Please enter the name of the person in charge!"
}]}
>
<Input style={{ width: 200 }}
placeholder="Please enter a name"
/>
</Form.Item>
</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}><Form.Item name="contactEmail"><Input style={{width:200}} placeholder="E-mail"/></Form.Item></div> <div className={styles.box4item3}>
<Form.Item
name="contactEmail"
rules={[{
required: true,
type: "email",
message: "Please enter the correct email address!"
}]}
>
<Input style={{ width: 200 }} placeholder="E-mail" /></Form.Item></div>
</div> </div>
...@@ -89,7 +145,7 @@ const Edit= (props:any) => { ...@@ -89,7 +145,7 @@ const Edit= (props:any) => {
); );
}; };
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;
...@@ -106,4 +162,3 @@ function mapStateToProps(state:any) { ...@@ -106,4 +162,3 @@ function mapStateToProps(state:any) {
export default connect(mapStateToProps)(Edit); export default connect(mapStateToProps)(Edit);
\ No newline at end of file
import React, { useState, useEffect,useRef} from 'react'; import React, { useState, useEffect, useRef } from 'react';
import styles from './index.less'; 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 { Link, useIntl, connect, Dispatch,history } from 'umi'; import { urlEncode, filterObj, filterObjbyTg } from '@/utils/method';
import { Link, useIntl, connect, Dispatch, history } from 'umi';
import TitleSearch from '../../../components/TitleSearch/TitleSearch'; import TitleSearch from '../../../components/TitleSearch/TitleSearch';
const ServiceProviderManagement = (props: any) => { const ServiceProviderManagement = (props: any) => {
const { formatMessage } = useIntl(); const { formatMessage } = useIntl();
const [pageNum, setPageNum] = useState(1)
const [loading, setLoading] = useState(false)
const [testData, setTestData] = useState(null);
const { dispatch, location, Data, CommunityList } = props; const { dispatch, location, Data, CommunityList } = props;
const RA = (index:any,values: any) => { dispatch({ type: 'ServiceProvider/RA', playload: {index:index, body:values } }) }; 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 TosTosServiceProviderGet = (values: any) => {
dispatch({
type: 'ServiceProvider/TosTosServiceProviderGet',
playload: values
})
};
const SaveChooseData = (values: any) => { dispatch({ type: 'ServiceProvider/SaveChooseData', playload: values }) }; const SaveChooseData = (values: any) => { dispatch({ type: 'ServiceProvider/SaveChooseData', playload: values }) };
const GetList = () => { // const GetList = () => {
if (CommunityList != null) { // if (CommunityList != null) {
TosTosServiceProviderGet({ // TosTosServiceProviderGet({
providerName: "", // providerName: "",
serviceCommunityList: CommunityList // serviceCommunityList: CommunityList
}) // })
} // }
} // }
useEffect(() => { // useEffect(() => {
GetList() // console.log(CommunityList)
}, []); // GetList()
useEffect(() => { // }, [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)
...@@ -44,76 +55,112 @@ const ServiceProviderManagement = (props: any) => { ...@@ -44,76 +55,112 @@ const ServiceProviderManagement = (props: 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 pagination={defaultCurrent:1,total: Data!=null?Data.length:0}
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",dataIndex: 'contactPhone',}, {
title: "Contacts",
dataIndex: 'contactPhone',
},
/*{ title: "Contact Details",dataIndex: 'contactEmail',},*/ /*{ title: "Contact Details",dataIndex: 'contactEmail',},*/
{ title: "Services Available",dataIndex: 'serviceScope',}, {
{ title: "Account Status",dataIndex: 'enable',}, title: "Services Available",
{ title: "Actions", dataIndex: 'serviceScope',
},
{ title: "Account Status", dataIndex: 'enable', },
{
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) => { const dataSource = (values: any) => {
let tmp = values; let tmp = values;
for (let items in tmp) { for (let items in tmp) {
switch (tmp[items].enable) { switch (tmp[items].enable) {
case 0: tmp[items].enable = "unregistered";break; case 0: tmp[items].enable = "unregistered"; break;
case 1: tmp[items].enable = "registered";break; case 1: tmp[items].enable = "registered"; break;
case 2:break; case 2: break;
} }
} }
for (let items in tmp) { for (let items in tmp) {
switch (tmp[items].serviceScope) { switch (tmp[items].serviceScope) {
case 0: tmp[items].serviceScope = "清洁";break; case 0: tmp[items].serviceScope = "清洁"; break;
case 1: tmp[items].serviceScope = "维修";break; case 1: tmp[items].serviceScope = "维修"; break;
case 2:tmp[items].serviceScope = "保安";break; case 2: tmp[items].serviceScope = "保安"; break;
case 3:tmp[items].serviceScope = "会计";break; case 3: tmp[items].serviceScope = "会计"; break;
} }
} }
// for (let items in tmp) {
// for(let i=0; i<tmp[items].serviceScopeList.length;i++){
// if(tmp[items].serviceScopeList[i] == '0'){
// tmp[items].serviceScopeList[i] = '清洁'
// continue
// }else if(tmp[items].serviceScopeList[i] == '1'){
// tmp[items].serviceScopeList[i] = '维修'
// continue
// }else if(tmp[items].serviceScopeList[i] == '2'){
// tmp[items].serviceScopeList[i] = '保安'
// continue
// }else if(tmp[items].serviceScopeList[i] == '3'){
// tmp[items].serviceScopeList[i] = '会计'
// continue
// }
// }
// }
return tmp; return tmp;
} }
const CallBackTitleSearch = (comment: any)=>{ useEffect(() => {
if (Data != null) {
setLoading(false)
console.log("核查的地方")
console.log(Data)
}
}, [Data])
useEffect(() => {
//分页设置
if (location.query.pageNum != null) {
setPageNum(parseInt(location.query.pageNum))
TosTosServiceProviderGet({
...location.query,
serviceCommunityList: testData != null ? testData : CommunityList,
})
} else {
setPageNum(1)
//获取数据
setLoading(true)
TosTosServiceProviderGet({
...location.query,
serviceCommunityList: testData != null ? testData : CommunityList,
})
}
}, [location])
const CallBackTitleSearch = (comment: any) => {
console.log(comment) console.log(comment)
console.log(location.pathname) console.log(location.pathname)
//页面搜索 //页面搜索
TosTosServiceProviderGet({ // TosTosServiceProviderGet({
// providerName: comment.providerName,
// serviceScope: comment.status,
// serviceCommunityList: comment.serviceCommunityList
// })
setTestData(comment.serviceCommunityList)
history.push(location.pathname + urlEncode(filterObj({
providerName: comment.providerName, providerName: comment.providerName,
serviceScope:comment.status, serviceScope: comment.status,
serviceCommunityList: comment.serviceCommunityList pageNum: 1
}) })))
// history.push(location.pathname+urlEncode(filterObj({ providerName: comment.providerName}))) }
const pageChange = (values: any) => {
// setPageNum(values.current)
console.log(values)
/*页面跳转*/
var tmp = filterObjbyTg(location.query, [])
tmp["pageNum"] = values.current
history.push(location.pathname + urlEncode(tmp))
} }
const pagination = {
current: pageNum,
// total: Data.total,
showSizeChanger: false
}
return ( return (
<div className={styles.base}> <div className={styles.base}>
...@@ -136,11 +183,15 @@ const ServiceProviderManagement = (props: any) => { ...@@ -136,11 +183,15 @@ const ServiceProviderManagement = (props: any) => {
</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 }} columns={columns} style={{ marginTop: 16 }}
dataSource={Data!=null?dataSource(Data):null} loading={loading}
pagination={pagination} /> columns={columns}
dataSource={Data != null ? dataSource(Data) : null}
pagination={Data != null ? pagination : {}}
onChange={pageChange}
/>
</Spin> </Spin>
</div> </div>
...@@ -148,7 +199,7 @@ const ServiceProviderManagement = (props: any) => { ...@@ -148,7 +199,7 @@ const ServiceProviderManagement = (props: any) => {
); );
}; };
function mapStateToProps(state:any) { function mapStateToProps(state: any) {
const { Data } = state.ServiceProvider; const { Data } = state.ServiceProvider;
const { DataProvider } = state.User; const { DataProvider } = state.User;
const { CommunityList } = state.Init; const { CommunityList } = state.Init;
......
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import styles from './Services.less'; import styles from './Services.less';
import { Form ,Button,Modal,Space,Pagination,Tooltip, Checkbox } from 'antd'; import { Form, Button, Modal, Space, Pagination, Tooltip, Checkbox } from 'antd';
import { Link, useIntl, connect, Dispatch } from 'umi'; import { Link, useIntl, connect, Dispatch } from 'umi';
import {PlusCircleOutlined} from '@ant-design/icons'; import { PlusCircleOutlined } from '@ant-design/icons';
import Line from '../../../components/Line/Line'; import Line from '../../../components/Line/Line';
import BackButton from '../../../components/BackButton/BackButton'; import BackButton from '../../../components/BackButton/BackButton';
...@@ -14,32 +14,33 @@ import TagSelect from '../../../components/TagSelect/index'; ...@@ -14,32 +14,33 @@ 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 = (props: any) => {
const { dispatch,DataServices} = props const { dispatch, DataServices } = props
const formRef = useRef(null) 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.serviceScopeList
console.log(tmp) console.log(tmp)
formRef.current.setFieldsValue({services:tmp }) console.log(formRef)
formRef.current.setFieldsValue({ services: tmp })
} }
}, [DataServices]) }, [DataServices])
const onFinish = (values:any) => { const onFinish = (values: any) => {
console.log(values) console.log(values)
RA(44, { RA(44, {
id:"5", id: "5",
serviceName:"律政" serviceName: "律政"
},module,dispatch) }, module, dispatch)
} }
const Add = (values:any) => { const Add = (values: any) => {
console.log(values) console.log(values)
} }
const Remove = (values: any) => { const Remove = (values: any) => {
...@@ -51,9 +52,9 @@ const Services = (props:any) => { ...@@ -51,9 +52,9 @@ const Services = (props:any) => {
<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="services"><TagSelect onAdd={Add} onRemove={Remove} /></Form.Item>
:null : 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> */}
...@@ -64,8 +65,8 @@ const Services = (props:any) => { ...@@ -64,8 +65,8 @@ const Services = (props:any) => {
); );
}; };
function mapStateToProps(state:any) { function mapStateToProps(state: any) {
const{DataServices} = state.User const { DataServices } = state.User
return { return {
DataServices DataServices
} }
......
...@@ -2,26 +2,26 @@ import request from '@/utils/request'; ...@@ -2,26 +2,26 @@ import request from '@/utils/request';
export function create(values: any) { export function create(values: any) {
console.log(values) console.log("ServiceProviderServices:create",values)
return request('/api/ServiceProvider/create',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}}) return request('/api/ServiceProvider/create',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}})
} }
export function service_1001(values: any) { export function service_1001(values: any) {
console.log(values) console.log("ServiceProviderServices:service_1001",values)
return request('/api/ServiceProvider/get',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}}) return request('/api/ServiceProvider/get',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}})
} }
export function service_1002(values: any) { export function service_1002(values: any) {
console.log(values) console.log("ServiceProviderServices:service_1002",values)
return request('/api/ServiceProvider/getById',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}}) return request('/api/ServiceProvider/getById',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}})
} }
export function get(values: any) { export function get(values: any) {
console.log(values) console.log("ServiceProviderServices:get",values)
return request('/tos/tosServiceProvider/get',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}}) return request('/tos/tosServiceProvider/get',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}})
} }
export function getSecurityGuarder(values: any) { export function getSecurityGuarder(values: any) {
console.log(values) console.log("ServiceProviderServices:getSecurityGuarder",values)
return request('/tos/securityGuarder/get',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}}) return request('/tos/securityGuarder/get',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}})
} }
...@@ -4,60 +4,101 @@ import request from '@/utils/request'; ...@@ -4,60 +4,101 @@ import request from '@/utils/request';
// 后台账号管理 // 后台账号管理
export function TosUserGetAllInfrom(values: any) { export function TosUserGetAllInfrom(values: any) {
return request('/tos/user/getAllInfrom',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}}) return request('/tos/user/getAllInfrom', {
method: 'POST',
body: JSON.stringify(values),
headers: { 'Content-Type': 'application/json' },
});
} }
export function TosUsersQuitAndUser(values: any) { export function TosUsersQuitAndUser(values: any) {
return request('/tos/users/quitAndUser',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}}) return request('/tos/users/quitAndUser', {
method: 'POST',
body: JSON.stringify(values),
headers: { 'Content-Type': 'application/json' },
});
} }
export function TosUserLogin(values: any) { export function TosUserLogin(values: any) {
return request('/tos/user/login/',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}}) return request('/tos/user/login/', {
method: 'POST',
body: JSON.stringify(values),
headers: { 'Content-Type': 'application/json' },
});
} }
export function TosUserNewCurrentUser(values: any) { export function TosUserNewCurrentUser(values: any) {
return request('/tos/user/newCurrentUser',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}}) return request('/tos/user/newCurrentUser', {
method: 'POST',
body: JSON.stringify(values),
headers: { 'Content-Type': 'application/json' },
});
} }
export function TosCheckAccountUsername(values: any) { export function TosCheckAccountUsername(values: any) {
return request('/tos/checkAccount/username',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}}) return request('/tos/checkAccount/username', {
method: 'POST',
body: JSON.stringify(values),
headers: { 'Content-Type': 'application/json' },
});
} }
export function TosAccountPermissionCheckPermission(values: any) { export function TosAccountPermissionCheckPermission(values: any) {
return request('/tos/account/permission/checkPermission',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}}) return request('/tos/account/permission/checkPermission', {
method: 'POST',
body: JSON.stringify(values),
headers: { 'Content-Type': 'application/json' },
});
} }
// 服务商 // 服务商
export function TosTosServiceProviderGet(values: any) { export function TosTosServiceProviderGet(values: any) {
return request('/tos/tosServiceProvider/get',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}}) console.log(values);
// return
return request('/tos/tosServiceProvider/get', {
method: 'POST',
body: JSON.stringify(values),
headers: { 'Content-Type': 'application/json' },
});
} }
export function TosSecurityGuarderGet(values: any) { export function TosSecurityGuarderGet(values: any) {
return request('/tos/securityGuarder/get',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}}) return request('/tos/securityGuarder/get', {
method: 'POST',
body: JSON.stringify(values),
headers: { 'Content-Type': 'application/json' },
});
} }
export function TosTosServiceProviderSave(values: any) { export function TosTosServiceProviderSave(values: any) {
return request('/tos/tosServiceProvider/save',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}}) return request('/tos/tosServiceProvider/save', {
method: 'POST',
body: JSON.stringify(values),
headers: { 'Content-Type': 'application/json' },
});
} }
// /tos/community/facilities/fuzzy/query // /tos/community/facilities/fuzzy/query
//配置文件 //配置文件
// const yellowcolor ="\033[40;33m" // const yellowcolor ="\033[40;33m"
// // const bulecolor='\033[40;34m'; // // const bulecolor='\033[40;34m';
// const colorend = "\033[0m" // const colorend = "\033[0m"
const headers = { 'Content-Type': 'application/json'} const headers = { 'Content-Type': 'application/json' };
function Body(values:any) { return {method: 'POST',body: JSON.stringify(values),headers:headers}}
function requestAuto(url:string,values:any) { function Body(values: any) {
return request(url, Body(values)) return {
method: 'POST',
body: JSON.stringify(values),
headers: headers,
};
} }
export function RA(playload: any) {
// console.log(playload)
// console.log(playload.index)
var url = (requestList[playload.index])[0]
console.log(playload.index + "》【发送请求】" + url + " " + (requestList[playload.index])[1]) function requestAuto(url: string, values: any) {
console.log("参数如下:") return request(url, Body(values));
console.log(playload.body) }
export function RA(playload: any) {
console.log('playload参数===========================================', playload);
var url = requestList[playload.index][0].toString();
console.log(playload.index + '》【发送请求】' + url + ' ' + requestList[playload.index][1]);
console.log('参数如下:');
console.log(playload.body);
// console.log(JSON.stringify(playload.body)) // console.log(JSON.stringify(playload.body))
return requestAuto(url,playload.body) return requestAuto(url, playload.body);
} }
//新增小区公告接口文件上传 http://47.74.233.180:8651/tos/image/upload imageType 参数值为 tosNotice //新增小区公告接口文件上传 http://47.74.233.180:8651/tos/image/upload imageType 参数值为 tosNotice
...@@ -5,12 +5,14 @@ export async function query(): Promise<any> { ...@@ -5,12 +5,14 @@ export async function query(): Promise<any> {
} }
export async function queryCurrent(values: any): Promise<any> { export async function queryCurrent(values: any): Promise<any> {
console.log(values) console.log('登录数据=================', values);
return request('/tos/user/newCurrentUser',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}}); return request('/tos/user/newCurrentUser', {
method: 'POST',
body: JSON.stringify(values),
headers: { 'Content-Type': 'application/json' },
});
} }
export async function queryNotices(): Promise<any> { export async function queryNotices(): Promise<any> {
return request('/api/notices'); return request('/api/notices');
} }
import {message } from 'antd'; import { message } from 'antd';
import moment from 'moment'; import moment from 'moment';
export const checkParam = (values: any) => { export const checkParam = (values: any) => {
var flag = true var flag = true;
for (var i in values) { for (var i in values) {
// console.log(values[i]); // console.log(values[i]);
if (values[i] == null) { if (values[i] == null) {
flag=false flag = false;
} else { } else {
if(values[i].length == 0){ flag=false} if (values[i].length == 0) {
flag = false;
} }
} }
return flag }
} return flag;
};
// onBlur={checkInput} maxLength={33} // onBlur={checkInput} maxLength={33}
export const checkInput = (e: any) => { export const checkInput = (e: any) => {
// console.log(e) // console.log(e)
if (e.target.value.length == 1) { if (e.target.value.length == 1) {
message.error("User Name Should be limit 2~30!", 3) message.error('User Name Should be limit 2~30!', 3);
e.target.value=null e.target.value = null;
} }
} };
export const picFromate = (values: any) => { export const picFromate = (values: any) => {
var result=new Array() var result = new Array();
if (values != null) { if (values != null) {
values.map((item: any, index: any) => {
values.map((item:any, index:any) => { result.push({ url: item });
result.push({ url: item }) });
})
} }
return result return result;
} };
export const getCookie=(key:string)=>{ export const getCookie = (key: string) => {
const name = key + "="; const name = key + '=';
const ca = document.cookie.split(';'); const ca = document.cookie.split(';');
for (let i = 0; i < ca.length; i++) { for (let i = 0; i < ca.length; i++) {
const c = ca[i].trim(); const c = ca[i].trim();
...@@ -47,127 +45,141 @@ export const getCookie=(key:string)=>{ ...@@ -47,127 +45,141 @@ export const getCookie=(key:string)=>{
return c.substring(name.length, c.length); return c.substring(name.length, c.length);
} }
} }
return ""; return '';
} };
export const setCookie=(key:string,value: string)=>{ export const setCookie = (key: string, value: string) => {
document.cookie=key + "=" + value + "; "; document.cookie = key + '=' + value + '; ';
} };
export const RA = (index: any, values: any, module: string, dispatch: any) => {
dispatch({
type: module + '/RA',
playload: { index: index, body: values },
});
};
export const SA = (values: any, module: string, dispatch: any) => {
dispatch({ type: module + '/SA', playload: values });
};
export const PAGE = (values: any, module: string, dispatch: any) => {
dispatch({ type: module + '/PAGE', playload: values });
};
export const URL = (values: any, module: string, dispatch: any) => {
dispatch({ type: module + '/URL', playload: values });
};
export const RA = (index: any, values: any, module: string, dispatch: any) => { dispatch({ type: module + '/RA', playload: { index: index, body: values } }) }; export const URLCLEAR = (module: string, dispatch: any) => {
export const SA = (values: any, module: string, dispatch: any) => { dispatch({ type: module + '/SA', playload: values }) }; dispatch({ type: module + '/URLCLEAR' });
export const PAGE = (values: any, module: string, dispatch: any) => { dispatch({ type: module + '/PAGE', playload: values }) }; };
export const URL = (values: any, module: string, dispatch: any) => { dispatch({ type: module + '/URL', playload: values }) }; export const DataClear = (module: string, dispatch: any) => {
export const URLCLEAR = (module: string, dispatch: any) => { dispatch({ type: module + '/URLCLEAR'}) }; dispatch({ type: module + '/DataClear' });
export const DataClear = (module: string, dispatch: any) => { dispatch({ type: module + '/DataClear'}) }; };
export const ResultClear = (module:any,dispatch:any) => { dispatch({ type: module + '/ResultClear' }) }; export const ResultClear = (module: any, dispatch: any) => {
dispatch({ type: module + '/ResultClear' });
};
// const reg = [["url", "categoriesImageUrl"], ["name", "categoriesName"]] // const reg = [["url", "categoriesImageUrl"], ["name", "categoriesName"]]
// const values = [{ categoriesImageUrl: "http://url", categoriesName: "A9" },{ categoriesImageUrl: "http://url...", categoriesName: "A8" }] // const values = [{ categoriesImageUrl: "http://url", categoriesName: "A9" },{ categoriesImageUrl: "http://url...", categoriesName: "A8" }]
export const Fromate = (values:any,reg:any) => { export const Fromate = (values: any, reg: any) => {
var result=new Array() var result = new Array();
if (values != null) { if (values != null) {
values.map((item: any, index: any) => {
values.map((item:any, index:any) => { var obj = {};
var obj={} for (var i = 0; i < reg.length; i++) {
for (var i = 0; i < reg.length; i++){
if (reg[i][1] == null) { if (reg[i][1] == null) {
obj[reg[i][0]]=item obj[reg[i][0]] = item;
} else { } else {
obj[reg[i][0]] = item[reg[i][1]] obj[reg[i][0]] = item[reg[i][1]];
} }
} }
result.push(obj) result.push(obj);
}) });
} }
return result return result;
} };
// 按键取值 // 按键取值
// const reg2 = "name" // const reg2 = "name"
// const values2 = [{name:"kat",url:"longtime"},{name:"jack",url:"longtime2"}] // const values2 = [{name:"kat",url:"longtime"},{name:"jack",url:"longtime2"}]
export const Fromate2 = (values:any, reg:string) => { export const Fromate2 = (values: any, reg: string) => {
var result = new Array() var result = new Array();
values.map((item:any, index:number) => { values.map((item: any, index: number) => {
result.push(item[reg]); result.push(item[reg]);
}) });
return result return result;
} };
// 获取对象信息 // 获取对象信息
export const getObjectInfo = (test: any) => { export const getObjectInfo = (test: any) => {
console.log(JSON.stringify(test,null, '\t')) console.log(JSON.stringify(test, null, '\t'));
var array = new Array() var array = new Array();
for (let item in test) { for (let item in test) {
array.push([item, typeof test[item]]) array.push([item, typeof test[item]]);
} }
return array return array;
} };
//对象转URL //对象转URL
export const urlEncode = (obj:any) => { export const urlEncode = (obj: any) => {
var url = "?" var url = '?';
var i = 0 var i = 0;
for (var item in obj) { for (var item in obj) {
if (i > 0) { if (i > 0) {
url += "&" url += '&';
} }
url += item + "=" + obj[item] url += item + '=' + obj[item];
i += 1 i += 1;
} }
return url return url;
} };
//对象抽空 //对象抽空
export const filterObj = (obj:any) => { export const filterObj = (obj: any) => {
var tmp = {} var tmp = {};
for (var item in obj) { for (var item in obj) {
if (obj[item] != null&&obj[item]!=undefined) { if (obj[item] != null && obj[item] != undefined) {
tmp[item] = obj[item] tmp[item] = obj[item];
} }
} }
return tmp return tmp;
} };
//对象抽空根据关键字 //对象抽空根据关键字
export const filterObjbyTg = (obj:any,tg:any) => { 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] != null) { if (obj[item] != null) {
tmp[item] = obj[item] tmp[item] = obj[item];
} }
} }
} }
return tmp return tmp;
} };
//提取当中的指定数据类型数据 //提取当中的指定数据类型数据
export const getLevelNum =()=>{ export const getLevelNum = () => {
var levelNum=new Array() var levelNum = new Array();
for (var item in treeData) { for (var item in treeData) {
// console.log(parseInt(treeData[item].key)) // console.log(parseInt(treeData[item].key))
if (!isNaN(parseInt(treeData[item].key))) { if (!isNaN(parseInt(treeData[item].key))) {
levelNum.push(treeData[item].key) levelNum.push(treeData[item].key);
} else { } else {
var tmp = treeData[item] var tmp = treeData[item];
tmp.children.map((item, index) => { tmp.children.map((item, index) => {
levelNum.push(item.key) levelNum.push(item.key);
}) });
} }
} }
return levelNum return levelNum;
} };
//转换 //转换
export const translate = (from:any,to:any,middle:any) => { export const translate = (from: any, to: any, middle: any) => {
middle.map((item, index) => { middle.map((item, index) => {
from[item[0]] = to[item[1]];
from[item[0]]=to[item[1]] });
}) return from;
return from };
}
//用户名检测 //用户名检测
export const checkData = (rule:any, value:any, callback:any) => { export const checkData = (rule: any, value: any, callback: any) => {
if (value) { if (value) {
if (/^[a-zA-Z0-9]+$/g.test(value)) { if (/^[a-zA-Z0-9]+$/g.test(value)) {
callback(); callback();
...@@ -178,10 +190,10 @@ export const checkData = (rule:any, value:any, callback:any) => { ...@@ -178,10 +190,10 @@ export const checkData = (rule:any, value:any, callback:any) => {
callback(); callback();
}; };
//时间转换函数 //时间转换函数
export const timeForm = (values: any,format:any) => { export const timeForm = (values: any, format: any) => {
var result = new Array() var result = new Array();
values.map((items:any, index:any) => { values.map((items: any, index: any) => {
result.push(moment(items).format(format)) result.push(moment(items).format(format));
}) });
return result[0] + "-" + result[1] return result[0] + '-' + result[1];
} };
\ No newline at end of file
export const validateMessages ={ export const validateMessages = {
required: '*it is required!', required: '*it is required!',
types: { types: {
email: 'It is not validate email!', email: 'It is not validate email!',
number: '${label} is not a validate number!', number: '${label} is not a validate number!',
string:'${label} is not a validate number!' string: '${label} is not a validate number!',
}, },
string: { string: {
range: 'It must be between ${min} and ${max}', range: 'It must be between ${min} and ${max}',
...@@ -11,106 +11,130 @@ export const validateMessages ={ ...@@ -11,106 +11,130 @@ export const validateMessages ={
number: { number: {
range: '${label} must be between ${min} and ${max}', range: '${label} must be between ${min} and ${max}',
}, },
} };
export const requestList = [ export const requestList = [
["/tos/community/facilities/categories/subscribe/list","0 请求预订列表",{}], ['/tos/community/facilities/categories/subscribe/list', '0 请求预订列表', {}],
["/tos/community/facilities/get","1 设施品类获取",{}], ['/tos/community/facilities/get', '1 设施品类获取', {}],
["/tos/community/facilities/categories/detail/get","2 缴费详情",{}], ['/tos/community/facilities/categories/detail/get', '2 缴费详情', {}],
["/tos/community/facilities/categories/fee/back","3 退还押金",{}], ['/tos/community/facilities/categories/fee/back', '3 退还押金', {}],
["/tos/community/facilities/categories/fee/pay","4 缴费",{}], ['/tos/community/facilities/categories/fee/pay', '4 缴费', {}],
["/tos/community/categories/subscribe/cancel","5 取消预约",{}], ['/tos/community/categories/subscribe/cancel', '5 取消预约', {}],
["/tos/community/facilities/add","6 新增小区设施",{}], ['/tos/community/facilities/add', '6 新增小区设施', {}],
["/tos/bookingService/lookUp","7 查看小区设施",{}], ['/tos/bookingService/lookUp', '7 查看小区设施', {}],
["/tos/community/facilities/fuzzy/query","8 查看设施管理模糊",{}], ['/tos/community/facilities/fuzzy/query', '8 查看设施管理模糊', {}],
["/tos/community/categories/subscribe/fuzzy/query","9 预订列表模糊查询",{}], ['/tos/community/categories/subscribe/fuzzy/query', '9 预订列表模糊查询', {}],
["/tos/user/newCurrentUser", "10 后台用户信息",{}], ['/tos/user/newCurrentUser', '10 后台用户信息', {}],
["/tos/community/facilities/categories/subscribe","11 预订",{}], ['/tos/community/facilities/categories/subscribe', '11 预订', {}],
["/tos/tosOwner/getAll", "12 业主查询",{}], // ['/tos/tosOwner/getAll', '12 业主查询', {}],
["/tos/tosOwner/getDetailAll", "13 业主查询详细",{}], ['/tos/owner/query/fuuzy', '12 业主查询', {}],
["/tos/tosOwner/save","14 业主添加",{}], ['/tos/tosOwner/getDetailAll', '13 业主查询详细', {}],
["/tos/life/community/qr/get","15 二维码查询",{}], ['/tos/tosOwner/save', '14 业主添加', {}],
["/tos/life/community/account/unit/del","16 删除单元",{}], ['/tos/life/community/qr/get', '15 二维码查询', {}],
["/tos/bookingService/edit", "17 编辑小区设施",{}], ['/tos/life/community/account/unit/del', '16 删除单元', {}],
["/tos/tosOwner/info/update", "18 编辑业主信息",{}], ['/tos/bookingService/edit', '17 编辑小区设施', {}],
['/tos/tosOwner/info/update', '18 编辑业主信息', {}],
["/tos/contract/list", "19 获取合同列表",{}], ['/tos/contract/list', '19 获取合同列表', {}],
["/tos/contract/detail/query", "20 获取合同列表详情",{}], ['/tos/contract/detail/query', '20 获取合同列表详情', {}],
["/tos/community/service/get/detail", "21 小区服务获取详情",{}], ['/tos/community/service/get/detail', '21 小区服务获取详情', {}],
["/tos/communtiy/service/reply", "22 小区回复",{}], ['/tos/communtiy/service/reply', '22 小区回复', {}],
["/tos/property/decorate/record/get", "23 装修列表获取",{}], ['/tos/property/decorate/record/get', '23 装修列表获取', {}],
["/tos/tosCommunity/get", "24 获取小区列表",{}], ['/tos/tosCommunity/get', '24 获取小区列表', {}],
["/tos/tosCommunityNotic/get", "25 获取小区公告列表",{}], ['/tos/tosCommunityNotic/get', '25 获取小区公告列表', {}],
["/tos/tosVisitorRecord/get", "26 获取访客记录列表",{}], ['/tos/tosVisitorRecord/get', '26 获取访客记录列表', {}],
["/tos/contract/add", "27 合同新增和编辑",{}], ['/tos/contract/add', '27 合同新增和编辑', {}],
["/tos/tosCommunityNotic/add", "28 新增小区公告接口", { [
"noticTitle":"Garden公告", '/tos/tosCommunityNotic/add',
"communityNum":"珠江丽景小区", '28 新增小区公告接口',
"noticText":"今晚晚上停水4小时", {
"noticScope":"1", noticTitle: 'Garden公告',
"noticStartTime":"2020-07-01 12:30:00", communityNum: '珠江丽景小区',
"noticEndTime":"2020-08-01 9:30:00", noticText: '今晚晚上停水4小时',
"file":["A.jpg"] noticScope: '1',
}], noticStartTime: '2020-07-01 12:30:00',
["/tos/tosManageCommunity/save", "29 新建一个小区",{}], noticEndTime: '2020-08-01 9:30:00',
["/tos/tosOrder/get", "30 获取订单详情",{}], file: ['A.jpg'],
["/tos/property/community/houseCard/query", "31 获取住户卡列表",{}], },
["/tos/tosCommunity/get/detail", "32 获取小区详情",{}], ],
["/tos/property/decorate/record/reply", "33 回复装修申请",{}], ['/tos/tosManageCommunity/save', '29 新建一个小区', {}],
["/tos/property/community/houseCard/reply", "34 回复住户卡申请",{}], ['/tos/tosOrder/get', '30 获取订单详情', {}],
["/tos/home/page/community/houseCard/add", "35 申请住户卡",{}], ['/tos/property/community/houseCard/query', '31 获取住户卡列表', {}],
["/tos/property/community/houseCard/query/detail", "36 获取住户卡详情",{}], ['/tos/tosCommunity/get/detail', '32 获取小区详情', {}],
["/tos/property/decorate/record/get/detail", "37 获取装修记录详情",{}], ['/tos/property/decorate/record/reply', '33 回复装修申请', {}],
["/tos/users/save", "38 新建后台信息",{}], ['/tos/property/community/houseCard/reply', '34 回复住户卡申请', {}],
["/tos/life/community/account/member/del", "39 删除业主成员信息", { ['/tos/home/page/community/houseCard/add', '35 申请住户卡', {}],
"id": "c06286cfe7b843cb96fdfcb987231123", ['/tos/property/community/houseCard/query/detail', '36 获取住户卡详情', {}],
"ownerId": "6b359755a36b49c28241a4620fa6539b" ['/tos/property/decorate/record/get/detail', '37 获取装修记录详情', {}],
}], ['/tos/users/save', '38 新建后台信息', {}],
["/tos/community/service/get", "40 获取小区服务回复列表",{}], [
["/tos/users/save", "41 添加后台账号", { '/tos/life/community/account/member/del',
"id": "null", '39 删除业主成员信息',
"oneself": 0, {
"tosUserEmail": "sales@huahui.com", id: 'c06286cfe7b843cb96fdfcb987231123',
"tosUserName": "小赵2", ownerId: '6b359755a36b49c28241a4620fa6539b',
"tosUserPhone": "020-8888-4444", },
"tosUserPwd": "123456", ],
"tosUserToCompany": "1", ['/tos/community/service/get', '40 获取小区服务回复列表', {}],
"tosUserServiceCell":"", [
"tosuserLevel": 1, '/tos/users/save',
"userStatus": 1 '41 添加后台账号',
}], {
["/tos/account/permission/savePermission", "42 添加后台权限", { id: 'null',
"userName": "小赵2", oneself: 0,
"userPassword": "123456", tosUserEmail: 'sales@huahui.com',
"permissionArray": ["2", "1", "3", "4"] tosUserName: '小赵2',
}], tosUserPhone: '020-8888-4444',
["/tos/tosServiceScope/get", "43 获取服务范围",{ tosUserPwd: '123456',
"serviceName": "" tosUserToCompany: '1',
}], tosUserServiceCell: '',
["/tos/tosServiceScope/save", "44 添加服务范围",{ tosuserLevel: 1,
"id":"5", userStatus: 1,
"serviceName":"律政" },
}], ],
["/tos/user/getAllInfrom", "45 获取后台列表", { [
"id": "", '/tos/account/permission/savePermission',
"moment": [], '42 添加后台权限',
"name": "", {
"leaderID": "1", userName: '小赵2',
"userPhone": "" userPassword: '123456',
}], permissionArray: ['2', '1', '3', '4'],
["/tos/tosServiceProvider/get","46 获取服务商",{}], },
] ],
[
'/tos/tosServiceScope/get',
'43 获取服务范围',
{
serviceName: '',
},
],
[
'/tos/tosServiceScope/save',
'44 添加服务范围',
{
id: '5',
serviceName: '律政',
},
],
[
'/tos/user/getAllInfrom',
'45 获取后台列表',
{
id: '',
moment: [],
name: '',
leaderID: '1',
userPhone: '',
},
],
['/tos/tosServiceProvider/get', '46 获取服务商', {}],
];
const params = [ const params = [
{ "communityName": "" }, { communityName: '' },
{ "communityNum": "", "noticTitlel": "" }, { communityNum: '', noticTitlel: '' },
{ "inviterAddress": "", "visitorCommunity": "" }, { inviterAddress: '', visitorCommunity: '' },
[26,{ [26, {}],
[28, {}],
}], ];
[28, {
}]
]
\ No newline at end of file
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