Commit 9670e42a authored by cellee's avatar cellee

完善小区提交信息,转化英文

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent 6aaa43c3
import React, { useState, useEffect, useRef } from 'react';
import { Link, useIntl, connect, Dispatch, history } from 'umi';
import styles from './index.less';
import BackButton from '../BackButton/BackButton';
import TitleGet from '../TitleGet/TitleGet';
import {SearchOutlined} from '@ant-design/icons';
import { Input, Row, Col, Form, Select, Button, DatePicker } from 'antd';
const { Option } = Select;
......@@ -195,7 +192,7 @@ const TitleSearch = (props: any) => {
htmlType="submit"
style={{ backgroundColor: '#e7f4ff', color: 'rgba(24,144,255,1)' }}
>
Search
<SearchOutlined /> Search
</Button>
</Form.Item>
</>
......
......@@ -68,13 +68,13 @@ export default {
yield put({ type: 'returnPage', Data });
}
break;
case 29: // 小区编辑
case 29: // 小区新增编辑
{
let Result = resp;
yield put({ type: 'returnResult', Result });
// message.success(`小区信息保存成功!`);
// history.push('/CommunityManagement/CellList');
message.success(`Information saved successfully!`);
history.push('/CommunityManagement/CellList');
}
break;
case 32: // 获取小区详情
......
......@@ -10,8 +10,10 @@ import { village } from '@/utils/tip';
import moment from 'moment';
const { RangePicker } = TimePicker;
// 接口申明
interface objc {}
interface objc { }
const Adds = (props: any) => {
const { Data, dispatch, loading, Result } = props;
......@@ -22,11 +24,10 @@ const Adds = (props: any) => {
//物业费选择
const plainOptions = [
{ label: '线上缴费', value: '0', disabled: true },
{ label: '线下缴费', value: '1' },
{ label: 'Online Payment', value: '0', disabled: true },
{ label: 'Offline Payment', value: '1' },
];
const { RangePicker } = TimePicker;
// 表单物业费提交值
const [PropertyFee, setPropertyFee] = useState(['1']);
......@@ -42,22 +43,23 @@ const Adds = (props: any) => {
const [codeStrat, setcodeStrat] = useState(false);
const [tipMain, setTipMain] = useState('');
useEffect(() => {
console.log(Result);
if (Result != null) {
console.log('页面结果');
console.log(Result);
if (Result.error_code == undefined) {
console.log('服务器有问题');
message.error('服务器有问题,请求失败', 5);
}
if (Result.error_code == '0000') {
message.success(`Community Saved Successfully`);
history.go(-1);
}
ResultClear(module, dispatch);
}
}, [Result]);
// 监听提交
// useEffect(() => {
// console.log(Result);
// if (Result != null) {
// console.log('页面结果');
// console.log(Result);
// if (Result.error_code == undefined) {
// console.log('服务器有问题');
// message.error('服务器有问题,请求失败', 5);
// }
// if (Result.error_code == '0000') {
// message.success(`Community Saved Successfully`);
// ResultClear(module, dispatch);
// history.go(-1);
// }
// }
// }, [Result]);
// 赋值
useEffect(() => {
......@@ -81,16 +83,13 @@ const Adds = (props: any) => {
email: Data.residentialEmail,
},
residentialManagerUserName: Data.residentialManagerUserName,
// 非必填的
help: {
residentialHotlineName: Data.residentialHotlineName ? Data.residentialHotlineName : '',
residentialHotline: Data.residentialHotline ? Data.residentialHotline : '',
time: Data.residentialHotlineServieStartTime
? [
moment(Data.residentialHotlineServieStartTime, 'HH:mm'),
moment(Data.residentialHotlineServieEndTime, 'HH:mm'),
]
: '',
residentialHotlineName: Data.residentialHotlineName,
residentialHotline: Data.residentialHotline,
time: [
moment(Data.residentialHotlineServieStartTime, 'HH:mm'),
moment(Data.residentialHotlineServieEndTime, 'HH:mm'),
]
},
});
// 上传
......@@ -100,7 +99,7 @@ const Adds = (props: any) => {
// 小区名 -- 上传需要
setCodeName(Data.residentialName);
setcodeStrat(true);
setTipMain('Binding content already exists, cannot be modified');
setTipMain('Binding Content Already Exists, Cannot Be Modified!');
} else {
console.log('新建');
}
......@@ -134,11 +133,11 @@ const Adds = (props: any) => {
console.log(po);
setLouba(po);
setcodeStrat(true);
setTipMain('已有绑定内容,不可做修改!');
setTipMain('Binding Content Already Exists, Cannot Be Modified!');
// 结果
uploadMsg(info);
} else {
message.warning('请先填写小区名');
message.warning('Please Fill In The Community Name');
}
},
};
......@@ -151,11 +150,11 @@ const Adds = (props: any) => {
// 给楼巴上传列表值
setGuide(po);
setcodeStrat(true);
setTipMain('已有绑定内容,不可做修改!');
setTipMain('Binding Content Already Exists, Cannot Be Modified!');
// 结果
uploadMsg(info);
} else {
message.warning('请先填写小区名');
message.warning('Please Fill In The Community Name');
}
},
};
......@@ -168,11 +167,11 @@ const Adds = (props: any) => {
// 给楼巴上传列表值 以及禁止修改小区名
setPeriod(po);
setcodeStrat(true);
setTipMain('已有绑定内容,不可做修改!');
setTipMain('Binding Content Already Exists, Cannot Be Modified!');
// 结果
uploadMsg(info);
} else {
message.warning('请先填写小区名');
message.warning('Please Fill In The Community Name');
}
},
};
......@@ -201,8 +200,18 @@ const Adds = (props: any) => {
}
}
// 表单提交
// 表单验证
const onFinish = (values: any) => {
let { residentialZipCode, residentialAddress, residentialName } = values.des;
if (residentialZipCode.length < 6) {
message.error('Please Enter 6-digit Zip Code!')
} else {
onUpDate(values)
}
}
// 表单提交
function onUpDate(values: any) {
console.log(values.help);
let obj: any = new Object();
......@@ -229,21 +238,21 @@ const Adds = (props: any) => {
// 小区热线
// 表单结构存在数据不存在情况, 所以要多判断一次
if (values.help) {
obj.residentialHotlineName = undeFi(values.help.residentialHotlineName);
obj.residentialHotline = undeFi(values.help.residentialHotline);
obj.residentialHotlineName = values.help.residentialHotlineName ? undeFi(values.help.residentialHotlineName) : values.info.tel;
obj.residentialHotline = values.help.residentialHotlineName ? undeFi(values.help.residentialHotline) : values.info.tel;
// 编辑的时候 为空 判断
if (values.help.time !== '' && values.help.time) {
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 = '';
obj.residentialHotlineServieEndTime = '';
obj.residentialHotlineServieStartTime = values.workingHours[0].format('HH:mm');
obj.residentialHotlineServieEndTime = values.workingHours[1].format('HH:mm');
}
} else {
obj.residentialHotlineName = '';
obj.residentialHotline = '';
obj.residentialHotlineServieStartTime = '';
obj.residentialHotlineServieEndTime = '';
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');
}
console.log('Success:', obj);
......@@ -270,9 +279,9 @@ const Adds = (props: any) => {
<>
<Spin spinning={loading} tip="信息提交中..." size="large">
<div className="form">
<h3>
<h3 className='capi'>
<EditOutlined />
&nbsp; {Data ? '编辑' : '新增'}小区
&nbsp; {Data ? 'edit' : 'establish'} community
<div className="back">
<Button onClick={goToReturn}>
<LeftOutlined />
......@@ -322,7 +331,7 @@ const Adds = (props: any) => {
</Form.Item>
<Form.Item label="Working Hours" name="workingHours" rules={village[1] as any}>
<RangePicker format="HH:mm" />
<RangePicker format="HH:mm" placeholder={['Start Time','End Time']} />
</Form.Item>
<Form.Item label="Community Telephone" name="info" rules={village[3] as any}>
......@@ -357,8 +366,8 @@ const Adds = (props: any) => {
<Form.Item label="Property Fee" name="propertyFee" style={{ marginBottom: '0' }}>
<Checkbox.Group options={plainOptions} defaultValue={['1']} onChange={onChange} />
<div className="tip">
<span>*</span>线上缴费会有服务费
<div className="tip capi">
<span>*</span>There will be a service charge for online payment
</div>
</Form.Item>
......@@ -377,7 +386,7 @@ const Adds = (props: any) => {
<LinkOutlined color="#409EFF" />
{loubaUpload.length > 0 ? loubaUpload[0].name : ''}
</p>
<span>支持文件:.doc,.docx,.jpg,.png,.pdf</span>
<span className="capi">Support Files:.doc,.docx,.jpg,.png,.pdf</span>
</div>
</Form.Item>
......@@ -390,7 +399,7 @@ const Adds = (props: any) => {
<LinkOutlined color="#409EFF" />
{guideUpload.length > 0 ? guideUpload[0].name : ''}
</p>
<span>支持文件:.doc,.docx,.jpg,.png,.pdf</span>
<span className="capi">Support Files:.doc,.docx,.jpg,.png,.pdf</span>
</div>
</Form.Item>
......@@ -407,7 +416,7 @@ const Adds = (props: any) => {
<LinkOutlined color="#409EFF" />
{periodUpload.length > 0 ? periodUpload[0].name : ''}
</p>
<span>支持文件:.doc,.docx,.jpg,.png,.pdf</span>
<span className="capi">Support Files:.doc,.docx,.jpg,.png,.pdf</span>
</div>
</Form.Item>
......@@ -418,16 +427,16 @@ const Adds = (props: any) => {
<Form.Item name={['help', 'residentialHotlineName']} noStyle>
<Input
style={{ marginRight: '10px', width: '160px' }}
placeholder="热线电话名称"
placeholder="Name Of Hotline"
/>
</Form.Item>
<Form.Item name={['help', 'residentialHotline']} noStyle>
<Input style={{ marginRight: '10px', width: '180px' }} placeholder="热线电话" />
<Input style={{ marginRight: '10px', width: '180px' }} placeholder="Hotline" />
</Form.Item>
<Form.Item name={['help', 'time']} noStyle>
<RangePicker format="HH:mm" />
<RangePicker format="HH:mm" placeholder={['Start Time','End Time']} />
</Form.Item>
</Input.Group>
</Form.Item>
......
......@@ -44,7 +44,18 @@ const CellLists = (props: any) => {
]);
const { dispatch, Data, loading, curString, village } = props;
// console.log(Data);
// 翻页数据
function pagesList( name:string , list: any , num: number){
let msg = {
residentialManagerUserName: name ? name : '',
communityNameList: list,
pageNum: num,
}
return msg
}
console.log(village.page)
// 先请求一次 拿到所有小区列表
useEffect(() => {
......@@ -54,12 +65,7 @@ const CellLists = (props: any) => {
// 监听data请求完毕再请求一次
useEffect(() => {
if (Data != null) {
let msg = {
residentialManagerUserName: '',
communityNameList: Data.communityList,
pageNum: 1,
};
RA(48, msg, module, dispatch);
RA(48, pagesList('',Data.communityList , 1), module, dispatch);
}
}, [Data]);
......@@ -84,39 +90,23 @@ const CellLists = (props: any) => {
// 点击搜索
const CallBackTitleSearch = (comment: any) => {
message.error('后台接口更新中');
// if (comment.communityName.length > 0 || typeof comment.label !== 'undefined') {
// let tmp: any = new Object();
// tmp.adminName = comment.label;
// tmp.communityName = comment.communityName;
// tmp.curPage = 1;
// // QA(tmp);
// console.log(tmp);
// // CallbackSearch()
// //中断
// // RA(9, {
// // userToken: token,
// // pageNum: '1',
// // subscribeDate: tmp.subscribeDate,
// // status: tmp.status,
// // communityNameList: comment.communityName,
// // }, module, dispatch);
// } else {
// message.error('请输入管理员姓名或选择小区进行搜索!');
// }
console.log(comment)
if (comment.communityName.length > 0 || typeof comment.label !== 'undefined') {
RA(48, pagesList(comment.label,comment.communityName , 1), module, dispatch);
}
else {
message.error('Please Enter And Select A Content To Search!');
}
};
// 页面切换
// 点击页面属性传参数
const paginationHandler = (page: number, pageSize?: number) => {
dispatch({
type: 'ContractModel/getList',
payload: {
index: 19,
page: {
pageNum: page,
},
},
});
RA(48, pagesList('',Data.communityList , page), module, dispatch);
};
// 刷新
const resetHandler = () => {
RA(48, pagesList('',Data.communityList , 1), module, dispatch);
};
return (
......@@ -150,27 +140,29 @@ const CellLists = (props: any) => {
density: true,
fullScreen: true,
reload: () => {
// resetHandler();
resetHandler();
},
setting: false,
}}
headerTitle="Community List"
// pagination={{ defaultCurrent: 1, total: Data.totalRow }}
// pagination={{ defaultCurrent: 1, total: Data.totalRow }}
/>
<div className="pages">
{/* <Pagination
current={village.page}
total={village.totalRow}
onChange={paginationHandler}
// onShowSizeChange={pageSizeHandler}
// current={users.meta.page}
// pageSize={users.meta.per_page}
/> */}
</div>
{village.page ? (
<div className="pages">
<Pagination
current={village.page.currentPage}
total={village.page.totalRow}
pageSize={village.page.curPageSize}
onChange={paginationHandler}
/>
</div>
) : ''}
</>
) : (
'暂无数据'
)}
'暂无数据'
)}
</div>
);
};
......
......@@ -125,7 +125,7 @@ const Detail = (props: any) => {
<div className="form">
<h3>
<EyeOutlined />
&nbsp;小区详情
&nbsp;Community Details
<div className="back">
<Button
type="primary"
......@@ -149,7 +149,7 @@ const Detail = (props: any) => {
<div className="celBox">
{/* 激活码 */}
<div className="code">
<li>小区激活码</li>
<li>Community Activation Code</li>
<Image width={140} src={detailData.visitorUrl} fallback={imgs} />
<li className="lis">{detailData.rows.cdkCode}</li>
</div>
......@@ -157,19 +157,19 @@ const Detail = (props: any) => {
{/* 详情 */}
<div className="list-item">
<div className="item">
<label>小区名称</label>
<label>Community Name</label>
<span>{detailData.rows.residentialName}</span>
</div>
{/* ---------- */}
<div className="item">
<label>详细地址</label>
<label>Community Address</label>
<span>
{detailData.rows.residentialAddress}&nbsp;{detailData.rows.residentialZipCode}{' '}
</span>
</div>
{/* ---------- */}
<div className="item">
<label>工作时间</label>
<label>Working Hours</label>
<span>
{detailData.rows.residentialStartWorking} -{' '}
{detailData.rows.residentialEndWorking}
......@@ -178,23 +178,23 @@ const Detail = (props: any) => {
{/* ---------- */}
<div className="inst">
<div className="item">
<label>小区联系电话</label>
<label>Community Telephone</label>
<span>{detailData.rows.residentialPhone}</span>
</div>
<div className="item">
<label>小区邮箱</label>
<label>Community Email</label>
<span>{detailData.rows.residentialEmail}</span>
</div>
</div>
{/* ---------- */}
<div className="item">
<label>小区管理员</label>
<label>Administrators</label>
<span>{detailData.rows.residentialManagerUserName}</span>
</div>
{/* ---------- */}
<div className="item" style={{ marginBottom: '0' }}>
<label>物业费</label>
<label>Property Fee</label>
<Checkbox.Group options={plainOptions} defaultValue={['1']} />
</div>
</div>
......@@ -205,7 +205,7 @@ const Detail = (props: any) => {
<div className="celBox">
<div className="list-item">
<div className="item">
<label>楼巴时刻表</label>
<label>Louba Timetable</label>
<Avatar
shape="square"
style={{ color: '#f56a00', backgroundColor: '#F2F6FC' }}
......@@ -214,7 +214,7 @@ const Detail = (props: any) => {
/>
{detailData.rows.balouscheduleUrl ? (
<Button type="link" onClick={() => opens(detailData.rows.balouscheduleUrl)}>
预览
Browse
</Button>
) : (
''
......@@ -222,7 +222,7 @@ const Detail = (props: any) => {
</div>
{/* ---------- */}
<div className="item">
<label>物业办事指南</label>
<label>Property Guide</label>
<Avatar
shape="square"
style={{ color: '#f56a00', backgroundColor: '#F2F6FC' }}
......@@ -231,7 +231,7 @@ const Detail = (props: any) => {
/>
{detailData.rows.serviceGuideUrl ? (
<Button type="link" onClick={() => opens(detailData.rows.serviceGuideUrl)}>
预览
Browse
</Button>
) : (
''
......@@ -239,7 +239,7 @@ const Detail = (props: any) => {
</div>
{/* ---------- */}
<div className="item">
<label>保质期服务</label>
<label>Shelf Life Service</label>
<Avatar
shape="square"
style={{ color: '#f56a00', backgroundColor: '#F2F6FC' }}
......@@ -248,7 +248,7 @@ const Detail = (props: any) => {
/>
{detailData.rows.lifeServiceUrl ? (
<Button type="link" onClick={() => opens(detailData.rows.lifeServiceUrl)}>
预览
Browse
</Button>
) : (
''
......@@ -262,7 +262,7 @@ const Detail = (props: any) => {
<div className="celBox">
<div className="list-item">
<div className="item item_span">
<label>帮助中心</label>
<label>Help Center</label>
<span>{detailData.rows.residentialHotlineName}</span>
<span>{detailData.rows.residentialHotline}</span>
<span>{detailData.rows.residentialHotlineServieStartTime}</span>
......@@ -277,7 +277,7 @@ const Detail = (props: any) => {
<div className="celBox">
<div className="list-item">
<div className="item">
<label>临时到访码下载</label>
<label>Temporary Code</label>
<Image width={64} src={hfor} />
<Button
type="link"
......@@ -285,7 +285,7 @@ const Detail = (props: any) => {
openDows(require('@/assets/h5.png'), 'code.png');
}}
>
下载
Download
</Button>
<Input
......@@ -300,7 +300,7 @@ const Detail = (props: any) => {
copy('http://47.74.233.180:8651/tosVisitorNo');
}}
>
复制
Copy
</Button>
</div>
</div>
......
li {
list-style: none;
}
.contop {
padding: 20px;
background: #fff;
......@@ -26,25 +29,11 @@
margin-bottom: 20px;
background: #fff;
}
.form .span,
.form .li {
display: inline-block;
min-width: 240px;
line-height: 30px;
background: #efefef;
font-size: 15px;
margin-top: -3px;
vertical-align: middle;
margin-left: 12px;
padding: 0 6px;
border-radius: 2px;
border: 1px solid #d9d9d9;
color: #999;
}
.form .li {
min-width: 140px;
margin-top: 15px;
margin-left: 0;
display: block;
}
.form input,
.form .ant-upload-list {
......@@ -69,5 +58,87 @@
margin-bottom: 20px;
}
.form .tip {
padding: 15px 0;
padding: 10px 0 15px;
}
.form .tip p {
display: none;
color: #67c23a;
}
.form .tip p.show {
display: block;
}
.form .tip p span {
margin-right: 5px;
}
.form .ant-form-item-label > label {
width: 160px;
}
.form .ant-divider-horizontal {
margin: 20px 0;
}
.form .celBox {
position: relative;
}
.form .celBox .item {
font-size: 14px;
line-height: 35px;
margin-bottom: 10px;
}
.form .celBox .item label {
display: inline-block;
min-width: 160px;
}
.form .celBox .item_span span {
display: inline-block;
margin-right: 15px;
}
.form .celBox .inst {
display: flex;
}
.form .celBox .inst .item {
flex: 1;
}
.form .celBox .inst .item:nth-child(2) {
flex: 2;
}
.form .celBox .code {
position: absolute;
right: 5%;
top: 50%;
transform: translateY(-55%);
width: 200px;
text-align: center;
}
.form .celBox .code li {
text-align: center;
line-height: 35px;
}
.form .celBox .code img {
width: 140px;
border: 1px solid #f0f0f0;
border-radius: 3px;
margin-bottom: 5px;
}
.form .celBox .code .lis {
color: #67c23a;
font-size: 18px;
font-weight: 500;
}
.ant-picker-time-panel-column {
width: 100px;
}
.redFs {
font-size: 12px;
color: red;
}
img {
cursor: pointer;
}
.capi {
text-transform: capitalize;
}
.pages {
background: #fff;
text-align: right;
padding: 10px ;
}
......@@ -84,12 +84,12 @@ li {
.celBox {
position: relative;
.item {
font-size: 15px;
font-size: 14px;
line-height: 35px;
margin-bottom: 10px;
label {
display: inline-block;
min-width: 110px;
min-width: 160px;
}
}
......@@ -113,6 +113,8 @@ li {
right: 5%;
top: 50%;
transform: translateY(-55%);
width: 200px;
text-align: center;
li {
text-align: center;
line-height: 35px;
......@@ -146,3 +148,8 @@ img {
.capi {
text-transform: capitalize;
}
.pages{
background: #fff;
text-align: right;
padding: 10px ;
}
\ No newline at end of file
......@@ -13,8 +13,8 @@ export const tipList = [
// 小区提示
export const village = [
[{ required: true, message: ' ' }],
[{ required: true, message: '请选择工作时间' }],
[{ required: true, message: '请输入小区管理员' }],
[{ required: true, message: '请输入小区服务电话和服务邮箱' }],
[{ required: true, message: '请完整输入小区邮编地址和名称' }],
[{ required: true, message: 'Please select working hours !' }],
[{ required: true, message: 'Please enter the community administrator !' }],
[{ required: true, message: 'Please enter the phone number and email address !' }],
[{ required: true, message: 'Please input the address and name of the community !' }],
];
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