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
d1eb41fe
Commit
d1eb41fe
authored
Aug 16, 2022
by
皮倩雯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: '数据库初始化优化'
parent
325eef2c
Pipeline
#57759
passed with stages
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
122 additions
and
60 deletions
+122
-60
initModal.jsx
src/pages/database/InitDataBase/initModal.jsx
+42
-43
DatabaseInitialization.jsx
...atabase/databaseInitialization/DatabaseInitialization.jsx
+79
-16
api.js
src/services/database/api.js
+1
-1
No files found.
src/pages/database/InitDataBase/initModal.jsx
View file @
d1eb41fe
...
...
@@ -7,7 +7,7 @@
* @Description:
* @Author: leizhe
* @Date: 2022-07-13 16:13:03
* @LastEditTime: 2022-08-
01 09:59:17
* @LastEditTime: 2022-08-
16 09:59:34
* @LastEditors: leizhe
*/
import
React
,
{
useState
,
useEffect
}
from
'react'
;
...
...
@@ -67,48 +67,47 @@ const InitModal = props => {
},
[
listVisible
]);
const
getProductList
=
()
=>
{
GetProductList
().
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
setKeepData
(
res
.
data
);
if
(
keepProduct
.
length
>
0
)
{
let
dd
=
[];
keepProduct
.
map
(
i
=>
{
res
.
data
.
map
(
j
=>
{
if
(
j
.
name
===
i
)
{
dd
.
push
(
j
);
}
});
});
let
arr
=
formateArrDataA
(
dd
,
'productName'
);
let
aa
=
Object
.
keys
(
arr
);
aa
.
map
(
i
=>
{
let
list
=
[];
arr
[
i
].
map
(
j
=>
{
list
.
push
(
j
.
name
);
});
arr
[
i
]
=
list
;
});
console
.
log
(
arr
);
setProduct
(
arr
);
setKeepValue
(
arr
);
}
let
arr
=
formateArrDataA
(
res
.
data
,
'productName'
);
let
aa
=
Object
.
keys
(
arr
);
aa
.
map
(
i
=>
{
let
list
=
[];
arr
[
i
].
map
(
j
=>
{
list
.
push
(
j
.
name
);
});
arr
[
i
]
=
list
;
});
console
.
log
(
aa
);
console
.
log
(
arr
);
console
.
log
(
keepProduct
);
setTitle
(
aa
);
setData
(
arr
);
}
});
// GetProductList().then(res => {
// if (res.code === 0) {
// setKeepData(res.data);
// if (keepProduct.length > 0) {
// let dd = [];
// keepProduct.map(i => {
// res.data.map(j => {
// if (j.name === i) {
// dd.push(j);
// }
// });
// });
// let arr = formateArrDataA(dd, 'productName');
// let aa = Object.keys(arr);
// aa.map(i => {
// let list = [];
// arr[i].map(j => {
// list.push(j.name);
// });
// arr[i] = list;
// });
// console.log(arr);
// setProduct(arr);
// setKeepValue(arr);
// }
// let arr = formateArrDataA(res.data, 'productName');
// let aa = Object.keys(arr);
// aa.map(i => {
// let list = [];
// arr[i].map(j => {
// list.push(j.name);
// });
// arr[i] = list;
// });
// console.log(aa);
// console.log(arr);
// console.log(keepProduct);
// setTitle(aa);
// setData(arr);
// }
// });
};
const
formateArrDataA
=
(
initialArr
,
name
)
=>
{
...
...
src/pages/database/databaseInitialization/DatabaseInitialization.jsx
View file @
d1eb41fe
...
...
@@ -115,6 +115,7 @@ const DatabaseInitialization = props => {
const
[
isAuthorize
,
setIsAuthorize
]
=
useState
(
false
);
const
[
licen
,
setLicen
]
=
useState
(
''
);
const
[
showDetali
,
setShowDetali
]
=
useState
(
false
);
const
[
keepLast
,
setKeepLast
]
=
useState
(
''
);
// 获取数据库配置信息
useEffect
(()
=>
{
...
...
@@ -408,7 +409,6 @@ const DatabaseInitialization = props => {
const
GetDbChange
=
e
=>
{
let
obj
=
form
.
getFieldsValue
();
setCardLoading
(
true
);
GetDbProduct
({
...
obj
}).
then
(
res
=>
{
setCardLoading
(
false
);
if
(
res
.
code
===
0
)
{
...
...
@@ -552,18 +552,12 @@ const DatabaseInitialization = props => {
if
(
value
.
length
>
0
)
{
setKeepProduct
(
value
);
}
// setMsg('当前数据库已存在不可初始化');
setbeforeColor
(
'red'
);
setResult
(
'检测到License已被使用'
);
// setbeforeColor('red');
// setResult('检测到License已被使用');
setMsg
(
'检测到License已被使用'
);
setCheckboxFlag
(
1
);
setfirstColor
(
'green'
);
SetAdminMenuToRole
().
then
(
resdata
=>
{
if
(
resdata
.
code
===
0
)
{
setLastColor
(
'green'
);
}
});
setDataResult
(
'成功'
);
notification
.
success
({
message
:
'提示'
,
...
...
@@ -578,7 +572,6 @@ const DatabaseInitialization = props => {
// setkeepMsg('');
// setkeepCo('');
if
(
res
.
data
.
productPackageCount
==
0
)
{
console
.
log
(
1212
);
setProductResult
(
'产品授权不包含已初始化的产品'
);
setsecordColor
(
'#eda625'
);
}
else
{
...
...
@@ -586,6 +579,15 @@ const DatabaseInitialization = props => {
}
setTotalProduct
(
res
.
data
.
productPackageSumCount
);
setSimpleProduct
(
res
.
data
.
productPackageCount
);
SetAdminMenuToRole
().
then
(
resdata
=>
{
if
(
resdata
.
code
===
0
)
{
setLastColor
(
'green'
);
setKeepLast
(
''
);
}
else
{
setLastColor
(
'red'
);
setKeepLast
(
res
.
data
.
msg
);
}
});
}
else
{
setDataResult
(
res
.
msg
);
setFinish
(
true
);
...
...
@@ -667,7 +669,31 @@ const DatabaseInitialization = props => {
if
(
obj
.
ip
&&
obj
.
userName
&&
obj
.
password
&&
obj
.
dbName
)
{
// setKeepValue([]);
setProduct
([]);
setCardLoading
(
true
);
GetProductList
({
...
obj
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
console
.
log
(
res
.
data
);
GetDbChange
();
setKeepData
(
res
.
data
);
let
arr
=
formateArrDataA
(
res
.
data
,
'productName'
);
let
aa
=
Object
.
keys
(
arr
);
aa
.
map
(
i
=>
{
let
list
=
[];
arr
[
i
].
map
(
j
=>
{
list
.
push
(
j
.
name
);
});
arr
[
i
]
=
list
;
});
setAllLength
(
res
.
data
.
length
);
console
.
log
(
arr
);
console
.
log
(
aa
);
setTitle
(
aa
);
setData
(
arr
);
}
else
{
setCardLoading
(
false
);
}
});
deleteInitDBLogNew
();
}
else
{
setbeforeColor
(
'red'
);
...
...
@@ -718,7 +744,29 @@ const DatabaseInitialization = props => {
const
Submit
=
()
=>
{
let
obj
=
form
.
getFieldsValue
();
if
(
obj
.
ip
&&
obj
.
userName
&&
obj
.
password
&&
obj
.
dbName
)
{
GetProductList
({
...
obj
}).
then
(
res
=>
{
setCardLoading
(
false
);
if
(
res
.
code
===
0
)
{
console
.
log
(
res
.
data
);
GetDbChange
(
1
);
setKeepData
(
res
.
data
);
let
arr
=
formateArrDataA
(
res
.
data
,
'productName'
);
let
aa
=
Object
.
keys
(
arr
);
aa
.
map
(
i
=>
{
let
list
=
[];
arr
[
i
].
map
(
j
=>
{
list
.
push
(
j
.
name
);
});
arr
[
i
]
=
list
;
});
setAllLength
(
res
.
data
.
length
);
console
.
log
(
arr
);
console
.
log
(
aa
);
setTitle
(
aa
);
setData
(
arr
);
}
});
setCardLoading
(
true
);
}
else
{
setbeforeColor
(
'red'
);
...
...
@@ -1090,18 +1138,33 @@ const DatabaseInitialization = props => {
</
Timeline
.
Item
>
<
Timeline
.
Item
color=
{
lastColor
}
>
<
span
>
平台管理员赋权使用
</
span
>
{
lastColor
==
'green'
?
(
{
(()
=>
{
switch
(
lastColor
)
{
case
'gray'
:
return
<></>;
case
'green'
:
return
(
<>
<
CheckCircleOutlined
style=
{
{
color
:
'green'
,
marginLeft
:
'10px'
}
}
/>
<
CheckCircleOutlined
style=
{
{
color
:
'green'
,
marginLeft
:
'10px'
}
}
/>
<
br
/>
<
spsn
>
登录名:panda
</
spsn
>
<
br
/>
{
password
?
<
span
>
初始密码:panda666
</
span
>
:
<></>
}
</>
)
:
(
<></>
)
}
);
default
:
return
(
<>
<
CloseCircleOutlined
style=
{
{
color
:
'red'
,
marginLeft
:
'10px'
}
}
/>
<
span
style=
{
{
color
:
'rgb(24 144 255)'
,
marginLeft
:
'5px'
}
}
>
{
keepLast
}
</
span
>
</>
);
}
})()
}
</
Timeline
.
Item
>
</
Timeline
>
</
div
>
...
...
src/services/database/api.js
View file @
d1eb41fe
...
...
@@ -190,7 +190,7 @@ export const AddUserAuthSetting = params =>
export
const
GetUserAuthSet
=
params
=>
get
(
`
${
PUBLISH_SERVICE
}
/WebSite/GetUserAuthSet`
,
params
);
// 获取产品列表
export
const
GetProductList
=
params
=>
ge
t
(
`
${
PUBLISH_SERVICE
}
/DBManager/GetProductList`
,
params
);
export
const
GetProductList
=
params
=>
pos
t
(
`
${
PUBLISH_SERVICE
}
/DBManager/GetProductList`
,
params
);
// 获取产品列表清单
export
const
GetProductListByLicense
=
params
=>
get
(
`
${
PUBLISH_SERVICE
}
/DBManager/GetProductListByLicense`
,
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