Commit 988b4f10 authored by cellee's avatar cellee

设施管理解决

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent 47d17e5f
...@@ -222,7 +222,6 @@ const Facilitys = (props: any) => { ...@@ -222,7 +222,6 @@ const Facilitys = (props: any) => {
function mapStateToProps(state: any) { function mapStateToProps(state: any) {
const { FacilitysList } = state.FacilityBookings; const { FacilitysList } = state.FacilityBookings;
console.log(FacilitysList);
return { return {
FacilitysList, FacilitysList,
}; };
......
import React from 'react'; import React, { useState, useEffect } from 'react';
import { Select } from 'antd'; import { Select, TimePicker } from 'antd';
const Option = Select.Option; const { Option } = Select;
import moment from 'moment';
const OnTime = (porps: any) => { const OnTime = (porps: any) => {
// placeholder 默认显示 disabled 是否禁止 // placeholder 默认显示 disabled 是否禁止
// openSelect 选中函数 limit 限制时间 type 类型 时开始还是结束 1 就是结束 结尾是59 // openSelect 选中函数 limit 限制时间 type 类型 时开始还是结束 1 就是结束 结尾是59
let { placeholder, disabled, openSelect, limit, type } = porps; // defaultValue 默认时间
let { placeholder, disabled, openSelect, limit, type, defaultValue } = porps;
console.log(limit); const [imgOpen, setImgOpen] = useState(null as any);
useEffect(() => {
if (defaultValue != null) {
let a = moment(defaultValue, 'HH:mm');
setImgOpen(a);
}
}, [defaultValue]);
// console.log(limit);
// 生成数组 -- 时间 // 生成数组 -- 时间
const createArray = (num: any) => { const createArray = (num: any) => {
var arr = []; var arr = [];
for (let i = 1; i < num; i++) { for (let i = 0; i < num; i++) {
if (i < 10) { if (i < 10) {
arr[i] = `0${i}`; arr[i] = `0${i}`;
} else { } else {
...@@ -49,14 +60,25 @@ const OnTime = (porps: any) => { ...@@ -49,14 +60,25 @@ const OnTime = (porps: any) => {
return ( return (
<> <>
<Select {defaultValue ? (
style={{ width: 140 }} <TimePicker
placeholder={placeholder} defaultValue={moment(defaultValue, 'HH:mm')}
disabled={disabled} format="HH:mm"
onSelect={openSelect} onChange={openSelect}
> placeholder={placeholder}
{hourS} defaultOpenValue={moment('00:00', 'HH:mm')}
</Select> disabled={disabled}
/>
) : (
<Select
style={{ width: 140 }}
placeholder={placeholder}
disabled={disabled}
onSelect={openSelect}
>
{hourS}
</Select>
)}
</> </>
); );
}; };
......
...@@ -161,7 +161,11 @@ export default { ...@@ -161,7 +161,11 @@ export default {
} break; } break;
case 7: { case 7: {
let tmp = resp.data; let tmp = resp.data;
const reg = [["url", "categoriesImageUrl"], ["name", "categoriesName"]] const reg = [
["url", "categoriesImageUrl"],
["name", "categoriesName"],
['imgName','categoriesImageName']
]
const reg2 = [["url", null]] const reg2 = [["url", null]]
//let sourceData = tmp; //let sourceData = tmp;
// sourceData.categoriesOpenTime= timeToMoment(tmp.categoriesOpenTime); // sourceData.categoriesOpenTime= timeToMoment(tmp.categoriesOpenTime);
......
...@@ -15,6 +15,8 @@ import { ...@@ -15,6 +15,8 @@ import {
message, message,
} from 'antd'; } from 'antd';
import moment from 'moment';
import { Link, useIntl, connect, Dispatch } from 'umi'; import { Link, useIntl, connect, Dispatch } from 'umi';
import TitleBack from '../../../components/TitleBack/TitleBack'; import TitleBack from '../../../components/TitleBack/TitleBack';
...@@ -23,6 +25,7 @@ import { timestampToTime3 } from '../../../utils/time'; ...@@ -23,6 +25,7 @@ import { timestampToTime3 } from '../../../utils/time';
import TextArea from 'antd/lib/input/TextArea'; import TextArea from 'antd/lib/input/TextArea';
import { getUrlLast } from '../../../utils/string'; import { getUrlLast } from '../../../utils/string';
import { merge } from 'lodash';
const BookingDetail = (props: any) => { const BookingDetail = (props: any) => {
const { dispatch, location, DataSave, DataSaveDetail, token, load } = props; const { dispatch, location, DataSave, DataSaveDetail, token, load } = props;
...@@ -135,7 +138,8 @@ const BookingDetail = (props: any) => { ...@@ -135,7 +138,8 @@ const BookingDetail = (props: any) => {
{statusDes[DataSave.status]} {statusDes[DataSave.status]}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label="Order Time"> <Descriptions.Item label="Order Time">
{timestampToTime3(DataSave.createTime.time)} {/* {timestampToTime3(DataSave.createTime.time)} */}
{moment(DataSave.createTime.time).format('MM-DD HH:mm')}
</Descriptions.Item> </Descriptions.Item>
</Descriptions> </Descriptions>
......
...@@ -88,6 +88,7 @@ const Bookings = (props: any) => { ...@@ -88,6 +88,7 @@ const Bookings = (props: any) => {
} }
}, [Result]); }, [Result]);
console.log(Data3);
// 选择小区监听是不是有值 // 选择小区监听是不是有值
useEffect(() => { useEffect(() => {
setLoading(false); setLoading(false);
...@@ -257,7 +258,7 @@ const Bookings = (props: any) => { ...@@ -257,7 +258,7 @@ const Bookings = (props: any) => {
alone={true} alone={true}
placeholder={'Community Name'} placeholder={'Community Name'}
opname={getFacility} opname={getFacility}
defaultValue={DataSave != null ? DataSave.communityName : null} defaultName={DataSave != null ? DataSave.communityName : null}
// onSubmit={getFacility} // onSubmit={getFacility}
/> />
</Spin> </Spin>
...@@ -316,7 +317,7 @@ const Bookings = (props: any) => { ...@@ -316,7 +317,7 @@ const Bookings = (props: any) => {
<div className={styles.box4item1}>Unit : </div> <div className={styles.box4item1}>Unit : </div>
<div className="divbox4"> <div className="divbox4">
<Form.Item name="buildNumber" rules={BookingsTip[2]}> <Form.Item name="buildNumber" rules={BookingsTip[2]}>
<Input placeholder="Building" style={{ width: 80 }} disabled={prohibit} /> <Input placeholder="Blk" style={{ width: 80 }} disabled={prohibit} />
</Form.Item> </Form.Item>
<span className="jio">#</span> <span className="jio">#</span>
<Form.Item name="floorNumber" rules={BookingsTip[3]}> <Form.Item name="floorNumber" rules={BookingsTip[3]}>
......
...@@ -12,6 +12,7 @@ import { ...@@ -12,6 +12,7 @@ import {
Form, Form,
Select, Select,
message, message,
Spin,
} from 'antd'; } from 'antd';
const { RangePicker } = TimePicker; const { RangePicker } = TimePicker;
const { Option } = Select; const { Option } = Select;
...@@ -44,11 +45,11 @@ import { validateMessages } from '@/utils/params'; ...@@ -44,11 +45,11 @@ import { validateMessages } from '@/utils/params';
const module = 'FacilityBookings'; const module = 'FacilityBookings';
import moment from 'moment'; import moment from 'moment';
import OnTime from '@/components/OnTime/OnTime';
const Facility = (props: any) => { const Facility = (props: any) => {
const { dispatch, location, token, sourceData, DataSave, Result, load, FacilitysList } = props; const { dispatch, location, token, sourceData, DataSave, Result, load, FacilitysList } = props;
console.log(DataSave);
const RA = (index: any, values: any) => { const RA = (index: any, values: any) => {
dispatch({ type: 'FacilityBookings/RA', playload: { index: index, body: values } }); dispatch({ type: 'FacilityBookings/RA', playload: { index: index, body: values } });
}; };
...@@ -60,7 +61,7 @@ const Facility = (props: any) => { ...@@ -60,7 +61,7 @@ const Facility = (props: any) => {
const [Ref3, setRef3] = useState([]); const [Ref3, setRef3] = useState([]);
const [extend, setExtend] = useState(null); const [extend, setExtend] = useState(null); // 小区名称
const [timeExtend, setTimeExtend] = useState(null); const [timeExtend, setTimeExtend] = useState(null);
const [pictrueExtend, setPictrueExtend] = useState({ pic: null, pics: null, tab: 3 }); const [pictrueExtend, setPictrueExtend] = useState({ pic: null, pics: null, tab: 3 });
const [facilityDetail, setFacilityDetail] = useState(false); const [facilityDetail, setFacilityDetail] = useState(false);
...@@ -68,18 +69,16 @@ const Facility = (props: any) => { ...@@ -68,18 +69,16 @@ const Facility = (props: any) => {
const formRef = useRef(null); const formRef = useRef(null);
// 页面进来 先清一遍 图片列表 // 监听是否选择了小区
useEffect(() => { const [imgOpen, setImgOpen] = useState(true);
if (DataSave == null) { const [ctyName, setCtyName] = useState(null);
let list: any = []; const [soltTime, setSoltTime] = useState(['', '']); // 已选时间
dispatch({ type: module + '/genxin', list });
} // 表单标识
}, [1]); const [form] = Form.useForm();
useEffect(() => { useEffect(() => {
if (Result != null) { if (Result != null) {
console.log('页面结果');
console.log(Result);
ResultClear(); ResultClear();
history.push('/CommunityManagement/FacilityBookings'); history.push('/CommunityManagement/FacilityBookings');
} }
...@@ -87,7 +86,6 @@ const Facility = (props: any) => { ...@@ -87,7 +86,6 @@ const Facility = (props: any) => {
const RA_S = () => { const RA_S = () => {
if (DataSave != null) { if (DataSave != null) {
console.log('请求的设施ID为:' + DataSave.id);
RA(7, { RA(7, {
userToken: token, userToken: token,
facilitieId: DataSave.id, facilitieId: DataSave.id,
...@@ -98,17 +96,49 @@ const Facility = (props: any) => { ...@@ -98,17 +96,49 @@ const Facility = (props: any) => {
}; };
useEffect(() => { useEffect(() => {
if (sourceData != null) { if (sourceData != null) {
console.log('【传入详情,当前数据不为空】');
console.log(sourceData); console.log(sourceData);
console.log(DataSave);
setExtend(sourceData.communityName); setExtend(DataSave.communityName);
setTimeExtend(sourceData.reservationQuantumTime);
setSoltTime(sourceData.reservationQuantumTime); // 设置时间
// 中断 // 中断
// setPictrueExtend({tab:null,pic:null,pics:null}) // setPictrueExtend({tab:null,pic:null,pics:null})
console.log('重点检查');
console.log(sourceData);
// 设施图片默认值
let list: any = sourceData.categoriesName.map((item: any, index: any) => {
let sam = {
id: index,
name: item.name,
fileList: [
{
uid: index,
name: item.imgName,
status: 'done',
url: item.url,
},
],
};
// 设施图片列表默认值
form.setFieldsValue({
['shebei_' + index]: item.name,
});
return sam;
});
dispatch({ type: module + '/genxin', list });
// 当是查看的时候禁止点击
if (location.pathname.indexOf('FacilityDetail') > -1) {
setImgOpen(true);
} else {
setImgOpen(false);
}
// 设置表单默认值
formRef.current.setFieldsValue(sourceData); formRef.current.setFieldsValue(sourceData);
} else {
// 新增页面进来 先清一遍 图片列表
let list: any = [];
dispatch({ type: module + '/genxin', list });
} }
}, [sourceData]); }, [sourceData]);
...@@ -120,7 +150,8 @@ const Facility = (props: any) => { ...@@ -120,7 +150,8 @@ const Facility = (props: any) => {
setPictrueExtend(tmp); setPictrueExtend(tmp);
RA_S(); RA_S();
} else if (location.pathname.indexOf('FacilityDetail') > -1) { } else if (location.pathname.indexOf('FacilityDetail') > -1) {
setFacilityDetail(true); setFacilityDetail(true); // 设置禁止
tmp.tab = 2; tmp.tab = 2;
setPictrueExtend(tmp); setPictrueExtend(tmp);
setPATHNAME('Facility Detail'); setPATHNAME('Facility Detail');
...@@ -143,84 +174,50 @@ const Facility = (props: any) => { ...@@ -143,84 +174,50 @@ const Facility = (props: any) => {
let imgs: any = []; let imgs: any = [];
for (let i in FacilitysList) { for (let i in FacilitysList) {
imgs[i] = `${FacilitysList[i].fileList[0].name}&${FacilitysList[i].name}`; imgs[i] = `${FacilitysList[i].name}&${FacilitysList[i].fileList[0].name}`;
} }
// 开放时间判断
if (imgs.length == 0) { if (imgs.length == 0) {
message.error('Please upload at least one facility!'); // 图片设施判断
} else if (!result.endTime && !result.startTime) { message.error('Please Upload At Least One Facility!');
message.error('Please select the opening time!'); } else if (soltTime.length < 2 || !soltTime[0]) {
// 判断时间选择
message.error('Please Fill In The Appointment Period!');
} else if (
// 提前预订时间大于 取消时间
result.canReservationDay < result.cancelReservationDay ||
result.canReservationDay < result.nomarginCancelReservationDay
) {
message.error('Reservation should be greater than cancellation time!');
} else { } else {
// 先处理设施和时间 // 处理 开放时间段
let reservationQuantumTime: any = [ // let reservationQuantumTime: any = [
moment(result.startTime, 'HH:mm').format('HH:mm'), // moment(soltTime[0], 'HH:mm').format('HH:mm'),
moment(result.endTime, 'HH:mm').format('HH:mm'), // moment(soltTime[1], 'HH:mm').format('HH:mm'),
]; // ];
let categoriesName: any = imgs; // 设施图片 let categoriesName: any = imgs; // 设施图片
result.categoriesName = categoriesName; // 设施内容 result.categoriesName = categoriesName; // 设施内容
result.reservationQuantumTime = reservationQuantumTime; // 开放时间段 result.reservationQuantumTime = soltTime; // 开放时间段
result.categoriesOpenTime = `${result.startTime}-${result.endTime}`; // 预约时间段 二开需要 result.categoriesOpenTime = `${soltTime[0]}-${soltTime[1]}`; // 预约时间段 二开需要
result.communityManagerFee = result.communityManagerFee ? result.communityManagerFee : 0; // 价格押金没有为0
result.communityMargin = result.communityMargin ? result.communityMargin : 0; // 价格押金没有为0
delete result.startTime; delete result.startTime;
delete result.endTime;
delete result.picList; delete result.picList;
console.log(reservationQuantumTime); if (sourceData != null) {
console.log(result); result.id = DataSave.id;
RA(6, result); if (Result == null) {
// 如果有了 开始上传 RA(17, result);
// if (categoriesName) {
// }
}
return false;
// if (Ref3.length!=0) {
// result.reservationQuantumTime = Ref3
// } else {
result.reservationQuantumTime = [timeForm(result.categoriesOpenTime, 'HH:mm')];
var categoriesOpenTime = timeForm(result.categoriesOpenTime, 'HH:mm');
result.categoriesOpenTime = categoriesOpenTime;
// }
// console.log(timeForm(result.categoriesOpenTime,'HH:mm'))
// 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);
}
if (
result.canReservationDay <= result.cancelReservationDay ||
result.canReservationDay <= result.nomarginCancelReservationDay
) {
message.error('can Reservation Day is invaild!', 3);
result.canReservationDay = null;
} else {
console.log('Should be check:', result);
if (checkParam(result)) {
//中断
if (pictrueExtend.tab == 3) {
if (Result == null) {
console.log('提交');
RA(6, result);
}
} else {
result.id = DataSave.id;
console.log('编辑');
if (Result == null) {
RA(17, result);
}
} }
} else { } else {
message.error('Error,Please finish it,not empty!', 3); RA(6, result);
} }
} }
return false;
}; };
const onFinishFailed = (errorInfo: any) => { const onFinishFailed = (errorInfo: any) => {
console.log('Failed:', errorInfo); // console.log('Failed:', errorInfo);
}; };
const Subscribe = () => { const Subscribe = () => {
history.push(getUrlLast(location.pathname) + '/FacilityApply'); history.push(getUrlLast(location.pathname) + '/FacilityApply');
...@@ -244,32 +241,6 @@ const Facility = (props: any) => { ...@@ -244,32 +241,6 @@ const Facility = (props: any) => {
formRef.current.setFieldsValue(tmp); formRef.current.setFieldsValue(tmp);
}; };
// 监听是否选择了小区
const [imgOpen, setImgOpen] = useState(true);
const [ctyName, setCtyName] = useState(null);
// 生成数组 -- 时间
const createArray = (num: any) => {
var arr = [];
for (let i = 1; i < num; i++) {
if (i < 10) {
arr[i] = `0${i}`;
} else {
arr[i] = i;
}
}
return arr;
};
const Option = Select.Option;
//小时
const hourS = createArray(24).map((item) => (
<Option value={item + ':00'} key={item}>{`${item}:00`}</Option>
));
// 图片列表
// 表单标识
const [form] = Form.useForm();
// 选择小区名字并赋值 // 选择小区名字并赋值
const opname = (value: any) => { const opname = (value: any) => {
if (value) { if (value) {
...@@ -281,6 +252,9 @@ const Facility = (props: any) => { ...@@ -281,6 +252,9 @@ const Facility = (props: any) => {
} else { } else {
// 设置是否能点击上传 // 设置是否能点击上传
setImgOpen(true); setImgOpen(true);
// 清空设施列表图
let list: any = [];
dispatch({ type: module + '/genxin', list });
} }
}; };
...@@ -291,190 +265,229 @@ const Facility = (props: any) => { ...@@ -291,190 +265,229 @@ const Facility = (props: any) => {
}); });
}; };
// 下拉选择
const startTimes = (value: any) => {
let s = soltTime;
if (sourceData != null) {
s[0] = moment(value).format('HH:mm');
} else {
s[0] = value;
}
setSoltTime(s);
};
// 结束时间
const endTimes = (value: any) => {
let s = soltTime;
if (sourceData != null) {
s[1] = moment(value).format('HH:mm');
} else {
s[1] = value;
}
setSoltTime(s);
};
return ( return (
<div className={'base basediy'}> <>
{/* 头部组件v1.2 */} <Spin spinning={load}>
<TitleBack title={PATHNAME} url={getUrlLast(location.pathname) + '?Facility=true'} /> <div className={'base basediy'}>
<Form {/* 头部组件v1.2 */}
ref={formRef} <TitleBack title={PATHNAME} url={getUrlLast(location.pathname) + '?Facility=true'} />
form={form} <Form
name="basic" ref={formRef}
onFinish={onFinish} form={form}
onFinishFailed={onFinishFailed} name="basic"
validateMessages={validateMessages} onFinish={onFinish}
> onFinishFailed={onFinishFailed}
{/* 选择小区 */} validateMessages={validateMessages}
<Form.Item label="Community" name="communityName" rules={NewFaci[0]}>
<SearchOptionsCommnity
// ubmit={extendName}
defaultName={DataSave != null ? DataSave.communityName : ''}
opname={opname}
/>
</Form.Item>
{/* 设施名称 以及费用 */}
<Input.Group>
<Form.Item label="Facility" name="facilityName" rules={NewFaci[1]}>
<Input placeholder="Facility Name" />
</Form.Item>
<Form.Item label="Fee($)" name="communityManagerFee" rules={NewFaci[2]}>
<span className="divIconMoney">$</span>
<InputNumber
onKeyUp={keyup_communityManagerFee}
prefix="$"
placeholder="00.00"
disabled={facilityDetail}
min={0}
max={999}
step={0.01}
style={{ paddingLeft: '12px', width: '120px' }}
/>
</Form.Item>
<Form.Item label="Deposit" name="communityMargin" rules={NewFaci[3]}>
<span className="divIconMoney">$</span>
<InputNumber
onKeyUp={keyup_communityMargin}
prefix="$"
placeholder="00.00"
disabled={facilityDetail}
min={0}
max={999}
step={0.01}
style={{ paddingLeft: '12px', width: '120px' }}
/>
</Form.Item>
</Input.Group>
<hr></hr>
{/* 设施品类上传 */}
<Form.Item label="Facility Classification" className="flex required">
<Facilitys
disabled={imgOpen}
updata={{
// userToken: token,
imageType: 'categoriesImageName',
extends: ctyName,
}}
dumps={dumps}
></Facilitys>
</Form.Item>
{/* 设施详情上传 */}
<Form.Item name="categoriesDetailsImageName" label="Facility Details" rules={NewFaci[4]}>
<PictureOptionsRow
over={imgOpen}
data={{
// userToken: token,
imageType: 'categoriesDetailsImageName',
extends: ctyName,
}}
/>
</Form.Item>
{/* 时间 */}
<Form.Item label="Opening Hours" className="required">
<Form.Item name="startTime" noStyle>
<Select style={{ width: 140 }} placeholder="Start Time">
{hourS}
</Select>
</Form.Item>
<span className="diyspan">-</span>
<Form.Item name="endTime" noStyle>
<Select style={{ width: 140 }} placeholder="Closing Time">
{hourS}
</Select>
</Form.Item>
</Form.Item>
<hr></hr>
{/* ------------- */}
<p className="diyp">Appointment Settings : </p>
{/* 预约设置 */}
<Input.Group>
<Form.Item name="cancelReservationDay" label="Early Cancellation" rules={NewFaci[5]}>
<Input
onKeyUp={keyup.bind(this, 'cancelReservationDay')}
disabled={facilityDetail}
prefix="Advance"
suffix="Day"
style={{ width: 160, textAlign: 'center' }}
placeholder="0"
/>
</Form.Item>
<Form.Item
label="No deposit to cancel reservation"
name="nomarginCancelReservationDay"
rules={NewFaci[6]}
> >
<Input {/* 选择小区 */}
onKeyUp={keyup.bind(this, 'nomarginCancelReservationDay')} <Form.Item label="Community" name="communityName" rules={NewFaci[0]}>
disabled={facilityDetail} <SearchOptionsCommnity
prefix="Advance" // ubmit={extendName}
suffix="Day" defaultName={sourceData != null ? DataSave.communityName : null}
style={{ width: 160, textAlign: 'center' }} opname={opname}
placeholder="0" />
/> </Form.Item>
</Form.Item>
<Form.Item label="Booking" name="canReservationDay" rules={NewFaci[7]}> {/* 设施名称 以及费用 */}
<Input <Input.Group>
onKeyUp={keyup.bind(this, 'canReservationDay')} <Form.Item label="Facility" name="facilityName" rules={NewFaci[1]}>
placeholder="0" <Input placeholder="Facility Name" disabled={facilityDetail} />
style={{ width: 160, textAlign: 'center' }} </Form.Item>
disabled={facilityDetail} <Form.Item label="Fee($)" name="communityManagerFee" rules={NewFaci[2]}>
prefix="Advance" {/* <span className="divIconMoney">$</span> */}
suffix="Day" <InputNumber
/> onKeyUp={keyup_communityManagerFee}
</Form.Item> prefix="$"
</Input.Group> placeholder="00.00"
disabled={facilityDetail}
{/* 设置次数 */} min={0}
<Input.Group> max={999}
<Form.Item label="Appointment Cycle" name="periodType" rules={NewFaci[8]}> step={0.01}
<Select style={{ width: '120px' }}
placeholder="Period" />
allowClear </Form.Item>
style={{ width: 120 }}
disabled={facilityDetail} <Form.Item label="Deposit" name="communityMargin" rules={NewFaci[3]}>
{/* <span className="divIconMoney">$</span> */}
<InputNumber
onKeyUp={keyup_communityMargin}
prefix="$"
placeholder="00.00"
disabled={facilityDetail}
min={0}
max={999}
step={0.01}
style={{ width: '120px' }}
/>
</Form.Item>
</Input.Group>
<hr></hr>
{/* 设施品类上传 */}
<Form.Item label="Facility Classification" className="flex required">
<Facilitys
disabled={imgOpen}
updata={{
// userToken: token,
imageType: 'categoriesImageName',
extends: ctyName,
}}
dumps={dumps}
></Facilitys>
</Form.Item>
{/* 设施详情上传 */}
<Form.Item
name="categoriesDetailsImageName"
label="Facility Details"
rules={NewFaci[4]}
> >
<Option value="1">Week</Option> <PictureOptionsRow
<Option value="2">Month</Option> over={imgOpen}
<Option value="3">Year</Option> data={{
</Select> // userToken: token,
</Form.Item> imageType: 'categoriesDetailsImageName',
<Form.Item name="canReservationNum" rules={NewFaci[9]}> extends: ctyName,
<Input }}
onKeyUp={keyup.bind(this, 'canReservationNum')} limitNums={99}
placeholder="second" />
style={{ width: 120 }} </Form.Item>
disabled={facilityDetail}
suffix="second" {/* 时间 */}
/> <Form.Item label="Opening Hours" className="required">
</Form.Item> <Form.Item name="startTime" noStyle>
</Input.Group> <OnTime
placeholder={'Start Time'}
<hr></hr> type={0}
{/* <Row gutter={32} style={{ marginTop: 28 }}> openSelect={startTimes}
<Col>Appointment Period</Col> defaultValue={soltTime[0]}
<Col><TimeSelect putSubmit={TimeSelectRef} defaultValue={timeExtend} disabled={facilityDetail}/></Col> disabled={imgOpen}
</Row> */} />
{facilityDetail ? ( </Form.Item>
<> <span className="diyspan">-</span>
<Button type="primary" onClick={Subscribe} loading={load}> <Form.Item name="endTime" noStyle>
Subscribe <OnTime
</Button> placeholder={'Closing Time'} // 默认值
</> openSelect={endTimes}
) : ( type={1}
<> defaultValue={soltTime[1]}
<Button type="primary" htmlType="submit" loading={load}> disabled={imgOpen}
Submit />
</Button> </Form.Item>
</> </Form.Item>
)}
</Form> <hr></hr>
</div>
{/* ------------- */}
<p className="diyp">Appointment Settings : </p>
{/* 预约设置 */}
<Input.Group>
<Form.Item name="cancelReservationDay" label="Early Cancellation" rules={NewFaci[5]}>
<Input
onKeyUp={keyup.bind(this, 'cancelReservationDay')}
disabled={facilityDetail}
prefix="Advance"
suffix="Day"
style={{ width: 160, textAlign: 'center' }}
placeholder="0"
/>
</Form.Item>
<Form.Item
label="No Deposit To Cancel Reservation"
name="nomarginCancelReservationDay"
rules={NewFaci[6]}
>
<Input
onKeyUp={keyup.bind(this, 'nomarginCancelReservationDay')}
disabled={facilityDetail}
prefix="Advance"
suffix="Day"
style={{ width: 160, textAlign: 'center' }}
placeholder="0"
/>
</Form.Item>
<Form.Item label="Booking" name="canReservationDay" rules={NewFaci[7]}>
<Input
onKeyUp={keyup.bind(this, 'canReservationDay')}
placeholder="0"
style={{ width: 160, textAlign: 'center' }}
disabled={facilityDetail}
prefix="Advance"
suffix="Day"
/>
</Form.Item>
</Input.Group>
{/* 设置次数 */}
<Input.Group>
<Form.Item label="Appointment Cycle" name="periodType" rules={NewFaci[8]}>
<Select
placeholder="Period"
allowClear
style={{ width: 120 }}
disabled={facilityDetail}
>
<Option value="1">Week</Option>
<Option value="2">Month</Option>
<Option value="3">Year</Option>
</Select>
</Form.Item>
<Form.Item name="canReservationNum" rules={NewFaci[9]}>
<Input
onKeyUp={keyup.bind(this, 'canReservationNum')}
placeholder="Second"
style={{ width: 120 }}
disabled={facilityDetail}
suffix="Second"
/>
</Form.Item>
</Input.Group>
<hr></hr>
{/* <Row gutter={32} style={{ marginTop: 28 }}>
<Col>Appointment Period</Col>
<Col><TimeSelect putSubmit={TimeSelectRef} defaultValue={timeExtend} disabled={facilityDetail}/></Col>
</Row> */}
{facilityDetail ? (
<>
<Button type="primary" onClick={Subscribe} loading={load} disabled={imgOpen}>
Subscribe
</Button>
</>
) : (
<>
<Button type="primary" htmlType="submit" loading={load}>
Submit
</Button>
</>
)}
</Form>
</div>
</Spin>
</>
); );
}; };
......
...@@ -43,7 +43,9 @@ const FacilityBookings = (props: any) => { ...@@ -43,7 +43,9 @@ const FacilityBookings = (props: any) => {
const QA = (values: any) => { const QA = (values: any) => {
dispatch({ type: 'FacilityBookings/QA', playload: values }); dispatch({ type: 'FacilityBookings/QA', playload: values });
}; };
const IA = () => {
dispatch({ type: 'FacilityBookings/IA' });
};
const CA = () => { const CA = () => {
dispatch({ type: 'FacilityBookings/CA', playload: null }); dispatch({ type: 'FacilityBookings/CA', playload: null });
}; };
...@@ -52,14 +54,14 @@ const FacilityBookings = (props: any) => { ...@@ -52,14 +54,14 @@ const FacilityBookings = (props: any) => {
const [columns2, setColumns2] = useState([]); const [columns2, setColumns2] = useState([]);
const goToFunction = () => { const goToFunction = () => {
console.log(curString.tab);
if (curString.tab == 2) { if (curString.tab == 2) {
CA(); CA();
// 先清空上传图片列表 // 先清空上传图片列表
dispatch({ type: 'FacilityBookings/overAllImgList' }); dispatch({ type: 'FacilityBookings/overAllImgList' });
} else { } else {
// 清空之前的数据 // 清空之前的数据
let Data3 = null; SA(null);
dispatch({ type: 'FacilityBookings/returnPage3', Data3 });
} }
history.push(location.pathname + (curString.tab == 1 ? '/Booking' : '/Adding')); history.push(location.pathname + (curString.tab == 1 ? '/Booking' : '/Adding'));
}; };
...@@ -74,8 +76,10 @@ const FacilityBookings = (props: any) => { ...@@ -74,8 +76,10 @@ const FacilityBookings = (props: any) => {
const makeOperator = (values: any, index: any) => { const makeOperator = (values: any, index: any) => {
const path = ['/FacilityDetail', '/FacilityEdit', '/FacilityApply']; const path = ['/FacilityDetail', '/FacilityEdit', '/FacilityApply'];
SA(values); SA(values);
console.log('准备页面跳转'); // 清空设施列表图
console.log(curString); let list: any = [];
dispatch({ type: 'FacilityBookings/genxin', list });
history.push(location.pathname + path[index]); history.push(location.pathname + path[index]);
}; };
...@@ -307,7 +311,7 @@ const FacilityBookings = (props: any) => { ...@@ -307,7 +311,7 @@ const FacilityBookings = (props: any) => {
toolBarRender={() => [ toolBarRender={() => [
<Button key="3" type="primary" onClick={goToFunction}> <Button key="3" type="primary" onClick={goToFunction}>
<PlusOutlined /> <PlusOutlined />
添加预约 Add Appointment
</Button>, </Button>,
]} ]}
options={{ options={{
...@@ -318,7 +322,7 @@ const FacilityBookings = (props: any) => { ...@@ -318,7 +322,7 @@ const FacilityBookings = (props: any) => {
}, },
setting: false, setting: false,
}} }}
headerTitle="预约列表" // headerTitle="预约列表"
/> />
{curString ? ( {curString ? (
...@@ -343,18 +347,18 @@ const FacilityBookings = (props: any) => { ...@@ -343,18 +347,18 @@ const FacilityBookings = (props: any) => {
rowKey="id" rowKey="id"
dataSource={Data2.data} dataSource={Data2.data}
columns={columns2} columns={columns2}
pagination={{ // pagination={{
current: curString.curPage2, // current: curString.curPage2,
total: Data2.total.totalRow, // total: Data2.total.totalRow,
showSizeChanger: false, // showSizeChanger: false,
onChange: Pagechange, // onChange: Pagechange,
}} // }}
// pagination={false} // 隐藏默认分页 pagination={false} // 隐藏默认分页
search={false} search={false}
toolBarRender={() => [ toolBarRender={() => [
<Button key="3" type="primary" onClick={goToFunction}> <Button key="3" type="primary" onClick={goToFunction}>
<PlusOutlined /> <PlusOutlined />
添加设施 Add Facilities
</Button>, </Button>,
]} ]}
options={{ options={{
...@@ -365,8 +369,23 @@ const FacilityBookings = (props: any) => { ...@@ -365,8 +369,23 @@ const FacilityBookings = (props: any) => {
}, },
setting: false, setting: false,
}} }}
headerTitle="设施列表" // headerTitle="Facilities List"
/> />
{curString ? (
<div className="pages">
<Pagination
current={curString.curPage2}
total={Data2.total.totalRow}
// pageSizeOptions={[]}
showSizeChanger={false}
// pageSize={village.page.curPageSize}
onChange={Pagechange}
/>
</div>
) : (
''
)}
</TabPane> </TabPane>
</Tabs> </Tabs>
</div> </div>
......
import React, { useState, useEffect } from 'react';
import { Input ,Tabs,Table,Space, Button} from 'antd';
const { TabPane } = Tabs;
import {connect} from 'umi';
import { objectColumns } from '@/utils/string';
// cdkCode: 998974
// cdkStatus: "0"
// count: 0
// createTime: "Sep 7, 2020 6:12:35 PM"
// deleted: 0
// enable: 0
// extend: ""
// id: "8f8b49308c0b4fb4a0e6b9d6af0aaa1e"
// inviterAddress: "TANGDE2#01#01#01"
// inviterId: "2597108b72f64a5da34892c14f0e6a57"
// inviterName: "啊啊啊"
// inviterPhone: "2536727886@qq.com"
// linkStatus: 1
// numberPlate: "粤A465123"
// securityGuardCommunity: "unkown"
// securityGuardName: "unkown"
// securityGuardPhone: "unkown"
// status: 1
// updateTime: "Sep 7, 2020 6:13:06 PM"
// visitorsName: "销赃"
// visitorsPhone: "18535669865"
const columns = objectColumns( [
["User Name", "inviterName"],
["Visitor", "visitorsName"],
["Security Guard", "securityGuardName"],
["Number Plate", "numberPlate"],
["time", "updateTime"],
["community", "visitorCommunity"],
["unit", "inviterAddress"]
// ["Actions",null, (text: any, record: any) => (<Space size="middle"> <a>Detail</a></Space>)],
])
import TitleSearch from '@/components/TitleSearch/TitleSearch'
import { RA } from '@/utils/method';
const module="VisitorRecord"
const VisitorRecord = (props:any) => {
const { dispatch, Data } = props;
const TosVisitorRecordGet = (values: any) => { dispatch({ type: 'tosVisitorRecord/get', playload: values }) };
useEffect(() => {
RA(26,{inviterAddress: "", visitorCommunity: ""},module,dispatch)
}, [])
const CallBackTitleSearch = (values:any) => {
console.log(values)
// visitorCommunity
TosVisitorRecordGet({
visitorCommunity: values.inviterAddress,
})
}
const pagination={defaultCurrent:1,total: Data!=null?Data.length:0}
return (
<div style={{ width: "100%", minWidth: 1020, padding: 34, backgroundColor: "#ffffff" }}>
<TitleSearch listkey={['inviterAddress']}
list={['Community Name']}
community={"serviceCommunityList"}
onSubmit={CallBackTitleSearch}/>
{Data!=null?
<Table
loading={false}
rowKey="id"
style={{ marginTop: 16 }}
dataSource={Data.rows}
columns={columns}
pagination={pagination}
// pagination={{ current: 1, total: Data.total}}
/>:null}
</div>
);
};
function map(state:any) {
const { Data} = state[module]
return { Data}
}
export default connect(map)(VisitorRecord);
// 备注
// 列表缺少访客时间
// 搜索缺少到达时间、访客姓名
...@@ -31,8 +31,8 @@ export const Notice = [ ...@@ -31,8 +31,8 @@ export const Notice = [
export const NewFaci = [ export const NewFaci = [
[{ required: true, message: 'Please select community' }], [{ required: true, message: 'Please select community' }],
[{ required: true, message: 'Please input Facility Name' }], [{ required: true, message: 'Please input Facility Name' }],
[{ required: true, message: 'Please Set management fee' }], [{ required: false, message: 'Please Set management fee' }],
[{ required: true, message: 'Please Set Setting deposit' }], [{ required: false, message: 'Please Set Setting deposit' }],
[{ required: true, message: 'Please Upload facility photos' }], [{ required: true, message: 'Please Upload facility photos' }],
[{ required: true, message: 'Required' }], [{ required: true, message: 'Required' }],
[{ required: true, message: 'Required' }], [{ required: true, message: 'Required' }],
......
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