Commit 113bb4aa authored by cellee's avatar cellee

预约重新选择小区清空附件

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent c15d8b62
......@@ -16,7 +16,7 @@ function getBase64(file: File) {
import { getUrlPicName } from '../../utils/string';
const PictureOptionsRow = (props: any) => {
const { value, onChange, limitNums, defaultValue } = props;
const { value, onChange, limitNums } = props;
const [fileList, setFileList] = useState([] as any);
const [previewVisible, setPreviewVisible] = useState(false);
const [previewImage, setPreviewImage] = useState('');
......@@ -35,7 +35,9 @@ const PictureOptionsRow = (props: any) => {
var tmp = value;
var result = new Array();
var resultToInside = new Array();
if (tmp.length > 0 && typeof tmp[0] != 'string') {
if (value.length == 0) {
setFileList([]);
} else if (tmp.length > 0 && typeof tmp[0] != 'string') {
//输入输出
tmp.map((item: any) => {
if (item.name == null) {
......@@ -52,30 +54,6 @@ const PictureOptionsRow = (props: any) => {
}
}, [value]);
useEffect(() => {
// if (props.disabled) {
if (defaultValue != null) {
var tmp = defaultValue;
var result = new Array();
var resultToInside = new Array();
tmp.map((item: any) => {
if (item.name == null) {
item.name = getUrlPicName(item.url);
item.uid = randomString(8);
item.status = 'done';
}
result.push(item);
resultToInside.push(item.name);
});
setFileList(result);
onChange && onChange(resultToInside);
} else {
// 更改小区删除附件
setFileList([]);
}
// }
}, [defaultValue]);
// 加载logo
const uploadButton = (
<div>
......
......@@ -228,7 +228,7 @@ export default {
// 更新列表
*genxin({ list }, { put }) {
yield put({type: 'retImgsList', list} )
yield put({type: 'retImgsList', list})
}
},
......
......@@ -22,8 +22,8 @@ const BookingDetail = (props: any) => {
if (DataSave != null) {
// 已预约时间段
let arr = DataSave.subscribeTime.split(',');
let time1 = parseInt(moment(arr[0], 'HH:mm').format('hh'));
let time2 = parseInt(moment(arr[arr.length - 1], 'HH:mm').format('hh'));
let time1 = parseInt(moment(arr[0], 'HH:mm').format('HH'));
let time2 = parseInt(moment(arr[arr.length - 1], 'HH:mm').format('HH'));
let Time = '';
for (let i = time1; i <= time2; i++) {
i < 10 ? (Time = `${Time}0${i}:00,`) : (Time = `${Time}${i}:00,`);
......
import React, { useState, useEffect, useRef } from 'react';
import './css/index.less';
import {
Input,
TimePicker,
InputNumber,
Button,
Space,
Pagination,
Tooltip,
Upload,
Form,
Select,
message,
Spin,
} from 'antd';
const { RangePicker } = TimePicker;
import { Input, InputNumber, Button, Form, Select, message, Spin } from 'antd';
const { Option } = Select;
import { PlusOutlined, MinusCircleOutlined, ClearOutlined } from '@ant-design/icons';
import { Link, useIntl, connect, Dispatch, history } from 'umi';
import { FieldTimeOutlined } from '@ant-design/icons';
import PictureOptions from '../../../components/PictureOptions/PictureOptions';
import PictureOptionsRow from '../../../components/PictureOptions/PictureOptionsRow';
import TitleBack from '../../../components/TitleBack/TitleBack';
import TimeSelect from '../../../components/TimeSelect/TimeSelect';
import Line from '../../../components/Line/Line';
import { getNumber } from '../../../utils/string';
import { connect, history } from 'umi';
import PictureOptionsRow from '@/components/PictureOptions/PictureOptionsRow';
import TitleBack from '@/components/TitleBack/TitleBack';
import { getNumber } from '@/utils/string';
import SearchOptionsCommnity from '@/components/SearchOptions/SearchOptionsCommnity';
import { NewFaci } from '@/utils/tip';
// categoriesDetailsImageName: ["test.jpg"],
// categoriesName: ["篮球场A&test.jpg"],
// reservationQuantumTime: ["09:00-07:00"]
import Facilitys from '@/components/Facilitys/Facilitys';
import { getUrlLast, numberToString } from '../../../utils/string';
import { checkParam, timeForm } from '@/utils/method';
import { getUrlLast } from '@/utils/string';
import { validateMessages } from '@/utils/params';
const module = 'FacilityBookings';
......@@ -57,8 +32,6 @@ const Facility = (props: any) => {
dispatch({ type: 'FacilityBookings/ResultClear' });
};
const openCheck = true;
const [pictrueExtend, setPictrueExtend] = useState({ pic: null, pics: null, tab: 3 });
const [facilityDetail, setFacilityDetail] = useState(false);
const [PATHNAME, setPATHNAME] = useState('');
......@@ -94,8 +67,7 @@ const Facility = (props: any) => {
};
useEffect(() => {
if (sourceData != null) {
console.log(sourceData.categoriesDetailsImageName);
console.log(sourceData);
setCtyName(DataSave.communityName);
setSoltTime(sourceData.reservationQuantumTime); // 设置时间
......@@ -122,16 +94,14 @@ const Facility = (props: any) => {
});
return sam;
});
dispatch({ type: module + '/genxin', list });
// 当是查看的时候禁止点击
if (location.pathname.indexOf('FacilityDetail') > -1) {
setImgOpen(true);
} else {
setImgOpen(false);
}
location.pathname.indexOf('FacilityDetail') > -1 ? setImgOpen(true) : setImgOpen(false);
setFileList(sourceData.categoriesDetailsImageName); //设置图片组
delete sourceData.categoriesDetailsImageName;
setFileList(sourceData.categoriesDetailsImageName); //设置图片组名称
// delete sourceData.categoriesDetailsImageName;
// 设置表单默认值
formRef.current.setFieldsValue(sourceData);
......@@ -248,8 +218,8 @@ const Facility = (props: any) => {
// 选择小区名字并赋值
const opname = (value: any) => {
console.log(value);
console.log(ctyName);
console.log('选择的小区是:' + value);
console.log('储存的小区是:' + ctyName);
if (value == '') {
eliminate();
} else {
......@@ -260,7 +230,17 @@ const Facility = (props: any) => {
communityName: value, // 给表单赋值
});
} else if (value != ctyName) {
eliminate();
// eliminate();
// 清空设施列表图
console.log('不等于');
setCtyName(value); // 给小区赋值
let list: any = [];
dispatch({ type: module + '/genxin', list });
setFileList(null);
//去掉图片组
form.setFieldsValue({
categoriesDetailsImageName: [],
});
}
}
};
......@@ -400,7 +380,7 @@ const Facility = (props: any) => {
extends: ctyName,
}}
limitNums={99}
defaultValue={DataSave != null ? fileList : null}
value={fileList}
/>
</Form.Item>
......
......@@ -251,7 +251,7 @@ const VisitorRecord = (props: any) => {
Reset
</Button>
</Form.Item>
<div style={{ marginTop: 24, marginRight: -16, width: 'cala(100%+16px)' }}>
<div style={{ marginTop: 24, marginRight: -16, width: 'calc(100% + 16px)' }}>
<Form.Item name="community" label="">
<SelectCommunity />
</Form.Item>
......
......@@ -251,7 +251,7 @@ const VisitorRecord = (props: any) => {
Reset
</Button>
</Form.Item>
<div style={{ marginTop: 24, marginRight: -16, width: 'cala(100%+16px)' }}>
<div style={{ marginTop: 24, marginRight: -16, width: 'calc(100% + 16px)' }}>
<Form.Item name="community" label="">
<SelectCommunity />
</Form.Item>
......
......@@ -22,7 +22,7 @@ const Guard = (props: any) => {
return (
<div className={styles.base}>
<TitleGet title={'Version 1.5.0'} />
<TitleGet title={'Version 1.5.1'} />
{/* <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