Commit d1ffefa8 authored by Sixiang_Zzb's avatar Sixiang_Zzb

申请住户卡bug处理

parent af885b0d
...@@ -11,11 +11,14 @@ import Line from '@/components/Line/Line'; ...@@ -11,11 +11,14 @@ import Line from '@/components/Line/Line';
import TextArea from 'antd/lib/input/TextArea'; import TextArea from 'antd/lib/input/TextArea';
import Relationship from '@/components/Relationship/Relationship'; import Relationship from '@/components/Relationship/Relationship';
import { useForm } from 'antd/es/form/util'; import { useForm } from 'antd/es/form/util';
import { validateMessages } from '@/utils/params';
import styles from './css/index.less';
const module = 'CommunityService'; const module = 'CommunityService';
let communityName: string = '';
const CardAdd = (props: any) => { const CardAdd = (props: any) => {
const { dispatch, Result, communityInfo } = props; const { dispatch, Result, communityInfo } = props;
// const formRef = useRef(null)
const [form] = Form.useForm(); const [form] = Form.useForm();
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
...@@ -35,11 +38,18 @@ const CardAdd = (props: any) => { ...@@ -35,11 +38,18 @@ const CardAdd = (props: any) => {
}, [Result]); }, [Result]);
const onFinish = (values: any) => { const onFinish = (values: any) => {
if (!communityName) {
message.warning('Please enter the complete!');
return;
}
values.communityName = communityName;
setLoading(true); setLoading(true);
RA(35, values, module, dispatch); RA(35, values, module, dispatch);
}; };
const extendName = (values: any) => { const extendName = (values: any) => {
communityName = values;
RA(32, { communityName: values }, 'User', dispatch); RA(32, { communityName: values }, 'User', dispatch);
}; };
...@@ -47,18 +57,39 @@ const CardAdd = (props: any) => { ...@@ -47,18 +57,39 @@ const CardAdd = (props: any) => {
if (communityInfo != null) { if (communityInfo != null) {
form.setFieldsValue({ form.setFieldsValue({
zipCode: zipCode:
communityInfo.data.rows[0].residentialAddress + communityInfo.data.rows.residentialAddress +
' SINGAPORE' + ' SINGAPORE' +
communityInfo.data.rows[0].residentialZipCode, communityInfo.data.rows.residentialZipCode,
}); });
} }
}, [communityInfo]); }, [communityInfo]);
useEffect(() => {
form.resetFields();
}, []);
const checkData = (rule: any, value: any, callback: any) => {
if (value) {
if (/^[a-zA-Z0-9]+$/g.test(value)) {
callback();
} else {
callback(new Error('Only numbers and letters can be entered!'));
}
}
callback();
};
const checkName = (rule: any, value: any, callback: any) => {
if (!value || !value.trim()) {
callback(new Error('*it is required!'));
}
callback();
};
return ( return (
<div style={{ width: '100%', minWidth: 1020, padding: 34, backgroundColor: '#ffffff' }}> <div style={{ width: '100%', minWidth: 1020, padding: 34, backgroundColor: '#ffffff' }}>
<TitleBack title={'Apply Card'}></TitleBack> <TitleBack title={'Apply Card'}></TitleBack>
<Form form={form} name="basic" onFinish={onFinish}> <Form form={form} name="basic" onFinish={onFinish} validateMessages={validateMessages}>
<Spin spinning={loading}> <Spin spinning={loading}>
<Form.Item labelCol={{ span: 3 }} label="Community" style={{ marginBottom: 0 }}> <Form.Item labelCol={{ span: 3 }} label="Community" style={{ marginBottom: 0 }}>
<Input.Group compact> <Input.Group compact>
...@@ -68,7 +99,8 @@ const CardAdd = (props: any) => { ...@@ -68,7 +99,8 @@ const CardAdd = (props: any) => {
<Form.Item <Form.Item
name="buildNumber" name="buildNumber"
style={{ marginRight: 16 }} style={{ marginRight: 16 }}
rules={[{ required: true }]} className={styles.buildNumber}
rules={[{ required: true, validator: checkData }]}
> >
<Input style={{ width: 80 }} placeholder={'Building'} /> <Input style={{ width: 80 }} placeholder={'Building'} />
</Form.Item> </Form.Item>
...@@ -76,18 +108,27 @@ const CardAdd = (props: any) => { ...@@ -76,18 +108,27 @@ const CardAdd = (props: any) => {
<Form.Item <Form.Item
name="floorNumber" name="floorNumber"
style={{ marginRight: 16 }} style={{ marginRight: 16 }}
rules={[{ required: true }]} className={styles.floorNumber}
rules={[{ required: true, validator: checkData }]}
> >
<Input style={{ width: 80 }} placeholder={'Floor'} /> <Input style={{ width: 80 }} placeholder={'Floor'} />
</Form.Item> </Form.Item>
<div style={{ lineHeight: 2, marginRight: 16 }}>-</div> <div style={{ lineHeight: 2, marginRight: 16 }}>-</div>
<Form.Item name="roomNumber" rules={[{ required: true }]}> <Form.Item
name="roomNumber"
className={styles.roomNumber}
rules={[{ required: true, validator: checkData }]}
>
<Input style={{ width: 120 }} placeholder={'Room'} /> <Input style={{ width: 120 }} placeholder={'Room'} />
</Form.Item> </Form.Item>
</Input.Group> </Input.Group>
</Form.Item> </Form.Item>
<Form.Item name="zipCode" wrapperCol={{ ...Layout.wrapperCol, offset: 3 }}> <Form.Item
name="zipCode"
wrapperCol={{ ...Layout.wrapperCol, offset: 3 }}
rules={[{ required: true }]}
>
<Input <Input
style={{ width: 580 }} style={{ width: 580 }}
placeholder={'Display the address and postcode automatically according to the'} placeholder={'Display the address and postcode automatically according to the'}
...@@ -95,35 +136,22 @@ const CardAdd = (props: any) => { ...@@ -95,35 +136,22 @@ const CardAdd = (props: any) => {
></Input> ></Input>
</Form.Item> </Form.Item>
<Form.Item <Form.Item labelCol={{ span: 3 }} label="Owner Name" style={{ marginBottom: -40 }}>
labelCol={{ span: 3 }}
label="Owner Name"
style={{ marginBottom: -40 }}
rules={[{ required: true }]}
>
<Input.Group compact> <Input.Group compact>
<Form.Item <Form.Item
name="communityOwner" name="communityOwner"
style={{ marginRight: 20 }} style={{ marginRight: 20 }}
rules={[{ required: true }]} rules={[{ required: true, validator: checkName }]}
> >
<Input placeholder={'Name'} /> <Input placeholder={'Name'} />
</Form.Item> </Form.Item>
<Form.Item <Form.Item style={{ marginRight: 20 }} label={'Contact Information'}>
style={{ marginRight: 20 }}
label={'Contact Information'}
rules={[{ required: true }]}
>
<Input hidden={true} /> <Input hidden={true} />
</Form.Item> </Form.Item>
<Form.Item <Form.Item name="communityOwnerPhone" style={{ marginRight: 20 }}>
name="communityOwnerPhone"
style={{ marginRight: 20 }}
rules={[{ required: true }]}
>
<Input placeholder={'Phone number'} /> <Input placeholder={'Phone number'} />
</Form.Item> </Form.Item>
<Form.Item name="communityOwnerEmail" rules={[{ required: true }]}> <Form.Item name="communityOwnerEmail" rules={[{ required: true, type: 'email' }]}>
<Input placeholder={'Email'} /> <Input placeholder={'Email'} />
</Form.Item> </Form.Item>
</Input.Group> </Input.Group>
...@@ -133,24 +161,20 @@ const CardAdd = (props: any) => { ...@@ -133,24 +161,20 @@ const CardAdd = (props: any) => {
<Form.Item labelCol={{ span: 3 }} label="Applicant" style={{ marginBottom: -40 }}> <Form.Item labelCol={{ span: 3 }} label="Applicant" style={{ marginBottom: -40 }}>
<Input.Group compact> <Input.Group compact>
<Form.Item name="applyName" style={{ marginRight: 20 }} rules={[{ required: true }]}>
<Input placeholder={'Name'} />
</Form.Item>
<Form.Item <Form.Item
name="applyName"
style={{ marginRight: 20 }} style={{ marginRight: 20 }}
label={'Contact Information'} rules={[{ required: true, validator: checkName }]}
rules={[{ required: true }]}
> >
<Input placeholder={'Phone number'} hidden={true} /> <Input placeholder={'Name'} />
</Form.Item> </Form.Item>
<Form.Item <Form.Item style={{ marginRight: 20 }} label={'Contact Information'}>
name="applyNamePhone" <Input hidden={true} />
style={{ marginRight: 20 }} </Form.Item>
rules={[{ required: true }]} <Form.Item name="applyNamePhone" style={{ marginRight: 20 }}>
>
<Input placeholder={'Phone number'} /> <Input placeholder={'Phone number'} />
</Form.Item> </Form.Item>
<Form.Item name="applyNameEmail" rules={[{ required: true }]}> <Form.Item name="applyNameEmail" rules={[{ required: true, type: 'email' }]}>
<Input placeholder={'Email'} /> <Input placeholder={'Email'} />
</Form.Item> </Form.Item>
</Input.Group> </Input.Group>
......
import React, { useState, useEffect,useRef} from 'react'; import React, { useState, useEffect, useRef } from 'react';
import { Input ,Tabs,Row,Col, Button,Form,Radio,message} from 'antd'; import { Input, Tabs, Row, Col, Button, Form, Radio, message } from 'antd';
const { TabPane } = Tabs; const { TabPane } = Tabs;
import {connect,history} from 'umi'; import { connect, history } from 'umi';
import { RA, getCookie } from '@/utils/method'; import { RA, getCookie } from '@/utils/method';
import TitleBack from '@/components/TitleBack/TitleBack'; import TitleBack from '@/components/TitleBack/TitleBack';
import Line from '@/components/Line/Line'; import Line from '@/components/Line/Line';
import TextArea from 'antd/lib/input/TextArea'; import TextArea from 'antd/lib/input/TextArea';
const module="CommunityService" const module = 'CommunityService';
const CardDetail = (props:any) => { const CardDetail = (props: any) => {
const { dispatch, Data, DataSave, DataSaveDetail } = props;
const { dispatch, Data,DataSave,DataSaveDetail } = props; const formRef = useRef(null);
const formRef = useRef(null)
useEffect(()=>{ useEffect(() => {
if (DataSaveDetail != null) { if (DataSaveDetail != null) {
console.log(DataSaveDetail) console.log(DataSaveDetail);
} }
}, [DataSaveDetail]) }, [DataSaveDetail]);
useEffect(()=>{ useEffect(() => {
if (DataSave != null) { if (DataSave != null) {
console.log("初始化页面参数") console.log('初始化页面参数');
console.log(DataSave); console.log(DataSave);
RA(36, { id:DataSave.id }, module, dispatch); RA(36, { id: DataSave.id }, module, dispatch);
/* apply_name: "jack-小白白"
apply_reason_content: "H4sIAAAAAAAAAHuyo/fJnlkAljbS9QYAAAA="
apply_relation_owner: 0
apply_status: 0
build_number: "01"
communityId: "7e5c6fd2f4ba497a90e64535df6e9088"
community_name: "A4"
community_owner: "jack-小白白"
community_owner_email: "3290098379@qq.com"
create_time: {date: 10, day: 4, hours: 19, minutes: 51, month: 8, …}
deleted: 0
floor_number: "00"
id: "977597589971009536"
ownerId: "c4da40676d044487b37e7a1bdc6dd045"
room_number: "767"
update_time: */
} else { } else {
history.go(-1) history.go(-1);
}
}, [])
const onFinish = (values:any) => {
var tmp={
communityId : DataSave.communityId,
id:DataSave.id,
ownerId:DataSave.ownerId,
applyStatus:values.applyStatus,
replyContent:values.replyContent,
type:"7"
} }
console.log(tmp) }, []);
RA(34,tmp,module,dispatch)
const onFinish = (values: any) => {
var tmp = {
communityId: DataSave.communityId,
id: DataSave.id,
ownerId: DataSave.ownerId,
applyStatus: values.applyStatus,
replyContent: values.replyContent,
type: '7',
};
console.log(tmp);
RA(34, tmp, module, dispatch);
message.success('Success Operation!'); message.success('Success Operation!');
history.push('/CommercialService/AccessCardApplication') history.push('/CommercialService/AccessCardApplication');
} };
return ( return (
<div style={{ width: "100%", minWidth: 1020, padding: 34, backgroundColor: "#ffffff" }}> <div style={{ width: '100%', minWidth: 1020, padding: 34, backgroundColor: '#ffffff' }}>
{ {DataSave != null ? (
DataSave != null ? <> <>
<TitleBack sublist={['Status : ' + "1", 'Time : ' + '12']} title="Apply Card" ></TitleBack> <TitleBack sublist={['Status : ' + '1', 'Time : ' + '12']} title="Apply Card"></TitleBack>
<Row gutter={8}> <Row gutter={8}>
<Col>Community:</Col> <Col>Community:</Col>
<Col span={1}>{DataSave.community_name}</Col> <Col span={3}>{DataSave.community_name}</Col>
<Col>unit:</Col> <Col>unit:</Col>
<Col>{DataSave.build_number}#{DataSave.floor_number}-{DataSave.room_number}</Col> <Col>
{DataSave.build_number}#{DataSave.floor_number}-{DataSave.room_number}
</Col>
</Row> </Row>
<Row gutter={8} style={{marginTop:16}}> <Row gutter={8} style={{ marginTop: 16 }}>
<Col>Address:</Col> <Col>Address:</Col>
<Col>{DataSave.build_number}#{DataSave.floor_number}-{DataSave.room_number}</Col> <Col>
{DataSave.build_number}#{DataSave.floor_number}-{DataSave.room_number}
</Col>
</Row> </Row>
<Row gutter={8} style={{marginTop:16}}> <Row gutter={8} style={{ marginTop: 16 }}>
<Col>Owner Name:</Col> <Col>Owner Name:</Col>
<Col span={3}>{DataSave.community_owner}</Col> <Col span={3}>{DataSave.community_owner}</Col>
<Col>Phone:</Col> <Col>Phone:</Col>
<Col>13169646231</Col> <Col>13169646231</Col>
</Row> </Row>
<Line></Line> <Line></Line>
<Row gutter={8} style={{marginTop:16}}> <Row gutter={8} style={{ marginTop: 16 }}>
<Col span={3}>Apply Name:</Col> <Col span={3}>Apply Name:</Col>
<Col span={3}>{DataSave.apply_name}</Col> <Col span={3}>{DataSave.apply_name}</Col>
<Col>Phone:</Col> <Col>Phone:</Col>
<Col>13169646231</Col> <Col>13169646231</Col>
</Row> </Row>
<Row gutter={8} style={{marginTop:16}}> <Row gutter={8} style={{ marginTop: 16 }}>
<Col span={3}>Relationship:</Col> <Col span={3}>Relationship:</Col>
<Col >{DataSave.apply_relation_owner}</Col> <Col>{DataSave.apply_relation_owner}</Col>
</Row> </Row>
<Row gutter={8} style={{marginTop:16}}> <Row gutter={8} style={{ marginTop: 16 }}>
<Col span={3}>Reason:</Col> <Col span={3}>Reason:</Col>
<Col><TextArea disabled value={DataSave.apply_reason_content} style={{width:300,height:100,padding:8}}></TextArea></Col> <Col>
<TextArea
disabled
value={DataSave.apply_reason_content}
style={{ width: 300, height: 100, padding: 8 }}
></TextArea>
</Col>
</Row> </Row>
<Line></Line> <Line></Line>
<Form ref={formRef} name="basic" onFinish={onFinish}> <Form ref={formRef} name="basic" onFinish={onFinish}>
<Row gutter={8} style={{ marginTop: 16 }}>
<Row gutter={8} style={{marginTop:16}}>
<Col span={3}>Examine:</Col> <Col span={3}>Examine:</Col>
<Col span={4}><Form.Item name="applyStatus"><Radio.Group ><Radio.Button value={"1"}>Agree</Radio.Button ><Radio.Button style={{marginLeft:10}} value={"2"}>Refuse</Radio.Button ></Radio.Group></Form.Item></Col> <Col span={4}>
<Form.Item name="applyStatus">
<Radio.Group>
<Radio.Button value={'1'}>Agree</Radio.Button>
<Radio.Button style={{ marginLeft: 10 }} value={'2'}>
Refuse
</Radio.Button>
</Radio.Group>
</Form.Item>
</Col>
</Row> </Row>
<Row gutter={8} style={{marginTop:16}}> <Row gutter={8} style={{ marginTop: 16 }}>
<Col span={3}>Reply:</Col> <Col span={3}>Reply:</Col>
<Col> <Form.Item name="replyContent"><TextArea style={{width:300,height:100,padding:8}}></TextArea></Form.Item></Col> <Col>
{' '}
<Form.Item name="replyContent">
<TextArea style={{ width: 300, height: 100, padding: 8 }}></TextArea>
</Form.Item>
</Col>
</Row> </Row>
<Row gutter={8} style={{marginTop:16}}> <Row gutter={8} style={{ marginTop: 16 }}>
<Col span={3}>Received:</Col> <Col span={3}>Received:</Col>
<Col span={4}><Form.Item name="applyStatus"><Radio.Group ><Radio value={"3"}>Agree</Radio></Radio.Group></Form.Item></Col> <Col span={4}>
<Form.Item name="applyStatus">
<Radio.Group>
<Radio value={'3'}>Agree</Radio>
</Radio.Group>
</Form.Item>
</Col>
</Row> </Row>
<Form.Item ><Button type="primary" htmlType="submit">Submit</Button></Form.Item> <Form.Item>
<Button type="primary" htmlType="submit">
Submit
</Button>
</Form.Item>
</Form> </Form>
</>
</>:null ) : null}
}
</div> </div>
); );
}; };
function map(state:any) { function map(state: any) {
const { Data,DataSave,DataSaveDetail} = state[module] const { Data, DataSave, DataSaveDetail } = state[module];
return { Data,DataSave,DataSaveDetail} return { Data, DataSave, DataSaveDetail };
} }
export default connect(map)(CardDetail); export default connect(map)(CardDetail);
...@@ -8,48 +8,84 @@ ...@@ -8,48 +8,84 @@
min-width: 1020px; min-width: 1020px;
} }
//头部组件 //头部组件
.box{ .box {
width: 100%; width: 100%;
height: 64px; height: 64px;
position: relative; position: relative;
} }
.input{ .input {
width:200px; width: 200px;
height:32px; height: 32px;
background:none; background: none;
outline: none; outline: none;
border:1px solid rgba(217,217,217,1); border: 1px solid rgba(217, 217, 217, 1);
border-radius:2px; border-radius: 2px;
font-size:14px; font-size: 14px;
font-weight:400; font-weight: 400;
line-height:30px; line-height: 30px;
text-indent: 19px; text-indent: 19px;
} }
.item1{ .item1 {
.input(); .input();
} }
.item2{ .item2 {
.input(); .input();
margin-left: 20px; margin-left: 20px;
} }
.item4{ .item4 {
.input(); .input();
margin-left: 20px; margin-left: 20px;
} }
.item3{ .item3 {
width:80px; width: 80px;
height:32px; height: 32px;
border:1px solid rgba(24,144,255,1); border: 1px solid rgba(24, 144, 255, 1);
border-radius:2px; border-radius: 2px;
background-color:#e7f4ff; background-color: #e7f4ff;
outline: none; outline: none;
font-size:14px; font-size: 14px;
font-weight:400; font-weight: 400;
color:rgba(24,144,255,1); color: rgba(24, 144, 255, 1);
line-height:30px; line-height: 30px;
cursor: pointer; cursor: pointer;
margin-left: 48px; margin-left: 48px;
} }
.item3:active{ .item3:active {
background-color:#ffffff; background-color: #ffffff;
}
.buildNumber {
:global(.ant-form-item-explain) {
position: absolute;
top: 34px;
left: 33px;
width: 260px;
z-index: 10;
background-color: #fff;
min-height: 20px;
}
}
.floorNumber {
:global(.ant-form-item-explain) {
position: absolute;
top: 34px;
left: -87px;
width: 260px;
z-index: 20;
background-color: #fff;
min-height: 20px;
}
}
.roomNumber {
:global(.ant-form-item-explain) {
position: absolute;
top: 34px;
left: -205px;
width: 260px;
z-index: 30;
background-color: #fff;
min-height: 20px;
}
} }
...@@ -11,7 +11,6 @@ import { checkParam, RA } from '../../../utils/method'; ...@@ -11,7 +11,6 @@ import { checkParam, RA } from '../../../utils/method';
import { validateMessages } from '@/utils/params'; import { validateMessages } from '@/utils/params';
const module = 'User'; const module = 'User';
let verifyNum = 0;
const UsersAdd = (props: any) => { const UsersAdd = (props: any) => {
const { dispatch, communityInfo } = props; const { dispatch, communityInfo } = props;
...@@ -47,9 +46,9 @@ const UsersAdd = (props: any) => { ...@@ -47,9 +46,9 @@ const UsersAdd = (props: any) => {
if (postman.extend != null) { if (postman.extend != null) {
formRef.current.setFieldsValue({ formRef.current.setFieldsValue({
addressAndpostalCode: addressAndpostalCode:
communityInfo.data.rows[0].residentialAddress + communityInfo.data.rows.residentialAddress +
' SINGAPORE' + ' SINGAPORE' +
communityInfo.data.rows[0].residentialZipCode, communityInfo.data.rows.residentialZipCode,
}); });
} }
} }
......
...@@ -11,6 +11,9 @@ export const validateMessages = { ...@@ -11,6 +11,9 @@ export const validateMessages = {
number: { number: {
range: '${label} must be between ${min} and ${max}', range: '${label} must be between ${min} and ${max}',
}, },
phone: {
range: 'It has to be an 8 digit number or an 11 digit number!',
},
}; };
export const requestList = [ export const requestList = [
......
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