Commit 59f00b7a authored by cellee's avatar cellee

上线前样式统一

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent e31991a0
/*
* @Author: your name
* @Date: 2021-02-01 14:54:48
* @LastEditTime: 2021-02-01 16:57:27
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\components\Form\PdfUpload.tsx
*/
import React, { useState } from 'react';
import { Input, Upload, message, Button } from 'antd';
import { LoadingOutlined, PlusOutlined, MinusCircleOutlined } from '@ant-design/icons';
interface PriceInputProps {
value?: any;
onChange?: any;
disabled?: any; // 禁用状态
action?: any; // 传递地址
data?: any; // 附带数据
}
const PdfUpload: React.FC<PriceInputProps> = ({ value = {}, onChange, disabled, action, data }) => {
const [loading, setLoading] = useState(false);
const [imgList, setImgList] = useState([] as any);
// 上传前检测
function beforeUpload(file: any) {
const isJpgOrPng = file.type === 'application/pdf' || file.type === 'pdf';
if (!isJpgOrPng) {
message.error('You can only upload PDF file!');
}
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
message.error('PDF must smaller than 2MB!');
}
return isJpgOrPng && isLt2M;
}
const handleChange = (info: any) => {
if (info.file.status === 'uploading') {
setLoading(true);
return;
} else {
setLoading(false);
}
if (info.file.status === 'done') {
// Get this url from response in real world.
// getBase64(info.file.originFileObj, (imageUrl: any) => {
// setLoading(true);
// setImageUrl(imageUrl);
// });
console.log(info);
}
};
// 新增的按钮
const add = () => {
let list = Object.assign(imgList);
let item = [
{
id: Math.floor(Math.random() * 100),
name: '',
fileList: [],
},
];
list.push(item);
console.log(list);
setImgList([...list]);
};
// 删除的按钮
const del = (index: any) => {
let list = Object.assign(imgList);
list.splice(index, 1);
setImgList([...list]);
};
return (
<>
{imgList.map((item: any, index: any) => {
return (
<div className="pdf" key={index}>
<span>
<Input placeholder="Basic usage" className="pdf-input" />
</span>
<div className="pdf-div">
<Upload
className="avatar-uploader"
accept=".pdf"
action={action != null ? action : '/tos/image/upload'}
data={data}
name="file"
listType="picture"
fileList={item.fileList}
// showUploadList={false}
beforeUpload={beforeUpload}
onChange={handleChange}
>
<Button icon={loading ? <LoadingOutlined /> : <PlusOutlined />}>Upload</Button>
</Upload>
<MinusCircleOutlined
className="pdf-icon"
onClick={() => {
del(index);
}}
/>
</div>
</div>
);
})}
{imgList.length < 5 ? (
<div className="pdf-add">
<Button
type="dashed"
onClick={() => add()}
className="pdf-btn"
icon={<PlusOutlined />}
disabled={disabled}
></Button>
</div>
) : (
''
)}
</>
);
};
export default PdfUpload;
/*
* @Author: your name
* @Date: 2021-01-30 16:16:41
* @LastEditTime: 2021-02-01 15:12:24
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\components\Form\ZipCode.tsx
*/
import React, { useState } from 'react';
import { Input } from 'antd';
......@@ -12,13 +20,18 @@ interface PriceValue {
interface PriceInputProps {
value?: PriceValue;
onChange?: (value: PriceValue) => void;
insdInps?: any;
}
const PriceInput: React.FC<PriceInputProps> = ({ value = {}, onChange }) => {
const ZipCode: React.FC<PriceInputProps> = ({ value = {}, onChange, insdInps }) => {
const triggerChange = (changedValue: any) => {
console.log(changedValue);
if (onChange) {
onChange({ ...value, ...changedValue });
}
if (changedValue.residentialName) {
insdInps(changedValue.residentialName);
}
};
const onNumberChange = (e: React.ChangeEvent<HTMLInputElement>) => {
......@@ -54,7 +67,7 @@ const PriceInput: React.FC<PriceInputProps> = ({ value = {}, onChange }) => {
name="residentialName"
// value={value.residentialName || number}
onChange={onNumberChange}
style={{ marginRight: '10px', width: '260px' }}
style={{ marginRight: '10px', width: '240px' }}
placeholder="Please enter community name"
/>
</div>
......@@ -62,4 +75,4 @@ const PriceInput: React.FC<PriceInputProps> = ({ value = {}, onChange }) => {
);
};
export default PriceInput;
export default ZipCode;
......@@ -2,5 +2,39 @@
margin-bottom: 15px;
}
.zip1 {
margin-bottom: 10px;
margin-bottom: 5px;
}
// pdf上传
.pdf {
margin-bottom: 15px;
.pdf-input {
width: 104px;
margin-right: 10px;
}
.pdf-div {
display: inline-block !important;
}
.avatar-uploader {
display: inline-block !important;
width: 100px;
}
.pdf-icon {
font-size: 20px !important;
margin-left: 10px !important;
vertical-align: text-top !important;
cursor: pointer;
transition: all 0.3s;
&:hover {
color: #1890ff;
}
}
}
.pdf-add {
margin-top: 10px;
}
.pdf-btn {
width: 80px;
height: 80px;
border-radius: 2px;
}
......@@ -14,7 +14,8 @@ import './OnTime.less';
const OnTime = (porps: any) => {
// disabled 是否禁用 // limit 设施默认禁止时间段 // onChanges 提交到父页面 // inhibitTime 选择日期后的禁止时间
let { disabled, limit, onChanges, inhibitTime } = porps;
// concurrent 并发后禁止的时间
let { disabled, limit, onChanges, inhibitTime, concurrent } = porps;
// 语言设置
const [imgOpen, setImgOpen] = useState([] as any);
......@@ -63,15 +64,7 @@ const OnTime = (porps: any) => {
useEffect(() => {
if (inhibitTime) {
// 只要数据变化了先清空原来的数据
let a = [] as any;
if (getLocale() == 'zh-CN') {
setImgOpen(['开始时间', '结束时间']);
} else {
setImgOpen(['Start time', 'End time']);
}
setScheduled(false);
time.length = 0;
timeOks.length = 0;
restore();
// 先循环一次把所有k的变成可选
for (let k in Quantum) {
......@@ -92,6 +85,35 @@ const OnTime = (porps: any) => {
}
}, [inhibitTime]);
// 并发后禁止的时间
useEffect(() => {
if (concurrent) {
for (let i in concurrent) {
for (let j in Quantum) {
if (Quantum[j].id == parseInt(moment(concurrent[i], 'HH:mm').format('HH'))) {
Quantum[j].active = false;
Quantum[j].disabled = true;
}
}
}
// 只要数据变化了先清空原来的数据
restore();
}
}, [concurrent]);
// 清空还原原来数据
const restore = () => {
// 只要数据变化了先清空原来的数据
if (getLocale() == 'zh-CN') {
setImgOpen(['开始时间', '结束时间']);
} else {
setImgOpen(['Start time', 'End time']);
}
setScheduled(false);
time.length = 0;
timeOks.length = 0;
};
// 点击时间
const onclicks = (item: any, index: any) => {
// 用作判断
......
import React, { useState } from 'react';
import { Form, Input, Select, Button } from 'antd';
const { Option } = Select;
type Currency = 'rmb' | 'dollar';
interface PriceValue {
number?: number;
currency?: Currency;
}
interface PriceInputProps {
value?: PriceValue;
onChange?: (value: PriceValue) => void;
}
const PriceInput: React.FC<PriceInputProps> = ({ value = {}, onChange }) => {
const [number, setNumber] = useState(0);
const [currency, setCurrency] = useState<Currency>('rmb');
const triggerChange = (changedValue: { number?: number; currency?: Currency }) => {
if (onChange) {
onChange({ number, currency, ...value, ...changedValue });
}
};
const onNumberChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const newNumber = parseInt(e.target.value || '0', 10);
if (Number.isNaN(number)) {
return;
}
if (!('number' in value)) {
setNumber(newNumber);
}
triggerChange({ number: newNumber });
};
const onCurrencyChange = (newCurrency: Currency) => {
if (!('currency' in value)) {
setCurrency(newCurrency);
}
triggerChange({ currency: newCurrency });
};
return (
<span>
<Input
type="text"
value={value.number || number}
onChange={onNumberChange}
style={{ width: 100 }}
/>
<Select
value={value.currency || currency}
style={{ width: 80, margin: '0 8px' }}
onChange={onCurrencyChange}
>
<Option value="rmb">RMB</Option>
<Option value="dollar">Dollar</Option>
</Select>
</span>
);
};
const Facilities = () => {
const onFinish = (values: any) => {
console.log('Received values from form: ', values);
};
const checkPrice = (_: any, value: { number: number }) => {
if (value.number > 0) {
return Promise.resolve();
}
return Promise.reject('Price must be greater than zero!');
};
return (
<Form
name="customized_form_controls"
layout="inline"
onFinish={onFinish}
initialValues={{
price: {
number: 0,
currency: 'rmb',
},
}}
>
<Form.Item name="price" label="Price" rules={[{ validator: checkPrice }]}>
<PriceInput />
</Form.Item>
<Form.Item>
<Button type="primary" htmlType="submit">
Submit
</Button>
</Form.Item>
</Form>
);
};
export default Facilities;
/*
* @Author: your name
* @Date: 2021-01-12 16:05:46
* @LastEditTime: 2021-02-01 18:11:30
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\pages\AccountManagement\SystemFeedback\BugDetail.tsx
*/
import React, { useEffect } from 'react';
import { Button, Descriptions, Image } from 'antd';
import { EditOutlined, LeftOutlined } from '@ant-design/icons';
......@@ -51,8 +59,8 @@ const BugDetail = (props: any) => {
</Descriptions.Item>
<Descriptions.Item className="diys" label="&nbsp;" style={{ paddingBottom: 16 }}>
{DataSave
? DataSave.imageUrls.map((item: any) => {
return <Image width={120} src={item} />;
? DataSave.imageUrls.map((item: any, index: any) => {
return <Image key={index} width={120} src={item} />;
})
: '-'}
</Descriptions.Item>
......
......@@ -246,7 +246,7 @@ const Account = (props: any) => {
<Button type="primary" htmlType="submit" icon={<SearchOutlined />} loading={loading}>
Search{' '}
</Button>
<Button
{/* <Button
htmlType="button"
onClick={Refresh}
style={{ marginLeft: '15px' }}
......@@ -255,7 +255,7 @@ const Account = (props: any) => {
>
{' '}
Reset
</Button>
</Button> */}
</Form.Item>
</Form>
</div>
......
......@@ -297,7 +297,7 @@ const Account = (props: any) => {
<Descriptions column={{ xs: 1, sm: 1, md: 2, xl: 3 }}>
<Descriptions.Item>
<Form.Item name="tosUserName" label="Account ID" rules={AccountTip[0] as any}>
<Input placeholder="Login Account" className="input" />
<Input placeholder="E-mail address" className="input" />
</Form.Item>
</Descriptions.Item>
<Descriptions.Item>
......@@ -306,7 +306,7 @@ const Account = (props: any) => {
</Form.Item>
</Descriptions.Item>
<Descriptions.Item>
<Form.Item name="tosUserPhone" label="Phone" rules={AccountTip[2] as any}>
<Form.Item name="tosUserPhone" label="Correct telephone" rules={AccountTip[2] as any}>
<Input
placeholder="Contact Information"
className="input"
......
......@@ -407,14 +407,6 @@ const Account = (props: any) => {
<EditOutlined />
&nbsp;Account Detail
<div className="back">
{user && user.currentUser.tosUserLevel !== 3 ? (
<Button type="primary" danger style={{ marginRight: 15 }} onClick={lockS}>
<PoweroffOutlined />
Close Account
</Button>
) : (
''
)}
<Button onClick={goToReturn}>
<LeftOutlined />
Back
......@@ -514,9 +506,14 @@ const Account = (props: any) => {
<div className="diy">
<div className="label"></div>
<div className="label">
<Button type="primary" htmlType="submit" loading={loading} disabled>
Submit
</Button>
{user && user.currentUser.tosUserLevel !== 3 ? (
<Button danger style={{ marginRight: 15 }} onClick={lockS}>
<PoweroffOutlined />
Close Account
</Button>
) : (
''
)}
</div>
</div>
......
......@@ -565,7 +565,7 @@ const Account = (props: any) => {
<Descriptions column={{ xs: 1, sm: 1, md: 2, xl: 3 }}>
<Descriptions.Item>
<Form.Item name="tosUserName" label="Account ID" rules={AccountTip[0] as any}>
<Input placeholder="Login Account" className="input" disabled />
<Input placeholder="E-mail address" className="input" disabled />
</Form.Item>
</Descriptions.Item>
<Descriptions.Item>
......@@ -574,7 +574,7 @@ const Account = (props: any) => {
</Form.Item>
</Descriptions.Item>
<Descriptions.Item>
<Form.Item name="tosUserPhone" label="Phone" rules={AccountTip[2] as any}>
<Form.Item name="tosUserPhone" label="Correct telephone" rules={AccountTip[2] as any}>
<Input
placeholder="Contact Information"
className="input"
......
......@@ -411,7 +411,12 @@ const Adds = (props: any) => {
labelAlign="left"
scrollToFirstError={true}
>
<Form.Item label="Community Name" name="des" rules={[{ required: false }]}>
<Form.Item
label="Community Name"
name="des"
rules={[{ required: false }]}
className="must"
>
<Input.Group compact>
<Form.Item name={['des', 'residentialZipCode']} noStyle rules={village[0] as any}>
<Input
......@@ -457,7 +462,12 @@ const Adds = (props: any) => {
/>
</Form.Item>
<Form.Item label="Community Telephone" name="info" rules={[{ required: false }]}>
<Form.Item
label="Community Telephone"
name="info"
rules={[{ required: false }]}
className="must"
>
<Input.Group compact>
<Form.Item name={['info', 'tel']} noStyle rules={village[4] as any}>
<Input
......
......@@ -22,10 +22,9 @@ import { village } from '@/utils/tip';
import moment from 'moment';
import { getNumber } from '@/utils/string'; // 正则
// banner 上传
import PictureOptionsRow from '@/components/PictureOptions/PictureOptionsRow';
// 多图上传
import Facilities from '@/components/Form/ZipCode';
import PictureOptionsRow from '@/components/PictureOptions/PictureOptionsRow'; // banner 上传
import Facilities from '@/components/Form/ZipCode'; // 小区邮编地址名称
import PdfUpload from '@/components/Form/PdfUpload'; // 多图上传
import PDF from 'react-pdf-js';
......@@ -41,7 +40,7 @@ const Adds = (props: any) => {
const [PropertyFee, setPropertyFee] = useState(['1']); // 表单物业费提交值
// 监听用户填写小区名 以及后续禁止输入 提示信息
const [codename, setCodeName] = useState('');
const [codename, setCodeName] = useState(null);
const [codeStrat, setcodeStrat] = useState(false);
const [tipMain, setTipMain] = useState('');
......@@ -89,9 +88,9 @@ const Adds = (props: any) => {
},
});
// 上传
setLouba(Data.balouscheduleUrl ? [backUpload(Data.balouscheduleUrl, Data.id)] : []);
setGuide(Data.serviceGuideUrl ? [backUpload(Data.serviceGuideUrl, Data.id)] : []);
setPeriod(Data.lifeServiceUrl ? [backUpload(Data.lifeServiceUrl, Data.id)] : []);
// setLouba(Data.balouscheduleUrl ? [backUpload(Data.balouscheduleUrl, Data.id)] : []);
// setGuide(Data.serviceGuideUrl ? [backUpload(Data.serviceGuideUrl, Data.id)] : []);
// setPeriod(Data.lifeServiceUrl ? [backUpload(Data.lifeServiceUrl, Data.id)] : []);
// 小区名 -- 上传需要
setCodeName(Data.residentialName);
setcodeStrat(true);
......@@ -213,29 +212,14 @@ const Adds = (props: any) => {
}
}
// 表单验证
const onFinish = (values: any) => {
let { residentialZipCode } = values.des;
let tel = values.info.tel;
if (values.residentialManagerUserName.length < 2) {
message.error('Please Enter 2-digit Administrator Name!');
} else if (residentialZipCode.length < 6) {
message.error('Please Enter The Correct Name!');
} else if (tel.length != 8 && tel.length != 11) {
message.error('Incorrect Contact Information!');
} else {
onUpDate(values);
}
};
// 表单提交
function onUpDate(values: any) {
function onFinish(values: any) {
// 额外判断
let obj: any = new Object();
obj.propertyFee = PropertyFee;
// 小区信息;
let { residentialZipCode, residentialAddress, residentialName } = values.des;
let { residentialZipCode, residentialAddress, residentialName } = values;
obj.residentialZipCode = `SINGAPORE ${residentialZipCode}`;
obj.residentialAddress = residentialAddress;
......@@ -250,9 +234,9 @@ const Adds = (props: any) => {
// 上传内容
obj.balouscheduleUrl = undeFi(loubaUpload.map((item: any) => item.name)[0]);
obj.serviceGuideUrl = undeFi(guideUpload.map((item: any) => item.name)[0]);
obj.lifeServiceUrl = undeFi(periodUpload.map((item: any) => item.name)[0]);
// obj.balouscheduleUrl = undeFi(loubaUpload.map((item: any) => item.name)[0]);
// obj.serviceGuideUrl = undeFi(guideUpload.map((item: any) => item.name)[0]);
// obj.lifeServiceUrl = undeFi(periodUpload.map((item: any) => item.name)[0]);
// 小区热线
// 表单结构存在数据不存在情况, 所以要多判断一次
......@@ -292,10 +276,11 @@ const Adds = (props: any) => {
history.go(-1);
};
// 小区名输入监听ant
function insdInp(value: string) {
setCodeName(value);
return value;
// 小区名输入监听赋值
function insdInp(value: any) {
if (value.trim() != '') {
setCodeName(value);
}
}
// 正则手机号
......@@ -357,28 +342,26 @@ const Adds = (props: any) => {
setPageNumber(page);
};
// 验证
// 邮编小区名字验证
const checkPrice = (_: any, value: any) => {
console.log(isNaN(value.residentialZipCode));
if (!value) {
return Promise.reject('必填!');
return Promise.reject('Please fill in the basic information !');
}
if (value.residentialZipCode && value.residentialZipCode.trim() == '') {
return Promise.reject('邮编不能空!');
} else if (value.residentialZipCode.length < 6 || isNaN(parseInt(value.residentialZipCode))) {
return Promise.reject('邮编错误!');
} else if (value.residentialAddress && value.residentialAddress.trim() == '') {
return Promise.reject('地址不能空!');
} else if (value.residentialName && value.residentialName.trim() == '') {
return Promise.reject('名称不能空!');
if (!value.residentialZipCode || value.residentialZipCode.trim() == '') {
return Promise.reject('Please enter the postcode !');
} else if (value.residentialZipCode.length < 6 || !/^\d+$/.test(value.residentialZipCode)) {
return Promise.reject('Wrong zip code !');
} else if (
!value.residentialAddress ||
value.residentialAddress.trim() == '' ||
value.residentialAddress.length < 2
) {
return Promise.reject('Please enter the address of the community !');
} else if (!value.residentialName || value.residentialName.trim() == '') {
return Promise.reject('Please enter the community name !');
} else {
return Promise.resolve();
}
console.log(value);
// if (value.length > 0) {
// return Promise.resolve();
// }
return Promise.reject('Price must be greater than zero!');
};
return (
......@@ -404,14 +387,19 @@ const Adds = (props: any) => {
labelAlign="left"
scrollToFirstError={true}
>
{/* 小区邮编 */}
{/* 小区邮编、地址和名称 */}
<Form.Item
name="des"
label="Community Name"
rules={[{ validator: checkPrice }]}
style={{ marginBottom: 10 }}
style={{ marginBottom: 15 }}
className="must"
>
<Facilities />
<Facilities
insdInps={(value: any) => {
insdInp(value);
}}
/>
</Form.Item>
{/* 小区时间 */}
......@@ -423,33 +411,31 @@ const Adds = (props: any) => {
/>
</Form.Item>
<Form.Item label="Community Telephone" name="info" rules={[{ required: true }]}>
<Input.Group compact>
<Form.Item name={['info', 'tel']} noStyle rules={village[4] as any}>
<Input
style={{ marginRight: '10px', width: '160px' }}
placeholder="Please enter phone"
maxLength={11}
onKeyUp={keyup_communityManagerFee}
/>
</Form.Item>
<span style={{ display: 'inline-block', marginRight: '10px', lineHeight: '30px' }}>
-
</span>
<Form.Item name={['info', 'email']} noStyle rules={village[5] as any}>
<Input style={{ width: '180px' }} placeholder="Please enter email" />
</Form.Item>
</Input.Group>
{/* 小区联系方式 */}
<Form.Item name="tel" label="Community Telephone" rules={village[4] as any}>
<Input
style={{ marginRight: '10px', width: '240px' }}
placeholder="Please enter phone"
maxLength={11}
onKeyUp={keyup_communityManagerFee}
/>
</Form.Item>
{/* 小区邮箱 */}
<Form.Item name="email" label="Community Mailbox" rules={village[5] as any}>
<Input style={{ width: '240px' }} placeholder="Please enter email" />
</Form.Item>
{/* 小区管理员 */}
<Form.Item
label="Administrator"
name="residentialManagerUserName"
rules={village[6] as any}
>
<Input style={{ width: '160px' }} placeholder="Name" maxLength={30} />
<Input style={{ width: '240px' }} placeholder="Please enter name" maxLength={30} />
</Form.Item>
{/* 小区缴费方式 */}
<Form.Item label="Property Fee" name="propertyFee" style={{ marginBottom: '0' }}>
<Checkbox onChange={onChange} disabled>
Online Payment
......@@ -474,6 +460,15 @@ const Adds = (props: any) => {
</Form.Item>
{/* 第一个上传 */}
<Form.Item name={'banner2'} label="Maintenance Schedule:" colon={false}>
<PdfUpload
action="/tos/image/upload"
data={{
imageType: 'tosNotice',
comName: codename,
}}
></PdfUpload>
</Form.Item>
<hr />
......
......@@ -137,22 +137,6 @@ const Detail = (props: any) => {
<EyeOutlined />
&nbsp;Community Details
<div className="back">
{user && user.currentUser.permission.includes('47') ? (
<Button
type="primary"
danger
style={{ marginRight: '15px' }}
icon={<PoweroffOutlined />}
loading={false}
onClick={openModel}
>
{' '}
<span className="capi">Close the community</span>
</Button>
) : (
''
)}
<Button onClick={goToReturn}>
<LeftOutlined />
Back
......@@ -301,9 +285,27 @@ const Detail = (props: any) => {
</div>
</div>
{user && user.currentUser.permission.includes('47') ? (
<div>
<Divider />
<Button
danger
style={{ marginRight: '15px' }}
icon={<PoweroffOutlined />}
loading={false}
onClick={openModel}
>
{' '}
<span className="capi">Close the community</span>
</Button>
</div>
) : (
''
)}
{/* 确认关闭框 */}
<Modal
title="Are You Sure You Want To Close The Community??"
title="Are You Sure You Want To Close The Community ?"
visible={ModelFee}
centered={true}
onCancel={handleCancel}
......
......@@ -153,3 +153,19 @@ img {
text-align: right;
padding: 10px;
}
// 必填
.must {
.ant-form-item-label > label {
position: relative;
&::before {
display: inline-block;
margin-right: 4px;
color: #ff4d4f;
font-size: 14px;
font-family: SimSun, sans-serif;
line-height: 1;
content: '*';
}
}
}
......@@ -212,7 +212,7 @@ const CommunityAnnouncement = (props: any) => {
>
Search{' '}
</Button>
<Button
{/* <Button
htmlType="button"
onClick={onReset}
style={{ marginLeft: '15px' }}
......@@ -221,7 +221,7 @@ const CommunityAnnouncement = (props: any) => {
>
{' '}
Reset
</Button>
</Button> */}
</Form.Item>
</Form>
</div>
......
......@@ -21,7 +21,7 @@ import { BookingsTip } from '@/utils/tip';
import OnTimeTow from '@/components/OnTime/OnTime';
const Bookings = (props: any) => {
const { dispatch, Data3, Result, DataSave, token, load, resultTime, Remaining } = props;
const { dispatch, Data3, Result, DataSave, token, load, resultTime, Remaining, history } = props;
const RA = (index: any, values: any) => {
dispatch({ type: 'FacilityBookings/RA', playload: { index: index, body: values } });
......@@ -51,6 +51,7 @@ const Bookings = (props: any) => {
const [prohibit, setProhibit] = useState(true); // 输入框是否不可选
const [result, setResultTime] = useState(null as any); // 已预约时间段
const [concurrent, setConcurrent] = useState(null as any); // 并发后禁止的时间
const [bookTime, setBookTime] = useState(1); // 默认延后预订时间
......@@ -91,12 +92,27 @@ const Bookings = (props: any) => {
useEffect(() => {
if (Result != null) {
message.error(Result.msg);
if (Result.index == 1) {
IA();
// 预约的结果 0004的话就是 并发被占用了
// message.error(Result.msg);
// if (Result.index == 1) {
// IA();
// }
// setLoading(false);
// ResultClear();
// 并发触发占用时间
if (Result.error_code == '0004') {
// 更新list
setConcurrent(Result.data);
ResultClear(); // 清除结果
message.warning('The selected time has been reserved by app, please select again!');
} else {
// 提交成功
ResultClear(); // 清除结果
message.success('Success Operation!', 3);
history.push('/CommunityManagement/FacilityBookings');
}
setLoading(false);
ResultClear();
}
}, [Result]);
......@@ -420,6 +436,7 @@ const Bookings = (props: any) => {
limit={curString.categoriesOpenTime} // 设施默认禁止时间段
inhibitTime={result} // 选择日期后的禁止时间
onChanges={onChanges}
concurrent={concurrent}
/>
</Form.Item>
</Col>
......@@ -531,13 +548,7 @@ const Bookings = (props: any) => {
) : null}
<div className={styles.line}></div>
<Button
htmlType="submit"
type="primary"
loading={load}
disabled={prohibit}
style={{ width: 80, height: 32 }}
>
<Button htmlType="submit" type="primary" loading={load} disabled={prohibit}>
Submit
</Button>
</Form>
......
......@@ -32,6 +32,7 @@ import { NewFaci } from '@/utils/tip';
const FacilityTow = (props: any) => {
const {
user,
dispatch,
location,
DataSaveDetail,
......@@ -290,14 +291,6 @@ const FacilityTow = (props: any) => {
setIsModalVisible(false);
};
// 关闭按钮
const operations = (
<Button type="primary" danger onClick={showModal}>
<PoweroffOutlined />
Close The Selected Facility
</Button>
);
return (
<>
{DataSave ? (
......@@ -311,12 +304,7 @@ const FacilityTow = (props: any) => {
<label>Community :</label> {DataSave ? DataSave.community : ''}
</div>
<Tabs
defaultActiveKey="0"
tabPosition="top"
onTabClick={(key) => onTabClicks(key)}
tabBarExtraContent={facilityDetail ? operations : ''}
>
<Tabs defaultActiveKey="0" tabPosition="top" onTabClick={(key) => onTabClicks(key)}>
{DataSave
? DataSave.facilities.map((i: any) => (
<TabPane tab={`${i.name}`} key={i.id}></TabPane>
......@@ -502,9 +490,16 @@ const FacilityTow = (props: any) => {
<hr></hr>
<>
<Button type="primary" htmlType="submit" loading={load} disabled={facilityDetail}>
Submit
</Button>
{facilityDetail && user && user.currentUser.permission.includes('58') ? (
<Button danger onClick={showModal}>
<PoweroffOutlined />
Close The Selected Facility
</Button>
) : (
<Button type="primary" htmlType="submit" loading={load}>
Submit
</Button>
)}
</>
</Form>
</div>
......@@ -550,8 +545,10 @@ function mapStateToProps(state: any) {
FacilityDelete,
} = state.FacilityBookings;
const { token } = state.login;
const user = state.user;
const load = state.loading.models.FacilityBookings || false;
return {
user,
DataSave,
DataSaveDetail,
sourceData,
......
......@@ -210,7 +210,7 @@ const VisitorRecord = (props: any) => {
<Button type="primary" htmlType="submit" icon={<SearchOutlined />} loading={loading}>
Search{' '}
</Button>
<Button
{/* <Button
htmlType="button"
onClick={onReset}
style={{ marginLeft: '15px' }}
......@@ -219,7 +219,7 @@ const VisitorRecord = (props: any) => {
>
{' '}
Reset
</Button>
</Button> */}
</Form.Item>
<div style={{ marginTop: 24, marginRight: -16, width: 'calc(100% + 16px)' }}>
<Form.Item name="community" label="">
......
......@@ -210,7 +210,7 @@ const VisitorRecord = (props: any) => {
<Button type="primary" htmlType="submit" icon={<SearchOutlined />} loading={loading}>
Search{' '}
</Button>
<Button
{/* <Button
htmlType="button"
onClick={onReset}
style={{ marginLeft: '15px' }}
......@@ -219,7 +219,7 @@ const VisitorRecord = (props: any) => {
>
{' '}
Reset
</Button>
</Button> */}
</Form.Item>
<div style={{ marginTop: 24, marginRight: -16, width: 'calc(100% + 16px)' }}>
<Form.Item name="community" label="">
......
......@@ -168,7 +168,7 @@ const Contract = (props: any) => {
<Button type="primary" htmlType="submit" icon={<SearchOutlined />} loading={loading}>
Search{' '}
</Button>
<Button
{/* <Button
htmlType="button"
onClick={onReset}
style={{ marginLeft: '15px' }}
......@@ -177,7 +177,7 @@ const Contract = (props: any) => {
>
{' '}
Reset
</Button>
</Button> */}
</Form.Item>
</Form>
</div>
......
......@@ -388,11 +388,7 @@ const ContractContent = (props: any) => {
>
<div className="contract_box">
<div className="list2">
<Form.Item
name="contractNumber"
label="Contract Number"
rules={[{ required: true, message: `${tipList[0]}` }]}
>
<Form.Item name="contractNumber" label="Contract Number" rules={tipList[0]}>
<Input style={{ width: 200 }} placeholder="Contract Number" />
</Form.Item>
</div>
......@@ -408,11 +404,7 @@ const ContractContent = (props: any) => {
</Form.Item>
</div> */}
<div className="item_1">
<Form.Item
name="contractPartyB"
label="Contract Party"
rules={[{ required: true, message: `${tipList[2]}` }]}
>
<Form.Item name="contractPartyB" label="Contract Party" rules={tipList[1]}>
<Input style={{ width: 300 }} placeholder="Contract Party " />
</Form.Item>
</div>
......@@ -424,7 +416,7 @@ const ContractContent = (props: any) => {
labelAlign="right"
name="communityName"
label="Community Name"
rules={[{ required: true, message: `${tipList[3]}` }]}
rules={tipList[3]}
>
<SearchOptionsCommnity
defaultName={DataSaveDetail ? DataSaveDetail.communityName : null}
......@@ -440,7 +432,7 @@ const ContractContent = (props: any) => {
labelAlign="right"
name="contractTitle"
label="Contract Title"
rules={[{ required: true, message: `${tipList[4]}` }]}
rules={tipList[4]}
>
<Input style={{ width: 500 }} placeholder="Contract Title" />
</Form.Item>
......@@ -448,12 +440,7 @@ const ContractContent = (props: any) => {
{/* 起止时间 */}
<div className="list2">
<Form.Item
name="time"
labelAlign="right"
label="Contract Time"
rules={[{ required: true, message: `${tipList[5]}` }]}
>
<Form.Item name="time" labelAlign="right" label="Contract Time" rules={tipList[5]}>
<RangePicker
defaultValue={DataSaveDetail ? DataSaveDetail.time : null}
// disabledDate={disabledDate} // 时间限制
......@@ -469,7 +456,7 @@ const ContractContent = (props: any) => {
labelAlign="right"
name="upload"
label="Contract Annex"
rules={[{ required: true, message: `Please upload the attachment!` }]}
rules={tipList[6]}
>
<Upload
{...uploadProps}
......@@ -488,7 +475,7 @@ const ContractContent = (props: any) => {
<div className="list2">
<div className={styles.box8item2x1}>
<Form.Item
rules={[{ required: true, message: `${tipList[5]}` }]}
rules={tipList[7]}
label="Contract Remarks"
name="contractRemindContent"
style={{ marginBottom: 0 }}
......@@ -519,9 +506,8 @@ const ContractContent = (props: any) => {
{/* <span style={{color:'#f00'}}>&nbsp;{stateTime}</span> */}
</div>
</div>
<div>
<LINE />
<LINE />
<div style={{ marginLeft: 150 }}>
<Button type="primary" htmlType="submit" loading={loading}>
Submit
</Button>
......
/*
* @Author: your name
* @Date: 2020-11-19 16:54:53
* @LastEditTime: 2021-01-28 09:28:38
* @LastEditTime: 2021-02-01 17:31:42
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\utils\tip.ts
......@@ -58,13 +58,13 @@ const reqMes = (msg: string) => {
// 合同提示
export const tipList = [
[reqMes('Please Input Contract Numbe!')],
[reqMes('Please Input Contract Party A!')],
[reqMes('Please Input Contract Party!')],
[reqMes('Please Input Contract Party B!')],
[reqMes('Please Choice CommunityName!')],
[reqMes('Please Choice Contract Title!')],
[reqMes('Please Choice Contract Time!')],
[reqMes('Please upload Contract Annex!')],
// [reqMes('Please Input Contract Remarks!')],
[reqMes('Please Input Contract Remarks!')],
];
// 小区提示
......@@ -108,12 +108,12 @@ export const BookingsTip = [
[{ required: true, message: 'Letters or numbers!', validator: inputNumberStr }],
[{ required: true, message: 'Letters or numbers!', validator: inputNumberStr }],
[{ required: true, message: 'Letters or numbers!', validator: inputNumberStr }],
[reqMes('Please Select The Date')],
[reqMes('Please choose the date')],
];
// 账号新增编辑
export const AccountTip = [
[{ ...reqMes('Please enter email address !'), type: 'email' }],
[reqMes('Required')],
[reqMes('Please enter the correct contact information !')],
[reqMes('Please enter the name !')],
[reqMes('Please enter the correct telephone !')],
];
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