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
7e3bce54
Commit
7e3bce54
authored
Oct 22, 2020
by
赵吉
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(pages/database): add a fea
parent
c6cc8ddd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
353 additions
and
1 deletion
+353
-1
.env
.env
+2
-1
InitDataBase.jsx
src/pages/database/InitDataBase.jsx
+194
-0
ManagementDataBase.jsx
src/pages/database/ManagementDataBase.jsx
+157
-0
No files found.
.env
View file @
7e3bce54
PROXY=http://
localhost:10087
PROXY=http://
192.168.19.102:8005/
HOST=localhost
PORT=3001
\ No newline at end of file
src/pages/database/InitDataBase.jsx
0 → 100644
View file @
7e3bce54
import
React
,{
useEffect
,
useState
}
from
'react'
;
import
{
Card
,
Form
,
Input
,
Button
,
Select
,
Table
,
Tag
,
Space
}
from
'antd'
;
import
{
PageContainer
}
from
'@ant-design/pro-layout'
;
import
{
connect
}
from
'react-redux'
;
import
{
get
,
post
}
from
'services'
;
const
InitDataBase
=
(
props
)
=>
{
const
[
form
]
=
Form
.
useForm
()
const
{
Option
}
=
Select
const
onFinish
=
(
e
)
=>
{
console
.
log
(
e
)
}
const
[
dbForm
,
setDbForm
]
=
useState
({
ip
:
''
,
dbName
:
''
,
password
:
''
,
userName
:
''
,
inUse
:
''
,
})
const
[
data
,
setData
]
=
useState
([])
const
url
=
window
.
location
.
host
console
.
log
(
window
.
location
.
host
)
useEffect
(
()
=>
{
get
(
`/Cityinterface/rest/services/OMS.svc/S_GetConnRecord`
,{
_version
:
9999
,
dc
:
1603334559186
}).
then
(
res
=>
{
if
(
res
.
length
>
0
){
let
arr
=
res
.
map
(
(
item
,
index
)
=>
{
item
.
key
=
index
return
item
})
setData
(
arr
)
}
}).
catch
(
err
=>
{
console
.
error
(
err
)
})
},[])
useEffect
(
()
=>
{
get
(
`/Cityinterface/rest/services/OMS.svc/S_GetDataBaseConfig`
,{
_version
:
9999
,
dc
:
1603334559186
}).
then
(
res
=>
{
console
.
log
(
res
)
if
(
res
.
success
){
let
obj
=
{}
for
(
let
k
in
dbForm
){
obj
[
k
]
=
res
[
k
]
}
form
.
setFieldsValue
(
obj
)
setDbForm
(
obj
)
}
}).
catch
(
err
=>
{
console
.
error
(
err
)
})
},[])
const
testChlick
=
()
=>
{
}
const
onValuesChange
=
(
e
)
=>
{
form
.
setFieldsValue
(
e
)
}
const
onChange
=
(
e
)
=>
{
console
.
log
(
e
)
form
.
setFieldsValue
({
dbName
:
e
})
}
const
onCheck
=
(
e
)
=>
{
console
.
log
(
dbForm
)
console
.
log
(
form
.
getFieldValue
())
}
const
option
=
[
{
value
:
'jack'
,
},
{
value
:
'jack1'
,
},
{
value
:
'jack2'
,
},
]
const
columns
=
[
{
title
:
'服务器名或IP地址'
,
dataIndex
:
'ip'
,
key
:
'ip'
,
},
{
title
:
'数据库名称'
,
dataIndex
:
'dbName'
,
key
:
'dbName'
,
},
{
title
:
'数据库用户名称'
,
dataIndex
:
'userName'
,
key
:
'userName'
,
},
{
title
:
'保存时间'
,
dataIndex
:
'saveTime'
,
key
:
'saveTime'
,
},
{
title
:
'描述'
,
dataIndex
:
'desc'
,
key
:
'desc'
,
},
{
title
:
'修改描述'
,
dataIndex
:
'name'
,
key
:
'name'
,
render
:
()
=>
{
return
(
<
button
>
修改描述
</
button
>
)
}
},
{
title
:
'删除'
,
dataIndex
:
'name'
,
key
:
'name'
,
render
:
()
=>
{
return
(
<
button
>
删除
</
button
>
)
}
},
]
return
(
<>
<
PageContainer
>
<
Card
>
<
Form
layout=
"horizontal"
labelAlign=
'left'
labelCol=
{
{
span
:
3
}
}
form=
{
form
}
onFinish=
{
onFinish
}
onValuesChange=
{
onValuesChange
}
>
<
Form
.
Item
label=
"服务器名或IP地址:"
name=
'ip'
>
<
Input
placeholder=
"请输入"
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"数据库用户名称:"
name=
'userName'
>
<
Input
placeholder=
"请输入"
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"数据库用户密码:"
name
=
'
password
'
>
<
Input
placeholder=
"请输入"
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"数据库名称:"
name
=
'
dbName
'
>
<
Select
showSearch
placeholder=
"请选择"
optionFilterProp=
"children"
onChange=
{
onChange
}
filterOption=
{
(
input
,
option
)
=>
option
.
children
.
toLowerCase
().
indexOf
(
input
.
toLowerCase
())
>=
0
}
>
{
option
.
map
(
item
=>
{
return
(<
Option
value=
{
item
.
value
}
>
{
item
.
value
}
</
Option
>)
})
}
</
Select
>
</
Form
.
Item
>
<
Form
.
Item
>
<
Space
size=
'large'
>
<
Button
onClick=
{
onCheck
}
>
测试连接
</
Button
>
<
Button
htmlType=
'submit'
>
保存连接
</
Button
>
<
Button
htmlType=
'reset'
onClick
=
{
testChlick
}
>
数据库初始化
</
Button
>
</
Space
>
<
span
>
{
dbForm
.
inUse
}
</
span
>
</
Form
.
Item
>
{
/* <div className={`btnBox`}>
<Button onClick={onCheck}>测试连接</Button>
<Button>保存连接</Button>
<Button>数据库初始化</Button>
<span>(产品方案(物联GCK))</span>
</div> */
}
</
Form
>
</
Card
>
<
Card
>
<
Table
columns=
{
columns
}
dataSource=
{
data
}
bordered
/>
</
Card
>
</
PageContainer
>
</>
)
}
export
default
connect
()(
InitDataBase
)
\ No newline at end of file
src/pages/database/ManagementDataBase.jsx
0 → 100644
View file @
7e3bce54
import
React
,{
useEffect
,
useState
}
from
'react'
;
import
{
Card
,
Form
,
Input
,
Button
,
Select
,
Table
,
Tag
,
Space
}
from
'antd'
;
import
{
PageContainer
}
from
'@ant-design/pro-layout'
;
import
{
connect
}
from
'react-redux'
;
import
{
get
,
post
}
from
'services'
;
const
ManagementDataBase
=
()
=>
{
const
[
autoCheckList
,
setAutoCheckList
]
=
useState
([])
const
[
checkList
,
setCheckList
]
=
useState
([])
const
[
logList
,
setLogList
]
=
useState
([])
//检查数据库表
useEffect
(
()
=>
{
get
(
`/Cityinterface/rest/services/OMS.svc/TableCheck`
,{
_version
:
9999
,
_dc
:
new
Date
().
getTime
()
}).
then
(
res
=>
{
console
.
log
(
res
)
if
(
res
.
sucess
){
const
{
list
,
messageList
}
=
res
//自动检测列表
let
arr
=
list
.
map
((
item
,
index
)
=>
{
item
.
key
=
index
return
item
})
//手动检查列表
let
arr2
=
messageList
.
map
((
item
,
index
)
=>
{
item
.
key
=
index
return
item
})
console
.
log
(
arr
)
setAutoCheckList
(
arr
)
setCheckList
(
arr2
)
}
}).
catch
(
err
=>
{
console
.
error
(
err
)
})
},[])
//获取数据库升级记录
useEffect
(
()
=>
{
get
(
`/Cityinterface/rest/services/OMS.svc/DatabaseStandard_GetLog`
,{
_version
:
9999
,
_dc
:
new
Date
().
getTime
()
}).
then
(
res
=>
{
console
.
log
(
res
)
if
(
res
){
setLogList
(
res
)
}
}).
catch
(
err
=>
{
console
.
error
(
err
)
})
},[])
const
handleCheck
=
()
=>
{
console
.
log
(
'check DB'
)
}
const
handleUpdate
=
()
=>
{
console
.
log
(
'updatedb'
)
}
const
autoCheckColumns
=
[
{
title
:
'表名称'
,
dataIndex
:
'tableName'
,
key
:
'tableName'
,
},
{
title
:
'类型'
,
dataIndex
:
'type'
,
key
:
'type'
,
},
{
title
:
'差异比较'
,
dataIndex
:
'message'
,
key
:
'message'
,
},
];
const
checkColumns
=
[
{
title
:
'表名称'
,
dataIndex
:
'tableName'
,
key
:
'tableName'
,
width
:
200
},
{
title
:
'类型'
,
dataIndex
:
'type'
,
key
:
'type'
,
},
{
title
:
'差异比较'
,
dataIndex
:
'message'
,
key
:
'message'
,
ellipsis
:
true
,
// width:80
},
];
const
logColumns
=
[
{
title
:
'登录名'
,
dataIndex
:
'updateBy'
,
key
:
'updateBy'
,
},
{
title
:
'数据库名称'
,
dataIndex
:
'name'
,
key
:
'name'
,
},
{
title
:
'数据库版本'
,
dataIndex
:
'version'
,
key
:
'version'
,
},
{
title
:
'数据库版本'
,
dataIndex
:
'version'
,
key
:
'version'
,
},
{
title
:
'升级时间'
,
dataIndex
:
'updateTime'
,
key
:
'updateTime'
,
},
{
title
:
'版本日志'
,
dataIndex
:
'despersion'
,
key
:
'despersion'
,
},
{
title
:
'升级内容'
,
dataIndex
:
'content'
,
key
:
'content'
,
ellipsis
:
true
,
},
]
return
(
<>
<
PageContainer
>
<
Card
>
<
Table
columns=
{
autoCheckColumns
}
dataSource=
{
autoCheckList
}
bordered
></
Table
>
<
Space
>
<
Button
onClick=
{
handleCheck
}
>
检查
</
Button
>
<
Button
onClick=
{
handleUpdate
}
>
升级
</
Button
>
</
Space
>
</
Card
>
<
Card
>
<
Table
columns=
{
checkColumns
}
dataSource=
{
checkList
}
bordered
></
Table
>
</
Card
>
<
Card
>
<
Table
columns=
{
logColumns
}
dataSource=
{
logList
}
bordered
></
Table
>
</
Card
>
</
PageContainer
>
</>
)
}
export
default
ManagementDataBase
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