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
d788f593
Commit
d788f593
authored
Jan 26, 2021
by
Maofei94
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: 产品配置修改
parent
f30314b6
Pipeline
#23004
passed with stages
in 28 minutes 48 seconds
Changes
6
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
130 additions
and
46 deletions
+130
-46
editForm.jsx
src/pages/webConfig/components/editForm.jsx
+34
-17
AddForm.jsx
src/pages/webConfig/menuconfig/AddForm.jsx
+5
-3
editForm.jsx
src/pages/webConfig/menuconfig/editForm.jsx
+4
-3
webMenu.jsx
src/pages/webConfig/menuconfig/webMenu.jsx
+9
-3
productConfig.jsx
src/pages/webConfig/productConfig.jsx
+77
-19
api.js
src/services/webConfig/api.js
+1
-1
No files found.
src/pages/webConfig/components/editForm.jsx
View file @
d788f593
...
...
@@ -16,12 +16,12 @@ const EditForm = props => {
};
const
environmentList
=
[
{
value
:
'
production
'
,
value
:
'
已发布
'
,
label
:
'已发布'
,
key
:
'production'
,
},
{
value
:
'
development
'
,
value
:
'
研发中
'
,
label
:
'研发中'
,
key
:
'development'
,
},
...
...
@@ -35,7 +35,7 @@ const EditForm = props => {
const
finished
=
value
=>
{
let
params
=
{
...
value
,
I
d
:
productObj
.
Id
,
I
D
:
productObj
.
ID
,
};
editCallback
(
params
);
console
.
log
(
value
,
'value'
);
...
...
@@ -46,42 +46,55 @@ const EditForm = props => {
<
div
style=
{
{
minHeight
:
'calc(100vh - 252px)'
,
marginTop
:
'35px'
}
}
>
<
Form
form=
{
form
}
name=
"formEdit"
{
...
layout
}
onFinish=
{
finished
}
>
<
Item
label=
"产品
名称
:"
name=
"P
roduct
Name"
label=
"产品
包名
:"
name=
"P
ackage
Name"
rules=
{
[
{
required
:
true
,
pattern
:
new
RegExp
(
/^
[
a-z0-9A-Z
]
+$/
),
message
:
'产品
名称
必须是英文或者数字'
,
message
:
'产品
包名
必须是英文或者数字'
,
},
]
}
>
<
Input
placeholder=
"请输入产品
名称
"
allowClear
disabled
/>
<
Input
placeholder=
"请输入产品
包名
"
allowClear
disabled
/>
</
Item
>
<
Item
label=
"产品
包名
:"
name=
"Product
Alias
"
label=
"产品
名称
:"
name=
"Product
Name
"
// rules={[
// {
// required: true,
// message: '请输入产品别名',
// pattern: new RegExp(/^[a-z0-9A-Z]+$/),
// message: '产品名称必须是英文或者数字',
// },
// ]}
>
<
Input
placeholder=
"请输入产品包名:"
allowClear
/>
<
Input
placeholder=
"请输入产品名称"
allowClear
/>
</
Item
>
<
Item
label=
"产品说明:"
name=
"Description"
// rules={[
// {
// required: true,
// pattern: new RegExp(/^[a-z0-9A-Z]+$/),
// message: '产品名称必须是英文或者数字',
// },
// ]}
>
<
Input
placeholder=
"请输入产品说明"
/>
</
Item
>
<
Item
label=
"发布状态:"
name=
"
Environment
"
name=
"
PublishState
"
rules=
{
[
{
required
:
true
,
message
:
'请选择发布状态
:
'
,
message
:
'请选择发布状态'
,
},
]
}
>
<
Select
placeholder=
"请选择发布状态
:"
>
<
Select
placeholder=
"请选择发布状态
"
disabled
>
{
environmentList
&&
environmentList
.
map
(
item
=>
(
<
Option
value=
{
item
.
value
}
key=
{
item
.
key
}
>
...
...
@@ -92,7 +105,7 @@ const EditForm = props => {
</
Item
>
<
Item
label=
"访问路由"
name=
"
Start
Url"
name=
"
Route
Url"
rules=
{
[
{
required
:
true
,
...
...
@@ -100,7 +113,11 @@ const EditForm = props => {
},
]
}
>
<
Input
addonBefore=
"//"
placeholder=
"请输入访问路由"
allowClear
/>
{
/* <Input addonBefore="//" placeholder="请输入访问路由" allowClear /> */
}
<
Input
placeholder=
"请输入访问路由,示例//localhost:3001/civmanage"
allowClear
/>
</
Item
>
<
Item
label=
"默认配置"
...
...
src/pages/webConfig/menuconfig/AddForm.jsx
View file @
d788f593
...
...
@@ -15,6 +15,7 @@ const AddForm = props => {
configFiles
,
productList
,
}
=
props
;
console
.
log
(
productList
);
const
[
form
]
=
Form
.
useForm
();
const
[
otherForm
]
=
Form
.
useForm
();
const
layout
=
{
...
...
@@ -62,11 +63,12 @@ const AddForm = props => {
<
Input
placeholder=
"请输入菜单别名"
/>
</
Item
>
<
Item
label=
"产品类型:"
name=
"product"
>
<
Select
placeholder=
"请选择产品类型"
>
<
Select
placeholder=
"请选择产品类型"
allowClear
>
{
productList
&&
productList
.
length
>
0
&&
productList
.
map
(
item
=>
(
<
Option
value=
{
item
.
P
roductName
}
key=
{
item
.
Id
}
>
{
item
.
P
roductAlias
}
<
Option
value=
{
item
.
P
ackageName
}
key=
{
item
.
PackageName
}
>
{
item
.
P
ackageName
}
</
Option
>
))
}
</
Select
>
...
...
src/pages/webConfig/menuconfig/editForm.jsx
View file @
d788f593
...
...
@@ -73,11 +73,12 @@ const EditForm = props => {
<
Input
placeholder=
"请输入菜单别名"
/>
</
Item
>
<
Item
label=
"产品类型:"
name=
"product"
>
<
Select
placeholder=
"请选择产品类型"
>
<
Select
placeholder=
"请选择产品类型"
allowClear
>
{
productList
&&
productList
.
length
>
0
&&
productList
.
map
(
item
=>
(
<
Option
value=
{
item
.
P
roductName
}
key=
{
item
.
Id
}
>
{
item
.
P
roductAlias
}
<
Option
value=
{
item
.
P
ackageName
}
key=
{
item
.
PackageName
}
>
{
item
.
P
ackageName
||
''
}
</
Option
>
))
}
</
Select
>
...
...
src/pages/webConfig/menuconfig/webMenu.jsx
View file @
d788f593
...
...
@@ -47,7 +47,7 @@ const MiniMenu = props => {
const
[
modalLoading
,
setModalLoading
]
=
useState
(
false
);
const
[
submitLoading
,
setSubmitLoading
]
=
useState
(
false
);
const
[
newTreeList
,
setNewTreeList
]
=
useState
([]);
const
[
productList
,
setProductList
]
=
useState
([]);
const
[
productList
,
setProductList
]
=
useState
([]);
// 选中的产品类型
const
[
menuList
,
setMenuList
]
=
useState
([]);
// 菜单树
/* ***************************************************** */
...
...
@@ -59,9 +59,15 @@ const MiniMenu = props => {
},
[
menuID
,
webid
]);
useEffect
(()
=>
{
getProductList
().
then
(
res
=>
{
const
{
code
,
data
}
=
res
;
const
{
code
}
=
res
;
if
(
code
===
0
)
{
setProductList
(
data
);
const
{
data
:
{
UserProducts
},
}
=
res
;
if
(
UserProducts
&&
UserProducts
.
length
>
0
)
{
setProductList
(
UserProducts
);
}
// setProductList(data);
}
});
},
[]);
...
...
src/pages/webConfig/productConfig.jsx
View file @
d788f593
...
...
@@ -8,6 +8,7 @@ import {
Spin
,
notification
,
Switch
,
message
,
}
from
'antd'
;
import
{
modifyProduct
,
...
...
@@ -21,6 +22,7 @@ import styles from './productConfig.less';
const
ProductConfig
=
props
=>
{
const
[
addVisible
,
setAddVisible
]
=
useState
(
false
);
const
[
productList
,
setProductList
]
=
useState
([]);
const
[
userProductsList
,
setUserProductsList
]
=
useState
([]);
const
[
productObj
,
setProductObt
]
=
useState
(
null
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
flag
,
setFlag
]
=
useState
(
1
);
...
...
@@ -28,12 +30,18 @@ const ProductConfig = props => {
setLoading
(
true
);
getProductList
()
.
then
(
res
=>
{
const
{
code
,
data
}
=
res
;
const
{
code
}
=
res
;
if
(
code
===
0
)
{
if
(
!
productObj
&&
data
.
length
>
0
)
{
setProductObt
(
data
[
0
]);
}
setProductList
(
data
);
const
{
data
:
{
AllProducts
,
UserProducts
},
}
=
res
;
console
.
log
(
AllProducts
,
UserProducts
);
setProductList
(
AllProducts
);
setUserProductsList
(
UserProducts
);
// if (!productObj && data.length > 0) {
// setProductObt(data[0]);
// }
// setProductList(data);
}
})
.
finally
(()
=>
{
...
...
@@ -45,17 +53,15 @@ const ProductConfig = props => {
setAddVisible
(
true
);
};
// 删除
const
handleDel
=
()
=>
{
const
handleDel
=
item
=>
{
setLoading
(
true
);
delProductList
({
ids
:
productObj
.
Id
,
})
delProductList
({
...
item
})
.
then
(
res
=>
{
setLoading
(
false
);
if
(
res
.
code
===
0
)
{
notification
.
success
({
message
:
'提示'
,
description
:
'
删除
成功'
,
description
:
'
关闭
成功'
,
duration
:
3
,
});
setProductObt
(
''
);
...
...
@@ -63,7 +69,7 @@ const ProductConfig = props => {
}
else
{
notification
.
error
({
message
:
'提示'
,
description
:
res
.
msg
||
'
删除
失败'
,
description
:
res
.
msg
||
'
关闭
失败'
,
duration
:
10
,
});
}
...
...
@@ -104,30 +110,82 @@ const ProductConfig = props => {
console
.
log
(
err
);
});
};
const
handleSwitchClick
=
(
e
,
id
)
=>
{
console
.
log
(
e
,
id
);
const
handleSwitchClick
=
(
e
,
item
,
userlist
)
=>
{
if
(
e
)
{
setLoading
(
true
);
modifyProduct
({
...
item
})
.
then
(
res
=>
{
console
.
log
(
res
);
setLoading
(
false
);
if
(
res
.
code
===
0
)
{
notification
.
success
({
message
:
'提示'
,
description
:
'启用成功'
,
duration
:
3
,
});
setFlag
(
flag
+
1
);
}
else
{
notification
.
error
({
message
:
'提示'
,
description
:
res
.
msg
||
'启用失败'
,
duration
:
10
,
});
}
})
.
catch
(
err
=>
{
setLoading
(
false
);
console
.
log
(
err
);
});
}
if
(
!
e
)
{
let
obj
=
userlist
.
find
(
i
=>
i
.
PackageName
===
item
.
PackageName
);
handleDel
(
obj
);
}
console
.
log
(
e
,
item
);
};
const
handleClickItem
=
value
=>
{
if
(
userProductsList
.
length
>
0
)
{
let
obj
=
userProductsList
.
find
(
i
=>
i
.
PackageName
===
value
.
PackageName
);
console
.
log
(
obj
);
if
(
obj
)
{
setProductObt
(
obj
);
}
else
{
message
.
warning
({
content
:
'请先启用产品'
,
duration
:
3
,
});
}
}
else
{
message
.
warning
({
content
:
'请先启用产品'
,
duration
:
3
,
});
}
};
const
renderListItem
=
arr
=>
arr
.
map
(
item
=>
(
<
List
.
Item
key=
{
item
.
Id
}
key=
{
item
.
PackageName
}
className=
{
classnames
({
[
styles
.
listItem
]:
true
,
[
styles
.
selected
]:
item
.
Id
===
productObj
.
Id
,
[
styles
.
selected
]:
item
.
PackageName
===
productObj
?.
PackageName
,
})
}
onClick=
{
()
=>
setProductObt
(
item
)
}
onClick=
{
()
=>
handleClickItem
(
item
)
}
>
<
div
onClick=
{
e
=>
e
.
stopPropagation
()
}
>
<
Switch
// size="small"
defaultChecked=
{
!
item
.
checked
}
// defaultChecked={item.IsUsed}
checked=
{
item
.
IsUsed
}
checkedChildren=
"启用"
unCheckedChildren=
"关闭"
onClick=
{
e
=>
{
handleSwitchClick
(
e
,
item
.
Id
);
handleSwitchClick
(
e
,
item
,
userProductsList
);
}
}
/>
</
div
>
<
span
className=
{
classnames
({
[
styles
.
itemspan
]:
true
})
}
>
{
item
.
P
roduct
Name
}
{
item
.
P
ackage
Name
}
</
span
>
</
List
.
Item
>
));
...
...
src/services/webConfig/api.js
View file @
d788f593
...
...
@@ -122,4 +122,4 @@ export const modifyProduct = params =>
// 删除产品列表
export
const
delProductList
=
params
=>
get
(
`
${
PUBLISH_SERVICE
}
/UserCenter/DelProductLis
t`
,
params
);
post
(
`
${
PUBLISH_SERVICE
}
/UserCenter/DelProduc
t`
,
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