Commit 0a284db6 authored by cellee's avatar cellee

设施修复

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent a329cf87
...@@ -17,7 +17,7 @@ const module = 'FacilityBookings'; ...@@ -17,7 +17,7 @@ const module = 'FacilityBookings';
const Facilitys = (props: any) => { const Facilitys = (props: any) => {
//传递值 //传递值
const { updata, disabled, FacilitysList, dispatch, dumps } = props; const { updata, disabled, FacilitysList, dispatch } = props;
//上传列表 //上传列表
// const [FacilitysList, setFileList] = useState(FacilitysList); // const [FacilitysList, setFileList] = useState(FacilitysList);
...@@ -27,6 +27,8 @@ const Facilitys = (props: any) => { ...@@ -27,6 +27,8 @@ const Facilitys = (props: any) => {
const [previewTitle, setpreviewTitle] = useState(''); const [previewTitle, setpreviewTitle] = useState('');
// 图片地址 // 图片地址
const [previewImage, setpreviewImage] = useState(''); const [previewImage, setpreviewImage] = useState('');
//
const [idKey, setidKey] = useState(10001);
// 传递给后台加 key // 传递给后台加 key
const updetaTow = (key: any) => { const updetaTow = (key: any) => {
...@@ -60,18 +62,22 @@ const Facilitys = (props: any) => { ...@@ -60,18 +62,22 @@ const Facilitys = (props: any) => {
if (info.file.status === 'done') { if (info.file.status === 'done') {
message.success(`${info.file.name} file uploaded successfully`); message.success(`${info.file.name} file uploaded successfully`);
// 拿到key 值 开始存储 // 拿到key 值 开始存储
let key = info.fileList[0].response.data.identification; let key = parseInt(info.fileList[0].response.data.identification);
console.log(info);
console.log(key);
let list = FacilitysList; let list = FacilitysList;
setidKey(idKey + 1);
list[key] = { list[key] = {
id: key, id: idKey,
fileList: info.fileList,
name: FacilitysList[key].name, name: FacilitysList[key].name,
fileList: info.fileList,
disabled: false, disabled: false,
}; };
// 存储到mode里面去 // 存储到mode里面去
dispatch({ type: module + '/genxin', list }); dispatch({ type: module + '/genxin', list });
console.log(list);
} else if (info.file.status === 'error') { } else if (info.file.status === 'error') {
message.error(`${info.file.name} file upload failed.`); message.error(`${info.file.name} file upload failed.`);
} }
...@@ -80,6 +86,7 @@ const Facilitys = (props: any) => { ...@@ -80,6 +86,7 @@ const Facilitys = (props: any) => {
// 新增动作 // 新增动作
const add = () => { const add = () => {
setidKey(idKey + 1);
let list = FacilitysList; let list = FacilitysList;
let adds = { let adds = {
id: '-1', id: '-1',
...@@ -97,10 +104,15 @@ const Facilitys = (props: any) => { ...@@ -97,10 +104,15 @@ const Facilitys = (props: any) => {
list.push(adds); list.push(adds);
// 存储到mode里面去 // 存储到mode里面去
dispatch({ type: module + '/genxin', list }); dispatch({ type: module + '/genxin', list });
console.log(list);
} else { } else {
// 提示每一项都要填写完 // 提示每一项都要填写完
message.error('Please fill out each item !'); message.error('Please fill out each item !');
} }
// 新增的时候把当前的表单输入框清空
// foEmpty(FacilitysList.length - 1);
}; };
//删除动作 //删除动作
...@@ -108,10 +120,6 @@ const Facilitys = (props: any) => { ...@@ -108,10 +120,6 @@ const Facilitys = (props: any) => {
let list = FacilitysList; let list = FacilitysList;
list[key].name = ''; list[key].name = '';
// 这里还要清除表单的值,否则再次新增输入框的值会重复出现
dumps(id);
list.splice(key, 1); list.splice(key, 1);
// 存储到mode里面去 // 存储到mode里面去
dispatch({ type: module + '/genxin', list }); dispatch({ type: module + '/genxin', list });
...@@ -121,7 +129,6 @@ const Facilitys = (props: any) => { ...@@ -121,7 +129,6 @@ const Facilitys = (props: any) => {
const deleteImgs = (key: any, id: any) => { const deleteImgs = (key: any, id: any) => {
let list = FacilitysList; let list = FacilitysList;
list[key].name = '';
list[key].fileList = []; list[key].fileList = [];
// 存储到mode里面去 // 存储到mode里面去
...@@ -146,55 +153,59 @@ const Facilitys = (props: any) => { ...@@ -146,55 +153,59 @@ const Facilitys = (props: any) => {
return ( return (
<> <>
<Form.Item name="picList" required={false} style={{ marginBottom: 0 }}> <Form.Item name="picList" required={false} style={{ marginBottom: 0 }}>
{FacilitysList.map((item: any, index: any, key: any) => { {FacilitysList
return ( ? FacilitysList.map((item: any, index: any, key: any) => {
<div className={'test'} key={item.id}> return (
<div className={'diybox'} key={item.id}> <div className={'test'} key={item.id}>
<Upload <div className={'diybox'} key={item.id}>
{...uploadProps} <Upload
fileList={ {...uploadProps}
FacilitysList[index].fileList.length > 0 ? FacilitysList[index].fileList : false fileList={
} FacilitysList[index].fileList.length > 0
// data={updata} ? FacilitysList[index].fileList
data={updetaTow(index)} // 携带数据 : false
disabled={disabled} // 禁止 }
onPreview={handlePreview} // 预览 // data={updata}
onRemove={() => { data={updetaTow(index)} // 携带数据
deleteImgs(index, item.id); disabled={disabled} // 禁止
}} //移除 onPreview={handlePreview} // 预览
> onRemove={() => {
{FacilitysList[index].fileList.length > 0 ? null : uploadButton} deleteImgs(index, item.id);
</Upload> }} //移除
<div className={'Facility'} key={item.id}>
<Form.Item
label={`Facility ${index + 1}`}
name={'shebei_' + item.id}
rules={[{ required: true, message: 'Please input Facility Name!' }]}
>
<Input
placeholder="Facility Name"
disabled={disabled}
id={index}
onChange={(e: any) => monitor(e, index)}
value={FacilitysList[index].name}
disabled={FacilitysList[index].disabled || disabled}
/>
</Form.Item>
<div className={'over'}>
<Button
type="link"
disabled={disabled}
onClick={() => deleteImg(index, item.id)}
> >
Delete {FacilitysList[index].fileList.length > 0 ? null : uploadButton}
</Button> </Upload>
<div className={'Facility'} key={item.id}>
<Form.Item
label={`Facility ${index + 1}`}
// name={'shebei_' + item.id}
rules={[{ required: true, message: 'Please input Facility Name!' }]}
>
<Input
placeholder="Facility Name"
disabled={disabled}
id={index}
onChange={(e: any) => monitor(e, index)}
value={FacilitysList[index].name}
disabled={FacilitysList[index].disabled || disabled}
/>
</Form.Item>
<div className={'over'}>
<Button
type="link"
disabled={disabled}
onClick={() => deleteImg(index, item.id)}
>
Delete
</Button>
</div>
</div>
</div> </div>
</div> </div>
</div> );
</div> })
); : ''}
})}
</Form.Item> </Form.Item>
<Form.Item> <Form.Item>
<Button <Button
......
...@@ -167,7 +167,9 @@ const BookingDetail = (props: any) => { ...@@ -167,7 +167,9 @@ const BookingDetail = (props: any) => {
DataSave.managerFeeStatus == 1 && DataSave.managerFeeStatus == 1 &&
DataSaveDetail.backMarginFee == 0 && DataSaveDetail.backMarginFee == 0 &&
DataSaveDetail.managerFee > 0) || DataSaveDetail.managerFee > 0) ||
(DataSave.managerFee == 0 && DataSave.marginFee > 0 && DataSave.status != 3) ? ( (DataSaveDetail.managerFee == 0 &&
DataSaveDetail.marginFee > 0 &&
DataSave.status != 3) ? (
<> <>
<Form <Form
ref={formRef} ref={formRef}
......
...@@ -57,6 +57,8 @@ const Bookings = (props: any) => { ...@@ -57,6 +57,8 @@ const Bookings = (props: any) => {
const [UnitName, setUnitName] = useState([] as any); // 楼栋搜索的家庭成员 const [UnitName, setUnitName] = useState([] as any); // 楼栋搜索的家庭成员
const [value, setValue] = React.useState(1);
// 表单标识 // 表单标识
const [form] = Form.useForm(); const [form] = Form.useForm();
...@@ -209,15 +211,10 @@ const Bookings = (props: any) => { ...@@ -209,15 +211,10 @@ const Bookings = (props: any) => {
// 选择设施 // 选择设施
const RadioChoose = (e: any) => { const RadioChoose = (e: any) => {
// 先清空表单其他值 // 先清空表单其他值
// form.resetFields() form.resetFields();
form.setFieldsValue({ form.setFieldsValue({
accountName: '', categoriesName: e.target.value,
accountPhone: '',
buildNumber: '',
floorNumber: '',
roomNumber: '',
subscribeDate: '',
Time: null,
}); });
// 再把提示时间删除 // 再把提示时间删除
setResultTime(null); setResultTime(null);
...@@ -229,7 +226,7 @@ const Bookings = (props: any) => { ...@@ -229,7 +226,7 @@ const Bookings = (props: any) => {
// 然后在做切换 // 然后在做切换
Data3.map((item: any, index: any) => { Data3.map((item: any, index: any) => {
item.categorieList.map((thing: any, i: any) => { item.categorieList.map((thing: any, i: any) => {
if (thing.categoriesId == e.target.value.categoriesId) { if (thing.categoriesId == e.target.value) {
setCurString({ setCurString({
communityManagerFee: parseInt(item.communityManagerFee).toFixed(2), communityManagerFee: parseInt(item.communityManagerFee).toFixed(2),
communityMargin: parseInt(item.communityMargin).toFixed(2), communityMargin: parseInt(item.communityMargin).toFixed(2),
...@@ -238,6 +235,7 @@ const Bookings = (props: any) => { ...@@ -238,6 +235,7 @@ const Bookings = (props: any) => {
facilitiesId: thing.facilitiesId, facilitiesId: thing.facilitiesId,
}); });
setValue(e.target.value);
// 选择后取消输入框禁止 // 选择后取消输入框禁止
setProhibit(false); setProhibit(false);
// 赋值给延后天数 // 赋值给延后天数
...@@ -345,7 +343,7 @@ const Bookings = (props: any) => { ...@@ -345,7 +343,7 @@ const Bookings = (props: any) => {
<div className={styles.box2item1}>Facilities Available: </div> <div className={styles.box2item1}>Facilities Available: </div>
<div className={styles.box2item2}> <div className={styles.box2item2}>
<Form.Item name="categoriesName"> <Form.Item name="categoriesName">
<Radio.Group onChange={RadioChoose}> <Radio.Group onChange={RadioChoose} value={value}>
{Data3.map((item: any, index: any) => { {Data3.map((item: any, index: any) => {
return ( return (
<li key={index} style={{ lineHeight: '32px' }}> <li key={index} style={{ lineHeight: '32px' }}>
...@@ -362,7 +360,7 @@ const Bookings = (props: any) => { ...@@ -362,7 +360,7 @@ const Bookings = (props: any) => {
</i> </i>
{item.categorieList.map((thing: any, i: any) => { {item.categorieList.map((thing: any, i: any) => {
return ( return (
<Radio key={thing.categoriesId} value={thing}> <Radio key={thing.categoriesId} value={thing.categoriesId}>
{thing.categoriesName} {thing.categoriesName}
</Radio> </Radio>
); );
......
...@@ -152,6 +152,14 @@ const Facility = (props: any) => { ...@@ -152,6 +152,14 @@ const Facility = (props: any) => {
} }
// 提交 // 提交
const onFinish = (values: any) => { const onFinish = (values: any) => {
// 先判断是否填写完整
for (let j in FacilitysList) {
if (FacilitysList[j].fileList.length == 0) {
message.error('Please upload classified pictures of facilities!');
return false;
}
}
// 过滤表单; // 过滤表单;
let imgs: any = []; // 小设施图片 -- 用作提交 let imgs: any = []; // 小设施图片 -- 用作提交
let name = []; // 小设施名称 -- 用作判断重名 let name = []; // 小设施名称 -- 用作判断重名
...@@ -178,12 +186,6 @@ const Facility = (props: any) => { ...@@ -178,12 +186,6 @@ const Facility = (props: any) => {
values.canReservationDay < values.nomarginCancelReservationDay values.canReservationDay < values.nomarginCancelReservationDay
) { ) {
message.error('Reservation should be greater than cancellation time!'); message.error('Reservation should be greater than cancellation time!');
// } else if ( // 暂时去掉这个需求判断
// // 不为 0 的时候 No Deposit To Cancel Reservation 必须要小于 Booking
// values.nomarginCancelReservationDay != 0 &&
// values.canReservationDay <= values.nomarginCancelReservationDay
// ) {
// message.error('nomarginCancelReservationDay 要小于 Booking !');
} else { } else {
let categoriesName: any = imgs; // 设施图片 let categoriesName: any = imgs; // 设施图片
values.categoriesName = categoriesName; // 设施内容 values.categoriesName = categoriesName; // 设施内容
...@@ -278,11 +280,11 @@ const Facility = (props: any) => { ...@@ -278,11 +280,11 @@ const Facility = (props: any) => {
}; };
// 子组件清除表单的 输入框值 // 子组件清除表单的 输入框值
const dumps = (key: any) => { // const dumps = (key: any) => {
form.setFieldsValue({ // form.setFieldsValue({
['shebei_' + key]: '', // ['shebei_' + key]: '',
}); // });
}; // };
//时间 //时间
const onChanges = (value: any, b: any) => { const onChanges = (value: any, b: any) => {
...@@ -365,7 +367,6 @@ const Facility = (props: any) => { ...@@ -365,7 +367,6 @@ const Facility = (props: any) => {
imageType: 'categoriesImageName', imageType: 'categoriesImageName',
extends: ctyName, extends: ctyName,
}} }}
dumps={dumps}
></Facilitys> ></Facilitys>
</Form.Item> </Form.Item>
......
...@@ -94,13 +94,11 @@ const FacilityBookings = (props: any) => { ...@@ -94,13 +94,11 @@ const FacilityBookings = (props: any) => {
if (curString.tab == 2) { if (curString.tab == 2) {
CA(); CA();
// 先清空上传图片列表 // 先清空上传图片列表
dispatch({ type: 'FacilityBookings/overAllImgList' }); let list: any = [];
// 在清空详情信息 dispatch({ type: 'FacilityBookings/genxin' }, list);
SA(null);
} else {
// 清空之前的数据
SA(null);
} }
// 清空之前的数据
SA(null);
history.push(location.pathname + (curString.tab == 1 ? '/Booking' : '/Adding')); history.push(location.pathname + (curString.tab == 1 ? '/Booking' : '/Adding'));
}; };
...@@ -166,7 +164,7 @@ const FacilityBookings = (props: any) => { ...@@ -166,7 +164,7 @@ const FacilityBookings = (props: any) => {
(text: any, record: any) => { (text: any, record: any) => {
let a = ''; let a = '';
text.map((item: any) => { text.map((item: any) => {
a += item.name + ''; a += item.name + ' , ';
}); });
return a; return a;
}, },
......
...@@ -10,7 +10,6 @@ import './css/index.less'; ...@@ -10,7 +10,6 @@ import './css/index.less';
import TitleBack from '@/components/TitleBack/TitleBack'; import TitleBack from '@/components/TitleBack/TitleBack';
import Facilitys from '@/components/Facilitys/Facilitys'; import Facilitys from '@/components/Facilitys/Facilitys';
import PictureOptionsRow from '@/components/PictureOptions/PictureOptionsRow'; import PictureOptionsRow from '@/components/PictureOptions/PictureOptionsRow';
import OnTime from '@/components/OnTime/OnTime';
import moment from 'moment'; import moment from 'moment';
...@@ -32,7 +31,7 @@ const FacilityTow = (props: any) => { ...@@ -32,7 +31,7 @@ const FacilityTow = (props: any) => {
const [PATHNAME, setPATHNAME] = useState(''); const [PATHNAME, setPATHNAME] = useState('');
const [facilityDetail, setFacilityDetail] = useState(false); // 全部禁止 const [facilityDetail, setFacilityDetail] = useState(false); // 全部禁止
const [imgOpen, setImgOpen] = useState(false); // 是否能点击上传
const [ctyName, setCtyName] = useState(null); // 小区名称 const [ctyName, setCtyName] = useState(null); // 小区名称
const [fileList, setFileList] = useState([] as any); // 设施总图片列表组 const [fileList, setFileList] = useState([] as any); // 设施总图片列表组
const [Cycle, setCycle] = useState(null as any); // 周期下拉 const [Cycle, setCycle] = useState(null as any); // 周期下拉
...@@ -72,7 +71,6 @@ const FacilityTow = (props: any) => { ...@@ -72,7 +71,6 @@ const FacilityTow = (props: any) => {
useEffect(() => { useEffect(() => {
if (DataSaveDetail !== null) { if (DataSaveDetail !== null) {
let { categories, facilities } = DataSaveDetail; let { categories, facilities } = DataSaveDetail;
console.log(categories);
// 设施A、设施B小图 // 设施A、设施B小图
let list: any = categories let list: any = categories
...@@ -129,6 +127,10 @@ const FacilityTow = (props: any) => { ...@@ -129,6 +127,10 @@ const FacilityTow = (props: any) => {
// tab 切换 // tab 切换
const onTabClicks = (id: String) => { const onTabClicks = (id: String) => {
// 清空设施图片
let list: any = [];
dispatch({ type: 'FacilityBookings/genxin', list });
form.resetFields(); // 清空所有表单值
setFacilityId(id); setFacilityId(id);
beg(id); beg(id);
}; };
...@@ -146,9 +148,19 @@ const FacilityTow = (props: any) => { ...@@ -146,9 +148,19 @@ const FacilityTow = (props: any) => {
// 提交 // 提交
const onFinish = (values: any) => { const onFinish = (values: any) => {
console.log(FacilitysList);
// 先判断是否填写完整
for (let j in FacilitysList) {
if (FacilitysList[j].fileList.length == 0) {
message.error('Please upload classified pictures of facilities!');
return false;
}
}
// 提取设施icon图和名称出来; // 提取设施icon图和名称出来;
let imgs: any = []; // 小设施图片 -- 用作提交 let imgs: any = []; // 小设施图片 -- 用作提交
let name = []; // 小设施名称 -- 用作判断重名 let name = []; // 小设施名称 -- 用作判断重名
for (let i in FacilitysList) { for (let i in FacilitysList) {
name.push(FacilitysList[i].name); name.push(FacilitysList[i].name);
imgs[ imgs[
...@@ -193,7 +205,7 @@ const FacilityTow = (props: any) => { ...@@ -193,7 +205,7 @@ const FacilityTow = (props: any) => {
delete values.endTime; delete values.endTime;
delete values.picList; delete values.picList;
delete values.Time; delete values.Time;
RA(17, values); // RA(17, values);
} }
}; };
...@@ -202,13 +214,6 @@ const FacilityTow = (props: any) => { ...@@ -202,13 +214,6 @@ const FacilityTow = (props: any) => {
RA(60, { facilitiesId: id }); RA(60, { facilitiesId: id });
}; };
// 删除子组件清除表单的 输入框值
const dumps = (key: any) => {
form.setFieldsValue({
['shebei_' + key]: '',
});
};
// 监听输入框值全填了就搜索 // 监听输入框值全填了就搜索
const keyup = (keyname: any, e: any) => { const keyup = (keyname: any, e: any) => {
e.target.value = e.target.value.replace(/[^\d^\.]+/g, ''); e.target.value = e.target.value.replace(/[^\d^\.]+/g, '');
...@@ -310,7 +315,6 @@ const FacilityTow = (props: any) => { ...@@ -310,7 +315,6 @@ const FacilityTow = (props: any) => {
imageType: 'categoriesImageName', imageType: 'categoriesImageName',
extends: ctyName, extends: ctyName,
}} }}
dumps={dumps}
></Facilitys> ></Facilitys>
</Form.Item> </Form.Item>
...@@ -438,10 +442,7 @@ const FacilityTow = (props: any) => { ...@@ -438,10 +442,7 @@ const FacilityTow = (props: any) => {
function mapStateToProps(state: any) { function mapStateToProps(state: any) {
const { sourceData, DataSave, DataSaveDetail, Result, FacilitysList } = state.FacilityBookings; const { sourceData, DataSave, DataSaveDetail, Result, FacilitysList } = state.FacilityBookings;
const { token } = state.login; const { token } = state.login;
const load = const load = state.loading.models.FacilityBookings || false;
typeof state.loading.models.FacilityBookings == 'undefined'
? false
: state.loading.models.FacilityBookings;
return { return {
DataSave, DataSave,
DataSaveDetail, DataSaveDetail,
......
...@@ -22,7 +22,7 @@ const Guard = (props: any) => { ...@@ -22,7 +22,7 @@ const Guard = (props: any) => {
return ( return (
<div className={styles.base}> <div className={styles.base}>
<TitleGet title={'Version 1.5.8'} /> <TitleGet title={'Version 1.6.0'} />
{/* <p> {/* <p>
token:{page.token} token:{page.token}
name:{getCookie('name')} name:{getCookie('name')}
......
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