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