Commit fe7ae761 authored by cellee's avatar cellee

合同完整bug修复

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent 13c3a04e
......@@ -243,7 +243,7 @@ export default defineConfig({
icon: 'SwitcherOutlined',
routes: [
{ path: './', component: './ContractManagement/Contract' },
{ path: './Detail', component: './ContractManagement/ContractContent' },
{ path: './Detail', component: './ContractManagement/ContractDetail' },
{ path: './Edit', component: './ContractManagement/ContractContent' },
{ path: './Add', component: './ContractManagement/ContractContent' },
],
......
import React, { useState, useEffect } from 'react';
import { connect } from 'umi';
import { Avatar, Modal, Button, Spin, Image, Pagination } from 'antd';
import {} from '@ant-design/icons';
import { RA } from '@/utils/method';
// icon
import IconPdf from '@/assets/icon-pdf.png';
import IconImg from '@/assets/icon-img.png';
import IconNone from '@/assets/logo_icon_bg.png';
import PDF from 'react-pdf-js';
import FileViewer from 'react-file-viewer';
import { stringSplit } from '@/utils/string';
const PreView = (props: any) => {
const { OpenUrl, loading } = props;
const [Icon, setIcon] = useState(null as any); // 图标显示哪一个控制
const [ModalTip, setModalTip] = useState(false); // 弹窗控制
//pdf 页码内容
const [numPages, setNumPages] = useState(1 as any); // 总页码数
const [pageNumber, setPageNumber] = useState(1); // 当前页码数
// 图标显示判断
useEffect(() => {
console.log(OpenUrl);
if (OpenUrl) {
OpenUrl.type == 'pdf' ? setIcon(IconPdf) : setIcon(IconImg);
} else {
setIcon(IconNone);
}
}, [OpenUrl]);
//点击预览
const opens = () => {
setModalTip(true);
};
// 隐藏弹窗
const handleCancel = () => {
setModalTip(false);
};
// pdf 总页数
const onDocumentLoadSuccess = (pages: any) => {
setNumPages(pages);
};
// 切换pdf 总数
const onChangePage = (page: any) => {
setPageNumber(page);
};
return (
<>
{OpenUrl ? (
<div style={{ marginBottom: 10 }}>
{/* 文件 Icon */}
<Avatar
shape="square"
style={{
color: '#f56a00',
backgroundColor: '#F2F6FC',
border: '1px solid #F2F6FC',
borderRadius: 4,
}}
size={80}
src={Icon}
/>
{/* 文件名 */}
<span style={{ display: 'inline-block', margin: '0 15px', minWidth: 200 }}>
{OpenUrl.name}
</span>
{/* 文件操作 */}
<Button type="link" onClick={opens}>
Browse
</Button>
{/* 文件弹窗 */}
<Modal
visible={ModalTip}
width={650}
style={{ textAlign: 'center' }}
footer={null}
title={OpenUrl.name}
onCancel={handleCancel}
>
<Spin spinning={loading}>
{OpenUrl != null && OpenUrl.type == 'pdf' ? (
<>
<PDF
file={OpenUrl ? stringSplit(OpenUrl.url, 'm/cash') : ''}
page={pageNumber}
onDocumentComplete={onDocumentLoadSuccess}
/>
<Pagination
style={{ textAlign: 'center', marginTop: 10, display: 'block' }}
simple
defaultCurrent={pageNumber}
total={numPages * 10}
onChange={onChangePage}
/>
</>
) : OpenUrl.type == 'jpg' || OpenUrl.type == 'png' ? (
// 图片用指定格式
<Image
src={OpenUrl.url}
preview={false}
style={{ margin: '0 auto', textAlign: 'center' }}
/>
) : (
<FileViewer fileType={OpenUrl.type} filePath={stringSplit(OpenUrl.url, 'm/cash')} />
)}
</Spin>
</Modal>
</div>
) : (
''
)}
</>
);
};
function PreViewPorps(state: any) {
const { CellList } = state;
const loading = false;
return {
CellList,
loading,
};
}
export default connect(PreViewPorps)(PreView);
......@@ -58,12 +58,18 @@ export default {
yield put({ type: 'returnPage', Data });
}
break;
case 51:
case 51: // 获取后台所有账号
{
let Data = resp.data;
yield put({ type: 'returnPage', Data });
}
break;
case 52: // 修改账号状态
{
let Result = resp.data;
yield put({ type: 'returnResult', Result });
}
break;
}
}
},
......
......@@ -7,7 +7,7 @@ import { routerRedux } from 'dva/router';
export default {
namespace: 'Contract',
state: {
Data: { data: [], total: 0 },
Data: null,
curString: {},
Result: null,
DataSave: null,
......@@ -45,7 +45,6 @@ export default {
*RA({ playload }, { call, put }) {
console.log('开始请求');
const resp = yield call(service.RA, playload);
console.log(resp);
if (resp.error_code != '0000') {
console.log('请求错误码:' + '(' + playload.index + ')' + resp.error_code);
console.log(playload);
......@@ -66,11 +65,15 @@ export default {
case 27:
{
message.success('Save Success !');
var tmp = resp;
let tmp = resp;
let Data = null;
yield put({ type: 'returnResult', tmp });
// 保存成功 清空列表 以便列表拿取最新数据
yield put({ type: 'returnPage', Data });
setTimeout(function () {
history.goBack();
}, 1000);
}, 500);
}
break;
case 47:
......@@ -83,13 +86,6 @@ export default {
}
},
// url 带参数
// *RA2({ playload }, { call, put }){
// console.log("开始请求")
// const resp = yield call(service.RA2, playload);
// console.log(resp)
// },
*ResultClear({}, { put }) {
var tmp = null;
yield put({ type: 'returnResult', tmp });
......@@ -104,6 +100,12 @@ export default {
yield put({ type: 'returnPath', playload });
},
// 详情
*DataSaveDetail({ playload }, { put }) {
let DataSaveDetail = playload.record;
yield put({ type: 'returnDataSaveDetail', DataSaveDetail });
},
// 清掉图片列表
*FileImgs({ playload }, { put }) {
let FileImg = null;
......
......@@ -6,47 +6,46 @@ const ContractModel = {
namespace: 'ContractModel',
// 数据
state: {
list:[],
page:1,
totalRow:0,
type:'Add',
record:-1,
loding:true,
list: [],
page: 1,
totalRow: 0,
type: 'Add',
record: -1,
loding: true,
},
// 同步
reducers: {
reGetList(state:any,{ payload }:{payload:any}) {
return Object.assign({}, state, payload)
reGetList(state: any, { payload }: { payload: any }) {
return Object.assign({}, state, payload);
// return {...payload}
}
},
},
// 异步
effects: {
// 拉取列表
*getList({payload}:{payload:any}, { put, call}:{ put:any, call:any}) {
const data = yield call(getRemoveList,payload);
if(data){
*getList({ payload }: { payload: any }, { put, call }: { put: any; call: any }) {
const data = yield call(getRemoveList, payload);
if (data) {
yield put({
type: 'reGetList',
payload:{
list:data.list,
page:payload.page.pageNum,
totalRow:data.page.totalRow,
loding:false
payload: {
list: data.list,
page: payload.page.pageNum,
totalRow: data.page.totalRow,
loding: false,
},
})
}else{
message.error('列表获取失败')
});
} else {
message.error('列表获取失败');
}
},
*getMove({payload}:{payload:any},{ put, call}:{ put:any, call:any}){
*getMove({ payload }: { payload: any }, { put, call }: { put: any; call: any }) {
yield put({
type: 'reGetList',
payload:payload,
})
}
payload: payload,
});
},
},
};
export default ContractModel;
......@@ -14,25 +14,37 @@ const Account = (props: any) => {
const RA = (index: any, values: any) => {
dispatch({ type: 'Account/RA', playload: { index: index, body: values } });
};
const [term, setTerm] = useState({} as any); // 拉取数据的条件存储
const [over, setOver] = useState(false); // 关闭账号确认弹窗
const [accountName, setaccountName] = useState(null as any); // 弹窗账号信息
// 数据
useEffect(() => {
if (Data == null) {
Refresh();
}
}, [Data]); //页面进来执行一次
// 监听改变状态提交结果
useEffect(() => {
if (Result != null) {
console.log('改变');
}
}, [Result]);
const [form] = Form.useForm(); // 表单标识
// 刷新加载
const Refresh = () => {
let obj = {
leaderID: getCookie('id'),
pageNum: 1,
};
// RA(45, obj);
form.resetFields();
setTerm(obj);
RA(51, obj);
}
}, [Data]); //页面进来执行一次
const [term, setTerm] = useState({} as any); // 拉取数据的条件存储
const [over, setOver] = useState(false); // 关闭账号确认弹窗
const [accountName, setaccountName] = useState(null as any); // 弹窗账号信息
const [form] = Form.useForm(); // 表单标识
};
// 表头
const columns = [
......@@ -128,7 +140,7 @@ const Account = (props: any) => {
// 表头单搜索
const onFinishContract = (value: any) => {
if (value.creatorName || value.accountName) {
if (value.tosUserName || value.creatorName) {
let t = { ...term, ...value };
delete t.pageNum; // 搜索的时候 删除页码
setTerm(t);
......@@ -148,10 +160,17 @@ const Account = (props: any) => {
RA(51, t);
};
// 弹窗
// 弹窗 提交确认账号打开关闭
const handleOk = (e: any) => {
setOver(false);
//
let obj = {
userStatus: accountName.userStatus == 0 ? 1 : 0,
userID: accountName.tosUserId,
};
RA(52, obj);
// setOver(false);
};
// 关闭弹窗
const handleCancel = (e: any) => {
setOver(false);
};
......@@ -166,7 +185,7 @@ const Account = (props: any) => {
name="contract"
onFinish={onFinishContract}
>
<Form.Item name="accountName">
<Form.Item name="tosUserName">
<Input allowClear placeholder="Account Name" />
</Form.Item>
<Form.Item name="creatorName">
......@@ -178,7 +197,7 @@ const Account = (props: any) => {
</Button>
<Button
htmlType="button"
// onClick={onReset}
onClick={Refresh}
style={{ marginLeft: '15px' }}
icon={<ClearOutlined />}
loading={loading}
......@@ -205,7 +224,6 @@ const Account = (props: any) => {
loading={loading}
icon={<PlusOutlined />}
onClick={() => {
// Jump(0, 'Add');
edit(1);
}}
>
......@@ -216,7 +234,7 @@ const Account = (props: any) => {
density: false,
fullScreen: false,
reload: () => {
edit;
Refresh();
},
setting: false,
}}
......@@ -243,6 +261,7 @@ const Account = (props: any) => {
cancelText={'Cancel'}
onOk={handleOk}
onCancel={handleCancel}
confirmLoading={loading}
>
{accountName != null ? (
<p>
......
......@@ -57,13 +57,17 @@ const Account = (props: any) => {
// 保存提交
const onFinishContract = (value: any) => {
console.log(value);
if (checkedKeys.length == 0) {
// 权限
message.error('Please Select Permission!');
return false;
} else if (value.community.value == 0) {
} else if (value.community.value.length == 0) {
// 小区
message.error('Please Select The Jurisdiction Area!');
return false;
} else if (value.tosUserName.length < 6 || value.tosUserPwd.length < 6) {
} else if (value.tosUserName.length < 6) {
// 账号长度
message.error('The Account Password is Greater Than 6 Digits!');
return false;
} else {
......@@ -85,12 +89,14 @@ const Account = (props: any) => {
};
console.log(obj);
// RA(38, value, module, dispatch); // 信息上传
// RA(42, obj, module, dispatch); // 权限上传
RA(38, value, module, dispatch); // 信息上传
RA(42, obj, module, dispatch); // 权限上传
}
};
//goToReturn
const goToReturn = () => {};
const goToReturn = () => {
history.go(-1);
};
// 全选
const onCheckAllChange = (e: any) => {};
......@@ -159,6 +165,14 @@ const Account = (props: any) => {
name="contract"
onFinish={onFinishContract}
>
<Descriptions column={{ xs: 1, sm: 2, md: 3 }}>
<Descriptions.Item>
<Form.Item name="tosUserName" label="Account ID" rules={AccountTip[2]}>
<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[0]}>
......@@ -175,24 +189,6 @@ const Account = (props: any) => {
/>
</Form.Item>
</Descriptions.Item>
<Descriptions.Item>
<Form.Item name="tosUserToCompany" label="Company">
<Input placeholder="Affiliated Company" className="input" />
</Form.Item>
</Descriptions.Item>
</Descriptions>
<Descriptions column={{ xs: 1, sm: 2, md: 3 }}>
<Descriptions.Item>
<Form.Item name="tosUserName" label="Account ID" rules={AccountTip[2]}>
<Input placeholder="Login Account" className="input" />
</Form.Item>
</Descriptions.Item>
<Descriptions.Item>
<Form.Item name="tosUserPwd" label="PassWord" rules={AccountTip[3]}>
<Input placeholder="Login PassWord" className="input" />
</Form.Item>
</Descriptions.Item>
</Descriptions>
<Form.Item name="community" label="Community">
......
......@@ -11,43 +11,40 @@ import { RA } from '@/services/tos';
import SearchOptionsCommnity from '@/components/SearchOptions/SearchOptionsCommnity';
const Contract = (props: any) => {
const { location, dispatch, ContractModel, userListLoading } = props;
const { location, dispatch, Contract, loading } = props;
const { Data, DataSave, DataSaveDetail, Result } = Contract;
// 把请求装在一个地方
const RA = (index: any, values: any) => {
dispatch({ type: 'Contract/RA', playload: { index: index, body: values } });
};
// 把请求装在一个地方
function requst(payload: any) {
dispatch({ type: 'ContractModel/getList', payload: payload });
dispatch({ type: 'Contract/getList', payload: payload });
}
// 数据
useEffect(() => {
let payload = {
index: 19,
page: {
pageNum: ContractModel.page,
},
if (Data == null) {
//如果没数据请求一次
let obj = {
pageNum: 1,
};
requst(payload);
}, [1]); //页面进来执行一次
RA(19, obj);
}
}, [Data]);
// 表单标识
const [form] = Form.useForm();
// 跳转
const Jump = (record: any, Jump: String) => {
dispatch({
type: 'ContractModel/getMove',
payload: {
type: Jump,
record: record,
},
});
// RA();
dispatch({ type: 'Contract/DataSaveDetail', playload: { record } });
// 清掉图片列表
dispatch({ type: 'Contract/FileImgs' });
// if(record == 0){
// history.push(location.pathname + '/' + Jump)
// }
// console.log(location.pathname + '/' + Jump)
// 跳转
history.push(location.pathname + '/' + Jump);
};
// 表头
......@@ -56,7 +53,7 @@ const Contract = (props: any) => {
title: 'Contract Number',
render: function (record: any) {
let mom = moment(record.contractValidEndDate).diff(moment(), 'day');
if (mom < 30) {
if (mom < 60) {
return (
<Tooltip title="Due Soon" placement="right" color={'red'} key={record.id}>
<span className={styles.red}>{record.contractNumber}</span>
......@@ -112,62 +109,28 @@ const Contract = (props: any) => {
// 页面切换
const paginationHandler = (page: number, pageSize?: number) => {
dispatch({
type: 'ContractModel/getList',
payload: {
index: 19,
page: {
let obj = {
pageNum: page,
},
},
});
};
// 刷新
const resetHandler = () => {
dispatch({
type: 'ContractModel/getList',
payload: {
index: 19,
page: {
pageNum: ContractModel.page,
},
},
});
RA(19, obj);
};
// 表单标识
const [form] = Form.useForm();
// 重置
const onReset = () => {
form.resetFields();
let payload = {
index: 19,
page: {
let obj = {
pageNum: 1,
},
};
requst(payload);
RA(19, obj);
};
// 表单提交
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);
let payload = {
index: 19,
page: {
pageNum: 1,
contractNumber: value.contractNumber,
contractTitle: value.contractTitle,
communityName: value.communityName,
},
};
requst(payload);
value.pageNum = 1;
RA(19, value);
}
};
......@@ -200,12 +163,7 @@ const Contract = (props: any) => {
<Input allowClear placeholder="Contract Title" />
</Form.Item>
<Form.Item>
<Button
type="primary"
htmlType="submit"
icon={<SearchOutlined />}
loading={userListLoading}
>
<Button type="primary" htmlType="submit" icon={<SearchOutlined />} loading={loading}>
Search{' '}
</Button>
<Button
......@@ -213,7 +171,7 @@ const Contract = (props: any) => {
onClick={onReset}
style={{ marginLeft: '15px' }}
icon={<ClearOutlined />}
loading={userListLoading}
loading={loading}
>
{' '}
Reset
......@@ -226,28 +184,29 @@ const Contract = (props: any) => {
<ProTable
// request={requestHeadl}
rowKey={'id'}
dataSource={ContractModel.list}
dataSource={Data ? Data.list : ''}
columns={columns}
pagination={false} // 隐藏默认分页
search={false}
loading={userListLoading}
loading={loading}
toolBarRender={() => [
<Button
key="3"
type="primary"
onClick={() => {
Jump(0, 'Add');
Jump(null, 'Add');
}}
loading={loading}
icon={<PlusOutlined />}
>
<PlusOutlined />
Add Contract
</Button>,
]}
options={{
density: true,
fullScreen: true,
density: false,
fullScreen: false,
reload: () => {
resetHandler();
onReset();
},
setting: false,
}}
......@@ -257,12 +216,10 @@ const Contract = (props: any) => {
<div className={styles.pages}>
<Pagination
current={ContractModel.page}
total={ContractModel.totalRow}
current={Data ? Data.page.currentPage : 0}
total={Data ? Data.page.totalRow : 0}
onChange={paginationHandler}
// onShowSizeChange={pageSizeHandler}
// current={users.meta.page}
// pageSize={users.meta.per_page}
defaultPageSize={Data ? Data.page.pageSize : 15}
/>
</div>
</div>
......@@ -270,10 +227,11 @@ const Contract = (props: any) => {
);
};
const mapStateToProps = ({ ContractModel, loading }: { ContractModel: any; loading: Loading }) => {
const mapStateToProps = (state: any) => {
console.log(state);
return {
ContractModel,
userListLoading: loading.models.ContractModel || false,
Contract: state.Contract,
loading: state.loading.models.Contract || false,
};
};
......
import React, { useState, useEffect } from 'react';
import { Input ,Table,Space,Form,Button,message} from 'antd';
import { Link, useIntl, connect, Dispatch, history, Loading } from 'umi';
import ProTable, { ProColumns, TableDropdown, ActionType } from '@ant-design/pro-table';
import { RA } from '@/services/tos';
import { times } from 'lodash';
import moment from 'moment';
import styles from './index.less';
import './ContractContent.less';
const Contract = (props:any) => {
const { formatMessage } = useIntl();
const { dispatch,location,Data,Result ,loading } = props;
const RA = (index: any, values: any) => { dispatch({ type: 'Contract/RA', playload: { index: index, body: values } }) };
const SA = (values: any) => { dispatch({ type: 'Contract/SA', playload: values }) };
// 把请求装在一个地方
function requst(){RA(19, {pageNum:"1",contractNumber:"",contractTitle:"",communityName:""})}
useEffect(() => {
console.log("合同页面")
requst()
}, [])
useEffect(() => {
if (Data != null) {
console.log(Data)
}
},[Data])
const goToDetail = (record: any, e: any) => {
SA(record)
history.push(location.pathname+'/Detail')
}
const goToEdit = (record: any, e: any) => {
SA(record)
history.push(location.pathname+'/Edit')
}
const goToAdd = (record: any) => {
SA(record)
history.push(location.pathname+'/Add')
}
// 日期处理
function CountDown(record: any) {
return record.contractValidEndDate
};
// 表头
const columns = [
{
title: "Contract Number",
render:function(record) {
let mom = moment(record.contractValidEndDate).diff(moment(), 'day');
return <span className={mom < 30? 'red' : ''}>{record.contractNumber}</span>
}
}, // 合同编号
{
title: "Company",
render: (text:any, record:any) => (
<>
<div>
<span>Party A : {record.contractPartyA}</span>
</div>
<div>
<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 File", dataIndex: 'contractFileName' }, // 附件
{
title: "Actions",
render: (text: any, record: any) => (
<Space size="middle">
<a onClick={goToEdit.bind(this, record)}>Edit</a>
<a onClick={goToDetail.bind(this,record)}>Detail</a>
</Space>
),
},// 操作
];
// 表单标识
const [form] = Form.useForm()
// 重置
const onReset = () => {
form.resetFields();
requst()
};
// 表单提交
const onFinishContract = (value:any)=>{
// console.log(value)
if(!value.communityName&&!value.contractNumber&&!value.contractTitle){
message.error('Please enter one of them!')
}else{
RA(19, {
pageNum:"1",
contractNumber:value.contractNumber,
contractTitle:value.contractTitle,
communityName:value.communityName
})
}
}
return (
<div className={styles.base}>
{/* 头部组件 */}
{/* <div className={styles.box}>
<Form
autoComplete= "off"
layout="inline"
form={form}
name="contract"
onFinish={onFinishContract}
>
<Form.Item name="communityName">
<Input allowClear placeholder='Community name' />
</Form.Item>
<Form.Item name="contractNumber">
<Input allowClear placeholder='Contract No' />
</Form.Item>
<Form.Item name="contractTitle">
<Input allowClear placeholder='Contract Title' />
</Form.Item>
<Form.Item>
<Button type="primary" htmlType="submit"> Search </Button>
<Button htmlType="button" onClick={onReset} style={{marginLeft:'15px'}}>Reset</Button>
</Form.Item>
</Form>
</div> */}
{/* 内容组件 */}
<div className={styles.box2}>
<button className={styles.buttonAdd} onClick={goToAdd}> + Add To</button>
</div>
{/* 列表组件 */}
{
<ProTable
request={requestHeadl}
rowKey={"id"}
style={{ marginTop: 16 }}
columns={columns}
pagination={{ defaultCurrent: 1, total: Data.totalRow }}
loading={ loading }
/>
}
</div>
);
};
function mapStateToProps(state) {
const { Data,curString,Result } = state.Contract;
const loading = state.loading.models.user;
return {
Data,
curString,
Result,
loading
};
}
export default connect(mapStateToProps)(Contract);
......@@ -34,7 +34,9 @@ import PDF from 'react-pdf-js';
import { stringSplit } from '@/utils/string';
const ContractContent = (props: any) => {
const { ContractModel, dispatch, FileImg, loading } = props;
const { Contract, dispatch, FileImg, loading } = props;
const { DataSaveDetail } = Contract;
const { RangePicker } = DatePicker; // 日期组件
const [form] = Form.useForm(); // 表单
const RA = (index: any, values: any) => {
......@@ -56,19 +58,20 @@ const ContractContent = (props: any) => {
const [numPages, setNumPages] = useState(1 as any); // 总页码数
const [pageNumber, setPageNumber] = useState(1); // 当前页码数
const [imgInfo, setimgInfo] = useState(null as any); //本地图片预览
const [previewVisible, setPreviewVisible] = useState(false); //本地图片预览弹窗
useEffect(() => {
// 如果是添加传来没有值的时候 就清空 否则 赋值给表单
if (ContractModel.record === -1) {
// 返回列表
console.log('没数据');
} else if (ContractModel.record === 0) {
if (DataSaveDetail == null) {
// 清空表单
form.resetFields();
} else {
// 发起请求
// 发起图片请求
let objData = {
type: 'tosContractPreview',
fileName: ContractModel.record.contractFileName,
extends: ContractModel.record.communityName,
fileName: DataSaveDetail.contractFileName,
extends: DataSaveDetail.communityName,
};
RA(47, objData);
......@@ -76,28 +79,29 @@ const ContractContent = (props: any) => {
setUploadUp(false);
// 提示时间
let a1 = moment(ContractModel.record.contractValidEndDate)
let a1 = moment(DataSaveDetail.contractValidEndDate)
.subtract(2, 'month')
.format('YYYY-MM-DD');
let a2 = moment(ContractModel.record.contractValidEndDate)
let a2 = moment(DataSaveDetail.contractValidEndDate)
.subtract(1, 'month')
.format('YYYY-MM-DD');
setTipTime([a1, a2]);
// 给到上传绑定
setComtyName(ContractModel.record.communityName);
setComtyName(DataSaveDetail.communityName);
// 表单内容
form.setFieldsValue({
...ContractModel.record,
...DataSaveDetail,
upload: 'ok',
time: [
moment(ContractModel.record.contractValidStartDate),
moment(ContractModel.record.contractValidEndDate),
moment(DataSaveDetail.contractValidStartDate),
moment(DataSaveDetail.contractValidEndDate),
],
});
}
}, [ContractModel]);
}, [DataSaveDetail]);
// 监听图片列表
// 监听上传图片列表
useEffect(() => {
if (FileImg != null) {
let obj = new Array();
......@@ -118,14 +122,25 @@ const ContractContent = (props: any) => {
}
}, [FileImg]);
// 监听列表
useEffect(() => {
if (fileList.length == 0) {
form.setFieldsValue['upload'] = null;
}
}, [fileList]);
// 返回
const goToReturn = () => {
// console.log(fileList)
history.back();
};
// // 提交
// 提交
const onFinish = (values: any) => {
// 判断有没有文件
if (fileList.length == 0) {
message.error('Please upload the attachment!');
} else {
values.contractValidStartDate = values.time[0].format('YYYY-MM-DD');
values.contractValidEndDate = values.time[1].format('YYYY-MM-DD');
let data = new Array();
......@@ -135,12 +150,13 @@ const ContractContent = (props: any) => {
values.contractFileNameList = data;
// 编辑
if (ContractModel.record.id != undefined) {
values.id = ContractModel.record.id;
if (DataSaveDetail != null) {
values.id = DataSaveDetail.id;
}
RA(27, values);
// RA(27, values)
}
};
// 上传文件设置
......@@ -152,6 +168,11 @@ const ContractContent = (props: any) => {
onChange({ file, fileList }: { file: any; fileList: any }) {
setFileList(fileList);
// 添加到表单
form.setFieldsValue({
upload: 'ok',
});
if (file.status == 'done') {
message.success(file.name, 3);
}
......@@ -182,10 +203,33 @@ const ContractContent = (props: any) => {
});
};
//本地图预览处理
function getBase64(file: any) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result);
reader.onerror = (error) => reject(error);
});
}
//点击预览
const onPreviews = (file: any) => {
const onPreviews = async (file: any) => {
// 有值的话 就是本地预览
if (file.size) {
if (!file.url && !file.preview) {
file.preview = await getBase64(file.originFileObj);
}
let info = {
previewImage: file.url || file.preview,
previewTitle: file.name || file.url.substring(file.url.lastIndexOf('/') + 1),
};
setPreviewVisible(true); // 弹窗
setimgInfo(info); // 图片信息
} else {
setfileInfo(file); // 设置选择的文件
settipModal(true);
}
};
// 关闭预览弹窗
......@@ -209,7 +253,7 @@ const ContractContent = (props: any) => {
<div className={styles.base}>
{/* 头部组件 */}
<div className={styles.box}>
<div className={styles.item1}>{ContractModel.type} Contract</div>
<div className={styles.item1}>{DataSaveDetail ? 'Edit' : 'Add'} Contract</div>
<button className={styles.item3} onClick={goToReturn}>
<LeftOutlined />
Back
......@@ -221,7 +265,7 @@ const ContractContent = (props: any) => {
autoComplete="off"
form={form}
name="basic"
initialValues={ContractModel.record}
initialValues={DataSaveDetail}
onFinish={onFinish}
// initialValues={defForm}
>
......@@ -266,7 +310,7 @@ const ContractContent = (props: any) => {
rules={[{ required: true, message: `${tipList[3]}` }]}
>
<SearchOptionsCommnity
defaultName={ContractModel.record.communityName}
defaultName={DataSaveDetail ? DataSaveDetail.communityName : null}
// ubmit={extendName}
opname={opname}
/>
......@@ -295,7 +339,7 @@ const ContractContent = (props: any) => {
>
<RangePicker
locale={locale}
defaultValue={ContractModel.time}
defaultValue={DataSaveDetail ? DataSaveDetail.time : null}
disabledDate={disabledDate}
placeholder={['Effective Date', 'Expiration Date']}
onChange={changeTime}
......@@ -307,8 +351,9 @@ const ContractContent = (props: any) => {
<div className="list2">
<Form.Item
labelAlign="right"
name="upload"
label="Contract Annex"
rules={[{ required: true, message: `${tipList[6]}` }]}
rules={[{ required: true, message: `Please upload the attachment!` }]}
>
<Upload
{...uploadProps}
......@@ -395,7 +440,7 @@ const ContractContent = (props: any) => {
// 图片用指定格式
<Image
src={stringSplit(fileInfo.url, 'm/cash')}
src={fileInfo.url}
preview={false}
style={{ margin: '0 auto', textAlign: 'center' }}
/>
......@@ -409,6 +454,22 @@ const ContractContent = (props: any) => {
''
)}
</Modal>
{/* 本地附件预览 */}
{imgInfo != null ? (
<Modal
visible={previewVisible}
title={imgInfo.previewTitle}
footer={null}
onCancel={() => {
setPreviewVisible(false);
}}
>
<img alt="example" style={{ width: '100%' }} src={imgInfo.previewImage} />
</Modal>
) : (
''
)}
</div>
</Spin>
</>
......@@ -421,6 +482,7 @@ function mapStateToProps(state: any) {
const loading = state.loading.models.Contract || false;
return {
ContractModel,
Contract,
FileImg,
loading,
};
......
import React, { useEffect, useState } from 'react';
import { connect } from 'umi';
import { Spin, Descriptions } from 'antd';
import { LeftOutlined } from '@ant-design/icons';
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); // 图片列表
// 带来信息
useEffect(() => {
if (DataSaveDetail == null) {
console.log('返回列表');
} else {
let objData = {
type: 'tosContractPreview',
fileName: DataSaveDetail.contractFileName,
extends: DataSaveDetail.communityName,
};
RA(47, objData);
}
}, [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 :">
{DataSaveDetail.contractValidStartDate} ~ {DataSaveDetail.contractValidEndDate}
</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);
......@@ -138,6 +138,7 @@ export const requestList = [
['/tos/community/delete', '49 关闭小区', {}],
['/tos/community/facilities/subscribeTime/query', '50 设施预订时间段查询', {}],
['/tos/user/infromation/get', '51 获取后台所有账号', {}],
['/tos/users/quitAndUser', '52 修改账号状态', {}],
];
const params = [
......
......@@ -7,22 +7,295 @@ export const zhCnFaci = [
title: 'life用户管理',
key: '1',
children: [
{ title: '查看LIFE用户', key: '2' },
{ title: '编辑LIFE用户', key: '3' },
{ title: '添加业主档案', key: '4' },
{ title: '注销业主档案', key: '5' },
{ title: '添加家属/租户', key: '6' },
{ title: '查看用户', key: '2' },
{ title: '编辑用户', key: '3' },
{ title: '添加用户', key: '4' },
{ title: '删除单元', key: '5' },
{ title: '查看家属/租户', key: '6' },
{ title: '注销家属/租户', key: '7' },
],
},
{
title: '服务商管理',
key: '8',
children: [
{ title: '查看服务商', key: '9' },
{ title: '编辑服务商', key: '10' },
{ title: '添加服务商', key: '11' },
{ title: '注销服务商', key: '12' },
{ title: '查看保安账号', key: '13' },
{ title: '注销保安账号', key: '14' },
],
},
{
title: '物业费管理',
key: '15',
children: [{ title: '查看物业费', key: '16' }],
},
{
title: '物业服务-小区保养',
key: '17',
children: [
{ title: '查看信息', key: '18' },
{ title: '回复信息', key: '19' },
],
},
{
title: '物业服务-业主投诉',
key: '20',
children: [
{ title: '查看信息', key: '21' },
{ title: '回复信息', key: '22' },
],
},
{
title: '物业服务-建议反馈',
key: '23',
children: [
{ title: '查看信息', key: '24' },
{ title: '回复信息', key: '25' },
],
},
{
title: '物业服务-装修申请',
key: '26',
children: [
{ title: '查看信息', key: '27' },
{ title: '回复信息', key: '28' },
],
},
{
title: '物业服务-住户卡申请',
key: '29',
children: [
{ title: '查看信息', key: '30' },
{ title: '回复信息', key: '31' },
{ title: '申请住户卡', key: '32' },
],
},
{
title: '物业服务-在线报事',
key: '33',
children: [
{ title: '查看信息', key: '34' },
{ title: '回复信息', key: '35' },
],
},
{
title: '物业服务-保质期服务',
key: '36',
children: [
{ title: '查看信息', key: '37' },
{ title: '回复信息', key: '38' },
],
},
{
title: '合同管理',
key: '39',
children: [
{ title: '查看合同', key: '40' },
{ title: '添加合同', key: '41' },
{ title: '编辑合同', key: '42' },
],
},
{
title: '小区列表',
key: '43',
children: [
{ title: '查看小区', key: '44' },
{ title: '编辑小区', key: '45' },
{ title: '添加小区', key: '46' },
{ title: '注销小区', key: '47' },
],
},
{
title: '小区公告',
key: '48',
children: [
{ title: '查看公告', key: '49' },
{ title: '编辑公告', key: '50' },
{ title: '添加公告', key: '51' },
],
},
{
title: '小区设施',
key: '52',
children: [
{ title: '查看预约设施', key: '53' },
{ title: '添加预约设施', key: '54' },
{ title: '取消预约设施', key: '55' },
{ title: '退还预约设施费用', key: '56' },
{ title: '查看设施', key: '57' },
{ title: '编辑设施', key: '58' },
{ title: '添加设施', key: '59' },
],
},
{
title: '访客记录',
key: '60',
children: [{ title: '查看访客记录', key: '61' }],
},
{
title: '账号管理',
key: '62',
children: [
{ title: '查看账号', key: '63' },
{ title: '编辑账号', key: '64' },
{ title: '添加账号', key: '65' },
{ title: '注销账号', key: '66' },
],
},
],
},
];
export const enUsFaci = [
{
title: 'Check all',
key: '0',
children: [
{
title: 'LIFE Users',
key: '1',
children: [
{ title: 'Check users', key: '2' },
{ title: 'Edit users', key: '3' },
{ title: 'Add users', key: '4' },
{ title: 'Delete unit', key: '5' },
{ title: 'Check family/tenants', key: '6' },
{ title: 'Log off family/tenants', key: '7' },
],
},
{
title: 'Service Providers',
key: '8',
children: [
{ title: '查看物业费', key: '9' },
{ title: '编辑物业费', key: '10' },
{ title: 'Check service providers', key: '9' },
{ title: 'Edit service providers', key: '10' },
{ title: 'Add service providers', key: '11' },
{ title: 'Log off service providers', key: '12' },
{ title: 'Check security account', key: '13' },
{ title: 'Log off security account', key: '14' },
],
},
{
title: 'Property Management',
key: '15',
children: [{ title: 'View property fees', key: '16' }],
},
{
title: 'Commercial Service-Community Maintenance',
key: '17',
children: [
{ title: 'See information', key: '18' },
{ title: 'Reply message', key: '19' },
],
},
{
title: 'Commercial Service-Owner Complaints',
key: '20',
children: [
{ title: 'See information', key: '21' },
{ title: 'Reply message', key: '22' },
],
},
{
title: 'Commercial Service-Problem Feedback',
key: '23',
children: [
{ title: 'See information', key: '24' },
{ title: 'Reply message', key: '25' },
],
},
{
title: 'Commercial Service-Renovation Application',
key: '26',
children: [
{ title: 'See information', key: '27' },
{ title: 'Reply message', key: '28' },
],
},
{
title: 'Commercial Service-AccessCard Application',
key: '29',
children: [
{ title: 'See information', key: '30' },
{ title: 'Reply message', key: '31' },
{ title: 'Apply accesscard', key: '32' },
],
},
{
title: 'Commercial Service-Report Online',
key: '33',
children: [
{ title: 'See information', key: '34' },
{ title: 'Reply message', key: '35' },
],
},
{
title: 'Commercial Service-Shelf Life Service',
key: '36',
children: [
{ title: 'See information', key: '37' },
{ title: 'Reply message', key: '38' },
],
},
{
title: 'Contract Management',
key: '39',
children: [
{ title: 'Check contract', key: '40' },
{ title: 'Add contract', key: '41' },
{ title: 'Edit contract', key: '42' },
],
},
{
title: 'Community',
key: '43',
children: [
{ title: 'Check community', key: '44' },
{ title: 'Edit community', key: '45' },
{ title: 'Add community', key: '46' },
{ title: 'Log off community', key: '47' },
],
},
{
title: 'Announcement',
key: '48',
children: [
{ title: 'Check announcement', key: '49' },
{ title: 'Edit announcement', key: '50' },
{ title: 'Add announcement', key: '51' },
],
},
{
title: 'Facility Bookings',
key: '52',
children: [
{ title: 'View booking facilities', key: '53' },
{ title: 'Add booking facilities', key: '54' },
{ title: 'Cancel booking facilities', key: '55' },
{ title: 'Refund of booking facility fee', key: '56' },
{ title: 'View facilities', key: '57' },
{ title: 'Edit facilities', key: '58' },
{ title: 'Add facilities', key: '59' },
],
},
{
title: 'Visitor Record',
key: '60',
children: [{ title: 'View visitor record', key: '61' }],
},
{
title: 'Account Management',
key: '62',
children: [
{ title: 'View account', key: '63' },
{ title: 'Edit account', key: '64' },
{ title: 'Add account', key: '65' },
{ title: 'Log off account', key: '66' },
],
},
],
},
];
\ No newline at end of file
];
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