Commit 3708790d authored by cellee's avatar cellee

测试各bug修复

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent 851262aa
......@@ -67,6 +67,7 @@ const Model: LoginModelType = {
console.log(userMessage);
console.log(userMessage.token);
setCookie('token', userMessage.token);
setCookie('id', userMessage.userModel.id);
setCookie('name', userMessage.userModel.tosUserName);
setCookie('phone', userMessage.userModel.tosUserPhone);
localStorage.setItem('permission', JSON.stringify(userMessage.permission));
......
......@@ -10,6 +10,7 @@ import { village } from '@/utils/tip';
import moment from 'moment';
import { parseInt } from 'lodash';
import { event } from '@/.umi/plugin-locale/locale';
const { RangePicker } = TimePicker;
......@@ -204,6 +205,7 @@ 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 {
......@@ -280,6 +282,11 @@ const Adds = (props: any) => {
return value;
}
// 键盘回车事件
const onKeyDowns = (event: any) => {
console.log(event);
};
return (
<>
<Spin spinning={loading} tip="信息提交中..." size="large">
......@@ -295,6 +302,7 @@ const Adds = (props: any) => {
</div>
</h3>
<Form
onKeyDown={onKeyDowns}
name="basic"
form={form}
onFinish={onFinish}
......@@ -466,9 +474,9 @@ const Adds = (props: any) => {
// export default Adds;
function map(state: any) {
console.log(state);
// console.log(state);
const Data = state.CellList.DataSave;
const loading = state.loading.models.CellList;
const loading = state.loading.models.CellList ? state.loading.models.CellList : false;
const { Result } = state.CellList;
return { Data, loading, Result };
}
......
......@@ -20,25 +20,30 @@ import { getCookie } from '@/utils/method';
import moment from 'moment';
const module = 'CommunityAnnouncement';
const Add = (props: any) => {
const { dispatch, Result, loading, DataSave, ImgSrc } = props;
const formRef = useRef(null);
const [form] = Form.useForm();
// 图片地址
const [ImageSrc, setImageSrc] = useState([] as any);
console.log(ImgSrc);
// 监听传递过来的值
useEffect(() => {
if (DataSave != null) {
// let tim = DataSave.noticStartTime.time;
let day = moment(DataSave.noticStartTime.time);
let day2 = DataSave.noticEndTime ? moment(DataSave.noticEndTime.time) : null;
// 赋值
form.setFieldsValue({
noticTitle: DataSave.noticTitlel,
noticText: DataSave.noticText,
// noticStartTime: moment(tim).format('YYYY-MM-DD'),
// noticEndTime:DataSave.noticEndTime?moment(DataSave.noticEndTime, 'YYYY-MM-DD HH:mm:ss'):'',
noticStartTime: day,
noticEndTime: day2,
});
// 发起请求图片
let msg = {
type: 'tosCommunityNoticePreview',
......@@ -48,9 +53,6 @@ const Add = (props: any) => {
}
}, [DataSave]);
// 图片地址
const [ImageSrc, setImageSrc] = useState([] as any);
// 监听图片状态 ImgSrc
useEffect(() => {
if (ImgSrc != null) {
......@@ -151,7 +153,9 @@ const Add = (props: any) => {
rules={Notice[2]}
>
<TextArea
style={{ width: 400, height: 100 }}
style={{ height: 100, maxWidth: 600 }}
maxLength={1000}
showCount={true}
placeholder="Please input the announcement content"
/>
</Form.Item>
......@@ -162,7 +166,7 @@ const Add = (props: any) => {
data={{
imageType: 'tosNotice',
}}
limitNums={1}
limitNums={5}
defaultValue={ImageSrc}
/>
</Form.Item>
......@@ -179,11 +183,7 @@ const Add = (props: any) => {
/>
</Form.Item>
<Form.Item name="noticEndTime" className="diyItem" label="Expiration Date" rules={[]}>
<DatePicker
style={{ width: 200 }}
placeholder="Expiration Dates"
disabledDate={disabledDate}
/>
<DatePicker style={{ width: 200 }} placeholder="Expiration Dates" />
</Form.Item>
<hr />
<Form.Item style={{ marginBottom: 5 }} className="diyItem" label=" " colon={false}>
......@@ -200,7 +200,9 @@ const Add = (props: any) => {
function map(state: any) {
const { Result, DataSave, ImgSrc } = state[module];
const loading = state.loading.models.CommunityAnnouncement;
const loading = state.loading.models.CommunityAnnouncement
? state.loading.models.CommunityAnnouncement
: false;
return { Result, loading, DataSave, ImgSrc };
}
export default connect(map)(Add);
......@@ -65,18 +65,18 @@ const CommunityAnnouncement = (props: any) => {
),
},
{
title: 'NoticScope',
title: 'Status',
dataIndex: 'noticStatus',
render: function (text: any) {
switch (text) {
case 1:
return <Tag color="green">Publishing</Tag>; // 发布中
return <Tag color="green">Take Effect</Tag>; // 发布中
break;
case 2:
return <Tag color="red">Expired</Tag>; // 已过期
return <Tag color="red">Invalid</Tag>; // 已过期
break;
default:
return <Tag color="cyan">Waiting for release</Tag>; // 等待发布
return <Tag color="cyan">Waiting For Release</Tag>; // 等待发布
break;
}
},
......@@ -84,7 +84,7 @@ const CommunityAnnouncement = (props: any) => {
{
title: 'Actions',
render: (text: any, record: any) => (
<Space size="middle">
<Space size={0}>
<Button
type="link"
onClick={() => {
......
......@@ -48,14 +48,14 @@ const Detail = (props: any) => {
function hanFunStart(start: any) {
switch (start) {
case 1:
return <Badge status="success" text="Publishing" />;
return <Badge status="success" text="Take effect" />;
// <Tag color="green">Publishing</Tag>; // 发布中
break;
case 2:
return <Badge status="error" text="Expired" />; // 已过期
return <Badge status="error" text="Invalid" />; // 已过期
break;
default:
return <Badge status="processing" text="Waiting for release" />; // 等待发布
return <Badge status="processing" text="Waiting For Release" />; // 等待发布
break;
}
}
......
......@@ -7,51 +7,54 @@
.ant-form-item-label {
label {
min-width : 120px;
min-width: 120px;
text-align: right;
}
}
}
hr {
border : 0;
height : 1px;
background : #eee;
border: 0;
height: 1px;
background: #eee;
margin-bottom: 20px;
}
// bianji
.form {
padding : 20px;
border : 1px solid #efefef;
padding: 20px;
border: 1px solid #efefef;
border-radius: 3px;
background : #fff;
box-shadow : 0 1px 1px #ccc;
background: #fff;
box-shadow: 0 1px 1px #ccc;
h3 {
margin-bottom: 30px;
position : relative;
line-height : 35px;
position: relative;
line-height: 35px;
.back {
position : absolute;
right : 0;
top : 0;
position: absolute;
right: 0;
top: 0;
margin-bottom: 20px;
background : #fff;
background: #fff;
}
}
.famg {
display : flex;
display: flex;
justify-content: center;
align-items : center;
div{
padding:10% 0;
align-items: center;
div {
padding: 10% 0;
}
span {
margin: 10px auto;
}
}
}
}
\ No newline at end of file
.ant-form-item textarea.ant-input {
height: 100%;
}
......@@ -30,8 +30,9 @@ import { validateMessages } from '@/utils/params';
// 日期
import moment from 'moment';
import { BookingsTip } from '@/utils/tip';
// 自定义时间段
import OnTime from '@/components/OnTime/OnTime';
import { getNumber } from '@/utils/string'; // 正则
const Bookings = (props: any) => {
const { dispatch, Data3, Result, DataSave, token, load, resultTime } = props;
......@@ -57,7 +58,8 @@ const Bookings = (props: any) => {
categoriesOpenTime: null,
} as any);
const [loading, setLoading] = useState(false);
const formRef = useRef(null);
const formRef = useRef(null as any);
const [prohibit, setProhibit] = useState(true); // 输入框是否不可选
const [result, setResultTime] = useState(resultTime); // 已预约时间段
......@@ -132,14 +134,17 @@ const Bookings = (props: any) => {
// 保存提交
const onFinish = (value: any) => {
console.log('Success:');
var tmp = value;
console.log(value);
// 判断时间选择
if (soltTime.length < 2 || !soltTime[0]) {
message.error('Please Fill In The Appointment Period!');
return false;
}
// 手机判断
if (tmp.accountPhone.length != 11 && tmp.accountPhone.length != 8) {
message.error('Please Fill In The Contact Information Correctly!');
return false;
}
// tmp.categoriesId = null
// tmp.facilitiesId = null
// tmp.communityName = null
......@@ -179,7 +184,7 @@ const Bookings = (props: any) => {
// console.log(comminityValues)
// console.log(tmp)
};
// 选择
// 选择设施
const RadioChoose = (e: any) => {
Data3.map((item: any, index: any) => {
item.categorieList.map((thing: any, i: any) => {
......@@ -196,7 +201,7 @@ const Bookings = (props: any) => {
// 选择后取消输入框禁止
setProhibit(false);
// 赋值给延后天数
setBookTime(-thing.pageSize);
setBookTime(-item.canReservationDay + 1);
// console.log(item.communityManagerFee)
// console.log(item.communityMargin)
}
......@@ -217,6 +222,7 @@ const Bookings = (props: any) => {
setProhibit(true);
setResultTime(null);
setSoltTime([]);
// formRef.current.resetFields({ accountName: null }); // 清空已填写的表单
};
// 设置之前时间不能选择
......@@ -249,6 +255,16 @@ const Bookings = (props: any) => {
setSoltTime(s);
};
// 正则手机号
const keyup_tool = (value: any) => {
return getNumber(value.replace(/[^\d^\.]+/g, ''));
};
// 手机号
const keyup_communityManagerFee = (e: any) => {
e.target.value = keyup_tool(e.target.value);
};
return (
<div className={styles.base}>
{/* 头部组件v1.2 */}
......@@ -313,6 +329,8 @@ const Bookings = (props: any) => {
style={{ width: 200 }}
placeholder="Contact Information"
disabled={prohibit}
onKeyUp={keyup_communityManagerFee}
maxLength={11}
/>
</Form.Item>
</div>
......@@ -322,11 +340,23 @@ const Bookings = (props: any) => {
<div className={styles.box4item1}>Unit : </div>
<div className="divbox4">
<Form.Item name="buildNumber" rules={BookingsTip[2]}>
<Input placeholder="Blk" style={{ width: 80 }} disabled={prohibit} />
<Input
placeholder="Blk"
style={{ width: 80 }}
disabled={prohibit}
onKeyUp={keyup_communityManagerFee}
maxLength={10}
/>
</Form.Item>
<span className="jio">#</span>
<Form.Item name="floorNumber" rules={BookingsTip[3]}>
<Input placeholder="Floor" style={{ width: 80 }} disabled={prohibit} />
<Input
placeholder="Floor"
style={{ width: 80 }}
disabled={prohibit}
onKeyUp={keyup_communityManagerFee}
maxLength={10}
/>
</Form.Item>
<span className="heng">--</span>
<Form.Item name="roomNumber" rules={BookingsTip[4]}>
......
......@@ -59,10 +59,6 @@ const Facility = (props: any) => {
const openCheck = true;
const [Ref3, setRef3] = useState([]);
const [extend, setExtend] = useState(null); // 小区名称
const [timeExtend, setTimeExtend] = useState(null);
const [pictrueExtend, setPictrueExtend] = useState({ pic: null, pics: null, tab: 3 });
const [facilityDetail, setFacilityDetail] = useState(false);
const [PATHNAME, setPATHNAME] = useState('');
......
import React , { useState, useEffect } from 'react';
import { Space, Button, message , Pagination ,Form ,Input } from 'antd';
import { connect, history , Loading } from 'umi';
import { PlusOutlined,SearchOutlined,ClearOutlined } from '@ant-design/icons';
import React, { useState, useEffect } from 'react';
import { Space, Button, message, Pagination, Form, Input, Tooltip } from 'antd';
import { connect, history, Loading } from 'umi';
import { PlusOutlined, SearchOutlined, ClearOutlined } from '@ant-design/icons';
import ProTable from '@ant-design/pro-table';
import moment from 'moment';
import styles from './ContractContent.less';
......@@ -10,59 +10,67 @@ import { RA } from '@/services/tos';
import SearchOptionsCommnity from '@/components/SearchOptions/SearchOptionsCommnity';
const Contract = (props:any) => {
const Contract = (props: any) => {
const { location, dispatch, ContractModel, userListLoading } = props;
const RA = (index: any, values: any) => {
dispatch({ type: 'Contract/RA', playload: { index: index, body: values } });
};
const {location,dispatch,ContractModel,userListLoading } = props;
const RA = (index: any, values: any) => { dispatch({ type: 'Contract/RA', playload: { index: index, body: values } }) };
console.log(userListLoading)
console.log(userListLoading);
// 把请求装在一个地方
function requst(payload:any){
dispatch({type:'ContractModel/getList', payload:payload})
function requst(payload: any) {
dispatch({ type: 'ContractModel/getList', payload: payload });
}
// 数据
useEffect(()=>{
useEffect(() => {
let payload = {
index: 19,
page:{
pageNum:ContractModel.page
}
}
page: {
pageNum: ContractModel.page,
},
};
requst(payload);
},[1]) //页面进来执行一次
}, [1]); //页面进来执行一次
// 跳转
const Jump = (record:any,Jump:String)=>{
console.log(record)
console.log(Jump)
const Jump = (record: any, Jump: String) => {
console.log(record);
console.log(Jump);
dispatch({
type: 'ContractModel/getMove',
payload: {
type:Jump,
record:record,
type: Jump,
record: record,
},
});
// if(record == 0){
// history.push(location.pathname + '/' + Jump)
// }
// console.log(location.pathname + '/' + Jump)
history.push(location.pathname + '/' + Jump)
}
history.push(location.pathname + '/' + Jump);
};
// 表头
const columns = [
{
title: "Contract Number",
render:function(record:any) {
title: 'Contract Number',
render: function (record: any) {
let mom = moment(record.contractValidEndDate).diff(moment(), 'day');
return <span className={mom < 30? styles.red : ''}>{record.contractNumber}</span>
}
}, // 合同编号
if (mom < 30) {
return (
<Tooltip title="Due Soon" placement="right" color={'red'} key={record.id}>
<span className={styles.red}>{record.contractNumber}</span>
</Tooltip>
);
} else {
return <span>{record.contractNumber}</span>;
}
},
}, // 合同编号
{
title: "Company",
render: (text:any, record:any) => (
title: 'Company',
render: (text: any, record: any) => (
<>
<div>
<span>Party A : {record.contractPartyA}</span>
......@@ -71,136 +79,169 @@ const Contract = (props:any) => {
<span>Party B : {record.contractPartyB}</span>
</div>
</>
)
}, //合同方
{title: "Contract Title",dataIndex: 'contractTitle'}, // 合同标题
{title: "Community Name",dataIndex: 'communityName'}, // 小区名
{title: "Contacts",dataIndex: 'communityAccount'}, // 联系人
{title: "Phone",dataIndex: 'communityPhone'}, // 联系电话
{title: "Valid Start Date",dataIndex: 'contractValidStartDate'}, // 生效时间
{title: "Valid End Date",dataIndex: 'contractValidEndDate'},// 到期时间
),
}, //合同方
{ title: 'Contract Title', dataIndex: 'contractTitle' }, // 合同标题
{ title: 'Community Name', dataIndex: 'communityName' }, // 小区名
{ title: 'Contacts', dataIndex: 'communityAccount' }, // 联系人
{ title: 'Phone', dataIndex: 'communityPhone' }, // 联系电话
{ title: 'Valid Start Date', dataIndex: 'contractValidStartDate' }, // 生效时间
{ title: 'Valid End Date', dataIndex: 'contractValidEndDate' }, // 到期时间
// { title: "Contract File", dataIndex: 'contractFileName' }, // 附件
{
title: "Actions",
title: 'Actions',
render: (text: any, record: any) => (
<Space size="middle">
<a onClick={()=>{Jump(record,'Edit')}}>Edit</a>
<a onClick={()=>{Jump(record,'Detail')}}>Detail</a>
<a
onClick={() => {
Jump(record, 'Edit');
}}
>
Edit
</a>
<a
onClick={() => {
Jump(record, 'Detail');
}}
>
Detail
</a>
</Space>
),
},// 操作
}, // 操作
];
// 页面切换
const paginationHandler = (page: number, pageSize?: number)=>{
const paginationHandler = (page: number, pageSize?: number) => {
dispatch({
type: 'ContractModel/getList',
payload: {
index:19,
page:{
pageNum:page,
}
index: 19,
page: {
pageNum: page,
},
},
});
}
};
// 刷新
const resetHandler = () => {
dispatch({
type: 'ContractModel/getList',
payload: {
index:19,
page:{
pageNum:ContractModel.page,
}
index: 19,
page: {
pageNum: ContractModel.page,
},
},
});
};
// 表单标识
const [form] = Form.useForm()
const [form] = Form.useForm();
// 重置
const onReset = () => {
form.resetFields();
let payload = {
index: 19,
page:{
pageNum:1
}
}
page: {
pageNum: 1,
},
};
requst(payload);
};
// 表单提交
const onFinishContract = (value:any)=>{
// 表单提交
const onFinishContract = (value: any) => {
// console.log(value)
if(!value.communityName&&!value.contractNumber&&!value.contractTitle){
message.error('Please enter one of them!')
}else{
console.log(value)
if (!value.communityName && !value.contractNumber && !value.contractTitle) {
message.error('Please enter one of them!');
} else {
console.log(value);
let payload = {
index: 19,
page:{
pageNum:1,
contractNumber:value.contractNumber,
contractTitle:value.contractTitle,
communityName:value.communityName
}
}
page: {
pageNum: 1,
contractNumber: value.contractNumber,
contractTitle: value.contractTitle,
communityName: value.communityName,
},
};
requst(payload);
}
}
};
// 选择小区名字并赋值
const opname = (value:any)=>{
// 选择小区名字并赋值
const opname = (value: any) => {
form.setFieldsValue({
'communityName' : value
})
}
communityName: value,
});
};
return (
<>
<div className={styles.contop}>
<Form
autoComplete= "off"
layout="inline"
form={form}
name="contract"
onFinish={onFinishContract}
autoComplete="off"
layout="inline"
form={form}
name="contract"
onFinish={onFinishContract}
>
<Form.Item name="communityName">
<SearchOptionsCommnity
// ubmit={extendName}
opname={opname}
/>
</Form.Item>
<Form.Item name="contractNumber">
<Input allowClear placeholder="Contract Number" />
</Form.Item>
<Form.Item name="contractTitle">
<Input allowClear placeholder="Contract Title" />
</Form.Item>
<Form.Item>
<Button
type="primary"
htmlType="submit"
icon={<SearchOutlined />}
loading={userListLoading}
>
Search{' '}
</Button>
<Button
htmlType="button"
onClick={onReset}
style={{ marginLeft: '15px' }}
icon={<ClearOutlined />}
loading={userListLoading}
>
<Form.Item name="communityName">
<SearchOptionsCommnity
// ubmit={extendName}
opname={opname} />
</Form.Item>
<Form.Item name="contractNumber">
<Input allowClear placeholder='Contract Number' />
</Form.Item>
<Form.Item name="contractTitle">
<Input allowClear placeholder='Contract Title' />
</Form.Item>
<Form.Item>
<Button type="primary" htmlType="submit" icon={<SearchOutlined />} loading={userListLoading}>Search </Button>
<Button htmlType="button" onClick={onReset} style={{marginLeft:'15px'}} icon={<ClearOutlined />} loading={userListLoading}> Reset</Button>
</Form.Item>
</Form>
{' '}
Reset
</Button>
</Form.Item>
</Form>
</div>
<div className={styles.listbox}>
<ProTable
<ProTable
// request={requestHeadl}
rowKey={"id"}
rowKey={'id'}
dataSource={ContractModel.list}
columns={columns}
pagination={false} // 隐藏默认分页
columns={columns}
pagination={false} // 隐藏默认分页
search={false}
loading={userListLoading}
toolBarRender={() => [
<Button key="3" type="primary" onClick={()=>{Jump(0,'Add')}}>
<PlusOutlined />Add Contract
<Button
key="3"
type="primary"
onClick={() => {
Jump(0, 'Add');
}}
>
<PlusOutlined />
Add Contract
</Button>,
]}
options={{
......@@ -212,36 +253,30 @@ const Contract = (props:any) => {
setting: false,
}}
headerTitle="Contract list"
// pagination={{ defaultCurrent: 1, total: Data.totalRow }}
/>
// pagination={{ defaultCurrent: 1, total: Data.totalRow }}
/>
<div className={styles.pages}>
<Pagination
current={ContractModel.page}
total={ContractModel.totalRow}
onChange={paginationHandler}
// onShowSizeChange={pageSizeHandler}
// current={users.meta.page}
// pageSize={users.meta.per_page}
/>
onChange={paginationHandler}
// onShowSizeChange={pageSizeHandler}
// current={users.meta.page}
// pageSize={users.meta.per_page}
/>
</div>
</div>
</>
);
};
const mapStateToProps = ({
ContractModel,
loading,
}: {
ContractModel: any;
loading: Loading;
}) => {
console.log(loading)
const mapStateToProps = ({ ContractModel, loading }: { ContractModel: any; loading: Loading }) => {
console.log(loading);
return {
ContractModel,
userListLoading: loading.models.ContractModel,
};
};
export default connect(mapStateToProps)(Contract);
\ No newline at end of file
export default connect(mapStateToProps)(Contract);
import React, { useState, useEffect, useRef } from 'react';
import styles from './ContractContent.less';
import { Input, Form, message, Upload, Button, DatePicker, Space } from 'antd';
import { UploadOutlined, LeftOutlined } from '@ant-design/icons';
import { PlusOutlined, LeftOutlined } from '@ant-design/icons';
import { Link, useIntl, connect, Dispatch, Loading } from 'umi';
import { RA } from '@/services/tos';
......@@ -137,7 +137,7 @@ const ContractContent = (props: any) => {
<div className={styles.base}>
{/* 头部组件 */}
<div className={styles.box}>
<div className={styles.item1}>{ContractModel.type} Service Provider</div>
<div className={styles.item1}>{ContractModel.type} Contract</div>
<button className={styles.item3} onClick={goToReturn}>
<LeftOutlined />
Back
......@@ -225,6 +225,7 @@ const ContractContent = (props: any) => {
locale={locale}
defaultValue={ContractModel.time}
disabledDate={disabledDate}
placeholder={['Effective Date', 'Expiration Date']}
// onChange={changeTime}
/>
</Form.Item>
......@@ -237,10 +238,8 @@ const ContractContent = (props: any) => {
label="Contract Annex"
rules={[{ required: true, message: `${tipList[6]}` }]}
>
<Upload {...uploadProps}>
<Button>
<UploadOutlined /> Upload
</Button>
<Upload {...uploadProps} listType={'picture-card'}>
{fileList.length >= 3 ? null : <PlusOutlined />}
</Upload>
</Form.Item>
</div>
......
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