Commit 7b571f25 authored by Maofei94's avatar Maofei94

perf: 角色管理优化

parent 08e9235e
...@@ -9,7 +9,7 @@ module.exports = options => ({ ...@@ -9,7 +9,7 @@ module.exports = options => ({
output: Object.assign( output: Object.assign(
{ {
path: path.resolve(process.cwd(), 'build'), path: path.resolve(process.cwd(), 'build'),
publicPath: process.env.PUBLIC_PATH || '/CivManage', publicPath: process.env.PUBLIC_PATH || '/CivManage/',
}, },
options.output, options.output,
), // Merge with env dependent settings ), // Merge with env dependent settings
......
...@@ -83,7 +83,7 @@ const arr = [ ...@@ -83,7 +83,7 @@ const arr = [
</div> </div>
), ),
}, },
// CivManage后增加/ 2020-12-22
// { // {
// key: '2', // key: '2',
// label: '1.0.20201218', // label: '1.0.20201218',
......
...@@ -29,6 +29,7 @@ const dataArr = [ ...@@ -29,6 +29,7 @@ const dataArr = [
component: <MySQLTable />, component: <MySQLTable />,
}, },
]; ];
const Hr = () => <hr style={{ width: 'calc( 100% - 40px)' }} />;
const DatabaseConnectConfig = props => { const DatabaseConnectConfig = props => {
const [flag, setFlag] = useState(false); const [flag, setFlag] = useState(false);
const [active, setActive] = useState('0'); const [active, setActive] = useState('0');
...@@ -37,16 +38,28 @@ const DatabaseConnectConfig = props => { ...@@ -37,16 +38,28 @@ const DatabaseConnectConfig = props => {
console.log(e); console.log(e);
setActive(e); setActive(e);
}; };
return ( return (
<PageContainer> <PageContainer>
<Card> <Card>
<Tabs activeKey={active} onChange={e => handleChange(e)}> {/* <Tabs activeKey={active} onChange={e => handleChange(e)}>
{dataArr.map(item => ( {dataArr.map(item => (
<TabPane tab={item.title} key={item.key}> <TabPane tab={item.title} key={item.key}>
{active === item.key && item.component} {active === item.key && item.component}
</TabPane> </TabPane>
))} ))}
</Tabs> </Tabs> */}
<Hr />
<SQLServerTable />
<br />
<Hr />
<OracleTable />
<br />
<Hr />
<MongDBTable />
<br />
<Hr />
<MySQLTable />
</Card> </Card>
</PageContainer> </PageContainer>
); );
......
...@@ -214,6 +214,7 @@ const AddModal = props => { ...@@ -214,6 +214,7 @@ const AddModal = props => {
onChange={e => { onChange={e => {
handleChange(e); handleChange(e);
}} }}
disabled
> >
{typeList.map(item => ( {typeList.map(item => (
<Option value={item.value} key={item.key}> <Option value={item.value} key={item.key}>
......
...@@ -52,7 +52,7 @@ const SiteManage = () => { ...@@ -52,7 +52,7 @@ const SiteManage = () => {
const [saveTreeId, setSaveTreeId] = useState(''); // 保存点击回调的roleid const [saveTreeId, setSaveTreeId] = useState(''); // 保存点击回调的roleid
const [modalVisible, setModalVisible] = useState(false); // 新增弹窗 const [modalVisible, setModalVisible] = useState(false); // 新增弹窗
const [flag, setFlag] = useState(1); const [flag, setFlag] = useState(1);
const [itemObj, setItemObj] = useState({}); // 选择的角色item const [itemObj, setItemObj] = useState(''); // 选择的角色item
const [delVisible, setDelVisible] = useState(false); // 删除弹窗 const [delVisible, setDelVisible] = useState(false); // 删除弹窗
const [editVisible, setEditVisible] = useState(false); // 修改弹窗 const [editVisible, setEditVisible] = useState(false); // 修改弹窗
const [subList, setSubList] = useState([]); // 选中的数组 const [subList, setSubList] = useState([]); // 选中的数组
...@@ -103,7 +103,7 @@ const SiteManage = () => { ...@@ -103,7 +103,7 @@ const SiteManage = () => {
} }
}); });
return () => { return () => {
setItemObj({}); setItemObj('');
}; };
}, [flag]); }, [flag]);
...@@ -229,7 +229,9 @@ const SiteManage = () => { ...@@ -229,7 +229,9 @@ const SiteManage = () => {
i.group = itemRole.visibleTitle; i.group = itemRole.visibleTitle;
i.icon = <UserOutlined />; i.icon = <UserOutlined />;
if (roleID && roleID === i.roleID) { if (roleID && roleID === i.roleID) {
console.log(roleID, typeof roleID, 'roleID');
setItemObj(i); setItemObj(i);
// setCurrentSelectId(roleID);
} }
}); });
...@@ -240,7 +242,9 @@ const SiteManage = () => { ...@@ -240,7 +242,9 @@ const SiteManage = () => {
itemRole.subSystemValue = item.visibleValue; itemRole.subSystemValue = item.visibleValue;
itemRole.icon = <UserOutlined />; itemRole.icon = <UserOutlined />;
if (roleID && roleID === itemRole.roleID) { if (roleID && roleID === itemRole.roleID) {
console.log(roleID, typeof roleID, 'roleID');
setItemObj(itemRole); setItemObj(itemRole);
// setCurrentSelectId(roleID);
} }
} }
return itemRole; return itemRole;
...@@ -251,18 +255,16 @@ const SiteManage = () => { ...@@ -251,18 +255,16 @@ const SiteManage = () => {
}); });
return arr3; return arr3;
}; };
// 获取搜索框的值
const handleSearch = value => {
setSearchWord(value);
};
const handleChange = e => { const handleChange = e => {
const { value } = e.target; const { value } = e.target;
setSearchWord(value); setSearchWord(value);
}; };
// 确认回调 // 确认回调
const confirmModal = e => { const confirmModal = e => {
console.log(e, 'e'); console.log(e, typeof e, 'e');
setModalVisible(false); setModalVisible(false);
setRoleID(`${e}`);
setCurrentSelectId([`${e}`]);
setFlag(flag + 1); setFlag(flag + 1);
setItemObj(''); setItemObj('');
}; };
...@@ -417,7 +419,7 @@ const SiteManage = () => { ...@@ -417,7 +419,7 @@ const SiteManage = () => {
<Search <Search
allowClear allowClear
placeholder={placeholder} placeholder={placeholder}
onSearch={handleSearch} // onSearch={handleSearch}
onChange={handleChange} onChange={handleChange}
enterButton enterButton
/> />
...@@ -430,7 +432,7 @@ const SiteManage = () => { ...@@ -430,7 +432,7 @@ const SiteManage = () => {
onClick={() => { onClick={() => {
handleAdd(); handleAdd();
}} }}
disabled={itemObj.roleID} disabled={!itemObj || (itemObj && itemObj.roleID)}
> >
新增角色 新增角色
</Button> </Button>
......
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