Commit dd58cf90 authored by cellee's avatar cellee

设施

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent 18f07ced
/*
* @Author: your name
* @Date: 2020-12-01 18:40:06
* @LastEditTime: 2021-01-13 10:34:13
* @LastEditTime: 2021-01-15 18:17:37
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \tostumi\config\config.ts
......@@ -326,7 +326,7 @@ export default defineConfig({
},
{
path: './FacilityDetail',
component: './CommunityManagement/FacilityBookings/Facility',
component: './CommunityManagement/FacilityBookings/FacilityTow',
},
{
path: './FacilityApply',
......
......@@ -86,15 +86,15 @@ export default {
changeOrigin: true,
pathRewrite: { '^': '' },
},
'/tos/': {
target: 'http://47.74.233.180:8651',
changeOrigin: true,
pathRewrite: { '^': '' },
},
// '/tos/': {
// target: 'http://192.168.1.28:8651',
// target: 'http://47.74.233.180:8651',
// changeOrigin: true,
// pathRewrite: { '^': '' },
// },
'/tos/': {
target: 'http://192.168.1.28:8651',
changeOrigin: true,
pathRewrite: { '^': '' },
},
},
};
......@@ -32,7 +32,10 @@ export default {
resultTime: null, // 设施已预约时间段
FacilitysList: [],// 动态新增组件
Remaining:null,
Remaining: null,
},
reducers: {
......
......@@ -57,7 +57,11 @@ const BugDetail = (props: any) => {
: '-'}
</Descriptions.Item>
<Descriptions.Item label="Actions">
{DataSave ? moment(DataSave.updateTime.time).calendar() : '-'}
{DataSave
? moment(DataSave.updateTime.time).format('YYYY-MM-DD hh') +
':00' +
(parseInt(moment(DataSave.updateTime.time).format('HH')) > 11 ? 'PM' : 'AM')
: '-'}
</Descriptions.Item>
</Descriptions>
</div>
......
......@@ -30,12 +30,12 @@ const SystemFeedback = (props: any) => {
title: 'Submission time',
dataIndex: 'createTime',
render: (text: any) => {
// let data =
// moment(text.time).format('YYYY-MM-DD hh') +
// ':00' +
// (parseInt(moment(text.time).format('HH')) > 11 ? 'PM' : 'AM');
let data =
moment(text.time).format('YYYY-MM-DD hh') +
':00' +
(parseInt(moment(text.time).format('HH')) > 11 ? 'PM' : 'AM');
let data = moment(text.time).calendar();
// let data = moment(text.time).calendar();
return data;
},
},
......
......@@ -135,7 +135,7 @@ const Bookings = (props: any) => {
}
// 没有次数
if (Remaining == 0) {
if (Remaining.canReservationNum == 0) {
message.error('No bookable times');
return false;
}
......@@ -315,6 +315,7 @@ const Bookings = (props: any) => {
opname={getFacility}
defaultName={DataSave != null ? DataSave.communityName : null}
// onSubmit={getFacility}
disabled={DataSave && DataSave.type == 2 ? true : false}
/>
</Spin>
{/* <Input.Search style={{ width: 200, height: 32 }} onSearch={getFacility} loading={loading} defaultValue={}/> */}
......@@ -531,7 +532,7 @@ const Bookings = (props: any) => {
<div className={styles.box6item1}>Remaining times : </div>
<div className={styles.box6item2}>
<BarChartOutlined style={{ color: '#999', marginRight: 10 }} />
<span style={{ color: '#f00' }}>{Remaining}</span> times
<span style={{ color: '#f00' }}>{Remaining.canReservationNum}</span> times
</div>
</div>
) : (
......
import React, { useState, useEffect, useRef } from 'react';
import './css/index.less';
import { Input, InputNumber, Button, Form, Select, message, Spin } from 'antd';
import { Input, InputNumber, Button, Form, Select, message, Spin, TimePicker } from 'antd';
const { Option } = Select;
const { RangePicker } = TimePicker;
import { connect, history } from 'umi';
import PictureOptionsRow from '@/components/PictureOptions/PictureOptionsRow';
......@@ -145,69 +146,71 @@ const Facility = (props: any) => {
// setRef3(values)
// }
// 判断数组是否有重复项
function isRepeat(arr: any) {
let hash = {};
for (let i in arr) {
if (hash[arr[i]]) {
return true;
}
hash[arr[i]] = true;
}
return false;
}
// 提交
const onFinish = (values: any) => {
var result = values;
// 过滤表单;
let imgs: any = [];
let imgs: any = []; // 小设施图片 -- 用作提交
let name = []; // 小设施名称 -- 用作判断重名
for (let i in FacilitysList) {
name.push(FacilitysList[i].name);
imgs[
i
] = `${FacilitysList[i].name}&${FacilitysList[i].fileList[0].name}&${FacilitysList[i].fileList[0].uid}`;
}
console.log(imgs);
if (imgs.length == 0) {
// 如果小设施有重名
if (isRepeat(name)) {
message.error('Facility name cannot be repeated!');
} else if (imgs.length == 0) {
// 图片设施判断
message.error('Please Upload At Least One Facility!');
} else if (soltTime.length < 2 || !soltTime[0]) {
} else if (!values.Time) {
// 判断时间选择
message.error('Please Fill In The Appointment Period!');
} else if (soltTime[1] <= soltTime[0]) {
// 开始时间与结束时间选择错误
message.error('Wrong selection of start time and end time!');
} else if (
// 提前预订时间大于 取消时间
result.canReservationDay < result.cancelReservationDay ||
result.canReservationDay < result.nomarginCancelReservationDay
values.canReservationDay < values.cancelReservationDay ||
values.canReservationDay < values.nomarginCancelReservationDay
) {
message.error('Reservation should be greater than cancellation time!');
// } else if ( // 暂时去掉这个需求判断
// // 不为 0 的时候 No Deposit To Cancel Reservation 必须要小于 Booking
// result.nomarginCancelReservationDay != 0 &&
// result.canReservationDay <= result.nomarginCancelReservationDay
// values.nomarginCancelReservationDay != 0 &&
// values.canReservationDay <= values.nomarginCancelReservationDay
// ) {
// message.error('nomarginCancelReservationDay 要小于 Booking !');
} else {
let categoriesName: any = imgs; // 设施图片
result.categoriesName = categoriesName; // 设施内容
result.reservationQuantumTime = soltTime; // 开放时间段
result.categoriesOpenTime = `${soltTime[0]}-${soltTime[1]}`; // 预约时间段 二开需要
result.communityManagerFee = result.communityManagerFee ? result.communityManagerFee : '0.00'; // 价格押金没有为0
result.communityMargin = result.communityMargin ? result.communityMargin : '0.00'; // 价格押金没有为0
result.periodType = Cycle;
delete result.startTime;
delete result.endTime;
delete result.picList;
if (sourceData != null) {
result.id = DataSave.id;
if (Result == null) {
RA(17, result);
}
} else {
RA(6, result);
}
values.categoriesName = categoriesName; // 设施内容
values.reservationQuantumTime = [
moment(values.Time[0]).format('HH:mm'),
moment(values.Time[1]).format('HH:mm'),
]; // 开放时间段
// values.categoriesOpenTime = `${soltTime[0]}-${soltTime[1]}`; // 预约时间段 二开需要
values.communityManagerFee = values.communityManagerFee ? values.communityManagerFee : '0.00'; // 价格押金没有为0
values.communityMargin = values.communityMargin ? values.communityMargin : '0.00'; // 价格押金没有为0
values.periodType = Cycle;
delete values.picList;
delete values.Time;
// RA(6, values);
}
return false;
};
const onFinishFailed = (errorInfo: any) => {
// console.log('Failed:', errorInfo);
};
const Subscribe = () => {
history.push(getUrlLast(location.pathname) + '/FacilityApply');
};
......@@ -285,25 +288,14 @@ 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);
//时间
const onChanges = (value: any, b: any) => {
// console.log(value);
// console.log(b);
// 修改后的时间
formRef.current.setFieldsValue({
Time: [moment(b[0], 'HH:mm'), moment(b[1], 'HH:mm')],
});
};
return (
......@@ -317,7 +309,6 @@ const Facility = (props: any) => {
form={form}
name="basic"
onFinish={onFinish}
onFinishFailed={onFinishFailed}
validateMessages={validateMessages}
>
{/* 选择小区 */}
......@@ -339,8 +330,8 @@ const Facility = (props: any) => {
maxLength={30}
/>
</Form.Item>
<Form.Item label="Fee($)" name="communityManagerFee">
{/* <span className="divIconMoney">$</span> */}
<span className="divIconMoney">Fee($):</span>
<Form.Item label="" name="communityManagerFee">
<InputNumber
onKeyUp={keyup_communityManagerFee}
prefix="$"
......@@ -352,9 +343,8 @@ const Facility = (props: any) => {
style={{ width: '120px' }}
/>
</Form.Item>
<Form.Item label="Deposit" name="communityMargin">
{/* <span className="divIconMoney">$</span> */}
<span className="divIconMoney">Deposit:</span>
<Form.Item label="" name="communityMargin">
<InputNumber
onKeyUp={keyup_communityMargin}
prefix="$"
......@@ -403,23 +393,15 @@ const Facility = (props: any) => {
{/* 时间 */}
<Form.Item label="Opening Hours" className="required">
<Form.Item name="startTime" noStyle>
<OnTime
placeholder={'Start Time'}
type={0}
openSelect={startTimes}
defaultValue={soltTime[0]}
disabled={imgOpen}
/>
</Form.Item>
<span className="diyspan">-</span>
<Form.Item name="endTime" noStyle>
<OnTime
placeholder={'Closing Time'} // 默认值
openSelect={endTimes}
type={0}
defaultValue={soltTime[1]}
<Form.Item name="Time" noStyle>
<RangePicker
disabled={imgOpen}
minuteStep={60}
format="HH:mm"
onChange={(time: any, timeString: any) => {
onChanges(time, timeString);
}}
allowClear={false}
/>
</Form.Item>
</Form.Item>
......
......@@ -116,12 +116,18 @@ const FacilityBookings = (props: any) => {
// 列表2 点击跳转
const makeOperator = (values: any, index: any) => {
const path = ['/FacilityDetail', '/FacilityEdit', '/FacilityApply'];
if (index != 1) {
message.error('In function development!');
return false;
values.type = index;
console.log(values);
if (index == 2) {
values.communityName = values.community;
// values.id = values.community;
}
SA(values);
// 清空设施列表图
// 清空设施列表图;
let list: any = [];
dispatch({ type: 'FacilityBookings/genxin', list });
......
......@@ -36,7 +36,7 @@ const FacilityTow = (props: any) => {
const [ctyName, setCtyName] = useState(null); // 小区名称
const [fileList, setFileList] = useState([] as any); // 设施总图片列表组
const [Cycle, setCycle] = useState(null as any); // 周期下拉
const [soltTime, setSoltTime] = useState(['', '']); // 已选时间
const [Facilityid, setFacilityId] = useState(null as any); // 周期下拉
const formRef = useRef(null as any);
const [form] = Form.useForm(); // 表单标识
......@@ -57,7 +57,11 @@ const FacilityTow = (props: any) => {
// 传递来的小区和设施
useEffect(() => {
if (DataSave) {
if (DataSave.type == 0) {
setFacilityDetail(true);
}
setCtyName(DataSave.community);
setFacilityId(DataSave.facilities[0].id);
beg(DataSave.facilities[0].id);
} else {
//返回列表
......@@ -67,8 +71,6 @@ const FacilityTow = (props: any) => {
// 点击设施获取到的设施列表
useEffect(() => {
if (DataSaveDetail) {
console.log();
let { categories, facilities } = DataSaveDetail;
// 设施A、设施B小图
......@@ -79,7 +81,7 @@ const FacilityTow = (props: any) => {
fileList: [
{
uid: item.id,
name: item.categoriesName,
name: item.categoriesImageName,
status: 'done',
url: item.categoriesImageUrl,
},
......@@ -116,23 +118,75 @@ const FacilityTow = (props: any) => {
formRef.current.setFieldsValue({
Time: [moment(time[0], 'HH:mm'), moment(time[1], 'HH:mm')],
});
setSoltTime([...time]);
}
}, [DataSaveDetail]);
// tab 切换
const onTabClicks = (id: String) => {
setFacilityId(id);
beg(id);
};
// 判断数组是否有重复项
function isRepeat(arr: any) {
let hash = {};
for (let i in arr) {
if (hash[arr[i]]) {
return true;
}
hash[arr[i]] = true;
}
return false;
}
// 提交
const onFinish = (values: any) => {
console.log(values);
message.error('In function development!');
};
// 提取设施icon图和名称出来;
let imgs: any = []; // 小设施图片 -- 用作提交
let name = []; // 小设施名称 -- 用作判断重名
for (let i in FacilitysList) {
name.push(FacilitysList[i].name);
imgs[
i
] = `${FacilitysList[i].name}&${FacilitysList[i].fileList[0].name}&${FacilitysList[i].fileList[0].uid}`;
}
// 单个的话也转化为数组
if (typeof values.categoriesDetailsImageName == 'string') {
values.categoriesDetailsImageName = values.categoriesDetailsImageName.split(',');
}
const onFinishFailed = (errorInfo: any) => {
// console.log('Failed:', errorInfo);
// 如果小设施有重名
if (isRepeat(name)) {
message.error('Facility name cannot be repeated!');
} else if (imgs.length == 0) {
// 图片设施判断
message.error('Please Upload At Least One Facility!');
} else if (
// 提前预订时间大于 取消时间
values.canReservationDay < values.cancelReservationDay ||
values.canReservationDay < values.nomarginCancelReservationDay
) {
message.error('Reservation should be greater than cancellation time!');
} else {
let categoriesName: any = imgs; // 设施图片
values.categoriesName = categoriesName; // 设施内容
values.reservationQuantumTime = [
moment(values.Time[0]).format('HH:mm'),
moment(values.Time[1]).format('HH:mm'),
]; // 开放时间段
// values.categoriesOpenTime = `${soltTime[0]}-${soltTime[1]}`; // 预约时间段 二开需要
values.communityManagerFee = values.communityManagerFee ? values.communityManagerFee : '0.00'; // 价格押金没有为0
values.communityMargin = values.communityMargin ? values.communityMargin : '0.00'; // 价格押金没有为0
values.periodType = Cycle;
values.id = Facilityid;
delete values.startTime;
delete values.endTime;
delete values.picList;
delete values.Time;
RA(17, values);
}
};
// 发起请求
......@@ -162,7 +216,12 @@ const FacilityTow = (props: any) => {
//时间
const onChanges = (value: any, b: any) => {
console.log(value);
// console.log(value);
// console.log(b);
// 修改后的时间
formRef.current.setFieldsValue({
Time: [moment(b[0], 'HH:mm'), moment(b[1], 'HH:mm')],
});
};
return (
......@@ -190,7 +249,6 @@ const FacilityTow = (props: any) => {
form={form}
name="basic"
onFinish={onFinish}
onFinishFailed={onFinishFailed}
validateMessages={validateMessages}
labelAlign="right"
>
......@@ -232,9 +290,13 @@ const FacilityTow = (props: any) => {
<hr></hr>
{/* 设施品类上传 */}
<Form.Item label="Facilities" className="flex required" style={{ marginBottom: 0 }}>
<Form.Item
label="Facilities"
className="flex required"
style={{ marginBottom: 0, minHeight: 134 }}
>
<Facilitys
disabled={imgOpen}
disabled={facilityDetail}
updata={{
// userToken: token,
imageType: 'categoriesImageName',
......@@ -251,7 +313,7 @@ const FacilityTow = (props: any) => {
rules={NewFaci[4]}
>
<PictureOptionsRow
over={imgOpen}
over={facilityDetail}
data={{
// userToken: token,
imageType: 'categoriesDetailsImageName',
......@@ -271,7 +333,8 @@ const FacilityTow = (props: any) => {
onChange={(time: any, timeString: any) => {
onChanges(time, timeString);
}}
disabled
allowClear={false}
disabled={facilityDetail}
/>
</Form.Item>
</Form.Item>
......@@ -353,7 +416,7 @@ const FacilityTow = (props: any) => {
<hr></hr>
<>
<Button type="primary" htmlType="submit" loading={load}>
<Button type="primary" htmlType="submit" loading={load} disabled={facilityDetail}>
Submit
</Button>
</>
......
/*
* @Author: your name
* @Date: 2020-11-19 20:34:18
* @LastEditTime: 2021-01-14 15:31:59
* @LastEditTime: 2021-01-15 18:52:31
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\utils\params.ts
......@@ -90,7 +90,7 @@ export const requestList = [
['/tos/tosCommunity/get/user', '55 根据用户id获取用户管辖小区名', {}],
['/tos/user/twoLevel/get', '56 获取二级账号', {}],
['/tos/user/twoLevel/get/CommunityAuth', '57 根据用户id获取用户管辖小区名和权限', {}],
['/tos/community/categories/subscribe/reservationNum', '58 获取小区设施可预约次数', {}],
['/tos/community/categories/subscribe/reservationInfo', '58 获取小区设施可预约次数', {}],
['/tos/bug/feedback/list', '59 获取用户反馈列表', {}],
['/tos/community/facilities/get/detail', '60 获取小区设施详情', {}],
];
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