Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivManage
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
CivManage
Commits
1c055509
Commit
1c055509
authored
Dec 06, 2023
by
皮倩雯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: '优化'
parent
6571e2d7
Pipeline
#82834
passed with stages
Changes
9
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
677 additions
and
212 deletions
+677
-212
BookConfigNew.jsx
src/pages/bsmanager/base/standingBook/BookConfigNew.jsx
+2
-15
InitDataBase.jsx
src/pages/database/InitDataBase/InitDataBase.jsx
+535
-61
InitDataBase.less
src/pages/database/InitDataBase/InitDataBase.less
+2
-9
DatabaseConfig.jsx
src/pages/database/databaseConfig/DatabaseConfig.jsx
+91
-6
AddModal.jsx
src/pages/database/databaseConfig/mysqltable/AddModal.jsx
+3
-11
AddModal.jsx
src/pages/database/databaseConfig/oracle/AddModal.jsx
+3
-11
AddModal.jsx
src/pages/database/databaseConfig/sqlServer/AddModal.jsx
+3
-11
index.jsx
src/pages/platformCenter/scheduledTasks/index.jsx
+0
-38
UserManage.jsx
src/pages/userCenter/userManage/UserManage.jsx
+38
-50
No files found.
src/pages/bsmanager/base/standingBook/BookConfigNew.jsx
View file @
1c055509
...
@@ -277,7 +277,6 @@ const BookConfigNew = props => {
...
@@ -277,7 +277,6 @@ const BookConfigNew = props => {
Ledger_ParentLedgers
(
params
).
then
(
res
=>
{
Ledger_ParentLedgers
(
params
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
setParentData
(
res
.
data
);
setParentData
(
res
.
data
);
console
.
log
(
res
,
'ressssssssssssssssss'
);
}
else
{
}
else
{
setParentData
([]);
setParentData
([]);
}
}
...
@@ -684,13 +683,7 @@ const BookConfigNew = props => {
...
@@ -684,13 +683,7 @@ const BookConfigNew = props => {
name=
"PreName"
name=
"PreName"
// rules={[{ required: true, message: '请选择分组' }]}
// rules={[{ required: true, message: '请选择分组' }]}
>
>
<
Select
<
Select
showSearch
placeholder=
"请选择父级台账"
allowClear
>
showSearch
filterOption=
{
false
}
// onSearch={onSearch}
placeholder=
"请选择父级台账"
allowClear
>
{
parentData
.
map
((
item
,
index
)
=>
(
{
parentData
.
map
((
item
,
index
)
=>
(
<
Option
value=
{
item
.
name
}
key=
{
index
}
>
<
Option
value=
{
item
.
name
}
key=
{
index
}
>
{
item
.
name
}
{
item
.
name
}
...
@@ -706,13 +699,7 @@ const BookConfigNew = props => {
...
@@ -706,13 +699,7 @@ const BookConfigNew = props => {
rules=
{
[{
required
:
true
,
message
:
'请选择分组'
}]
}
rules=
{
[{
required
:
true
,
message
:
'请选择分组'
}]
}
{
...
itemLayout
}
{
...
itemLayout
}
>
>
<
Select
<
Select
showSearch
onSearch=
{
onSearch
}
placeholder=
"请输入分组名称"
allowClear
>
showSearch
filterOption=
{
false
}
onSearch=
{
onSearch
}
placeholder=
"请输入分组名称"
allowClear
>
{
data
.
map
((
item
,
index
)
=>
(
{
data
.
map
((
item
,
index
)
=>
(
<
Option
value=
{
item
}
key=
{
index
}
>
<
Option
value=
{
item
}
key=
{
index
}
>
{
item
}
{
item
}
...
...
src/pages/database/InitDataBase/InitDataBase.jsx
View file @
1c055509
...
@@ -59,28 +59,43 @@ const InitDataBase = props => {
...
@@ -59,28 +59,43 @@ const InitDataBase = props => {
dbName
:
''
,
dbName
:
''
,
password
:
''
,
password
:
''
,
userName
:
''
,
userName
:
''
,
providerType
:
''
,
inUse
:
''
,
inUse
:
''
,
});
});
const
[
data
,
setData
]
=
useState
([]);
// 数据库链接记录
const
[
data
,
setData
]
=
useState
([]);
// 数据库链接记录
const
[
upData
,
setUpData
]
=
useState
(
1
);
// 列表刷新标记
const
[
option
,
setOption
]
=
useState
([]);
// 下拉列表数据
const
[
option
,
setOption
]
=
useState
([]);
// 下拉列表数据
const
[
desc
,
setDesc
]
=
useState
(
''
);
// 修改描述
const
[
desc
,
setDesc
]
=
useState
(
''
);
// 修改描述
const
[
allSqlDir
,
setAllSqulDir
]
=
useState
([]);
// 修改产品方案
const
[
defaultSqlDir
,
setDefaultSqlDir
]
=
useState
(
''
);
// 修改产品方案默认值
const
[
modalVisible
,
setModalVisible
]
=
useState
({
const
[
modalVisible
,
setModalVisible
]
=
useState
({
describeVisible
:
false
,
// 描述弹窗
describeVisible
:
false
,
// 描述弹窗
versionVisible
:
false
,
// 检查版本弹窗
versionVisible
:
false
,
// 检查版本弹窗
initVisible
:
false
,
// 初始化选择产品弹窗
initVisible
:
false
,
// 初始化选择产品弹窗
});
// 修改弹窗
});
// 修改弹窗
const
[
initVisible
,
setInitVisible
]
=
useState
(
false
);
// 数据库初始化弹窗
const
[
initContent
,
setInitContent
]
=
useState
(
''
);
// 数据库初始化内容
const
[
cardLoading
,
setCardLoading
]
=
useState
(
false
);
// 初始化card Loading
const
[
cardLoading
,
setCardLoading
]
=
useState
(
false
);
// 初始化card Loading
const
[
finish
,
setFinish
]
=
useState
(
false
);
const
[
initLoading
,
setInitLoading
]
=
useState
(
false
);
const
[
initList
,
setInitList
]
=
useState
([]);
// 数据库初始化产品数据
const
[
dbExists
,
setDbExists
]
=
useState
(
false
);
// 数据库是否存在
const
[
visibleModel
,
setVisibleModel
]
=
useState
(
false
);
const
[
keepDb
,
setKeepDb
]
=
useState
([]);
const
[
keepProduct
,
setKeepProduct
]
=
useState
([]);
const
scroll
=
useRef
(
null
);
const
[
keep
,
setKeep
]
=
useState
([]);
const
[
flag
,
setFlag
]
=
useState
(
0
);
const
[
flag
,
setFlag
]
=
useState
(
0
);
const
[
keepData
,
setKeepData
]
=
useState
({});
const
[
keepData
,
setKeepData
]
=
useState
({});
const
chooseDb
=
useRef
({});
const
chooseDb
=
useRef
({});
const
key
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1p2a3n4d5a6o7m8s9a10n1e2t3c4o5re'
);
//十六位十六进制数作为密钥
const
key
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1p2a3n4d5a6o7m8s9a10n1e2t3c4o5re'
);
//十六位十六进制数作为密钥
const
iv
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1234567890000000'
);
const
iv
=
CryptoJS
.
enc
.
Utf8
.
parse
(
'1234567890000000'
);
const
[
pickItem
,
setPickItem
]
=
useState
();
// 获取数据库配置信息
// 获取数据库配置信息
useEffect
(()
=>
{
useEffect
(()
=>
{
// setTimeout(() => {
// document.getElementById('pwd').removeAttribute('value');
// }, 0);
setCardLoading
(
true
);
setCardLoading
(
true
);
// 数据库连接记录初始化
// 数据库连接记录初始化
getConnRecordData
();
getConnRecordData
();
...
@@ -96,6 +111,14 @@ const InitDataBase = props => {
...
@@ -96,6 +111,14 @@ const InitDataBase = props => {
});
});
form
.
setFieldsValue
({
...
obj
});
form
.
setFieldsValue
({
...
obj
});
setDbForm
(
val
=>
({
...
val
,
...
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
]);
}
}
}
});
});
return
()
=>
{
return
()
=>
{
...
@@ -151,9 +174,72 @@ const InitDataBase = props => {
...
@@ -151,9 +174,72 @@ const InitDataBase = props => {
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
setTableLoading
(
false
);
setTableLoading
(
false
);
console
.
error
(
err
);
});
};
// 获取日志
const
doInitLog
=
()
=>
{
setInitLoading
(
true
);
getInitDBLogNew
()
.
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
res
.
data
.
content
)
{
setInitLoading
(
false
);
let
arr
=
[];
arr
.
push
(
res
.
data
.
content
.
split
(
/
(\r\n)
|
(\n)
/
).
map
((
item
,
index
)
=>
(
// eslint-disable-next-line react/no-danger
<
p
key=
{
index
}
dangerouslySetInnerHTML=
{
{
__html
:
item
}
}
/>
)),
);
console
.
log
(
arr
);
setInitContent
(
arr
);
scroll
.
current
.
scrollTop
=
scroll
.
current
.
scrollHeight
;
}
if
(
!
res
.
data
.
finish
)
{
time
=
setTimeout
(()
=>
{
doInitLog
();
},
600
);
}
else
{
setInitLoading
(
false
);
if
(
time
)
{
clearTimeout
(
time
);
time
=
null
;
}
}
}
})
.
catch
(
err
=>
{
setFinish
(
true
);
});
};
// 数据库初始化
const
initClick
=
()
=>
{
setInitContent
(
''
);
setCardLoading
(
true
);
setInitVisible
(
true
);
let
obj
=
form
.
getFieldsValue
();
doInitLog
();
initDBv4new
({
...
obj
,
})
.
then
(
res
=>
{
setCardLoading
(
false
);
if
(
res
.
code
==
0
)
{
console
.
log
(
res
);
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
15
,
description
:
res
.
msg
||
'初始化失败'
,
});
}
})
.
catch
(
err
=>
{
setCardLoading
(
false
);
console
.
log
(
err
);
});
});
};
};
const
onValuesChange
=
(
value
,
b
)
=>
{
const
onValuesChange
=
(
value
,
b
)
=>
{
form
.
setFieldsValue
(
value
);
form
.
setFieldsValue
(
value
);
};
};
...
@@ -176,7 +262,6 @@ const InitDataBase = props => {
...
@@ -176,7 +262,6 @@ const InitDataBase = props => {
dbName
:
obj
.
dbName
,
dbName
:
obj
.
dbName
,
userName
:
obj
.
userName
,
userName
:
obj
.
userName
,
password
:
pwd
,
password
:
pwd
,
providerType
:
obj
.
providerType
,
desc
:
chooseDb
.
current
.
desc
,
desc
:
chooseDb
.
current
.
desc
,
})
})
.
then
(
resnew
=>
{
.
then
(
resnew
=>
{
...
@@ -206,11 +291,7 @@ const InitDataBase = props => {
...
@@ -206,11 +291,7 @@ const InitDataBase = props => {
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
setCardLoading
(
false
);
setCardLoading
(
false
);
notification
.
error
({
console
.
log
(
err
);
message
:
'提示'
,
duration
:
15
,
description
:
err
,
});
});
});
};
};
// 测试连接
// 测试连接
...
@@ -225,7 +306,6 @@ const InitDataBase = props => {
...
@@ -225,7 +306,6 @@ const InitDataBase = props => {
ip
:
obj
.
ip
,
ip
:
obj
.
ip
,
dbName
:
obj
.
dbName
,
dbName
:
obj
.
dbName
,
userName
:
obj
.
userName
,
userName
:
obj
.
userName
,
providerType
:
obj
.
providerType
,
password
:
pwd
,
password
:
pwd
,
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
...
@@ -260,7 +340,6 @@ const InitDataBase = props => {
...
@@ -260,7 +340,6 @@ const InitDataBase = props => {
userName
:
params
.
userName
||
''
,
userName
:
params
.
userName
||
''
,
password
:
pwd
||
''
,
password
:
pwd
||
''
,
ip
:
params
.
ip
||
''
,
ip
:
params
.
ip
||
''
,
providerType
:
params
.
providerType
||
''
,
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
if
(
res
.
code
==
0
)
{
if
(
res
.
code
==
0
)
{
...
@@ -287,7 +366,33 @@ const InitDataBase = props => {
...
@@ -287,7 +366,33 @@ const InitDataBase = props => {
chooseDb
.
current
=
item
;
chooseDb
.
current
=
item
;
form
.
setFieldsValue
({
...
obj
});
form
.
setFieldsValue
({
...
obj
});
};
};
// 产品方案选择框回调
const
handleSelect
=
value
=>
{
handeleChangeSQLDirName
(
value
);
};
const
handeleChangeSQLDirName
=
val
=>
{
setTableSQLDirName
({
dirName
:
val
,
})
.
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
notification
.
success
({
message
:
'提示'
,
duration
:
3
,
description
:
`已切换初始化脚本为:
${
val
}
`
,
});
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
15
,
description
:
res
.
message
,
});
}
})
.
catch
(
err
=>
{
console
.
error
(
err
);
});
};
// 展示修改描述
// 展示修改描述
const
changeDesc
=
val
=>
{
const
changeDesc
=
val
=>
{
setDesc
(
val
);
setDesc
(
val
);
...
@@ -297,35 +402,300 @@ const InitDataBase = props => {
...
@@ -297,35 +402,300 @@ const InitDataBase = props => {
const
{
value
}
=
e
.
target
;
const
{
value
}
=
e
.
target
;
setDesc
(
value
);
setDesc
(
value
);
};
};
// 关闭弹窗
const
handleClick
=
()
=>
{
setInitVisible
(
false
);
setInitContent
(
''
);
setFinish
(
false
);
// deleteInitDBLog({
// _version: 9999,
// _dc: Date.now(),
// });
deleteInitDBLogNew
();
};
// 弹窗确认回调
// 弹窗确认回调
const
modalOkCallback
=
()
=>
{
const
modalOkCallback
=
()
=>
{
const
obj
=
form
.
getFieldsValue
();
// 更新描述
// 更新描述
updateConnDescNew
({
updateConnDescNew
({
ip
:
pickItem
.
ip
,
ip
:
obj
.
ip
,
dbName
:
pickItem
.
dbName
,
dbName
:
obj
.
dbName
,
userName
:
pickItem
.
userName
,
userName
:
obj
.
userName
,
password
:
pickItem
.
password
,
password
:
obj
.
password
,
providerType
:
pickItem
.
providerType
,
desc
,
desc
,
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
handleShowModal
(
'describeVisible'
,
false
);
handleShowModal
(
'describeVisible'
,
false
);
// setUpData(upData + 1);
getConnRecordData
();
})
.
catch
(
err
=>
{
console
.
error
(
err
);
handleShowModal
(
'describeVisible'
,
false
);
});
};
// 删除数据库连接记录
const
delConfirm
=
value
=>
{
const
{
key
=
''
}
=
value
;
setTableLoading
(
true
);
deleteConnNew
({
rowIndex
:
key
,
})
.
then
(
res
=>
{
setTableLoading
(
false
);
if
(
res
.
code
===
0
)
{
// setUpData(upData + 1);
getConnRecordData
();
getConnRecordData
();
notification
.
success
({
message
:
'提示'
,
duration
:
3
,
description
:
'操作成功'
,
});
}
else
{
}
else
{
notification
.
error
({
notification
.
error
({
message
:
'提示'
,
message
:
'提示'
,
duration
:
5
,
duration
:
1
5
,
description
:
res
.
msg
,
description
:
res
.
msg
,
});
});
}
}
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
handleShowModal
(
'describeVisible'
,
false
);
setTableLoading
(
false
);
console
.
error
(
err
);
});
});
};
};
const
GetDb
=
()
=>
{
let
obj
=
form
.
getFieldsValue
();
GetDbProduct
({
...
obj
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
console
.
log
(
res
.
data
);
if
(
res
.
data
.
Product
)
{
console
.
log
(
res
.
data
.
Product
);
let
aa
=
[];
res
.
data
.
Product
.
map
(
i
=>
{
aa
.
push
(
i
.
name
);
});
console
.
log
(
aa
);
setKeep
(
res
.
data
.
IsAuthorize
);
setKeepProduct
(
aa
);
}
setDbExists
(
res
.
data
.
DBExists
);
setKeepDb
(
res
.
data
);
if
(
!
res
.
data
.
DBExists
)
{
setVisibleModel
(
true
);
}
else
if
(
res
.
data
.
DBExists
&&
res
.
data
.
Product
.
length
>
0
)
{
setVisibleModel
(
true
);
}
else
{
notification
.
warning
({
message
:
'提示'
,
duration
:
15
,
description
:
'当前数据库不可初始化'
,
});
}
}
else
{
notification
.
warning
({
message
:
'提示'
,
duration
:
15
,
description
:
res
.
msg
,
});
}
});
};
// 获取数据库初始化回显列表
const
getInitList
=
()
=>
{
setInitList
([]);
handleShowModal
(
'initVisible'
,
true
);
setInitLoading
(
true
);
let
obj
=
form
.
getFieldsValue
();
let
req1
=
GetProductList
();
let
req2
=
GetDbProduct
({
...
obj
});
Promise
.
all
([
req1
,
req2
])
.
then
(
res
=>
{
if
(
res
[
1
].
code
!==
0
||
res
[
0
].
code
!==
0
)
{
setInitLoading
(
false
);
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
'连接失败'
,
});
return
;
}
setDbExists
(
res
[
1
].
data
.
DBExists
);
let
fileList
=
res
[
0
].
data
?
res
[
0
].
data
:
[];
let
dataList
=
res
[
1
].
data
.
Product
?
res
[
1
].
data
.
Product
:
[];
// 没有库或者dataList为[]直接用fileList作为回显
if
(
!
res
[
1
].
data
.
DBExists
||
dataList
.
length
===
0
)
{
setInitList
(
fileList
);
setInitLoading
(
false
);
return
;
}
let
mapList
=
new
Map
();
// 通过map给数据库中中的节点中的key的值当作key,checkVersion当作value进行存储
dataList
.
forEach
(
element
=>
{
// 存入一级目录是否有选中项的key
mapList
.
set
(
element
.
key
,
element
.
check
);
element
.
modularSolutions
.
forEach
(
item
=>
{
// 存入二级目录对应的选中的checkVersion跟check
mapList
.
set
(
item
.
key
,
{
checkVersion
:
item
.
checkVersion
,
check
:
item
.
check
,
});
item
.
functionrSolutions
.
forEach
(
val
=>
{
// 存入三级目录对应的选中的checkVersion跟check
mapList
.
set
(
val
.
key
,
val
.
isCheck
);
});
});
});
console
.
log
(
mapList
,
'mapList'
);
fileList
.
forEach
(
element
=>
{
// 根据key来获取第一级目录tab的check
let
tabKey
=
mapList
.
get
(
element
.
key
);
element
.
check
=
tabKey
===
undefined
?
null
:
tabKey
;
element
.
modularSolutions
.
forEach
(
item
=>
{
let
mapCheckVersion
=
mapList
.
get
(
item
.
key
);
if
(
mapCheckVersion
===
undefined
)
{
mapCheckVersion
=
{
checkVersion
:
null
,
check
:
null
};
}
// 根据key值去匹配对应的checkVersion
item
.
checkVersion
=
mapCheckVersion
.
checkVersion
===
undefined
?
null
:
mapCheckVersion
.
checkVersion
;
// 根据key值去匹配对应的二级目录的check
item
.
check
=
mapCheckVersion
.
check
===
undefined
?
null
:
mapCheckVersion
.
check
;
if
(
item
.
check
)
{
item
.
hasCheck
=
true
;
}
item
.
functionrSolutions
.
forEach
(
val
=>
{
// 根据三级目录对应的选中key匹配isCheck
let
isCheck
=
mapList
.
get
(
val
.
key
);
val
.
isCheck
=
isCheck
===
undefined
?
null
:
isCheck
;
// 版本号低于当前版本号禁止选用
if
(
item
.
checkVersion
&&
val
.
version
<
item
.
checkVersion
)
{
val
.
disabled
=
true
;
}
else
{
val
.
disabled
=
false
;
}
});
});
});
setInitList
(
fileList
);
setInitLoading
(
false
);
})
.
catch
(
err
=>
{
console
.
log
(
err
,
'err'
);
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
'连接失败'
,
});
setInitLoading
(
false
);
});
};
// 初始化产品列表渲染
const
renderInitListItem
=
(
tabItem
,
index
)
=>
(
<
TabPane
tab=
{
tabItem
.
productName
}
key=
{
index
}
>
<
div
className=
{
styles
.
tabContainer
}
>
{
tabItem
.
modularSolutions
.
map
((
item
,
num
)
=>
(
<
React
.
Fragment
key=
{
item
.
key
}
>
{
item
.
functionrSolutions
.
length
>
0
?
(
<
RadioBox
radioTitle=
{
item
.
modularName
}
radioOptions=
{
item
.
functionrSolutions
}
currentVal=
{
item
.
checkVersion
}
currentIndex=
{
{
tabIndex
:
index
,
radioIndex
:
num
}
}
callBack=
{
radioChange
}
/>
)
:
null
}
</
React
.
Fragment
>
))
}
</
div
>
</
TabPane
>
);
// 单选选后的回调,改变数据
const
radioChange
=
(
index
,
value
)
=>
{
setInitList
(
val
=>
{
const
list
=
JSON
.
parse
(
JSON
.
stringify
(
val
));
const
secondList
=
list
[
index
.
tabIndex
].
modularSolutions
[
index
.
radioIndex
];
// 取消功能 一开始未选中的才能取消
if
(
value
===
secondList
.
checkVersion
&&
!
secondList
.
hasCheck
)
{
secondList
.
checkVersion
=
null
;
value
=
null
;
secondList
.
check
=
false
;
}
else
{
// 修改选中的checkVersion值
secondList
.
checkVersion
=
value
;
// 修改二级菜单的check字段
secondList
.
check
=
true
;
}
// 修改一级菜单的check字段
list
[
index
.
tabIndex
].
check
=
!
list
[
index
.
tabIndex
].
modularSolutions
.
every
(
version
=>
version
.
checkVersion
===
null
,
);
// 修改单选isCheck字段
secondList
.
functionrSolutions
.
forEach
(
item
=>
{
if
(
item
.
version
===
value
)
{
item
.
isCheck
=
true
;
}
else
{
item
.
isCheck
=
false
;
}
});
return
list
;
});
};
const
onOK
=
(
arr
,
code
)
=>
{
initDatabasePro
(
arr
,
code
);
};
// 数据库初始化
const
initDatabasePro
=
(
e
,
j
)
=>
{
let
productSetting
=
e
;
let
obj
=
form
.
getFieldsValue
();
// 数据库存在调用编辑接口否则调用新增接口
setInitLoading
(
true
);
setVisibleModel
(
false
);
handleShowModal
(
'initVisible'
,
false
);
setInitVisible
(
true
);
doInitLog
();
if
(
dbExists
)
{
InitEditDataBase
({
...
obj
,
productSetting
,
license
:
j
,
password
:
obj
.
password
,
}).
then
(
res
=>
{
setInitLoading
(
false
);
if
(
res
.
code
===
0
)
{
notification
.
success
({
message
:
'提示'
,
duration
:
3
,
description
:
'数据库初始化成功'
,
});
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
5
,
description
:
res
.
msg
,
});
}
});
return
;
}
InitAddDataBase
({
...
obj
,
productSetting
,
license
:
j
}).
then
(
res
=>
{
setInitLoading
(
false
);
if
(
res
.
code
===
0
)
{
notification
.
success
({
message
:
'提示'
,
duration
:
3
,
description
:
'数据库初始化成功'
,
});
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
5
,
description
:
res
.
msg
,
});
}
});
};
const
columns
=
[
const
columns
=
[
{
{
title
:
'服务器名或IP地址'
,
title
:
'服务器名或IP地址'
,
...
@@ -333,7 +703,6 @@ const InitDataBase = props => {
...
@@ -333,7 +703,6 @@ const InitDataBase = props => {
key
:
'ip'
,
key
:
'ip'
,
width
:
180
,
width
:
180
,
ellipsis
:
true
,
ellipsis
:
true
,
align
:
'center'
,
},
},
{
{
title
:
'数据库名称'
,
title
:
'数据库名称'
,
...
@@ -341,7 +710,6 @@ const InitDataBase = props => {
...
@@ -341,7 +710,6 @@ const InitDataBase = props => {
key
:
'dbName'
,
key
:
'dbName'
,
width
:
180
,
width
:
180
,
ellipsis
:
true
,
ellipsis
:
true
,
align
:
'center'
,
},
},
{
{
title
:
'数据库用户名称'
,
title
:
'数据库用户名称'
,
...
@@ -349,7 +717,6 @@ const InitDataBase = props => {
...
@@ -349,7 +717,6 @@ const InitDataBase = props => {
key
:
'userName'
,
key
:
'userName'
,
width
:
180
,
width
:
180
,
ellipsis
:
true
,
ellipsis
:
true
,
align
:
'center'
,
},
},
{
{
title
:
'保存时间'
,
title
:
'保存时间'
,
...
@@ -357,22 +724,12 @@ const InitDataBase = props => {
...
@@ -357,22 +724,12 @@ const InitDataBase = props => {
key
:
'saveTime'
,
key
:
'saveTime'
,
width
:
180
,
width
:
180
,
ellipsis
:
true
,
ellipsis
:
true
,
align
:
'center'
,
},
{
title
:
'数据库类型'
,
dataIndex
:
'providerType'
,
key
:
'providerType'
,
width
:
180
,
ellipsis
:
true
,
align
:
'center'
,
},
},
{
{
title
:
'描述'
,
title
:
'描述'
,
dataIndex
:
'desc'
,
dataIndex
:
'desc'
,
key
:
'desc'
,
key
:
'desc'
,
ellipsis
:
true
,
ellipsis
:
true
,
align
:
'center'
,
},
},
{
{
title
:
'操作'
,
title
:
'操作'
,
...
@@ -380,33 +737,64 @@ const InitDataBase = props => {
...
@@ -380,33 +737,64 @@ const InitDataBase = props => {
key
:
'action'
,
key
:
'action'
,
width
:
250
,
width
:
250
,
ellipsis
:
true
,
ellipsis
:
true
,
align
:
'center'
,
render
:
(
text
,
record
)
=>
(
render
:
(
text
,
record
)
=>
(
<
Space
>
<
Space
>
<
Button
<
Button
type=
"primary"
type=
"primary"
size=
"small"
size=
"small"
onClick=
{
e
=>
{
onClick=
{
()
=>
{
e
.
stopPropagation
();
changeDesc
(
record
.
desc
);
changeDesc
(
record
.
desc
);
setPickItem
(
record
);
}
}
}
}
>
>
修改描述
修改描述
</
Button
>
</
Button
>
{
/* <div onClick={e => e.stopPropagation()}>
<Popconfirm
title="是否删除该连接的历史记录?"
okText="确认"
cancelText="取消"
onConfirm={() => {
delConfirm(record);
}}
>
<Button size="small" danger>
删除
</Button>
</Popconfirm>
</div> */
}
</
Space
>
</
Space
>
),
),
},
},
];
];
const
flagChange
=
()
=>
{
const
obj
=
form
.
getFieldsValue
();
console
.
log
(
keepData
);
console
.
log
(
obj
);
if
(
keepData
.
ip
==
obj
.
ip
&&
keepData
.
dbName
==
obj
.
dbName
&&
keepData
.
userName
==
obj
.
userName
&&
keepData
.
password
==
obj
.
password
)
{
GetDb
();
deleteInitDBLogNew
();
}
else
{
notification
.
warning
({
message
:
'提示'
,
duration
:
15
,
description
:
'请先保存连接'
,
});
}
};
return
(
return
(
<>
<>
<
PageContainer
className=
{
styles
.
InitDataBaseContainer
}
>
<
PageContainer
className=
{
styles
.
InitDataBaseContainer
}
>
<
Card
className=
{
styles
.
cardTop
}
>
<
Card
>
<
Spin
tip=
"loading..."
spinning=
{
cardLoading
}
>
<
Spin
tip=
"loading..."
spinning=
{
cardLoading
}
>
{
/* <div className={styles.tableTitle}>数据库初始化</div> */
}
{
/* <div className={styles.tableTitle}>数据库初始化</div> */
}
<
Form
<
Form
className=
{
styles
.
cardBottom
}
className=
{
styles
.
mgTop20
}
layout=
"horizontal"
layout=
"horizontal"
labelAlign=
"left"
labelAlign=
"left"
labelCol=
{
{
span
:
3
}
}
labelCol=
{
{
span
:
3
}
}
...
@@ -415,25 +803,6 @@ const InitDataBase = props => {
...
@@ -415,25 +803,6 @@ const InitDataBase = props => {
onValuesChange=
{
onValuesChange
}
onValuesChange=
{
onValuesChange
}
autoComplete=
"off"
autoComplete=
"off"
>
>
<
Form
.
Item
label=
"数据库类型"
name=
"providerType"
rules=
{
[
{
validator
:
(
rule
,
value
)
=>
{
if
(
form
.
getFieldValue
().
providerType
==
''
)
{
return
Promise
.
reject
(
'ip必填'
);
}
return
Promise
.
resolve
();
},
},
]
}
>
<
Select
placeholder=
"请选择数据库类型"
>
<
Select
.
Option
value=
"SqlServer"
>
SqlServer
</
Select
.
Option
>
<
Select
.
Option
value=
"Dm"
>
Dm
</
Select
.
Option
>
</
Select
>
</
Form
.
Item
>
<
Form
.
Item
<
Form
.
Item
label=
{
`${formLables.ip}:`
}
label=
{
`${formLables.ip}:`
}
name=
"ip"
name=
"ip"
...
@@ -494,6 +863,7 @@ const InitDataBase = props => {
...
@@ -494,6 +863,7 @@ const InitDataBase = props => {
rules=
{
[
rules=
{
[
{
{
validator
:
(
rule
,
value
)
=>
{
validator
:
(
rule
,
value
)
=>
{
console
.
log
(
form
.
getFieldValue
().
dbName
);
if
(
if
(
form
.
getFieldValue
().
dbName
==
''
||
form
.
getFieldValue
().
dbName
==
''
||
form
.
getFieldValue
().
dbName
==
undefined
form
.
getFieldValue
().
dbName
==
undefined
...
@@ -518,6 +888,7 @@ const InitDataBase = props => {
...
@@ -518,6 +888,7 @@ const InitDataBase = props => {
}
}
}
}
// eslint-disable-next-line no-shadow
// eslint-disable-next-line no-shadow
filterOption=
{
(
input
,
option
)
=>
{
filterOption=
{
(
input
,
option
)
=>
{
console
.
log
(
option
);
return
(
return
(
option
.
children
&&
option
.
children
&&
option
.
children
.
toLowerCase
().
indexOf
(
input
.
toLowerCase
())
>=
0
option
.
children
.
toLowerCase
().
indexOf
(
input
.
toLowerCase
())
>=
0
...
@@ -542,6 +913,20 @@ const InitDataBase = props => {
...
@@ -542,6 +913,20 @@ const InitDataBase = props => {
保存连接
保存连接
</
Button
>
</
Button
>
</
Space
>
</
Space
>
<
Space
>
{
/* <Button
type="primary"
// onClick={() => {
// getInitList();
// deleteInitDBLogNew();
// }}
onClick={() => {
flagChange();
}}
>
数据库初始化
</Button> */
}
</
Space
>
</
Space
>
</
Space
>
</
div
>
</
div
>
</
Form
.
Item
>
</
Form
.
Item
>
...
@@ -549,7 +934,7 @@ const InitDataBase = props => {
...
@@ -549,7 +934,7 @@ const InitDataBase = props => {
</
Spin
>
</
Spin
>
</
Card
>
</
Card
>
<
Card
className=
{
styles
.
cardBottom
}
>
<
Card
className=
{
styles
.
mgTop20
}
>
<
div
className=
{
styles
.
recordBox
}
>
<
div
className=
{
styles
.
recordBox
}
>
<
div
className=
{
styles
.
tableTitle
}
>
近期保存的数据库连接
</
div
>
<
div
className=
{
styles
.
tableTitle
}
>
近期保存的数据库连接
</
div
>
<
Table
<
Table
...
@@ -570,6 +955,54 @@ const InitDataBase = props => {
...
@@ -570,6 +955,54 @@ const InitDataBase = props => {
/>
/>
</
div
>
</
div
>
</
Card
>
</
Card
>
<
Modal
title=
"初始化数据库"
visible=
{
initVisible
}
onCancel=
{
()
=>
{
setInitVisible
(
false
);
setInitContent
(
''
);
// deleteInitDBLog(
{
// _version: 9999,
// _dc: Date.now(),
//
});
deleteInitDBLogNew
();
}
}
width=
{
800
}
maskClosable=
{
false
}
bodyStyle=
{
{
height
:
'500px'
,
// overflowY: 'auto',
}
}
footer=
{
[
<
Button
onClick=
{
()
=>
{
handleClick
();
}
}
key=
"back"
type=
"primary"
>
关闭窗口
</
Button
>,
]
}
>
<
div
ref=
{
scroll
}
style=
{
{
maxHeight
:
'470px'
,
overflowY
:
'auto'
,
marginRight
:
' -24px'
,
}
}
>
{
initContent
||
(
<
Spin
spinning=
{
initLoading
}
tip=
"loading..."
style=
{
{
width
:
'100%'
,
marginTop
:
'40px'
}
}
/>
)
}
</
div
>
</
Modal
>
<
Modal
<
Modal
title=
"修改链接描述"
title=
"修改链接描述"
visible=
{
modalVisible
.
describeVisible
}
visible=
{
modalVisible
.
describeVisible
}
...
@@ -600,6 +1033,47 @@ const InitDataBase = props => {
...
@@ -600,6 +1033,47 @@ const InitDataBase = props => {
</
Col
>
</
Col
>
</
Row
>
</
Row
>
</
Modal
>
</
Modal
>
<
InitModal
visible=
{
visibleModel
}
onCancel=
{
()
=>
setVisibleModel
(
false
)
}
keepDb=
{
keepDb
}
callBackSubmit=
{
onOK
}
keepProduct=
{
keepProduct
}
keep=
{
keep
}
/>
{
/* 初始化选择产品弹窗 */
}
<
Modal
title=
"初始化"
maskClosable=
{
false
}
visible=
{
modalVisible
.
initVisible
}
onCancel=
{
()
=>
handleShowModal
(
'initVisible'
,
false
)
}
footer=
{
[
<
Button
key=
"back"
onClick=
{
()
=>
handleShowModal
(
'initVisible'
,
false
)
}
>
取消
</
Button
>,
<
Popconfirm
placement=
"topLeft"
title=
"是否确认初始化"
onConfirm=
{
initDatabasePro
}
okText=
"确认"
key=
"submit"
cancelText=
"取消"
>
<
Button
type=
"primary"
loading=
{
initLoading
}
>
确认
</
Button
>
</
Popconfirm
>,
]
}
width=
{
900
}
>
<
Spin
spinning=
{
initLoading
}
>
<
div
className=
{
styles
.
cardContainer
}
>
<
Tabs
defaultActiveKey=
"1"
type=
"card"
tabBarGutter=
{
-
1
}
>
{
initList
.
map
((
item
,
index
)
=>
renderInitListItem
(
item
,
index
))
}
</
Tabs
>
</
div
>
</
Spin
>
</
Modal
>
</
PageContainer
>
</
PageContainer
>
</>
</>
);
);
...
...
src/pages/database/InitDataBase/InitDataBase.less
View file @
1c055509
...
@@ -21,19 +21,12 @@
...
@@ -21,19 +21,12 @@
}
}
.InitDataBaseContainer {
.InitDataBaseContainer {
width: 100%;
height: 100%;
.ant-card-body {
.ant-card-body {
padding-bottom: 0px !important;
padding-bottom: 0px !important;
}
}
.cardTop {
.mgTop20 {
height: 350px;
margin-top: 20px;
width: 100%;
}
.cardBottom {
height: calc(100% - 350px);
height: calc(100% - 350px);
}
}
...
...
src/pages/database/databaseConfig/DatabaseConfig.jsx
View file @
1c055509
import
React
,
{
useEffect
}
from
'react'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Card
,
notification
}
from
'antd'
;
import
{
Card
,
Tabs
,
Form
,
Input
,
Button
,
notification
}
from
'antd'
;
import
{
CheckOutlined
,
CloseOutlined
}
from
'@ant-design/icons'
;
import
{
SaveMainServer
,
GetMainServer
,
DeleteMainServer
}
from
'@/services/database/api'
;
import
PageContainer
from
'@/components/BasePageContainer'
;
import
PageContainer
from
'@/components/BasePageContainer'
;
import
SQLServerTable
from
'./sqlServer/SQLServerTable'
;
import
SQLServerTable
from
'./sqlServer/SQLServerTable'
;
import
DmTable
from
'./dm/DmTable'
;
import
OracleTable
from
'./oracle/OracleTable'
;
import
OracleTable
from
'./oracle/OracleTable'
;
import
MongDBTable
from
'./mongDB/MongDBTable'
;
import
MongDBTable
from
'./mongDB/MongDBTable'
;
import
MySQLTable
from
'./mysqltable/MySQLTable'
;
import
MySQLTable
from
'./mysqltable/MySQLTable'
;
import
MasterTable
from
'./master/MasterTable'
;
import
MasterTable
from
'./master/MasterTable'
;
const
{
TabPane
}
=
Tabs
;
const
dataArr
=
[
{
title
:
'SQLServer数据库连接'
,
key
:
'0'
,
component
:
<
SQLServerTable
/>,
},
{
title
:
'Oracle数据库连接'
,
key
:
'1'
,
component
:
<
OracleTable
/>,
},
{
title
:
'MongoDB数据库连接'
,
key
:
'2'
,
component
:
<
MongDBTable
/>,
},
{
title
:
'MySQL数据库连接'
,
key
:
'3'
,
component
:
<
MySQLTable
/>,
},
];
const
Hr
=
()
=>
<
hr
style=
{
{
width
:
'calc( 100% - 40px)'
}
}
/>;
const
DatabaseConnectConfig
=
props
=>
{
const
DatabaseConnectConfig
=
props
=>
{
const
[
form
]
=
Form
.
useForm
();
const
[
flag
,
setFlag
]
=
useState
(
false
);
const
[
active
,
setActive
]
=
useState
(
'0'
);
const
[
isLink
,
setIsLink
]
=
useState
(
false
);
//主站配置是否连接
useEffect
(()
=>
{
getData
();
},
[]);
const
handleChange
=
e
=>
{
setActive
(
e
);
};
const
getData
=
()
=>
{
GetMainServer
().
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
form
.
setFieldsValue
({
url
:
res
.
data
});
// if (res.data) {
// setIsLink(true);
// form.setFieldsValue({ url: res.data });
// } else {
// setIsLink(false);
// form.setFieldsValue({ url: window.location.origin });
// }
}
});
};
const
deleteConfig
=
()
=>
{
DeleteMainServer
().
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
notification
.
success
({
message
:
'提示'
,
duration
:
3
,
description
:
'删除成功'
});
getData
();
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
res
.
msg
});
}
});
};
// 提交主站配置
const
onFinish
=
values
=>
{
console
.
log
(
'Success:'
,
values
);
SaveMainServer
(
values
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
notification
.
success
({
message
:
'提示'
,
duration
:
3
,
description
:
'保存成功'
,
});
getData
();
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
res
.
msg
,
});
}
});
};
return
(
return
(
<
PageContainer
>
<
PageContainer
>
<
div
style=
{
{
width
:
'100%'
,
height
:
'100%'
,
overflowY
:
'scroll'
}
}
>
<
div
style=
{
{
width
:
'100%'
,
height
:
'100%'
,
overflowY
:
'scroll'
}
}
>
<
Card
>
<
Card
>
{
/* <Tabs activeKey={active} onChange={e => handleChange(e)}>
{dataArr.map(item => (
<TabPane tab={item.title} key={item.key}>
{active === item.key && item.component}
</TabPane>
))}
</Tabs> */
}
<
div
style=
{
{
marginBottom
:
'15px'
}
}
>
<
div
style=
{
{
marginBottom
:
'15px'
}
}
>
<
SQLServerTable
/>
<
SQLServerTable
/>
</
div
>
</
div
>
<
div
style=
{
{
marginBottom
:
'15px'
}
}
>
<
DmTable
/>
</
div
>
<
div
style=
{
{
marginBottom
:
'15px'
}
}
>
<
div
style=
{
{
marginBottom
:
'15px'
}
}
>
<
OracleTable
/>
<
OracleTable
/>
</
div
>
</
div
>
...
...
src/pages/database/databaseConfig/mysqltable/AddModal.jsx
View file @
1c055509
...
@@ -42,15 +42,11 @@ const AddModal = props => {
...
@@ -42,15 +42,11 @@ const AddModal = props => {
if
(
validate
)
{
if
(
validate
)
{
setLoading
(
true
);
setLoading
(
true
);
let
obj
=
form
.
getFieldsValue
();
let
obj
=
form
.
getFieldsValue
();
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
||
Decrypt
(
obj
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
if
(
type
===
'add'
)
{
if
(
type
===
'add'
)
{
AddConnString
({
AddConnString
({
type
:
'mysql'
,
type
:
'mysql'
,
...
obj
,
...
obj
,
password
:
pwd
,
password
:
Encrypt
(
obj
.
password
)
,
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
setLoading
(
false
);
setLoading
(
false
);
...
@@ -82,15 +78,11 @@ const AddModal = props => {
...
@@ -82,15 +78,11 @@ const AddModal = props => {
};
};
const
handleEdit
=
()
=>
{
const
handleEdit
=
()
=>
{
let
obj
=
form
.
getFieldsValue
();
let
obj
=
form
.
getFieldsValue
();
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
||
Decrypt
(
obj
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
EditConnString
({
EditConnString
({
type
:
'mysql'
,
type
:
'mysql'
,
...
obj
,
...
obj
,
oldName
:
formObj
.
name
,
oldName
:
formObj
.
name
,
password
:
pwd
,
password
:
Encrypt
(
obj
.
password
)
,
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
setLoading
(
false
);
setLoading
(
false
);
...
@@ -120,7 +112,7 @@ const AddModal = props => {
...
@@ -120,7 +112,7 @@ const AddModal = props => {
form
.
setFieldsValue
({
port
:
3306
});
form
.
setFieldsValue
({
port
:
3306
});
break
;
break
;
case
'edit'
:
case
'edit'
:
form
.
setFieldsValue
({
...
formObj
,
password
:
formObj
.
password
});
form
.
setFieldsValue
({
...
formObj
,
password
:
Decrypt
(
formObj
.
password
)
});
if
(
!
formObj
.
port
)
{
if
(
!
formObj
.
port
)
{
form
.
setFieldsValue
({
port
:
3306
});
form
.
setFieldsValue
({
port
:
3306
});
}
}
...
...
src/pages/database/databaseConfig/oracle/AddModal.jsx
View file @
1c055509
...
@@ -42,15 +42,11 @@ const AddModal = props => {
...
@@ -42,15 +42,11 @@ const AddModal = props => {
if
(
validate
)
{
if
(
validate
)
{
setLoading
(
true
);
setLoading
(
true
);
let
obj
=
form
.
getFieldsValue
();
let
obj
=
form
.
getFieldsValue
();
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
||
Decrypt
(
obj
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
if
(
type
===
'add'
)
{
if
(
type
===
'add'
)
{
AddConnString
({
AddConnString
({
...
obj
,
...
obj
,
type
:
'oracle'
,
type
:
'oracle'
,
password
:
pwd
,
password
:
Encrypt
(
obj
.
password
)
,
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
setLoading
(
false
);
setLoading
(
false
);
...
@@ -82,15 +78,11 @@ const AddModal = props => {
...
@@ -82,15 +78,11 @@ const AddModal = props => {
};
};
const
handleEdit
=
()
=>
{
const
handleEdit
=
()
=>
{
let
obj
=
form
.
getFieldsValue
();
let
obj
=
form
.
getFieldsValue
();
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
||
Decrypt
(
obj
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
EditConnString
({
EditConnString
({
type
:
'oracle'
,
type
:
'oracle'
,
...
obj
,
...
obj
,
oldName
:
formObj
.
name
,
oldName
:
formObj
.
name
,
password
:
pwd
,
password
:
Encrypt
(
obj
.
password
)
,
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
setLoading
(
false
);
setLoading
(
false
);
...
@@ -119,7 +111,7 @@ const AddModal = props => {
...
@@ -119,7 +111,7 @@ const AddModal = props => {
form
.
resetFields
();
form
.
resetFields
();
break
;
break
;
case
'edit'
:
case
'edit'
:
form
.
setFieldsValue
({
...
formObj
,
password
:
formObj
.
password
});
form
.
setFieldsValue
({
...
formObj
,
password
:
Decrypt
(
formObj
.
password
)
});
break
;
break
;
default
:
default
:
break
;
break
;
...
...
src/pages/database/databaseConfig/sqlServer/AddModal.jsx
View file @
1c055509
...
@@ -42,15 +42,11 @@ const AddModal = props => {
...
@@ -42,15 +42,11 @@ const AddModal = props => {
if
(
validate
)
{
if
(
validate
)
{
setLoading
(
true
);
setLoading
(
true
);
let
obj
=
form
.
getFieldsValue
();
let
obj
=
form
.
getFieldsValue
();
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
||
Decrypt
(
obj
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
if
(
type
===
'add'
)
{
if
(
type
===
'add'
)
{
AddConnString
({
AddConnString
({
...
obj
,
...
obj
,
type
:
'sqlserver'
,
type
:
'sqlserver'
,
password
:
pwd
,
password
:
Encrypt
(
obj
.
password
)
,
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
setLoading
(
false
);
setLoading
(
false
);
...
@@ -82,15 +78,11 @@ const AddModal = props => {
...
@@ -82,15 +78,11 @@ const AddModal = props => {
};
};
const
handleEdit
=
()
=>
{
const
handleEdit
=
()
=>
{
let
obj
=
form
.
getFieldsValue
();
let
obj
=
form
.
getFieldsValue
();
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
||
Decrypt
(
obj
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
EditConnString
({
EditConnString
({
...
obj
,
...
obj
,
oldName
:
formObj
.
name
,
oldName
:
formObj
.
name
,
type
:
'sqlserver'
,
type
:
'sqlserver'
,
password
:
pwd
,
password
:
Encrypt
(
obj
.
password
)
,
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
setLoading
(
false
);
setLoading
(
false
);
...
@@ -119,7 +111,7 @@ const AddModal = props => {
...
@@ -119,7 +111,7 @@ const AddModal = props => {
form
.
resetFields
();
form
.
resetFields
();
break
;
break
;
case
'edit'
:
case
'edit'
:
form
.
setFieldsValue
({
...
formObj
,
password
:
formObj
.
password
});
form
.
setFieldsValue
({
...
formObj
,
password
:
Decrypt
(
formObj
.
password
)
});
break
;
break
;
default
:
default
:
break
;
break
;
...
...
src/pages/platformCenter/scheduledTasks/index.jsx
View file @
1c055509
...
@@ -35,7 +35,6 @@ import {
...
@@ -35,7 +35,6 @@ import {
import
AddModal
from
'./components/AddModal'
;
import
AddModal
from
'./components/AddModal'
;
import
LookModal
from
'./components/LookModal'
;
import
LookModal
from
'./components/LookModal'
;
import
PushTest
from
'./components/PushTest/PushTest'
;
import
PushTest
from
'./components/PushTest/PushTest'
;
import
logWorker
from
'./components/logWorker'
;
const
{
Option
}
=
Select
;
const
{
Option
}
=
Select
;
let
timer
=
null
;
let
timer
=
null
;
...
@@ -55,7 +54,6 @@ const ScheduledTasks = () => {
...
@@ -55,7 +54,6 @@ const ScheduledTasks = () => {
const
listRef
=
useRef
();
const
listRef
=
useRef
();
const
[
logList
,
setLogList
]
=
useState
([]);
const
[
logList
,
setLogList
]
=
useState
([]);
const
keepLength
=
useRef
(
0
);
const
keepLength
=
useRef
(
0
);
const
[
loadingLog
,
setLoadingLog
]
=
useState
(
false
);
const
columns
=
[
const
columns
=
[
{
{
...
@@ -185,50 +183,14 @@ const ScheduledTasks = () => {
...
@@ -185,50 +183,14 @@ const ScheduledTasks = () => {
getTableList
();
getTableList
();
setColumnsData
(
columns
);
setColumnsData
(
columns
);
getIISAgentLog
();
getIISAgentLog
();
updateInfo
();
return
()
=>
{
return
()
=>
{
clearInterval
(
timer
);
clearInterval
(
timer
);
timer
=
null
;
timer
=
null
;
};
};
},
[]);
},
[]);
const
updateInfo
=
()
=>
{
let
worker
=
new
Worker
(
'logWorker'
);
debugger
;
worker
.
onmessage
=
m
=>
{
debugger
;
console
.
log
(
m
);
};
debugger
;
worker
.
postMessage
(
'123'
);
};
// updateInfo(payload={}){
// debugger
// this._updateInfo(payload);
// let worker = new Worker(worker, {name: 'myWorker'});
// const {pressions} = payload;
// worker.onmessage = (event) =>{
// debugger
// const { routeMap={}, codeMap = {}} = event.data;
// console.log(routeMap, "routeMap", event.data);
// this.updateRouteMap(routeMap);
// this.updateCodeMap(codeMap);
// worker.terminate();
// }
// if(pressions&&pressions.length>0){
// debugger
// worker.postMessage(pressions);
// }
// }
const
getIISAgentLog
=
()
=>
{
const
getIISAgentLog
=
()
=>
{
if
(
loadingLog
)
{
return
;
}
setLoadingLog
(
true
);
GetIISAgentLog
().
then
(
res
=>
{
GetIISAgentLog
().
then
(
res
=>
{
setLoadingLog
(
false
);
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
let
arr
=
[];
let
arr
=
[];
let
list
=
res
.
data
let
list
=
res
.
data
...
...
src/pages/userCenter/userManage/UserManage.jsx
View file @
1c055509
...
@@ -539,6 +539,7 @@ const UserManage = () => {
...
@@ -539,6 +539,7 @@ const UserManage = () => {
useEffect
(()
=>
{
useEffect
(()
=>
{
setExpendKey
(
menuID
);
setExpendKey
(
menuID
);
console
.
log
(
expendKey
);
},
[
menuID
]);
},
[
menuID
]);
// 获取用户机构树
// 获取用户机构树
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -642,6 +643,8 @@ const UserManage = () => {
...
@@ -642,6 +643,8 @@ const UserManage = () => {
const
rowSelection
=
{
const
rowSelection
=
{
selectedRowKeys
,
selectedRowKeys
,
onChange
:
(
RowKeys
,
Rows
)
=>
{
onChange
:
(
RowKeys
,
Rows
)
=>
{
console
.
log
(
RowKeys
);
console
.
log
(
Rows
);
setSelectedRowKeys
(
RowKeys
);
setSelectedRowKeys
(
RowKeys
);
getCheckList
(
RowKeys
);
getCheckList
(
RowKeys
);
setUserIDs
(
RowKeys
.
toString
());
// 数组转字符串,逗号连接
setUserIDs
(
RowKeys
.
toString
());
// 数组转字符串,逗号连接
...
@@ -1034,6 +1037,8 @@ const UserManage = () => {
...
@@ -1034,6 +1037,8 @@ const UserManage = () => {
// 删除机构
// 删除机构
const
deleteOrg
=
()
=>
{
const
deleteOrg
=
()
=>
{
setDeleteOrgVisible
(
true
);
setDeleteOrgVisible
(
true
);
console
.
log
(
orgID
);
console
.
log
(
keep1
);
if
(
orgID
.
id
==
keep1
)
{
if
(
orgID
.
id
==
keep1
)
{
setTreeState
(
true
);
setTreeState
(
true
);
}
else
{
}
else
{
...
@@ -1077,6 +1082,7 @@ const UserManage = () => {
...
@@ -1077,6 +1082,7 @@ const UserManage = () => {
const
relateRole
=
record
=>
{
const
relateRole
=
record
=>
{
// getEmptyRoleList(record.userId);
// getEmptyRoleList(record.userId);
setMult
(
'No'
);
setMult
(
'No'
);
console
.
log
(
record
);
getRoleList
(
record
);
getRoleList
(
record
);
setRoleVisible
(
true
);
setRoleVisible
(
true
);
setCurrentUser
(
record
);
setCurrentUser
(
record
);
...
@@ -1104,10 +1110,12 @@ const UserManage = () => {
...
@@ -1104,10 +1110,12 @@ const UserManage = () => {
};
};
// 冻结用户
// 冻结用户
const
freezeUser
=
record
=>
{
const
freezeUser
=
record
=>
{
console
.
log
(
currentUser
);
// setFreezeUserVisible(true);
// setFreezeUserVisible(true);
setCurrentUser
(
record
);
setCurrentUser
(
record
);
setSelectColor
(
record
);
setSelectColor
(
record
);
let
state
=
''
;
let
state
=
''
;
console
.
log
(
record
);
if
(
record
.
state
===
'0'
||
record
.
state
===
null
)
{
if
(
record
.
state
===
'0'
||
record
.
state
===
null
)
{
state
=
'1'
;
state
=
'1'
;
}
else
{
}
else
{
...
@@ -1137,6 +1145,7 @@ const UserManage = () => {
...
@@ -1137,6 +1145,7 @@ const UserManage = () => {
};
};
// 删除用户
// 删除用户
const
deleteUser
=
record
=>
{
const
deleteUser
=
record
=>
{
console
.
log
(
record
.
userName
);
setCurrentUser
(
record
.
userName
);
setCurrentUser
(
record
.
userName
);
setSelectColor
(
record
);
setSelectColor
(
record
);
DeleteUserNew
({
DeleteUserNew
({
...
@@ -1213,73 +1222,30 @@ const UserManage = () => {
...
@@ -1213,73 +1222,30 @@ const UserManage = () => {
}
}
setTableLoading
(
true
);
setTableLoading
(
true
);
let
data
=
searchWord
!=
''
?
{
key
:
searchWord
}
:
''
;
let
data
=
searchWord
!=
''
?
{
key
:
searchWord
}
:
''
;
// GetUserByKeyNew(data)
GetUserByKeyNew
(
data
)
// .then(res => {
// setSearchFlag(1);
// setTableLoading(false);
// if (res.code === 0) {
// setTotalSearch(res.data.length);
// setSelectedRowKeys([]); // 重置选中用户数
// setCurrentOrgOperate(true); // 禁止当前机构操作
// setMultiOperate(true); // 禁用批量操作
// setOrgTitle('全部机构搜索结果'); // 设置表头
// setCurrentSelectOrg('-1'); // 清空选中机构
// setShowSearchStyle(true);
// setTableData(res.data);
// setTableLength(res.data.length);
// } else {
// notification.error({
// message: '提示',
// duration: 3,
// description: res.msg,
// });
// }
// })
// .catch(err => {
// message.error(err);
// });
getOneOUUserListNew
(
0
,
pageSize
,
1
,
searchWord
)
.
then
(
res
=>
{
.
then
(
res
=>
{
setSearchFlag
(
1
);
setSearchFlag
(
1
);
setTableLoading
(
false
);
setTableLoading
(
false
);
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
setTotal
(
res
.
data
.
count
);
setTotal
Search
(
res
.
data
.
length
);
setSelectedRowKeys
([]);
// 重置选中用户数
setSelectedRowKeys
([]);
// 重置选中用户数
setCurrentOrgOperate
(
true
);
// 禁止当前机构操作
setCurrentOrgOperate
(
true
);
// 禁止当前机构操作
setMultiOperate
(
true
);
// 禁用批量操作
setMultiOperate
(
true
);
// 禁用批量操作
setOrgTitle
(
'全部机构搜索结果'
);
// 设置表头
setOrgTitle
(
'全部机构搜索结果'
);
// 设置表头
setCurrentSelectOrg
(
'-1'
);
// 清空选中机构
setCurrentSelectOrg
(
'-1'
);
// 清空选中机构
console
.
log
(
res
.
data
);
setShowSearchStyle
(
true
);
setShowSearchStyle
(
true
);
setTableData
(
res
.
data
);
// 返回用户表数据结构处理,扁平化
setTableLength
(
res
.
data
.
length
);
let
temp
=
res
.
data
.
data
;
// 设置过滤字段
let
arr
=
temp
.
map
(
item
=>
item
.
groupName
);
arr
=
arr
.
filter
((
value
,
index
)
=>
arr
.
indexOf
(
value
)
===
index
);
setOrgFilters
(
arr
.
map
(
item
=>
({
text
:
item
,
value
:
item
})));
setTableLength
(
temp
.
length
);
let
datalist
=
[];
const
table
=
temp
.
map
((
item
,
index
)
=>
{
if
(
item
.
loginName
==
'panda'
||
item
.
loginName
==
'admin'
)
{
datalist
.
push
(
item
.
userId
);
}
item
.
key
=
index
;
return
item
;
});
setKeepDataList
(
datalist
);
setTableData
(
table
);
}
else
{
}
else
{
setTableLoading
(
false
);
notification
.
error
({
notification
.
error
({
message
:
'获取失败'
,
message
:
'提示'
,
duration
:
3
,
description
:
res
.
msg
,
description
:
res
.
msg
,
});
});
}
}
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
setTableLoading
(
false
);
message
.
error
(
err
);
message
.
error
(
err
);
});
});
};
};
...
@@ -1290,12 +1256,16 @@ const UserManage = () => {
...
@@ -1290,12 +1256,16 @@ const UserManage = () => {
setLoading
(
true
);
setLoading
(
true
);
GetUserRelationListNew
({
userId
:
e
.
userId
})
GetUserRelationListNew
({
userId
:
e
.
userId
})
.
then
(
res
=>
{
.
then
(
res
=>
{
console
.
log
(
111
);
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
const
{
roleList
,
stationList
}
=
res
.
data
;
const
{
roleList
,
stationList
}
=
res
.
data
;
console
.
log
(
roleList
);
setRolelist
(
roleList
);
setRolelist
(
roleList
);
setStationlist
(
stationList
);
setStationlist
(
stationList
);
setLoading
(
false
);
setLoading
(
false
);
}
else
{
}
else
{
console
.
log
(
res
);
setLoading
(
false
);
setLoading
(
false
);
}
}
})
})
...
@@ -1310,12 +1280,14 @@ const UserManage = () => {
...
@@ -1310,12 +1280,14 @@ const UserManage = () => {
setLoading
(
true
);
setLoading
(
true
);
GetUserRelationListNew
({
userId
:
0
})
GetUserRelationListNew
({
userId
:
0
})
.
then
(
res
=>
{
.
then
(
res
=>
{
console
.
log
(
222
);
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
const
{
roleList
,
stationList
}
=
res
.
data
;
const
{
roleList
,
stationList
}
=
res
.
data
;
setRolelist
(
roleList
);
setRolelist
(
roleList
);
setStationlist
(
stationList
);
setStationlist
(
stationList
);
setLoading
(
false
);
setLoading
(
false
);
}
else
{
}
else
{
console
.
log
(
res
.
msg
);
setLoading
(
false
);
setLoading
(
false
);
}
}
})
})
...
@@ -1327,6 +1299,7 @@ const UserManage = () => {
...
@@ -1327,6 +1299,7 @@ const UserManage = () => {
};
};
const
getCheckList
=
e
=>
{
const
getCheckList
=
e
=>
{
console
.
log
(
e
);
let
aa
=
[];
let
aa
=
[];
let
bb
=
[];
let
bb
=
[];
loadAllUserRole
(
e
).
then
(
res
=>
{
loadAllUserRole
(
e
).
then
(
res
=>
{
...
@@ -1343,6 +1316,8 @@ const UserManage = () => {
...
@@ -1343,6 +1316,8 @@ const UserManage = () => {
bb
.
push
(
item1
);
bb
.
push
(
item1
);
});
});
}
}
console
.
log
(
aa
);
console
.
log
(
bb
);
setMultiRoleList
(
aa
);
setMultiRoleList
(
aa
);
setMultiStationList
(
bb
);
setMultiStationList
(
bb
);
}
}
...
@@ -1371,6 +1346,7 @@ const UserManage = () => {
...
@@ -1371,6 +1346,7 @@ const UserManage = () => {
// .catch(err => {
// .catch(err => {
// message.error(err);
// message.error(err);
// });
// });
console
.
log
(
currentUser
);
JumpToAnotherOUNew
({
JumpToAnotherOUNew
({
userId
:
currentUser
.
userId
,
userId
:
currentUser
.
userId
,
oldOUID
:
currentUser
.
groupId
,
oldOUID
:
currentUser
.
groupId
,
...
@@ -1512,10 +1488,12 @@ const UserManage = () => {
...
@@ -1512,10 +1488,12 @@ const UserManage = () => {
keepDataList
.
length
>
0
&&
keepDataList
.
length
>
0
&&
keepDataList
.
map
(
i
=>
{
keepDataList
.
map
(
i
=>
{
let
aa
=
userIDs
.
split
(
','
).
indexOf
(
i
);
let
aa
=
userIDs
.
split
(
','
).
indexOf
(
i
);
console
.
log
(
aa
);
if
(
aa
!==
-
1
)
{
if
(
aa
!==
-
1
)
{
data
.
push
(
aa
);
data
.
push
(
aa
);
}
}
});
});
console
.
log
(
data
);
if
(
data
.
length
>
0
)
{
if
(
data
.
length
>
0
)
{
notification
.
error
({
notification
.
error
({
message
:
'操作失败'
,
message
:
'操作失败'
,
...
@@ -1579,6 +1557,10 @@ const UserManage = () => {
...
@@ -1579,6 +1557,10 @@ const UserManage = () => {
// 更改机构范围
// 更改机构范围
const
submitExtent
=
(
extent
,
areaName
,
flags
)
=>
{
const
submitExtent
=
(
extent
,
areaName
,
flags
)
=>
{
setTreeLoading
(
true
);
setTreeLoading
(
true
);
console
.
log
(
extent
);
console
.
log
(
areaName
);
console
.
log
(
flags
);
console
.
log
(
currentSelectOrg1
);
if
(
flags
===
0
)
{
if
(
flags
===
0
)
{
setTreeLoading
(
false
);
setTreeLoading
(
false
);
notification
.
warn
({
notification
.
warn
({
...
@@ -1617,12 +1599,15 @@ const UserManage = () => {
...
@@ -1617,12 +1599,15 @@ const UserManage = () => {
};
};
// 树的拖拽
// 树的拖拽
const
handleDrop
=
infos
=>
{
const
handleDrop
=
infos
=>
{
console
.
log
(
infos
);
const
dropKey
=
infos
.
node
.
key
;
const
dropKey
=
infos
.
node
.
key
;
const
dragKey
=
infos
.
dragNode
.
key
;
const
dragKey
=
infos
.
dragNode
.
key
;
const
dropPos
=
infos
.
node
.
pos
.
split
(
'-'
);
const
dropPos
=
infos
.
node
.
pos
.
split
(
'-'
);
const
dropPosition
=
infos
.
dropPosition
-
Number
(
dropPos
[
dropPos
.
length
-
1
]);
const
dropPosition
=
infos
.
dropPosition
-
Number
(
dropPos
[
dropPos
.
length
-
1
]);
const
datas
=
JSON
.
parse
(
JSON
.
stringify
(
treeData
));
const
datas
=
JSON
.
parse
(
JSON
.
stringify
(
treeData
));
console
.
log
(
dropKey
,
'dropKey'
);
console
.
log
(
dragKey
,
'dragKey'
);
// 找到拖拽的元素
// 找到拖拽的元素
let
dragObj
;
let
dragObj
;
let
dropObj
;
let
dropObj
;
...
@@ -1639,6 +1624,7 @@ const UserManage = () => {
...
@@ -1639,6 +1624,7 @@ const UserManage = () => {
});
});
// 将节点插入到正确的位置
// 将节点插入到正确的位置
if
(
!
infos
.
dropToGap
)
{
if
(
!
infos
.
dropToGap
)
{
console
.
log
(
'33333333333'
);
dropObj
.
children
=
dropObj
.
children
||
[];
dropObj
.
children
=
dropObj
.
children
||
[];
// 在哪里插入,示例添加到头部,可以是随意位置
// 在哪里插入,示例添加到头部,可以是随意位置
dropObj
.
children
.
unshift
(
dragObj
);
dropObj
.
children
.
unshift
(
dragObj
);
...
@@ -1912,6 +1898,7 @@ const UserManage = () => {
...
@@ -1912,6 +1898,7 @@ const UserManage = () => {
marginRight
:
'5px'
,
marginRight
:
'5px'
,
}
}
}
}
>
>
{
searchFlag
===
0
&&
(
<
Pagination
<
Pagination
total=
{
total
}
total=
{
total
}
showTotal=
{
(
totals
,
range
)
=>
`第${range[0]}-${range[1]} 条/共 ${totals} 条`
}
showTotal=
{
(
totals
,
range
)
=>
`第${range[0]}-${range[1]} 条/共 ${totals} 条`
}
...
@@ -1925,6 +1912,7 @@ const UserManage = () => {
...
@@ -1925,6 +1912,7 @@ const UserManage = () => {
size=
"small"
size=
"small"
showQuickJumper
showQuickJumper
/>
/>
)
}
</
div
>
</
div
>
</
div
>
</
div
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment