Commit e9315581 authored by cellee's avatar cellee

添加预定完成

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent 1c2ac72c
import React from 'react';
import { Select } from 'antd';
const Option = Select.Option;
const OnTime = (porps: any) => {
// placeholder 默认显示 disabled 是否禁止 openSelect 选中函数 limit 限制时间
let { placeholder, disabled, openSelect, limit } = porps;
// 生成数组 -- 时间
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 hourS = createArray(24).map((item) =>
// 处理限制时间
limit ? (
<Option value={item + ':00'} key={item} disabled={Times(item, limit)}>{`${item}:00`}</Option>
) : (
<Option value={item + ':00'} key={item}>{`${item}:00`}</Option>
),
);
// 字符串截取判断
function Times(item: any, openTime: string) {
if (
parseInt(item) >= parseInt(openTime.slice(0, 2)) &&
parseInt(item) <= parseInt(openTime.slice(6, 8))
) {
return false;
} else {
return true;
}
}
return (
<>
<Select
style={{ width: 140 }}
placeholder={placeholder}
disabled={disabled}
onSelect={openSelect}
>
{hourS}
</Select>
</>
);
};
export default OnTime;
......@@ -29,7 +29,8 @@ export default {
// 不知道前面是干嘛的,自增公告列表
NoticeList: [],
imgList:[{},{},{},{},{}] // 设施图片列表
imgList: [{}, {}, {}, {}, {}], // 设施图片列表
resultTime:null, // 设施已预约时间段
},
reducers: {
......@@ -65,8 +66,11 @@ export default {
return state
},
returnPage(state, { Data,DataPage,DataSave}) {
return { ...state, Data,DataPage,DataSave };
// returnPage(state, { Data,DataPage,DataSave}) {
// return { ...state, Data,DataPage,DataSave };
// },
returnPage(state, { Data }) {
return { ...state, Data};
},
returnPage2(state, { Data2 }) {
return { ...state, Data2 };
......@@ -77,7 +81,7 @@ export default {
returnDataSave(state, { DataSave }) {
return { ...state, DataSave};
},
DataSaveDetail(state, { DataSaveDetail,}) {
DataSaveDetail(state, { DataSaveDetail, }) {
return { ...state, DataSaveDetail };
},
returnSource(state, { sourceData }) {
......@@ -88,7 +92,12 @@ export default {
},
returnResult(state, { Result }) {
return { ...state, Result };
}
},
// 时间
onResult(state, { resultTime }) {
return { ...state, resultTime };
},
},
......@@ -122,28 +131,22 @@ export default {
// console.log('===========================')
// console.log(playload)
switch (playload.index) {
case 0:
case 9:
{
let Data = {data:resp.data.list,total:resp.data.page} ;
yield put({ type: 'returnPage', Data });
case 1:
{
let Data3 = resp.data;
if (JSON.stringify(Data3) == "{}") {
Data3 = false
// 提示小区没有设施
message.error('There Are No Facilities In The Community !');
}
break;
case 1:
{
let Data3 = resp.data;
if (JSON.stringify(Data3) == "{}") {
Data3 = false
// 提示小区没有设施
message.error('There Are No Facilities In The Community !');
}
yield put({ type: 'returnPage3', Data3});
}break;
yield put({ type: 'returnPage3', Data3});
}break;
case 2: {
case 2:{
let DataSaveDetail = resp.data;
yield put({ type: 'DataSaveDetail', DataSaveDetail });
} break;
case 3:
case 4:
......@@ -188,12 +191,29 @@ export default {
let Data2 = {data:resp.data.list,total:resp.data.page};
yield put({ type: 'returnPage2', Data2, });
} break;
case 0:
case 9: {
let Data = {data:resp.data.list,total:resp.data.page} ;
yield put({ type: 'returnPage', Data });
}break;
// 自增公告列表
case 25:{
let NoticeList = resp.data;
yield put({ type: 'retuNotice',payload:NoticeList, });
}
} break;
// 时间查询
case 50:{
let resultTime = [];
let data = resp.data;
for (var i = 0; i < data.length; i += 2){
let a = data[i] + '-' + data[i+1];
resultTime.push(a);
}
console.log(resultTime)
yield put({ type: 'onResult', resultTime });
}break;
}
}
......
......@@ -28,7 +28,7 @@ import moment from 'moment';
const FacilityBookings = (props: any) => {
const { formatMessage } = useIntl();
const { dispatch, location, Data, Data2, token, DataSave, curString, Result } = props;
const { dispatch, location, Data, Data2, token, DataSave, curString, Result, loading } = props;
const RA = (index: any, values: any) => {
console.log(values);
......@@ -48,7 +48,6 @@ const FacilityBookings = (props: any) => {
dispatch({ type: 'FacilityBookings/CA', playload: null });
};
const [loading, setLoading] = useState(false);
const [columns, setColumns] = useState([]);
const [columns2, setColumns2] = useState([]);
......@@ -57,16 +56,22 @@ const FacilityBookings = (props: any) => {
CA();
// 先清空上传图片列表
dispatch({ type: 'FacilityBookings/overAllImgList' });
} else {
// 清空之前的数据
let Data3 = null;
dispatch({ type: 'FacilityBookings/returnPage3', Data3 });
}
history.push(location.pathname + (curString.tab == 1 ? '/Booking' : '/Adding'));
};
// 预约详情跳转
const goToDetail = (values: any) => {
SA(values);
console.log('准备页面跳转');
console.log(curString);
history.push(location.pathname + '/Detail');
};
const makeOperator = (values: any, index: any, e: any) => {
// 列表2 点击跳转
const makeOperator = (values: any, index: any) => {
const path = ['/FacilityDetail', '/FacilityEdit', '/FacilityApply'];
SA(values);
console.log('准备页面跳转');
......@@ -125,9 +130,9 @@ const FacilityBookings = (props: any) => {
null,
(text: any, record: any) => (
<Space size="middle">
<a onClick={makeOperator.bind(this, record, 0)}>Detail</a>
<a onClick={makeOperator.bind(this, record, 1)}>Edit</a>
<a onClick={makeOperator.bind(this, record, 2)}>Booking</a>
<a onClick={() => makeOperator(record, 0)}>Detail</a>
<a onClick={() => makeOperator(record, 1)}>Edit</a>
<a onClick={() => makeOperator(record, 2)}>Booking</a>
</Space>
),
],
......@@ -150,10 +155,6 @@ const FacilityBookings = (props: any) => {
}
}, []);
useEffect(() => {
setLoading(false);
}, [Data, Data2]);
const CallBackTitleSearch = (comment: any) => {
console.log(comment);
......@@ -195,7 +196,6 @@ const FacilityBookings = (props: any) => {
}
};
function TabCallback(tab: any) {
setLoading(true);
var tmp = curString;
tmp.tab = tab;
QA(tmp);
......@@ -212,7 +212,6 @@ const FacilityBookings = (props: any) => {
}
}
function Pagechange(current: any, pageSize: any) {
setLoading(true);
if (curString.tab == 1) {
var tmp = curString;
tmp.curPage = current;
......@@ -285,12 +284,15 @@ const FacilityBookings = (props: any) => {
</Button>
</div> */}
<Tabs defaultActiveKey={curString.tab.toString()} onChange={TabCallback}>
<Tabs
defaultActiveKey={curString.tab.toString()}
onChange={TabCallback}
className="diytabs"
>
<TabPane tab="Facility Bookings" key="1">
<ProTable
loading={loading}
rowKey="id"
style={{ marginTop: 16 }}
dataSource={Data.data}
columns={columns}
pagination={{
......@@ -322,7 +324,6 @@ const FacilityBookings = (props: any) => {
<ProTable
loading={loading}
rowKey="id"
style={{ marginTop: 16 }}
dataSource={Data2.data}
columns={columns2}
pagination={{
......@@ -359,6 +360,10 @@ const FacilityBookings = (props: any) => {
function mapStateToProps(state: any) {
const { Data, Data2, DataSave, curString, Result } = state.FacilityBookings;
const { token } = state.login;
const loading =
typeof state.loading.models.FacilityBookings == 'undefined'
? true
: state.loading.models.FacilityBookings;
return {
Data,
Data2,
......@@ -366,6 +371,7 @@ function mapStateToProps(state: any) {
curString,
Result,
token,
loading,
};
}
export default connect(mapStateToProps)(FacilityBookings);
......
......@@ -188,3 +188,36 @@
margin: 0 20px;
}
}
.required {
position: relative;
padding-left: 10px;
&::after {
content: '*';
display: block;
color: #f00;
font-size: 14px;
position: absolute;
left: 0;
top: 8px;
width: 10px;
// transform: translateY(-50%);
}
}
.boxdiyitem {
position: absolute;
left: 135px;
}
.diyspan,
.diyspan3 {
display: inline-block;
margin: 0 10px;
}
.diyspan3 {
color: #f00;
line-height: 32px;
margin: 0;
margin-left: 30px;
}
......@@ -350,3 +350,9 @@ hr {
// transform: translateY(-50%);
}
}
.diytabs {
.ant-tabs-nav {
margin-bottom: 0;
}
}
......@@ -136,6 +136,7 @@ export const requestList = [
['/tos/fileAndImage/preview', '47 获取附件地址', {}],
['/tos/tosCommunity/get/list', '48 修改获取小区列表', {}],
['/tos/community/delete', '49 关闭小区', {}],
['/tos/community/facilities/subscribeTime/query', '50 设施预订时间段查询', {}],
];
const params = [
......
......@@ -43,10 +43,10 @@ export const NewFaci = [
// 设施预订
export const BookingsTip = [
[{ required: false, message: 'Please select community' }],
[{ required: false, message: 'Please input Facility Name' }],
[{ required: false, message: 'Please Set management fee' }],
[{ required: false, message: 'Please Set Setting deposit' }],
[{ required: false, message: 'Please Upload facility photos' }],
[{ required: false, message: 'Required' }],
[{ required: true, message: 'Please input Name ' }],
[{ required: true, message: 'Please input Contact Details' }],
[{ required: true, message: 'Required' }],
[{ required: true, message: 'Required' }],
[{ required: true, message: 'Required' }],
[{ required: true, message: 'Please Select The Date' }],
];
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