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
5ae11ffd
Commit
5ae11ffd
authored
Jul 26, 2022
by
皮倩雯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: '产品初始化方案修改
parent
f2eb8e14
Pipeline
#56197
passed with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
59 deletions
+87
-59
InitDataBase.jsx
src/pages/database/InitDataBase/InitDataBase.jsx
+1
-1
initModal.jsx
src/pages/database/InitDataBase/initModal.jsx
+86
-58
No files found.
src/pages/database/InitDataBase/InitDataBase.jsx
View file @
5ae11ffd
...
...
@@ -440,7 +440,7 @@ const InitDataBase = props => {
aa
.
push
(
i
.
name
);
});
console
.
log
(
aa
);
setKeep
(
res
.
data
.
Product
);
setKeep
(
res
.
data
.
IsAuthorize
);
setKeepProduct
(
aa
);
}
setDbExists
(
res
.
data
.
DBExists
);
...
...
src/pages/database/InitDataBase/initModal.jsx
View file @
5ae11ffd
...
...
@@ -7,11 +7,11 @@
* @Description:
* @Author: leizhe
* @Date: 2022-07-13 16:13:03
* @LastEditTime: 2022-07-
19 17:53:15
* @LastEditTime: 2022-07-
26 13:35:37
* @LastEditors: leizhe
*/
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Form
,
Modal
,
Divider
,
Checkbox
,
Button
,
Input
,
notification
,
Row
,
Col
}
from
'antd'
;
import
{
Form
,
Modal
,
Divider
,
Checkbox
,
Button
,
Input
,
notification
,
Row
,
Col
,
Spin
}
from
'antd'
;
import
{
GetProductList
,
GetProductListByLicense
,
...
...
@@ -34,18 +34,25 @@ const InitModal = props => {
const
[
flag
,
setFlag
]
=
useState
(
0
);
const
[
mag
,
setMag
]
=
useState
(
''
);
const
[
code
,
setCode
]
=
useState
(
''
);
const
[
loadings
,
setLoadings
]
=
useState
(
false
);
const
[
checkboxFlag
,
setCheckboxFlag
]
=
useState
(
0
);
const
[
keepValue
,
setKeepValue
]
=
useState
([]);
const
[
value
,
setValue
]
=
useState
([]);
const
[
product
,
setProduct
]
=
useState
([]);
useEffect
(()
=>
{
getProductList
();
console
.
log
(
keep
);
console
.
log
(
keepProduct
);
setFlag
(
0
);
setCheckboxFlag
(
0
);
setMag
(
''
);
if
(
visible
)
{
getProductList
();
if
(
keep
)
{
setCheckboxFlag
(
1
);
}
else
{
setCheckboxFlag
(
0
);
}
setValue
(
keepProduct
);
setKeepCode
(
keepProduct
);
}
else
{
setCode
(
''
);
...
...
@@ -83,7 +90,7 @@ const InitModal = props => {
});
console
.
log
(
arr
);
setProduct
(
arr
);
setValue
(
keepProduct
);
setKeepValue
(
arr
);
}
let
arr
=
formateArrDataA
(
res
.
data
,
'productName'
);
...
...
@@ -202,63 +209,61 @@ const InitModal = props => {
};
const
onSubmit
=
()
=>
{
console
.
log
(
mag
);
if
(
mag
!=
''
&&
keepProduct
==
keepCode
&&
checkboxFlag
!=
0
)
{
notification
.
error
({
message
:
'提示'
,
duration
:
5
,
description
:
'请先输入激活码激活产品'
,
// console.log(mag);
// if (mag != '' && keepProduct == keepCode && checkboxFlag != 0) {
// notification.error({
// message: '提示',
// duration: 5,
// description: '请先输入激活码激活产品',
// });
// } else {
// if (flag !== 0 || checkboxFlag == 0) {
// setLoadings(true);
// let arr = [];
// if (checkboxFlag == 0) {
// keepData.map(i => {
// if (value.indexOf(i.name) != -1) {
// arr.push(i);
// }
// });
// } else {
// keepData.map(i => {
// if (keepCode.indexOf(i.name) != -1) {
// arr.push(i);
// }
// });
// }
// console.log(arr);
// callBackSubmit(arr, code);
// onCancel();
// } else {
// notification.warning({
// message: '提示',
// duration: 5,
// description: '请先输入激活码激活产品',
// });
// }
// }
let
arr
=
[];
if
(
checkboxFlag
==
0
)
{
keepData
.
map
(
i
=>
{
if
(
value
.
indexOf
(
i
.
name
)
!=
-
1
)
{
arr
.
push
(
i
);
}
});
}
else
{
if
(
flag
!==
0
||
checkboxFlag
==
0
)
{
setLoadings
(
true
);
let
arr
=
[];
if
(
checkboxFlag
==
0
)
{
keepData
.
map
(
i
=>
{
if
(
value
.
indexOf
(
i
.
name
)
!=
-
1
)
{
arr
.
push
(
i
);
}
});
}
else
{
keepData
.
map
(
i
=>
{
if
(
keepCode
.
indexOf
(
i
.
name
)
!=
-
1
)
{
arr
.
push
(
i
);
}
});
keepData
.
map
(
i
=>
{
if
(
keepCode
.
indexOf
(
i
.
name
)
!=
-
1
)
{
arr
.
push
(
i
);
}
console
.
log
(
arr
);
callBackSubmit
(
arr
,
code
);
onCancel
();
}
else
{
notification
.
warning
({
message
:
'提示'
,
duration
:
5
,
description
:
'请先输入激活码激活产品'
,
});
}
});
}
console
.
log
(
arr
);
callBackSubmit
(
arr
,
code
);
onCancel
();
};
const
onChange
=
(
e
,
item
)
=>
{
console
.
log
(
e
);
console
.
log
(
product
);
console
.
log
(
keepProduct
);
console
.
log
(
product
[
item
]);
console
.
log
(
item
);
console
.
log
(
data
[
item
]);
console
.
log
(
keepValue
);
// let aa = keepValue;
// aa[item] = e;
// let a = Object.keys(aa);
// let list = [];
// a.map(i => {
// aa[i].map(j => {
// list.push(j);
// });
// });
// setKeepValue(aa);
// setValue(list);
if
(
product
[
item
])
{
// 过滤已初始化的产品但不存在于产品列表中的数据,避免组件出错
product
[
item
].
map
(
i
=>
{
...
...
@@ -312,7 +317,7 @@ const InitModal = props => {
forceRender
getContainer=
{
false
}
footer=
{
[
<
Button
onClick=
{
()
=>
setListVisible
(
true
)
}
>
产品激活
</
Button
>,
//
<Button onClick=
{()
=>
setListVisible
(
true
)}
>
产品激活
<
/Button>
,
<
Button
type
=
"primary"
onClick
=
{()
=>
onSubmit
()}
>
确认
<
/Button>
,
...
...
@@ -344,7 +349,7 @@ const InitModal = props => {
<>
{
data
[
item
]
&&
data
[
item
].
map
((
i
,
j
)
=>
{
if
(
keep
Code
.
indexOf
(
i
)
!=
-
1
)
{
if
(
keep
Product
.
indexOf
(
i
)
!=
-
1
)
{
return
<
Checkbox
checked=
{
true
}
>
{
i
}
</
Checkbox
>;
}
else
{
return
(
...
...
@@ -371,7 +376,11 @@ const InitModal = props => {
<
Form
form=
{
form
}
>
<
Row
span=
{
24
}
>
<
Col
span=
{
6
}
>
<
Form
.
Item
label=
"产品激活码"
name=
"License1"
>
<
Form
.
Item
label=
"产品激活码"
name=
"License1"
// rules={[{ required: true, message: '请输入产品激活码' }]}
>
<
Input
maxLength=
{
5
}
onPaste=
{
e
=>
{
...
...
@@ -521,6 +530,25 @@ const InitModal = props => {
</
Form
.
Item
>
</
Col
>
</
Row
>
<
Form
.
Item
name=
"name"
label=
"部署人工号"
rules=
{
[
//
{
required
:
true
,
message
:
'请输入部署人工号'
},
{
validator
:
(
rule
,
value
)
=>
{
let
aa
=
/^
[
1-9
]([
0-9
])
*$/
;
let
bb
=
form
.
getFieldValue
().
name
;
if
(
!
aa
.
test
(
bb
))
{
return
Promise
.
reject
(
'请正确填写工号'
);
}
return
Promise
.
resolve
();
},
},
]
}
>
<
Input
placeholder=
"请输入部署人工号"
allowClear
style=
{
{
width
:
'33%'
}
}
/>
</
Form
.
Item
>
</
Form
>
</
Modal
>
</
Modal
>
...
...
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