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