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) => {
function mapStateToProps(state: any) {
const { FacilitysList } = state.FacilityBookings;
console.log(FacilitysList);
return {
FacilitysList,
};
......
import React from 'react';
import { Select } from 'antd';
const Option = Select.Option;
import React, { useState, useEffect } from 'react';
import { Select, TimePicker } from 'antd';
const { Option } = Select;
import moment from 'moment';
const OnTime = (porps: any) => {
// placeholder 默认显示 disabled 是否禁止
// 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) => {
var arr = [];
for (let i = 1; i < num; i++) {
for (let i = 0; i < num; i++) {
if (i < 10) {
arr[i] = `0${i}`;
} else {
......@@ -49,6 +60,16 @@ const OnTime = (porps: any) => {
return (
<>
{defaultValue ? (
<TimePicker
defaultValue={moment(defaultValue, 'HH:mm')}
format="HH:mm"
onChange={openSelect}
placeholder={placeholder}
defaultOpenValue={moment('00:00', 'HH:mm')}
disabled={disabled}
/>
) : (
<Select
style={{ width: 140 }}
placeholder={placeholder}
......@@ -57,6 +78,7 @@ const OnTime = (porps: any) => {
>
{hourS}
</Select>
)}
</>
);
};
......
......@@ -161,7 +161,11 @@ export default {
} break;
case 7: {
let tmp = resp.data;
const reg = [["url", "categoriesImageUrl"], ["name", "categoriesName"]]
const reg = [
["url", "categoriesImageUrl"],
["name", "categoriesName"],
['imgName','categoriesImageName']
]
const reg2 = [["url", null]]
//let sourceData = tmp;
// sourceData.categoriesOpenTime= timeToMoment(tmp.categoriesOpenTime);
......
......@@ -15,6 +15,8 @@ import {
message,
} from 'antd';
import moment from 'moment';
import { Link, useIntl, connect, Dispatch } from 'umi';
import TitleBack from '../../../components/TitleBack/TitleBack';
......@@ -23,6 +25,7 @@ import { timestampToTime3 } from '../../../utils/time';
import TextArea from 'antd/lib/input/TextArea';
import { getUrlLast } from '../../../utils/string';
import { merge } from 'lodash';
const BookingDetail = (props: any) => {
const { dispatch, location, DataSave, DataSaveDetail, token, load } = props;
......@@ -135,7 +138,8 @@ const BookingDetail = (props: any) => {
{statusDes[DataSave.status]}
</Descriptions.Item>
<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>
......
......@@ -88,6 +88,7 @@ const Bookings = (props: any) => {
}
}, [Result]);
console.log(Data3);
// 选择小区监听是不是有值
useEffect(() => {
setLoading(false);
......@@ -257,7 +258,7 @@ const Bookings = (props: any) => {
alone={true}
placeholder={'Community Name'}
opname={getFacility}
defaultValue={DataSave != null ? DataSave.communityName : null}
defaultName={DataSave != null ? DataSave.communityName : null}
// onSubmit={getFacility}
/>
</Spin>
......@@ -316,7 +317,7 @@ const Bookings = (props: any) => {
<div className={styles.box4item1}>Unit : </div>
<div className="divbox4">
<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>
<span className="jio">#</span>
<Form.Item name="floorNumber" rules={BookingsTip[3]}>
......
......@@ -12,6 +12,7 @@ import {
Form,
Select,
message,
Spin,
} from 'antd';
const { RangePicker } = TimePicker;
const { Option } = Select;
......@@ -44,11 +45,11 @@ import { validateMessages } from '@/utils/params';
const module = 'FacilityBookings';
import moment from 'moment';
import OnTime from '@/components/OnTime/OnTime';
const Facility = (props: any) => {
const { dispatch, location, token, sourceData, DataSave, Result, load, FacilitysList } = props;
console.log(DataSave);
const RA = (index: any, values: any) => {
dispatch({ type: 'FacilityBookings/RA', playload: { index: index, body: values } });
};
......@@ -60,7 +61,7 @@ const Facility = (props: any) => {
const [Ref3, setRef3] = useState([]);
const [extend, setExtend] = useState(null);
const [extend, setExtend] = useState(null); // 小区名称
const [timeExtend, setTimeExtend] = useState(null);
const [pictrueExtend, setPictrueExtend] = useState({ pic: null, pics: null, tab: 3 });
const [facilityDetail, setFacilityDetail] = useState(false);
......@@ -68,18 +69,16 @@ const Facility = (props: any) => {
const formRef = useRef(null);
// 页面进来 先清一遍 图片列表
useEffect(() => {
if (DataSave == null) {
let list: any = [];
dispatch({ type: module + '/genxin', list });
}
}, [1]);
// 监听是否选择了小区
const [imgOpen, setImgOpen] = useState(true);
const [ctyName, setCtyName] = useState(null);
const [soltTime, setSoltTime] = useState(['', '']); // 已选时间
// 表单标识
const [form] = Form.useForm();
useEffect(() => {
if (Result != null) {
console.log('页面结果');
console.log(Result);
ResultClear();
history.push('/CommunityManagement/FacilityBookings');
}
......@@ -87,7 +86,6 @@ const Facility = (props: any) => {
const RA_S = () => {
if (DataSave != null) {
console.log('请求的设施ID为:' + DataSave.id);
RA(7, {
userToken: token,
facilitieId: DataSave.id,
......@@ -98,17 +96,49 @@ const Facility = (props: any) => {
};
useEffect(() => {
if (sourceData != null) {
console.log('【传入详情,当前数据不为空】');
console.log(sourceData);
console.log(DataSave);
setExtend(sourceData.communityName);
setTimeExtend(sourceData.reservationQuantumTime);
setExtend(DataSave.communityName);
setSoltTime(sourceData.reservationQuantumTime); // 设置时间
// 中断
// 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);
} else {
// 新增页面进来 先清一遍 图片列表
let list: any = [];
dispatch({ type: module + '/genxin', list });
}
}, [sourceData]);
......@@ -120,7 +150,8 @@ const Facility = (props: any) => {
setPictrueExtend(tmp);
RA_S();
} else if (location.pathname.indexOf('FacilityDetail') > -1) {
setFacilityDetail(true);
setFacilityDetail(true); // 设置禁止
tmp.tab = 2;
setPictrueExtend(tmp);
setPATHNAME('Facility Detail');
......@@ -143,84 +174,50 @@ const Facility = (props: any) => {
let imgs: any = [];
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) {
message.error('Please upload at least one facility!');
} else if (!result.endTime && !result.startTime) {
message.error('Please select the opening time!');
// 图片设施判断
message.error('Please Upload At Least One Facility!');
} 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 {
// 先处理设施和时间
let reservationQuantumTime: any = [
moment(result.startTime, 'HH:mm').format('HH:mm'),
moment(result.endTime, 'HH:mm').format('HH:mm'),
];
// 处理 开放时间段
// let reservationQuantumTime: any = [
// moment(soltTime[0], 'HH:mm').format('HH:mm'),
// moment(soltTime[1], 'HH:mm').format('HH:mm'),
// ];
let categoriesName: any = imgs; // 设施图片
result.categoriesName = categoriesName; // 设施内容
result.reservationQuantumTime = reservationQuantumTime; // 开放时间段
result.categoriesOpenTime = `${result.startTime}-${result.endTime}`; // 预约时间段 二开需要
result.reservationQuantumTime = soltTime; // 开放时间段
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.endTime;
delete result.picList;
console.log(reservationQuantumTime);
console.log(result);
RA(6, 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 {
if (sourceData != null) {
result.id = DataSave.id;
console.log('编辑');
if (Result == null) {
RA(17, result);
}
}
} else {
message.error('Error,Please finish it,not empty!', 3);
RA(6, result);
}
}
return false;
};
const onFinishFailed = (errorInfo: any) => {
console.log('Failed:', errorInfo);
// console.log('Failed:', errorInfo);
};
const Subscribe = () => {
history.push(getUrlLast(location.pathname) + '/FacilityApply');
......@@ -244,32 +241,6 @@ const Facility = (props: any) => {
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) => {
if (value) {
......@@ -281,6 +252,9 @@ const Facility = (props: any) => {
} else {
// 设置是否能点击上传
setImgOpen(true);
// 清空设施列表图
let list: any = [];
dispatch({ type: module + '/genxin', list });
}
};
......@@ -291,7 +265,30 @@ 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 (
<>
<Spin spinning={load}>
<div className={'base basediy'}>
{/* 头部组件v1.2 */}
<TitleBack title={PATHNAME} url={getUrlLast(location.pathname) + '?Facility=true'} />
......@@ -307,7 +304,7 @@ const Facility = (props: any) => {
<Form.Item label="Community" name="communityName" rules={NewFaci[0]}>
<SearchOptionsCommnity
// ubmit={extendName}
defaultName={DataSave != null ? DataSave.communityName : ''}
defaultName={sourceData != null ? DataSave.communityName : null}
opname={opname}
/>
</Form.Item>
......@@ -315,10 +312,10 @@ const Facility = (props: any) => {
{/* 设施名称 以及费用 */}
<Input.Group>
<Form.Item label="Facility" name="facilityName" rules={NewFaci[1]}>
<Input placeholder="Facility Name" />
<Input placeholder="Facility Name" disabled={facilityDetail} />
</Form.Item>
<Form.Item label="Fee($)" name="communityManagerFee" rules={NewFaci[2]}>
<span className="divIconMoney">$</span>
{/* <span className="divIconMoney">$</span> */}
<InputNumber
onKeyUp={keyup_communityManagerFee}
prefix="$"
......@@ -327,11 +324,12 @@ const Facility = (props: any) => {
min={0}
max={999}
step={0.01}
style={{ paddingLeft: '12px', width: '120px' }}
style={{ width: '120px' }}
/>
</Form.Item>
<Form.Item label="Deposit" name="communityMargin" rules={NewFaci[3]}>
<span className="divIconMoney">$</span>
{/* <span className="divIconMoney">$</span> */}
<InputNumber
onKeyUp={keyup_communityMargin}
prefix="$"
......@@ -340,7 +338,7 @@ const Facility = (props: any) => {
min={0}
max={999}
step={0.01}
style={{ paddingLeft: '12px', width: '120px' }}
style={{ width: '120px' }}
/>
</Form.Item>
</Input.Group>
......@@ -361,7 +359,11 @@ const Facility = (props: any) => {
</Form.Item>
{/* 设施详情上传 */}
<Form.Item name="categoriesDetailsImageName" label="Facility Details" rules={NewFaci[4]}>
<Form.Item
name="categoriesDetailsImageName"
label="Facility Details"
rules={NewFaci[4]}
>
<PictureOptionsRow
over={imgOpen}
data={{
......@@ -369,21 +371,30 @@ const Facility = (props: any) => {
imageType: 'categoriesDetailsImageName',
extends: ctyName,
}}
limitNums={99}
/>
</Form.Item>
{/* 时间 */}
<Form.Item label="Opening Hours" className="required">
<Form.Item name="startTime" noStyle>
<Select style={{ width: 140 }} placeholder="Start Time">
{hourS}
</Select>
<OnTime
placeholder={'Start Time'}
type={0}
openSelect={startTimes}
defaultValue={soltTime[0]}
disabled={imgOpen}
/>
</Form.Item>
<span className="diyspan">-</span>
<Form.Item name="endTime" noStyle>
<Select style={{ width: 140 }} placeholder="Closing Time">
{hourS}
</Select>
<OnTime
placeholder={'Closing Time'} // 默认值
openSelect={endTimes}
type={1}
defaultValue={soltTime[1]}
disabled={imgOpen}
/>
</Form.Item>
</Form.Item>
......@@ -405,7 +416,7 @@ const Facility = (props: any) => {
/>
</Form.Item>
<Form.Item
label="No deposit to cancel reservation"
label="No Deposit To Cancel Reservation"
name="nomarginCancelReservationDay"
rules={NewFaci[6]}
>
......@@ -447,10 +458,10 @@ const Facility = (props: any) => {
<Form.Item name="canReservationNum" rules={NewFaci[9]}>
<Input
onKeyUp={keyup.bind(this, 'canReservationNum')}
placeholder="second"
placeholder="Second"
style={{ width: 120 }}
disabled={facilityDetail}
suffix="second"
suffix="Second"
/>
</Form.Item>
</Input.Group>
......@@ -462,7 +473,7 @@ const Facility = (props: any) => {
</Row> */}
{facilityDetail ? (
<>
<Button type="primary" onClick={Subscribe} loading={load}>
<Button type="primary" onClick={Subscribe} loading={load} disabled={imgOpen}>
Subscribe
</Button>
</>
......@@ -475,6 +486,8 @@ const Facility = (props: any) => {
)}
</Form>
</div>
</Spin>
</>
);
};
......
......@@ -43,7 +43,9 @@ const FacilityBookings = (props: any) => {
const QA = (values: any) => {
dispatch({ type: 'FacilityBookings/QA', playload: values });
};
const IA = () => {
dispatch({ type: 'FacilityBookings/IA' });
};
const CA = () => {
dispatch({ type: 'FacilityBookings/CA', playload: null });
};
......@@ -52,14 +54,14 @@ const FacilityBookings = (props: any) => {
const [columns2, setColumns2] = useState([]);
const goToFunction = () => {
console.log(curString.tab);
if (curString.tab == 2) {
CA();
// 先清空上传图片列表
dispatch({ type: 'FacilityBookings/overAllImgList' });
} else {
// 清空之前的数据
let Data3 = null;
dispatch({ type: 'FacilityBookings/returnPage3', Data3 });
SA(null);
}
history.push(location.pathname + (curString.tab == 1 ? '/Booking' : '/Adding'));
};
......@@ -74,8 +76,10 @@ const FacilityBookings = (props: any) => {
const makeOperator = (values: any, index: any) => {
const path = ['/FacilityDetail', '/FacilityEdit', '/FacilityApply'];
SA(values);
console.log('准备页面跳转');
console.log(curString);
// 清空设施列表图
let list: any = [];
dispatch({ type: 'FacilityBookings/genxin', list });
history.push(location.pathname + path[index]);
};
......@@ -307,7 +311,7 @@ const FacilityBookings = (props: any) => {
toolBarRender={() => [
<Button key="3" type="primary" onClick={goToFunction}>
<PlusOutlined />
添加预约
Add Appointment
</Button>,
]}
options={{
......@@ -318,7 +322,7 @@ const FacilityBookings = (props: any) => {
},
setting: false,
}}
headerTitle="预约列表"
// headerTitle="预约列表"
/>
{curString ? (
......@@ -343,18 +347,18 @@ const FacilityBookings = (props: any) => {
rowKey="id"
dataSource={Data2.data}
columns={columns2}
pagination={{
current: curString.curPage2,
total: Data2.total.totalRow,
showSizeChanger: false,
onChange: Pagechange,
}}
// pagination={false} // 隐藏默认分页
// pagination={{
// current: curString.curPage2,
// total: Data2.total.totalRow,
// showSizeChanger: false,
// onChange: Pagechange,
// }}
pagination={false} // 隐藏默认分页
search={false}
toolBarRender={() => [
<Button key="3" type="primary" onClick={goToFunction}>
<PlusOutlined />
添加设施
Add Facilities
</Button>,
]}
options={{
......@@ -365,8 +369,23 @@ const FacilityBookings = (props: any) => {
},
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>
</Tabs>
</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 = [
export const NewFaci = [
[{ required: true, message: 'Please select community' }],
[{ required: true, message: 'Please input Facility Name' }],
[{ required: true, message: 'Please Set management fee' }],
[{ required: true, message: 'Please Set Setting deposit' }],
[{ required: false, message: 'Please Set management fee' }],
[{ required: false, message: 'Please Set Setting deposit' }],
[{ required: true, message: 'Please Upload facility photos' }],
[{ 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