Commit b8ae18d8 authored by cellee's avatar cellee

小区公告,合同模板修复,账号编辑

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent f8fa3286
...@@ -344,7 +344,7 @@ export default defineConfig({ ...@@ -344,7 +344,7 @@ export default defineConfig({
routes: [ routes: [
{ path: './', component: './AccountManagement/account/Account' }, { path: './', component: './AccountManagement/account/Account' },
{ path: './edit', component: './AccountManagement/account/AccountEdit' }, { path: './edit', component: './AccountManagement/account/AccountEdit' },
{ path: './Add', component: './AccountManagement/account/AccountEdit' }, { path: './Add', component: './AccountManagement/account/AccountAdds' },
{ path: './reset', component: './AccountManagement/account/AccountReset' }, { path: './reset', component: './AccountManagement/account/AccountReset' },
], ],
}, },
......
...@@ -4,7 +4,7 @@ import SearchOptions from './SearchOptions'; ...@@ -4,7 +4,7 @@ import SearchOptions from './SearchOptions';
import SearchOptionsTow from './SearchOptionsTow'; import SearchOptionsTow from './SearchOptionsTow';
const SearchOptionsCommnity = (props: any) => { const SearchOptionsCommnity = (props: any) => {
const { dispatch, CommunityList, opname, defaultName, type } = props; const { dispatch, CommunityList, opname, defaultName, type, disabled } = props;
const tosCommunityget = (values: any) => { const tosCommunityget = (values: any) => {
dispatch({ type: 'Init/tosCommunityget', playload: values }); dispatch({ type: 'Init/tosCommunityget', playload: values });
...@@ -32,6 +32,7 @@ const SearchOptionsCommnity = (props: any) => { ...@@ -32,6 +32,7 @@ const SearchOptionsCommnity = (props: any) => {
// onSubmit={extendName} /> // onSubmit={extendName} />
<SearchOptionsTow <SearchOptionsTow
disabled={disabled}
list={CommunityList} list={CommunityList}
extendName={extendName} extendName={extendName}
def={defaultName} def={defaultName}
......
...@@ -3,7 +3,7 @@ import { Select } from 'antd'; ...@@ -3,7 +3,7 @@ import { Select } from 'antd';
const { Option } = Select; const { Option } = Select;
const SearchOptionsTow = (porps: any) => { const SearchOptionsTow = (porps: any) => {
const { list, extendName, def, type } = porps; const { list, extendName, def, type, disabled } = porps;
const options = list.map((d: any, index: number) => ( const options = list.map((d: any, index: number) => (
<Option value={d} key={index}> <Option value={d} key={index}>
...@@ -27,6 +27,7 @@ const SearchOptionsTow = (porps: any) => { ...@@ -27,6 +27,7 @@ const SearchOptionsTow = (porps: any) => {
optionFilterProp="children" optionFilterProp="children"
onChange={onChange} onChange={onChange}
defaultValue={def} defaultValue={def}
disabled={disabled}
> >
{options} {options}
</Select> </Select>
...@@ -39,6 +40,7 @@ const SearchOptionsTow = (porps: any) => { ...@@ -39,6 +40,7 @@ const SearchOptionsTow = (porps: any) => {
optionFilterProp="children" optionFilterProp="children"
onChange={onChange} onChange={onChange}
defaultValue={def} defaultValue={def}
disabled={disabled}
> >
{options} {options}
</Select> </Select>
......
...@@ -34,7 +34,7 @@ export default { ...@@ -34,7 +34,7 @@ export default {
//标准请求 //标准请求
*RA({ playload }, { call, put }) { *RA({ playload }, { call, put }) {
const resp = yield call(service.RA, playload); const resp = yield call(service.RA, playload);
console.log(resp);
if (resp.code == 500 || resp.error_code != '0000') { if (resp.code == 500 || resp.error_code != '0000') {
} }
if (resp.error_code != '0000') { if (resp.error_code != '0000') {
...@@ -47,8 +47,17 @@ export default { ...@@ -47,8 +47,17 @@ export default {
// yield put({ type: 'returnPage', Data }); // yield put({ type: 'returnPage', Data });
} }
break; break;
case 38:
{
console.log(resp);
}
break;
case 42: case 42:
{ {
// 保存成功, 清掉原来数据 并且跳转
message.success('Submitted Successfully !');
let Data = null;
yield put({ type: 'returnPage', Data });
history.go(-1); history.go(-1);
} }
break; break;
...@@ -66,7 +75,7 @@ export default { ...@@ -66,7 +75,7 @@ export default {
break; break;
case 52: // 修改账号状态 case 52: // 修改账号状态
{ {
let Result = resp.data; let Result = resp.error_code;
yield put({ type: 'returnResult', Result }); yield put({ type: 'returnResult', Result });
} }
break; break;
...@@ -74,13 +83,18 @@ export default { ...@@ -74,13 +83,18 @@ export default {
} }
}, },
*ReData({}, { put }) {
var Data = null;
yield put({ type: 'returnPage', Data });
},
*ResultClear({}, { put }) { *ResultClear({}, { put }) {
var tmp = null; var tmp = null;
yield put({ type: 'returnResult', tmp }); yield put({ type: 'returnResult', tmp });
}, },
*SA({ playload }, { call, put }) { *SA({ DataSave }, { call, put }) {
var DataSave = playload; console.log(DataSave);
yield put({ type: 'returnDataSave', DataSave }); yield put({ type: 'returnDataSave', DataSave });
}, },
}, },
......
hr {
border: 0;
height: 1px;
background: #eee;
margin-bottom: 24px;
}
.contop { .contop {
background: #fff; background: #fff;
padding: 20px; padding: 20px;
border-right: 4px; border-right: 4px;
margin-bottom: 15px; margin-bottom: 15px;
h3 { h3 {
margin-bottom: 0; margin-bottom: 15px;
position: relative; position: relative;
.back { .back {
position: absolute; position: absolute;
......
...@@ -23,12 +23,21 @@ const Account = (props: any) => { ...@@ -23,12 +23,21 @@ const Account = (props: any) => {
if (Data == null) { if (Data == null) {
Refresh(); Refresh();
} }
}, [Data]); //页面进来执行一次 }, [Data]); //监听Data执行一次
// 监听改变状态提交结果 // 监听改变状态提交结果
useEffect(() => { useEffect(() => {
if (Result != null) { if (Result != null) {
console.log('改变'); // console.log('改变取消弹窗重新加载,在清空结果');
// let obj = {
// userStatus: accountName.userStatus == 0 ? 1 : 0,
// userID: accountName.tosUserId,
// };
// RA(52, obj);
setOver(false);
// 清除结果
dispatch({ type: 'Account/ResultClear' });
dispatch({ type: 'Account/ReData' });
} }
}, [Result]); }, [Result]);
...@@ -128,10 +137,17 @@ const Account = (props: any) => { ...@@ -128,10 +137,17 @@ const Account = (props: any) => {
// 编辑- 新增 // 编辑- 新增
const edit = (item: any) => { const edit = (item: any) => {
item == 1 ? history.push('./account/Add') : history.push('./account/edit'); // console.log(item);
if (item == 1) {
history.push('./account/Add');
} else {
let DataSave = item;
dispatch({ type: 'Account/SA', DataSave });
history.push('./account/edit');
}
}; };
// 停用账号 // 停用账号弹窗
const lockS = (item: any) => { const lockS = (item: any) => {
setOver(true); setOver(true);
setaccountName(item); setaccountName(item);
...@@ -278,7 +294,6 @@ const Account = (props: any) => { ...@@ -278,7 +294,6 @@ const Account = (props: any) => {
}; };
const AccountProps = (styte: any) => { const AccountProps = (styte: any) => {
console.log(styte);
const { Data, DataSave, DataSaveDetail, Result } = styte.Account; const { Data, DataSave, DataSaveDetail, Result } = styte.Account;
const loading = styte.loading.models.Account || false; const loading = styte.loading.models.Account || false;
return { return {
......
import React, { useState, useEffect, useRef } from 'react';
import {
Form,
Input,
Button,
Pagination,
message,
Descriptions,
Checkbox,
Tree,
Radio,
} from 'antd';
import { connect, history } from 'umi';
import { SearchOutlined, ClearOutlined, EditOutlined, LeftOutlined } from '@ant-design/icons';
import { getCookie } from '@/utils/method';
import './Account.less';
import { zhCnFaci } from '@/utils/power';
import { AccountTip } from '@/utils/tip';
import SelectCommunity from '@/components/SelectCommunity';
import { getNumber } from '@/utils/string'; // 正则
import { RA } from '@/utils/method';
import moment from 'moment';
const Account = (props: any) => {
const module = 'Account';
const { dispatch, Data, DataSave, DataSaveDetail, Result, loading, CommunityList } = props;
// 拉取数据的条件存储
const [term, setTerm] = useState({} as any);
// 小区列表
// const [comList, setCommunityList] = useState(CommunityList as any);
// // 数据
// useEffect(() => {
// if (CommunityList != null) {
// setCommunityList(CommunityList);
// }
// }, [CommunityList]);
// 权限列表
const treeData = zhCnFaci;
const [expandedKeys, setExpandedKeys] = useState<string[]>([]); // 展开栏目
const [checkedKeys, setCheckedKeys] = useState<string[]>([]); // 默认已选栏目
const [selectedKeys, setSelectedKeys] = useState<string[]>([]); // 设置选中的树节点
const [autoExpandParent, setAutoExpandParent] = useState<boolean>(true); // 树形菜单展开关闭
// 单选 二级还是三级管理员
const [values, setvalues] = useState(2); // 树形菜单展开关闭
// 表单标识
const [form] = Form.useForm();
const formRef = useRef(null);
// 保存提交
const onFinishContract = async (value: any) => {
// console.log(value);
if (checkedKeys.length == 0) {
// 权限
message.error('Please Select Permission!');
return false;
} else if (value.community.value == null || value.community.value.length == 0) {
// 小区
message.error('Please Select The Jurisdiction Area!');
return false;
} else if (value.tosUserName.length < 6) {
// 账号长度
message.error('The Account Password is Greater Than 6 Digits!');
return false;
} else {
value.tosUserServiceCellList = value.community.value; // 管辖小区
value.tosUserEmail = value.tosUserName; // 邮箱就是账号
value.tosUserLevel = values; //级别
value.creatorName = getCookie('name'); //新建者账号
value.creatorId = getCookie('id'); //新建者ID
delete value.community;
// console.log(value);
// 另传权限
let obj = {
userName: value.tosUserName,
userPassword: value.tosUserPwd,
permissionArray: checkedKeys.sort((n1, n2) => {
return parseInt(n1) - parseInt(n2);
}),
};
// console.log(obj);
RA(38, value, module, dispatch); // 信息上传
RA(42, obj, module, dispatch); // 权限上传
}
};
//goToReturn
const goToReturn = () => {
history.go(-1);
};
// 全选
const onCheckAllChange = (e: any) => {};
// 展开/收起树形菜单触发
const onExpand = (expandedKeys: any) => {
setExpandedKeys(expandedKeys);
setAutoExpandParent(false);
};
// 点击单个触发
const onCheck = (checkedKeys: any) => {
console.log('onCheck', checkedKeys);
setCheckedKeys(checkedKeys);
};
// 点击树节点触发 - 大栏目
const onSelect = (selectedKeys: any, info: any) => {
console.log('onSelect', info);
setSelectedKeys(selectedKeys);
};
// 管理员级别样式
const radioStyle = {
display: 'block',
height: '30px',
lineHeight: '30px',
marginBottom: '15px',
};
//级别切换
const onRadio = (e: any) => {
setvalues(e.target.value);
};
//手机号
const keyup_communityManagerFee = (e: any) => {
e.target.value = keyup_tool(e.target.value);
};
const keyup_tool = (value: any) => {
return getNumber(value.replace(/[^\d^\.]+/g, ''));
};
// 选择小区名字并赋值
return (
<>
<div className="contop" style={{ padding: '12px 20px' }}>
<h3 className="capi">
<EditOutlined />
&nbsp; Add Account
<div className="back">
<Button onClick={goToReturn}>
<LeftOutlined />
Back
</Button>
</div>
</h3>
<hr></hr>
<Form
ref={formRef}
form={form}
autoComplete="off"
// layout="inline"
layout="horizontal"
name="contract"
onFinish={onFinishContract}
>
<Descriptions column={{ xs: 1, sm: 2, md: 3 }}>
<Descriptions.Item>
<Form.Item name="tosUserName" label="Account ID" rules={AccountTip[0]}>
<Input placeholder="Login Account" className="input" />
</Form.Item>
</Descriptions.Item>
</Descriptions>
<Descriptions column={{ xs: 1, sm: 2, md: 3 }}>
<Descriptions.Item>
<Form.Item name="tosAccountName" label="Name" rules={AccountTip[1]}>
<Input placeholder="Name Of Administrator" className="input" />
</Form.Item>
</Descriptions.Item>
<Descriptions.Item>
<Form.Item name="tosUserPhone" label="Phone" rules={AccountTip[2]}>
<Input
placeholder="Contact Information"
className="input"
maxLength={11}
onKeyUp={keyup_communityManagerFee}
/>
</Form.Item>
</Descriptions.Item>
</Descriptions>
<Form.Item name="community" label="Community">
<SelectCommunity />
</Form.Item>
<div className="diy" style={{ marginBottom: '14px' }}>
<div className="label">
<span className="title">Privilege Level:</span>
</div>
<div className="label">
<Radio.Group defaultValue={values} onChange={onRadio}>
<Radio style={radioStyle} value={2}>
Two Level Administrator
</Radio>
<Radio style={radioStyle} value={3}>
Three Level Administrator
{/* <Input placeholder="三级管理员" style={{ width: 160, marginLeft: 10 }} /> */}
</Radio>
</Radio.Group>
</div>
</div>
<div className="diy" style={{ marginBottom: '24px' }}>
<div className="label">
<span className="title">Permission List:</span>
</div>
<div className="label">
<Tree
checkable
onExpand={onExpand}
expandedKeys={expandedKeys}
autoExpandParent={autoExpandParent}
onCheck={onCheck}
checkedKeys={checkedKeys}
onSelect={onSelect}
selectedKeys={selectedKeys}
treeData={treeData}
/>
</div>
</div>
<div className="diy">
<div className="label"></div>
<div className="label">
<Button type="primary" htmlType="submit" loading={loading}>
Submit
</Button>
</div>
</div>
</Form>
</div>
</>
);
};
const AccountProps = (state: any) => {
console.log(state);
const { Data, DataSave, DataSaveDetail, Result } = state.Account;
const { CommunityList } = state.Init; // 小区列表
const loading = state.loading.models.Account || false;
return {
Data,
DataSave,
DataSaveDetail,
Result,
loading,
CommunityList,
};
};
export default connect(AccountProps)(Account);
...@@ -29,40 +29,53 @@ const Account = (props: any) => { ...@@ -29,40 +29,53 @@ const Account = (props: any) => {
const { dispatch, Data, DataSave, DataSaveDetail, Result, loading, CommunityList } = props; const { dispatch, Data, DataSave, DataSaveDetail, Result, loading, CommunityList } = props;
// 拉取数据的条件存储
const [term, setTerm] = useState({} as any);
// 小区列表
// const [comList, setCommunityList] = useState(CommunityList as any);
// // 数据
// useEffect(() => {
// if (CommunityList != null) {
// setCommunityList(CommunityList);
// }
// }, [CommunityList]);
// 权限列表 // 权限列表
const treeData = zhCnFaci; const treeData = zhCnFaci;
const [expandedKeys, setExpandedKeys] = useState<string[]>(['0']); // 展开栏目 const [expandedKeys, setExpandedKeys] = useState<string[]>([]); // 展开栏目
const [checkedKeys, setCheckedKeys] = useState<string[]>(['3']); // 默认已选栏目 const [checkedKeys, setCheckedKeys] = useState<string[]>([]); // 默认已选栏目
const [selectedKeys, setSelectedKeys] = useState<string[]>([]); // 设置选中的树节点 const [selectedKeys, setSelectedKeys] = useState<string[]>([]); // 设置选中的树节点
const [autoExpandParent, setAutoExpandParent] = useState<boolean>(true); // 树形菜单展开关闭 const [autoExpandParent, setAutoExpandParent] = useState<boolean>(true); // 树形菜单展开关闭
// 单选 二级还是三级管理员 // 单选 二级还是三级管理员
const [values, setvalues] = useState(2); // 树形菜单展开关闭 const [values, setvalues] = useState(2); // 树形菜单展开关闭
// 已选小区
const [ServiceCell, setServiceCell] = useState(null as any);
// 表单标识 // 表单标识
const [form] = Form.useForm(); const [form] = Form.useForm();
const formRef = useRef(null); const formRef = useRef(null);
// 拉取数据的条件存储
// const [term, setTerm] = useState({} as any);
// 小区列表
// const [comList, setCommunityList] = useState(CommunityList as any);
// // 数据
useEffect(() => {
if (DataSave != null) {
console.log(DataSave);
// 赋值
form.setFieldsValue({
tosUserName: DataSave.tosUserName,
tosUserPhone: DataSave.tosUserPhone,
tosAccountName: DataSave.tosAccountName,
});
setvalues(DataSave.tosUserLevel); // 等级
setServiceCell(DataSave.tosUserServiceCell.split(',')); // 已选小区
}
}, [DataSave]);
// 保存提交 // 保存提交
const onFinishContract = (value: any) => { const onFinishContract = async (value: any) => {
console.log(value); // console.log(value);
if (checkedKeys.length == 0) { if (checkedKeys.length == 0) {
// 权限 // 权限
message.error('Please Select Permission!'); message.error('Please Select Permission!');
return false; return false;
} else if (value.community.value.length == 0) { } else if (value.community.value == null || value.community.value.length == 0) {
// 小区 // 小区
message.error('Please Select The Jurisdiction Area!'); message.error('Please Select The Jurisdiction Area!');
return false; return false;
...@@ -77,7 +90,7 @@ const Account = (props: any) => { ...@@ -77,7 +90,7 @@ const Account = (props: any) => {
value.creatorName = getCookie('name'); //新建者账号 value.creatorName = getCookie('name'); //新建者账号
value.creatorId = getCookie('id'); //新建者ID value.creatorId = getCookie('id'); //新建者ID
delete value.community; delete value.community;
console.log(value); // console.log(value);
// 另传权限 // 另传权限
let obj = { let obj = {
...@@ -87,12 +100,13 @@ const Account = (props: any) => { ...@@ -87,12 +100,13 @@ const Account = (props: any) => {
return parseInt(n1) - parseInt(n2); return parseInt(n1) - parseInt(n2);
}), }),
}; };
console.log(obj); // console.log(obj);
RA(38, value, module, dispatch); // 信息上传 RA(38, value, module, dispatch); // 信息上传
RA(42, obj, module, dispatch); // 权限上传 RA(42, obj, module, dispatch); // 权限上传
} }
}; };
//goToReturn //goToReturn
const goToReturn = () => { const goToReturn = () => {
history.go(-1); history.go(-1);
...@@ -146,7 +160,7 @@ const Account = (props: any) => { ...@@ -146,7 +160,7 @@ const Account = (props: any) => {
<div className="contop" style={{ padding: '12px 20px' }}> <div className="contop" style={{ padding: '12px 20px' }}>
<h3 className="capi"> <h3 className="capi">
<EditOutlined /> <EditOutlined />
&nbsp; {DataSave ? 'Edit' : 'Add'} Account &nbsp; Edit Account
<div className="back"> <div className="back">
<Button onClick={goToReturn}> <Button onClick={goToReturn}>
<LeftOutlined /> <LeftOutlined />
...@@ -154,8 +168,8 @@ const Account = (props: any) => { ...@@ -154,8 +168,8 @@ const Account = (props: any) => {
</Button> </Button>
</div> </div>
</h3> </h3>
</div> <hr></hr>
<div className="contop">
<Form <Form
ref={formRef} ref={formRef}
form={form} form={form}
...@@ -167,7 +181,7 @@ const Account = (props: any) => { ...@@ -167,7 +181,7 @@ const Account = (props: any) => {
> >
<Descriptions column={{ xs: 1, sm: 2, md: 3 }}> <Descriptions column={{ xs: 1, sm: 2, md: 3 }}>
<Descriptions.Item> <Descriptions.Item>
<Form.Item name="tosUserName" label="Account ID" rules={AccountTip[2]}> <Form.Item name="tosUserName" label="Account ID" rules={AccountTip[0]}>
<Input placeholder="Login Account" className="input" /> <Input placeholder="Login Account" className="input" />
</Form.Item> </Form.Item>
</Descriptions.Item> </Descriptions.Item>
...@@ -175,12 +189,12 @@ const Account = (props: any) => { ...@@ -175,12 +189,12 @@ const Account = (props: any) => {
<Descriptions column={{ xs: 1, sm: 2, md: 3 }}> <Descriptions column={{ xs: 1, sm: 2, md: 3 }}>
<Descriptions.Item> <Descriptions.Item>
<Form.Item name="tosAccountName" label="Name" rules={AccountTip[0]}> <Form.Item name="tosAccountName" label="Name" rules={AccountTip[1]}>
<Input placeholder="Name Of Administrator" className="input" /> <Input placeholder="Name Of Administrator" className="input" />
</Form.Item> </Form.Item>
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item> <Descriptions.Item>
<Form.Item name="tosUserPhone" label="Phone" rules={AccountTip[1]}> <Form.Item name="tosUserPhone" label="Phone" rules={AccountTip[2]}>
<Input <Input
placeholder="Contact Information" placeholder="Contact Information"
className="input" className="input"
...@@ -246,7 +260,6 @@ const Account = (props: any) => { ...@@ -246,7 +260,6 @@ const Account = (props: any) => {
}; };
const AccountProps = (state: any) => { const AccountProps = (state: any) => {
console.log(state);
const { Data, DataSave, DataSaveDetail, Result } = state.Account; const { Data, DataSave, DataSaveDetail, Result } = state.Account;
const { CommunityList } = state.Init; // 小区列表 const { CommunityList } = state.Init; // 小区列表
const loading = state.loading.models.Account || false; const loading = state.loading.models.Account || false;
......
...@@ -26,8 +26,10 @@ const Add = (props: any) => { ...@@ -26,8 +26,10 @@ const Add = (props: any) => {
const formRef = useRef(null); const formRef = useRef(null);
const [form] = Form.useForm(); const [form] = Form.useForm();
// 图片地址 const [ImageSrc, setImageSrc] = useState([] as any); // 图片显示地址
const [ImageSrc, setImageSrc] = useState([] as any); const [ImageName, setImageName] = useState([] as any); // 全部图片名称
const [timeT, settimeT] = useState(true); // 结束时间是否禁止选择
const [timeOver, settimeOver] = useState(1); // 结束时间禁止天数
// 监听传递过来的值 // 监听传递过来的值
useEffect(() => { useEffect(() => {
...@@ -48,21 +50,29 @@ const Add = (props: any) => { ...@@ -48,21 +50,29 @@ const Add = (props: any) => {
fileName: DataSave.noticImageName, fileName: DataSave.noticImageName,
}; };
RA(47, msg, module, dispatch); RA(47, msg, module, dispatch);
// 解除结束时间不可选
settimeT(false);
// 图片名
setImageName(DataSave.noticImageName.split(','));
} }
}, [DataSave]); }, [DataSave]);
// 监听图片状态 ImgSrc // 监听图片状态 ImgSrc
useEffect(() => { useEffect(() => {
if (ImgSrc != null) { if (ImgSrc != null) {
let imgUrl = [ let a = ImgSrc.map((item: any, index: number) => {
{ let key = Object.keys(item)[0];
uid: '-1', return {
name: 'image.png', uid: index,
name: key,
status: 'done', status: 'done',
url: ImgSrc, url: item[key],
}, };
]; });
setImageSrc(imgUrl);
// 图片列表
setImageSrc(a);
} }
}, [ImgSrc]); }, [ImgSrc]);
...@@ -98,7 +108,6 @@ const Add = (props: any) => { ...@@ -98,7 +108,6 @@ const Add = (props: any) => {
// 提交 // 提交
const onFinish = (values: any) => { const onFinish = (values: any) => {
// console.log(values);
var tmp = values; var tmp = values;
if (DataSave != null) { if (DataSave != null) {
tmp.id = DataSave.id; // 如果是修改传递的 修改ID tmp.id = DataSave.id; // 如果是修改传递的 修改ID
...@@ -107,11 +116,11 @@ const Add = (props: any) => { ...@@ -107,11 +116,11 @@ const Add = (props: any) => {
tmp.communityNum = values.community.value; tmp.communityNum = values.community.value;
tmp.noticScope = '' + values.community.index; tmp.noticScope = '' + values.community.index;
delete tmp.community; delete tmp.community;
// 文件名 // 文件名 如果动了。 新增删除 就传新的, 否则传旧的
tmp.noticImageName = values.file ? values.file[0] : null; tmp.noticImageName = values.file ? values.file : ImageName.join(','); // 传递来的 和 表单的在一起
tmp.noticStartTime = values.noticStartTime.format('YYYY-MM-DD'); tmp.noticStartTime = values.noticStartTime.format('YYYY-MM-DD');
tmp.noticEndTime = values.noticEndTime ? values.noticEndTime.format('YYYY-MM-DD') : null; tmp.noticEndTime = values.noticEndTime ? values.noticEndTime.format('YYYY-MM-DD') : null;
// console.log(tmp);
RA(28, tmp, module, dispatch); RA(28, tmp, module, dispatch);
}; };
...@@ -120,6 +129,22 @@ const Add = (props: any) => { ...@@ -120,6 +129,22 @@ const Add = (props: any) => {
return current && current <= moment().subtract(1, 'days').endOf('day'); return current && current <= moment().subtract(1, 'days').endOf('day');
} }
function disabledDateOver(current: any) {
return current && current <= moment().subtract(timeOver, 'days').endOf('day');
}
// 开始时间选择后打开结束时间
const startTime = (date: any) => {
settimeT(false);
// 清除结束时间
form.setFieldsValue({
noticEndTime: null,
});
// 结束时间
let day = moment().diff(date, 'days') + 1;
settimeOver(day);
};
return ( return (
<> <>
<Spin spinning={loading}> <Spin spinning={loading}>
...@@ -177,10 +202,16 @@ const Add = (props: any) => { ...@@ -177,10 +202,16 @@ const Add = (props: any) => {
style={{ width: 200 }} style={{ width: 200 }}
placeholder="Effective Dates" placeholder="Effective Dates"
disabledDate={disabledDate} disabledDate={disabledDate}
onChange={startTime}
/> />
</Form.Item> </Form.Item>
<Form.Item name="noticEndTime" className="diyItem" label="Expiration Date" rules={[]}> <Form.Item name="noticEndTime" className="diyItem" label="Expiration Date" rules={[]}>
<DatePicker style={{ width: 200 }} placeholder="Expiration Dates" /> <DatePicker
style={{ width: 200 }}
placeholder="Expiration Dates"
disabledDate={disabledDateOver}
disabled={timeT}
/>
</Form.Item> </Form.Item>
<hr /> <hr />
<Form.Item style={{ marginBottom: 5 }} className="diyItem" label=" " colon={false}> <Form.Item style={{ marginBottom: 5 }} className="diyItem" label=" " colon={false}>
......
...@@ -165,7 +165,7 @@ const CommunityAnnouncement = (props: any) => { ...@@ -165,7 +165,7 @@ const CommunityAnnouncement = (props: any) => {
} else { } else {
// 要看是哪里分页 // 要看是哪里分页
let mlist = { ...value }; let mlist = { ...value };
mlist.communityNumList = value.communityNumList; mlist.communityNumList = value.communityNumList.length > 0 ? value.communityNumList : null;
mlist.pageNum = 1; mlist.pageNum = 1;
// 把内容存进去 // 把内容存进去
SA(DetailPage(mlist), module, dispatch); SA(DetailPage(mlist), module, dispatch);
......
...@@ -53,7 +53,7 @@ const Contract = (props: any) => { ...@@ -53,7 +53,7 @@ const Contract = (props: any) => {
title: 'Contract Number', title: 'Contract Number',
render: function (record: any) { render: function (record: any) {
let mom = moment(record.contractValidEndDate).diff(moment(), 'months'); let mom = moment(record.contractValidEndDate).diff(moment(), 'months');
console.log(mom); // console.log(mom);
if (mom < 2) { if (mom < 2) {
return ( return (
<Tooltip title="Due Soon" placement="right" color={'red'} key={record.id}> <Tooltip title="Due Soon" placement="right" color={'red'} key={record.id}>
......
import React, { useEffect, useState } from 'react';
import { connect, history } from 'umi';
import { Spin, Descriptions } from 'antd';
import { LeftOutlined } from '@ant-design/icons';
import moment from 'moment';
import './ContractContent.less';
import PreView from '@/components/PreView/PreViewTow';
const ContractDetail = (props: any) => {
const { Contract, dispatch, FileImg, loading } = props;
const { DataSaveDetail } = Contract;
const RA = (index: any, values: any) => {
dispatch({ type: 'Contract/RA', playload: { index: index, body: values } });
};
const goToReturn = () => {
history.go(-1);
};
const [fileList, setFileList] = useState([] as any); // 图片列表
const [tipTime, setTipTime] = useState(['previous month', 'two months'] as any); //提示时间
// 带来信息
useEffect(() => {
if (DataSaveDetail == null) {
history.push('/ContractManagement');
} else {
// 请求
let objData = {
type: 'tosContractPreview',
fileName: DataSaveDetail.contractFileName,
extends: DataSaveDetail.communityName,
};
RA(47, objData);
// 设置提示时间
let a1 = moment(DataSaveDetail.contractValidEndDate)
.subtract(2, 'month')
.format('YYYY-MM-DD');
let a2 = moment(DataSaveDetail.contractValidEndDate)
.subtract(1, 'month')
.format('YYYY-MM-DD');
setTipTime([a1, a2]);
}
}, [DataSaveDetail]);
// 监听图片列表
useEffect(() => {
if (FileImg != null) {
let obj = new Array();
for (var i in FileImg) {
let a = {
uid: i,
name: FileImg[i].fileName,
status: 'done',
type: FileImg[i].fileName.match(/\.([^\.]+)$/)[1].toLowerCase(),
url: FileImg[i].fileUrl,
};
obj.push(a);
}
setFileList([...obj]);
} else {
setFileList([]);
}
}, [FileImg]);
return (
<Spin spinning={loading}>
{DataSaveDetail ? (
<div className="base">
{/* 头部组件 */}
<div className="box">
<div className="item1">Detail Contract</div>
<button className="item3" onClick={goToReturn}>
<LeftOutlined />
Back
</button>
</div>
<div className="">
<Descriptions title="" bordered layout="vertical">
<Descriptions.Item label="Contract Number :">
{DataSaveDetail.contractNumber}
</Descriptions.Item>
<Descriptions.Item label="Party A :">
{DataSaveDetail.contractPartyA}
</Descriptions.Item>
<Descriptions.Item label="Party B :">
{DataSaveDetail.contractPartyB}
</Descriptions.Item>
<Descriptions.Item label="Contract Title :" span={2}>
{DataSaveDetail.contractTitle}
</Descriptions.Item>
<Descriptions.Item label="Community Name :">
{DataSaveDetail.communityName}
</Descriptions.Item>
<Descriptions.Item label="Date :">
<p>
{DataSaveDetail.contractValidStartDate} ~ {DataSaveDetail.contractValidEndDate}
</p>
<p style={{ marginBottom: 0, color: '#999' }}>
The system will send e-mail notification in the{' '}
<span style={{ color: 'red' }}>{tipTime[0]}</span> and{' '}
<span style={{ color: 'red' }}>{tipTime[1]}</span> that the contract is about to
expire !
</p>
{/* <p style={{ marginBottom: 0 }}>
<span style={{ color: 'red' }}>*</span> If the time has passed, it will not be
sent
</p> */}
</Descriptions.Item>
<Descriptions.Item label="Contacts :">
{DataSaveDetail.communityAccount}
</Descriptions.Item>
<Descriptions.Item label="Phone :">{DataSaveDetail.communityPhone}</Descriptions.Item>
<Descriptions.Item label="Contract Annex :" span={3}>
{fileList.map((item: any, index: number) => {
return <PreView OpenUrl={item} key={index}></PreView>;
})}
</Descriptions.Item>
<Descriptions.Item label="Contract Remarks :">
{DataSaveDetail.contractRemindContent}
</Descriptions.Item>
</Descriptions>
</div>
</div>
) : (
''
)}
</Spin>
);
};
function mapStateToProps(state: any) {
const { Contract } = state;
const { FileImg } = Contract;
const loading = state.loading.models.Contract || false;
return {
Contract,
FileImg,
loading,
};
}
export default connect(mapStateToProps)(ContractDetail);
...@@ -53,9 +53,9 @@ export const BookingsTip = [ ...@@ -53,9 +53,9 @@ export const BookingsTip = [
// 账号新增编辑 // 账号新增编辑
export const AccountTip = [ export const AccountTip = [
[{ required: true, type: 'email', message: 'Please enter email address !' }],
[{ required: true, message: 'Required' }], [{ required: true, message: 'Required' }],
[{ required: true, message: 'Required' }], [{ required: true, message: 'Please enter the correct contact information !' }],
[{ required: true, message: 'Required' }],
[{ required: true, message: 'Required' }], [{ required: true, message: 'Required' }],
[{ required: true, message: 'Required' }], [{ required: true, message: 'Required' }],
[{ required: true, message: 'Required' }], [{ required: true, message: 'Required' }],
......
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