Commit 2bd7d5ab authored by maple's avatar maple

[version]v1.0.3

parent e78e90eb
......@@ -86,6 +86,7 @@ export default defineConfig({
routes: [
{ path: './', component: './UserManagement/LIFEUserManagement/Users' },
{ path: './Add', component: './UserManagement/LIFEUserManagement/UsersAdd' },
{ path: './Detail', component: './UserManagement/LIFEUserManagement/UsersDetail' },
]
},
{
......
import React, { useState, useEffect,useRef } from 'react';
import { Input ,Form} from 'antd';
import { getNumber } from '../../utils/string';
const MoneyInput = (props:any) => {
// const [onChange] = props
const formRef = useRef(null);
const keyup = (e: any) => {
var value=e.target.value
value = value.replace(/[^\d^\.]+/g, '')
var last=getNumber(value)
e.target.value=last
formRef.current.setFieldsValue({ input: last })
// onChange(last)
}
return (
<>
<Form ref={formRef} name="basic2">
<Form.Item name="input">
<Input prefix="$" placeholder="00.00" onKeyUp={keyup} allowClear />
</Form.Item>
</Form>
</>
);
};
export default MoneyInput;
//头部组件
.item0{
float: left;
}
.item1{
float: left;
margin-left: 16px;
line-height: 34px;
}
.item2{
float: right;
}
.clear{
clear: both;
}
.clear0{
.clear();
margin-bottom: 35px;
}
import React, { useState, useEffect } from 'react';
import styles from './index.less';
import { Upload, Modal,Row,Col,Input } from 'antd';
import { Upload, Modal,Row,Col,Input,message} from 'antd';
import { PlusOutlined,PictureFilled } from '@ant-design/icons';
import { OmitProps } from 'antd/lib/transfer/ListBody';
......@@ -22,7 +22,7 @@ const Picture = (props:any) => {
useEffect(() => {
var tmp = props.defaultValue
console.log(tmp)
// console.log(tmp)
var checkFlag=false
if (tmp != null) {
tmp.map((item, index) => {
......@@ -31,8 +31,8 @@ const Picture = (props:any) => {
}
})
if (!checkFlag) {
console.log("picture")
console.log(tmp)
// console.log("picture")
// console.log(tmp)
setFileList(tmp)
}
......@@ -53,14 +53,22 @@ const Picture = (props:any) => {
const handleChange = ({ file,fileList }) => {
let tmp=fileList
setFileList(tmp)
setFileList(tmp.filter(file => !!file.status))
// console.log(fileList)
if (file.status === 'done') {
console.log("success upload picture")
// console.log("success upload picture")
props.onSubmit(file.name)
}
}
const beforeUpload=( file:any) => {
if (file.type === 'image/png' || file.type === 'image/jpeg' || file.type === 'image/jpg') {
return true
} else {
message.error(`${file.name} is not a png/jpeg/jpg file`);
return false
}
}
const uploadButton = (
<div>
<PictureFilled style={{ fontSize: '28px' }}/>
......@@ -69,12 +77,13 @@ const Picture = (props:any) => {
);
const uploadpic = (
<Upload
accept=".png,.jpg,.jpeg"
action="/tos/image/upload"
listType="picture-card"
data={props.data}
fileList={fileList}
onPreview={handlePreview} onChange={handleChange} disabled={props.disabled}>
onPreview={handlePreview} onChange={handleChange} disabled={props.disabled} beforeUpload={beforeUpload}>
{fileList.length >= 1 ? null : uploadButton}
</Upload>
)
......@@ -82,7 +91,7 @@ const Picture = (props:any) => {
<div>
{uploadpic}
<Modal visible={previewVisible} title={previewTitle} footer={null} onCancel={handleCancel}>
<Modal visible={previewVisible} title={previewTitle} footer={null} onCancel={handleCancel} onOk={handleCancel}>
<img alt="example" style={{ width: '100%' }} src={previewImage} />
</Modal>
</div>
......
......@@ -45,10 +45,10 @@ const PictureOptions = (props:any) => {
var tmp = fileList
tmp.splice(index, 1);
console.log("删除")
console.log(tmp)
// console.log("删除")
// console.log(tmp)
setFileList(fileList => ([...tmp]))
console.log(fileList)
// console.log(fileList)
props.putSubmit( CheckParm(tmp))
}
const CheckParm = (values: Array<any>) => {
......
......@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
import styles from './index.less';
import { Upload, Modal,Row,Col,Input,List,Card, Button } from 'antd';
import { Upload, Modal,Row,Col,Input,List,Card, Button,message } from 'antd';
import { PlusOutlined,PictureFilled } from '@ant-design/icons';
......@@ -24,6 +24,7 @@ const uploadButton = (
import { getUrlPicName } from '../../utils/string';
const PictureOptionsRow = (props:any) => {
// const [defa] = props;
const [fileList, setFileList] = useState([])
const [previewVisible, setPreviewVisible] = useState(false)
const [previewImage,setPreviewImage]=useState('')
......@@ -58,17 +59,26 @@ const PictureOptionsRow = (props:any) => {
const handleChange = ({ file, fileList }) => {
let tmp=fileList
setFileList(tmp)
setFileList(tmp.filter(file => !!file.status))
var result=new Array()
fileList.map((item, index) => {
result.push(item.name)
})
props.putSubmit(result)
}
const beforeUpload=( file:any) => {
if (file.type === 'image/png' || file.type === 'image/jpeg' || file.type === 'image/jpg') {
return true
} else {
message.error(`${file.name} is not a png/jpeg/jpg file`);
return false
}
}
return (
<div>
<Upload
<Upload
accept=".png,.jpg,.jpeg"
action="/tos/image/upload"
listType="picture-card"
data={props.data}
......@@ -76,11 +86,13 @@ const PictureOptionsRow = (props:any) => {
onPreview={handlePreview}
onChange={handleChange}
disabled={props.disabled}
beforeUpload={beforeUpload}
>
{fileList.length >= 8 ? null : (props.disabled?null:uploadButton)}
</Upload>
<Modal
visible={previewVisible}
visible={previewVisible}
onOk={handleCancel}
onCancel={handleCancel}
>
<img alt="example" style={{ width: '100%' }} src={previewImage} />
......
import { Select,Empty } from 'antd';
import { SearchOutlined } from '@ant-design/icons';
const { Option } = Select;
class SearchOptions extends React.Component {
state = {
};
constructor(props) {
super(props);
const {list,defaultValue} = this.props;
// console.log("重要的")
this.state={
data: [],
value: defaultValue,
initflag:false,
list:list
}
}
componentDidUpdate(){
if(this.props.defaultValue!=null&&this.props.defaultValue!=this.state.value)
{
this.setState({value:this.props.defaultValue})
}
}
handleSearch = value => {
if (value&&value.length>0) {
// console.log(value)
// console.log(this.state.list)
if(this.state.list!=null){
var tmp=new Array()
this.state.list.map((item,index)=>{
if((item.toLowerCase()).indexOf(value.toLowerCase())>-1){
tmp.push(item)
}
this.setState({ data: tmp });
})
}
} else {
this.setState({ data: [] });
}
};
handleChange = value => {
this.setState({ value });
// console.log(value)
this.props.onSubmit(value)
};
nocontent=()=>{
return(
<div>
<div>404</div>
</div>
)
}
render() {
const options = this.state.data.map(d => <Option key={d}>{d}</Option>);
return (
<Select
showSearch
value={this.state.value}
placeholder={"Community Name"}
optionFilterProp="children"
// style={this.props.style}
defaultActiveFirstOption={false}
showArrow={true}
filterOption={false}
onSearch={this.handleSearch}
onChange={this.handleChange}
notFoundContent={<div><Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />Please enter the correct Community Name!</div>}
style={{ width: 200 }}
>
{options}
</Select>
);
}
}
export default SearchOptions;
// ReactDOM.render(<SearchInput placeholder="input search text" style={{ width: 200 }} />, mountNode);
{/* <Select
showSearch
style={{ width: 200 }}
placeholder="Select a person"
optionFilterProp="children"
onChange={onChange}
onFocus={onFocus}
onBlur={onBlur}
onSearch={onSearch}
filterOption={(input, option) =>
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
>
<Option value="jack">Jack</Option>
<Option value="lucy">Lucy</Option>
<Option value="tom">Tom</Option>
</Select>, */}
\ No newline at end of file
import React, { useState,useEffect} from 'react';
import { Link, useIntl, connect, Dispatch, history } from 'umi';
import SearchOptions from './SearchOptions';
const SearchOptionsCommnity = (props: any) => {
const {dispatch, CommunityList,defaultValue,placeholder } = props;
const tosCommunityget = (values:any) => {dispatch({type: 'Init/tosCommunityget',playload:values})};
useEffect(() => {
if (CommunityList == null) {
tosCommunityget(null)
}
}, []);
const extendName = (values: any) => {
// console.log(values)
props.onSubmit(values);
}
return (
<>
<SearchOptions placeholder={placeholder} defaultValue={defaultValue} list={CommunityList} onSubmit={extendName} />
</>
);
};
function mapStateToProps(state:any) {
const { CommunityList } = state.Init;
return {
CommunityList,
};
}
export default connect(mapStateToProps)(SearchOptionsCommnity);
//头部组件
.item0{
float: left;
}
.item1{
float: left;
margin-left: 16px;
line-height: 34px;
}
.item2{
float: right;
}
.clear{
clear: both;
}
.clear0{
.clear();
margin-bottom: 35px;
}
......@@ -76,11 +76,8 @@ class SelectOptions extends React.Component {
console.log(this.props.show)
if(this.props.show==false){
this.setState({componetVisible:this.state.selectoptionsOpen,flag:true})
console.log("初始化")
}else{
this.setState({componetVisible:this.state.selectoptionsPutItAway,flag:false})
console.log("初始化")
}
console.log(this.state.componetVisible)
}
......
import React from 'react';
import styles from './index.less';
import { Input, Menu, Table, Space } from 'antd';
import TitleBlack from '';
const TableShow = (props:any) => {
const goTo = (values:any,e:any) => {
console.log(values)
}
const key = [
["Service Community", "communityName"],
["User Name", "accountName"],
["Facility Bookings", "facilityTitle"],
["Actions",null, (text: any, record: any) => (<Space size="middle"> <a onClick={goTo.bind(this,record)}>Detail</a></Space>)],
]
return (
<>
<Table dataSource={Data2.data} columns={columns2}></Table>
</>
);
};
export default TableShow;
// 线栏
.font{
border-left: 5px solid rgba(24,144,255,1);
font-family:'Source Han Sans CN';
font-size: 18px;
font-weight: 600;
color: #000000;
}
.item{
.font();
text-indent: 15px;
}
\ No newline at end of file
......@@ -13,13 +13,17 @@ const format = 'HH:mm';
import {timeToMoment} from '../../utils/time'
const TimeSelect = (props:any) => {
const { defaultValue } = props;
const [times, setTimes] = useState([])
const [timesLen, setTimesLen] = useState(0)
useEffect(() => {
if (props.defaultValue != null) {
var tmp = props.defaultValue
console.log(tmp)
console.log("时段选择器")
console.log(defaultValue)
if (defaultValue != null) {
var tmp = defaultValue
var result=new Array()
tmp.map((item, index) => {
result.push({index:index,time:item})
......@@ -27,10 +31,16 @@ const TimeSelect = (props:any) => {
setTimes(result)
setTimesLen(result.length)
props.putSubmit( CheckParm(result))
} else {
setTimes([{index: 0,time:null}])
}
},[])
}, [defaultValue]);
useEffect(() => {
// else {
// setTimes([{index: 0,time:null}])
// }
}, [])
const add =() => {
setTimesLen(timesLen + 1)
setTimes(times => ([...times, {index:timesLen + 1,time:null}]))
......@@ -62,8 +72,8 @@ const TimeSelect = (props:any) => {
const timeChange = (index: any, values: any) => {
var tmp = times;
console.log("Maple诊断"+index)
console.log(values)
// console.log("Maple诊断"+index)
// console.log(values)
if (values != null) {
tmp[index].time =timeForm(values)
} else {
......
......@@ -130,3 +130,16 @@ function mapStateToProps(state:any) {
};
}
export default connect(mapStateToProps)(TitleSearch);
// time={["key","预订时间筛选"]}
// status = [{name:"status",data:["处理", "未处理"]}]
// listkey={['A', 'C']} list={['订单状态', '预订时间筛选']}
// <TitleSearch
// status={[{
// name: ["status", "订单状态"],
// data: [[0, "全部"], [1, "已申请"], [2, "已预订"], [3, "已使用"], [4, "已取消"]]
// }]}
// time={["key", "预订时间筛选"]}
// community={"communityName"}
// // single={true}
// onSubmit={CallBackTitleSearch} />
\ No newline at end of file
......@@ -44,13 +44,16 @@ class SecurityLayout extends React.Component<SecurityLayoutProps, SecurityLayout
// You can replace it to your authentication rule (such as check token exists)
// 你可以把它替换成你自己的登录认证规则(比如判断 token 是否存在)
console.log("是否已登录")
console.log("是否已登录"+login?.token)
// const isLogin = currentUser && currentUser.name;//isLogin为关键点
var isLogin = false
if (currentUser.name != null) {
isLogin=true
}
isLogin=true
isLogin = true
if ((login?.token).length==0) {
// isLogin=false
}
const queryString = stringify({
redirect: window.location.href,
});
......@@ -70,5 +73,6 @@ class SecurityLayout extends React.Component<SecurityLayoutProps, SecurityLayout
export default connect(({ user, loading,login}: ConnectState) => ({
currentUser: user.currentUser,
loading: loading.models.user,
login:login
login: login
}))(SecurityLayout);
import * as service from '../../services/tos';
import { message } from 'antd';
import { Link, useIntl, connect, Dispatch, history } from 'umi';
import { routerRedux } from 'dva/router'
......@@ -11,11 +12,12 @@ export default {
Data2: {data:[],total:0},
Data3: null,
Data4:null,
Data3Error: false,
Data3Error: null,
DataSave: null,
DataSaveDetail: null,
sourceData:null,
sourceData: null,
curString:{subscribeDate: null, status: null,curPage:1,curPage2:1}
},
reducers: {
......@@ -40,6 +42,10 @@ export default {
returnSource(state, { sourceData }) {
return { ...state, sourceData };
},
returnCurString(state, { curString }) {
return { ...state, curString };
},
},
......@@ -47,15 +53,28 @@ export default {
//预订设施查询
*RA({ playload }, { call, put }) {
console.log("发送请求")
const resp = yield call(service.RA, playload);
console.log(resp)
console.log(playload)
if (resp.code == 500||resp.error_code!="0000") {
// window.location.href = '/500';
}
if (resp.error_code != "0000") {
console.log("请求错误码:"+resp.error_code)
console.log("请求错误码:"+"("+playload.index+")" + resp.error_code)
console.log(playload)
var Data3Error = null
switch (playload.index) {
case 1:
// message.error("Could't not found the facility!")
Data3Error ={index:playload.index,msg:"Could't not found the facility!"};
yield put({ type: 'returnData3Error', Data3Error });
break;
case 11:
Data3Error ={index:playload.index,msg:"Information Wrong!"};
yield put({ type: 'returnData3Error', Data3Error });
break;
}
}
else {
switch (playload.index) {
......@@ -68,15 +87,10 @@ export default {
break;
case 1:
{
if (resp.error_code != "0000") {
let Data3Error =true;
yield put({ type: 'returnData3Error', Data3Error });
} else {
let Data3 = resp.data.categorieList;
var Data4 = { communityManagerFee: resp.data.communityManagerFee, communityMargin: resp.data.communityMargin };
console.log(Data4)
yield put({ type: 'returnPage3', Data3, Data4});
}
}break;
case 2:{
......@@ -86,9 +100,11 @@ export default {
case 3:
case 4:
case 5:
case 6: {
case 6:
case 11:{
message.success("Success Operation!",3)
window.location.href = '/CommunityManagement/FacilityBookings';
// window.location.href = '/CommunityManagement/FacilityBookings';
history.push("/CommunityManagement/FacilityBookings")
} break;
case 7: {
let tmp = resp.data;
......@@ -103,8 +119,10 @@ export default {
facilityName: tmp.facilityName,
nomarginCancelReservationDay: tmp.nomarginCancelReservationDay,
periodType: tmp.periodType,
reservationQuantumTime: tmp.reservationQuantumTime,
facilitiesImageList:tmp.facilitiesImageList
}
console.log(sourceData)
// console.log(sourceData)
yield put({ type: 'returnSource', sourceData });
} break;
case 8: {
......@@ -118,10 +136,12 @@ export default {
*IA({ playload }, { call, put }) {
var Data3 = null
let Data3Error = false;
yield put({ type: 'returnData3Error', Data3Error });
yield put({ type: 'returnPage3', Data3 });
},
*IA2({ playload }, { call, put }) {
var Data3Error = null
yield put({ type: 'returnData3Error', Data3Error });
},
*SA({ playload }, { call, put }) {
var DataSave = playload
......@@ -131,7 +151,13 @@ export default {
*CA({ playload }, { call, put }) {
var sourceData = playload
yield put({type: 'returnSource',sourceData})
}
},
*QA({ playload }, { call, put }) {
var curString = playload
yield put({type: 'returnCurString', curString} )
},
},
};
import * as service from '../../services/tos';
import { message } from 'antd';
import { Link, useIntl, connect, Dispatch, history } from 'umi';
import { routerRedux } from 'dva/router'
export default {
namespace: 'User',
state: {
Data: {data:[],total:0},
DataPage:{totalRow:0},
Data3Error: null,
DataSave: null,
DataSaveDetail: null,
sourceData: null,
curString:{subscribeDate: null, status: null,curPage:1,curPage2:1}
},
reducers: {
returnPage(state, { Data,DataPage,DataSave}) {
return { ...state, Data,DataPage,DataSave };
},
returnData3Error(state, { Data3Error }) {
return { ...state, Data3Error };
},
returnDataSave(state, { DataSave }) {
return { ...state, DataSave};
},
DataSaveDetail(state, { DataSaveDetail,}) {
return { ...state, DataSaveDetail };
},
returnSource(state, { sourceData }) {
return { ...state, sourceData };
},
returnCurString(state, { curString }) {
return { ...state, curString };
},
},
effects: {
//预订设施查询
*RA({ playload }, { call, put }) {
const resp = yield call(service.RA, playload);
console.log(resp)
if (resp.code == 500||resp.error_code!="0000") {
// window.location.href = '/500';
}
if (resp.error_code != "0000") {
console.log("请求错误码:"+"("+playload.index+")" + resp.error_code)
console.log(playload)
var Data3Error = null
switch (playload.index) {
case 11:
Data3Error ={msg:"Information Wrong!"};
yield put({ type: 'returnData3Error', Data3Error });
break;
}
}
else {
switch (playload.index) {
case 12:
{
let Data = resp.data;
yield put({ type: 'returnPage', Data});
}break;
case 14:{
message.success("Success Operation!",3)
// window.location.href = '/CommunityManagement/FacilityBookings';
history.push("/UserManagement/LIFEUserManagement")
} break;
case 13: {
let DataSaveDetail = resp.data;
yield put({ type: 'DataSaveDetail', DataSaveDetail});
}
}
}
},
*IA({ playload }, { call, put }) {
var Data3 = null
yield put({ type: 'returnPage3', Data3 });
},
*IA2({ playload }, { call, put }) {
var Data3Error = null
yield put({ type: 'returnData3Error', Data3Error });
},
*SA({ playload }, { call, put }) {
var DataSave = playload
yield put({type: 'returnDataSave', DataSave} )
},
*CA({ playload }, { call, put }) {
var sourceData = playload
yield put({type: 'returnSource',sourceData})
},
*QA({ playload }, { call, put }) {
var curString = playload
yield put({type: 'returnCurString', curString} )
},
},
};
......@@ -32,7 +32,7 @@ const Model: LoginModelType = {
state: {
status: undefined,
token: 'A',
token: '',
userName: '',
password:'',
},
......
import React, { useState, useEffect } from 'react';
import React, { useState, useEffect,useRef } from 'react';
import styles from './css/Bookings.less';
import { Input ,DatePicker,Button,message, Radio,TimePicker,Row, Col } from 'antd';
import { Spin,Input ,DatePicker,Button,Form, Radio,TimePicker,Row, Col,message} from 'antd';
const { RangePicker } = TimePicker;
import {connect } from 'umi';
......@@ -8,44 +8,114 @@ import {connect } from 'umi';
import TitleBack from '../../../components/TitleBack/TitleBack';
import SearchOptionsCommnity from '../../../components/SearchOptions/SearchOptionsCommnity';
import { numberToString } from '../../../utils/string';
const Bookings = (props:any) => {
const { dispatch, Data3,Data3Error,Data4,DataSave,token} = props;
const RA = (index:any,values: any) => { dispatch({ type: 'FacilityBookings/RA', playload: { index: index, body: values } }) };
const IA = () => { dispatch({ type: 'FacilityBookings/IA' }) };
const IA2 = () => { dispatch({ type: 'FacilityBookings/IA2' }) };
const [comminityValues, setComminityValues] = useState(null);
const [loading, setLoading] = useState(false);
const formRef = useRef(null);
useEffect(() => {
RA(1, { userToken: token, communityName: DataSave.communityName })
if (DataSave != null) {
console.log("页面进入参数")
console.log(DataSave)
setComminityValues(DataSave.communityName)
RA(1, { userToken: token, communityName: DataSave.communityName })
}
}, [DataSave]);
useEffect(() => {
IA()
}, []);
useEffect(() => {
if (Data3Error) {
message.error('Check the community name,no found facility!');
if (Data3Error != null) {
console.log(Data3Error)
message.error(Data3Error.msg);
if (Data3Error.index == 1) {
IA()
}
setLoading(false)
IA()
IA2()
}
}, [Data3Error]);
useEffect(() => {
setLoading(false)
if (Data3!=null) {
console.log(Data3)
}
}, [Data3]);
const changeRadio = () => {
}
const getFacility = (values: any) => {
setComminityValues(values)
console.log(values)
RA(1, { userToken: token, communityName: values })
setLoading(true)
}
const format="HH:mm"
const Mitime=(values:any) => {
console.log(values)
const format = "HH:mm"
const checkParam = (values: any) => {
var flag = true
for (var i in values) {
// console.log(values[i]);
if (values[i] == null) {
flag=false
} else {
if(values[i].length == 0){ flag=false}
}
}
return flag
}
const onFinish = (value:any) => {
console.log("Success:")
var tmp = value
console.log(value)
tmp.categoriesId = null
tmp.facilitiesId = null
tmp.communityName = null
tmp.communityManagerFee = null
tmp.communityMargin=null
if (value.categoriesName != null) {
tmp.categoriesId = value.categoriesName.categoriesId
tmp.facilitiesId=value.categoriesName.facilitiesId
tmp.categoriesName = value.categoriesName.categoriesName
}
if (value.subscribeDate!= null) {
tmp.subscribeDate=value.subscribeDate.format('YYYY-M-D')
}
if (value.reservedTimeList != null) {
tmp.reservedTimeList = [value.reservedTimeList[0].format('HH:mm'), value.reservedTimeList[1].format('HH:mm')]
}
if (comminityValues!=null) {
tmp.communityName=comminityValues
}
if (Data4 != null) {
tmp.communityManagerFee = numberToString(Data4.communityManagerFee)
tmp.communityMargin= numberToString(Data4.communityMargin)
}
//还差检测
if (checkParam(tmp)) {
console.log(tmp)
RA(11, tmp)
} else {
message.error("Error,Please finish it,not empty!",3)
}
// console.log(checkParam(tmp))
// console.log(comminityValues)
// console.log(tmp)
}
return (
<div className={styles.base}>
......@@ -55,39 +125,47 @@ const Bookings = (props:any) => {
<div className={styles.box1}>
<div className={styles.box1item1}>Project</div>
<div className={styles.box1item2}>
<Input.Search style={{ width: 200, height: 32 }} onSearch={getFacility} loading={loading} defaultValue={DataSave.communityName}/>
<Spin spinning={loading} tip="Finding...">
<SearchOptionsCommnity placeholder={"Community Name"} defaultValue={DataSave != null ? DataSave.communityName : null} onSubmit={getFacility} />
</Spin>
{/* <Input.Search style={{ width: 200, height: 32 }} onSearch={getFacility} loading={loading} defaultValue={}/> */}
</div>
</div>
{Data3 != null ?
<>
<Form ref={formRef} name="basic" onFinish={onFinish} >
<div className={styles.box2}>
<div className={styles.box2item1}>Facility Bookings</div>
<div className={styles.box2item2}>
<Radio.Group onChange={changeRadio} defaultValue={1}>
<div className={styles.box2item2}>
<Form.Item name="categoriesName" >
<Radio.Group defaultValue={1}>
{
Data3.map((item:any, index:any) => {
return (
<Radio key={"Radio_" + index} value={item.categoriesId}>{item.categoriesName}</Radio>
<Radio key={"Radio_" + index} value={item}>{item.categoriesName}</Radio>
)
})
}
</Radio.Group>
</Radio.Group>
</Form.Item>
</div>
</div>
<div className={styles.line}></div>
<div className={styles.box3}>
<div className={styles.box3item1}>User Name</div>
<div className={styles.box3item2}><Input style={{ width: 200 }} /></div>
<div className={styles.box3item2}><Form.Item name="accountName" ><Input style={{ width: 200 }} /></Form.Item></div>
<div className={styles.box3item3}>Contact Details</div>
<div className={styles.box3item4}><Input style={{ width: 200 }} /></div>
<div className={styles.box3item4}><Form.Item name="accountPhone" ><Input style={{ width: 200 }} /></Form.Item></div>
</div>
<div className={styles.box4}>
<div className={styles.box4item1}>Unit</div>
<div className={styles.box4item2}><Input style={{ width: 80 }} /></div>
<div className={styles.box4item2}><Form.Item name="buildNumber" ><Input placeholder="building" style={{ width: 80 }} /></Form.Item></div>
<div className={styles.box4item3}>#</div>
<div className={styles.box4item4}><Input style={{ width: 80 }} /></div>
<div className={styles.box4item4}><Form.Item name="floorNumber" ><Input placeholder="floor" style={{ width: 80 }} /></Form.Item></div>
<div className={styles.box4item5}>——</div>
<div className={styles.box4item6}><Form.Item name="roomNumber" ><Input placeholder="room" style={{ width: 80 }} /></Form.Item></div>
</div>
<div className={styles.line}></div>
......@@ -96,13 +174,13 @@ const Bookings = (props:any) => {
<div className={styles.box5item1}>Booking Schedule</div>
<div className={styles.box5item2}>
<Row gutter={8}>
<Col><DatePicker /></Col>
<Col><RangePicker onChange={Mitime} format={format}/></Col>
<Col><Form.Item name="subscribeDate" ><DatePicker /></Form.Item></Col>
<Col><Form.Item name="reservedTimeList" ><RangePicker format={format}/></Form.Item></Col>
</Row>
</div>
</div>
<div className={styles.box6}>
{/* <div className={styles.box6}>
<div className={styles.box6item1}>Management fee required</div>
<div className={styles.box6item2}>${Data4.communityManagerFee}</div>
</div>
......@@ -110,9 +188,10 @@ const Bookings = (props:any) => {
<div className={styles.box6}>
<div className={styles.box6item1}>Deposit is required</div>
<div className={styles.box6item2}>${Data4.communityMargin}</div>
</div>
</div> */}
<div className={styles.line}></div><Button type="primary" style={{ width: 80, height: 32 }}>提交</Button>
<div className={styles.line}></div><Button htmlType="submit" type="primary" style={{ width: 80, height: 32 }}>Submit</Button>
</Form>
</> : null
}
</div>
......
......@@ -10,6 +10,7 @@ import Line from '../../../components/Line/Line';
import { timestampToTime3 } from '../../../utils/time';
import TextArea from 'antd/lib/input/TextArea';
import {getUrlLast} from '../../../utils/string';
const Detail = (props:any) => {
......@@ -25,7 +26,7 @@ const Detail = (props:any) => {
const statusDes = ["全部", "已申请", "已预订", "已使用", "已取消", "已完成"]
const [modalVisible,setModalVisible]=useState(false)
const [modalItem,setModalIteme]=useState({title:"",tab:1})
const [backFeeFlag, setBackFeeFlag] = useState(false)
const [curbackFee, setCurBackFee] = useState(0)
useEffect(() => {
......@@ -66,24 +67,30 @@ const Detail = (props:any) => {
setCurBackFee(e.target.value)
}
const makeFee = () => {
var RAVAL = {
accountCategoriesId: DataSave.id,
accountName: DataSave.accountName,
managerFee:(DataSaveDetail.managerFee).toString(),
marginFee:(DataSaveDetail.marginFee).toString()
}
RA(4,RAVAL)
setModalIteme({title:"Deposit And Fee",tab:2})
setModalVisible(true)
}
const showModal = () => {
setModalVisible(true)
setModalIteme({title:"Cancel Reservation",tab:1})
setModalVisible(true)
};
const handleOk = (e:any) => {
setModalVisible(false)
var RAVAL = {
accountCategoriesId: DataSave.id,
userToken: token,
if (modalItem.tab == 1) {
var RAVAL = {
accountCategoriesId: DataSave.id,
userToken: token,
}
RA(5, RAVAL)
} else {
var RAVAL2 = {
accountCategoriesId: DataSave.id,
accountName: DataSave.accountName,
managerFee:(DataSaveDetail.managerFee).toString(),
marginFee:(DataSaveDetail.marginFee).toString()
}
RA(4,RAVAL2)
}
RA(5,RAVAL)
};
const handleCancel = (e:any) => {
setModalVisible(false)
......@@ -167,9 +174,13 @@ const Detail = (props:any) => {
: null
}
<Modal okText="Yes" cancelText="No" title="Cancel Reservation" visible={modalVisible} onOk={handleOk} onCancel={handleCancel}>
<p>Are you sure you want to cancel the booking {DataSave.subscribeDate} {DataSave.subscribeTime} {DataSave.facilityTitle}</p>
</Modal>
<Modal okText="Yes" cancelText="No" title={modalItem.title} visible={modalVisible} onOk={handleOk} onCancel={handleCancel}>
{
modalItem.tab == 1 ?<p>Are you sure you want to cancel the booking {DataSave.subscribeDate} ,{DataSave.subscribeTime}, {DataSave.facilityTitle}</p>
:<p>Are you sure you confirm the payment of {DataSave.subscribeDate} {DataSave.subscribeTime} {DataSave.facilityTitle}</p>
}
</Modal>
</div>
......
......@@ -20,17 +20,16 @@ import { getUrlLastParams } from '../../../utils/string';
const FacilityBookings = (props:any) => {
const { formatMessage } = useIntl();
const { dispatch, location, Data, Data2, token,DataSave } = props;
const { dispatch, location, Data, Data2, token,DataSave,curString } = props;
const RA = (index:any,values: any) => { dispatch({ type: 'FacilityBookings/RA', playload: {index:index, body:values } }) };
const SA = (values: any) => { dispatch({ type: 'FacilityBookings/SA', playload: values }) };
const QA = (values: any) => { dispatch({ type: 'FacilityBookings/QA', playload: values }) };
const CA = () => { dispatch({ type: 'FacilityBookings/CA', playload: null }) };
const [tab, setTab] = useState(location.query.Facility == "true" ? 2 : 1)
const [curSearchString,setCurSearchString]=useState({subscribeDate:null,status:null,curPage:null})
const [curPage2, setCurPage2] = useState(1)
const [loading, setLoading] = useState(false)
const [columns, setColumns] = useState([])
......@@ -40,23 +39,10 @@ const FacilityBookings = (props:any) => {
if(tab==2){CA()}
history.push(location.pathname + (tab==1?'/Booking':'/Adding'))
}
const savePageAll = (values:any) => {
var tmp = values;
tmp.curSearchString = curSearchString
return tmp
}
function doing(){
console.log(curSearchString)
}
function test(values:any) {
console.log(values)
}
const goToDetail = (values:any) => {
console.log("跟踪对象")
console.log(curSearchString)
// SA(savePageAll(values))
// history.push(location.pathname + '/Detail')
SA(values)
console.log(values)
history.push(location.pathname + '/Detail')
}
const makeOperator = (values: any,index:any, e: any) => {
......@@ -65,6 +51,7 @@ const FacilityBookings = (props:any) => {
history.push(location.pathname + path[index])
}
useEffect(() => {
......@@ -79,7 +66,7 @@ const FacilityBookings = (props:any) => {
["Deposit", "marginFeeStatus",(text: any) => (<div>{marginFeeStatusDes[text]}</div>)],
["Status", "status",(text: any) => (<div>{statusDes[text]}</div>)],
["Actions",null, (text: any, record: any) => (<Space size="middle"> <Button onClick={test.bind(this,curSearchString)}>Detail</Button></Space>)],
["Actions",null, (text: any, record: any) => (<Space size="middle"> <a onClick={goToDetail.bind(this,record)}>Detail</a></Space>)],
]
const key2 = [
["小区", "communityName"],
......@@ -92,73 +79,70 @@ const FacilityBookings = (props:any) => {
</Space>)]
]
setColumns(objectColumns(key))
setColumns2(objectColumns(key2))
console.log("核心排查")
setColumns2(objectColumns(key2))
console.log("页面刷新")
console.log(DataSave)
console.log(curString)
if (tab == 1) {
RA(9, { userToken: token, pageNum: curString.curPage, subscribeDate: curString.subscribeDate, status: curString.status })
} else {
RA(8,{ userToken: token, pageNum: curString.curPage2 })
}
},[]);
useEffect(() => {
setLoading(false)
}, [Data]);
}, [Data,Data2]);
// useEffect(() => {
// console.log(location)
// if (location.query.type != null) {
// setCurSearchString(DataSave.curSearchString)
// RA(9, { userToken: token, pageNum: DataSave.curSearchString.curPage, subscribeDate: DataSave.curSearchString.subscribeDate, status: DataSave.curSearchString.status })
// }else {
// RA(0, { userToken: token, pageNum: 1 })
// }
// },[location])
const CallBackTitleSearch= (comment: any) => {
if (tab == 1) {
if (comment.communityName != null || comment.key != null || comment.status != null) {
console.log("搜索跟踪对象")
setCurSearchString({ subscribeDate: comment.key, status: comment.status,curPage:1})
RA(9, { userToken: token, pageNum: "1", subscribeDate: comment.key, status: comment.status })
var tmp = curString
tmp.subscribeDate = comment.key
if (comment.status == null||comment.status==undefined) {
tmp.status = 0;
} else {
tmp.status = comment.status
}
tmp.curPage=1
QA(tmp)
RA(9, { userToken: token, pageNum: "1", subscribeDate: tmp.subscribeDate, status: tmp.status,communityNameList:comment.communityName })
}
} else {
RA(8, {
"communityNameList":comment.communityName,
"facilityName":"",
"pageNum":"1"
})
if (comment.communityName != null || comment.facilityName != null) {
var tmp = curString
tmp.communityName = comment.communityName
tmp.facilityName = comment.facilityName
tmp.curPage=1
QA(tmp)
RA(8, {communityNameList: comment.communityName, facilityName: comment.facilityName, pageNum: "1"})
}
}
}
function TabCallback(tab: any) {
setTab(tab)
setLoading(true)
if (tab == 1) {
if (curSearchString.subscribeDate != null || curSearchString.status != null) {
RA(9, { userToken: token, pageNum: curSearchString.curPage, subscribeDate: curSearchString.subscribeDate, status: curSearchString.status })
} else {
RA(0, { userToken: token, pageNum: "1" })
}
RA(9, { userToken: token, pageNum: curString.curPage, subscribeDate: curString.subscribeDate, status: curString.status })
} else {
RA(8,{ userToken: token, pageNum: "1" })
RA(8,{ userToken: token, pageNum: curString.curPage2 })
}
}
function Pagechange(current: any, pageSize: any) {
setLoading(true)
if (tab == 1) {
var tmp = curSearchString
console.log("页面跟踪对象")
console.log(curSearchString)
var tmp = curString
tmp.curPage = current
console.log(tmp)
// setCurSearchString(tmp)
if (curSearchString.subscribeDate != null || curSearchString.status != null) {
// SA(savePageAll({}))
// RA(9, { userToken: token, pageNum: current, subscribeDate: curSearchString.subscribeDate, status: curSearchString.status })
} else {
RA(0, { userToken: token, pageNum: current })
}
QA(tmp)
RA(9, { userToken: token, pageNum: current, subscribeDate: curString.subscribeDate, status: curString.status })
} else {
setCurPage2(current)
var tmp = curString
tmp.curPage2 = current
QA(tmp)
RA(8, { userToken: token, pageNum: current })
}
}
......@@ -168,26 +152,38 @@ const FacilityBookings = (props:any) => {
return (
<div className={styles.base}>
{/* 头部组件 */}
<TitleSearch
status={[{ name: ["status", "订单状态"], data: [[0, "全部"], [1, "已申请"], [2, "已预订"], [3, "已使用"], [4, "已取消"]] }]}
{
tab == 1 ?
<>
<TitleSearch
status={[{
name: ["status", "订单状态"],
data: [[0, "全部"], [1, "已申请"], [2, "已预订"], [3, "已使用"], [4, "已取消"]]
}]}
time={["key", "预订时间筛选"]}
community={"communityName"}
onSubmit={CallBackTitleSearch} />
</> :
<>
<TitleSearch
listkey={['facilityName']} list={['设施名称']}
community={"communityName"}
// single={true}
onSubmit={CallBackTitleSearch} />
</>
}
<div style={{position:"relative",height:40}}>
<Button type="primary" style={{ position: "absolute", right: 0 }} onClick={goToFunction}>{tab==1?"Booking":"Add Facility"}</Button>
</div>
<Button type="primary" onClick={doing}>test</Button>
<Button type="primary" onClick={test.bind(this,curSearchString)}>test2</Button>
<Tabs defaultActiveKey={tab.toString()} onChange={TabCallback}>
<TabPane tab="Facility Bookings" key="1">
<Table loading={loading} rowKey="id" style={{ marginTop: 16 }} dataSource={Data.data } columns={columns} pagination={{ current: curSearchString.curPage, total: Data.total.totalRow, showSizeChanger: false, onChange:Pagechange }} />
<TabPane tab="Facility Bookings" key="1">
<Table loading={loading} rowKey="id" style={{ marginTop: 16 }} dataSource={Data.data } columns={columns} pagination={{ current: curString.curPage, total: Data.total.totalRow, showSizeChanger: false, onChange:Pagechange }} />
</TabPane>
<TabPane tab="Facility Management" key="2">
<Table rowKey="id" style={{ marginTop: 16 }} dataSource={Data2.data} columns={columns2} pagination={{ current: curPage2, total: Data2.total.totalRow, showSizeChanger: false, onChange: Pagechange }} />
<Table loading={loading} rowKey="id" style={{ marginTop: 16 }} dataSource={Data2.data} columns={columns2} pagination={{ current: curString.curPage2, total: Data2.total.totalRow, showSizeChanger: false, onChange: Pagechange }} />
</TabPane>
</Tabs>
......@@ -196,13 +192,14 @@ const FacilityBookings = (props:any) => {
};
function mapStateToProps(state:any) {
const { Data, DataPage, Data2,DataSave } = state.FacilityBookings;
const { Data, DataPage, Data2,DataSave,curString } = state.FacilityBookings;
const { token } = state.login;
return {
Data,
DataPage,
Data2,
DataSave,
curString,
token
};
}
......
import React, { useState, useEffect,useRef } from 'react';
import styles from './css/index.less';
import { Input ,Upload,Modal,Button,Space,Pagination,Tooltip, Radio, Form,Row, Col,Select, message } from 'antd';
import { Input ,InputNumber,Modal,Button,Space,Pagination,Tooltip, Radio, Form,Row, Col,Select, message } from 'antd';
const { Option } = Select;
import { Link, useIntl, connect, Dispatch,history } from 'umi';
......@@ -11,13 +11,16 @@ import PictureOptionsRow from '../../../components/PictureOptions/PictureOptions
import TitleBack from '../../../components/TitleBack/TitleBack';
import TimeSelect from '../../../components/TimeSelect/TimeSelect';
import Line from '../../../components/Line/Line';
import { getNumber } from '../../../utils/string';
import SearchOptionsCommnity from '../../../components/SearchOptions/SearchOptionsCommnity';
// categoriesDetailsImageName: ["test.jpg"],
// categoriesName: ["篮球场A&test.jpg"],
// reservationQuantumTime: ["09:00-07:00"]
import { getUrlLast } from '../../../utils/string'
import { getUrlLast,numberToString } from '../../../utils/string'
const FacilityManager = (props:any) => {
......@@ -30,88 +33,116 @@ const FacilityManager = (props:any) => {
const [Ref3, setRef3] = useState([])
const [extend, setExtend] = useState(null)
const [timeExtend, setTimeExtend] = useState(null)
const [pictrueExtend,setPictrueExtend]=useState({pic:null,pics:null})
const [facilityDetail, setFacilityDetail] = useState(false)
const [PATHNAME, setPATHNAME] = useState("")
const formRef = useRef(null);
const RA_S= () => {
RA(7, {
"userToken":token,
"facilitieId":DataSave.id
});
const picFromate = (values: any) => {
var result=new Array()
if (values != null) {
values.map((item, index) => {
result.push({ url: item })
})
}
console.log(result)
return result
}
const RA_S = () => {
if (DataSave != null) {
console.log("请求的设施ID为:"+ DataSave.id)
RA(7, {
"userToken": token,
"facilitieId": DataSave.id
});
} else {
history.go(-1)
}
}
useEffect(() => {
if (sourceData != null) {
console.log("当前数据不为空")
console.log(sourceData)
console.log(sourceData)
setExtend(sourceData.communityName)
setTimeExtend(sourceData.reservationQuantumTime)
// 中断
// var data=sourceData.facilitiesImageList
var data=["https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"]
setPictrueExtend({tab:null,pic:null,pics:picFromate()})
formRef.current.setFieldsValue(sourceData)
}
}, [sourceData])
useEffect(() => {
console.log("init one")
console.log(DataSave)
useEffect(() => {
var tmp=pictrueExtend
if ((location.pathname).indexOf("FacilityEdit") > -1) {
setPATHNAME("Edit Facility")
tmp.tab=1
setPictrueExtend(tmp)
RA_S()
}
else if ((location.pathname).indexOf("FacilityDetail") > -1) {
setFacilityDetail(true)
tmp.tab=2
setPictrueExtend(tmp)
setPATHNAME("Facility Detail")
RA_S()
} else {
tmp.tab=3
setPictrueExtend(tmp)
setPATHNAME("Add Facility")
}
// history.push(location.pathname +'/Detail?providerName='+values.providerName)
},[])
const PictureOptionsRef = (values:any) => {
console.log(values)
// console.log(values)
setRef1(values)
}
const TimeSelectRef = (values:any) => {
console.log(values)
// console.log(values)
setRef3(values)
}
const PictureOptionsRowRef = (values:any) => {
console.log(values)
// console.log(values)
setRef2(values)
}
const checkParam = (values: any) => {
var flag = true
for (var i in values) {
console.log(values[i]); //111,222,333,444
console.log(values[i]);
if (values[i] == null) {
flag=false
} else {
if(values[i].length == 0){ flag=false}
}
}
}
// for (var item in values) {
// if (typeof (values[item]) == "string") {
// if (values[item] == null || values[item].length == 0) {
// flag = false
// }
// } else if (typeof (values[item]) == "object") {
// if (values[item] == null || values[item].length == 0) {
// flag = false
// }
// }
// }
return flag
}
const onFinish = (values: any) => {
var result = values
result.communityName=extend
result.categoriesName= Ref1
result.categoriesDetailsImageName= Ref2
result.reservationQuantumTime = Ref3
result.categoriesOpenTime="09:00-20:00"
result.categoriesOpenTime = "09:00-20:00"
if (result.communityManagerFee == null) {
result.communityManagerFee=numberToString(0)
} else {
result.communityManagerFee=numberToString(result.communityManagerFee)
}
if (result.communityMargin == null) {
result.communityMargin=numberToString(0)
} else {
result.communityMargin=numberToString(result.communityMargin)
}
console.log('Should be check:', result);
if (checkParam(result)) {
console.log('Success:', result);
//中断
RA(6, values);
}else{message.error("Error,Please finish it,not empty!",3)}
};
......@@ -125,6 +156,37 @@ const FacilityManager = (props:any) => {
const Subscribe = () => {
history.push(getUrlLast(location.pathname)+ "/FacilityApply")
}
const keyup_tool=(value: any)=>{
return getNumber(value.replace(/[^\d^\.]+/g, '') )
}
const keyup_tool2=(value: any)=>{
return value.replace(/[^\d^\.]+/g, '')
}
const keyup_communityManagerFee = (e: any) => {
e.target.value =keyup_tool(e.target.value)
formRef.current.setFieldsValue({communityManagerFee:e.target.value})
}
const keyup_communityMargin = (e: any) => {
e.target.value =keyup_tool(e.target.value)
formRef.current.setFieldsValue({communityMargin:e.target.value})
}
const keyup_cancelReservationDay = (e: any) => {
e.target.value =keyup_tool2(e.target.value)
formRef.current.setFieldsValue({cancelReservationDay:e.target.value})
}
const keyup_nomarginCancelReservationDay = (e: any) => {
e.target.value =keyup_tool2(e.target.value)
formRef.current.setFieldsValue({nomarginCancelReservationDay:e.target.value})
}
const keyup_canReservationDay = (e: any) => {
e.target.value =keyup_tool2(e.target.value)
formRef.current.setFieldsValue({canReservationDay:e.target.value})
}
const keyup_canReservationNum = (e: any) => {
e.target.value =keyup_tool2(e.target.value)
formRef.current.setFieldsValue({canReservationNum:e.target.value})
}
return (
<div className={styles.base}>
......@@ -134,36 +196,67 @@ const FacilityManager = (props:any) => {
<Row gutter={32}>
<Col>所属小区</Col>
<Col> <Form.Item name="communityName" ><Input onChange={extendName} disabled={facilityDetail}/></Form.Item></Col>
<Col><SearchOptionsCommnity defaultValue={extend} onSubmit={extendName} /></Col>
</Row>
<Row gutter={32} style={{marginTop:28}}>
<Col>设施名称</Col>
<Col><Form.Item name="facilityName" ><Input disabled={facilityDetail}/></Form.Item></Col>
<Col>费用</Col>
<Col><Form.Item name="communityManagerFee" ><Input placeholder="$00.00" disabled={facilityDetail}/></Form.Item></Col>
<Col><Form.Item name="facilityName" ><Input placeholder="Facility Name" disabled={facilityDetail}/></Form.Item></Col>
<Col>费用($)</Col>
<Col><Form.Item name="communityManagerFee" ><Input onKeyUp={keyup_communityManagerFee} prefix="$" placeholder="00.00" disabled={facilityDetail} allowClear/></Form.Item></Col>
<Col>押金</Col>
<Col><Form.Item name="communityMargin" ><Input placeholder="$00.00" disabled={facilityDetail}/></Form.Item></Col>
<Col><Form.Item name="communityMargin" ><Input onKeyUp={keyup_communityMargin} prefix="$" placeholder="00.00" disabled={facilityDetail} allowClear/></Form.Item></Col>
</Row>
<Row gutter={32} style={{marginTop:28}}>
<Col>设施品类</Col>
<Col><PictureOptions disabled={facilityDetail} defultValue={[{ url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png", name: "篮球场A"},{ url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png", name: "篮球场B" }]} putSubmit={PictureOptionsRef}
data={{
userToken: token,
imageType: 'categoriesImageName',
extend: extend,
}} />
</Col>
<Row gutter={32} style={{ marginTop: 28 }}>
{
extend != null ?
<><Col>设施品类</Col>
<Col><PictureOptions disabled={facilityDetail} defultValue={[]} putSubmit={PictureOptionsRef}
data={{
userToken: token,
imageType: 'categoriesImageName',
extends: extend,
}} />
</Col>
</> : null
}
</Row>
<Row gutter={32} style={{marginTop:28}}>
<Col>设施详情</Col>
<Col><PictureOptionsRow disabled={facilityDetail} putSubmit={PictureOptionsRowRef} data={{
userToken: token,
imageType: 'categoriesImageName',
extend: extend,
}}
defultValue={[{ url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" }]} /></Col>
<Row gutter={32} style={{ marginTop: 28 }}>
{
extend != null ?
<Col>设施详情</Col>
:null
}
{/* 未完成 */}
<Col>
{
pictrueExtend.pics!=null
?
<PictureOptionsRow disabled={facilityDetail} putSubmit={PictureOptionsRowRef} data={{
userToken: token,
imageType: 'categoriesImageName',
extends: extend,
}}
defultValue={pictrueExtend.pics} />
:null
}
{
pictrueExtend.tab == 3 ? <>
{
extend != null ?
<PictureOptionsRow disabled={facilityDetail} putSubmit={PictureOptionsRowRef} data={{
userToken: token,
imageType: 'categoriesImageName',
extends: extend,
}}/>
:null
}
</>
:null
}
</Col>
</Row>
<Line />
<Row gutter={32} style={{marginTop:28}}>
......@@ -175,28 +268,28 @@ const FacilityManager = (props:any) => {
<Col>预约设置</Col>
<Col>
<Row gutter={100}>
<Col><Form.Item name="cancelReservationDay" label="提前取消预订"><Input placeholder="取消预订" style={{width:160}} disabled={facilityDetail}/></Form.Item></Col>
<Col><Form.Item name="nomarginCancelReservationDay" label="不交押金,自动取消预订"><Input placeholder="不交押金,取消预订" style={{width:160}} disabled={facilityDetail}/></Form.Item></Col>
<Col><Form.Item name="canReservationDay" label="可提前预订"><Input placeholder="可预订" style={{width:160}} disabled={facilityDetail}/></Form.Item></Col>
<Col><Form.Item name="cancelReservationDay" label="提前取消预订"><Input onKeyUp={keyup_cancelReservationDay} placeholder="取消预订" style={{width:160}} disabled={facilityDetail} suffix="Day"/></Form.Item></Col>
<Col><Form.Item name="nomarginCancelReservationDay" label="不交押金,自动取消预订"><Input onKeyUp={keyup_nomarginCancelReservationDay} placeholder="不交押金,取消预订" style={{width:160}} disabled={facilityDetail} suffix="Day"/></Form.Item></Col>
<Col><Form.Item name="canReservationDay" label="可提前预订"><Input onKeyUp={keyup_canReservationDay} placeholder="可预订" style={{width:160}} disabled={facilityDetail} suffix="Day"/></Form.Item></Col>
</Row>
<Row gutter={8}>
<Col>
<Form.Item name="periodType" label="预约周期">
<Select placeholder="period" allowClear style={{width:120}} disabled={facilityDetail}>
<Option value="1">Day</Option>
<Option value="1">Week</Option>
<Option value="2">Month</Option>
<Option value="3">Year</Option>
</Select>
</Form.Item>
</Col>
<Col><Form.Item name="canReservationNum" ><Input placeholder="times" style={{width:80}} disabled={facilityDetail}/></Form.Item></Col>
<Col><Form.Item name="canReservationNum" ><Input onKeyUp={keyup_canReservationNum} placeholder="times" style={{width:120}} disabled={facilityDetail} suffix="Times"/></Form.Item></Col>
</Row>
</Col>
</Row>
<Row gutter={32} style={{ marginTop: 28 }}>
<Col>预约时段</Col>
<Col><TimeSelect putSubmit={TimeSelectRef} defaultValue={["08:00-20:00"]} disabled={facilityDetail}/></Col>
<Col><TimeSelect putSubmit={TimeSelectRef} defaultValue={timeExtend} disabled={facilityDetail}/></Col>
</Row>
{
facilityDetail ? <><Line /><Button type="primary" onClick={Subscribe}>Subscribe</Button></> :
......@@ -209,7 +302,7 @@ const FacilityManager = (props:any) => {
};
function mapStateToProps(state:any) {
const {sourceData,DataSave } = state.FacilityBookings;
const { sourceData, DataSave } = state.FacilityBookings;
const { token } = state.login;
return {
DataSave,
......@@ -233,4 +326,5 @@ export default connect(mapStateToProps)(FacilityManager);
// facilityName: "篮球场",
// nomarginCancelReservationDay: "4",
// periodType: "2",
// }
\ No newline at end of file
// }
......@@ -128,6 +128,15 @@
position: absolute;
left: 281px;
}
.box4item5{
position: absolute;
left: 365px;
}
.box4item6{
position: absolute;
left: 380px;
}
.box5{
......
......@@ -8,19 +8,14 @@ import { Link, useIntl, connect, Dispatch, history } from 'umi';
import TitleSearch from '../../../components/TitleSearch/TitleSearch';
const dataSource = [
{
key: '1',
name: '胡彦斌',
age: 32,
address: '西湖区湖底公园1号',
},
];
import { timestampToTime } from '../../../utils/time';
const Users = (props: { location: any; }) => {
const Users = (props:any) => {
const { formatMessage } = useIntl();
const { location } = props;
const { dispatch, location,Data,CommunityList} = props;
const RA = (index: any, values: any) => { dispatch({ type: 'User/RA', playload: { index: index, body: values } }) };
const SA = (values: any) => { dispatch({ type: 'User/SA', playload: values}) };
const nameofowner = formatMessage({ id: 'R.charge.input.nameofowner' })
const inputProject = formatMessage({ id: 'R.charge.input.project' })
......@@ -34,13 +29,27 @@ const Users = (props: { location: any; }) => {
const addaccount = formatMessage({ id: 'R.charge.addaccount' })
const paymentsetting = formatMessage({ id: 'R.charge.paymentsetting' })
const menuListNormal = ["A",'Accounting company']
const [display, setDisplay] = useState("A");//小组件:线框
const pagination={defaultCurrent:1,total: 16}
const goToDetail = () => {
history.push(location.pathname+'/Detail?id=123')
const [curString,setCurString]=useState({defaultCurrent:1,total: 0})
useEffect(() => {
// console.log(CommunityList )
if (CommunityList != null) {
RA(12, {
ownerName: null,
communityArray: CommunityList
});
}
},[CommunityList])
useEffect(() => {
if (Data != null) {
var tmp = curString
tmp.total=Data.total
setCurString(tmp)
}
},[Data])
const goToDetail = (values:any,e:any) => {
SA(values)
history.push(location.pathname+'/Detail')
}
const goToEdit = () => {
history.push(location.pathname+'/Edit')
......@@ -51,37 +60,15 @@ const Users = (props: { location: any; }) => {
}
const columns = [
{
title: username,
dataIndex: 'name',
key: 'name',
},
{
title: project,
dataIndex: 'age',
key: 'age',
},
{
title: unit,
dataIndex: 'address',
key: 'address',
},
{
title: status,
dataIndex: 'address',
key: 'address',
},
{
title: submissionTime,
dataIndex: 'address',
key: 'address',
},
{
title: actions,
key: 'action',
{ title: username, dataIndex: 'owerName', },
{title: project,dataIndex: 'communityName',},
{title: unit,render:(text: any, record: any) => (<div>{record.buildingNumber+"#"+record.floorNumber+"—"+record.roomNumber}</div>)},
{title: status,dataIndex: 'enable'},
{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={goToDetail}>Detail</a>
<a onClick={goToDetail.bind(this,record)}>Detail</a>
</Space>
),
},
......@@ -89,6 +76,10 @@ const Users = (props: { location: any; }) => {
const CallBackTitleSearch = (comment: any)=>{
console.log(comment)
RA(12, {
ownerName: comment.OwnerName,
communityArray: comment.serviceCommunityList
});
}
return (
......@@ -96,8 +87,8 @@ const Users = (props: { location: any; }) => {
{/* 头部组件 */}
<TitleSearch
listkey={["providerName"]}
list={["Service Provider"]}
listkey={["OwnerName"]}
list={["Owner Name"]}
community={"serviceCommunityList"}
onSubmit={CallBackTitleSearch} />
......@@ -108,12 +99,28 @@ const Users = (props: { location: any; }) => {
</div>
{/* 列表组件 */}
<Table style={{ marginTop: 16 }} dataSource={dataSource} columns={columns} pagination={pagination} />
{
Data != null ?
<Table rowKey={"id"} style={{ marginTop: 16 }} dataSource={Data.rows} columns={columns} pagination={curString} />
:null
}
</div>
);
};
export default Users;
function mapStateToProps(state:any) {
const { sourceData, DataSave,Data } = state.User;
const { token } = state.login;
const { CommunityList } = state.Init;
return {
Data,
DataSave,
sourceData,
// token
CommunityList,
};
}
export default connect(mapStateToProps)(Users);
......@@ -54,6 +54,25 @@
left: 146px;
}
.box4{
width: 100%;
height: 34px;
line-height: 34px;
position: relative;
margin-bottom: 28px;
}
.box4item0{
position: absolute;
}
.box4item1{
position: absolute;
left: 146px;
}
.box4item2{
position: absolute;
left: 346px;
}
.box2{
width: 100%;
height: 34px;
......
import React, { useState, useEffect } from 'react';
import React, { useState, useEffect,useRef } from 'react';
import styles from './UsersAdd.less';
import { Input ,Menu,Table,Space,Pagination,Tooltip, Button } from 'antd';
import { Input ,Menu,Table,Space,Pagination,Tooltip, Button,Form,Row,Col, message} from 'antd';
import { Link, useIntl, connect, Dispatch } from 'umi';
import Line from '../../../components/Line/Line';
import TitleBack from '../../../components/TitleBack/TitleBack';
import SearchOptionsCommnity from '../../../components/SearchOptions/SearchOptionsCommnity';
import { checkParam } from '../../../utils/method'
const UsersAdd = (props:any) => {
const UsersAdd = () => {
const { dispatch} = props;
const gotoReturn=() => {
history.back()
}
const RA = (index: any, values: any) => { dispatch({ type: 'User/RA', playload: { index: index, body: values } }) };
// const [] = props;
const [postman,setPostman]=useState({extend:null})
const formRef = useRef(null);
const onFinish=(values:any) => {
if (postman.extend != null) {
values.communityName = postman.extend
} else {
values.communityName=null
}
var tmp = Object.keys(values);
console.log("添加业主提交的参数:" + tmp.length)
console.log(values)
if (checkParam(values)) {
RA(14,values)
} else {
message.error("Error,Please finish it,not empty!",3)
}
}
const extendName = (values: any) => {
var tmp = postman
tmp.extend=values
setPostman(tmp)
}
const checkInput = (e: any) => {
console.log(e)
if (e.target.value.length == 1) {
message.error("Ower Name Should be limit 2~33!",3)
}
}
return (
<div className={styles.base}>
{/* 头部组件 */}
<div className={styles.box}>
<div className={styles.item1}>Create New Owner</div>
<button className={styles.item3} onClick={gotoReturn}>返回</button>
</div>
<TitleBack title={"Create New Owner"} />
<Form ref={formRef} name="basic" onFinish={onFinish}>
<div className={styles.box1}>
<div className={styles.box1item1}>Owner's Name</div>
<div className={styles.box1item2}><Input style={{width:200}} placeholder="Single Line Input" /></div>
<div className={styles.box1item2}><Form.Item name="owerName" ><Input placeholder="Ower Name" onBlur={checkInput} maxLength={33}/></Form.Item></div>
</div>
<div className={styles.box4}>
<div className={styles.box4item0}>Contact Details</div>
<div className={styles.box4item1}><Form.Item name="owerPhone" ><Input placeholder="Phone Number" /></Form.Item></div>
<div className={styles.box4item2}><Form.Item name="owerEmail" ><Input placeholder="Email" /></Form.Item></div>
</div>
<div className={styles.box2}>
<div className={styles.box2item1}>Contact Details</div>
<div className={styles.box2item2}><Input.Search style={{width:200}} placeholder="Project Name"/></div>
<div className={styles.box2item3}><Input style={{width:94}}/></div>
{/* <div className={styles.box2item1}>Contact Details</div> */}
<div className={styles.box2item2}><SearchOptionsCommnity onSubmit={extendName} /></div>
<div className={styles.box2item3}><Form.Item name="buildingNumber"><Input placeholder="Building" style={{width:94}}/></Form.Item></div>
<div className={styles.box2item4}>#</div>
<div className={styles.box2item5}><Input style={{width:80}} /></div>
<div className={styles.box2item5}><Form.Item name="floorNumber" ><Input placeholder="Floor" style={{width:80}} /></Form.Item></div>
<div className={styles.box2item6}>——</div>
<div className={styles.box2item7}><Input style={{width:112}}/></div>
<div className={styles.box2item7}><Form.Item name="roomNumber"><Input placeholder="Room" style={{width:112}}/></Form.Item></div>
</div>
<div className={styles.box3}>
<div className={styles.box3item1}>
<Input style={{width:680}} placeholder="Display the address and postcode automatically according to the"/>
<Form.Item name="addressAndpostalCode"><Input style={{width:680}} placeholder="Display the address and postcode automatically according to the"/></Form.Item>
</div>
</div>
</div>
<Line />
<Form.Item ><Button type="primary" htmlType="submit">Submit</Button></Form.Item>
</Form>
<Line />
<Button type="primary" size="large">Submit</Button>
</div>
);
};
function mapStateToProps(state:any) {
const { DataSave } = state.User;
return {
DataSave,
export default UsersAdd;
};
}
export default connect(mapStateToProps)(UsersAdd);
// "owerName":"孟浩",
// "owerPhone":"18813787878",
// "owerEmail":"sale@huahuico.com",
// "communityName":"A7",
// "buildingNumber":"A1",
// "floorNumber":"11",
// "roomNumber":"388",
// "addressAndpostalCode":"工业大道3689561"
\ No newline at end of file
import React, { useState, useEffect,useRef } from 'react';
import { Input ,Tabs,Table,Space,Pagination,Tooltip, Button,Form,Row,Col, message} from 'antd';
const { TabPane } = Tabs;
import { Link, useIntl, connect, Dispatch } from 'umi';
import styles from './UsersAdd.less';
import Line from '../../../components/Line/Line';
import TitleBack from '../../../components/TitleBack/TitleBack';
import SearchOptionsCommnity from '../../../components/SearchOptions/SearchOptionsCommnity';
import { checkParam } from '../../../utils/method'
import { values } from 'lodash';
const UsersDetail = (props:any) => {
const { dispatch,DataSave,DataDetail} = props;
const RA = (index: any, values: any) => { dispatch({ type: 'User/RA', playload: { index: index, body: values } }) };
const [postman,setPostman]=useState({extend:null,tab:1})
const formRef = useRef(null);
const onFinish=(values:any) => {
if (postman.extend != null) {
values.communityName = postman.extend
} else {
values.communityName=null
}
var tmp = Object.keys(values);
console.log("添加业主提交的参数:" + tmp.length)
console.log(values)
if (checkParam(values)) {
RA(14, values)
} else {
message.error("Error,Please finish it,not empty!",3)
}
}
useEffect(() => {
if (DataSave != null) {
console.log("页面数据")
console.log(DataSave)
RA(13, {
ownerId:DataSave.id,
owerName:DataSave.owerName,
communityName:"A7"
})
}
}, [DataSave])
useEffect(() => {
if (DataDetail != null) {
console.log(DataDetail)
}
},[DataDetail])
const extendName = (values: any) => {
var tmp = postman
tmp.extend=values
setPostman(tmp)
}
const checkInput = (e: any) => {
console.log(e)
if (e.target.value.length == 1) {
message.error("Ower Name Should be limit 2~33!",3)
}
}
const TabCallback = (values: any) => {
}
return (
<div className={styles.base}>
{/* 头部组件 */}
<TitleBack title={"Owner Detail"} />
<Form ref={formRef} name="basic" onFinish={onFinish}>
<div className={styles.box1}>
<div className={styles.box1item1}>Owner's Name</div>
<div className={styles.box1item2}><Form.Item name="owerName" ><Input placeholder="Ower Name" onBlur={checkInput} maxLength={33}/></Form.Item></div>
</div>
<div className={styles.box4}>
<div className={styles.box4item0}>Contact Details</div>
<div className={styles.box4item1}><Form.Item name="owerPhone" ><Input placeholder="Phone Number" /></Form.Item></div>
<div className={styles.box4item2}><Form.Item name="owerEmail" ><Input placeholder="Email" /></Form.Item></div>
</div>
<Line />
<Tabs defaultActiveKey={postman.tab.toString()} onChange={TabCallback}>
<TabPane tab="A1" key="1">
<div>Hello</div>
{/* <Table loading={false} rowKey="id" style={{ marginTop: 16 }} dataSource={Data.data } columns={columns} pagination={{ current: curString.curPage, total: Data.total.totalRow, showSizeChanger: false, onChange:Pagechange }} /> */}
</TabPane>
<TabPane tab="A7" key="2">
{/* <Table loading={loading} rowKey="id" style={{ marginTop: 16 }} dataSource={Data2.data} columns={columns2} pagination={{ current: curString.curPage2, total: Data2.total.totalRow, showSizeChanger: false, onChange: Pagechange }} /> */}
</TabPane>
</Tabs>
<div className={styles.box2}>
{/* <div className={styles.box2item1}>Contact Details</div> */}
<div className={styles.box2item2}><SearchOptionsCommnity onSubmit={extendName} /></div>
<div className={styles.box2item3}><Form.Item name="buildingNumber"><Input placeholder="Building" style={{width:94}}/></Form.Item></div>
<div className={styles.box2item4}>#</div>
<div className={styles.box2item5}><Form.Item name="floorNumber" ><Input placeholder="Floor" style={{width:80}} /></Form.Item></div>
<div className={styles.box2item6}>——</div>
<div className={styles.box2item7}><Form.Item name="roomNumber"><Input placeholder="Room" style={{width:112}}/></Form.Item></div>
</div>
<div className={styles.box3}>
<div className={styles.box3item1}>
<Form.Item name="addressAndpostalCode"><Input style={{width:680}} placeholder="Display the address and postcode automatically according to the"/></Form.Item>
</div>
</div>
<Line />
<Form.Item ><Button type="primary" htmlType="submit">Submit</Button></Form.Item>
</Form>
</div>
);
};
function mapStateToProps(state:any) {
const { DataSave,DataDetail} = state.User;
return {
DataSave,
DataDetail,
};
}
export default connect(mapStateToProps)(UsersDetail);
// "owerName":"孟浩",
// "owerPhone":"18813787878",
// "owerEmail":"sale@huahuico.com",
// "communityName":"A7",
// "buildingNumber":"A1",
// "floorNumber":"11",
// "roomNumber":"388",
// "addressAndpostalCode":"工业大道3689561"
// "ownerId":"770da9de6b6c43f6b61bc3d671fa2e89",
// "owerName":"jack-小雄",
// "communityName":"A7"
\ No newline at end of file
......@@ -7,6 +7,8 @@ import { Link, useIntl, connect, Dispatch } from 'umi';
import Line from '../../components/Line/Line';
import BackButton from '../../components/BackButton/BackButton';
import TitleGet from '../../components/TitleGet/TitleGet';
import TableShow from '../../components/TableShow/TableShow';
const Guard = (props:any) => {
......@@ -29,12 +31,15 @@ const Guard = (props:any) => {
<div className={styles.base}>
<div className={styles.item0}><TitleGet title={"Version 1.0.1"}/></div>
<TitleGet title={"Version 1.0.3"} />
<p>
token:{token}
</p>
<TableShow />
{/* <div>{token}</div>
<Line /> */}
</div>
);
};
......
......@@ -71,7 +71,14 @@ const requestList = [
"/tos/bookingService/lookUp",//7 查看小区设施
"/tos/community/facilities/fuzzy/query",//8 查看设施管理模糊
"/tos/community/categories/subscribe/fuzzy/query",//9 预订列表模糊查询
"/tos/user/newCurrentUser" //10 后台用户信息
"/tos/user/newCurrentUser", //10 后台用户信息,
"/tos/community/facilities/categories/subscribe",//11 预订
"/tos/tosOwner/getAll", //12 业主查询
"/tos/tosOwner/getDetail", //13 业主查询详细
"/tos/tosOwner/save",//14 业主添加
"/tos/life/community/qr/get",//二维码查询
"/tos/life/community/account/unit/del",//删除单元
]
function requestAuto(url:string,values:any) {
return request(url, Body(values))
......@@ -80,5 +87,8 @@ export function RA(playload: any) {
// console.log(playload)
// console.log(playload.index)
// console.log(requestList[playload.index])
return requestAuto(requestList[playload.index],playload.body)
}
\ No newline at end of file
var url =requestList[playload.index]
console.log("发送请求"+url)
return requestAuto(url,playload.body)
}
export const checkParam = (values: any) => {
var flag = true
for (var i in values) {
console.log(values[i]);
if (values[i] == null) {
flag=false
} else {
if(values[i].length == 0){ flag=false}
}
}
return flag
}
\ No newline at end of file
export const stringSplit=(string:any,rex:any)=>{
// 方法名不能大写
export const stringSplit = (string: any, rex: any) => {
var index=string.lastIndexOf(rex);
string=string.substring(index+1,string.length);
......@@ -6,7 +7,6 @@ export const stringSplit=(string:any,rex:any)=>{
}
// 构建对象
export const objectColumns=(key:any) => {
const name = ["title", "dataIndex", "render"]
......@@ -35,4 +35,34 @@ export const getUrlLastParams = (str: string) => {
var index = str.lastIndexOf("?")
var tmp =str.substring(0,index)
return tmp
}
//保留小数点后面的两位数
export const getNumber = (str: string) => {
var index = str.lastIndexOf(".")
var tmp =str
if (index > -1) {
tmp = str.substring(0, index + 3)
// console.log(tmp)
var k = 0;
for (var i = 0; i < tmp.length; i++) {
if (tmp[i] == '.') { k++ };
}
if (k > 1) {
tmp = tmp.substring(0, tmp.length-1)
}
}
return tmp
}
//小数转字符串保留两位小数
export const numberToString = (values: any)=>{
var a=""+values
var b=""
if(a.indexOf('.')>-1){
b=a
}else{
b=a+(".00")
}
return b
}
\ No newline at end of file
......@@ -10,7 +10,7 @@ export const timestampToTime2=(timestamp:any)=>{
}
//月份补零
function addTZero(time) {
let tmp = time + 1 < 10 ? '0' + time : time + 1
let tmp = time + 1 < 10 ? '0' + (time+1) : (time + 1)
return tmp
}
function addZero(time) {
......
......@@ -19,8 +19,9 @@
"strict": true,
"paths": {
"@/*": ["./src/*"],
"@@/*": ["./src/.umi/*"]
}
"@@/*": ["./src/.umi/*"],
"@@@/*":["./src/components/*"],
}
},
"exclude": ["node_modules", "build", "dist", "scripts", "src/.umi/*", "webpack", "jest"]
}
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