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 { ...@@ -29,7 +29,8 @@ export default {
// 不知道前面是干嘛的,自增公告列表 // 不知道前面是干嘛的,自增公告列表
NoticeList: [], NoticeList: [],
imgList:[{},{},{},{},{}] // 设施图片列表 imgList: [{}, {}, {}, {}, {}], // 设施图片列表
resultTime:null, // 设施已预约时间段
}, },
reducers: { reducers: {
...@@ -65,8 +66,11 @@ export default { ...@@ -65,8 +66,11 @@ export default {
return state return state
}, },
returnPage(state, { Data,DataPage,DataSave}) { // returnPage(state, { Data,DataPage,DataSave}) {
return { ...state, Data,DataPage,DataSave }; // return { ...state, Data,DataPage,DataSave };
// },
returnPage(state, { Data }) {
return { ...state, Data};
}, },
returnPage2(state, { Data2 }) { returnPage2(state, { Data2 }) {
return { ...state, Data2 }; return { ...state, Data2 };
...@@ -77,7 +81,7 @@ export default { ...@@ -77,7 +81,7 @@ export default {
returnDataSave(state, { DataSave }) { returnDataSave(state, { DataSave }) {
return { ...state, DataSave}; return { ...state, DataSave};
}, },
DataSaveDetail(state, { DataSaveDetail,}) { DataSaveDetail(state, { DataSaveDetail, }) {
return { ...state, DataSaveDetail }; return { ...state, DataSaveDetail };
}, },
returnSource(state, { sourceData }) { returnSource(state, { sourceData }) {
...@@ -88,7 +92,12 @@ export default { ...@@ -88,7 +92,12 @@ export default {
}, },
returnResult(state, { Result }) { returnResult(state, { Result }) {
return { ...state, Result }; return { ...state, Result };
} },
// 时间
onResult(state, { resultTime }) {
return { ...state, resultTime };
},
}, },
...@@ -122,28 +131,22 @@ export default { ...@@ -122,28 +131,22 @@ export default {
// console.log('===========================') // console.log('===========================')
// console.log(playload) // console.log(playload)
switch (playload.index) { switch (playload.index) {
case 0: case 1:
case 9: {
{ let Data3 = resp.data;
let Data = {data:resp.data.list,total:resp.data.page} ; if (JSON.stringify(Data3) == "{}") {
yield put({ type: 'returnPage', Data }); Data3 = false
// 提示小区没有设施
message.error('There Are No Facilities In The Community !');
} }
break; yield put({ type: 'returnPage3', Data3});
case 1:
{ }break;
let Data3 = resp.data; case 2: {
if (JSON.stringify(Data3) == "{}") {
Data3 = false
// 提示小区没有设施
message.error('There Are No Facilities In The Community !');
}
yield put({ type: 'returnPage3', Data3});
}break;
case 2:{
let DataSaveDetail = resp.data; let DataSaveDetail = resp.data;
yield put({ type: 'DataSaveDetail', DataSaveDetail }); yield put({ type: 'DataSaveDetail', DataSaveDetail });
} break; } break;
case 3: case 3:
case 4: case 4:
...@@ -188,12 +191,29 @@ export default { ...@@ -188,12 +191,29 @@ export default {
let Data2 = {data:resp.data.list,total:resp.data.page}; let Data2 = {data:resp.data.list,total:resp.data.page};
yield put({ type: 'returnPage2', Data2, }); yield put({ type: 'returnPage2', Data2, });
} break; } break;
case 0:
case 9: {
let Data = {data:resp.data.list,total:resp.data.page} ;
yield put({ type: 'returnPage', Data });
}break;
// 自增公告列表 // 自增公告列表
case 25:{ case 25:{
let NoticeList = resp.data; let NoticeList = resp.data;
yield put({ type: 'retuNotice',payload:NoticeList, }); 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'; ...@@ -28,7 +28,7 @@ import moment from 'moment';
const FacilityBookings = (props: any) => { const FacilityBookings = (props: any) => {
const { formatMessage } = useIntl(); 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) => { const RA = (index: any, values: any) => {
console.log(values); console.log(values);
...@@ -48,7 +48,6 @@ const FacilityBookings = (props: any) => { ...@@ -48,7 +48,6 @@ const FacilityBookings = (props: any) => {
dispatch({ type: 'FacilityBookings/CA', playload: null }); dispatch({ type: 'FacilityBookings/CA', playload: null });
}; };
const [loading, setLoading] = useState(false);
const [columns, setColumns] = useState([]); const [columns, setColumns] = useState([]);
const [columns2, setColumns2] = useState([]); const [columns2, setColumns2] = useState([]);
...@@ -57,16 +56,22 @@ const FacilityBookings = (props: any) => { ...@@ -57,16 +56,22 @@ const FacilityBookings = (props: any) => {
CA(); CA();
// 先清空上传图片列表 // 先清空上传图片列表
dispatch({ type: 'FacilityBookings/overAllImgList' }); dispatch({ type: 'FacilityBookings/overAllImgList' });
} else {
// 清空之前的数据
let Data3 = null;
dispatch({ type: 'FacilityBookings/returnPage3', Data3 });
} }
history.push(location.pathname + (curString.tab == 1 ? '/Booking' : '/Adding')); history.push(location.pathname + (curString.tab == 1 ? '/Booking' : '/Adding'));
}; };
// 预约详情跳转
const goToDetail = (values: any) => { const goToDetail = (values: any) => {
SA(values); SA(values);
console.log('准备页面跳转');
console.log(curString);
history.push(location.pathname + '/Detail'); 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']; const path = ['/FacilityDetail', '/FacilityEdit', '/FacilityApply'];
SA(values); SA(values);
console.log('准备页面跳转'); console.log('准备页面跳转');
...@@ -125,9 +130,9 @@ const FacilityBookings = (props: any) => { ...@@ -125,9 +130,9 @@ const FacilityBookings = (props: any) => {
null, null,
(text: any, record: any) => ( (text: any, record: any) => (
<Space size="middle"> <Space size="middle">
<a onClick={makeOperator.bind(this, record, 0)}>Detail</a> <a onClick={() => makeOperator(record, 0)}>Detail</a>
<a onClick={makeOperator.bind(this, record, 1)}>Edit</a> <a onClick={() => makeOperator(record, 1)}>Edit</a>
<a onClick={makeOperator.bind(this, record, 2)}>Booking</a> <a onClick={() => makeOperator(record, 2)}>Booking</a>
</Space> </Space>
), ),
], ],
...@@ -150,10 +155,6 @@ const FacilityBookings = (props: any) => { ...@@ -150,10 +155,6 @@ const FacilityBookings = (props: any) => {
} }
}, []); }, []);
useEffect(() => {
setLoading(false);
}, [Data, Data2]);
const CallBackTitleSearch = (comment: any) => { const CallBackTitleSearch = (comment: any) => {
console.log(comment); console.log(comment);
...@@ -195,7 +196,6 @@ const FacilityBookings = (props: any) => { ...@@ -195,7 +196,6 @@ const FacilityBookings = (props: any) => {
} }
}; };
function TabCallback(tab: any) { function TabCallback(tab: any) {
setLoading(true);
var tmp = curString; var tmp = curString;
tmp.tab = tab; tmp.tab = tab;
QA(tmp); QA(tmp);
...@@ -212,7 +212,6 @@ const FacilityBookings = (props: any) => { ...@@ -212,7 +212,6 @@ const FacilityBookings = (props: any) => {
} }
} }
function Pagechange(current: any, pageSize: any) { function Pagechange(current: any, pageSize: any) {
setLoading(true);
if (curString.tab == 1) { if (curString.tab == 1) {
var tmp = curString; var tmp = curString;
tmp.curPage = current; tmp.curPage = current;
...@@ -285,12 +284,15 @@ const FacilityBookings = (props: any) => { ...@@ -285,12 +284,15 @@ const FacilityBookings = (props: any) => {
</Button> </Button>
</div> */} </div> */}
<Tabs defaultActiveKey={curString.tab.toString()} onChange={TabCallback}> <Tabs
defaultActiveKey={curString.tab.toString()}
onChange={TabCallback}
className="diytabs"
>
<TabPane tab="Facility Bookings" key="1"> <TabPane tab="Facility Bookings" key="1">
<ProTable <ProTable
loading={loading} loading={loading}
rowKey="id" rowKey="id"
style={{ marginTop: 16 }}
dataSource={Data.data} dataSource={Data.data}
columns={columns} columns={columns}
pagination={{ pagination={{
...@@ -322,7 +324,6 @@ const FacilityBookings = (props: any) => { ...@@ -322,7 +324,6 @@ const FacilityBookings = (props: any) => {
<ProTable <ProTable
loading={loading} loading={loading}
rowKey="id" rowKey="id"
style={{ marginTop: 16 }}
dataSource={Data2.data} dataSource={Data2.data}
columns={columns2} columns={columns2}
pagination={{ pagination={{
...@@ -359,6 +360,10 @@ const FacilityBookings = (props: any) => { ...@@ -359,6 +360,10 @@ const FacilityBookings = (props: any) => {
function mapStateToProps(state: any) { function mapStateToProps(state: any) {
const { Data, Data2, DataSave, curString, Result } = state.FacilityBookings; const { Data, Data2, DataSave, curString, Result } = state.FacilityBookings;
const { token } = state.login; const { token } = state.login;
const loading =
typeof state.loading.models.FacilityBookings == 'undefined'
? true
: state.loading.models.FacilityBookings;
return { return {
Data, Data,
Data2, Data2,
...@@ -366,6 +371,7 @@ function mapStateToProps(state: any) { ...@@ -366,6 +371,7 @@ function mapStateToProps(state: any) {
curString, curString,
Result, Result,
token, token,
loading,
}; };
} }
export default connect(mapStateToProps)(FacilityBookings); export default connect(mapStateToProps)(FacilityBookings);
......
...@@ -188,3 +188,36 @@ ...@@ -188,3 +188,36 @@
margin: 0 20px; 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 { ...@@ -350,3 +350,9 @@ hr {
// transform: translateY(-50%); // transform: translateY(-50%);
} }
} }
.diytabs {
.ant-tabs-nav {
margin-bottom: 0;
}
}
...@@ -136,6 +136,7 @@ export const requestList = [ ...@@ -136,6 +136,7 @@ export const requestList = [
['/tos/fileAndImage/preview', '47 获取附件地址', {}], ['/tos/fileAndImage/preview', '47 获取附件地址', {}],
['/tos/tosCommunity/get/list', '48 修改获取小区列表', {}], ['/tos/tosCommunity/get/list', '48 修改获取小区列表', {}],
['/tos/community/delete', '49 关闭小区', {}], ['/tos/community/delete', '49 关闭小区', {}],
['/tos/community/facilities/subscribeTime/query', '50 设施预订时间段查询', {}],
]; ];
const params = [ const params = [
......
...@@ -43,10 +43,10 @@ export const NewFaci = [ ...@@ -43,10 +43,10 @@ export const NewFaci = [
// 设施预订 // 设施预订
export const BookingsTip = [ export const BookingsTip = [
[{ required: false, message: 'Please select community' }], [{ required: true, message: 'Please input Name ' }],
[{ required: false, message: 'Please input Facility Name' }], [{ required: true, message: 'Please input Contact Details' }],
[{ required: false, message: 'Please Set management fee' }], [{ required: true, message: 'Required' }],
[{ required: false, message: 'Please Set Setting deposit' }], [{ required: true, message: 'Required' }],
[{ required: false, message: 'Please Upload facility photos' }], [{ required: true, message: 'Required' }],
[{ required: false, 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