Commit e31991a0 authored by cellee's avatar cellee

新增小区修改,设施预订时间bug修复

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent 7eab4fdc
/* /*
* @Author: your name * @Author: your name
* @Date: 2020-12-01 18:40:06 * @Date: 2020-12-01 18:40:06
* @LastEditTime: 2021-01-15 18:17:37 * @LastEditTime: 2021-01-30 15:56:31
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @Description: In User Settings Edit * @Description: In User Settings Edit
* @FilePath: \tostumi\config\config.ts * @FilePath: \tostumi\config\config.ts
...@@ -388,12 +388,11 @@ export default defineConfig({ ...@@ -388,12 +388,11 @@ export default defineConfig({
name: 'companyinformation', name: 'companyinformation',
component: './AccountManagement/CompanyInformation/CompanyInformation', component: './AccountManagement/CompanyInformation/CompanyInformation',
}, },
{ // {
path: './LanguageSettings', // path: './LanguageSettings',
name: 'languagesettings', // name: 'languagesettings',
component: './AccountManagement/LanguageSettings/LanguageSettings', // component: './AccountManagement/LanguageSettings/LanguageSettings',
}, // },
{ {
path: '*', path: '*',
component: '@/pages/404', component: '@/pages/404',
......
import React, { useState } from 'react';
import { Input } from 'antd';
import './zip.less';
interface PriceValue {
residentialZipCode?: String;
residentialAddress?: String;
residentialName?: String;
}
interface PriceInputProps {
value?: PriceValue;
onChange?: (value: PriceValue) => void;
}
const PriceInput: React.FC<PriceInputProps> = ({ value = {}, onChange }) => {
const triggerChange = (changedValue: any) => {
if (onChange) {
onChange({ ...value, ...changedValue });
}
};
const onNumberChange = (e: React.ChangeEvent<HTMLInputElement>) => {
triggerChange({ [e.target.name]: e.target.value });
};
return (
<span>
<div className="zip2">
<Input
type="text"
// value={value.residentialZipCode || number}
maxLength={6}
name="residentialZipCode"
onChange={onNumberChange}
style={{ marginRight: '10px', width: 120 }}
placeholder="6 Postcode"
/>
<Input
type="text"
name="residentialAddress"
// value={value.residentialAddress || number}
onChange={onNumberChange}
style={{ width: '360px' }}
placeholder="Please enter community adds"
/>
</div>
<div className="zip1">
<Input
type="text"
name="residentialName"
// value={value.residentialName || number}
onChange={onNumberChange}
style={{ marginRight: '10px', width: '260px' }}
placeholder="Please enter community name"
/>
</div>
</span>
);
};
export default PriceInput;
.zip2 {
margin-bottom: 15px;
}
.zip1 {
margin-bottom: 10px;
}
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
box-sizing: border-box; box-sizing: border-box;
border: 1px solid #d9d9d9; border: 1px solid #d9d9d9;
border-radius: 2px; border-radius: 2px;
cursor: pointer;
&.disabled { &.disabled {
background: #f5f5f5; background: #f5f5f5;
border-color: #d9d9d9; border-color: #d9d9d9;
...@@ -15,7 +16,6 @@ ...@@ -15,7 +16,6 @@
color: #000; color: #000;
font-size: 14px; font-size: 14px;
transition: all 0.5s; transition: all 0.5s;
cursor: pointer;
&.active { &.active {
color: #999; color: #999;
} }
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
z-index: 10; z-index: 10;
background: #fff; background: #fff;
border-radius: 2px; border-radius: 2px;
min-width: 396px; min-width: 410px;
// 可选时间 // 可选时间
.opens { .opens {
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
span.sapa { span.sapa {
cursor: pointer; cursor: pointer;
display: inline-block; display: inline-block;
padding: 2px 4px; padding: 4px 6px;
margin: 0 8px 8px 0; margin: 0 8px 8px 0;
font-size: 13px; font-size: 13px;
letter-spacing: 1px; letter-spacing: 1px;
...@@ -106,6 +106,8 @@ ...@@ -106,6 +106,8 @@
align-items: center; align-items: center;
margin-bottom: 8px; margin-bottom: 8px;
button { button {
width: 80px;
height: 28px;
&:nth-child(1) { &:nth-child(1) {
margin-right: 6px; margin-right: 6px;
} }
......
...@@ -62,8 +62,20 @@ const OnTime = (porps: any) => { ...@@ -62,8 +62,20 @@ const OnTime = (porps: any) => {
// 已经选择的时间 // 已经选择的时间
useEffect(() => { useEffect(() => {
if (inhibitTime) { 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;
// 先循环一次把所有k的变成可选 // 先循环一次把所有k的变成可选
for (let k in Quantum) { for (let k in Quantum) {
Quantum[k].active = false;
Quantum[k].disabled = false; Quantum[k].disabled = false;
} }
...@@ -206,14 +218,14 @@ const OnTime = (porps: any) => { ...@@ -206,14 +218,14 @@ const OnTime = (porps: any) => {
return ( return (
<div className={disabled ? 'ontime-box disabled' : 'ontime-box'}> <div className={disabled ? 'ontime-box disabled' : 'ontime-box'}>
<div <div
className={Scheduled ? 'ims' : 'ims active'} className={time.length > 0 ? 'ims' : 'ims active'}
onClick={() => { onClick={() => {
opens(); opens();
}} }}
> >
<span>{imgOpen[0]}</span> - <span>{imgOpen[1]}</span> <span>{imgOpen[0]}</span> - <span>{imgOpen[1]}</span>
{Scheduled ? ( {Scheduled ? (
<CloseCircleOutlined twoToneColor="#333" /> <DownOutlined style={{ color: '#333' }} className={Scheduled ? 'icon icon-up' : 'icon'} />
) : ( ) : (
<DownOutlined <DownOutlined
style={{ color: '#d9d9d9' }} style={{ color: '#d9d9d9' }}
......
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 * @Author: your name
* @Date: 2020-11-19 16:54:53 * @Date: 2020-11-19 16:54:53
* @LastEditTime: 2021-01-27 17:23:53 * @LastEditTime: 2021-01-30 15:54:42
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @Description: In User Settings Edit * @Description: In User Settings Edit
* @FilePath: \tostumi\src\pages\AccountManagement\CompanyInformation\CompanyInformation.tsx * @FilePath: \tostumi\src\pages\AccountManagement\CompanyInformation\CompanyInformation.tsx
...@@ -18,7 +18,8 @@ const CompanyInformation = () => { ...@@ -18,7 +18,8 @@ const CompanyInformation = () => {
<div className={styles.box1}> <div className={styles.box1}>
<div className={styles.box1item1}>Management Company :</div> <div className={styles.box1item1}>Management Company :</div>
<div style={{ position: 'absolute', left: 160 }}> <div style={{ position: 'absolute', left: 160 }}>
<Input style={{ width: 200 }} value="TOS Pte Ltd" /> <p>TOS Pte Ltd</p>
{/* <Input style={{ width: 200 }} value="TOS Pte Ltd" /> */}
</div> </div>
{/* <div className={styles.box1item3}> <Button>Edit</Button></div> */} {/* <div className={styles.box1item3}> <Button>Edit</Button></div> */}
</div> </div>
...@@ -26,13 +27,15 @@ const CompanyInformation = () => { ...@@ -26,13 +27,15 @@ const CompanyInformation = () => {
<div className={styles.box2}> <div className={styles.box2}>
<div className={styles.box2item1}>Contact Number :</div> <div className={styles.box2item1}>Contact Number :</div>
<div className={styles.box2item2}> <div className={styles.box2item2}>
<Input style={{ width: 200 }} value="67441692" /> <p>67441692</p>
{/* <Input style={{ width: 200 }} value="67441692" /> */}
</div> </div>
</div> </div>
<div className={styles.box2}> <div className={styles.box2}>
<div className={styles.box2item1}>Contact Email :</div> <div className={styles.box2item1}>Contact Email :</div>
<div className={styles.box2item2}> <div className={styles.box2item2}>
<Input style={{ width: 200 }} value="admin.tos@crems.com.sg" /> <p>admin.tos@crems.com.sg</p>
{/* <Input style={{ width: 200 }} value="admin.tos@crems.com.sg" /> */}
</div> </div>
</div> </div>
</div> </div>
......
...@@ -4,14 +4,14 @@ ...@@ -4,14 +4,14 @@
.base { .base {
width: 100%; width: 100%;
background-color: #ffffff; background-color: #ffffff;
padding: 34px; padding: 30px 30px 10px;
} }
.box1 { .box1 {
width: 100%; width: 100%;
height: 34px; height: 34px;
position: relative; position: relative;
margin-bottom: 28px; margin-bottom: 20px;
} }
.box1item1 { .box1item1 {
position: absolute; position: absolute;
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
width: 100%; width: 100%;
height: 34px; height: 34px;
position: relative; position: relative;
margin-bottom: 28px; margin-bottom: 20px;
} }
.box2item1 { .box2item1 {
position: absolute; position: absolute;
......
import React, { useState, useEffect, useRef } from 'react';
import { Input, Form, Button, message } from 'antd';
import { connect } from 'umi';
const layout = {
labelCol: { span: 2 },
// wrapperCol: { span: 8 },
};
import { RA, ResultClear } from '@/utils/method';
const module = 'CellList';
import FileUpload from '@/components/FileUpload/FileUpload';
import TitleBack from '@/components/TitleBack/TitleBack';
import Line from '@/components/Line/Line';
import { validateMessages } from '@/utils/params';
const Add = (props: any) => {
const { dispatch, Result } = props;
const formRef = useRef(null);
const onFinish = (values: any) => {
console.log(values);
RA(29, values, module, dispatch);
};
const [extend, setExtend] = useState('');
useEffect(() => {
if (Result != null) {
console.log('页面结果');
console.log(Result);
if (Result.error_code == undefined) {
console.log('服务器有问题');
message.error('服务器有问题,请求失败', 5);
}
if (Result.error_code == '0000') {
history.go(-1);
}
ResultClear(module, dispatch);
}
}, [Result]);
const onBillChange = (values: any, allValues: any) => {
if (values['residentialName'] != null) {
var tmp = values['residentialName'];
console.log(tmp.length);
setExtend(tmp);
}
};
return (
<div style={{ width: '100%', minWidth: 1020, padding: 34, backgroundColor: '#ffffff' }}>
<TitleBack title="Add Commnunity Infomation"></TitleBack>
<Form
ref={formRef}
{...layout}
name="nest-messages"
onFinish={onFinish}
validateMessages={validateMessages}
onValuesChange={onBillChange}
>
<Form.Item name={'residentialName'} label="Community" rules={[{ required: true }]}>
<Input style={{ width: 200 }} />
</Form.Item>
<Form.Item name={'zipcode'} label="Postcode" rules={[{ required: true }]}>
<Input style={{ width: 200 }} />
</Form.Item>
<Form.Item name={'residentialAddress'} label="Address" rules={[{ required: true }]}>
<Input style={{ width: 300 }} />
</Form.Item>
<Form.Item label="Contact Information" style={{ marginBottom: 0 }}>
<Form.Item
style={{ display: 'inline-block', width: '200' }}
name={'residentialPhone'}
rules={[{ required: true }]}
>
<Input placeholder="Contact Number" />
</Form.Item>
<Form.Item
style={{ display: 'inline-block', width: '200', marginLeft: 20 }}
name={'residentialEmail'}
rules={[{ required: true }]}
>
<Input placeholder="Contact Email" />
</Form.Item>
</Form.Item>
<Form.Item
name={'residentialManagerUserName'}
label="Community Manager"
rules={[{ required: true }]}
>
<Input style={{ width: 200 }} />
</Form.Item>
<Line />
<Form.Item label="Help center" style={{ marginBottom: 0 }}>
<Form.Item
style={{ display: 'inline-block', width: '200' }}
name={'residentialHotlineName'}
rules={[]}
>
<Input placeholder="Name Of Hotline" />
</Form.Item>
<Form.Item
style={{ display: 'inline-block', width: '200', marginLeft: 20 }}
name={'residentialHotline'}
rules={[]}
>
<Input placeholder="Hotline" />
</Form.Item>
</Form.Item>
<Line />
{extend.length > 0 ? (
<>
<Form.Item wrapperCol={{ offset: 2 }} style={{ marginBottom: 0 }}>
<Form.Item
style={{ display: 'inline-block', width: '200' }}
name={'balouscheduleFile'}
>
<FileUpload
title="Bus Timetable"
url={'/tos/image/upload'}
data={{ imageType: 'tosCreateCommunity', extends: extend }}
reg="name"
/>
</Form.Item>
<Form.Item
style={{ display: 'inline-block', width: '200', marginLeft: 100 }}
name={'serviceGuideFile'}
>
<FileUpload
title="Service Guide"
url={'/tos/image/upload'}
data={{ imageType: 'tosCreateCommunity', extends: extend }}
reg="name"
/>
</Form.Item>
<Form.Item
style={{ display: 'inline-block', width: '200', marginLeft: 100 }}
name={'lifeServiceFile'}
>
<FileUpload
title="Life Service"
url={'/tos/image/upload'}
data={{ imageType: 'tosCreateCommunity', extends: extend }}
reg="name"
/>
</Form.Item>
</Form.Item>
</>
) : null}
<Form.Item wrapperCol={{ offset: 2 }}>
<Button type="primary" htmlType="submit">
Submit
</Button>
</Form.Item>
</Form>
</div>
);
};
function map(state: any) {
const { Result } = state[module];
return { Result };
}
export default connect(map)(Add);
import React, { useState, useEffect } from 'react';
import { connect } from 'dva';
import { LeftOutlined, EditOutlined, LoadingOutlined, PlusOutlined } from '@ant-design/icons';
import {
Form,
Input,
Image,
Button,
TimePicker,
Checkbox,
message,
Spin,
Modal,
Pagination,
} from 'antd';
// 样式
import './celllist.less';
import { RA } from '@/utils/method';
import { history } from 'umi';
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 PDF from 'react-pdf-js';
const { RangePicker } = TimePicker;
const Adds = (props: any) => {
const module = 'CellList';
const { Data, dispatch, loading, imgUrl, Result } = props;
const [form] = Form.useForm();
const [PropertyFee, setPropertyFee] = useState(['1']); // 表单物业费提交值
// 监听用户填写小区名 以及后续禁止输入 提示信息
const [codename, setCodeName] = useState('');
const [codeStrat, setcodeStrat] = useState(false);
const [tipMain, setTipMain] = useState('');
const [previewVisible, setpreviewVisible] = useState(false); // 预览弹窗显示隐藏
const [previewImage, setpreviewImage] = useState({} as any); // 预览图片信息
//pdf 页码内容
const [numPages, setNumPages] = useState(1 as any); // 总页码数
const [pageNumber, setPageNumber] = useState(1); // 当前页码数
const [imgLoad, setimgLoad] = useState(false); //图片上传 load状态
// 赋值
useEffect(() => {
// 如果是添加传来没有值的时候 就清空 否则 赋值给表单
if (Data) {
// 返回列表
form.setFieldsValue({
// 必填的
des: {
residentialZipCode: Data.residentialZipCode.substring(
Data.residentialZipCode.length - 6,
Data.residentialZipCode.length,
),
residentialAddress: Data.residentialAddress,
residentialName: Data.residentialName,
},
workingHours: [
moment(Data.residentialStartWorking, 'HH:mm'),
moment(Data.residentialEndWorking, 'HH:mm'),
],
info: {
tel: Data.residentialPhone,
email: Data.residentialEmail,
},
residentialManagerUserName: Data.residentialManagerUserName,
help: {
residentialHotlineName: Data.residentialHotlineName,
residentialHotline: Data.residentialHotline,
time: [
moment(Data.residentialHotlineServieStartTime, 'HH:mm'),
moment(Data.residentialHotlineServieEndTime, 'HH:mm'),
],
},
});
// 上传
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);
setTipMain('Binding Content Already Exists, Cannot Be Modified!');
} else {
// console.log('新建');
}
}, [Data]);
// 提交成功与否
useEffect(() => {
if (Result != null) {
// 如果不是编辑的话就更新本地小区
if (!Data) {
dispatch({ type: 'Init/addCommunityget', playload: { Result: new Array(Result.data) } });
}
// 提示跳转
message.success(`Information saved successfully!`);
history.push('/CommunityManagement/CellList');
}
}, [Result, Data]);
// 监听编辑预览是否获取到地址以及发生改变
useEffect(() => {
if (imgUrl != null) {
let info = {
uid: '1',
name: imgUrl.name,
status: 'done',
type: imgUrl.name.match(/\.([^\.]+)$/)[1].toLowerCase(),
url: imgUrl.url,
};
setpreviewImage(info);
setpreviewVisible(true);
// openDows(imgUrl.url, imgUrl.name);
}
}, [imgUrl]);
// 编辑 返回上传格式 和 地址
function backUpload(str: any, index: number, url?: any) {
let a = {
uid: str + index,
name: str,
status: 'done',
type: str.match(/\.([^\.]+)$/)[1].toLowerCase(),
url: 'Transfer', // 需要调取接口
};
return a;
}
// 上传设置
const uploads = {
name: 'file',
accept: '.jpg,.png,.pdf',
action: '/tos/image/upload',
data: { imageType: 'tosCreateCommunity', extends: codename },
};
// 文件上传判断
function beforeUpload(file: any) {
// 文件大小判断
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
message.error('File must be less than or equal to 2MB!');
}
return isLt2M;
}
// 上传返回格式
function BackFormat(name: any, url: any) {
let imgs = [
{
uid: '-1',
name: name,
status: 'done',
type: name.match(/\.([^\.]+)$/)[1].toLowerCase(),
url: url,
},
];
return imgs;
}
// 楼巴上传
const upload1 = {
onChange({ file }: any) {
file.status === 'uploading' ? setimgLoad(true) : setimgLoad(false);
if (file.status === 'done') {
let data = file.response.data;
// setLouba(BackFormat(data.imageName, data.url));
setcodeStrat(true);
setTipMain('Binding Content Already Exists, Cannot Be Modified!');
}
// 结果
uploadMsg(file);
},
};
// 上传提示
function uploadMsg(file: any) {
if (file.status === 'done') {
message.success(`${file.name} File Uploaded Successfully`);
} else if (file.status === 'error') {
message.error(`${file.name} File Upload Failed.`);
}
}
// 多选选择改变值
function onChange(checkedValues: any) {
// 修改选择值
setPropertyFee(checkedValues);
}
// undefind 验证
function undeFi(e: any) {
if (typeof e == 'undefined') {
return null;
} else {
return e;
}
}
// 表单验证
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) {
// 额外判断
let obj: any = new Object();
obj.propertyFee = PropertyFee;
// 小区信息;
let { residentialZipCode, residentialAddress, residentialName } = values.des;
obj.residentialZipCode = `SINGAPORE ${residentialZipCode}`;
obj.residentialAddress = residentialAddress;
obj.residentialName = residentialName;
// 小区时间与管理员
obj.residentialManagerUserName = undeFi(values.residentialManagerUserName);
obj.residentialStartWorking = values.workingHours[0].format('HH:mm');
obj.residentialEndWorking = values.workingHours[1].format('HH:mm');
obj.residentialPhone = values.info.tel;
obj.residentialEmail = values.info.email;
// 上传内容
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]);
// 小区热线
// 表单结构存在数据不存在情况, 所以要多判断一次
if (values.help) {
obj.residentialHotlineName = values.help.residentialHotlineName
? undeFi(values.help.residentialHotlineName)
: 'Community Hotline';
obj.residentialHotline = values.help.residentialHotline
? undeFi(values.help.residentialHotline)
: values.info.tel;
// 编辑的时候 为空 判断
if (values.help.time) {
obj.residentialHotlineServieStartTime = undeFi(values.help.time[0]).format('HH:mm');
obj.residentialHotlineServieEndTime = undeFi(values.help.time[1]).format('HH:mm');
} else {
obj.residentialHotlineServieStartTime = values.workingHours[0].format('HH:mm');
obj.residentialHotlineServieEndTime = values.workingHours[1].format('HH:mm');
}
} else {
obj.residentialHotlineName = values.info.tel;
obj.residentialHotline = values.info.tel;
obj.residentialHotlineServieStartTime = values.workingHours[0].format('HH:mm');
obj.residentialHotlineServieEndTime = values.workingHours[1].format('HH:mm');
}
if (Data) {
obj.id = Data.id;
}
console.log(values);
console.log(obj);
// 上传
RA(29, obj, 'CellList', dispatch);
}
// 返回
const goToReturn = () => {
history.go(-1);
};
// 小区名输入监听ant
function insdInp(value: string) {
setCodeName(value);
return value;
}
// 正则手机号
const keyup_tool = (value: any) => {
return getNumber(value.replace(/[^\d^\.]+/g, ''));
};
// 手机号
const keyup_communityManagerFee = (e: any) => {
e.target.value = keyup_tool(e.target.value);
};
// 上传按钮
const uploadButton = (
<div>
{imgLoad ? <LoadingOutlined /> : <PlusOutlined />}
<div style={{ marginTop: 8 }}>Upload</div>
</div>
);
// 文件预览
const handlePreview = async (file: any) => {
if (file.url == 'Transfer') {
// 这是编辑的预览, 需要发送一个请求
let msg = {
// userToken: '',
// type: ans.substr(ans.lastIndexOf('.') + 1),
type: 'tosCommunityFileService',
fileName: file.name,
extends: Data.residentialName,
};
RA(47, msg, module, dispatch);
} else {
setpreviewImage(file);
setpreviewVisible(true);
}
};
// 点击移除图片
const handRemove = (key: any) => {
// key == 1 ? setLouba([]) : key == 2 ? setGuide([]) : setPeriod([]);
};
// 点击遮罩回调
const handleCancel = () => {
setpreviewVisible(false);
// 每次关闭预览都要清掉弹窗图片信息 -- 防止编辑打开页面直接弹出窗口
setpreviewImage({});
dispatch({ type: module + '/urlRemove' });
};
// pdf 总页数
const onDocumentLoadSuccess = (pages: any) => {
setNumPages(pages);
};
// 切换pdf 总数
const onChangePage = (page: any) => {
setPageNumber(page);
};
// 验证
const checkPrice = (_: any, value: any) => {
console.log(isNaN(value.residentialZipCode));
if (!value) {
return Promise.reject('必填!');
}
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('名称不能空!');
} else {
return Promise.resolve();
}
console.log(value);
// if (value.length > 0) {
// return Promise.resolve();
// }
return Promise.reject('Price must be greater than zero!');
};
return (
<>
<Spin spinning={loading} tip="loading..." size="large">
<div className="form">
<h3 className="capi">
<EditOutlined />
&nbsp; {Data ? 'edit' : 'Create New'} community
<div className="back">
<Button onClick={goToReturn}>
<LeftOutlined />
Back
</Button>
</div>
</h3>
<Form
name="basic"
form={form}
onFinish={onFinish}
wrapperCol={{ span: 18 }}
layout="horizontal"
labelAlign="left"
scrollToFirstError={true}
>
{/* 小区邮编 */}
<Form.Item
name="des"
label="Community Name"
rules={[{ validator: checkPrice }]}
style={{ marginBottom: 10 }}
>
<Facilities />
</Form.Item>
{/* 小区时间 */}
<Form.Item label="Working Hours" name="workingHours" rules={village[3] as any}>
<RangePicker
minuteStep={60}
format="HH:mm"
placeholder={['Start Time', 'End Time']}
/>
</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>
<Form.Item
label="Administrator"
name="residentialManagerUserName"
rules={village[6] as any}
>
<Input style={{ width: '160px' }} placeholder="Name" maxLength={30} />
</Form.Item>
<Form.Item label="Property Fee" name="propertyFee" style={{ marginBottom: '0' }}>
<Checkbox onChange={onChange} disabled>
Online Payment
</Checkbox>
<Checkbox onChange={onChange} checked>
Offline Payment
</Checkbox>
</Form.Item>
<hr />
{/* 上传部分 */}
<Form.Item name={'banner'} label="Banner:" colon={false}>
<PictureOptionsRow
action="/tos/image/upload"
data={{
imageType: 'tosNotice',
}}
limitNums={1}
// imgs={ImageSrc}
/>
</Form.Item>
{/* 第一个上传 */}
<hr />
{/* 帮助中心 */}
<Form.Item label="Help Center" name="help">
<Input.Group compact>
<Form.Item name={['help', 'residentialHotlineName']} noStyle>
<Input
style={{ marginRight: '10px', width: '160px' }}
placeholder="Name Of Hotline"
/>
</Form.Item>
<Form.Item name={['help', 'residentialHotline']} noStyle>
<Input style={{ marginRight: '10px', width: '180px' }} placeholder="Hotline" />
</Form.Item>
<Form.Item name={['help', 'time']} noStyle>
<RangePicker format="HH:mm" placeholder={['Start Time', 'End Time']} />
</Form.Item>
</Input.Group>
</Form.Item>
<hr />
{/* 提交 */}
<Form.Item label="" colon={false}>
<Button type="primary" htmlType="submit" loading={loading}>
Submit
</Button>
</Form.Item>
</Form>
</div>
{/* 附件预览 */}
<Modal
title={previewImage != null ? previewImage.name : 'File Preview'}
visible={previewVisible}
width={800}
onCancel={handleCancel}
style={{ textAlign: 'center' }}
footer={null}
>
{previewImage != null ? (
previewImage.type == 'pdf' ? (
// pdf 换一种
<>
<PDF
file={previewImage.url}
page={pageNumber}
scale={1.25}
onDocumentComplete={onDocumentLoadSuccess}
/>
<Pagination
style={{ textAlign: 'center', marginTop: 10, display: 'block' }}
simple
defaultCurrent={pageNumber}
total={numPages * 10}
onChange={onChangePage}
/>
</>
) : previewImage.type == 'jpg' || previewImage.type == 'png' ? (
// 图片用指定格式
<Image
src={previewImage.url}
preview={false}
style={{ margin: '0 auto', textAlign: 'center' }}
/>
) : (
''
)
) : (
''
)}
</Modal>
</Spin>
</>
);
};
// export default Adds;
function map(state: any) {
console.log(state);
const Data = state.CellList.DataSave;
const { imgUrl, Result } = state.CellList;
const loading = state.loading.models.CellList ? state.loading.models.CellList : false;
return { Data, loading, Result, imgUrl };
}
export default connect(map)(Adds);
import React, { useState, useEffect,useRef} from 'react';
import { Input ,Tabs,Row,Col, Button} from 'antd';
const { TabPane } = Tabs;
import {connect,history} from 'umi';
import { RA } from '@/utils/method';
import TitleBack from '@/components/TitleBack/TitleBack';
const module="CellList"
const Detail = (props:any) => {
const { dispatch, Data,DataSave,Result} = props;
const formRef = useRef(null)
useEffect(()=>{
if (DataSave != null) {
console.log("初始化页面参数")
console.log(DataSave);
/*
balouscheduleUrl: "Shelf_life_service.pdf"
cdkCode: 154952
cdkStatus: "0"
communityName: ""
count: 0
createTime: {date: 10, day: 4, hours: 22, minutes: 36, month: 8, …}
deleted: 0
description: ""
enable: 0
extend: ""
id: "a71a67d8ba0a43c0a46e73bf166d3484"
lifeServiceUrl: "小课堂课程表2020.08.07.pdf"
residentialAddress: "Tianhe"
residentialEmail: "sales@huahui.com"
residentialEndWorking: null
residentialFeeMethod: 0
residentialHotline: "2222-8888"
residentialHotlineName: "2222-8888"
residentialHotlineServieEndTime: null
residentialHotlineServieStartTime: null
residentialManagerUserName: "张主任"
residentialName: "ZERO Community"
residentialPhone: "2222-8888"
residentialStartWorking: null
residentialZipCode: "589647"
serviceGuideUrl: "propertyServiceGuide.pdf"
serviceProviderId: ""
serviceProviderName: ""
updateTime: */
}
}, [])
// 小区名称,
// 详细地址,
// 工作时间 休息时间
// 小区联系电话 小区邮箱
// 小区管理员
// 物业费
// 楼巴时刻表 物业办事指南 保质期服务
// 帮助中心
// 临时到访码下载
return (
<div style={{ width: "100%", minWidth: 1020, padding: 34, backgroundColor: "#ffffff" }}>
{
DataSave != null ?
<>
<TitleBack title="Community Detail"></TitleBack>
<Row gutter={8}>
<Col span={3}>小区名称:</Col>
<Col>{DataSave.residentialName}</Col>
</Row>
<Row gutter={8} style={{marginTop:16}}>
<Col span={3}>详细地址:</Col>
<Col>{DataSave.residentialAddress}</Col>
</Row>
<Row gutter={8} style={{marginTop:16}}>
<Col span={3}>小区联系电话:</Col>
<Col span={3}>{DataSave.residentialPhone}</Col>
<Col>小区邮箱:</Col>
<Col>{DataSave.residentialEmail}</Col>
</Row>
<Row gutter={8} style={{marginTop:16}}>
<Col span={3}>小区管理员:</Col>
<Col>{DataSave.residentialManagerUserName}</Col>
</Row>
<Row gutter={8} style={{marginTop:16}}>
<Col span={3}>物业费:</Col>
<Col>{DataSave.residentialAddress}</Col>
</Row>
<Row gutter={8} style={{marginTop:16}}>
<Col span={3}>楼巴时刻表:</Col>
<Col span={3}><a>{DataSave.balouscheduleUrl}</a></Col>
<Col>物业办事指南:</Col>
<Col span={3}><a>{DataSave.serviceGuideUrl}</a></Col>
<Col>保质期服务:</Col>
<Col span={3}><a>{DataSave.lifeServiceUrl}</a></Col>
</Row>
<Row gutter={8} style={{marginTop:16}}>
<Col span={3}>帮助中心:</Col>
<Col>{DataSave.residentialHotline}</Col>
<Col>{DataSave.residentialHotlineName}</Col>
</Row>
<Row gutter={8} style={{marginTop:16}}>
<Col span={3}>临时到访码:</Col>
<Col>{DataSave.residentialZipCode}</Col>
</Row>
</> : null
}
</div>
);
};
function map(state:any) {
const { Data,DataSave,Result} = state[module]
return { Data,DataSave,Result}
}
export default connect(map)(Detail);
\ No newline at end of file
...@@ -416,7 +416,7 @@ const Bookings = (props: any) => { ...@@ -416,7 +416,7 @@ const Bookings = (props: any) => {
<Col> <Col>
<Form.Item label="Reserve Time" name="Time" noStyle> <Form.Item label="Reserve Time" name="Time" noStyle>
<OnTimeTow <OnTimeTow
disabled={prohibit} disabled={prohibit || dateTime}
limit={curString.categoriesOpenTime} // 设施默认禁止时间段 limit={curString.categoriesOpenTime} // 设施默认禁止时间段
inhibitTime={result} // 选择日期后的禁止时间 inhibitTime={result} // 选择日期后的禁止时间
onChanges={onChanges} onChanges={onChanges}
......
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