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