Commit 7052822d authored by cellee's avatar cellee

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

parents b178aac3 4ef109a0
......@@ -12,11 +12,11 @@ export default {
changeOrigin: true,
pathRewrite: { '^': '' },
},
/*'/api/': {
target: 'http://localhost:8080',
changeOrigin: true,
pathRewrite: { '^': '' },
},*/
// '/api/': {
// target: 'http://localhost:8080',
// changeOrigin: true,
// pathRewrite: { '^': '' },
// },
'/res/': {
target: 'http://mapleonlyone.top',
changeOrigin: true,
......@@ -27,28 +27,28 @@ export default {
changeOrigin: true,
pathRewrite: { '^': '' },
},
/* '/tos/': {
target: 'http://47.74.233.180:8651',
changeOrigin: true,
pathRewrite: { '^': '' },
},*/
'/tos/': {
target: 'http://localhost:8651',
target: 'http://47.74.233.180:8651',
changeOrigin: true,
pathRewrite: { '^': '' },
},
// '/tos/': {
// target: 'http://localhost:8651',
// changeOrigin: true,
// pathRewrite: { '^': '' },
// },
},
test: {
/* '/api/': {
target: 'https://preview.pro.ant.design',
changeOrigin: true,
pathRewrite: { '^': '' },
},*/
'/api/': {
target: 'http://localhost:8080',
target: 'https://preview.pro.ant.design',
changeOrigin: true,
pathRewrite: { '^': '' },
},
// '/api/': {
// target: 'http://localhost:8080',
// changeOrigin: true,
// pathRewrite: { '^': '' },
// },
'/res/': {
target: 'http://mapleonlyone.top',
changeOrigin: true,
......@@ -59,16 +59,16 @@ export default {
changeOrigin: true,
pathRewrite: { '^': '' },
},
/* '/tos/': {
target: 'http://47.74.233.180:8651',
changeOrigin: true,
pathRewrite: { '^': '' },
},*/
'/tos/': {
target: 'http://localhost:8651',
target: 'http://47.74.233.180:8651',
changeOrigin: true,
pathRewrite: { '^': '' },
},
// '/tos/': {
// target: 'http://localhost:8651',
// changeOrigin: true,
// pathRewrite: { '^': '' },
// },
},
pre: {
// '/api/': {
......@@ -87,14 +87,14 @@ export default {
pathRewrite: { '^': '' },
},
'/tos/': {
target: 'http://47.74.233.180:8651',
changeOrigin: true,
pathRewrite: { '^': '' },
},
/* '/tos/': {
target: 'http://localhost:8651',
target: 'http://47.74.233.180:8651',
changeOrigin: true,
pathRewrite: { '^': '' },
},*/
},
// '/tos/': {
// target: 'http://localhost:8651',
// changeOrigin: true,
// pathRewrite: { '^': '' },
// },
},
};
......@@ -73,16 +73,16 @@ class AvatarDropdown extends React.Component<GlobalHeaderRightProps> {
</span>
</HeaderDropdown>
) : (
<span className={`${styles.action} ${styles.account}`}>
<Spin
size="small"
style={{
marginLeft: 8,
marginRight: 8,
}}
/>
</span>
);
<span className={`${styles.action} ${styles.account}`}>
<Spin
size="small"
style={{
marginLeft: 8,
marginRight: 8,
}}
/>
</span>
);
}
}
......
import React, { useEffect } from 'react';
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
import { objectColumns} from '@/utils/string';
import { objectColumns } from '@/utils/string';
import { size } from 'lodash';
import Toast from '../Toast/Toast';
const TableShow = (props:any) => {
const TableShow = (props: any) => {
const { data } = props;
const dataRow = data.rows;
const goTo = (values:any,e:any) => {
const goTo = (values: any, e: any) => {
console.log(values)
props.onSubmit(values)
}
......@@ -24,17 +24,17 @@ const TableShow = (props:any) => {
useEffect(() => {
console.log("组件入参")
console.log(dataRow)
},[])
}, [])
//
// Contact Details
// Email
// cdk_code
// Account Type
// User Status
// ower_email: "535740436@qq.com"
// ower_name: "测试"
// ower_phone: "微微"
// Contact Details
// Email
// cdk_code
// Account Type
// User Status
// ower_email: "535740436@qq.com"
// ower_name: "测试"
// ower_phone: "微微"
// Owner/Family Member/Tenant
// const user_status = [[1, "家属"], [2, "租户"]]
......@@ -43,63 +43,64 @@ const TableShow = (props:any) => {
// const user_type_status = ["Registered", "Unregistered", "Cancellation"]
const user_type_status = ["Normal", "Normal", "Cancellation"]
const user_code=["Not Used","Used"]
const user_code = ["Not Used", "Used"]
const key = objectColumns([
["User Name", "ower_name"],
["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>)],
["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>)],
])
return (
<>
<Tabs defaultActiveKey="0" >
{
dataRow.map((item, index) => {
return(
<TabPane tab={item.name} key={index}>
<Row gutter={16}><Col>Address:</Col><Col>{((item).owner).addressAndpostalCode}</Col></Row>
{
(item.unit).map((unit:any, uindex:any) => {
return (
<div key={unit.living}>
<Row gutter={32}>
<Col span={20}>
<Table title={() => {
return (
<div style={{ height: 80, position: "relative" }}>
<div style={{ position: "absolute", left: 0,bottom:16 }}>
<Row gutter={32}><Col>Unit No:</Col><Col>{unit.living}</Col></Row>
</div>
<div style={{ position: "absolute", right: 0,bottom:16 }}>
{props.deleteDisable ?<Button type="danger" onClick={deleteUnit.bind(this, unit.living)}>Delete</Button> : null}
</div>
</div>
)
}} footer={() => ''} rowKey={"ower_name"} dataSource={unit.member} columns={key} pagination={false}></Table>
</Col>
<Col>
<Row>
<img width={80} src={unit.imgUrl} />
</Row>
<Row style={{ marginTop: 8 }}><div style={{ width: 80, textAlign: "center" }}>{item.owner.cdkCode}({user_code[item.owner.cdkStatus]})</div></Row>
</Col>
</Row>
</div>
)
})
}
</TabPane>
)})
return (
<TabPane tab={item.name} key={index}>
<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) => {
return (
<div key={unit.living}>
<Row gutter={32}>
<Col span={20}>
<Table title={() => {
return (
<div style={{ height: 80, position: "relative" }}>
<div style={{ position: "absolute", left: 0, bottom: 16 }}>
<Row gutter={32}><Col>Unit No:</Col><Col>{unit.living}</Col></Row>
</div>
<div style={{ position: "absolute", right: 0, bottom: 16 }}>
{props.deleteDisable ? null : <Button type="primary" danger onClick={deleteUnit.bind(this, unit.living)}>Delete</Button>}
</div>
</div>
)
}} footer={() => ''} rowKey={"ower_name"} dataSource={unit.member} columns={key} pagination={false}></Table>
</Col>
<Col>
<Row>
<img width={80} src={unit.imgUrl} />
</Row>
<Row style={{ marginTop: 8 }}><div style={{ width: 80, textAlign: "center" }}>{item.owner.cdkCode}({user_code[item.owner.cdkStatus]})</div></Row>
</Col>
</Row>
</div>
)
})
}
</TabPane>
)
})
}
</Tabs>
</>
);
};
......
......@@ -81,7 +81,8 @@ class TagSelect extends React.Component {
const { value, inputVisible, inputValue, editInputIndex, editInputValue } = this.state;
return (
<>
{value.map((tag, index) => {
{
value.map((tag, index) => {
if (editInputIndex === index) {
return (
<Input
......@@ -127,7 +128,9 @@ class TagSelect extends React.Component {
) : (
tagElem
);
})}
})
}
{inputVisible && (
<Input
ref={this.saveInputRef}
......
......@@ -4,27 +4,27 @@ import styles from './index.less';
import BackButton from '../BackButton/BackButton';
import TitleGet from '../TitleGet/TitleGet';
const TitleBack = (props:any) => {
// <TitleBack sublist={['Handle Status : '+CurDataDetail.status,'Create Time : '+CurDataDetail.time]} title={headTitle} />
const backData = (values:any) => {
const TitleBack = (props: any) => {
// <TitleBack sublist={['Handle Status : '+CurDataDetail.status,'Create Time : '+CurDataDetail.time]} title={headTitle} />
const backData = (values: any) => {
props.titleBack(values)
}
return (
<>
<div className={styles.item0}><TitleGet title={props.title} /></div>
{
props.sublist!=null
?
(props.sublist).map((item:any,index:any)=>{
return (
<div key={index} className={styles.item1}>{item}</div>
)
})
props.sublist != null && props.title == "Edit Owner Infomation"
?
(props.sublist).map((item: any, index: any) => {
return (
<div key={index} className={styles.item1}>{item}</div>
)
})
:
<></>
}
<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>
</>
);
......
import React, { useState,useEffect,useRef} from 'react';
import React, { useState, useEffect, useRef } from 'react';
import { Link, useIntl, connect, Dispatch, history } from 'umi';
import styles from './index.less';
......@@ -6,25 +6,26 @@ import styles from './index.less';
import BackButton from '../BackButton/BackButton';
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;
import SelectOptions from '../../components/SelectOptions/index';
import { gray } from 'chalk';
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 name = props.list;
const single = props.single
const checklist = props.checklist;
const status = props.status;
const communitySelect=props.communitySelect
const communitySelect = props.communitySelect
const defaultValue = props.defaultValue
const time = props.time;
const community = props.community;
const [selectOptions, setSelectOptions] = useState(true)
......@@ -33,27 +34,29 @@ const TitleSearch= (props:any) => {
const [datePicker, setDate] = useState(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(() => {
// console.log("标题搜寻组件初始化") OK
if (CommunityList == null) {
// console.log("小区数量初始化") OK
tosCommunityget(null)
tosCommunityget(null)
}
if (defaultValue != null) {
formRef.current.setFieldsValue(defaultValue)
}
}, []);
}, []);
useEffect(() => {
useEffect(()=>{
if (defaultValue != null) {
formRef.current.setFieldsValue(defaultValue)
}
},[defaultValue])
useEffect(()=>{
}, [defaultValue])
useEffect(() => {
console.log(CommunityList)
if (CommunityList != null) {
// console.log("小区数量初始化完毕") OK
var tmp = {}
......@@ -61,105 +64,109 @@ const TitleSearch= (props:any) => {
// props.onSubmit(tmp) 禁用 改用组件初始化
setCommunitys(CommunityList)
}
},[CommunityList])
}, [CommunityList])
const onFinish = (values:any) => {
const onFinish = (values: any) => {
if (datePicker) {
values[time[0]] = datePicker;
}
if (community) {
values[community]=communitys
if (community) {
values[community] = communitys
}
console.log('Success:', values);
props.onSubmit(values)
props.onSubmit(values)
};
const onFinishFailed = (errorInfo:any) => {
const onFinishFailed = (errorInfo: any) => {
console.log('Failed:', errorInfo);
};
const onChange = (date:any,dateString:string) => {
const onChange = (date: any, dateString: string) => {
setDate(dateString)
}
const printContent = (comment: any)=>{
const printContent = (comment: any) => {
setCommunitys(comment)
}
return (
<>
<Form ref={formRef} name="basic" onFinish={onFinish} onFinishFailed={onFinishFailed}>
<Row gutter={32}>
{
communitySelect != null ?
<Col key={"communitySelect_"} ><Form.Item name={"communityName"}><SearchOptionsCommnity titleSearch={true} /></Form.Item></Col>
<Form ref={formRef} name="basic" onFinish={onFinish} onFinishFailed={onFinishFailed}>
<Row gutter={32}>
{
communitySelect != null ?
<Col key={"communitySelect_"} ><Form.Item name={"communityName"}><SearchOptionsCommnity titleSearch={true} /></Form.Item></Col>
: null
}
}
{
key!=null?
key.map((item, index) => {
return (
<Col key={"KeyCol_"+ index}><Form.Item name={item}><Input placeholder={name[index]} allowClear /></Form.Item></Col>
)
})
:null
key != null ?
key.map((item, index) => {
return (
<Col key={"KeyCol_" + index}><Form.Item name={item}><Input placeholder={name[index]} allowClear /></Form.Item></Col>
)
})
: null
}
{
status != null ?
status.map((item, index) => {
return (
<Col key={"StatusCol_" + index}><Form.Item name={item.name[0]}>
<Select style={{width:160}} placeholder={item.name[1]} allowClear={true}>
{
item.data.map(word => {
return (
<Option key={word} value={word[0]}>{word[1]}</Option>
)
})
}
</Select></Form.Item></Col>
)
})
:null
status.map((item, index) => {
return (
<Col key={"StatusCol_" + index}>
<Form.Item name={item.name[0]}>
<Select style={{ width: 160 }} placeholder={item.name[1]} allowClear={true}>
{
item.data.map(word => {
return (
<Option key={word} value={word[0]}>{word[1]}</Option>
)
})
}
</Select>
</Form.Item>
</Col>
)
})
: null
}
{
time != null ?
<Col key={"datePicker_"} > <DatePicker placeholder={time[1]} onChange={onChange} /></Col>
time != null ?
<Col key={"datePicker_"} > <DatePicker placeholder={time[1]} onChange={onChange} /></Col>
: null
}
}
{
community == null ?
<Col><Form.Item><Button type="primary" htmlType="submit">Search</Button></Form.Item></Col>
<Col><Form.Item><Button type="primary" htmlType="submit">Search</Button></Form.Item></Col>
: null
}
}
</Row>
{
community != null ?
<>
{
CommunityList != null ?
<SelectOptions checklist={checklist} single={single} list={CommunityList.sort()} show={selectOptions} onSubmit={printContent} />:
null
<SelectOptions checklist={checklist} single={single} list={CommunityList.sort()} show={selectOptions} onSubmit={printContent} /> :
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
}
</Form>
</>
);
};
function mapStateToProps(state:any) {
const { CommunityList } = state.Init;
function mapStateToProps(state: any) {
// console.log("state参数",state)
const { CommunityList } = state.Init;
return {
CommunityList,
};
......
export default {
'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.project': 'Project',
'R.charge.unit': 'Unit',
'R.charge.status': 'Status',
'R.charge.submissionTime': 'Submission Time',
'R.charge.usertype': 'user Type',
'R.charge.actions': 'Actions',
'R.charge.search': 'Search',
'R.charge.addaccount': 'Add Account',
'R.charge.paymentsetting': 'Payment Setting',
'R.selectoptions.open': 'Open',
'R.selectoptions.PutItAway':'Put It Away',
'R.selectoptions.Selected':'Selected',
'R.selectoptions.PutItAway': 'Put It Away',
'R.selectoptions.Selected': 'Selected',
'R.selectoptions.SelectNone': 'Select None',
'R.selectoptions.all':'All',
'R.selectoptions.all': 'All',
'R.selectoptions.SearchCell': 'Search cell',
};
export default {
'R.charge.input.project': '所在小区',
'R.charge.input.nameofowner':'业主名称',
'R.charge.input.nameofowner': '业主名称',
'R.charge.username': '业主名称',
'R.charge.project': '所在小区',
'R.charge.unit': '所在单元',
'R.charge.status': '状态',
'R.charge.submissionTime': '提交时间',
'R.charge.usertype': '用户类型',
'R.charge.actions': '操作',
'R.charge.search': '搜索',
'R.charge.addaccount': '添加会计',
'R.charge.paymentsetting': '缴费设置',
'R.selectoptions.open': '展开',
'R.selectoptions.PutItAway':'收起',
'R.selectoptions.Selected':'已选',
'R.selectoptions.PutItAway': '收起',
'R.selectoptions.Selected': '已选',
'R.selectoptions.SelectNone': '全不选',
'R.selectoptions.all':'所有',
'R.selectoptions.SearchCell':'搜索小区',
'R.selectoptions.all': '所有',
'R.selectoptions.SearchCell': '搜索小区',
};
......@@ -2,41 +2,41 @@ import * as service from '../../services/tos';
import { message } from 'antd';
import { Link, useIntl, connect, Dispatch, history } from 'umi';
import { routerRedux } from 'dva/router'
import { routerRedux } from 'dva/router';
export default {
namespace: 'User',
state: {
Data: null,
DataPage:{totalRow:0},
DataPage: { totalRow: 0 },
Data3Error: null,
DataSave: null,
DataSaveDetail: null,
sourceData: null,
curString: { subscribeDate: null, status: null, curPage: 1, curPage2: 1 },
communityInfo: null,
pageDate: null,
returnValue: null,
memberResult: null,
DataServices:null,
DataServices: null,
},
reducers: {
returnPage(state, { Data,DataPage,DataSave}) {
return { ...state, Data,DataPage,DataSave };
returnPage(state, { Data, DataPage, DataSave }) {
return { ...state, Data, DataPage, DataSave };
},
returnData3Error(state, { Data3Error }) {
return { ...state, Data3Error };
},
returnDataSave(state, { DataSave }) {
return { ...state, DataSave};
return { ...state, DataSave };
},
DataSaveDetail(state, { DataSaveDetail,returnValue}) {
return { ...state, DataSaveDetail,returnValue};
DataSaveDetail(state, { DataSaveDetail, returnValue }) {
return { ...state, DataSaveDetail, returnValue };
},
returnSource(state, { sourceData }) {
return { ...state, sourceData };
......@@ -45,157 +45,174 @@ export default {
return { ...state, curString };
},
returnResult(state, { Result }) {
return {...state,Result}
return { ...state, Result };
},
returnCommunityInfo(state, { communityInfo }) {
return {...state,communityInfo}
return { ...state, communityInfo };
},
PageDate(state, { pageDate }) {
return {...state,pageDate}
return { ...state, pageDate };
},
ReturnValue(state, { returnValue }) {
return{...state,returnValue}
return { ...state, returnValue };
},
returnMemberResult(state, { memberResult }) {
return{...state,memberResult}
return { ...state, memberResult };
},
returnDataServices(state, { DataServices }) {
return{...state,DataServices}
}
return { ...state, DataServices };
},
},
effects: {
*RA({ playload }, { call, put }) {
switch (playload.index) {
case 12:
{
let Data = null;
yield put({ type: 'returnPage', Data });
} break;
case 13: {
let DataSaveDetail = null;
let returnValue = null;
yield put({ type: 'DataSaveDetail', DataSaveDetail,returnValue });
} break;
case 43: {
let DataServices = null;
yield put({ type: 'returnDataServices', DataServices });
} break;
}
}
break;
case 13:
{
let DataSaveDetail = null;
let returnValue = null;
yield put({ type: 'DataSaveDetail', DataSaveDetail, returnValue });
}
break;
case 43:
{
let DataServices = null;
yield put({ type: 'returnDataServices', DataServices });
}
break;
}
const resp = yield call(service.RA, playload);
console.log(resp)
if (resp.code == 500 || resp.error_code != "0000") {
console.log('resp', resp);
if (resp.code == 500 || resp.error_code != '0000') {
// message.error("Server Error,try again,error code:500",3)
// window.location.href = '/500';
}
if (resp.error_code != "0000") {
console.log("请求错误码:"+"("+playload.index+")" + resp.error_code)
console.log(playload)
var Data3Error = null
var Result=null
switch (playload.index) {
case 11: {
Data3Error = { msg: "Information Wrong!" };
yield put({ type: 'returnData3Error', Data3Error });
} break;
case 13: {
//
history.push("/UserManagement/LIFEUserManagement")
} break;
if (resp.error_code != '0000') {
console.log('请求错误码:' + '(' + playload.index + ')' + resp.error_code);
console.log(playload);
var Data3Error = null;
var Result = null;
switch (playload.index) {
case 11:
{
Data3Error = { msg: 'Information Wrong!' };
yield put({ type: 'returnData3Error', Data3Error });
}
break;
case 13:
{
//
history.push('/UserManagement/LIFEUserManagement');
}
break;
// 删除失败的案例
// case 16:{
// Result = resp;
// yield put({ type: 'returnResult', Result });
// yield put({ type: 'returnResult', Result });
// } break;
}
}
else {
} else {
switch (playload.index) {
case 12:{
case 12:
{
let Data = resp;
yield put({ type: 'returnPage', Data});
} break;
yield put({ type: 'returnPage', Data });
}
break;
case 18:
case 14:{
message.success("Success Operation!",3)
// window.location.href = '/CommunityManagement/FacilityBookings';
history.push("/UserManagement/LIFEUserManagement")
} break;
case 13: {
let DataSaveDetail = resp.data;
yield put({ type: 'DataSaveDetail', DataSaveDetail });
} break;
case 16: {
console.log("等待删除完成")
var returnValue = resp;
yield put({ type: 'ReturnValue', returnValue });
} break;
case 32: {
let communityInfo = resp;
yield put({ type: 'returnCommunityInfo', communityInfo });
} break;
case 39: {
let memberResult = resp;
yield put({ type: 'returnMemberResult', memberResult });
} break;
case 43: {
let DataServices = resp;
yield put({ type: 'returnDataServices', DataServices });
} break;
case 14:
{
message.success('Success Operation!', 3);
// window.location.href = '/CommunityManagement/FacilityBookings';
history.push('/UserManagement/LIFEUserManagement');
}
break;
case 13:
{
let DataSaveDetail = resp.data;
yield put({ type: 'DataSaveDetail', DataSaveDetail });
}
break;
case 16:
{
console.log('等待删除完成');
var returnValue = resp;
yield put({ type: 'ReturnValue', returnValue });
}
break;
case 32:
{
let communityInfo = resp;
yield put({ type: 'returnCommunityInfo', communityInfo });
}
break;
case 39:
{
let memberResult = resp;
yield put({ type: 'returnMemberResult', memberResult });
}
break;
case 43:
{
let DataServices = resp;
yield put({ type: 'returnDataServices', DataServices });
}
break;
}
}
},
*IA({ playload }, { call, put }) {
var Data3 = null
var Data3 = null;
yield put({ type: 'returnPage3', Data3 });
},
*IA2({ playload }, { call, put }) {
var Data3Error = null
var Data3Error = null;
yield put({ type: 'returnData3Error', Data3Error });
},
*SA({ playload }, { call, put }) {
var DataSave = playload
yield put({type: 'returnDataSave', DataSave} )
var DataSave = playload;
yield put({ type: 'returnDataSave', DataSave });
},
*CA({ playload }, { call, put }) {
var sourceData = playload
yield put({type: 'returnSource',sourceData})
var sourceData = playload;
yield put({ type: 'returnSource', sourceData });
},
*QA({ playload }, { call, put }) {
var curString = playload
yield put({type: 'returnCurString', curString} )
var curString = playload;
yield put({ type: 'returnCurString', curString });
},
*ResultClear({ }, { put }) {
var tmp=null
yield put({type: 'returnResult', tmp} )
*ResultClear({}, { put }) {
var tmp = null;
yield put({ type: 'returnResult', tmp });
},
*PAGE({ playload }, { put }) {
var pageDate = playload
yield put({type: 'PageDate',pageDate})
*PAGE({ playload }, { put }) {
var pageDate = playload;
yield put({ type: 'PageDate', pageDate });
},
*DataClear({ }, { put }) {
var pageDate = null
yield put({type: 'returnPage',pageDate})
*DataClear({}, { put }) {
var pageDate = null;
yield put({ type: 'returnPage', pageDate });
},
*MemberResultClear({ }, { put }) {
*MemberResultClear({}, { put }) {
let memberResult = null;
yield put({ type: 'returnMemberResult', memberResult });
},
},
};
import * as service from '../services/tos';
import { message } from 'antd';
import { routerRedux } from 'dva/router'
import { routerRedux } from 'dva/router';
export default {
namespace: 'ServiceProvider',
state: {
Data: null,
CurDataFollow: null,
SaveChooseData:null,
SaveChooseData: null,
},
reducers: {
returnPage(state, { Data }) {
console.log(state);
console.log(Data);
return { ...state, Data };
},
......@@ -22,65 +24,57 @@ export default {
returnCurDataFollowDetail(state, { CurDataFollowDetail }) {
return { ...state, CurDataFollowDetail };
},
},
returnSaveChooseData(state, { SaveChooseData }) {
return { ...state, SaveChooseData };
},
},
effects: {
// 获取服务商
*TosTosServiceProviderGet({ playload }, { call, put }) {
const resp = yield call(service.TosTosServiceProviderGet, playload);
console.log(resp)
if (resp.code == 500) {
// window.location.href = '/500';
}
if (resp.error_code == "0000") {
let Data = resp.data.rows;
yield put({ type: 'returnPage', Data, });
console.log(resp);
if (resp.error_code == '0000') {
let Data = resp.data;
yield put({ type: 'returnPage', Data });
} else {
console.log("请求错误码:"+resp.error_code)
console.log('请求错误码:' + resp.error_code);
let Data = null;
console.log(playload)
yield put({ type: 'returnPage', Data, });
console.log(playload);
yield put({ type: 'returnPage', Data });
}
},
// 新建服务商
*TosTosServiceProviderSave({ playload }, { call, put }) {
console.log(playload)
console.log(playload);
const resp = yield call(service.TosTosServiceProviderSave, playload);
console.log(resp)
console.log(resp);
if (resp.code == 500) {
window.location.href = '/500';
} else {
message.success("operator success!", 2);
message.success('operator success!', 2);
window.location.href = '/UserManagement/ServiceProviderManagement';
}
},
//获取服务商保安根据服务商名
*TosSecurityGuarderGet({ playload }, { call, put }) {
console.log(playload)
console.log(playload);
const resp = yield call(service.TosSecurityGuarderGet, playload);
console.log(resp)
console.log(resp);
let CurDataFollow = resp.data.rows;
yield put({ type: 'returnCurDataFollow', CurDataFollow, });
yield put({ type: 'returnCurDataFollow', CurDataFollow });
},
//获取服务商保安详情根据服务商名
*GuarderById({ playload }, { call, put }) {
let CurDataFollowDetail = playload;
yield put({ type: 'returnCurDataFollowDetail', CurDataFollowDetail, });
yield put({ type: 'returnCurDataFollowDetail', CurDataFollowDetail });
},
*SaveChooseData({ playload }, { call, put }) {
let SaveChooseData = playload;
yield put({ type: 'returnSaveChooseData', SaveChooseData, });
yield put({ type: 'returnSaveChooseData', SaveChooseData });
},
},
};
......@@ -20,6 +20,7 @@ export default {
//获取
*tosCommunityget({ playload }, { call, put }) {
const resp = yield call(service.tosCommunityget, playload);
let CommunityList = resp.data.communityList;
yield put({ type: 'returnCommunityList', CommunityList, });
......
import { stringify } from 'querystring';
import { history, Reducer, Effect } from 'umi';
import { AccountLogin,AccountCheckLogin,AccountOut } from '@/services/login';
import { AccountLogin, AccountCheckLogin, AccountOut } from '@/services/login';
import { setAuthority } from '@/utils/authority';
import { getPageQuery } from '@/utils/utils';
......@@ -24,11 +24,10 @@ export interface LoginModelType {
logout: Effect;
};
reducers: {
changeLoginStatus: Reducer<StateType>;
changeLoginStatus: Reducer<StateType>;
};
}
const Model: LoginModelType = {
namespace: 'login',
......@@ -36,7 +35,7 @@ const Model: LoginModelType = {
status: undefined,
token: '',
userName: '',
password:'',
password: '',
},
reducers: {
......@@ -48,9 +47,9 @@ const Model: LoginModelType = {
type: payload.type,
};
},
saveToken(state, { token,userName,password }) {
return{...state,token,userName,password}
}
saveToken(state, { token, userName, password }) {
return { ...state, token, userName, password };
},
},
effects: {
......@@ -61,20 +60,25 @@ const Model: LoginModelType = {
payload: response,
});
// Login successfully response.status === 'ok'
if (response.token !=null) {
console.log("用户名密码登录成功")
console.log(response)
const userMessage = yield call(AccountCheckLogin, payload);//请求时间网络
console.log(userMessage)
console.log(userMessage.token)
setCookie("token", userMessage.token)
if (response.token != null) {
console.log('用户名密码登录成功');
console.log(response);
const userMessage = yield call(AccountCheckLogin, payload); //请求时间网络
console.log(userMessage);
console.log(userMessage.token);
setCookie('token', userMessage.token);
// tosUserName: "admin"
// tosUserPhone: "18818881888"
setCookie("name", response.token.tosUserName)
setCookie("phone", response.token.tosUserPhone)
setCookie("id", response.token.id)
console.log("获取到Token:" + getCookie("token"))
yield put({type: 'saveToken',token: userMessage.token,userName:payload.userName,password:payload.password});
setCookie('name', response.token.tosUserName);
setCookie('phone', response.token.tosUserPhone);
setCookie('id', response.token.id);
console.log('获取到Token:' + getCookie('token'));
yield put({
type: 'saveToken',
token: userMessage.token,
userName: payload.userName,
password: payload.password,
});
const urlParams = new URL(window.location.href);
const params = getPageQuery();
let { redirect } = params as { redirect: string };
......@@ -92,12 +96,12 @@ const Model: LoginModelType = {
}
history.replace(redirect || '/');
} else {
console.error(response)
message.error("Login Error! Username or Password is wrong!",3)
console.error(response);
message.error('Login Error! Username or Password is wrong!', 3);
}
},
*logout({},{call,put}) {
*logout({}, { call, put }) {
const { redirect } = getPageQuery();
// Note: There may be security issues, please note
// const response = yield call(AccountOut, payload);
......@@ -111,8 +115,6 @@ const Model: LoginModelType = {
}
},
},
};
export default Model;
......@@ -28,7 +28,7 @@ export default{
});
if(callback) callback(response);
},
*saveOwner({callback,payload},{ call, put }) {
*saveOwner({ callback, payload }, { call, put }) {
const response = yield call(saveOwner,payload);
yield put({
type: "save",
......
......@@ -40,7 +40,6 @@ const Order = (props:any) => {
// }
// },[Data])
const CallBackTitleSearch = (value: any) => {
if (value.orderNumber != null || value.serviceType != null) {
RA(30, value, module, dispatch)
}
......@@ -72,7 +71,7 @@ const Order = (props:any) => {
);
};
function map(state:any) {
function map(state: any) {
const { Data} = state[module]
return { Data}
}
......
import React, { useState, useEffect } from 'react';
import styles from './AccoutingContent.less';
import { Input ,Button,Table,Space,Pagination,Tooltip } from 'antd';
import { Input, Button, Table, Space, Pagination, Tooltip } from 'antd';
import { Link, useIntl, connect, Dispatch } from 'umi';
......@@ -17,39 +17,39 @@ const AccoutingContent = (props: { location: any; }) => {
history.back()
};
const [ editFlag, setEditFlag ] = useState(false);
useEffect(() => {
if ((location.pathname).indexOf("/AccoutingDetail")>-1) {
setEditFlag(true)
const [editFlag, setEditFlag] = useState(false);
useEffect(() => {
if ((location.pathname).indexOf("/AccoutingDetail") > -1) {
setEditFlag(true)
} else {
setEditFlag(false)
setEditFlag(false)
}
},[location.pathname]);
}, [location.pathname]);
const printContent = (comment: any)=>{
const printContent = (comment: any) => {
console.log(comment)
}
return (
<div className={styles.base}>
{/* 头部组件 */}
{/* 头部组件 */}
<div className={styles.box}>
<div className={styles.item1}>Add Accounting</div>
<button className={styles.item3} onClick={goToReturn}>Return</button>
</div>
<div className={styles.box1}>
<div className={styles.box1item1}>Company Name</div>
<div className={styles.box1item2}>{editFlag ? (<Input style={{ width: 260 }} placeholder="Please enter company name" />) : ("123")}</div>
<div className={styles.box1item3}>Office Address</div>
<div className={styles.box1item4}>{editFlag ? (<Input style={{ width: 200 }} placeholder="Single Line Input" />) : ("123")}</div>
</div>
<Line/>
<div style={{marginBottom:28}}>Service Community</div>
<SelectOptions list={["美国","美丽的","美好","加拿大","加油","XO"].sort()} onSubmit={printContent}/>
<Line />
<div style={{ marginBottom: 28 }}>Service Community</div>
<SelectOptions list={["美国", "美丽的", "美好", "加拿大", "加油", "XO"].sort()} onSubmit={printContent} />
<div className={styles.box2}>
<div className={styles.box2item1}>Services Available</div>
<div className={styles.box2item2}>Accounting</div>
......@@ -57,21 +57,21 @@ const AccoutingContent = (props: { location: any; }) => {
<div className={styles.box2}>
<div className={styles.box2item1}>Person In Charge</div>
<div className={styles.box2item2}>{editFlag?(<Input placeholder="Please enter a name" style={{width:200}}/>):("123")}</div>
<div className={styles.box2item2}>{editFlag ? (<Input placeholder="Please enter a name" style={{ width: 200 }} />) : ("123")}</div>
</div>
<div className={styles.box3}>
<div className={styles.box3item1}>Contact Details</div>
<div className={styles.box3item2}>{editFlag?(<Input placeholder="Telephone" style={{width:200}}/>):("123")}</div>
<div className={styles.box3item3}>{editFlag?(<Input placeholder="E-mail" style={{width:200}}/>):("123")}</div>
<div className={styles.box3item2}>{editFlag ? (<Input placeholder="Telephone" style={{ width: 200 }} />) : ("123")}</div>
<div className={styles.box3item3}>{editFlag ? (<Input placeholder="E-mail" style={{ width: 200 }} />) : ("123")}</div>
</div>
{
editFlag ? (
<div>
<Line/>
<Button type="primary" size="large">提交</Button>
<Line />
<Button type="primary" size="large">submit</Button>
</div>
):(<div/>)
) : (<div />)
}
</div>
......
import React, { useState, useEffect } from 'react';
import styles from './ChargeDetail.less';
import { Input ,Menu,Table,Space,Pagination,Tooltip } from 'antd';
import { Input, Menu, Table, Space, Pagination, Tooltip } from 'antd';
import { Link, useIntl, connect, Dispatch } from 'umi';
import PDF from 'react-pdf-js';//
import PDF from 'react-pdf-js'; //
import { render } from 'react-dom';
import { Document } from 'react-pdf/dist/entry.webpack';
......@@ -16,75 +15,82 @@ import { timestampToTime2 } from '../../utils/time';
import TitleBack from '../../components/TitleBack/TitleBack';
const ChargeDetail = (props: any) => {
const { CurData } = props;
const { formatMessage } = useIntl();
const [scale, setState] = useState(1.3)
const [pages,setPages] = useState(1)
const [curpage,setCurpage]=useState(1)
const [scale, setState] = useState(1.3);
const [pages, setPages] = useState(1);
const [curpage, setCurpage] = useState(1);
const pdfpages = (pages: any) => {
setPages(pages)
setPages(pages);
//alert(pages)
}
};
const lookup = () => {
if (scale == 1.3) {
setState(2)
setState(2);
} else {
setState(1.3)
setState(1.3);
}
}
};
const pageChange = (curpage: any) => {
setCurpage(curpage)
}
setCurpage(curpage);
};
const goToReturn = () => {
history.back()
}
history.back();
};
console.log(CurData);
return (
<div className={styles.base}>
{/* 组件 */}
<TitleBack title="Payment Settings" sublist={['Upload Time '+timestampToTime2(CurData.updateTime.time)]}/>
<div className={styles.box2}>
<div className={styles.item21}>Project</div>
<div className={styles.item22}>{CurData.billName}</div>
<div className={styles.item23}>{CurData.communityName}</div>
<div className={styles.item234}>#</div>
<div className={styles.item24}>{CurData.floorNumber}</div>
<div className={styles.item245}>——</div>
<div className={styles.item25}>{CurData.roomNumber}</div>
<div className={styles.item26}>{CurData.tosOwnerName}</div>
</div>
<>{stringSplit(CurData.billFileUrl, "m/cash")}</>
<div className={styles.box4}>
<Pagination simple defaultCurrent={curpage} total={pages*10} onChange={pageChange} />
</div>
{CurData ? (
<>
<TitleBack
title="Payment Settings"
sublist={['Upload Time ' + timestampToTime2(CurData.updateTime.time)]}
/>
<><Tooltip title={scale == 1.3 ?"点击放大查看"+CurData.billFileUrl:"还原视图"}>
<div className={scale == 1.3 ?styles.box3out:null}>
< div className={ scale == 1.3 ?styles.box3:styles.box3of} onClick={ lookup } >
<PDF key="pdfjs" file={ stringSplit(CurData.billFileUrl,"m/cash")} workerSrc = "//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.2.228/pdf.worker.js" scale={scale} page={curpage} onDocumentComplete={pdfpages} />
</div>
</div>
</Tooltip></>
<div className={styles.box2}>
<div className={styles.item21}>Project (community)</div>
<div className={styles.item22}>{CurData.billName}</div>
<div className={styles.item23}>{CurData.communityName}</div>
<div className={styles.item24}>{CurData.floorNumber}</div>
<div className={styles.item234}>#</div>
<div className={styles.item25}>{CurData.roomNumber}</div>
<div className={styles.item245}>——</div>
<div className={styles.item26}>{CurData.tosOwnerName}</div>
</div>
<>{stringSplit(CurData.billFileUrl, 'm/cash')}</>
<div className={styles.box4}>
<Pagination simple defaultCurrent={curpage} total={pages * 10} onChange={pageChange} />
</div>
<>
<Tooltip title={scale == 1.3 ? '点击放大查看' + CurData.billFileUrl : '还原视图'}>
<div className={scale == 1.3 ? styles.box3out : null}>
<div className={scale == 1.3 ? styles.box3 : styles.box3of} onClick={lookup}>
<PDF
key="pdfjs"
file={stringSplit(CurData.billFileUrl, 'm/cash')}
workerSrc="//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.2.228/pdf.worker.js"
scale={scale}
page={curpage}
onDocumentComplete={pdfpages}
/>
</div>
</div>
</Tooltip>
</>
</>
) : null}
</div>
);
};
function mapStateToProps(state:any) {
const { CurData } = state.PropertyManagement;
function mapStateToProps(state: any) {
const { CurData } = state.PropertyManagement;
return {
CurData
CurData,
};
}
export default connect(mapStateToProps)(ChargeDetail);
import React, { useState, useEffect } from 'react';
import styles from './index.less';
import { Input ,Menu,Table,Space} from 'antd';
import { Input, Menu, Table, Space } from 'antd';
import { Link, useIntl, connect, Dispatch, history } from 'umi';
......@@ -10,15 +10,15 @@ import { timestampToTime } from '../../utils/time';
import { values } from 'lodash';
import TitleSearch from '../../components/TitleSearch/TitleSearch';
const ChargeManager = (props:any) => {
const ChargeManager = (props: any) => {
const { formatMessage } = useIntl();
const { dispatch, location, Data } = props;
const get = (values: any) => { dispatch({ type: 'PropertyManagement/get', playload: values }) };
const getById = (values:any) => {dispatch({type: 'PropertyManagement/getById',playload:values})};
const get = (values: any) => { dispatch({ type: 'PropertyManagement/get', playload: values }) };
const getById = (values: any) => { dispatch({ type: 'PropertyManagement/getById', playload: values }) };
useEffect(() => {
get(null)
}, []);
}, []);
const nameofowner = formatMessage({ id: 'R.charge.input.nameofowner' })
......@@ -32,24 +32,24 @@ const ChargeManager = (props:any) => {
const search = formatMessage({ id: 'R.charge.search' })
const addaccount = formatMessage({ id: 'R.charge.addaccount' })
const paymentsetting = formatMessage({ id: 'R.charge.paymentsetting' })
const menuListNormal = ["A",'Accounting company']
const menuListNormal = ["A", 'Accounting company']
const [display, setDisplay] = useState("A");//小组件:线框
const pagination={defaultCurrent:1,total: 16}
const goToDetail = (values:any) => {
const pagination = { defaultCurrent: 1, total: 16 }
const goToDetail = (values: any) => {
getById(values)
history.push('/PropertyManagementDetail?')
history.push('/PropertyManagementDetail')
}
const goToAddAccout = () => {
history.push(location.pathname+'/AccoutingDetail')
history.push(location.pathname + '/AccoutingDetail')
}
const columns = [
{ title: username,dataIndex: 'tosOwnerName'},
{ title: project,dataIndex: 'communityName'},
{ title: unit,dataIndex: 'buildingNumber'},
{ title: status,dataIndex: 'enable'},
{ title: username, dataIndex: 'tosOwnerName' },
{ title: project, dataIndex: 'communityName' },
{ title: unit, dataIndex: 'buildingNumber' },
{ title: status, dataIndex: 'enable' },
{
title: submissionTime,
render: (text: any, record: any) => (
......@@ -58,43 +58,44 @@ const ChargeManager = (props:any) => {
</Space>
),
},
{ title: actions,
{
title: actions,
render: (text: any, record: any) => (
<Space size="middle">
<a onClick={goToDetail.bind(this,record)}>Detail</a>
<a onClick={goToDetail.bind(this, record)}>Detail</a>
</Space>
),
},
];
const TitleSearchContent = (comment: any)=>{
const TitleSearchContent = (comment: any) => {
console.log(comment)
}
return (
<div className={styles.base}>
<TitleSearch listkey={['tosOwnerName', 'communityName']} list={['tosOwnerName', 'communityName']} onSubmit={TitleSearchContent}/>
<div className={styles.base}>
{/* 内容组件 */}
<TitleSearch listkey={['tosOwnerName', 'communityName']} list={['tosOwnerName', 'communityName']} onSubmit={TitleSearchContent} />
{/* 内容组件 */}
<div className={styles.box2}>
{
menuListNormal.map((item, index) => {
return (<button key={"bt"+ index } className={display==item?styles.buttonChoose:styles.buttonWait} onClick={()=>{setDisplay(item)}}>{item}</button>)
menuListNormal.map((item, index) => {
return (<button key={"bt" + index} className={display == item ? styles.buttonChoose : styles.buttonWait} onClick={() => { setDisplay(item) }}>{item}</button>)
})
}
<button className={styles.buttonAdd2} onClick={goToAddAccout}>+ {addaccount} </button>
<button className={styles.buttonAdd} >{paymentsetting}</button>
</div>
</div>
{/* 列表组件 */}
<Table style={{ marginTop: 16 }} rowKey={"id"} dataSource={Data} columns={columns} pagination={pagination} />
</div>
);
};
function mapStateToProps(state:any) {
const { Data } = state.PropertyManagement;
function mapStateToProps(state: any) {
const { Data } = state.PropertyManagement;
return {
Data
};
......
import React, { useState, useEffect,useRef} from 'react';
import { Input ,Tabs,Table,Result, Button} from 'antd';
import React, { useState, useEffect, useRef } from 'react';
import { Input, Tabs, Table, Result, Button } from 'antd';
const { TabPane } = Tabs;
import {connect,history} from 'umi';
import { connect, history } from 'umi';
import { getCookie } from '@/utils/method';
import { RA } from '@/utils/method';
const module="User"
const ResultPageFailed = (props:any) => {
const module = "User"
const ResultPageFailed = (props: any) => {
const { dispatch, Data } = props;
const formRef = useRef(null)
const [resultTime, setResultTime] = useState(3);
const backPage = () => {
history.go(-1)
}
return (
<div style={{ width: "100%", minWidth: 1020, padding: 34, backgroundColor: "#ffffff" }}>
<Result
status="error"
title="Error submit the file!"
subTitle={<p>server has been handled it ,please try again or back.</p>}
extra={[
<Button type="primary" key="ok" ><a href="http://47.74.233.180:8651/tos/excel/down?operator_id=123456" >Download</a></Button>, <Button key="back" onClick={backPage}>Back</Button>
]}
/>
<Result
status="error"
title="Error submit the file!"
subTitle={<p>server has been handled it ,please try again or back.</p>}
extra={[
<Button type="primary" key="ok" ><a href={"http://47.74.233.180:8651/tos/excel/down?operator_id=" + getCookie("id")}>Download</a></Button>, <Button key="back" onClick={backPage}>Back</Button>
]}
/>
</div>
);
};
function map(state:any) {
const { Data} = state[module]
return { Data}
function map(state: any) {
const { Data } = state[module]
return { Data }
}
export default connect(map)(ResultPageFailed);
import React, { useState, useEffect } from 'react';
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 { Link, useIntl, connect, Dispatch, history } from 'umi';
......@@ -10,17 +10,19 @@ import TitleSearch from '../../../components/TitleSearch/TitleSearch';
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';
const module = "User"
const module2 = "History"
const module3="PageData"
const Users = (props:any) => {
const module3 = "PageData"
const Users = (props: any) => {
const { formatMessage } = useIntl();
const { dispatch, location,Data,CommunityList,pageData,history_url} = props;
const SA = (values: any) => { dispatch({ type: 'User/SA', playload: values}) };
const { dispatch, location, Data, CommunityList, pageData, history_url } = props;
const SA = (values: any) => { dispatch({ type: 'User/SA', playload: values }) };
const nameofowner = formatMessage({ id: 'R.charge.input.nameofowner' })
const inputProject = formatMessage({ id: 'R.charge.input.project' })
......@@ -35,53 +37,61 @@ const Users = (props:any) => {
const paymentsetting = formatMessage({ id: 'R.charge.paymentsetting' })
// 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 [loading, setLoading] = useState(false)
const [fileUploading, setFileUploading] = useState(false)
const [pageNum, setPageNum] = useState(1)
const [readyData,setReadyData]=useState(null)
const [compent,setCompent]=useState({loading:false,fileUploading:false})
const [TestData, setTestData] = useState(null)//{ rows: [], total:0,defaultCurrent:1 }
const [compent, setCompent] = useState({ loading: false, fileUploading: false })
const [pageStart, setPageStart] = useState(false)
const columns = [
{ title: username, dataIndex: 'owerName', },
{ title: project, dataIndex: 'communityName', },
// { title: project, dataIndex: 'unit', },
// { title: unit, dataIndex: 'living', },
{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: submissionTime,render:(text: any, record: any) => (<div>{timestampToTime(record.createTime.time)}</div>)},
{title: actions,
render: (text: any, record: any) => (
<Space size="middle">
<a onClick={goToEdit.bind(this, record)} disabled={record.enable==2?true:false}>Edit</a>
<a onClick={goToDetail.bind(this,record)}>Detail</a>
</Space>
),
},
];
const [TestData, setTestData] = useState({})
// 存储当前页码
const [pageNum, setPageNum] = useState(1)
// 存储小区筛选条件
const [readyData, setReadyData] = useState(null as any)
// 表格模块
const columns = [
{ title: username, dataIndex: 'owerName', },
{ title: project, dataIndex: 'communityName', },
// { title: project, dataIndex: 'unit', },
// { title: unit, dataIndex: 'living', },
{ 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: submissionTime, render: (text: any, record: any) => (<div>{timestampToTime(record.createTime.time)}</div>) },
{
title: actions,
render: (text: any, record: any) => (
<Space size="middle">
<a onClick={goToEdit.bind(this, record)} disabled={record.enable == 2 ? true : false}>Edit</a>
<a onClick={goToDetail.bind(this, record)}>Detail</a>
</Space>
),
},
];
// 上传的模块
const propsUpload = {
name: 'file',
action: ()=>{return "http://47.74.233.180:8651/tos/excel/upload?userId=" + getCookie("id")},
onChange(info) {
action: () => { return "http://47.74.233.180:8651/tos/excel/upload?userId=" + getCookie("id") },
beforeUpload: (file: any) => {
if (file.type !== "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") {
message.error(`${file.name} file format is incorrect!`);
}
return file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
},
onChange(info: any) {
if (info.file.status == 'uploading') {
setFileUploading(true)
}
if (info.file.status === 'done') {
if (info.file.response.error_code == "0000") {
history.push(location.pathname+"/Result")
history.push(location.pathname + "/Result")
} else {
history.push(location.pathname+"/ResultFailed")
message.error(`${info.file.name} file upload failed.`+'failed count is '+info.file.response.data.count);
history.push(location.pathname + "/ResultFailed")
message.error(`${info.file.name} file upload failed.` + 'failed count is ' + info.file.response.data.count);
setFileUploading(false)
}
} else if (info.file.status === 'error') {
......@@ -89,147 +99,133 @@ const Users = (props:any) => {
setFileUploading(false)
}
},
showUploadList:false,
showUploadList: false,
}
// 判断数据是否回来
useEffect(() => {
if (Data != null) {
setLoading(false)
console.log("核查的地方")
console.log(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(() => {
//分页设置
if (location.query.current!=null) {
setPageNum(parseInt(location.query.current))
} else {
setPageNum(1)
if (location.query.owerName) {
setTestData({
OwnerName: location.query.owerName
})
}
setPageNum(parseInt(location.query.pageNum) || 1)
//前置数据
console.log("前置数据");
var tmp = filterObjbyTg(location.query, ["ownerName"])
setReadyData(tmp)
setLoading(true)
//获取数据
setLoading(true)
RA(12, {
ownerName:location.query.ownerName != undefined ? (location.query.ownerName) : null,
communityArray: CommunityList
owerName: location.query.owerName !== undefined ? (location.query.owerName) : null,
communityArray: (readyData === null || readyData.length === 0) ? CommunityList : readyData,
pageNum: location.query.pageNum || 1
}, module, dispatch);
},[location])
}, [location])
const goToDetail = (values:any,e:any) => {
const goToDetail = (values: any, e: any) => {
SA(values)
PAGE(curString,module3,dispatch)//保存页面参数
history.push(location.pathname+'/Detail')
PAGE(readyData, module3, dispatch)//保存页面参数
history.push(location.pathname + '/Detail')
}
const goToEdit = (values: any, e: any) => {
SA(values)
PAGE(curString, module3, dispatch)
URL({ pathname: location.pathname+'/Edit', status: 1 }, module2, dispatch)
history.push(location.pathname+'/Edit')
PAGE(readyData, module3, dispatch)
URL({ pathname: location.pathname + '/Edit', status: 1 }, module2, dispatch)
history.push(location.pathname + '/Edit')
}
const goToAdd = () => {
URL({ pathname: location.pathname+'/Add', status: 1 }, module2, dispatch)
history.push(location.pathname+'/Add')
URL({ pathname: location.pathname + '/Add', status: 1 }, module2, dispatch)
history.push(location.pathname + '/Add')
}
const CallBackTitleSearch = (comment: any)=>{
console.log(comment)
//页面搜索
comment.current = 1
history.push(location.pathname+urlEncode(filterObj({ ownerName: comment.OwnerName})))
// LIFE用户管理页面的搜索按钮
const CallBackTitleSearch = (comment: any) => {
// 将筛选条件存储起来
setReadyData(comment.serviceCommunityList)
setPageNum(1)
/*页面跳转*/
if (comment.OwnerName) {
history.push(location.pathname + urlEncode(filterObj({
owerName: comment.OwnerName,
pageNum: 1,
})))
} else {
history.push(location.pathname + urlEncode(filterObj({
pageNum: 1,
})))
}
}
const pageChange = (values: any) => {
// var tmp = curString; tmp.defaultCurrent = values.current; setCurString(tmp)
// 将当前页码存储起来
setPageNum(values.current)
/*页面跳转*/
var tmp = filterObjbyTg(location.query, [])
tmp["current"]=values.current
tmp["pageNum"] = values.current
location.query.owerName ? tmp["owerName"] = location.query.owerName : null
history.push(location.pathname + urlEncode(tmp))
}
return (
<div className={styles.base}>
{/* 头部组件 */}
<TitleSearch listkey={["OwnerName"]} list={["Owner Name"]}
community={"serviceCommunityList"} onSubmit={CallBackTitleSearch} />
{/* 内容组件 */}
<div className={styles.box2}>
<button className={styles.buttonAdd2} onClick={goToAdd}>Create New Owner</button>
<div className={styles.buttonAdd} >
<Upload {...propsUpload}>
<Button icon={compent.fileUploading?null:<UploadOutlined />}>{compent.fileUploading?<><Spin indicator={<LoadingOutlined style={{ fontSize: 16 }} spin />} /> Uploading</>:"Batch Upload"}</Button>
</Upload>
</div>
<TitleSearch
listkey={["OwnerName"]}
list={["Owner Name"]}
community={"serviceCommunityList"}
onSubmit={CallBackTitleSearch}
defaultValue={TestData}
checklist={pageData}
/>
{/* 内容组件 */}
<div className={styles.box2}>
<button className={styles.buttonAdd2} onClick={goToAdd}>Create New Owner</button>
<div className={styles.buttonAdd} >
<Upload {...propsUpload}>
<Button icon={compent.fileUploading ? null : <UploadOutlined />}>
{compent.fileUploading ?
<>
<Spin indicator={<LoadingOutlined style={{ fontSize: 16 }} spin />} />
Uploading
</>
: "Batch Upload"}
</Button>
</Upload>
</div>
{/* 列表组件 */}
<Table
rowKey={"id"}
loading={loading}
style={{ marginTop: 16 }}
dataSource={Data!=null?Data.data.rows:[]}
columns={columns}
pagination={Data!=null? { current: pageNum, total: Data.data.rows.length } : {}}
onChange={pageChange} />
</div>
{/* 列表组件 */}
<Table
rowKey={"id"}
loading={loading}
style={{ marginTop: 16 }}
dataSource={Data != null ? Data.data.list : []}
columns={columns}
pagination={Data != null ? { current: pageNum, total: Data.data.page.totalRow, showSizeChanger: false, pageSize: Data.data.page.curPageSize } : {}}
onChange={pageChange} />
</div>
);
};
function mapStateToProps(state:any) {
const { sourceData, DataSave, Data, } = state.User;
function mapStateToProps(state: any) {
const { sourceData, DataSave, Data, } = state.User;
const { history_url } = state.History;
const { pageData} = state.PageData;
const { pageData } = state.PageData;
const { token } = state.login;
const { CommunityList } = state.Init;
return {
......@@ -242,5 +238,8 @@ function mapStateToProps(state:any) {
CommunityList,
};
}
export default connect(mapStateToProps)(Users);
......@@ -2,117 +2,117 @@
//基石
.base {
width: 100%;
background-color: #ffffff;
padding: 34px;
min-width: 1020px;
width: 100%;
background-color: #ffffff;
padding: 34px;
min-width: 1020px;
}
//头部组件
.box{
width: 100%;
height: 64px;
position: relative;
}
.item1{
position: absolute;
width: 400px;
text-indent: 15px;
border-left: 5px solid rgba(24,144,255,1);
font-family:'Source Han Sans CN';
font-size: 18px;
font-weight: 600;
color: #000000;
.box {
width: 100%;
height: 64px;
position: relative;
}
.item1 {
position: absolute;
width: 400px;
text-indent: 15px;
border-left: 5px solid rgba(24, 144, 255, 1);
font-family: 'Source Han Sans CN';
font-size: 18px;
font-weight: 600;
color: #000000;
}
.item3 {
width: 80px;
height: 32px;
position: absolute;
right: 0;
}
.item3{
width:80px;
height: 32px;
position: absolute;
right: 0;
outline: none;
background:none;
cursor: pointer;
outline: none;
background: none;
cursor: pointer;
border:1px solid rgba(217,217,217,1);
border-radius:2px;
border: 1px solid rgba(217, 217, 217, 1);
border-radius: 2px;
}
.box1{
width: 100%;
height: 34px;
line-height: 34px;
position: relative;
margin-bottom: 28px;
.box1 {
width: 100%;
height: 34px;
line-height: 34px;
position: relative;
margin-bottom: 28px;
}
.box1item1{
position: absolute;
.box1item1 {
position: absolute;
}
.box1item2{
position: absolute;
left: 146px;
.box1item2 {
position: absolute;
left: 146px;
}
.box4{
width: 100%;
height: 34px;
line-height: 34px;
position: relative;
margin-bottom: 28px;
.box4 {
width: 100%;
height: 34px;
line-height: 34px;
position: relative;
margin-bottom: 28px;
}
.box4item0{
position: absolute;
.box4item0 {
position: absolute;
}
.box4item1{
position: absolute;
left: 146px;
.box4item1 {
position: absolute;
left: 146px;
}
.box4item2{
position: absolute;
left: 346px;
.box4item2 {
position: absolute;
left: 346px;
}
.box2{
width: 100%;
height: 34px;
line-height: 34px;
position: relative;
margin-bottom: 28px;
.box2 {
width: 100%;
height: 34px;
line-height: 34px;
position: relative;
margin-bottom: 28px;
}
.box2item1{
position: absolute;
.box2item1 {
position: absolute;
}
.box2item2{
position: absolute;
left: 146px;
.box2item2 {
position: absolute;
left: 146px;
}
.box2item3{
position: absolute;
left: 362px;
.box2item3 {
position: absolute;
left: 362px;
}
.box2item4{
position: absolute;
left: 461px;
.box2item4 {
position: absolute;
left: 461px;
}
.box2item5{
position: absolute;
left: 475px;
.box2item5 {
position: absolute;
left: 475px;
}
.box2item6{
position: absolute;
left: 561px;
.box2item6 {
position: absolute;
left: 561px;
}
.box2item7{
position: absolute;
left: 583px;
.box2item7 {
position: absolute;
left: 583px;
}
.box3{
width: 100%;
height: 34px;
position: relative;
}
.box3item1{
padding-left: 146px;
}
\ No newline at end of file
.box3 {
width: 100%;
height: 34px;
position: relative;
}
.box3item1 {
padding-left: 146px;
}
import React, { useState, useEffect,useRef } from 'react';
import React, { useState, useEffect, useRef } from 'react';
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';
......@@ -10,108 +10,109 @@ import SearchOptionsCommnity from '../../../components/SearchOptions/SearchOptio
import { checkParam, RA } from '../../../utils/method'
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 formRef = useRef(null);
const { dispatch, communityInfo } = props;
const [postman, setPostman] = useState({ extend: null })
const formRef = useRef(null as any);
const [loading, setLoading] = useState(false)
const onFinish = (values: any) => {
const [loading,setLoading]=useState(false)
const onFinish=(values:any) => {
if (postman.extend != null) {
values.communityName = postman.extend
} else {
values.communityName = null
}
var tmp = Object.keys(values);
console.log("添加业主提交的参数:" + tmp.length)
console.log(values)
// var tmp = Object.keys(values);
if (checkParam(values)) {
values.owerPhone =null
values.owerEmail=null
values.owerPhone = null
values.owerEmail = null
RA(14, values, module, dispatch)
setLoading(true)
} else {
setLoading(false)
message.error("Error,Please finish it,not empty!",3)
message.error("Error,Please finish it,not empty!", 3)
}
}
const extendName = (values: any) => {
var tmp = postman
tmp.extend = values
RA(32, {communityName: values }, module, dispatch);
RA(32, { communityName: values }, module, dispatch);
setPostman(tmp)
}
useEffect(()=>{
useEffect(() => {
if (communityInfo != null) {
console.log(communityInfo)
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 (/^[a-zA-Z0-9]+$/g.test(value)) {
callback();
} else {
callback(new Error('Only numbers and letters can be entered!'));
}
callback(new Error('Only numbers and letters can be entered!'));
}
}
callback();
};
return (
<div className={styles.base}>
{/* 头部组件 */}
<TitleBack title={"Create New Owner"} />
{/* 头部组件 */}
<TitleBack title={"Create New Owner"} />
<Spin spinning={loading}>
<Form ref={formRef} name="basic" onFinish={onFinish} validateMessages={validateMessages}>
<div className={styles.box1}>
<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>
{/* <div className={styles.box4}>
<Form ref={formRef} name="basic" onFinish={onFinish} validateMessages={validateMessages}>
<div className={styles.box1}>
<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>
{/* <div className={styles.box4}>
<div className={styles.box4item0}>Contact Details</div>
<div className={styles.box4item1}><Form.Item name="owerPhone" ><Input placeholder="Phone Number" /></Form.Item></div>
<div className={styles.box4item2}><Form.Item name="owerEmail" ><Input placeholder="Email" /></Form.Item></div>
</div> */}
<div className={styles.box2}>
<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.box2item4}>#</div>
<div className={styles.box2item5}><Form.Item name="floorNumber" ><Input placeholder="Floor" style={{width:80}} /></Form.Item></div>
<div className={styles.box2item6}>——</div>
<div className={styles.box2item7}><Form.Item name="roomNumber"><Input placeholder="Room" style={{width:112}}/></Form.Item></div>
</div>
<div className={styles.box3}>
<div className={styles.box3item1}>
<Form.Item name="addressAndpostalCode"><Input style={{width:680}} placeholder="Display the address and postcode automatically according to the"/></Form.Item>
</div>
</div>
<Line />
<Form.Item ><Button type="primary" htmlType="submit">Submit</Button></Form.Item>
</Form>
<div className={styles.box2}>
<div className={styles.box2item1}>Contact Details</div>
<div className={styles.box2item2}><SearchOptionsCommnity alone={true} onSubmit={extendName} /></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.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.box2item7}><Form.Item name="roomNumber" rules={[{ validator: checkData }]}><Input placeholder="Room" style={{ width: 112 }} /></Form.Item></div>
</div>
<div className={styles.box3}>
<div className={styles.box3item1}>
<Form.Item name="addressAndpostalCode"><Input style={{ width: 680 }} disabled placeholder="Display the address and postcode automatically according to the" /></Form.Item>
</div>
</div>
<Line />
<Form.Item ><Button type="primary" htmlType="submit">Submit</Button></Form.Item>
</Form>
</Spin>
</div>
);
};
function mapStateToProps(state:any) {
const { DataSave,communityInfo } = state.User;
function mapStateToProps(state: any) {
const { DataSave, communityInfo } = state.User;
return {
DataSave,
DataSave,
communityInfo,
};
}
......
.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 { TabPane } = Tabs;
import { ExclamationCircleOutlined } from '@ant-design/icons';
......@@ -10,116 +23,131 @@ import styles from './UsersAdd.less';
import Line from '../../../components/Line/Line';
import TitleBack from '../../../components/TitleBack/TitleBack';
import SearchOptionsCommnity from '../../../components/SearchOptions/SearchOptionsCommnity';
import { checkParam } from '../../../utils/method'
import { checkParam } from '../../../utils/method';
import TableShow from '@/components/TableShow/TableShow';
import { values, fromPairs } from 'lodash';
import { timestampToTime } from '@/utils/time';
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 ResultClear = () => {
dispatch({ type: 'User/ResultClear' });
};
const MemberResultClear = () => {
dispatch({ type: 'User/MemberResultClear' });
};
const RA = (index: any, values: any) => { dispatch({ 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 [memberData, setMemberData] = useState(null);
const [editFlag, setEditFlag] = useState(false)
const [editFlag, setEditFlag] = useState(false);
// const user_status = [[1, "家属"], [2, "租户"]]
const user_status = [[1, "Family Member"], [2, "Tenant"]]
const user_type_status = ["Unregistered", "registered", "Deregistered"]
const user_status = [
[1, 'Family Member'],
[2, 'Tenant'],
];
const user_type_status = ['Unregistered', 'registered', 'Deregistered'];
const [DataSaveLoading, setDataSaveLoading] = useState(false);
const [visible, setVisible] = useState(false)
const [visible, setVisible] = useState(false);
const formRef = useRef(null);
const onFinish=(values:any) => {
const onFinish = (values: any) => {
if (DataSave != null) {
values.id = DataSave.id
values.enable=DataSave.enable
values.id = DataSave.id;
values.enable = DataSave.enable;
} else {
values.id=null
values.id = null;
}
var tmp = Object.keys(values);
console.log("添加业主提交的参数:" + tmp.length)
console.log(values)
var tmp = Object.keys(values);
console.log('添加业主提交的参数:' + tmp.length);
console.log(values);
if (checkParam(values)) {
RA(18, values)
setVisible(true);
RA(18, values);
} else {
message.error("Error,Please finish it,not empty!",3)
message.error('Error,Please finish it,not empty!', 3);
}
}
};
useEffect(() => {
if (Result != null) {
console.log(Result)
if (Result.error_code == "0001") {
message.error(Result.error_msg, 3)
ResultClear()
console.log(Result);
if (Result.error_code == '0001') {
message.error(Result.error_msg, 3);
ResultClear();
}
}
}, [Result])
useEffect(()=>{
}, [Result]);
useEffect(() => {
if (returnValue != null) {
message.success("Delete Successfully!")
RA(13, {
id:DataSave.id,
owerName: DataSave.owerName,
enable:DataSave.enable,
})
}
}, [returnValue])
message.success('Delete Successfully!');
RA(13, {
id: DataSave.id,
owerName: DataSave.owerName,
enable: DataSave.enable,
});
}
}, [returnValue]);
useEffect(() => {
if (DataSave != null) {
console.log("给予页面数据")
console.log(DataSave)
console.log('给予页面数据');
console.log(DataSave);
var tmp = {
owerName: DataSave.owerName,
owerPhone: DataSave.owerPhone,
owerEmail:DataSave.owerEmail
}
formRef.current.setFieldsValue(tmp)
owerEmail: DataSave.owerEmail,
};
formRef.current.setFieldsValue(tmp);
RA(13, {
id:DataSave.id,
id: DataSave.id,
owerName: DataSave.owerName,
enable:DataSave.enable,
})
enable: DataSave.enable,
});
} else {
history.go(-1)
history.go(-1);
}
}, [DataSave])
useEffect(() => {
}, [DataSave]);
if (DataSaveDetail!=null) {
console.log("页面数据副歌")
console.log(DataSaveDetail)
setDataSaveLoading(false)
}
useEffect(() => {
if (DataSaveDetail != null) {
console.log('页面数据副歌');
console.log(DataSaveDetail);
setDataSaveLoading(false);
}
}, [DataSaveDetail]);
}, [DataSaveDetail])
useEffect(() => {
if ((location.pathname).indexOf("Edit") > -1) {
setEditFlag(true)
if (location.pathname.indexOf('Edit') > -1) {
setEditFlag(true);
}
setDataSaveLoading(true)
}, [])
setDataSaveLoading(true);
}, []);
const tableShowCallback = (values: any) => {
console.log("成员信息")
console.log(values)
setMemberData(values)
setMemberDetail(true)
}
console.log('成员信息');
console.log(values);
setMemberData(values);
setMemberDetail(true);
};
const deleteUnit = (values:any) => {
const deleteUnit = (values: any) => {
// console.log(values)
confirm({
......@@ -129,115 +157,173 @@ const UsersDetail = (props:any) => {
okText: 'Confirm',
okType: 'danger',
cancelText: 'Cancel',
onCancel() {},
onCancel() { },
onOk() {
if (DataSave != null) {
//console.log(DataSave)
var tmp = {
owerName: DataSave.owerName,
communityName: DataSave.communityName,
unit: values
}
RA(16, tmp);
unit: values,
};
RA(16, tmp);
}
},
});
}
};
const DeleteMember = (values: any, e: any) => {
console.log(values)
RA(39, { id: values.id, ownerId: values.owner_id })
}
console.log(values);
RA(39, { id: values.id, ownerId: values.owner_id });
};
const titleBackCallBack = () => {
setMemberDetail(false)
}
useEffect(()=>{
setMemberDetail(false);
};
useEffect(() => {
if (memberResult != null) {
setMemberDetail(false)
setMemberDetail(false);
RA(13, {
id:DataSave.id,
id: DataSave.id,
owerName: DataSave.owerName,
enable:DataSave.enable,
})
MemberResultClear()
enable: DataSave.enable,
});
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}>
{
memberDetail == false ? <>
{
DataSave != null ? <>
<TitleBack 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.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>
{
DataSave.enable == 1 ?
<Spin spinning={visible} tip="Loading Submit">
{memberDetail == false ? (
<>
{DataSave != null ? (
<>
<TitleBack
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.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>
{DataSave.enable == 1 ? (
<>
<div className={styles.box4}>
<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.box4item2}><Form.Item name="owerEmail" rules={[{required:true,type:"email"}]} ><Input disabled={!editFlag} placeholder="Email" /></Form.Item></div>
<div className={styles.box4item1}>
<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>
</>
: null
}
) : null}
<Line />
<Spin spinning={DataSaveLoading} tip="Loading Detial">
{
DataSaveDetail != null ? <TableShow data={DataSaveDetail} onSubmit={tableShowCallback} onChange={deleteUnit} deleteDisable={editFlag}/> : null
}
{
editFlag ? <>
<Line />
<Form.Item ><Button type="primary" htmlType="submit">Submit</Button></Form.Item>
</>:null
}
<Line />
<Spin spinning={DataSaveLoading} tip="Loading Detial">
{DataSaveDetail != null ? (
<TableShow
data={DataSaveDetail}
onSubmit={tableShowCallback}
onChange={deleteUnit}
deleteDisable={editFlag}
/>
) : null}
{editFlag ? (
<>
<Line />
<Form.Item>
<Button type="primary" htmlType="submit">
Submit
</Button>
</Form.Item>
</>
) : null}
</Spin>
</Form>
</Form>
</>
) : null}
</>
) : (
<>
<div>
<TitleBack
title={'Member Detail'}
url="none"
titleBack={titleBackCallBack}
></TitleBack>
<Row>
<Col span={4}>Customer Type</Col>
<Col span={4}>
{memberData.owner_relationship != null
? user_status[memberData.owner_relationship - 1][1]
: null}
</Col>
</Row>
<Row gutter={16}>
<Col span={4}>User Name</Col>
<Col span={4}>{memberData.ower_name}</Col>
</Row>
<Row gutter={16}>
<Col span={4}>Contact Detail</Col>
<Col span={4}>{memberData.ower_phone}</Col>
<Col span={4}>{memberData.ower_email}</Col>
</Row>
<Line></Line>
</>:null
}
<Button danger onClick={DeleteMember.bind(this, memberData)}>
Delete
</Button>
</> :
<>
<div>
<TitleBack title={"Member Detail"} url="none" titleBack={titleBackCallBack}></TitleBack>
<Row>
<Col span={4}>Customer Type</Col>
<Col span={4}>{memberData.owner_relationship!=null?user_status[(memberData.owner_relationship)-1][1]:null}</Col>
</Row>
<Row gutter={16}>
<Col span={4}>User Name</Col>
<Col span={4}>{memberData.ower_name}</Col>
</Row>
<Row gutter={16}>
<Col span={4}>Contact Detail</Col>
<Col span={4}>{memberData.ower_phone}</Col>
<Col span={4}>{memberData.ower_email}</Col>
</Row>
<Line></Line>
<Button type="danger" onClick={DeleteMember.bind(this,memberData)}>Delete</Button>
</div>
</>
}
</div>
</>
)}
</Spin>
</div>
);
};
function mapStateToProps(state:any) {
const { DataSave,DataSaveDetail,Result,returnValue,memberResult} = state.User;
function mapStateToProps(state: any) {
const { DataSave, DataSaveDetail, Result, returnValue, memberResult } = state.User;
return {
DataSave,
DataSaveDetail,
......@@ -275,4 +361,4 @@ export default connect(mapStateToProps)(UsersDetail);
// {
// "id":"c06286cfe7b843cb96fdfcb987231123",
// "ownerId":"6b359755a36b49c28241a4620fa6539b"
// }
\ No newline at end of file
// }
import React, { useState, useEffect } from 'react';
import styles from './Detail.less';
import { Input ,Button,Table,Space,Pagination,Tooltip, Checkbox } from 'antd';
import { Input, Button, Table, Space, Pagination, Tooltip, Checkbox } from 'antd';
import { Link, useIntl, connect, Dispatch,history } from 'umi';
import { Link, useIntl, connect, Dispatch, history } from 'umi';
import ShowOptions from '../../../components/ShowOptions/index';
import TitleBack from '../../../components/TitleBack/TitleBack';
const Detail = (props:any) => {
const Detail = (props: any) => {
const { dispatch, Data, CurDataFollow, location, SaveChooseData } = props;
const { dispatch, Data,CurDataFollow,location,SaveChooseData } = props;
const TosSecurityGuarderGet = (values: any) => { dispatch({ type: 'ServiceProvider/TosSecurityGuarderGet', playload: values }) };
const GuarderById = (values: any) => { dispatch({ type: 'ServiceProvider/GuarderById', playload: values }) };
useEffect(() => {
TosSecurityGuarderGet({companyName:SaveChooseData.providerName})
}, []);
useEffect(() => {
TosSecurityGuarderGet({ companyName: SaveChooseData.providerName })
}, []);
const [showList,setShowList]=useState([])
useEffect(() => {
const [showList, setShowList] = useState([])
useEffect(() => {
console.log(CurDataFollow)
}, [CurDataFollow]);
}, [CurDataFollow]);
const goToGuard = (values: any, e: any) => {
GuarderById(values)
history.push(location.pathname +'/Guard?saferName='+values.saferName)
history.push(location.pathname + '/Guard?saferName=' + values.saferName)
}
const pagination={defaultCurrent:1,total: CurDataFollow!=null?CurDataFollow.length:CurDataFollow}
const pagination = { defaultCurrent: 1, total: CurDataFollow != null ? CurDataFollow.length : CurDataFollow }
const printContent = (comment: any)=>{
console.log(comment)
const printContent = (comment: any) => {
console.log(comment)
}
const columns = [
{ title: "User Name",dataIndex: 'saferName',},
{ title: "User Name", dataIndex: 'saferName', },
{ title: "Service Community", dataIndex: 'projectName', },
{ title: "Job Title", dataIndex: 'cdkCode', },
{ title: "User Status",dataIndex: 'cdkStatus',},
{ title: "User Status", dataIndex: 'cdkStatus', },
{
title: "actions",
render: (text: any, record: any) => (
<Space size="middle"> <a onClick={goToGuard.bind(this,record)}>Detail</a></Space>
<Space size="middle"> <a onClick={goToGuard.bind(this, record)}>Detail</a></Space>
),
},
];
return (
<div className={styles.base}>
<TitleBack title="Service Provider Details" />
<div className={styles.bigbox}>
<div className={styles.box0}>
<div className={styles.box0}>
<div className={styles.box0item1}></div>
<div className={styles.box0item2}>{SaveChooseData.serviceCommunityList}</div>
</div>
<div className={styles.box1}>
<div className={styles.box1item1}>Company Name</div>
<div className={styles.box1item2}>{SaveChooseData.providerName}</div>
</div>
</div>
<div className={styles.box1}>
<div className={styles.box1item1}>Company Name</div>
<div className={styles.box1item2}>{SaveChooseData.providerName}</div>
</div>
<div className={styles.box2}>
<div className={styles.box2item1}>Office Address</div>
<div className={styles.box2item2}>{SaveChooseData.providerAddress}</div>
</div>
<div className={styles.box2}>
<div className={styles.box2item1}>Office Address</div>
<div className={styles.box2item2}>{SaveChooseData.providerAddress}</div>
</div>
<div className={styles.box3}>
<div className={styles.box3item1}>Person In Charge</div>
<div className={styles.box3item2}>{SaveChooseData.contactName}</div>
<div className={styles.box3}>
<div className={styles.box3item1}>Person In Charge</div>
<div className={styles.box3item2}>{SaveChooseData.contactName}</div>
</div>
<div className={styles.box4}>
<div className={styles.box4item1}>Contact Details</div>
<div className={styles.box4item2}>{SaveChooseData.contactPhone} {SaveChooseData.contactEmail}</div>
</div>
<div className={styles.box5}>
<div className={styles.box5item1}>Services Available</div>
<div className={styles.box5item2}>Cleaning,Security Guard</div>
</div>
<div className={styles.box4}>
<div className={styles.box4item1}>Contact Details</div>
<div className={styles.box4item2}>{SaveChooseData.contactPhone} {SaveChooseData.contactEmail}</div>
</div>
<div className={styles.box6}>
<div className={styles.box1item1}>Service Community</div>
<div className={styles.box5}>
<div className={styles.box5item1}>Services Available</div>
<div className={styles.box5item2}>Cleaning,Security Guard</div>
</div>
<div className={styles.box6}>
<div className={styles.box1item1}>Service Community</div>
</div>
{
SaveChooseData.serviceCommunityList != null
?
?
<ShowOptions list={SaveChooseData.serviceCommunityList} defaultValue={"Put It Away"} onSubmit={printContent} />
:<></>
: <></>
}
<div className={styles.box7}>
<div className={styles.box1item1}>Security Guard Account</div>
</div>
<div className={styles.box7}>
<div className={styles.box1item1}>Security Guard Account</div>
</div>
</div>
<Table rowKey={"id"} style={{ marginTop: 16 }} dataSource={CurDataFollow} columns={columns} pagination={pagination} />
<Button >Cancellation</Button>
</div>
);
};
function mapStateToProps(state:any) {
const { Data,CurDataFollow,SaveChooseData } = state.ServiceProvider;
function mapStateToProps(state: any) {
const { Data, CurDataFollow, SaveChooseData } = state.ServiceProvider;
return {
Data,
CurDataFollow,
......
import React, { useState, useEffect,useRef } from 'react';
import React, { useState, useEffect, useRef } from 'react';
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';
......@@ -8,31 +8,36 @@ import SelectOptions from '../../../components/SelectOptions/index';
import TitleBack from '../../../components/TitleBack/TitleBack';
import { RA } from '@/utils/method';
const module="User"
const Edit= (props:any) => {
const module = "User"
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 [CList, setCList] = useState(CommunityList);
const [SList,setSList]=useState(["1"])
const printContent = (List: any)=>{setCList(List)}
const [SList, setSList] = useState(["1"])
const printContent = (List: any) => { setCList(List) }
const formRef = useRef(null);
useEffect(() => {
console.log(SaveChooseData)
RA(43,{serviceName:""},module,dispatch)
RA(43, { serviceName: "" }, module, dispatch)
}, []);
useEffect(()=>{
}, []);
useEffect(() => {
if (DataServices != null) {
var tmp=DataServices.data.serviceScopeList
if (SaveChooseData != null) {
formRef.current.setFieldsValue(SaveChooseData)
}
console.log(DataServices)
var tmp = DataServices.data.serviceScopeList
console.log(tmp)
if (SaveChooseData != null) {
formRef.current.setFieldsValue(SaveChooseData)
}
},[DataServices])
}
}, [DataServices])
const onFinish = (values: any) => {
var val = values
val.serviceCommunityList = CList
......@@ -42,54 +47,106 @@ const Edit= (props:any) => {
TosTosServiceProviderSave(val)
};
const onFinishFailed = (errorInfo:any) => {console.log('Failed:', errorInfo) };
const onFinishFailed = (errorInfo: any) => {
console.log('Failed:', errorInfo)
};
return (
<div className={styles.base}>
{/* 头部组件v1.2 */}
{/* 头部组件v1.2 */}
<TitleBack title="Edit Service Provider" />
<Form ref={formRef} name="basic" initialValues={{}} onFinish={onFinish} onFinishFailed={onFinishFailed}>
<div className={styles.box1}>
<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.box1item3}>Office Address</div>
<div className={styles.box1item4}><Form.Item name="providerAddress"><Input style={{width:200}} placeholder="Single Line Input"/></Form.Item></div>
</div>
<div className={styles.line}></div>
<SelectOptions list={CommunityList.sort()} checklist={SaveChooseData!=null?SaveChooseData.serviceCommunityList:null} onSubmit={printContent} />
<div className={styles.box2}>
<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>
<div className={styles.box3}>
<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>
<div className={styles.box4}>
<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.box4item3}><Form.Item name="contactEmail"><Input style={{width:200}} placeholder="E-mail"/></Form.Item></div>
</div>
<Form ref={formRef} name="basic" initialValues={{}} onFinish={onFinish} onFinishFailed={onFinishFailed}>
<div className={styles.box1}>
<div className={styles.box1item1}>Company Name</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.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 className={styles.line}></div>
<SelectOptions list={CommunityList.sort()} checklist={SaveChooseData != null ? SaveChooseData.serviceCommunityList : null} onSubmit={printContent} />
<div className={styles.box2}>
<div className={styles.box2item1}>Services Available</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 className={styles.box3}>
<div className={styles.box3item1}>Person In Charge</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 className={styles.box4}>
<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.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 className={styles.line}></div>
<Form.Item>
<Button type="primary" htmlType="submit">Submit</Button>
</Form.Item>
</Form>
</div>
);
};
function mapStateToProps(state:any) {
function mapStateToProps(state: any) {
const { CurData, SaveChooseData } = state.ServiceProvider;
const { DataServices, } = state.User;
const { CommunityList } = state.Init;
......@@ -106,4 +163,3 @@ function mapStateToProps(state:any) {
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 {Form, Input ,Spin,Table,Space, Button} from 'antd';
import { Form, Input, Spin, Table, Space, Button } from 'antd';
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';
const ServiceProviderManagement = (props: any) => {
const { formatMessage } = useIntl();
const [pageNum, setPageNum] = useState(1)
const [loading, setLoading] = useState(false)
const [testData, setTestData] = useState(null as any);
const { dispatch, location, Data, CommunityList } = props;
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 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 SaveChooseData = (values: any) => { dispatch({ type: 'ServiceProvider/SaveChooseData', playload: values }) };
const GetList = () => {
if (CommunityList != null) {
TosTosServiceProviderGet({
providerName: "",
serviceCommunityList: CommunityList
})
}
}
useEffect(() => {
GetList()
}, []);
useEffect(() => {
GetList()
}, [CommunityList]);
// const GetList = () => {
// if (CommunityList != null) {
// TosTosServiceProviderGet({
// providerName: "",
// serviceCommunityList: CommunityList
// })
// }
// }
// useEffect(() => {
// console.log(CommunityList)
// GetList()
// }, [CommunityList]);
const goToDetail = (values: any, e: any) => {
SaveChooseData(values)
history.push(location.pathname +'/Detail')
history.push(location.pathname + '/Detail')
}
const goToCreate = () => {
SaveChooseData(null)
......@@ -44,76 +55,107 @@ const ServiceProviderManagement = (props: any) => {
SaveChooseData(values)
history.push(location.pathname + '/Edit')
}
const goToServices = () => {history.push(location.pathname +'/Services')}
const pagination={defaultCurrent:1,total: Data!=null?Data.length:0}
const goToServices = () => { history.push(location.pathname + '/Services') }
const columns = [
{ title: "Service Provider",dataIndex: 'providerName',},
{ title: "contact Name",dataIndex: 'contactName',},
{ title: "Service Provider", dataIndex: 'providerName', },
{ title: "contact Name", dataIndex: 'contactName', },
{ title: "Contacts",dataIndex: 'contactPhone',},
{
title: "Contacts",
dataIndex: 'contactPhone',
},
/*{ title: "Contact Details",dataIndex: 'contactEmail',},*/
{ title: "Services Available",dataIndex: 'serviceScope',},
{ title: "Account Status",dataIndex: 'enable',},
{ title: "Actions",
{
title: "Services Available",
dataIndex: 'serviceScope',
},
{ title: "Account Status", dataIndex: 'enable', },
{
title: "Actions",
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;
for (let items in tmp) {
switch (tmp[items].enable) {
case 0: tmp[items].enable = "unregistered";break;
case 1: tmp[items].enable = "registered";break;
case 2:break;
case 0: tmp[items].enable = "unregistered"; break;
case 1: tmp[items].enable = "registered"; break;
case 2: break;
}
}
for (let items in tmp) {
switch (tmp[items].serviceScope) {
case 0: tmp[items].serviceScope = "清洁";break;
case 1: tmp[items].serviceScope = "维修";break;
case 2:tmp[items].serviceScope = "保安";break;
case 3:tmp[items].serviceScope = "会计";break;
case 0: tmp[items].serviceScope = "清洁"; break;
case 1: tmp[items].serviceScope = "维修"; break;
case 2: 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;
}
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))
// } else {
// }
setPageNum(1)
setLoading(true)
//获取数据
TosTosServiceProviderGet({
...location.query,
serviceCommunityList: (testData === null || testData.length === 0) ? CommunityList : testData,
pageNum: 1
})
}, [location])
const CallBackTitleSearch = (comment: any) => {
console.log(comment)
console.log(location.pathname)
//页面搜索
TosTosServiceProviderGet({
setTestData(comment.serviceCommunityList)
history.push(location.pathname + urlEncode(filterObj({
providerName: comment.providerName,
serviceScope:comment.status,
serviceCommunityList: comment.serviceCommunityList
})
// history.push(location.pathname+urlEncode(filterObj({ providerName: comment.providerName})))
serviceScope: comment.status,
pageNum: location.query.pageNum || 1
})))
}
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 !== null ? Data.page.totalRow : null,
showSizeChanger: false
}
return (
<div className={styles.base}>
......@@ -129,26 +171,30 @@ const ServiceProviderManagement = (props: any) => {
community={"serviceCommunityList"}
onSubmit={CallBackTitleSearch} />
{/* 内容组件 */}
{/* 内容组件 */}
<div className={styles.box2}>
<button className={styles.buttonAdd2} onClick={goToServices}>Avail Services</button>
<button className={styles.buttonAdd} onClick={goToCreate}>Create New</button>
</div>
{/* 列表组件 */}
<Spin spinning={Data!=null?false:true}>
<Table size="small" rowKey={"id"}
style={{ marginTop: 16 }} columns={columns}
dataSource={Data!=null?dataSource(Data):null}
pagination={pagination} />
<Spin spinning={Data != null ? false : true}>
<Table size="small" rowKey={"id"}
style={{ marginTop: 16 }}
loading={loading}
columns={columns}
dataSource={Data != null ? dataSource(Data.rows) : null}
pagination={Data != null ? pagination : {}}
onChange={pageChange}
/>
</Spin>
</div>
</div>
);
};
function mapStateToProps(state:any) {
function mapStateToProps(state: any) {
const { Data } = state.ServiceProvider;
const { DataProvider } = state.User;
const { CommunityList } = state.Init;
......
import React, { useState, useEffect, useRef } from 'react';
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 {PlusCircleOutlined} from '@ant-design/icons';
import { PlusCircleOutlined } from '@ant-design/icons';
import Line from '../../../components/Line/Line';
import BackButton from '../../../components/BackButton/BackButton';
......@@ -14,61 +14,62 @@ import TagSelect from '../../../components/TagSelect/index';
import { RA } from '@/utils/method';
import TitleBack from '@/components/TitleBack/TitleBack';
const module="User"
const Services = (props:any) => {
const module = "User"
const Services = (props: any) => {
const { dispatch,DataServices} = props
const { dispatch, DataServices } = props
const formRef = useRef(null)
useEffect(()=>{
RA(43,{serviceName:""},module,dispatch)
useEffect(() => {
RA(43, { serviceName: "" }, module, dispatch)
}, [location])
useEffect(()=>{
useEffect(() => {
if (DataServices != null) {
var tmp=DataServices.data.serviceScopeList
var tmp = DataServices.data.serviceScopeList
console.log(tmp)
formRef.current.setFieldsValue({services:tmp })
}
console.log(formRef)
formRef.current.setFieldsValue({ services: tmp })
}
}, [DataServices])
const onFinish = (values:any) => {
const onFinish = (values: any) => {
console.log(values)
RA(44, {
id:"5",
serviceName:"律政"
},module,dispatch)
id: "5",
serviceName: "律政"
}, module, dispatch)
}
const Add = (values:any) => {
const Add = (values: any) => {
console.log(values)
}
const Remove = (values: any) => {
}
return (
<div className={styles.base}>
<TitleBack title={"Services Available Management"}></TitleBack>
<TitleBack title={"Services Available Management"}></TitleBack>
<Form ref={formRef} name="basic" onFinish={onFinish}>
{DataServices != null?
<Form.Item label="Available Services" name="services"><TagSelect onAdd={Add} onRemove={Remove}/></Form.Item>
:null
{DataServices != null ?
<Form.Item label="Available Services" name="services"><TagSelect onAdd={Add} onRemove={Remove} /></Form.Item>
: null
}
<Line />
{/* <Form.Item ><Button type="primary" htmlType="submit">Submit</Button></Form.Item> */}
</Form>
</div>
);
};
function mapStateToProps(state:any) {
const{DataServices} = state.User
function mapStateToProps(state: any) {
const { DataServices } = state.User
return {
DataServices
}
}
}
export default connect(mapStateToProps)(Services)
......
import { AlipayCircleOutlined, TaobaoCircleOutlined, WeiboCircleOutlined,ArrowLeftOutlined } from '@ant-design/icons';
import {
AlipayCircleOutlined,
TaobaoCircleOutlined,
WeiboCircleOutlined,
ArrowLeftOutlined,
} from '@ant-design/icons';
import { Alert, Checkbox, Input } from 'antd';
import React, { useState,useEffect } from 'react';
import { Link, connect, Dispatch,history, Redirect } from 'umi';
import React, { useState, useEffect } from 'react';
import { Link, connect, Dispatch, history, Redirect } from 'umi';
import { StateType } from '@/models/login';
import { LoginParamsType } from '@/services/login';
import { ConnectState } from '@/models/connect';
......@@ -22,80 +27,102 @@ const Login: React.FC<LoginProps> = (props) => {
const { status, type: loginType } = userLogin;
const [type, setType] = useState<string>('account');
const [userName, setUsername] = useState("");
const [password, setPasswd] = useState("");
const [userName, setUsername] = useState('');
const [password, setPasswd] = useState('');
const handleSubmit = (values: LoginParamsType) => {
const { dispatch } = props;
console.log({ ...values, type,userName,password })
console.log({ ...values, type, userName, password });
console.log(props);
console.log(dispatch, 'dispatch');
dispatch({
type: 'login/login',
payload: {userName,password },
payload: { userName, password },
});
};
const usernameHandle = (e: any) => {
setUsername(e.target.value)
}
setUsername(e.target.value);
};
const passwdHandle = (e: any) => {
setPasswd(e.target.value)
}
setPasswd(e.target.value);
};
const returnHandle = (e: any)=> {
history.push("/user/login")
}
const gotoForgetHandle = (e: any)=> {
history.push("/user/forget")
}
const returnHandle = (e: any) => {
history.push('/user/login');
};
const gotoForgetHandle = (e: any) => {
history.push('/user/forget');
};
const { location } = props;
const [forgetflag,setForgetFlag]=useState(false)
useEffect(() => {
const handleSend = (e: any) => {
console.log('触发了发送事件', e);
console.log(password);
if (
password !== '' &&
/^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(password)
) {
console.log('邮箱正确!');
} else {
console.log('邮箱格式错误!');
}
};
if (location.pathname=="/user/forget") {
setForgetFlag(true)
const { location } = props;
const [forgetflag, setForgetFlag] = useState(false);
useEffect(() => {
if (location.pathname == '/user/forget') {
setForgetFlag(true);
} else {
setForgetFlag(false)
}
setForgetFlag(false);
}
}, [location.pathname]);
return (
<div>
{
forgetflag?(
<div style={{ position: "absolute", top: -50, cursor: "pointer" }} onClick={returnHandle}><ArrowLeftOutlined style={{ fontSize: '28px' }} /></div>
):(<div />)
}
{forgetflag ? (
<div style={{ position: 'absolute', top: -50, cursor: 'pointer' }} onClick={returnHandle}>
<ArrowLeftOutlined style={{ fontSize: '28px' }} />
</div>
) : (
<div />
)}
<LoginForm activeKey={type} onTabChange={setType} onSubmit={handleSubmit}>
<div className={styles.box1}>Account Number</div>
<input className={styles.input} onChange={usernameHandle}/>
<div className={styles.box1}>{forgetflag?("Next"):("Password")}</div>
{
forgetflag ? (
<div className={styles.box2}>
<input className={styles.input5} onChange={passwdHandle} type="password" />
<div className={styles.button2} style={{float:"right"}}>Send</div>
<input className={styles.input} onChange={usernameHandle} />
<div className={styles.box1}>{forgetflag ? 'Please enter email address' : 'Password'}</div>
{forgetflag ? (
<div className={styles.box2}>
<input className={styles.input5} onChange={passwdHandle} />
<div className={styles.button2} style={{ float: 'right' }} onClick={handleSend}>
Send
</div>
</div>
) : (
) : (
<div>
<input className={styles.input2} onChange={passwdHandle} type="password" />
<div>
<input className={styles.input2} onChange={passwdHandle} type="password"/>
<div>
<div className={styles.input3} onClick={gotoForgetHandle}>Forget Password</div>
<div className={styles.input4}>
{status === 'error' && loginType === 'account' && !submitting && (
<div>Wrong account or password</div>
)}</div>
</div>
<div className={styles.input3} onClick={gotoForgetHandle}>
Forget Password
</div>
<div className={styles.input4}>
{status === 'error' && loginType === 'account' && !submitting && (
<div>Wrong account or password</div>
)}
</div>
</div>
)
}
<Submit className={styles.button} loading={submitting} style={{ width: 330 }}>{forgetflag?("Next"):("登录")}</Submit>
</div>
)}
<Submit className={styles.button} loading={submitting} style={{ width: 330 }}>
{forgetflag ? 'Next' : '登录'}
</Submit>
</LoginForm>
</div>
);
};
export default connect(({ login, loading }: ConnectState) => ({
userLogin: login,
submitting: loading.effects['login/login'],
}))(Login);
export default connect(({ login, loading }: ConnectState) => {
return {
userLogin: login,
submitting: loading.effects['login/login'],
};
})(Login);
......@@ -2,26 +2,26 @@ import request from '@/utils/request';
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'}})
}
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'}})
}
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'}})
}
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'}})
}
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'}})
}
......@@ -17,12 +17,13 @@ export async function getFakeCaptcha(mobile: string) {
}
export async function AccountLogin(params: LoginParamsType) {
console.log("登录请求")
return request('/tos/user/login', { method: 'POST', data: params, });
console.log('登录请求');
console.log(params);
return request('/tos/user/login', { method: 'POST', data: params });
}
export async function AccountOut() {
return request('/tos/user/login', { method: 'POST' });
return request('/tos/user/login', { method: 'POST' });
}
export interface LoginCheckParamsType {
userName: string;
......@@ -31,6 +32,6 @@ export interface LoginCheckParamsType {
userId: string;
}
export async function AccountCheckLogin(params: LoginCheckParamsType) {
console.log("登录确认请求")
return request('/tos/user/newCurrentUser', { method: 'POST', data: params, });
}
\ No newline at end of file
console.log('登录确认请求');
return request('/tos/user/newCurrentUser', { method: 'POST', data: params });
}
......@@ -4,60 +4,101 @@ import request from '@/utils/request';
// 后台账号管理
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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
//配置文件
// const yellowcolor ="\033[40;33m"
// // const bulecolor='\033[40;34m';
// const colorend = "\033[0m"
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) {
return request(url, Body(values))
const headers = { 'Content-Type': 'application/json' };
function Body(values: any) {
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])
console.log("参数如下:")
console.log(playload.body)
function requestAuto(url: string, values: any) {
return request(url, Body(values));
}
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))
return requestAuto(url,playload.body)
return requestAuto(url, playload.body);
}
//新增小区公告接口文件上传 http://47.74.233.180:8651/tos/image/upload imageType 参数值为 tosNotice
......@@ -5,12 +5,14 @@ export async function query(): Promise<any> {
}
export async function queryCurrent(values: any): Promise<any> {
console.log(values)
return request('/tos/user/newCurrentUser',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}});
console.log('登录数据=================', values);
return request('/tos/user/newCurrentUser', {
method: 'POST',
body: JSON.stringify(values),
headers: { 'Content-Type': 'application/json' },
});
}
export async function queryNotices(): Promise<any> {
return request('/api/notices');
}
import {message } from 'antd';
import { message } from 'antd';
import moment from 'moment';
export const checkParam = (values: any) => {
var flag = true
var flag = true;
for (var i in values) {
// console.log(values[i]);
if (values[i] == null) {
flag=false
flag = false;
} else {
if(values[i].length == 0){ flag=false}
}
if (values[i].length == 0) {
flag = false;
}
}
}
return flag
}
return flag;
};
// onBlur={checkInput} maxLength={33}
export const checkInput = (e: any) => {
// console.log(e)
if (e.target.value.length == 1) {
message.error("User Name Should be limit 2~30!", 3)
e.target.value=null
message.error('User Name Should be limit 2~30!', 3);
e.target.value = null;
}
}
};
export const picFromate = (values: any) => {
var result=new Array()
if (values != null) {
values.map((item:any, index:any) => {
result.push({ url: item })
})
var result = new Array();
if (values != null) {
values.map((item: any, index: any) => {
result.push({ url: item });
});
}
return result
}
return result;
};
export const getCookie=(key:string)=>{
const name = key + "=";
export const getCookie = (key: string) => {
const name = key + '=';
const ca = document.cookie.split(';');
for (let i = 0; i < ca.length; i++) {
const c = ca[i].trim();
if (c.indexOf(name) === 0) {
return c.substring(name.length, c.length);
}
const c = ca[i].trim();
if (c.indexOf(name) === 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
return '';
};
export const setCookie = (key: string, value: string) => {
document.cookie = key + '=' + value + '; ';
};
export const setCookie=(key:string,value: string)=>{
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 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 URLCLEAR = (module: string, dispatch: any) => { dispatch({ type: module + '/URLCLEAR'}) };
export const DataClear = (module: string, dispatch: any) => { dispatch({ type: module + '/DataClear'}) };
export const ResultClear = (module:any,dispatch:any) => { dispatch({ type: module + '/ResultClear' }) };
export const URLCLEAR = (module: string, dispatch: any) => {
dispatch({ type: module + '/URLCLEAR' });
};
export const DataClear = (module: string, dispatch: any) => {
dispatch({ type: module + '/DataClear' });
};
export const ResultClear = (module: any, dispatch: any) => {
dispatch({ type: module + '/ResultClear' });
};
// const reg = [["url", "categoriesImageUrl"], ["name", "categoriesName"]]
// const values = [{ categoriesImageUrl: "http://url", categoriesName: "A9" },{ categoriesImageUrl: "http://url...", categoriesName: "A8" }]
export const Fromate = (values:any,reg:any) => {
var result=new Array()
if (values != null) {
values.map((item:any, index:any) => {
var obj={}
for (var i = 0; i < reg.length; i++){
export const Fromate = (values: any, reg: any) => {
var result = new Array();
if (values != null) {
values.map((item: any, index: any) => {
var obj = {};
for (var i = 0; i < reg.length; i++) {
if (reg[i][1] == null) {
obj[reg[i][0]]=item
obj[reg[i][0]] = item;
} 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 values2 = [{name:"kat",url:"longtime"},{name:"jack",url:"longtime2"}]
export const Fromate2 = (values:any, reg:string) => {
var result = new Array()
values.map((item:any, index:number) => {
result.push(item[reg]);
})
return result
}
export const Fromate2 = (values: any, reg: string) => {
var result = new Array();
values.map((item: any, index: number) => {
result.push(item[reg]);
});
return result;
};
// 获取对象信息
export const getObjectInfo = (test: any) => {
console.log(JSON.stringify(test,null, '\t'))
var array = new Array()
console.log(JSON.stringify(test, null, '\t'));
var array = new Array();
for (let item in test) {
array.push([item, typeof test[item]])
array.push([item, typeof test[item]]);
}
return array
}
return array;
};
//对象转URL
export const urlEncode = (obj:any) => {
var url = "?"
var i = 0
export const urlEncode = (obj: any) => {
var url = '?';
var i = 0;
for (var item in obj) {
if (i > 0) {
url += "&"
url += '&';
}
url += item + "=" + obj[item]
i += 1
url += item + '=' + obj[item];
i += 1;
}
return url
}
return url;
};
//对象抽空
export const filterObj = (obj:any) => {
var tmp = {}
export const filterObj = (obj: any) => {
var tmp = {};
for (var item in obj) {
if (obj[item] != null&&obj[item]!=undefined) {
tmp[item] = obj[item]
if (obj[item] != null && obj[item] != undefined) {
tmp[item] = obj[item];
}
}
return tmp
}
return tmp;
};
//对象抽空根据关键字
export const filterObjbyTg = (obj:any,tg:any) => {
var tmp = {}
export const filterObjbyTg = (obj: any, tg: any) => {
var tmp = {};
for (var item in obj) {
if (tg.indexOf(item)>-1) {
if (tg.indexOf(item) > -1) {
if (obj[item] != null) {
tmp[item] = obj[item]
tmp[item] = obj[item];
}
}
}
return tmp
}
return tmp;
};
//提取当中的指定数据类型数据
export const getLevelNum =()=>{
var levelNum=new Array()
export const getLevelNum = () => {
var levelNum = new Array();
for (var item in treeData) {
// console.log(parseInt(treeData[item].key))
if (!isNaN(parseInt(treeData[item].key))) {
levelNum.push(treeData[item].key)
// console.log(parseInt(treeData[item].key))
if (!isNaN(parseInt(treeData[item].key))) {
levelNum.push(treeData[item].key);
} else {
var tmp = treeData[item]
var tmp = treeData[item];
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) => {
from[item[0]]=to[item[1]]
})
return from
}
from[item[0]] = to[item[1]];
});
return from;
};
//用户名检测
export const checkData = (rule:any, value:any, callback:any) => {
export const checkData = (rule: any, value: any, callback: any) => {
if (value) {
if (/^[a-zA-Z0-9]+$/g.test(value)) {
callback();
} else {
callback(new Error('*Numbers and letters'));
}
callback(new Error('*Numbers and letters'));
}
}
callback();
};
//时间转换函数
export const timeForm = (values: any,format:any) => {
var result = new Array()
values.map((items:any, index:any) => {
result.push(moment(items).format(format))
})
return result[0] + "-" + result[1]
}
\ No newline at end of file
export const timeForm = (values: any, format: any) => {
var result = new Array();
values.map((items: any, index: any) => {
result.push(moment(items).format(format));
});
return result[0] + '-' + result[1];
};
export const validateMessages ={
export const validateMessages = {
required: '*it is required!',
types: {
email: 'It is not validate email!',
number: '${label} is not a validate number!',
string:'${label} is not a validate number!'
string: '${label} is not a validate number!',
},
string: {
range: 'It must be between ${min} and ${max}',
......@@ -11,106 +11,130 @@ export const validateMessages ={
number: {
range: '${label} must be between ${min} and ${max}',
},
}
};
export const requestList = [
["/tos/community/facilities/categories/subscribe/list","0 请求预订列表",{}],
["/tos/community/facilities/get","1 设施品类获取",{}],
["/tos/community/facilities/categories/detail/get","2 缴费详情",{}],
["/tos/community/facilities/categories/fee/back","3 退还押金",{}],
["/tos/community/facilities/categories/fee/pay","4 缴费",{}],
["/tos/community/categories/subscribe/cancel","5 取消预约",{}],
["/tos/community/facilities/add","6 新增小区设施",{}],
["/tos/bookingService/lookUp","7 查看小区设施",{}],
["/tos/community/facilities/fuzzy/query","8 查看设施管理模糊",{}],
["/tos/community/categories/subscribe/fuzzy/query","9 预订列表模糊查询",{}],
["/tos/user/newCurrentUser", "10 后台用户信息",{}],
["/tos/community/facilities/categories/subscribe","11 预订",{}],
['/tos/community/facilities/categories/subscribe/list', '0 请求预订列表', {}],
['/tos/community/facilities/get', '1 设施品类获取', {}],
['/tos/community/facilities/categories/detail/get', '2 缴费详情', {}],
['/tos/community/facilities/categories/fee/back', '3 退还押金', {}],
['/tos/community/facilities/categories/fee/pay', '4 缴费', {}],
['/tos/community/categories/subscribe/cancel', '5 取消预约', {}],
['/tos/community/facilities/add', '6 新增小区设施', {}],
['/tos/bookingService/lookUp', '7 查看小区设施', {}],
['/tos/community/facilities/fuzzy/query', '8 查看设施管理模糊', {}],
['/tos/community/categories/subscribe/fuzzy/query', '9 预订列表模糊查询', {}],
['/tos/user/newCurrentUser', '10 后台用户信息', {}],
['/tos/community/facilities/categories/subscribe', '11 预订', {}],
["/tos/tosOwner/getAll", "12 业主查询",{}],
["/tos/tosOwner/getDetailAll", "13 业主查询详细",{}],
["/tos/tosOwner/save","14 业主添加",{}],
["/tos/life/community/qr/get","15 二维码查询",{}],
["/tos/life/community/account/unit/del","16 删除单元",{}],
["/tos/bookingService/edit", "17 编辑小区设施",{}],
["/tos/tosOwner/info/update", "18 编辑业主信息",{}],
// ['/tos/tosOwner/getAll', '12 业主查询', {}],
['/tos/owner/query/fuuzy', '12 业主查询', {}],
['/tos/tosOwner/getDetailAll', '13 业主查询详细', {}],
['/tos/tosOwner/save', '14 业主添加', {}],
['/tos/life/community/qr/get', '15 二维码查询', {}],
['/tos/life/community/account/unit/del', '16 删除单元', {}],
['/tos/bookingService/edit', '17 编辑小区设施', {}],
['/tos/tosOwner/info/update', '18 编辑业主信息', {}],
["/tos/contract/list", "19 获取合同列表",{}],
["/tos/contract/detail/query", "20 获取合同列表详情",{}],
["/tos/community/service/get/detail", "21 小区服务获取详情",{}],
["/tos/communtiy/service/reply", "22 小区回复",{}],
["/tos/property/decorate/record/get", "23 装修列表获取",{}],
["/tos/tosCommunity/get", "24 获取小区列表",{}],
["/tos/tosCommunityNotic/get", "25 获取小区公告列表",{}],
["/tos/tosVisitorRecord/get", "26 获取访客记录列表",{}],
["/tos/contract/add", "27 合同新增和编辑",{}],
["/tos/tosCommunityNotic/add", "28 新增小区公告接口", {
"noticTitle":"Garden公告",
"communityNum":"珠江丽景小区",
"noticText":"今晚晚上停水4小时",
"noticScope":"1",
"noticStartTime":"2020-07-01 12:30:00",
"noticEndTime":"2020-08-01 9:30:00",
"file":["A.jpg"]
}],
["/tos/tosManageCommunity/save", "29 新建一个小区",{}],
["/tos/tosOrder/get", "30 获取订单详情",{}],
["/tos/property/community/houseCard/query", "31 获取住户卡列表",{}],
["/tos/tosCommunity/get/detail", "32 获取小区详情",{}],
["/tos/property/decorate/record/reply", "33 回复装修申请",{}],
["/tos/property/community/houseCard/reply", "34 回复住户卡申请",{}],
["/tos/home/page/community/houseCard/add", "35 申请住户卡",{}],
["/tos/property/community/houseCard/query/detail", "36 获取住户卡详情",{}],
["/tos/property/decorate/record/get/detail", "37 获取装修记录详情",{}],
["/tos/users/save", "38 新建后台信息",{}],
["/tos/life/community/account/member/del", "39 删除业主成员信息", {
"id": "c06286cfe7b843cb96fdfcb987231123",
"ownerId": "6b359755a36b49c28241a4620fa6539b"
}],
["/tos/community/service/get", "40 获取小区服务回复列表",{}],
["/tos/users/save", "41 添加后台账号", {
"id": "null",
"oneself": 0,
"tosUserEmail": "sales@huahui.com",
"tosUserName": "小赵2",
"tosUserPhone": "020-8888-4444",
"tosUserPwd": "123456",
"tosUserToCompany": "1",
"tosUserServiceCell":"",
"tosuserLevel": 1,
"userStatus": 1
}],
["/tos/account/permission/savePermission", "42 添加后台权限", {
"userName": "小赵2",
"userPassword": "123456",
"permissionArray": ["2", "1", "3", "4"]
}],
["/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 获取服务商",{}],
]
['/tos/contract/list', '19 获取合同列表', {}],
['/tos/contract/detail/query', '20 获取合同列表详情', {}],
['/tos/community/service/get/detail', '21 小区服务获取详情', {}],
['/tos/communtiy/service/reply', '22 小区回复', {}],
['/tos/property/decorate/record/get', '23 装修列表获取', {}],
['/tos/tosCommunity/get', '24 获取小区列表', {}],
['/tos/tosCommunityNotic/get', '25 获取小区公告列表', {}],
['/tos/tosVisitorRecord/get', '26 获取访客记录列表', {}],
['/tos/contract/add', '27 合同新增和编辑', {}],
[
'/tos/tosCommunityNotic/add',
'28 新增小区公告接口',
{
noticTitle: 'Garden公告',
communityNum: '珠江丽景小区',
noticText: '今晚晚上停水4小时',
noticScope: '1',
noticStartTime: '2020-07-01 12:30:00',
noticEndTime: '2020-08-01 9:30:00',
file: ['A.jpg'],
},
],
['/tos/tosManageCommunity/save', '29 新建一个小区', {}],
['/tos/tosOrder/get', '30 获取订单详情', {}],
['/tos/property/community/houseCard/query', '31 获取住户卡列表', {}],
['/tos/tosCommunity/get/detail', '32 获取小区详情', {}],
['/tos/property/decorate/record/reply', '33 回复装修申请', {}],
['/tos/property/community/houseCard/reply', '34 回复住户卡申请', {}],
['/tos/home/page/community/houseCard/add', '35 申请住户卡', {}],
['/tos/property/community/houseCard/query/detail', '36 获取住户卡详情', {}],
['/tos/property/decorate/record/get/detail', '37 获取装修记录详情', {}],
['/tos/users/save', '38 新建后台信息', {}],
[
'/tos/life/community/account/member/del',
'39 删除业主成员信息',
{
id: 'c06286cfe7b843cb96fdfcb987231123',
ownerId: '6b359755a36b49c28241a4620fa6539b',
},
],
['/tos/community/service/get', '40 获取小区服务回复列表', {}],
[
'/tos/users/save',
'41 添加后台账号',
{
id: 'null',
oneself: 0,
tosUserEmail: 'sales@huahui.com',
tosUserName: '小赵2',
tosUserPhone: '020-8888-4444',
tosUserPwd: '123456',
tosUserToCompany: '1',
tosUserServiceCell: '',
tosuserLevel: 1,
userStatus: 1,
},
],
[
'/tos/account/permission/savePermission',
'42 添加后台权限',
{
userName: '小赵2',
userPassword: '123456',
permissionArray: ['2', '1', '3', '4'],
},
],
[
'/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 = [
{ "communityName": "" },
{ "communityNum": "", "noticTitlel": "" },
{ "inviterAddress": "", "visitorCommunity": "" },
[26,{
}],
[28, {
}]
]
\ No newline at end of file
{ communityName: '' },
{ communityNum: '', noticTitlel: '' },
{ inviterAddress: '', visitorCommunity: '' },
[26, {}],
[28, {}],
];
import moment from 'moment';
const format = 'HH:mm';
//2020/7/14/18:09:00
export const timestampToTime2=(timestamp:any)=>{
var date = new Date(timestamp);//*1000//getHours getMinutes getSeconds
export const timestampToTime2 = (timestamp: any) => {
var date = new Date(timestamp); //*1000//getHours getMinutes getSeconds
return (
date.getFullYear() +
'/' +
(date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) +
' ' +
date.getDate()
);
// return date.getFullYear()+'/' + (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + ' '+date.getDate()+' '+date.getHours()+':'+date.getMinutes()+':'+date.getSeconds()
};
return date.getFullYear()+'/' + (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + ' '+date.getDate()+' '+date.getHours()+':'+date.getMinutes()+':'+date.getSeconds()
}
//月份补零
function addTZero(time) {
let tmp = time + 1 < 10 ? '0' + (time+1) : (time + 1)
return tmp
let tmp = time + 1 < 10 ? '0' + (time + 1) : time + 1;
return tmp;
}
function addZero(time) {
let tmp = time + 1 < 10 ? '0' + time : time
return tmp
let tmp = time + 1 < 10 ? '0' + time : time;
return tmp;
}
const month = ("Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sept,Oct,Nov,Dec").split(",")
const MonthTurnNum = (values:any) => {
const month = 'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sept,Oct,Nov,Dec'.split(',');
const MonthTurnNum = (values: any) => {
var i = 0;
month.map((item, index) => {
if (values == item) {
i=index+1
i = index + 1;
}
})
return i
}
export const getStringToTime = (time:any) => {
var date = time.split(" ")
var result = addTZero(MonthTurnNum(date[0])) + "-" + addZero(parseInt(date[1].slice(0, date[1].length - 1))) + " " + date[2]
return result
}
});
return i;
};
export const getStringToTime = (time: any) => {
var date = time.split(' ');
var result =
addTZero(MonthTurnNum(date[0])) +
'-' +
addZero(parseInt(date[1].slice(0, date[1].length - 1))) +
' ' +
date[2];
return result;
};
//03-08-2020 13:26
export const timestampToTime4 = (timestamp: any) => {
var date = new Date(timestamp);//*1000//getHours getMinutes getSeconds
var date = new Date(timestamp); //*1000//getHours getMinutes getSeconds
return addZero(date.getDate()) + '-'+ (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-'+date.getFullYear()+ ' '+addZero(date.getHours())+ ':'+addZero(date.getMinutes())
}
return (
addZero(date.getDate()) +
'-' +
(date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) +
'-' +
date.getFullYear() +
' ' +
addZero(date.getHours()) +
':' +
addZero(date.getMinutes())
);
};
// 03-06 13:26
export const timestampToTime3=(timestamp:any)=>{
var date = new Date(timestamp);//*1000//getHours getMinutes getSeconds
export const timestampToTime3 = (timestamp: any) => {
var date = new Date(timestamp); //*1000//getHours getMinutes getSeconds
return addZero(date.getDate()) + '-'+ addTZero(date.getMonth()) + ' '+addZero(date.getHours())+ ':'+addZero(date.getMinutes());
}
return (
addZero(date.getDate()) +
'-' +
addTZero(date.getMonth()) +
' ' +
addZero(date.getHours()) +
':' +
addZero(date.getMinutes())
);
};
// 03-08-2020
export const timestampToTime = (timestamp: any) => {
var date = new Date(timestamp);//*1000//getHours getMinutes getSeconds
var date = new Date(timestamp); //*1000//getHours getMinutes getSeconds
return addZero(date.getDate()) + '-'+ (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-'+date.getFullYear();
}
return (
addZero(date.getDate()) +
'-' +
(date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) +
'-' +
date.getFullYear()
);
};
//时间转换
// 时间的拆分 var tmp = ["10:00-12:00", "13:00-14:00"]
export const timeToMoment = (tmp: any) => {
if (tmp == null) return null
if (tmp == null) return null;
// var result = new Array()
// tmp.map((item:any, index:any) => {
// var piece = item.split('-')
// result.push([moment(piece[0], format), moment(piece[1], format)])
// })
// return result;
var piece = tmp.split('-')
return [moment(piece[0], format), moment(piece[1], format)]
}
var piece = tmp.split('-');
return [moment(piece[0], format), moment(piece[1], format)];
};
export const MomentToTime= (tmp: any) => {
if (tmp == null) return null
export const MomentToTime = (tmp: any) => {
if (tmp == null) return null;
return (tmp.format("YYYY-MM-DD HH:mm:ss"))
}
export const TimeToMoment2= (tmp: any) => {
if (tmp == null) return null
return tmp.format('YYYY-MM-DD HH:mm:ss');
};
export const TimeToMoment2 = (tmp: any) => {
if (tmp == null) return null;
return moment(tmp, "YYYY-MM-DD HH:mm:ss")
}
return moment(tmp, 'YYYY-MM-DD HH:mm:ss');
};
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