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
86f2ec75
Commit
86f2ec75
authored
Nov 05, 2020
by
Maofei94
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf(pages/database): a perf
parent
7f2f4bf6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
93 additions
and
11 deletions
+93
-11
InitDataBase.jsx
src/pages/database/InitDataBase.jsx
+82
-10
DelModal.jsx
src/pages/userCenter/siteManage/DelModal.jsx
+1
-1
api.js
src/services/database/api.js
+10
-0
No files found.
src/pages/database/InitDataBase.jsx
View file @
86f2ec75
...
...
@@ -15,6 +15,7 @@ import {
import
{
PageContainer
}
from
'@ant-design/pro-layout'
;
import
{
connect
}
from
'react-redux'
;
import
{
get
,
post
}
from
'../../services'
;
import
{
setTableSQLDirName
,
deleteConn
}
from
'@/services/database/api'
import
styles
from
'./InitDataBase.less'
;
const
{
Option
}
=
Select
;
...
...
@@ -38,6 +39,8 @@ const InitDataBase = props => {
const
[
upData
,
setUpData
]
=
useState
(
1
);
// 列表刷新标记
const
[
option
,
setOption
]
=
useState
([]);
// 下拉列表数据
const
[
desc
,
setDesc
]
=
useState
(
''
);
// 修改描述
const
[
allSqlDir
,
setAllSqulDir
]
=
useState
([])
//修改产品方案
const
[
defaultSqlDir
,
setDefaultSqlDir
]
=
useState
(
''
)
//修改产品方案默认值
const
[
modalVisible
,
setModalVisible
]
=
useState
(
false
);
console
.
log
(
window
.
location
.
host
);
// 获取数据库链接记录
...
...
@@ -77,6 +80,8 @@ const InitDataBase = props => {
});
form
.
setFieldsValue
(
obj
);
setDbForm
(
val
=>
({
...
val
,
...
obj
}));
setAllSqulDir
(
res
.
allSqlDir
)
setDefaultSqlDir
(
res
.
tableSQLDirName
)
}
})
.
catch
(
err
=>
{
...
...
@@ -203,6 +208,30 @@ const InitDataBase = props => {
});
form
.
setFieldsValue
(
obj
);
};
// 产品方案选择框回调
const
handleSelect
=
(
value
)
=>
{
setTableSQLDirName
({
dirName
:
value
,
_version
:
9999
,
_dc
:
new
Date
().
getTime
()
}).
then
(
res
=>
{
if
(
res
.
success
){
notification
.
success
({
message
:
'提示'
,
duration
:
3
,
description
:
`已切换初始化脚本为:
${
value
}
`
,
});
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
res
.
message
,
});
}
}).
catch
(
err
=>
{
console
.
error
(
err
)
})
}
// 展示修改描述
const
changeDesc
=
()
=>
{
setModalVisible
(
true
);
...
...
@@ -236,6 +265,34 @@ const InitDataBase = props => {
setModalVisible
(
false
);
});
};
//删除数据库连接记录
const
delConn
=
(
value
)
=>
{
setTableLoading
(
true
)
const
{
key
=
''
}
=
value
deleteConn
({
rowIndex
:
key
,
_version
:
9999
,
_dc
:
new
Date
().
getTime
()
}).
then
(
res
=>
{
setTableLoading
(
false
)
if
(
res
.
success
){
setUpData
(
upData
+
1
);
notification
.
success
({
message
:
'提示'
,
duration
:
3
,
description
:
'操作成功'
})
}
else
{
notification
.
error
({
message
:
'提示'
,
duration
:
3
,
description
:
res
.
message
})
}
}).
catch
(
err
=>
{
setTableLoading
(
false
)
console
.
error
(
err
)})
}
const
columns
=
[
{
title
:
'服务器名或IP地址'
,
...
...
@@ -280,11 +337,12 @@ const InitDataBase = props => {
},
{
title
:
'删除'
,
dataIndex
:
'name'
,
key
:
'name'
,
render
:
()
=>
(
<
Button
size=
"small"
danger
>
dataIndex
:
'del'
,
key
:
'del'
,
render
:
(
text
,
record
)
=>
(
<
Button
size=
"small"
danger
onClick=
{
()
=>
delConn
(
record
)
}
>
删除
</
Button
>
),
...
...
@@ -360,7 +418,20 @@ const InitDataBase = props => {
>
数据库初始化
</
Button
>
<
span
>
{
dbForm
.
inUse
}
</
span
>
{
defaultSqlDir
&&
<
Select
placeholder=
'请选择解决方案'
style=
{
{
width
:
'200px'
}
}
defaultValue=
{
defaultSqlDir
}
onChange
=
{
(
e
)=
>
{
handleSelect
(
e
)
}
}
>
{
allSqlDir
&&
allSqlDir
.
map
(
(
item
,
index
)
=>
{
console
.
log
(
defaultSqlDir
)
return
<
Option
value=
{
item
}
key=
{
index
}
>
{
item
}
</
Option
>
})
}
</
Select
>
}
{
/* <span>{dbForm.inUse}</span> */
}
</
Space
>
</
div
>
</
Form
.
Item
>
...
...
@@ -389,19 +460,20 @@ const InitDataBase = props => {
maskClosable
onOk=
{
()
=>
modalOkCallback
()
}
onCancel=
{
()
=>
setModalVisible
(
false
)
}
width=
"
10
00px"
width=
"
8
00px"
bodyStyle=
{
{
minHeight
:
'100px'
,
}
}
cancelText=
"取消"
okText=
"确认修改"
destroyOnClose
destroyOnClose
=
{
true
}
>
<
Row
>
<
Col
span=
{
1
}
className=
{
styles
.
decsBox
}
>
<
Col
span=
{
2
}
className=
{
styles
.
decsBox
}
>
描述:
</
Col
>
<
Col
span=
{
11
}
>
<
Col
span=
{
22
}
>
<
Input
placeholder=
"请输入描述"
onChange=
{
value
=>
{
...
...
src/pages/userCenter/siteManage/DelModal.jsx
View file @
86f2ec75
...
...
@@ -41,7 +41,7 @@ const DelModal = (props) =>{
return
(
<
SiteModal
{
...
props
}
title=
'删除站点'
bodyStyle
={{
width
:"100%",
minHeight
:"50
px
",}}
style=
{
{
top
:
'500px'
}
}
style=
{
{
top
:
200
}
}
width=
"400px"
destroyOnClose=
{
true
}
cancelText=
'取消'
...
...
src/services/database/api.js
View file @
86f2ec75
import
{
get
,
post
}
from
'@/services/index'
;
// 修改产品解决方案
export
const
setTableSQLDirName
=
params
=>
get
(
'/Cityinterface/rest/services/OMS.svc/S_SetTableSQLDirName'
,
params
);
// 删除数据库连接记录
export
const
deleteConn
=
params
=>
get
(
'/Cityinterface/rest/services/OMS.svc/S_DeleteConn'
,
params
);
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