Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
Dui123
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
王天宇
Dui123
Commits
e43599c4
Commit
e43599c4
authored
Sep 30, 2021
by
rzf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
改
parent
8dda73e7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
91 additions
and
66 deletions
+91
-66
PublishModal.jsx
src/modal/PublishModal.jsx
+2
-2
RemoveType.jsx
src/modal/RemoveType.jsx
+52
-60
ToolModal.jsx
src/modal/ToolModal.jsx
+6
-1
TypeModal.jsx
src/modal/TypeModal.jsx
+31
-3
No files found.
src/modal/PublishModal.jsx
View file @
e43599c4
...
...
@@ -50,13 +50,13 @@ const PublishModal = ({ visible, onCancel, data }) => {
.
then
(
data
=>
{
if
(
data
.
success
)
{
onCancel
()
message
.
success
(
'
发布
成功!'
)
message
.
success
(
'
替换
成功!'
)
dataCenter
?.
type
&&
fetchData
(
'/page/queryPage'
,
{},
'queryPage'
)
.
then
((
res
)
=>
{
})
}
else
{
message
.
error
(
data
.
error
||
'发布
失败'
)
message
.
error
(
'替换
失败'
)
}
});
}
else
{
...
...
src/modal/RemoveType.jsx
View file @
e43599c4
import
{
Menu
,
Modal
,
Popconfirm
,
Space
,
Table
}
from
'antd'
;
import
React
,
{
useContext
,
useEffect
,
useState
}
from
'react'
;
import
{
Menu
,
Modal
,
Popconfirm
,
Space
,
Table
,
message
}
from
'antd'
;
import
React
,
{
useContext
,
useEffect
,
useState
}
from
'react'
;
import
TypeModal
from
'../modal/TypeModal'
import
{
Root
}
from
"../dataCenter/Root"
;
import
{
NEED_UPDATE_INDEX
}
from
"../dataCenter/action"
;
import
{
Root
}
from
"../dataCenter/Root"
;
const
menu
=
(
<
Menu
>
...
...
@@ -13,88 +14,76 @@ const menu = (
function
RemoveType
({
visible
,
onCancel
})
{
const
[
typeModal
,
setTypeModal
]
=
useState
(
false
)
const
[
typeData
,
settypeData
]
=
useState
(
''
)
const
[
oldData
,
setoldData
]
=
useState
(
''
)
const
{
fetchData
,
dataCenter
}
=
useContext
(
Root
)
const
{
fetchData
,
dataCenter
,
dispatch
}
=
useContext
(
Root
)
const
changType
=
(
data
)
=>
{
setoldData
(
data
)
setTypeModal
(
true
)
}
const
changeData
=
(
list
,
cb
)
=>
{
return
list
.
map
((
item
,
index
)
=>
{
const
res
=
cb
(
item
);
if
(
item
.
children
)
res
.
children
=
changeData
(
item
.
children
,
item
=>
({
isRemove
:
true
,
key
:
item
.
childTypeId
,
typeId
:
item
.
childTypeId
,
typeName
:
item
.
childTypeName
,
}));
return
res
;
})
}
const
removeType
=
(
data
)
=>
{
console
.
log
(
data
);
fetchData
(
'/typeManage/deleteChildType'
,
{
childTypeId
:
data
.
typeId
})
.
then
((
res
)
=>
{
if
(
res
.
success
)
{
message
.
success
(
'刪除成功'
)
dispatch
(
NEED_UPDATE_INDEX
())
queryData
()
// onCancel()
}
else
{
message
.
error
(
'刪除失败'
)
}
})
}
useEffect
(
()
=>
{
const
queryData
=
()
=>
{
dataCenter
?.
type
&&
fetchData
(
'/typeManage/queryTypeForManage'
,
{},
'childTypeData'
)
.
then
((
res
)
=>
{
console
.
log
(
res
);
// console.log(res.data);
const
newData
=
changeData
(
res
.
data
,
item
=>
({
key
:
item
.
typeId
,
typeId
:
item
.
typeId
,
typeName
:
item
.
typeName
,
}));
// console.log(newData);
settypeData
(
newData
)
})
}
useEffect
(()
=>
{
queryData
()
},
[])
const
columns
=
[
{
title
:
'类型名'
,
width
:
100
,
dataIndex
:
'
name'
,
key
:
'n
ame'
},
{
title
:
'Id'
,
width
:
100
,
dataIndex
:
'
platform'
,
align
:
'center'
,
key
:
'platform
'
},
{
title
:
'类型名'
,
width
:
100
,
dataIndex
:
'
typeName'
,
key
:
'typeN
ame'
},
{
title
:
'Id'
,
width
:
100
,
dataIndex
:
'
typeId'
,
align
:
'center'
,
key
:
'typeId
'
},
{
title
:
'操作'
,
width
:
100
,
key
:
'operation'
,
align
:
'center'
,
render
:
(
text
,
record
)
=>
(
<
Space
size=
"middle"
>
<
Popconfirm
title=
"确定删除吗?"
okText=
"确定"
cancelText=
"取消"
onConfirm=
{
()
=>
removeType
(
record
)
}
>
<
a
href=
"#"
>
删除
</
a
>
</
Popconfirm
>
{
record
.
isRemove
&&
<
Popconfirm
title=
"确定删除吗?"
okText=
"确定"
cancelText=
"取消"
onConfirm=
{
()
=>
removeType
(
record
)
}
>
<
a
href=
"#"
>
删除
</
a
>
</
Popconfirm
>
}
<
a
href=
"#"
onClick=
{
()
=>
changType
(
record
)
}
>
修改
</
a
>
</
Space
>
)
},
];
const
data
=
[{
key
:
1
,
name
:
'甲类型1'
,
platform
:
'iOS'
,
version
:
'10.3.4.5654'
,
upgradeNum
:
500
,
creator
:
'Jack'
,
createdAt
:
'2014-12-24 23:12:00'
,
children
:
[
{
key
:
3
,
platform
:
'3'
,
name
:
'子类型31'
,
upgradeNum
:
'Upgraded: 3'
,
},
]
},
{
key
:
2
,
name
:
'甲类型2'
,
platform
:
'iOS'
,
version
:
'10.3.4.5654'
,
upgradeNum
:
500
,
creator
:
'Jack'
,
createdAt
:
'2014-12-24 23:12:00'
,
children
:
[
{
key
:
3
,
platform
:
'32'
,
name
:
'子类型32'
,
upgradeNum
:
'Upgraded: 3'
,
},
]
},
{
key
:
3
,
name
:
'甲类型3'
,
platform
:
'iOS'
,
upgradeNum
:
500
,
children
:
[
{
key
:
3
,
platform
:
'33'
,
name
:
'子类型33'
,
upgradeNum
:
'Upgraded: 3'
,
},
]
}];
return
(
<
Modal
visible=
{
visible
}
...
...
@@ -107,13 +96,16 @@ function RemoveType({ visible, onCancel }) {
>
<
Table
columns=
{
columns
}
dataSource=
{
d
ata
}
dataSource=
{
typeD
ata
}
/>
{
typeModal
&&
<
TypeModal
visible=
{
typeModal
}
onCancel=
{
()
=>
setTypeModal
(
false
)
}
queryData=
{
()
=>
queryData
()
}
data=
{
oldData
}
/>
}
</
Modal
>
...
...
src/modal/ToolModal.jsx
View file @
e43599c4
...
...
@@ -22,14 +22,17 @@ const ToolModal = ({ visible, onCancel, data }) => {
input
=
{
...
input
,
typeId
:
values
.
type
,
childType
:
values
.
childType
childType
Id
:
values
.
childType
}
console
.
log
(
input
);
fetchData
(
'/add/addToolBox'
,
input
)
.
then
((
res
)
=>
{
if
(
res
.
success
)
{
message
.
success
(
'新建成功'
)
dispatch
(
NEED_UPDATE_INDEX
())
onCancel
()
}
else
{
message
.
error
(
'新建失败'
)
}
})
...
...
@@ -40,6 +43,8 @@ const ToolModal = ({ visible, onCancel, data }) => {
message
.
success
(
'修改成功'
)
dispatch
(
NEED_UPDATE_INDEX
())
onCancel
()
}
else
{
message
.
error
(
'新建失败'
)
}
})
}
...
...
src/modal/TypeModal.jsx
View file @
e43599c4
...
...
@@ -5,10 +5,14 @@ import { Root } from "../dataCenter/Root";
import
{
NEED_UPDATE_INDEX
}
from
"../dataCenter/action"
;
const
{
Option
}
=
Select
;
const
{
TabPane
}
=
Tabs
;
const
TypeModal
=
({
visible
,
onCancel
,
data
})
=>
{
const
TypeModal
=
({
visible
,
onCancel
,
queryData
,
data
})
=>
{
console
.
log
(
data
);
const
[
form
]
=
Form
.
useForm
();
if
(
data
)
{
form
.
setFieldsValue
({
typeName
:
data
.
typeName
,
});
}
const
formItemLayout
=
{
labelCol
:
{
span
:
4
},
wrapperCol
:
{
span
:
18
},
...
...
@@ -19,9 +23,33 @@ const TypeModal = ({ visible, onCancel, data }) => {
const
onCreate
=
(
values
)
=>
{
if
(
data
)
{
console
.
log
(
data
);
let
input
=
{
typeId
:
''
,
typeName
:
''
}
if
(
!
data
.
isRemove
)
{
input
=
{
typeId
:
data
.
typeId
,
typeName
:
values
.
typeName
}
}
else
{
input
=
{
childTypeId
:
data
.
typeId
,
childTypeName
:
values
.
typeName
}
}
fetchData
(
'/typeManage/updateType'
,
input
)
.
then
((
res
)
=>
{
if
(
res
.
success
)
{
message
.
success
(
'修改成功'
)
dispatch
(
NEED_UPDATE_INDEX
())
queryData
()
onCancel
()
}
})
}
else
{
console
.
log
(
values
);
fetchData
(
'/add/addType'
,
values
)
...
...
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