Commit d05c0fc8 authored by 邓超's avatar 邓超

fix: 数据库连接模块保存连接下面记录不刷新修复 数据库标准化管理,数据库连接配置报错修复 web配置显示修复 台账管理保存显示修复 产品配置不能保存修复

parent d05d6c72
Pipeline #33184 passed with stages
in 43 minutes 36 seconds
...@@ -18,22 +18,14 @@ import PageContainer from '@/components/BasePageContainer'; ...@@ -18,22 +18,14 @@ import PageContainer from '@/components/BasePageContainer';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { import {
setTableSQLDirName, setTableSQLDirName,
deleteConn,
deleteConnNew, deleteConnNew,
initDBv4,
initDBv4new, initDBv4new,
getInitDBLog,
getInitDBLogNew, getInitDBLogNew,
getConnRecord,
getConnRecordNew, getConnRecordNew,
getDataBaseConfig,
getDataBaseConfigNew, getDataBaseConfigNew,
saveConnection,
saveConnectionNew, saveConnectionNew,
getDataBaseList, getDataBaseList,
updateConnDesc,
updateConnDescNew, updateConnDescNew,
deleteInitDBLog,
deleteInitDBLogNew, deleteInitDBLogNew,
connectionTest, connectionTest,
} from '@/services/database/api'; } from '@/services/database/api';
...@@ -46,7 +38,7 @@ const formLables = { ...@@ -46,7 +38,7 @@ const formLables = {
password: '数据库用户密码', password: '数据库用户密码',
dbName: '数据库名称', dbName: '数据库名称',
}; };
let time = null let time = null;
const InitDataBase = props => { const InitDataBase = props => {
const [form] = Form.useForm(); const [form] = Form.useForm();
const [tableLoading, setTableLoading] = useState(false); // 连接记录 const [tableLoading, setTableLoading] = useState(false); // 连接记录
...@@ -70,118 +62,69 @@ const InitDataBase = props => { ...@@ -70,118 +62,69 @@ const InitDataBase = props => {
const [finish, setFinish] = useState(false); const [finish, setFinish] = useState(false);
const [initLoading, setInitLoading] = useState(false); const [initLoading, setInitLoading] = useState(false);
const scroll = useRef(null); const scroll = useRef(null);
// 获取数据库链接记录
// 获取数据库配置信息
useEffect(() => { useEffect(() => {
setTableLoading(true); setCardLoading(true);
// getConnRecord({ // 数据库连接记录初始化
// _version: 9999, getConnRecordData();
// dc: Date.now(), getDataBaseConfigNew().then(resnew => {
// }) setCardLoading(false);
// .then(res => { let res = resnew.data;
// setTableLoading(false);
// if (res.length > 0) {
// let arr = res.map((item, index) => {
// item.key = index;
// return item;
// });
// setData(arr);
// }
// })
// .catch(err => {
// setTableLoading(false);
// console.error(err);
// });
getConnRecordNew().then(resnew => {
setTableLoading(false);
if (resnew.code == 0) { if (resnew.code == 0) {
let res = resnew.data const { inUse } = res;
let arr = res.map((item, index) => {
item.key = index; let obj = {};
return item; Object.keys(dbForm).forEach(k => {
obj[k] = res[k];
}); });
setData(arr); form.setFieldsValue(obj);
setDbForm(val => ({ ...val, ...obj }));
setAllSqulDir(res.allSqlDir);
if (res.allSqlDir.some(item => item === inUse)) {
setDefaultSqlDir(res.tableSQLDirName);
} else {
// 默认切换到第一个产品方案
handeleChangeSQLDirName(res.allSqlDir[0]);
setDefaultSqlDir(res.allSqlDir[0]);
}
} }
}).catch(err => {
setTableLoading(false);
console.error(err);
}); });
return () => { return () => {
if (time) { if (time) {
clearTimeout(time) clearTimeout(time);
time = null time = null;
} }
} };
}, [upData]); }, []);
// 获取数据库配置信息 // 获取数据库连接记录
useEffect(() => { const getConnRecordData = () => {
setCardLoading(true); setTableLoading(true);
// getDataBaseConfig({ getConnRecordNew()
// _version: 9999, .then(resnew => {
// dc: Date.now(), setTableLoading(false);
// })
// .then(res => {
// setCardLoading(false);
// if (res.success) {
// const { inUse } = res;
// let obj = {};
// Object.keys(dbForm).forEach(k => {
// obj[k] = res[k];
// });
// form.setFieldsValue(obj);
// setDbForm(val => ({ ...val, ...obj }));
// setAllSqulDir(res.allSqlDir);
// if (res.allSqlDir.some(item => item === inUse)) {
// setDefaultSqlDir(res.tableSQLDirName);
// } else {
// // 默认切换到第一个产品方案
// handeleChangeSQLDirName(res.allSqlDir[0]);
// setDefaultSqlDir(res.allSqlDir[0]);
// }
// }
// })
// .catch(err => {
// setCardLoading(false);
// console.error(err);
// });
getDataBaseConfigNew().then(
resnew => {
setCardLoading(false);
let res = resnew.data
if (resnew.code == 0) { if (resnew.code == 0) {
const { inUse } = res; let res = resnew.data;
let arr = res.map((item, index) => {
let obj = {}; item.key = index;
Object.keys(dbForm).forEach(k => { return item;
obj[k] = res[k];
}); });
form.setFieldsValue(obj); setData(arr);
setDbForm(val => ({ ...val, ...obj }));
setAllSqulDir(res.allSqlDir);
if (res.allSqlDir.some(item => item === inUse)) {
setDefaultSqlDir(res.tableSQLDirName);
} else {
// 默认切换到第一个产品方案
handeleChangeSQLDirName(res.allSqlDir[0]);
setDefaultSqlDir(res.allSqlDir[0]);
}
} }
} })
) .catch(err => {
return () => { setTableLoading(false);
if (time) { console.error(err);
clearTimeout(time) });
time = null };
}
}
}, []);
// 获取日志 // 获取日志
const doInitLog = () => { const doInitLog = () => {
setInitLoading(true) setInitLoading(true);
getInitDBLogNew() getInitDBLogNew()
.then(res => { .then(res => {
if (res.code == 0) { if (res.code == 0) {
if (res.data.content) { if (res.data.content) {
setInitLoading(false) setInitLoading(false);
let arr = []; let arr = [];
arr.push( arr.push(
res.data.content res.data.content
...@@ -195,12 +138,11 @@ const InitDataBase = props => { ...@@ -195,12 +138,11 @@ const InitDataBase = props => {
time = setTimeout(() => { time = setTimeout(() => {
doInitLog(); doInitLog();
}, 600); }, 600);
} } else {
else { setInitLoading(false);
setInitLoading(false)
if (time) { if (time) {
clearTimeout(time) clearTimeout(time);
time = null time = null;
} }
} }
} }
...@@ -208,30 +150,6 @@ const InitDataBase = props => { ...@@ -208,30 +150,6 @@ const InitDataBase = props => {
.catch(err => { .catch(err => {
setFinish(true); setFinish(true);
}); });
// getInitDBLogNew().
// then(resnew => {
// if (resnew.code == 0) {
// let res = resnew.data
// if (res.content) {
// let arr = [];
// arr.push(
// res.content
// .split(/(\r\n)|(\n)/)
// .map((item, index) => <p key={index}>{item}</p>),
// );
// setInitContent(arr);
// scroll.current.scrollTop = scroll.current.scrollHeight;
// }
// if (!res.finish) {
// setTimeout(() => {
// doInitLog();
// }, 600);
// }
// }
// })
// .catch(err => {
// setFinish(true);
// });
}; };
// 数据库初始化 // 数据库初始化
const initClick = () => { const initClick = () => {
...@@ -240,41 +158,21 @@ const InitDataBase = props => { ...@@ -240,41 +158,21 @@ const InitDataBase = props => {
setInitVisible(true); setInitVisible(true);
let obj = form.getFieldsValue(); let obj = form.getFieldsValue();
doInitLog(); doInitLog();
// initDBv4({
// _version: 9999,
// _dc: Date.now(),
// ...obj,
// })
// .then(res => {
// setCardLoading(false);
// if (res.GetMe) {
// console.log(res);
// } else {
// notification.error({
// message: '提示',
// duration: 15,
// description: res.Say.Message || '初始化失败',
// });
// }
// })
// .catch(err => {
// setCardLoading(false);
// console.log(err);
// });
initDBv4new({ initDBv4new({
...obj ...obj,
}).then(res => {
setCardLoading(false);
if (res.code == 0) {
console.log(res);
} else {
notification.error({
message: '提示',
duration: 15,
description: res.msg || '初始化失败',
});
}
}) })
.then(res => {
setCardLoading(false);
if (res.code == 0) {
console.log(res);
} else {
notification.error({
message: '提示',
duration: 15,
description: res.msg || '初始化失败',
});
}
})
.catch(err => { .catch(err => {
setCardLoading(false); setCardLoading(false);
console.log(err); console.log(err);
...@@ -299,11 +197,12 @@ const InitDataBase = props => { ...@@ -299,11 +197,12 @@ const InitDataBase = props => {
dbName: obj.dbName, dbName: obj.dbName,
userName: obj.userName, userName: obj.userName,
password: obj.password, password: obj.password,
}).then( })
resnew => { .then(resnew => {
setCardLoading(false); setCardLoading(false);
if (resnew.code == 0) { if (resnew.code == 0) {
setUpData(upData + 1); // setUpData(upData + 1);
getConnRecordData();
notification.success({ notification.success({
message: '提示', message: '提示',
duration: 3, duration: 3,
...@@ -316,40 +215,11 @@ const InitDataBase = props => { ...@@ -316,40 +215,11 @@ const InitDataBase = props => {
description: resnew.msg, description: resnew.msg,
}); });
} }
} })
).catch(err => { .catch(err => {
setCardLoading(false); setCardLoading(false);
console.log(err); console.log(err);
}); });
// saveConnection({
// _version: 9999,
// _dc: new Date().getTime(),
// ip: obj.ip,
// dbName: obj.dbName,
// userName: obj.userName,
// password: obj.password,
// })
// .then(res => {
// setCardLoading(false);
// if (res.GetMe === true) {
// setUpData(upData + 1);
// notification.success({
// message: '提示',
// duration: 3,
// description: '保存成功',
// });
// } else {
// notification.error({
// message: '提示',
// duration: 15,
// description: res.Say.Message || '保存失败',
// });
// }
// })
// .catch(err => {
// setCardLoading(false);
// console.log(err);
// });
}; };
// 测试连接 // 测试连接
const onCheck = e => { const onCheck = e => {
...@@ -467,7 +337,7 @@ const InitDataBase = props => { ...@@ -467,7 +337,7 @@ const InitDataBase = props => {
// _version: 9999, // _version: 9999,
// _dc: Date.now(), // _dc: Date.now(),
// }); // });
deleteInitDBLogNew() deleteInitDBLogNew();
}; };
// 弹窗确认回调 // 弹窗确认回调
const modalOkCallback = () => { const modalOkCallback = () => {
...@@ -499,7 +369,8 @@ const InitDataBase = props => { ...@@ -499,7 +369,8 @@ const InitDataBase = props => {
}) })
.then(res => { .then(res => {
setModalVisible(false); setModalVisible(false);
setUpData(upData + 1); // setUpData(upData + 1);
getConnRecordData();
}) })
.catch(err => { .catch(err => {
console.error(err); console.error(err);
...@@ -516,7 +387,8 @@ const InitDataBase = props => { ...@@ -516,7 +387,8 @@ const InitDataBase = props => {
.then(res => { .then(res => {
setTableLoading(false); setTableLoading(false);
if (res.code === 0) { if (res.code === 0) {
setUpData(upData + 1); // setUpData(upData + 1);
getConnRecordData();
notification.success({ notification.success({
message: '提示', message: '提示',
duration: 3, duration: 3,
...@@ -534,25 +406,6 @@ const InitDataBase = props => { ...@@ -534,25 +406,6 @@ const InitDataBase = props => {
setTableLoading(false); setTableLoading(false);
console.error(err); console.error(err);
}); });
// deleteConnNew({
// rowIndex: key
// }).then(res => {
// setTableLoading(false);
// if (res.code == 0) {
// setUpData(upData + 1);
// notification.success({
// message: '提示',
// duration: 3,
// description: '操作成功',
// });
// } else {
// notification.error({
// message: '提示',
// duration: 15,
// description: res.msg,
// });
// }
// })
}; };
const columns = [ const columns = [
{ {
...@@ -760,7 +613,7 @@ const InitDataBase = props => { ...@@ -760,7 +613,7 @@ const InitDataBase = props => {
// _version: 9999, // _version: 9999,
// _dc: Date.now(), // _dc: Date.now(),
// }); // });
deleteInitDBLogNew() deleteInitDBLogNew();
}} }}
width={800} width={800}
maskClosable={false} maskClosable={false}
...@@ -773,6 +626,7 @@ const InitDataBase = props => { ...@@ -773,6 +626,7 @@ const InitDataBase = props => {
onClick={() => { onClick={() => {
handleClick(); handleClick();
}} }}
key="back"
type="primary" type="primary"
> >
关闭窗口 关闭窗口
......
...@@ -16,7 +16,7 @@ import { ...@@ -16,7 +16,7 @@ import {
tableCheckNew, tableCheckNew,
updateDateBase, updateDateBase,
databaseStandardGetLog, databaseStandardGetLog,
databaseStandardGetLogNew databaseStandardGetLogNew,
} from '@/services/database/api'; } from '@/services/database/api';
const ManagementDataBase = () => { const ManagementDataBase = () => {
...@@ -65,7 +65,7 @@ const ManagementDataBase = () => { ...@@ -65,7 +65,7 @@ const ManagementDataBase = () => {
setCheckLoading(false); setCheckLoading(false);
console.log(resnew); console.log(resnew);
if (resnew.code == 0) { if (resnew.code == 0) {
let res = resnew.data let res = resnew.data;
const { Autolist, ManualList } = res; const { Autolist, ManualList } = res;
// 自动检测列表 // 自动检测列表
let arr = Autolist.map((item, index) => { let arr = Autolist.map((item, index) => {
...@@ -112,7 +112,7 @@ const ManagementDataBase = () => { ...@@ -112,7 +112,7 @@ const ManagementDataBase = () => {
.then(resnew => { .then(resnew => {
setLogLoading(false); setLogLoading(false);
if (resnew.code == 0) { if (resnew.code == 0) {
let res = resnew.data.list let res = resnew.data.list;
let arr = []; let arr = [];
res.map((item, index) => { res.map((item, index) => {
item.key = index; item.key = index;
...@@ -138,7 +138,7 @@ const ManagementDataBase = () => { ...@@ -138,7 +138,7 @@ const ManagementDataBase = () => {
setCheckLoading(false); setCheckLoading(false);
setCheckFlag(checkFlag + 1); setCheckFlag(checkFlag + 1);
setUpFlag(upFlag + 1); setUpFlag(upFlag + 1);
if (res.code===0) { if (res.code === 0) {
notification.success({ notification.success({
message: '通知', message: '通知',
duration: 3, duration: 3,
...@@ -166,7 +166,7 @@ const ManagementDataBase = () => { ...@@ -166,7 +166,7 @@ const ManagementDataBase = () => {
setModalVisible(true); setModalVisible(true);
// setContent(text); // setContent(text);
setContent(arr); setContent(arr);
} };
const handleLog = (text, val) => { const handleLog = (text, val) => {
setModalTitle(val); setModalTitle(val);
let arr = []; let arr = [];
...@@ -296,11 +296,11 @@ const ManagementDataBase = () => { ...@@ -296,11 +296,11 @@ const ManagementDataBase = () => {
onClick={() => { onClick={() => {
handleLog(text, '详细信息'); handleLog(text, '详细信息');
}} }}
style={{ backgroundColor: "red" }} style={{ backgroundColor: 'red' }}
> >
错误内容 错误内容
</Button> </Button>
) );
} }
}, },
}, },
...@@ -366,7 +366,6 @@ const ManagementDataBase = () => { ...@@ -366,7 +366,6 @@ const ManagementDataBase = () => {
size="small" size="small"
/> />
</Card> </Card>
</PageContainer> </PageContainer>
<Modal <Modal
...@@ -384,7 +383,11 @@ const ManagementDataBase = () => { ...@@ -384,7 +383,11 @@ const ManagementDataBase = () => {
}} }}
style={{ top: '40px' }} style={{ top: '40px' }}
footer={[ footer={[
<Button type="primary" onClick={() => setModalVisible(false)}> <Button
type="primary"
onClick={() => setModalVisible(false)}
key="back"
>
关闭窗口 关闭窗口
</Button>, </Button>,
]} ]}
......
...@@ -203,6 +203,7 @@ const SQLServerTable = props => { ...@@ -203,6 +203,7 @@ const SQLServerTable = props => {
size="small" size="small"
type="primary" type="primary"
onClick={() => handleCon(val, item)} onClick={() => handleCon(val, item)}
key="testLink"
> >
测试连接 测试连接
</Button>, </Button>,
...@@ -213,12 +214,14 @@ const SQLServerTable = props => { ...@@ -213,12 +214,14 @@ const SQLServerTable = props => {
color: '#faad14', color: '#faad14',
borderColor: '#ffe58f', borderColor: '#ffe58f',
}} }}
key="bntEdit"
size="small" size="small"
onClick={() => handleEdit(val, item)} onClick={() => handleEdit(val, item)}
> >
编辑 编辑
</Button>, </Button>,
<Popconfirm <Popconfirm
key="btnDelete"
title={`是否删除连接${item.name}`} title={`是否删除连接${item.name}`}
cancelText="取消" cancelText="取消"
okText="确认" okText="确认"
...@@ -236,7 +239,7 @@ const SQLServerTable = props => { ...@@ -236,7 +239,7 @@ const SQLServerTable = props => {
<> <>
<ProTable <ProTable
headerTitle="SQL数据库" headerTitle="SQL数据库"
rowKey="key" rowKey="name"
search={false} search={false}
columns={columns} columns={columns}
bordered bordered
......
...@@ -161,7 +161,8 @@ const standingBook = props => { ...@@ -161,7 +161,8 @@ const standingBook = props => {
newArr.push(item) newArr.push(item)
}) })
setAllData(arr); setAllData(arr);
setPickItem(newArr[0]) // 第一次进入展示第一页 不是第一次进入根据当前选择的来进行展示
flag === 0 ? setPickItem(newArr[0]) : setPickItem(pickItem);
console.log(newArr, 'newArr'); console.log(newArr, 'newArr');
setTableData(newArr); setTableData(newArr);
} }
......
...@@ -25,7 +25,7 @@ import { ...@@ -25,7 +25,7 @@ import {
FormOutlined, FormOutlined,
EditOutlined, EditOutlined,
DeleteOutlined, DeleteOutlined,
UserAddOutlined UserAddOutlined,
} from '@ant-design/icons'; } from '@ant-design/icons';
import { import {
setMenuToRole, setMenuToRole,
...@@ -47,7 +47,7 @@ import EditModal from './EditModal'; ...@@ -47,7 +47,7 @@ import EditModal from './EditModal';
import EditGroup from './EditGroup'; import EditGroup from './EditGroup';
import userStyles from '@/pages/userCenter/userManage/UserManage.less'; import userStyles from '@/pages/userCenter/userManage/UserManage.less';
import iconStyles from '@/assets/font/omsfont/iconfont.css'; import iconStyles from '@/assets/font/omsfont/iconfont.css';
import UserModal from './UserModal' import UserModal from './UserModal';
import { data } from '@/pages/platformCenter/messageManage/projectManage/components/Mock'; import { data } from '@/pages/platformCenter/messageManage/projectManage/components/Mock';
const { Search } = Input; const { Search } = Input;
...@@ -131,7 +131,9 @@ const SiteManage = () => { ...@@ -131,7 +131,9 @@ const SiteManage = () => {
}; };
useEffect(() => { useEffect(() => {
console.log('进入');
if (!roleID) return; if (!roleID) return;
console.log('选择后');
setLoading(true); setLoading(true);
const defaultConfig = { const defaultConfig = {
optionsList: [], optionsList: [],
...@@ -146,8 +148,8 @@ const SiteManage = () => { ...@@ -146,8 +148,8 @@ const SiteManage = () => {
.then(res => { .then(res => {
const list = []; const list = [];
// eslint-disable-next-line no-unused-expressions // eslint-disable-next-line no-unused-expressions
res.code===0 && res.code === 0 &&
res.root.forEach(item => { res.data.root.forEach(item => {
list.push({ ...defaultConfig, ...item }); list.push({ ...defaultConfig, ...item });
}); });
const finalList = buildMap(list); const finalList = buildMap(list);
...@@ -189,7 +191,6 @@ const SiteManage = () => { ...@@ -189,7 +191,6 @@ const SiteManage = () => {
}; };
// 树形数据转换; // 树形数据转换;
const transTree = val => { const transTree = val => {
let arr = val; let arr = val;
let newArr = []; let newArr = [];
// 提取child里面的数组 // 提取child里面的数组
...@@ -239,27 +240,44 @@ const SiteManage = () => { ...@@ -239,27 +240,44 @@ const SiteManage = () => {
{i.roleID && ( {i.roleID && (
<> <>
<Tooltip title="编辑角色" className={styles.fs}> <Tooltip title="编辑角色" className={styles.fs}>
<FormOutlined style={{ fontSize: '16px', color: '#1890FF' }} onClick={e=>editorUser(e,i)} /> <FormOutlined
</Tooltip><Tooltip title="删除角色" className={styles.fs}> style={{ fontSize: '16px', color: '#1890FF' }}
<DeleteOutlined style={{ fontSize: '16px', color: '#1890FF' }} onClick={e=>deletesUser(e,i)} /> onClick={e => editorUser(e, i)}
</Tooltip><Tooltip title="关联用户" className={styles.fs}> />
<UserAddOutlined style={{ fontSize: '16px', color: '#1890FF' }} onClick={e=>relevancyUser(e,i)} /> </Tooltip>
</Tooltip></> <Tooltip title="删除角色" className={styles.fs}>
<DeleteOutlined
style={{ fontSize: '16px', color: '#1890FF' }}
onClick={e => deletesUser(e, i)}
/>
</Tooltip>
<Tooltip title="关联用户" className={styles.fs}>
<UserAddOutlined
style={{ fontSize: '16px', color: '#1890FF' }}
onClick={e => relevancyUser(e, i)}
/>
</Tooltip>
</>
)} )}
{!i.roleID && ( {!i.roleID && (
<Tooltip title="新增角色" className={styles.fs}> <Tooltip title="新增角色" className={styles.fs}>
<PlusSquareOutlined style={{ fontSize: '16px', color: '#1890FF' }} onClick={e=>addsUser(e,i)} /> <PlusSquareOutlined
style={{ fontSize: '16px', color: '#1890FF' }}
onClick={e => addsUser(e, i)}
/>
</Tooltip> </Tooltip>
)} )}
{i.groupflag && ( {i.groupflag && (
<Tooltip title="编辑分组" className={styles.fs}> <Tooltip title="编辑分组" className={styles.fs}>
<EditOutlined style={{ fontSize: '16px', color: '#1890FF' }} onClick={e=>editorGroup(e,i)} /> <EditOutlined
style={{ fontSize: '16px', color: '#1890FF' }}
onClick={e => editorGroup(e, i)}
/>
</Tooltip> </Tooltip>
)} )}
</div> </div>
</div> </div>
) );
i.key = i.roleID; i.key = i.roleID;
i.subSystemValue = item.visibleValue; i.subSystemValue = item.visibleValue;
i.group = itemRole.visibleTitle; i.group = itemRole.visibleTitle;
...@@ -279,7 +297,6 @@ const SiteManage = () => { ...@@ -279,7 +297,6 @@ const SiteManage = () => {
setItemObj(itemRole); setItemObj(itemRole);
// setCurrentSelectId(roleID); // setCurrentSelectId(roleID);
} }
} }
itemRole.title = ( itemRole.title = (
<div className={styles.title}> <div className={styles.title}>
...@@ -288,27 +305,44 @@ const SiteManage = () => { ...@@ -288,27 +305,44 @@ const SiteManage = () => {
{itemRole.roleID && ( {itemRole.roleID && (
<> <>
<Tooltip title="编辑角色" className={styles.fs}> <Tooltip title="编辑角色" className={styles.fs}>
<FormOutlined style={{ fontSize: '16px', color: '#1890FF' }} onClick={e=>editorUser(e,itemRole)} /> <FormOutlined
</Tooltip><Tooltip title="删除角色" className={styles.fs}> style={{ fontSize: '16px', color: '#1890FF' }}
<DeleteOutlined style={{ fontSize: '16px', color: '#1890FF' }} onClick={e=>deletesUser(e,itemRole)} /> onClick={e => editorUser(e, itemRole)}
</Tooltip><Tooltip title="关联用户" className={styles.fs}> />
<UserAddOutlined style={{ fontSize: '16px', color: '#1890FF' }} onClick={e=>relevancyUser(e,itemRole)} /> </Tooltip>
</Tooltip></> <Tooltip title="删除角色" className={styles.fs}>
<DeleteOutlined
style={{ fontSize: '16px', color: '#1890FF' }}
onClick={e => deletesUser(e, itemRole)}
/>
</Tooltip>
<Tooltip title="关联用户" className={styles.fs}>
<UserAddOutlined
style={{ fontSize: '16px', color: '#1890FF' }}
onClick={e => relevancyUser(e, itemRole)}
/>
</Tooltip>
</>
)} )}
{!itemRole.roleID && ( {!itemRole.roleID && (
<Tooltip title="新增角色" className={styles.fs}> <Tooltip title="新增角色" className={styles.fs}>
<PlusSquareOutlined style={{ fontSize: '16px', color: '#1890FF' }} onClick={e=>addsUser(e,itemRole)} /> <PlusSquareOutlined
style={{ fontSize: '16px', color: '#1890FF' }}
onClick={e => addsUser(e, itemRole)}
/>
</Tooltip> </Tooltip>
)} )}
{itemRole.groupflag && ( {itemRole.groupflag && (
<Tooltip title="编辑分组" className={styles.fs}> <Tooltip title="编辑分组" className={styles.fs}>
<EditOutlined style={{ fontSize: '16px', color: '#1890FF' }} onClick={e=>editorGroup(e,itemRole)} /> <EditOutlined
style={{ fontSize: '16px', color: '#1890FF' }}
onClick={e => editorGroup(e, itemRole)}
/>
</Tooltip> </Tooltip>
)} )}
</div> </div>
</div> </div>
) );
return itemRole; return itemRole;
}); });
} }
...@@ -320,62 +354,80 @@ const SiteManage = () => { ...@@ -320,62 +354,80 @@ const SiteManage = () => {
{item.roleID && ( {item.roleID && (
<> <>
<Tooltip title="编辑角色" className={styles.fs}> <Tooltip title="编辑角色" className={styles.fs}>
<FormOutlined style={{ fontSize: '16px', color: '#1890FF' }} onClick={e=>editorUser(e,item)} /> <FormOutlined
</Tooltip><Tooltip title="删除角色" className={styles.fs}> style={{ fontSize: '16px', color: '#1890FF' }}
<DeleteOutlined style={{ fontSize: '16px', color: '#1890FF' }} onClick={e=>deletesUser(e,item)} /> onClick={e => editorUser(e, item)}
</Tooltip><Tooltip title="关联用户" className={styles.fs}> />
<UserAddOutlined style={{ fontSize: '16px', color: '#1890FF' }} onClick={e=>relevancyUser(e,item)} /> </Tooltip>
</Tooltip></> <Tooltip title="删除角色" className={styles.fs}>
<DeleteOutlined
style={{ fontSize: '16px', color: '#1890FF' }}
onClick={e => deletesUser(e, item)}
/>
</Tooltip>
<Tooltip title="关联用户" className={styles.fs}>
<UserAddOutlined
style={{ fontSize: '16px', color: '#1890FF' }}
onClick={e => relevancyUser(e, item)}
/>
</Tooltip>
</>
)} )}
{!item.roleID && ( {!item.roleID && (
<Tooltip title="新增角色" className={styles.fs}> <Tooltip title="新增角色" className={styles.fs}>
<PlusSquareOutlined style={{ fontSize: '16px', color: '#1890FF' }} onClick={e=>addsUser(e,item)} /> <PlusSquareOutlined
style={{ fontSize: '16px', color: '#1890FF' }}
onClick={e => addsUser(e, item)}
/>
</Tooltip> </Tooltip>
)} )}
{item.groupflag && ( {item.groupflag && (
<Tooltip title="编辑分组" className={styles.fs}> <Tooltip title="编辑分组" className={styles.fs}>
<EditOutlined style={{ fontSize: '16px', color: '#1890FF' }} onClick={e=>editorGroup(e,item)} /> <EditOutlined
style={{ fontSize: '16px', color: '#1890FF' }}
onClick={e => editorGroup(e, item)}
/>
</Tooltip> </Tooltip>
)} )}
</div> </div>
</div> </div>
) );
return item; return item;
}); });
return arr3; return arr3;
}; };
//编辑角色 //编辑角色
const editorUser = (e,record) => { const editorUser = (e, record) => {
e.stopPropagation(); e.stopPropagation();
setItemObj(record); setItemObj(record);
setEditVisible(true); setEditVisible(true);
} };
//删除角色 //删除角色
const deletesUser = (e,record) => { const deletesUser = (e, record) => {
e.stopPropagation(); e.stopPropagation();
setItemObj(record); setItemObj(record);
setDelVisible(true); setDelVisible(true);
} };
//关联用户 //关联用户
const relevancyUser = (e,record) => { const relevancyUser = (e, record) => {
e.stopPropagation(); e.stopPropagation();
setItemObj(record); setItemObj(record);
setUserVisible(true) setUserVisible(true);
} };
//编辑分组 //编辑分组
const editorGroup = (e,record) => { const editorGroup = (e, record) => {
console.log(record,'1212') console.log(record, '1212');
e.stopPropagation(); e.stopPropagation();
setItemObj(record); setItemObj(record);
setGroupVisible(true); setGroupVisible(true);
} };
//新增角色 //新增角色
const addsUser = (e,record) => { const addsUser = (e, record) => {
e.stopPropagation(); e.stopPropagation();
setItemObj(record); setItemObj(record);
setModalVisible(true); setModalVisible(true);
} };
const handleChange = e => { const handleChange = e => {
const { value } = e.target; const { value } = e.target;
setSearchWord(value); setSearchWord(value);
...@@ -415,7 +467,7 @@ const SiteManage = () => { ...@@ -415,7 +467,7 @@ const SiteManage = () => {
setFlag(flag + 1); setFlag(flag + 1);
setItemObj(''); setItemObj('');
handleTreeSelect(saveCurId); handleTreeSelect(saveCurId);
} };
const valueCallback = valueObj => { const valueCallback = valueObj => {
setSubList(valueObj); setSubList(valueObj);
}; };
...@@ -437,7 +489,7 @@ const SiteManage = () => { ...@@ -437,7 +489,7 @@ const SiteManage = () => {
) )
.then(res => { .then(res => {
setBtnLoading(false); setBtnLoading(false);
if (res.msg==='Ok') { if (res.msg === 'Ok') {
setValueList([...results.flat()]); setValueList([...results.flat()]);
notification.success({ notification.success({
message: '提示', message: '提示',
...@@ -457,8 +509,8 @@ const SiteManage = () => { ...@@ -457,8 +509,8 @@ const SiteManage = () => {
}); });
}; };
const handleUserAttach = () => { const handleUserAttach = () => {
setUserVisible(true) setUserVisible(true);
} };
return ( return (
<PageContainer> <PageContainer>
<div <div
......
...@@ -47,13 +47,13 @@ const EditForm = props => { ...@@ -47,13 +47,13 @@ const EditForm = props => {
<Item <Item
label="产品包名:" label="产品包名:"
name="PackageName" name="PackageName"
rules={[ // rules={[
{ // {
required: true, // required: true,
pattern: new RegExp(/^[a-z0-9A-Z]+$/), // pattern: new RegExp(/^[a-z0-9A-Z]+$/),
message: '产品包名必须是英文或者数字', // message: '产品包名必须是英文或者数字',
}, // },
]} // ]}
> >
<Input placeholder="请输入产品包名" allowClear disabled /> <Input placeholder="请输入产品包名" allowClear disabled />
</Item> </Item>
...@@ -86,12 +86,12 @@ const EditForm = props => { ...@@ -86,12 +86,12 @@ const EditForm = props => {
<Item <Item
label="发布状态:" label="发布状态:"
name="PublishState" name="PublishState"
rules={[ // rules={[
{ // {
required: true, // required: true,
message: '请选择发布状态', // message: '请选择发布状态',
}, // },
]} // ]}
> >
<Select placeholder="请选择发布状态" disabled> <Select placeholder="请选择发布状态" disabled>
{environmentList && {environmentList &&
......
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