Commit 47d17e5f authored by cellee's avatar cellee

设施新增重做

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent 4ac63b98
import React, { useState, useEffect, useRef } from 'react';
import './index.less';
import { Input, Button, Upload, Form, Select, message, Modal } from 'antd';
const { Option } = Select;
import { PlusOutlined } from '@ant-design/icons';
import { Link, useIntl, connect, Dispatch, history } from 'umi';
import { event } from '@/.umi/plugin-locale/locale';
function getBase64(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result);
reader.onerror = (error) => reject(error);
});
}
const Facilitys = (props: any) => {
//传递值
const { updata, disabled } = props;
console.log(disabled);
//上传列表
const [fileList, setFileList] = useState([]);
//显示隐藏
const [previewVisible, setpreviewVisible] = useState(false);
// 名称
const [previewTitle, setpreviewTitle] = useState('');
// 图片地址
const [previewImage, setpreviewImage] = useState(null);
// 新增按钮
const uploadButton = (
<div>
<PlusOutlined />
<div className="ant-upload-text">Upload</div>
</div>
);
// 上传属性
const uploadProps = {
listType: 'picture-card',
accept: '.jpeg,.png,.jpg',
action: '/tos/image/upload',
// fileList: fileList,
onChange(info: any) {
console.log(info);
if (info.file.status === 'done') {
message.success(`${info.file.name} file uploaded successfully`);
// 拿到key 值 开始存储
let list = fileList;
// setFileList(list); // 注意 不能直接赋值 因为使用完全绑定需要全部更新
setFileList([...list]);
console.log(fileList);
} else if (info.file.status === 'error') {
message.error(`${info.file.name} file upload failed.`);
}
},
};
// 上传
const carryData = (key: any) => {
console.log(`key值是${key}`);
updata.identification = key;
console.log(updata);
return updata;
};
// 预览
const handlePreview = async (file) => {
if (!file.url && !file.preview) {
file.preview = await getBase64(file.originFileObj);
}
setpreviewImage(file.url || file.preview);
setpreviewTitle(file.name);
setpreviewVisible(true);
};
// 点击遮罩回调
const handleCancel = () => {
setpreviewVisible(false);
};
// 点击移除图片
const handRemove = () => {
setFileList([...fileList]);
};
return (
<>
<Form.List
name="names"
rules={[
{
validator: async (_, names) => {
// if (!names || names.length < 2) {
// return Promise.reject(new Error('At least 2 passengers'));
// }
},
},
]}
>
{(fields, { add, remove }, { errors }) => (
<>
{fields.map((field, index) => (
<Form.Item required={false} key={field.key} style={{ marginBottom: 0 }}>
{/* 每一个上传的组件 */}
<div className={'test'}>
<div className={'diybox'}>
<Upload
fileList={fileList}
data={carryData(index)}
{...uploadProps}
disabled={disabled}
onPreview={handlePreview}
onRemove={handRemove}
>
{/* 这里存在一个bug 当 key 超过 fileList 的默认值后 会报错 */}
{fileList.length >= 1 ? null : uploadButton}
</Upload>
<div className={'Facility'}>
<Form.Item
label={`Facility Name ${index}`}
name={field.key}
rules={[{ required: true, message: 'Please input Facility Name!' }]}
>
<Input placeholder="Facility Name" disabled={disabled} />
</Form.Item>
<div className={'over'}>
{fields.length > 1 ? (
<Button
type="link"
disabled={disabled}
onClick={() => remove(field.name)}
>
Delete
</Button>
) : null}
</div>
</div>
</div>
</div>
</Form.Item>
))}
{fields.length < 5 ? (
<Form.Item>
<Button
type="dashed"
onClick={() => add()}
style={{ width: '100px', height: '100px' }}
icon={<PlusOutlined />}
disabled={disabled}
></Button>
<Form.ErrorList errors={errors} />
</Form.Item>
) : null}
</>
)}
</Form.List>
{/* 预览表格 */}
<Modal visible={previewVisible} title={previewTitle} footer={null} onCancel={handleCancel}>
<img alt="example" style={{ width: '100%' }} src={previewImage} />
</Modal>
</>
);
};
export default Facilitys;
import React, { useState } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import './index.less'; import './index.less';
import { Button, Form, message, Modal } from 'antd'; import { Button, Form, message, Modal, Input, Upload } from 'antd';
import { PlusOutlined } from '@ant-design/icons'; import { PlusOutlined } from '@ant-design/icons';
import FacilitysTow from './FacilitysTow'; // import FacilitysTow from './FacilitysTow';
import { Link, useIntl, connect, Dispatch, history } from 'umi'; import { Link, useIntl, connect, Dispatch, history } from 'umi';
function getBase64(file) { function getBase64(file: any) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const reader = new FileReader(); const reader = new FileReader();
reader.readAsDataURL(file); reader.readAsDataURL(file);
...@@ -13,32 +13,195 @@ function getBase64(file) { ...@@ -13,32 +13,195 @@ function getBase64(file) {
reader.onerror = (error) => reject(error); reader.onerror = (error) => reject(error);
}); });
} }
const module = 'FacilityBookings';
const Facilitys = (props: any) => { const Facilitys = (props: any) => {
//传递值 //传递值
const { updata, disabled } = props; const { updata, disabled, FacilitysList, dispatch, dumps } = props;
//上传列表
// const [FacilitysList, setFileList] = useState(FacilitysList);
//显示隐藏
const [previewVisible, setpreviewVisible] = useState(false);
// 名称
const [previewTitle, setpreviewTitle] = useState('');
// 图片地址
const [previewImage, setpreviewImage] = useState('');
// 传递给后台加 key
const updetaTow = (key: any) => {
let data = updata;
data.identification = key;
return data;
};
//绑定值
const updetaList = (key: any) => {
return FacilitysList[key].fileList;
};
// 预览
const handlePreview = async (file: any) => {
if (!file.url && !file.preview) {
file.preview = await getBase64(file.originFileObj);
}
setpreviewImage(file.url || file.preview);
setpreviewTitle(file.name);
setpreviewVisible(true);
};
// 点击移除图片
const handRemove = (key: any) => {
// let list = fileList;
// 将图片信息提交给state
deleteImg(key);
};
// 点击遮罩回调
const handleCancel = () => {
setpreviewVisible(false);
};
// 上传属性
const uploadProps: any = {
listType: 'picture-card',
accept: '.jpeg,.png,.jpg',
action: '/tos/image/upload',
onChange(info: any) {
// console.log(info);
if (info.file.status === 'done') {
message.success(`${info.file.name} file uploaded successfully`);
// 拿到key 值 开始存储
let key = info.fileList[0].response.data.identification;
let list = FacilitysList;
list[key].id = key;
list[key].fileList = info.fileList;
// 存储到mode里面去
dispatch({ type: module + '/genxin', list });
// 当前页面也要刷新
// let list = fileList;
// setFileList(list); // 注意 不能直接赋值 因为使用完全绑定需要全部更新
// setFileList(list);
// let list: any = [...fileList, ...info.fileList];
// setFileList(list);
console.log(list);
// 将图片信息提交给state
// let data = { val: info.file.name, key: keys };
// dispatch({ type: module + '/retImgsList', data });
// 结束
} else if (info.file.status === 'error') {
message.error(`${info.file.name} file upload failed.`);
}
},
};
// 新增动作
const add = () => {
let list = FacilitysList;
let adds = {
id: '-1',
fileList: [],
name: '',
};
// 验证已添加的是否上传完整
let complete = list.every((item: any) => {
// return item.fileList.length > 0 && item.name !== '';
return item.fileList.length > 0;
});
if (list.length == 0 || complete) {
list.push(adds);
// 存储到mode里面去
dispatch({ type: module + '/genxin', list });
} else {
// 提示每一项都要填写完
message.error('Please fill out each item !');
}
};
//删除动作
const deleteImg = (key: any) => {
let list = FacilitysList;
list[key].name = '';
// 这里还要清除表单的值,否则再次新增输入框的值会重复出现
dumps(key);
list.splice(key, 1);
// 存储到mode里面去
dispatch({ type: module + '/genxin', list });
};
// 新增按钮
const uploadButton = (
<div>
<PlusOutlined />
<div className="ant-upload-text">Upload</div>
</div>
);
// 输入框内容
const monitor = (e: any) => {
let list = FacilitysList;
let { id, value } = e.target;
if (id == 'basic_shebei_0') {
id = 0;
}
list[id].name = value;
dispatch({ type: module + '/genxin', list });
};
return ( return (
<> <>
<Form.List <Form.Item name="picList" required={false} style={{ marginBottom: 0 }}>
name="picList" {FacilitysList.map((item: any, index: any, key: any) => {
rules={[ return (
{ <div className={'test'} key={'pic_' + index}>
validator: async (_, names) => { <div className={'diybox'} key={'pic_' + index}>
// if (!names || names.length < 2) { <Upload
// return Promise.reject(new Error('At least 2 passengers')); {...uploadProps}
// } fileList={
}, FacilitysList[index].fileList.length > 0 ? FacilitysList[index].fileList : false
}, }
]} // data={updata}
data={updetaTow(index)} // 携带数据
disabled={disabled} // 禁止
onPreview={handlePreview} // 预览
onRemove={() => {
handRemove(index);
}} //移除
> >
{(fields, { add, remove }, { errors }) => ( {FacilitysList[index].fileList.length > 0 ? null : uploadButton}
<> </Upload>
{fields.map((field, index) => (
<Form.Item required={false} key={field.key} style={{ marginBottom: 0 }}> <div className={'Facility'} key={'pic_' + index}>
<FacilitysTow updata={updata} disabled={disabled} keys={field.key}></FacilitysTow> <Form.Item
label={`Facility Name ${index + 1}`}
name={'shebei_' + index}
rules={[{ required: true, message: 'Please input Facility Name!' }]}
>
<Input
placeholder="Facility Name"
disabled={disabled}
id={index}
onChange={(e: any) => monitor(e)}
value={FacilitysList[index].name}
/>
</Form.Item>
<div className={'over'}>
<Button type="link" disabled={disabled} onClick={() => deleteImg(index)}>
Delete
</Button>
</div>
</div>
</div>
</div>
);
})}
</Form.Item> </Form.Item>
))}
{fields.length < 5 ? (
<Form.Item> <Form.Item>
<Button <Button
type="dashed" type="dashed"
...@@ -47,20 +210,21 @@ const Facilitys = (props: any) => { ...@@ -47,20 +210,21 @@ const Facilitys = (props: any) => {
icon={<PlusOutlined />} icon={<PlusOutlined />}
disabled={disabled} disabled={disabled}
></Button> ></Button>
<Form.ErrorList errors={errors} />
</Form.Item> </Form.Item>
) : null}
</> {/* 预览表格 */}
)} <Modal visible={previewVisible} title={previewTitle} footer={null} onCancel={handleCancel}>
</Form.List> <img alt="example" style={{ width: '100%' }} src={previewImage} />
</Modal>
</> </>
); );
}; };
function mapStateToProps(state: any) { function mapStateToProps(state: any) {
const { imgList } = state.FacilityBookings; const { FacilitysList } = state.FacilityBookings;
console.log(FacilitysList);
return { return {
imgList, FacilitysList,
}; };
} }
export default connect(mapStateToProps)(Facilitys); export default connect(mapStateToProps)(Facilitys);
import React, { useState, useEffect, useRef } from 'react';
import './index.less';
import { Input, Upload, Form, Select, message, Modal } from 'antd';
const { Option } = Select;
import { PlusOutlined } from '@ant-design/icons';
import { Link, useIntl, connect, Dispatch, history } from 'umi';
function getBase64(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result);
reader.onerror = (error) => reject(error);
});
}
const module = 'FacilityBookings';
const FacilitysTow = (props: any) => {
const { updata, disabled, keys, dispatch } = props;
//上传列表
const [fileList, setFileList] = useState([]);
//显示隐藏
const [previewVisible, setpreviewVisible] = useState(false);
// 名称
const [previewTitle, setpreviewTitle] = useState('');
// 图片地址
const [previewImage, setpreviewImage] = useState('');
// 新增按钮
const uploadButton = (
<div>
<PlusOutlined />
<div className="ant-upload-text">Upload</div>
</div>
);
// 上传属性
const uploadProps = {
listType: 'picture-card',
accept: '.jpeg,.png,.jpg',
action: '/tos/image/upload',
// fileList: fileList,
onChange(info: any) {
console.log(info);
if (info.file.status === 'done') {
message.success(`${info.file.name} file uploaded successfully`);
// 拿到key 值 开始存储
// let key = info.fileList[0].response.data.identification;
// let list = fileList;
// list[key] = info.fileList;
// setFileList(list); // 注意 不能直接赋值 因为使用完全绑定需要全部更新
// setFileList(list);
let list: any = [...fileList, ...info.fileList];
setFileList(list);
console.log(info);
// 将图片信息提交给state
let data = { val: info.file.name, key: keys };
dispatch({ type: module + '/retImgsList', data });
// 结束
} else if (info.file.status === 'error') {
message.error(`${info.file.name} file upload failed.`);
}
},
};
// 预览
const handlePreview = async (file) => {
if (!file.url && !file.preview) {
file.preview = await getBase64(file.originFileObj);
}
setpreviewImage(file.url || file.preview);
setpreviewTitle(file.name);
setpreviewVisible(true);
};
// 点击遮罩回调
const handleCancel = () => {
setpreviewVisible(false);
};
// 点击移除图片
const handRemove = () => {
// let list = fileList;
setFileList([]);
// 将图片信息提交给state
let data = { key: keys };
dispatch({ type: module + '/overImgList', data });
};
// 输入框内容
const monitor = (e: any) => {
let data = { val: e.target.value, key: keys };
dispatch({ type: module + '/retImgsName', data });
};
return (
<div>
{}
{/* 每一个上传的组件 */}
<div className={'test'}>
<div className={'diybox'}>
<Upload
fileList={fileList}
data={updata}
{...uploadProps}
disabled={disabled}
onPreview={handlePreview}
onRemove={handRemove}
>
{/* 这里存在一个bug 当 key 超过 fileList 的默认值后 会报错 */}
{fileList.length >= 1 ? null : uploadButton}
</Upload>
<div className={'Facility'}>
<Form.Item
label={`Facility Name ${keys}`}
name={keys.key}
rules={[{ required: true, message: 'Please input Facility Name!' }]}
>
<Input placeholder="Facility Name" onChange={monitor} disabled={disabled} />
</Form.Item>
<div className={'over'}>
{/* {fields.length > 1 ? (
<Button type="link" disabled={disabled} onClick={() => remove(field.name)}>
Delete
</Button>
) : null} */}
</div>
</div>
</div>
</div>
{/* 预览表格 */}
<Modal visible={previewVisible} title={previewTitle} footer={null} onCancel={handleCancel}>
<img alt="example" style={{ width: '100%' }} src={previewImage} />
</Modal>
</div>
);
};
function mapProps(state: any) {
console.log(state.FacilityBookings);
console.log('------------------');
const { imgList } = state.FacilityBookings;
return {
imgList,
};
}
export default connect(mapProps)(FacilitysTow);
...@@ -3,9 +3,11 @@ import { Select } from 'antd'; ...@@ -3,9 +3,11 @@ import { Select } from 'antd';
const Option = Select.Option; const Option = Select.Option;
const OnTime = (porps: any) => { const OnTime = (porps: any) => {
// placeholder 默认显示 disabled 是否禁止 openSelect 选中函数 limit 限制时间 // placeholder 默认显示 disabled 是否禁止
let { placeholder, disabled, openSelect, limit } = porps; // openSelect 选中函数 limit 限制时间 type 类型 时开始还是结束 1 就是结束 结尾是59
let { placeholder, disabled, openSelect, limit, type } = porps;
console.log(limit);
// 生成数组 -- 时间 // 生成数组 -- 时间
const createArray = (num: any) => { const createArray = (num: any) => {
var arr = []; var arr = [];
...@@ -21,11 +23,15 @@ const OnTime = (porps: any) => { ...@@ -21,11 +23,15 @@ const OnTime = (porps: any) => {
//小时 //小时
const hourS = createArray(24).map((item) => const hourS = createArray(24).map((item) =>
// 处理限制时间 // 处理限制时间
limit ? ( limit ? (
<Option value={item + ':00'} key={item} disabled={Times(item, limit)}>{`${item}:00`}</Option> <Option value={item + (type ? ':59' : ':00')} key={item} disabled={Times(item, limit)}>
{item + (type ? ':59' : ':00')}
</Option>
) : ( ) : (
<Option value={item + ':00'} key={item}>{`${item}:00`}</Option> <Option value={item + (type ? ':59' : ':00')} key={item}>
{item + (type ? ':59' : ':00')}
</Option>
), ),
); );
......
...@@ -29,8 +29,8 @@ export default { ...@@ -29,8 +29,8 @@ export default {
// 不知道前面是干嘛的,自增公告列表 // 不知道前面是干嘛的,自增公告列表
NoticeList: [], NoticeList: [],
imgList: [{}, {}, {}, {}, {}], // 设施图片列表 resultTime: null, // 设施已预约时间段
resultTime:null, // 设施已预约时间段 FacilitysList: [],// 动态新增组件
}, },
reducers: { reducers: {
...@@ -41,9 +41,9 @@ export default { ...@@ -41,9 +41,9 @@ export default {
}, },
// 设施图片列表 // 设施图片列表
retImgsList(state,{data}) { retImgsList(state, { list }) {
state.imgList[data.key]['pic'] = data.val; let FacilitysList = list;
return state return { ...state, FacilitysList}
}, },
// 设施图片名称 // 设施图片名称
...@@ -242,8 +242,10 @@ export default { ...@@ -242,8 +242,10 @@ export default {
yield put({type: 'returnResult', null} ) yield put({type: 'returnResult', null} )
}, },
// 更新列表
*genxin({ list }, { put }) {
yield put({type: 'retImgsList', list} )
}
}, },
......
...@@ -352,15 +352,17 @@ const Bookings = (props: any) => { ...@@ -352,15 +352,17 @@ const Bookings = (props: any) => {
disabled={prohibit} disabled={prohibit}
limit={curString.categoriesOpenTime} limit={curString.categoriesOpenTime}
openSelect={startTimes} openSelect={startTimes}
type={0}
/> />
</Form.Item> </Form.Item>
<span className="diyspan">-</span> <span className="diyspan">-</span>
<Form.Item name="endTime" noStyle> <Form.Item name="endTime" noStyle>
<OnTime <OnTime
placeholder={'Closing Time'} placeholder={'Closing Time'} // 默认值
disabled={prohibit} disabled={prohibit} // 是否禁止
limit={curString.categoriesOpenTime} limit={curString.categoriesOpenTime} // 禁止时间段
openSelect={endTimes} openSelect={endTimes} // 时间类型
type={1}
/> />
</Form.Item> </Form.Item>
</Form.Item> </Form.Item>
......
...@@ -28,7 +28,7 @@ import TimeSelect from '../../../components/TimeSelect/TimeSelect'; ...@@ -28,7 +28,7 @@ import TimeSelect from '../../../components/TimeSelect/TimeSelect';
import Line from '../../../components/Line/Line'; import Line from '../../../components/Line/Line';
import { getNumber } from '../../../utils/string'; import { getNumber } from '../../../utils/string';
import SearchOptionsCommnity from '../../../components/SearchOptions/SearchOptionsCommnity'; import SearchOptionsCommnity from '@/components/SearchOptions/SearchOptionsCommnity';
import { NewFaci } from '@/utils/tip'; import { NewFaci } from '@/utils/tip';
...@@ -45,7 +45,9 @@ const module = 'FacilityBookings'; ...@@ -45,7 +45,9 @@ const module = 'FacilityBookings';
import moment from 'moment'; import moment from 'moment';
const Facility = (props: any) => { const Facility = (props: any) => {
const { dispatch, location, token, sourceData, DataSave, Result, imgList, load } = 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 } });
...@@ -66,15 +68,13 @@ const Facility = (props: any) => { ...@@ -66,15 +68,13 @@ const Facility = (props: any) => {
const formRef = useRef(null); const formRef = useRef(null);
// 再监听列表 // 页面进来 先清一遍 图片列表
const [extImgList, setextImgList] = useState(imgList);
useEffect(() => { useEffect(() => {
console.log('变化'); if (DataSave == null) {
console.log(imgList); let list: any = [];
if (imgList != null) { dispatch({ type: module + '/genxin', list });
setextImgList(imgList);
} }
}, [imgList]); }, [1]);
useEffect(() => { useEffect(() => {
if (Result != null) { if (Result != null) {
...@@ -140,8 +140,12 @@ const Facility = (props: any) => { ...@@ -140,8 +140,12 @@ const Facility = (props: any) => {
const onFinish = (values: any) => { const onFinish = (values: any) => {
var result = values; var result = values;
// 过滤表单; // 过滤表单;
let imgs = extImgList.filter((item: any) => (Object.keys(item).length == 0 ? false : true)); let imgs: any = [];
console.log(imgs.length);
for (let i in FacilitysList) {
imgs[i] = `${FacilitysList[i].fileList[0].name}&${FacilitysList[i].name}`;
}
// 开放时间判断 // 开放时间判断
if (imgs.length == 0) { if (imgs.length == 0) {
message.error('Please upload at least one facility!'); message.error('Please upload at least one facility!');
...@@ -149,24 +153,15 @@ const Facility = (props: any) => { ...@@ -149,24 +153,15 @@ const Facility = (props: any) => {
message.error('Please select the opening time!'); message.error('Please select the opening time!');
} else { } else {
// 先处理设施和时间 // 先处理设施和时间
let categoriesName: any = [];
let reservationQuantumTime: any = [ let reservationQuantumTime: any = [
moment(result.startTime, 'HH:mm').format('HH:mm'), moment(result.startTime, 'HH:mm').format('HH:mm'),
moment(result.endTime, 'HH:mm').format('HH:mm'), moment(result.endTime, 'HH:mm').format('HH:mm'),
]; ];
for (var i in imgs) { let categoriesName: any = imgs; // 设施图片
if (imgs[i].name && imgs[i].pic) {
categoriesName[i] = `${imgs[i].name}&${imgs[i].pic}`;
} else {
message.error('Please fill in the name of the facility!');
return;
}
}
result.categoriesName = categoriesName; // 设施内容 result.categoriesName = categoriesName; // 设施内容
result.reservationQuantumTime = reservationQuantumTime; // 开放时间段 result.reservationQuantumTime = reservationQuantumTime; // 开放时间段
result.categoriesOpenTime = `${result.startTime}-${result.endTime}`; // 预约时间段 二开需要 result.categoriesOpenTime = `${result.startTime}-${result.endTime}`; // 预约时间段 二开需要
delete result.startTime; delete result.startTime;
delete result.periodType;
delete result.picList; delete result.picList;
console.log(reservationQuantumTime); console.log(reservationQuantumTime);
console.log(result); console.log(result);
...@@ -272,7 +267,7 @@ const Facility = (props: any) => { ...@@ -272,7 +267,7 @@ const Facility = (props: any) => {
)); ));
// 图片列表 // 图片列表
const fileList: any = [];
// 表单标识 // 表单标识
const [form] = Form.useForm(); const [form] = Form.useForm();
// 选择小区名字并赋值 // 选择小区名字并赋值
...@@ -288,6 +283,14 @@ const Facility = (props: any) => { ...@@ -288,6 +283,14 @@ const Facility = (props: any) => {
setImgOpen(true); setImgOpen(true);
} }
}; };
// 子组件清除表单的 输入框值
const dumps = (key: any) => {
form.setFieldsValue({
['shebei_' + key]: '',
});
};
return ( return (
<div className={'base basediy'}> <div className={'base basediy'}>
{/* 头部组件v1.2 */} {/* 头部组件v1.2 */}
...@@ -304,6 +307,7 @@ const Facility = (props: any) => { ...@@ -304,6 +307,7 @@ const Facility = (props: any) => {
<Form.Item label="Community" name="communityName" rules={NewFaci[0]}> <Form.Item label="Community" name="communityName" rules={NewFaci[0]}>
<SearchOptionsCommnity <SearchOptionsCommnity
// ubmit={extendName} // ubmit={extendName}
defaultName={DataSave != null ? DataSave.communityName : ''}
opname={opname} opname={opname}
/> />
</Form.Item> </Form.Item>
...@@ -352,6 +356,7 @@ const Facility = (props: any) => { ...@@ -352,6 +356,7 @@ const Facility = (props: any) => {
imageType: 'categoriesImageName', imageType: 'categoriesImageName',
extends: ctyName, extends: ctyName,
}} }}
dumps={dumps}
></Facilitys> ></Facilitys>
</Form.Item> </Form.Item>
...@@ -360,7 +365,7 @@ const Facility = (props: any) => { ...@@ -360,7 +365,7 @@ const Facility = (props: any) => {
<PictureOptionsRow <PictureOptionsRow
over={imgOpen} over={imgOpen}
data={{ data={{
userToken: token, // userToken: token,
imageType: 'categoriesDetailsImageName', imageType: 'categoriesDetailsImageName',
extends: ctyName, extends: ctyName,
}} }}
...@@ -474,19 +479,19 @@ const Facility = (props: any) => { ...@@ -474,19 +479,19 @@ const Facility = (props: any) => {
}; };
function mapStateToProps(state: any) { function mapStateToProps(state: any) {
const { sourceData, DataSave, Result, imgList } = state.FacilityBookings; const { sourceData, DataSave, Result, FacilitysList } = state.FacilityBookings;
const { token } = state.login; const { token } = state.login;
const load = const load =
typeof state.loading.models.FacilityBookings == 'undefined' typeof state.loading.models.FacilityBookings == 'undefined'
? true ? false
: state.loading.models.FacilityBookings; : state.loading.models.FacilityBookings;
return { return {
DataSave, DataSave,
sourceData, sourceData,
token, token,
Result, Result,
imgList,
load, load,
FacilitysList,
}; };
} }
export default connect(mapStateToProps)(Facility); export default connect(mapStateToProps)(Facility);
......
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Input, Tabs, Table, Space, Button } from 'antd'; import { Input, Tabs, Pagination, Space, Button } from 'antd';
const { TabPane } = Tabs; const { TabPane } = Tabs;
import { Link, useIntl, connect, Dispatch, history } from 'umi'; import { Link, useIntl, connect, Dispatch, history } from 'umi';
...@@ -102,7 +102,8 @@ const FacilityBookings = (props: any) => { ...@@ -102,7 +102,8 @@ const FacilityBookings = (props: any) => {
(text: any) => ( (text: any) => (
<div> <div>
<ClockCircleOutlined style={{ color: '#666' }} /> <ClockCircleOutlined style={{ color: '#666' }} />
&nbsp;{text} &nbsp;
{moment(text).format('YYYY-MM-DD')}
</div> </div>
), ),
], ],
...@@ -295,12 +296,13 @@ const FacilityBookings = (props: any) => { ...@@ -295,12 +296,13 @@ const FacilityBookings = (props: any) => {
rowKey="id" rowKey="id"
dataSource={Data.data} dataSource={Data.data}
columns={columns} columns={columns}
pagination={{ // pagination={{
current: curString.curPage, // current: curString.curPage,
total: Data.total.totalRow, // total: Data.total.totalRow,
showSizeChanger: false, // showSizeChanger: false,
onChange: Pagechange, // onChange: Pagechange,
}} // }}
pagination={false}
search={false} search={false}
toolBarRender={() => [ toolBarRender={() => [
<Button key="3" type="primary" onClick={goToFunction}> <Button key="3" type="primary" onClick={goToFunction}>
...@@ -318,6 +320,21 @@ const FacilityBookings = (props: any) => { ...@@ -318,6 +320,21 @@ const FacilityBookings = (props: any) => {
}} }}
headerTitle="预约列表" headerTitle="预约列表"
/> />
{curString ? (
<div className="pages">
<Pagination
current={curString.curPage}
total={Data.total.totalRow}
// pageSizeOptions={[]}
showSizeChanger={false}
// pageSize={village.page.curPageSize}
onChange={Pagechange}
/>
</div>
) : (
''
)}
</TabPane> </TabPane>
<TabPane tab="Facility Management" key="2"> <TabPane tab="Facility Management" key="2">
......
...@@ -356,3 +356,8 @@ hr { ...@@ -356,3 +356,8 @@ hr {
margin-bottom: 0; margin-bottom: 0;
} }
} }
.pages {
background: #fff;
text-align: right;
padding: 20px 10px 10px;
}
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