Commit 86851cfb authored by cellee's avatar cellee

更改需求,修复bug

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent 16620118
import { LogoutOutlined, SettingOutlined, UserOutlined } from '@ant-design/icons'; import { LogoutOutlined } from '@ant-design/icons';
import { Avatar, Menu, Spin } from 'antd'; import { Avatar, Menu, Spin } from 'antd';
import { ClickParam } from 'antd/es/menu'; import { ClickParam } from 'antd/es/menu';
import { setCookie } from '@/utils/method';
import React from 'react'; import React from 'react';
import { history, ConnectProps, connect } from 'umi'; import { history, ConnectProps, connect } from 'umi';
import { ConnectState } from '@/models/connect'; import { ConnectState } from '@/models/connect';
...@@ -58,50 +57,27 @@ class AvatarDropdown extends React.Component<GlobalHeaderRightProps> { ...@@ -58,50 +57,27 @@ class AvatarDropdown extends React.Component<GlobalHeaderRightProps> {
render(): React.ReactNode { render(): React.ReactNode {
const { const {
currentUser = { currentUser = {
avatar: '', avatar: 'http://120.77.240.215:5205/file/ce90a1cd01cf4c2bb6ab12b295c25c16.png',
name: '', name: 'Login Again Please',
}, },
menu,
} = this.props; } = this.props;
const menuHeaderDropdown = ( const menuHeaderDropdown = (
<Menu className={styles.menu} selectedKeys={[]} onClick={this.onMenuClick}> <Menu className={styles.menu} selectedKeys={[]} onClick={this.onMenuClick}>
{menu && (
<Menu.Item key="center">
<UserOutlined />
个人中心
</Menu.Item>
)}
{menu && (
<Menu.Item key="settings">
<SettingOutlined />
个人设置
</Menu.Item>
)}
{menu && <Menu.Divider />}
<Menu.Item key="logout"> <Menu.Item key="logout">
<LogoutOutlined /> <LogoutOutlined />
Sign Out Sign Out
</Menu.Item> </Menu.Item>
</Menu> </Menu>
); );
return currentUser && currentUser.name ? (
return (
<HeaderDropdown overlay={menuHeaderDropdown}> <HeaderDropdown overlay={menuHeaderDropdown}>
<span className={`${styles.action} ${styles.account}`}> <span className={`${styles.action} ${styles.account}`}>
<Avatar size="small" className={styles.avatar} src={currentUser.avatar} alt="avatar" /> <Avatar size="small" className={styles.avatar} src={currentUser.avatar} alt="avatar" />
<span className={styles.name}>{currentUser.name}</span> <span className={styles.name}>{currentUser.name}</span>
</span> </span>
</HeaderDropdown> </HeaderDropdown>
) : (
<span className={`${styles.action} ${styles.account}`}>
<Spin
size="small"
style={{
marginLeft: 8,
marginRight: 8,
}}
/>
</span>
); );
} }
} }
......
...@@ -29,46 +29,12 @@ const GlobalHeaderRight: React.SFC<GlobalHeaderRightProps> = (props) => { ...@@ -29,46 +29,12 @@ const GlobalHeaderRight: React.SFC<GlobalHeaderRightProps> = (props) => {
} }
return ( return (
<div className={className}> <div className={className}>
{/* <HeaderSearch
className={`${styles.action} ${styles.search}`}
placeholder="站内搜索"
defaultValue="umi ui"
options={[
{ label: <a href="https://umijs.org/zh/guide/umi-ui.html">umi ui</a>, value: 'umi ui' },
{
label: <a href="next.ant.design">Ant Design</a>,
value: 'Ant Design',
},
{
label: <a href="https://protable.ant.design/">Pro Table</a>,
value: 'Pro Table',
},
{
label: <a href="https://prolayout.ant.design/">Pro Layout</a>,
value: 'Pro Layout',
},
]}
// onSearch={value => {
// //console.log('input', value);
// }}
/> */}
{/* <Tooltip title="使用文档">
<a
target="_blank"
href="https://pro.ant.design/docs/getting-started"
rel="noopener noreferrer"
className={styles.action}
>
<QuestionCircleOutlined />
</a>
</Tooltip> */}
<Avatar /> <Avatar />
{REACT_APP_ENV && ( {REACT_APP_ENV && (
<span> <span>
<Tag color={ENVTagColor[REACT_APP_ENV]}>{REACT_APP_ENV}</Tag> <Tag color={ENVTagColor[REACT_APP_ENV]}>{REACT_APP_ENV}</Tag>
</span> </span>
)} )}
{/* <SelectLang className={styles.action} /> */}
</div> </div>
); );
}; };
......
...@@ -69,6 +69,9 @@ const PictureOptionsRow = (props: any) => { ...@@ -69,6 +69,9 @@ const PictureOptionsRow = (props: any) => {
}); });
setFileList(result); setFileList(result);
onChange && onChange(resultToInside); onChange && onChange(resultToInside);
} else {
// 更改小区删除附件
setFileList([]);
} }
// } // }
}, [defaultValue]); }, [defaultValue]);
......
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import styles from './index.less'; import styles from './index.less';
import { Input ,Menu,Table,Space,Pagination,Tooltip, Radio } from 'antd'; import { Input, Menu, Table, Space, Pagination, Tooltip, Radio } from 'antd';
import { Link, useIntl, connect, Dispatch ,getLocale, setLocale} from 'umi'; import { Link, useIntl, connect, Dispatch, getLocale, setLocale } from 'umi';
const locales = ['zh-CN', 'en-US'];
const locales = ['zh-CN','en-US'];
const LanguageSettings = () => { const LanguageSettings = () => {
const languageSelect = (e: any) => {
const languageSelect = (e) => { setLocale(locales[e.target.value]);
setLocale(locales[e.target.value])
}; };
const [curLang, setCurLang] = useState(0); const [curLang, setCurLang] = useState(0);
useEffect(() => { useEffect(() => {
if (getLocale() == "en-US") { if (getLocale() == 'en-US') {
setCurLang(1) setCurLang(1);
} else { } else {
setCurLang(0) setCurLang(0);
} }
}, [curLang]); }, [curLang]);
return ( return (
<div className={styles.base}> <div className={styles.base}>
<div className={styles.box}>Language Selection</div> <div className={styles.box}>Language Selection</div>
<Radio.Group onChange={languageSelect} value={curLang} > <Radio.Group onChange={languageSelect} value={curLang}>
<div className={styles.box}><Radio value={0}>Chinese</Radio></div> <div className={styles.box}>
<div className={styles.box}><Radio value={1}>English</Radio></div> <Radio value={0}>Chinese</Radio>
</div>
<div className={styles.box}>
<Radio value={1}>English</Radio>
</div>
</Radio.Group> </Radio.Group>
</div> </div>
); );
}; };
export default LanguageSettings; export default LanguageSettings;
...@@ -52,6 +52,11 @@ const Add = (props: any) => { ...@@ -52,6 +52,11 @@ const Add = (props: any) => {
// 解除结束时间不可选 // 解除结束时间不可选
settimeT(false); settimeT(false);
// 设置结束时间 到开始时间不能选
let difference = moment().diff(moment(DataSave.noticStartTime.time), 'days');
settimeOver(difference);
// 图片名 // 图片名
setImageName(DataSave.noticImageName.split(',')); setImageName(DataSave.noticImageName.split(','));
} }
......
...@@ -151,7 +151,7 @@ const CommunityAnnouncement = (props: any) => { ...@@ -151,7 +151,7 @@ const CommunityAnnouncement = (props: any) => {
let mlist = { ...value }; let mlist = { ...value };
mlist.communityNumList = mlist.communityNumList =
value.communityNumList != null && value.communityNumList.length > 0 value.communityNumList != null && value.communityNumList.length > 0
? value.communityNumList ? [value.communityNumList]
: null; : null;
mlist.pageNum = 1; mlist.pageNum = 1;
// 把内容存进去 // 把内容存进去
...@@ -196,7 +196,7 @@ const CommunityAnnouncement = (props: any) => { ...@@ -196,7 +196,7 @@ const CommunityAnnouncement = (props: any) => {
<SearchOptionsCommnity <SearchOptionsCommnity
// ubmit={extendName} // ubmit={extendName}
opname={opname} opname={opname}
type={1} // 单选还是多选 单选就直接去掉 // type={1} // 单选还是多选 单选就直接去掉
/> />
</Form.Item> </Form.Item>
<Form.Item name="noticTitlel"> <Form.Item name="noticTitlel">
......
...@@ -38,12 +38,14 @@ const Add = (props: any) => { ...@@ -38,12 +38,14 @@ const Add = (props: any) => {
noticStartTime: day, noticStartTime: day,
noticEndTime: day2, noticEndTime: day2,
}); });
// 发起请求图片 if (DataSave.noticImageName) {
let msg = { // 发起请求图片
type: 'tosCommunityNoticePreview', let msg = {
fileName: DataSave.noticImageName, type: 'tosCommunityNoticePreview',
}; fileName: DataSave.noticImageName,
RA(47, msg, module, dispatch); };
RA(47, msg, module, dispatch);
}
} }
}, [DataSave]); }, [DataSave]);
......
...@@ -371,6 +371,7 @@ const Bookings = (props: any) => { ...@@ -371,6 +371,7 @@ const Bookings = (props: any) => {
limit={curString.categoriesOpenTime} // 禁止时间段 limit={curString.categoriesOpenTime} // 禁止时间段
openSelect={endTimes} // 时间类型 openSelect={endTimes} // 时间类型
type={0} type={0}
inhibitTime={result}
/> />
</Form.Item> </Form.Item>
</Form.Item> </Form.Item>
......
...@@ -65,6 +65,8 @@ const Facility = (props: any) => { ...@@ -65,6 +65,8 @@ const Facility = (props: any) => {
const formRef = useRef(null as any); const formRef = useRef(null as any);
const [fileList, setFileList] = useState([] as any); // 图片列表组
// 监听是否选择了小区 // 监听是否选择了小区
const [imgOpen, setImgOpen] = useState(true); const [imgOpen, setImgOpen] = useState(true);
const [ctyName, setCtyName] = useState(null); const [ctyName, setCtyName] = useState(null);
...@@ -92,6 +94,8 @@ const Facility = (props: any) => { ...@@ -92,6 +94,8 @@ const Facility = (props: any) => {
}; };
useEffect(() => { useEffect(() => {
if (sourceData != null) { if (sourceData != null) {
console.log(sourceData.categoriesDetailsImageName);
setCtyName(DataSave.communityName); setCtyName(DataSave.communityName);
setSoltTime(sourceData.reservationQuantumTime); // 设置时间 setSoltTime(sourceData.reservationQuantumTime); // 设置时间
...@@ -126,6 +130,9 @@ const Facility = (props: any) => { ...@@ -126,6 +130,9 @@ const Facility = (props: any) => {
setImgOpen(false); setImgOpen(false);
} }
setFileList(sourceData.categoriesDetailsImageName); //设置图片组
delete sourceData.categoriesDetailsImageName;
// 设置表单默认值 // 设置表单默认值
formRef.current.setFieldsValue(sourceData); formRef.current.setFieldsValue(sourceData);
} else { } else {
...@@ -176,18 +183,22 @@ const Facility = (props: any) => { ...@@ -176,18 +183,22 @@ const Facility = (props: any) => {
} else if (soltTime.length < 2 || !soltTime[0]) { } else if (soltTime.length < 2 || !soltTime[0]) {
// 判断时间选择 // 判断时间选择
message.error('Please Fill In The Appointment Period!'); message.error('Please Fill In The Appointment Period!');
} else if (soltTime[1] <= soltTime[0]) {
// 开始时间与结束时间选择错误
message.error('Wrong selection of start time and end time!');
} else if ( } else if (
// 提前预订时间大于 取消时间 // 提前预订时间大于 取消时间
result.canReservationDay < result.cancelReservationDay || result.canReservationDay < result.cancelReservationDay ||
result.canReservationDay < result.nomarginCancelReservationDay result.canReservationDay < result.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
// result.nomarginCancelReservationDay != 0 &&
// result.canReservationDay <= result.nomarginCancelReservationDay
// ) {
// message.error('nomarginCancelReservationDay 要小于 Booking !');
} else { } else {
// 处理 开放时间段
// let reservationQuantumTime: any = [
// moment(soltTime[0], 'HH:mm').format('HH:mm'),
// moment(soltTime[1], 'HH:mm').format('HH:mm'),
// ];
let categoriesName: any = imgs; // 设施图片 let categoriesName: any = imgs; // 设施图片
result.categoriesName = categoriesName; // 设施内容 result.categoriesName = categoriesName; // 设施内容
result.reservationQuantumTime = soltTime; // 开放时间段 result.reservationQuantumTime = soltTime; // 开放时间段
...@@ -197,6 +208,7 @@ const Facility = (props: any) => { ...@@ -197,6 +208,7 @@ const Facility = (props: any) => {
delete result.startTime; delete result.startTime;
delete result.endTime; delete result.endTime;
delete result.picList; delete result.picList;
if (sourceData != null) { if (sourceData != null) {
result.id = DataSave.id; result.id = DataSave.id;
if (Result == null) { if (Result == null) {
...@@ -236,21 +248,39 @@ const Facility = (props: any) => { ...@@ -236,21 +248,39 @@ const Facility = (props: any) => {
// 选择小区名字并赋值 // 选择小区名字并赋值
const opname = (value: any) => { const opname = (value: any) => {
if (value) { console.log(value);
setImgOpen(false); // 允许图片上传 console.log(ctyName);
setCtyName(value); // 给小区赋值 if (value == '') {
form.setFieldsValue({ eliminate();
communityName: value, // 给表单赋值
});
} else { } else {
// 设置是否能点击上传 if (ctyName == null) {
setImgOpen(true); setImgOpen(false); // 允许图片上传
// 清空设施列表图 setCtyName(value); // 给小区赋值
let list: any = []; form.setFieldsValue({
dispatch({ type: module + '/genxin', list }); communityName: value, // 给表单赋值
});
} else if (value != ctyName) {
eliminate();
}
} }
}; };
// 切换小区清除小区附件列表
const eliminate = () => {
setCtyName(null);
// 设置是否能点击上传
setImgOpen(true);
// 清空设施列表图
let list: any = [];
dispatch({ type: module + '/genxin', list });
setFileList(null);
//去掉图片组
form.setFieldsValue({
categoriesDetailsImageName: [],
});
};
// 子组件清除表单的 输入框值 // 子组件清除表单的 输入框值
const dumps = (key: any) => { const dumps = (key: any) => {
form.setFieldsValue({ form.setFieldsValue({
...@@ -297,7 +327,7 @@ const Facility = (props: any) => { ...@@ -297,7 +327,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={sourceData != null ? DataSave.communityName : null} defaultName={DataSave != null ? DataSave.communityName : null}
opname={opname} opname={opname}
disabled={facilityDetail} disabled={facilityDetail}
/> />
...@@ -340,7 +370,11 @@ const Facility = (props: any) => { ...@@ -340,7 +370,11 @@ const Facility = (props: any) => {
<hr></hr> <hr></hr>
{/* 设施品类上传 */} {/* 设施品类上传 */}
<Form.Item label="Facility Classification" className="flex required"> <Form.Item
label="Facility Classification"
className="flex required"
style={{ marginBottom: 0 }}
>
<Facilitys <Facilitys
disabled={imgOpen} disabled={imgOpen}
updata={{ updata={{
...@@ -366,6 +400,7 @@ const Facility = (props: any) => { ...@@ -366,6 +400,7 @@ const Facility = (props: any) => {
extends: ctyName, extends: ctyName,
}} }}
limitNums={99} limitNums={99}
defaultValue={DataSave != null ? fileList : null}
/> />
</Form.Item> </Form.Item>
......
...@@ -57,6 +57,8 @@ const FacilityBookings = (props: any) => { ...@@ -57,6 +57,8 @@ const FacilityBookings = (props: any) => {
CA(); CA();
// 先清空上传图片列表 // 先清空上传图片列表
dispatch({ type: 'FacilityBookings/overAllImgList' }); dispatch({ type: 'FacilityBookings/overAllImgList' });
// 在清空详情信息
SA(null);
} else { } else {
// 清空之前的数据 // 清空之前的数据
SA(null); SA(null);
...@@ -130,8 +132,8 @@ const FacilityBookings = (props: any) => { ...@@ -130,8 +132,8 @@ const FacilityBookings = (props: any) => {
), ),
], ],
]; ];
setColumns(objectColumns(key)); setColumns(objectColumns(key) as any);
setColumns2(objectColumns(key2)); setColumns2(objectColumns(key2) as any);
if (curString.tab == 1) { if (curString.tab == 1) {
RA(9, { RA(9, {
userToken: token, userToken: token,
......
/* /*
* @Author: your name * @Author: your name
* @Date: 2020-11-19 16:54:53 * @Date: 2020-11-19 16:54:53
* @LastEditTime: 2020-11-30 15:00:30 * @LastEditTime: 2020-12-02 16:32:42
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @Description: In User Settings Edit * @Description: In User Settings Edit
* @FilePath: \tostumi\src\utils\tip.ts * @FilePath: \tostumi\src\utils\tip.ts
...@@ -61,8 +61,8 @@ export const NewFaci = [ ...@@ -61,8 +61,8 @@ export const NewFaci = [
export const BookingsTip = [ export const BookingsTip = [
[{ required: true, message: 'Please input Name ' }], [{ required: true, message: 'Please input Name ' }],
[{ required: true, message: 'Please input Contact Details' }], [{ required: true, message: 'Please input Contact Details' }],
[{ required: true, message: 'Required' }], [{ required: true, pattern: new RegExp(/^[1-9]\d*$/, 'g'), message: 'Only numbers!' }],
[{ required: true, message: 'Required' }], [{ required: true, pattern: new RegExp(/^[1-9]\d*$/, 'g'), message: 'Only numbers!' }],
[{ required: true, message: 'Required' }], [{ required: true, message: 'Required' }],
[{ required: true, message: 'Please Select The Date' }], [{ required: true, message: 'Please Select The Date' }],
]; ];
......
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