Commit 34bd254a authored by cellee's avatar cellee

去除操作成功提示

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent b7a6b4bb
......@@ -63,7 +63,7 @@ const Facilitys = (props: any) => {
onChange(info: any) {
// console.log(info);
if (info.file.status === 'done') {
message.success(`${info.file.name} file uploaded successfully`);
// message.success(`${info.file.name} file uploaded successfully`);
// 拿到key 值 开始存储
let key = info.fileList[0].response.data.identification;
let list = FacilitysList;
......
......@@ -60,7 +60,7 @@ const Facilitys = (props: any) => {
onChange(info: any) {
// console.log(info);
if (info.file.status === 'done') {
message.success(`${info.file.name} file uploaded successfully`);
// message.success(`${info.file.name} file uploaded successfully`);
// 后台返回的值
let data = info.file.response.data;
// 拿到key 值 开始存储
......
import React, { useState,useEffect} from 'react';
import React, { useState, useEffect } from 'react';
import { Upload,Button, message,Row,Col } from 'antd';
import { Upload, Button, message, Row, Col } from 'antd';
import { UploadOutlined } from '@ant-design/icons';
// { imageType: "tosContract", extends: extend }
//"/tos/image/upload"
import { Fromate2 } from '@/utils/method'
import { Fromate2 } from '@/utils/method';
const FileUpload = (props: any) => {
const {value,onChange}=props
const { value, onChange } = props;
const [fileList, setFileList] = useState([]);
const uploadProps = {
accept:".pdf,",
action:props.url,
accept: '.pdf,',
action: props.url,
data: props.data,
fileList: fileList,
showUploadList:false,
showUploadList: false,
onChange({ file, fileList }) {
let tmp=fileList
setFileList(tmp.filter(file => !!file.status))
let tmp = fileList;
setFileList(tmp.filter((file) => !!file.status));
if (file.status == 'done') {
console.log(fileList);
message.success(file.name, 3)
// message.success(file.name, 3)
if (props.reg != null) {
onChange(Fromate2(fileList,props.reg))
onChange(Fromate2(fileList, props.reg));
} else {
onChange(fileList)
onChange(fileList);
}
}
},
......@@ -38,7 +36,9 @@ const FileUpload = (props: any) => {
return (
<>
<Row gutter={8}>
<Col><div style={{lineHeight:2}}>{props.title}</div></Col>
<Col>
<div style={{ lineHeight: 2 }}>{props.title}</div>
</Col>
<Col>
<Upload {...uploadProps}>
<Button>
......@@ -47,7 +47,6 @@ const FileUpload = (props: any) => {
</Upload>
</Col>
</Row>
</>
);
};
......
......@@ -65,7 +65,7 @@ export default {
break;
case 27:
{
message.success('Save Success !');
// message.success('Save Success !');
let tmp = resp;
let Data = null;
yield put({ type: 'returnResult', tmp });
......
......@@ -147,7 +147,7 @@ export default {
case 6:
case 17:
{
message.success('Success Operation!', 3);
// message.success('Success Operation!', 3);
history.push('/CommunityManagement/FacilityBookings');
}
break;
......
......@@ -94,7 +94,7 @@ const Account = (props: any) => {
if (SubResult != null) {
if (SubResult.statr == 0 && SubResult.desc == 0) {
// 保存成功, 清掉原来数据 并且跳转
message.success('Submitted Successfully !');
// message.success('Submitted Successfully !');
dispatch({ type: module + '/ReData' });
dispatch({ type: module + '/AccountClear' });
setLoading(false);
......
......@@ -508,7 +508,6 @@ const Account = (props: any) => {
<div className="label">
{user && user.currentUser.tosUserLevel !== 3 ? (
<Button danger style={{ marginRight: 15 }} onClick={lockS}>
<PoweroffOutlined />
Close Account
</Button>
) : (
......
import React, { useState, useEffect, useRef } from 'react';
import { Form, Input, Button, message, Descriptions, Spin, Tree, Radio, Select, Modal } from 'antd';
import { connect, history } from 'umi';
import { EditOutlined, LeftOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
import './Account.less';
import { zhCnFaci, enUsFaci } from '@/utils/power';
import { AccountTip } from '@/utils/tip';
import { getNumber } from '@/utils/string'; // 正则
import { RA } from '@/utils/method';
const Account = (props: any) => {
const module = 'Account';
const { Option } = Select;
const { dispatch, SubResult, loading, user, DataSave, Permission } = props;
// 权限列表
const treeData = localStorage.getItem('umi_locale') == 'zh-CN' ? zhCnFaci : enUsFaci;
const [expandedKeys, setExpandedKeys] = useState<string[]>(['0']); // 展开栏目
const [checkedKeys, setCheckedKeys] = useState([] as any); // 默认已选栏目
const [selectedKeys, setSelectedKeys] = useState<string[]>([]); // 设置选中的树节点
const [autoExpandParent, setAutoExpandParent] = useState<boolean>(true); // 树形菜单展开关闭
const [treeDataList, settreeDataList] = useState(treeData); // 权限列表
// 单选 二级还是三级管理员
const [values, setvalues] = useState(2); // 树形菜单展开关闭
const [towAccountId, settowAccountId] = useState(null); // 二级账户id
//提醒次数
// const [frequency, setfrequency] = useState(0); // 权限列表
const [TreeDisabled, setTreeDisabled] = useState(true); // 权限是否可编辑
// 表单标识
const [form] = Form.useForm();
const formRef = useRef(null);
// 当前编辑账户的数据
useEffect(() => {
if (DataSave != null && user != null) {
// 赋值
form.setFieldsValue({
tosUserName: DataSave.tosUserName,
tosUserPhone: DataSave.tosUserPhone,
tosAccountName: DataSave.tosAccountName,
});
setvalues(DataSave.tosUserLevel); // 等级
// 当前登录的不是admin 就 给默认id
if (user.currentUser.userModel.tosUserLevel > 1) {
settowAccountId(DataSave.userLeader); // 二级账户id
}
if (DataSave.tosUserLevel == 3) {
settowAccountId(DataSave.userLeader); //上级id
}
// 二级账户可以编辑下级但不可编辑自身
if (
user.currentUser.userModel.tosUserLevel == 1 ||
(user.currentUser.userModel.tosUserLevel == 2 && DataSave.tosUserLevel == 3)
) {
setTreeDisabled(false);
}
// 发起获取权限请求
RA(54, { tosUserName: DataSave.tosUserName }, module, dispatch); // 发起获取权限请求
} else {
history.push('/AccountManagement/account');
}
}, [DataSave, user]);
// 提交信息结果
useEffect(() => {
if (SubResult != null) {
if (SubResult.statr == 0 && SubResult.desc == 0) {
// 保存成功, 清掉原来数据 并且跳转
message.success('Submitted Successfully !');
dispatch({ type: module + '/ReData' });
dispatch({ type: module + '/AccountClear' });
history.go(-1);
}
}
}, [SubResult]);
// 已选权限
useEffect(() => {
if (Permission != null) {
let data = Permission.curUserPermission ? Permission.curUserPermission.split(',') : [];
let dataTow = Permission.beloginPermission ? Permission.beloginPermission.split(',') : [];
// 深拷贝权限列表
let treeDatas = JSON.parse(JSON.stringify(treeData));
// 如果是三级账户 可编辑的就是 上级权限,否者是登录的账户权限
let _a = DataSave.tosUserLevel == 3 ? dataTow : user.currentUser.permission; // 当前账户权限
let _p = treeDatas[0].children; // 所有权限列表
let arr: any = []; // 一级栏目权限
let erArr: any = []; // 一级栏目权限
// 循环一级 判断当前账户有没有权限修改增加
for (let i of _a) {
for (let j in _p) {
if (_p[j].key == i) {
arr.push(_p[j].key);
_p[j].disabled = false;
}
// 二级权限
for (let k in _p[j].children) {
if (_p[j].children[k].key == i) {
erArr.push(_p[j].children[k].key);
_p[j].children[k].disableCheckbox = false;
}
}
}
}
// 赋值 可勾选的权限
treeDatas[0].children = _p;
settreeDataList([...treeDatas]);
//-----------------分割--------------------
// 在解决默认已勾选的值
for (let i in _p) {
let arr = _p[i].children; // 每个权限
let newArr = []; // 每个权限下的子权限列表
for (let j in arr) {
newArr.push(arr[j].key);
}
if (!newArr.every((val) => data.includes(val))) {
// 判断数组是否包含另一个数组
// console.log('不包含' + _p[i].key);
// 不全部包含就删除数组的元素
var index = data.indexOf(_p[i].key);
if (index > -1) {
data.splice(index, 1);
}
}
}
// 再赋值给列表
if (DataSave.tosUserLevel == 3) {
// 且禁用最后两个账户管理
_p[_p.length - 1].children[2].disableCheckbox = true;
_p[_p.length - 1].children[3].disableCheckbox = true;
}
setCheckedKeys(data);
}
}, [Permission, DataSave]);
// 保存提交
const onFinishContract = async (value: any) => {
const userInfo = localStorage.getItem('userInfo') || '';
const id = JSON.parse(userInfo).userModel.id;
if (
value.tosAccountName.length <= 2 &&
value.tosUserPhone.length != 8 &&
value.tosUserPhone.length != 11
) {
// 姓名联系方式
message.error('Please enter the correct name and contact information!');
return false;
} else if (checkedKeys[0].key) {
// 如果存在key 就是没有选择
// 权限
message.error('Please Select Permission!');
return false;
} else if (value.tosUserName.length < 6) {
// 账号长度
message.error('The Account Password is Greater Than 6 Digits!');
return false;
} else if (values == 3 && towAccountId == null) {
// 如果创建的是三级账号就要判断是否选择了绑定的二级账户
message.error('Please select affiliated account !');
return false;
} else {
value.tosUserEmail = value.tosUserName; // 邮箱就是账号
value.tosUserLevel = values; //级别
// value.creatorName = JSON.parse(userInfo).userModel.tosUserName; //新建者账号
value.creatorId = id; //新建者ID
if (values == 3) {
value.userLeader = towAccountId;
}
delete value.community;
// 编辑的时候传id 新增则没有
DataSave ? (value.id = DataSave.id) : '';
// 判断有没有 0 有就删除
for (var i in checkedKeys) {
checkedKeys[i] == '0' ? checkedKeys.splice(i, 1) : '';
}
// 追加到上级id
let Obj = treeData[0].children;
for (let i in Obj) {
for (let j in checkedKeys) {
if (JSON.stringify(Obj[i].children).indexOf(JSON.stringify(checkedKeys[j])) != -1) {
// 提取出上级id 并且追加
checkedKeys.push(Obj[i].key);
}
}
}
// 去重后在排序
let newData = Array.from(new Set(checkedKeys)).sort((n1: any, n2: any) => {
return parseInt(n1) - parseInt(n2);
});
//新旧权限比对
let subPermissionArray = [];
if (values == 2) {
let data = Permission.curUserPermission ? Permission.curUserPermission.split(',') : '';
let Deleted = compare(data, newData); // 当前删除的权限有哪些
subPermissionArray = compares(Deleted); // 当前删除的三级权限有哪些
}
// 另传权限
let obj = {
userName: value.tosUserName,
userPassword: value.tosUserPwd,
permissionArray: newData,
subPermissionArray,
};
RA(38, value, module, dispatch); // 信息上传
RA(42, obj, module, dispatch); // 权限上传
}
};
// 保存前看看那些权限是增加或者减少
function compare(beforeArr: any, afterArr: any) {
let add = [];
let del = [];
let cenObj = {};
//把beforeArr数组去重放入cenObj
for (let i = 0; i < beforeArr.length; i++) {
cenObj[beforeArr[i]] = beforeArr[i];
}
//遍历afterArr,查看其元素是否在cenObj中
for (let j = 0; j < afterArr.length; j++) {
if (!cenObj[afterArr[j]]) {
add.push(afterArr[j]);
} else {
delete cenObj[afterArr[j]];
}
}
for (let k in cenObj) {
del.push(k);
}
// 只返回删除的
return del;
}
// 看看是不是动了三级权限的东西
function compares(afterArr: any) {
// 下级权限
let dataTow = Permission.beloginPermission ? Permission.beloginPermission.split(',') : [];
let del = [];
for (let i of afterArr) {
if (dataTow.indexOf(i) !== -1) {
del.push(i);
}
}
return del;
}
//goToReturn
const goToReturn = () => {
history.go(-1);
};
// 展开/收起树形菜单触发
const onExpand = (expandedKeys: any) => {
setExpandedKeys(expandedKeys);
setAutoExpandParent(false);
};
// 点击单个触发
const onCheck = (checkedKeys: any) => {
// 如果是二级账户就要判断去掉的有没有三级账户的权限
if (DataSave.tosUserLevel == 2) {
let checkers = (arr: any, target: any) => target.every((v: any) => arr.includes(v));
// 上级或者下级权限
let newPerTow = Permission.beloginPermission ? Permission.beloginPermission.split(',') : [];
// 列表权限
let treeDatas = JSON.parse(JSON.stringify(treeData));
// 列表的二级权限
let TowLev = treeDatas[0].children.map((v: any) => v.key);
let dataTow: any = [];
for (let i in newPerTow) {
// 如果不是二级就添加进去
if (TowLev.indexOf(newPerTow[i]) == -1) {
dataTow.push(newPerTow[i]);
}
}
// true 就是没有勾选到三级 false 就是勾选到三级了
if (!checkers(checkedKeys, dataTow)) {
showDeleteConfirm(checkedKeys);
return false;
}
}
setCheckedKeys(checkedKeys);
};
const { confirm } = Modal;
// 弹窗
function showDeleteConfirm(checkedKeys: any) {
// 如果没有提醒过的话就开启 否则直接设置
// if (frequency < 1) {
confirm({
title: 'Are you sure you want to delete this permission?',
icon: <ExclamationCircleOutlined />,
content:
'Cancel permission has been given to level 3 account. Do you want to delete it together!',
okText: 'Yes',
okType: 'danger',
cancelText: 'No',
onOk() {
setCheckedKeys(checkedKeys);
// setfrequency(1);
},
onCancel() {},
});
// } else {
// setCheckedKeys(checkedKeys);
// }
}
// 点击树节点触发 - 大栏目
const onSelect = (selectedKeys: any, info: any) => {
// console.log('onSelect', info);
setSelectedKeys(selectedKeys);
};
//手机号
const keyup_communityManagerFee = (e: any) => {
e.target.value = keyup_tool(e.target.value);
};
const keyup_tool = (value: any) => {
return getNumber(value.replace(/[^\d^\.]+/g, ''));
};
// 管理员级别样式
const radioStyle = {
display: 'block',
height: '30px',
lineHeight: '30px',
marginBottom: '15px',
};
//级别切换
const onRadio = (e: any) => {
setvalues(e.target.value);
// setCheckedKeys([]);
if (e.target.value == 2) {
//否则打开
settowAccountId(null);
}
};
return (
<Spin spinning={loading}>
<div className="contop" style={{ padding: '12px 20px' }}>
<h3 className="capi">
<EditOutlined />
&nbsp; Edit 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: 1, md: 2, xl: 3 }}>
<Descriptions.Item>
<Form.Item name="tosUserName" label="Account ID" rules={AccountTip[0] as any}>
<Input placeholder="Login Account" className="input" disabled />
</Form.Item>
</Descriptions.Item>
<Descriptions.Item>
<Form.Item name="tosAccountName" label="Name" rules={AccountTip[1] as any}>
<Input placeholder="Name Of Administrator" className="input" />
</Form.Item>
</Descriptions.Item>
<Descriptions.Item>
<Form.Item name="tosUserPhone" label="Phone" rules={AccountTip[2] as any}>
<Input
placeholder="Contact Information"
className="input"
maxLength={11}
onKeyUp={keyup_communityManagerFee}
/>
</Form.Item>
</Descriptions.Item>
</Descriptions>
<div className="diy" style={{ marginBottom: '14px' }}>
<div className="label">
<span className="title">Privilege Level:</span>
</div>
<div className="label">
<Radio.Group value={values} onChange={onRadio}>
<Radio style={radioStyle} disabled value={2}>
Second Level Administrator
</Radio>
<Radio style={radioStyle} disabled value={3}>
Third Level Administrator
</Radio>
</Radio.Group>
{/* 选择挂靠的二级菜单 */}
{values === 3 && user.currentUser.userModel.tosUserLevel <= 1 ? (
<Select
style={{ width: 260 }}
placeholder="Please select affiliated account"
disabled
defaultValue={DataSave.userLeader}
>
{DataSave ? (
<Option key={DataSave.userLeader} value={DataSave.userLeader}>
{DataSave.userLeaderAccountName}
</Option>
) : (
''
)}
</Select>
) : (
''
)}
</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={treeDataList}
disabled={TreeDisabled}
/>
</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>
</Spin>
);
};
const AccountProps = (state: any) => {
const { Data, DataSave, DataSaveDetail, Result, SubResult, Permission, Info } = state.Account;
const loading = state.loading.models.Account || false;
const { user } = state;
return {
Data,
DataSave,
DataSaveDetail,
Result,
loading,
Permission,
user, // 获取当前账户信息
SubResult,
Info,
};
};
export default connect(AccountProps)(Account);
......@@ -108,7 +108,7 @@ const Adds = (props: any) => {
dispatch({ type: 'Init/addCommunityget', playload: { Result: new Array(Result.data) } });
}
// 提示跳转
message.success(`Information saved successfully!`);
// message.success(`Information saved successfully!`);
history.push('/CommunityManagement/CellList');
}
}, [Result, Data]);
......
......@@ -295,7 +295,6 @@ const Detail = (props: any) => {
<Button
danger
style={{ marginRight: '15px' }}
icon={<PoweroffOutlined />}
loading={false}
onClick={openModel}
>
......
......@@ -114,7 +114,7 @@ const Bookings = (props: any) => {
} else {
// 提交成功
ResultClear(); // 清除结果
message.success('Success Operation!', 3);
// message.success('Success Operation!', 3);
history.push('/CommunityManagement/FacilityBookings');
}
}
......
......@@ -144,7 +144,7 @@ const FacilityTow = (props: any) => {
// 设施删除结果
useEffect(() => {
if (FacilityDelete) {
message.success('Closed Successfully!');
// message.success('Closed Successfully!');
setIsModalVisible(false);
history.push('/CommunityManagement/FacilityBookings');
dispatch({ type: 'FacilityBookings/FacilityDel' });
......@@ -492,7 +492,6 @@ const FacilityTow = (props: any) => {
<>
{facilityDetail && user && user.currentUser.permission.includes('58') ? (
<Button danger onClick={showModal}>
<PoweroffOutlined />
Close The Selected Facility
</Button>
) : (
......
......@@ -178,7 +178,7 @@ const ContractContent = (props: any) => {
setimgLoad(false);
}
if (file.status === 'done') {
message.success(file.name + ' Upload Successful !');
// message.success(file.name + ' Upload Successful !');
// 实现在线预览
let obj = {
......
......@@ -224,7 +224,7 @@ const ContractContent = (props: any) => {
dispatchs({ type: 'setimgLoad', payload: false });
}
if (file.status === 'done') {
message.success(file.name + ' Upload Successful !');
// message.success(file.name + ' Upload Successful !');
let data = file.response.data;
// 实现在线预览
......
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