Commit 568b0654 authored by cellee's avatar cellee

预览跨域问题,以及账号管理界面更新

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent 2e104c6c
......@@ -344,6 +344,7 @@ export default defineConfig({
routes: [
{ path: './', component: './AccountManagement/account/Account' },
{ path: './edit', component: './AccountManagement/account/AccountEdit' },
{ path: './Add', component: './AccountManagement/account/AccountEdit' },
{ path: './reset', component: './AccountManagement/account/AccountReset' },
],
},
......
......@@ -22,7 +22,7 @@ export default {
changeOrigin: true,
pathRewrite: { '^': '' },
},
'/cash/tos-manager/bill/': {
'/cash/tos-manager/': {
target: 'http://acc-huahui.oss-cn-shenzhen.aliyuncs.com',
changeOrigin: true,
pathRewrite: { '^': '' },
......@@ -54,7 +54,7 @@ export default {
changeOrigin: true,
pathRewrite: { '^': '' },
},
'/cash/tos-manager/bill/': {
'/cash/tos-manager/': {
target: 'http://acc-huahui.oss-cn-shenzhen.aliyuncs.com',
changeOrigin: true,
pathRewrite: { '^': '' },
......@@ -81,7 +81,7 @@ export default {
changeOrigin: true,
pathRewrite: { '^': '' },
},
'/cash/tos-manager/bill/': {
'/cash/tos-manager/': {
target: 'http://acc-huahui.oss-cn-shenzhen.aliyuncs.com',
changeOrigin: true,
pathRewrite: { '^': '' },
......
......@@ -11,6 +11,8 @@ import IconNone from '@/assets/logo_icon_bg.png';
import PDF from 'react-pdf-js';
import { stringSplit } from '@/utils/string';
const PreView = (props: any) => {
const module = 'CellList';
......@@ -113,7 +115,7 @@ const PreView = (props: any) => {
{ModalInfo != null && ModalInfo.type == 'pdf' ? (
<>
<PDF
file={ModalInfo ? ModalInfo.url : ''}
file={ModalInfo ? stringSplit(ModalInfo.url, 'm/cash') : ''}
page={pageNumber}
onDocumentComplete={onDocumentLoadSuccess}
/>
......
......@@ -65,7 +65,7 @@ export default {
break;
case 27:
{
message.success('save success !');
message.success('Save Success !');
var tmp = resp;
yield put({ type: 'returnResult', tmp });
setTimeout(function () {
......
import React, { useState, useEffect } from 'react';
import { Form, Input, Button, Pagination, message, Modal } from 'antd';
import { Form, Input, Button, Pagination, message, Modal, Tag } from 'antd';
import { connect, history } from 'umi';
import { SearchOutlined, ClearOutlined, PlusOutlined } from '@ant-design/icons';
import ProTable from '@ant-design/pro-table';
......@@ -28,13 +28,11 @@ const Account = (props: any) => {
}
}, [Data]); //页面进来执行一次
// 拉取数据的条件存储
const [term, setTerm] = useState({} as any);
// 关闭账号
const [over, setOver] = useState(false);
const [term, setTerm] = useState({} as any); // 拉取数据的条件存储
const [over, setOver] = useState(false); // 关闭账号确认弹窗
const [accountName, setaccountName] = useState(null as any); // 弹窗账号信息
// 表单标识
const [form] = Form.useForm();
const [form] = Form.useForm(); // 表单标识
// 表头
const columns = [
......@@ -49,11 +47,10 @@ const Account = (props: any) => {
key: 'userLevel',
render: (text: any) => (
<span>
{text == 5 || text == 0 ? '超级管理员' : ''}
{text == 4 ? '一级管理员' : ''}
{text == 3 ? '二级管理员' : ''}
{text == 2 ? '三级管理员' : ''}
{text == 1 ? '一级管理员' : ''}
{text == 0 ? 'Administrator' : ''}
{text == 1 ? 'First Level' : ''}
{text == 2 ? 'Two Level' : ''}
{text == 3 ? 'Three Level' : ''}
</span>
),
},
......@@ -62,7 +59,13 @@ const Account = (props: any) => {
title: 'Status',
dataIndex: 'userStatus',
key: 'userStatus',
render: (text: any) => <span>{text != 1 ? '启用' : '禁用'}</span>,
render: (text: any) => {
return (
<Tag color={text != 1 ? '#87d068' : '#f20'} key={text}>
<span> {text != 1 ? 'Enable' : 'Close'}</span>
</Tag>
);
},
},
{
title: 'Created By',
......@@ -70,16 +73,13 @@ const Account = (props: any) => {
key: 'createAccount',
width: 280,
ellipsis: true,
// render: (text: any) => {
// <span>{text == 0 ? '启用' : '禁用'}</span>
// },
},
{
title: 'Creation Time',
dataIndex: 'createTime',
key: 'createTime',
render: (text: any) => {
return moment(text.time).format('YYYY-MM-DD');
return moment(text).format('YYYY-MM-DD');
},
},
......@@ -87,7 +87,7 @@ const Account = (props: any) => {
title: 'Actions',
dataIndex: 'action',
key: 'action',
render: (record: any) => (
render: (text: any, record: any) => (
<span>
<Button
type="link"
......@@ -103,7 +103,7 @@ const Account = (props: any) => {
lockS(record);
}}
>
{record.userStatus == 1 ? 'Lock' : 'Unlock'}
{record.userStatus != 1 ? 'Close' : 'Open'}
</Button>
{/*{record.userID == 1||record.userID == this.props.currentUser.userid?'':
<Button style={{background: 'transparent', border: 0, color: '#1890FF'}}
......@@ -116,12 +116,14 @@ const Account = (props: any) => {
// 编辑- 新增
const edit = (item: any) => {
history.push('./account/edit');
item == 1 ? history.push('./account/Add') : history.push('./account/edit');
};
// 停用账号
const lockS = (item: any) => {
setOver(true);
setaccountName(item);
console.log(item);
};
// 表头单搜索
......@@ -204,6 +206,7 @@ const Account = (props: any) => {
icon={<PlusOutlined />}
onClick={() => {
// Jump(0, 'Add');
edit(1);
}}
>
Add Account
......@@ -233,10 +236,23 @@ const Account = (props: any) => {
</div>
{/* 确认关闭账号 */}
<Modal title="Basic Modal" visible={over} onOk={handleOk} onCancel={handleCancel}>
<p>Some contents...</p>
<p>Some contents...</p>
<p>Some contents...</p>
<Modal
title="Operation Tips"
visible={over}
okText={'Confirm'}
cancelText={'Cancel'}
onOk={handleOk}
onCancel={handleCancel}
>
{accountName != null ? (
<p>
Are You Sure To{' '}
<span style={{ color: 'red' }}>{accountName.userStatus != 1 ? 'Close' : 'Open'}</span>{' '}
The Account '<span style={{ color: 'red' }}> {accountName.tosUserName} </span>' ?
</p>
) : (
''
)}
</Modal>
</>
);
......
......@@ -19,7 +19,7 @@ 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';
......@@ -57,26 +57,37 @@ const Account = (props: any) => {
// 保存提交
const onFinishContract = (value: any) => {
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); // 权限上传
if (checkedKeys.length == 0) {
message.error('Please Select Permission!');
return false;
} else if (value.community.value == 0) {
message.error('Please Select The Jurisdiction Area!');
return false;
} else if (value.tosUserName.length < 6 || value.tosUserPwd.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 = () => {};
......@@ -115,6 +126,13 @@ const Account = (props: 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 (
......@@ -143,50 +161,55 @@ const Account = (props: any) => {
>
<Descriptions column={{ xs: 1, sm: 2, md: 3 }}>
<Descriptions.Item>
<Form.Item name="tosAccountName" label="管理员姓名" rules={AccountTip[0]}>
<Input placeholder="6 Postcode" className="input" />
<Form.Item name="tosAccountName" label="Name" rules={AccountTip[0]}>
<Input placeholder="Name Of Administrator" className="input" />
</Form.Item>
</Descriptions.Item>
<Descriptions.Item>
<Form.Item name="tosUserPhone" label="联系方式">
<Input placeholder="6 Postcode" className="input" />
<Form.Item name="tosUserPhone" label="Phone" rules={AccountTip[1]}>
<Input
placeholder="Contact Information"
className="input"
maxLength={11}
onKeyUp={keyup_communityManagerFee}
/>
</Form.Item>
</Descriptions.Item>
<Descriptions.Item>
<Form.Item name="tosUserToCompany" label="所属公司">
<Input placeholder="6 Postcode" className="input" />
<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="账号ID">
<Input placeholder="6 Postcode" className="input" />
<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="登录密码">
<Input placeholder="6 Postcode" className="input" />
<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="服务小区">
<Form.Item name="community" label="Community">
<SelectCommunity />
</Form.Item>
<div className="diy" style={{ marginBottom: '14px' }}>
<div className="label">
<span className="title">权限配置</span>
<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>
......@@ -195,7 +218,7 @@ const Account = (props: any) => {
<div className="diy" style={{ marginBottom: '24px' }}>
<div className="label">
<span className="title">权限选择</span>
<span className="title">Permission List</span>
</div>
<div className="label">
<Tree
......@@ -215,7 +238,7 @@ const Account = (props: any) => {
<div className="diy">
<div className="label"></div>
<div className="label">
<Button type="primary" htmlType="submit">
<Button type="primary" htmlType="submit" loading={loading}>
Submit
</Button>
</div>
......
......@@ -31,6 +31,7 @@ import { tipList } from '@/utils/tip';
import FileViewer from 'react-file-viewer';
import PDF from 'react-pdf-js';
import { stringSplit } from '@/utils/string';
const ContractContent = (props: any) => {
const { ContractModel, dispatch, FileImg, loading } = props;
......@@ -108,6 +109,7 @@ const ContractContent = (props: any) => {
type: FileImg[i].fileName.match(/\.([^\.]+)$/)[1].toLowerCase(),
url: FileImg[i].fileUrl,
};
console.log();
obj.push(a);
}
setFileList([...obj]);
......@@ -182,7 +184,6 @@ const ContractContent = (props: any) => {
//点击预览
const onPreviews = (file: any) => {
console.log(file);
setfileInfo(file); // 设置选择的文件
settipModal(true);
};
......@@ -378,7 +379,7 @@ const ContractContent = (props: any) => {
// pdf 换一种
<>
<PDF
file={fileInfo.url}
file={stringSplit(fileInfo.url, 'm/cash')}
page={pageNumber}
onDocumentComplete={onDocumentLoadSuccess}
/>
......@@ -392,13 +393,17 @@ const ContractContent = (props: any) => {
</>
) : fileInfo.type == 'jpg' || fileInfo.type == 'png' ? (
// 图片用指定格式
<Image
src={fileInfo.url}
src={stringSplit(fileInfo.url, 'm/cash')}
preview={false}
style={{ margin: '0 auto', textAlign: 'center' }}
/>
) : (
<FileViewer fileType={fileInfo.type} filePath={fileInfo.url} />
<FileViewer
fileType={fileInfo.type}
filePath={stringSplit(fileInfo.url, 'm/cash')}
/>
)
) : (
''
......
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