Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
szse
Overview
Overview
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
zhaochengxiang
szse
Commits
a21c2933
Commit
a21c2933
authored
Mar 07, 2022
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资产打标签
parent
899804be
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
96 additions
and
40 deletions
+96
-40
AssetAction.jsx
src/view/Manage/AssetManage/Component/AssetAction.jsx
+5
-1
AddTagModal.jsx
src/view/Manage/Tag/Component/AddTagModal.jsx
+90
-38
index.jsx
src/view/Manage/Tag/index.jsx
+1
-1
No files found.
src/view/Manage/AssetManage/Component/AssetAction.jsx
View file @
a21c2933
...
@@ -295,9 +295,13 @@ const AssetAction = (props) => {
...
@@ -295,9 +295,13 @@ const AssetAction = (props) => {
</
Descriptions
.
Item
>
</
Descriptions
.
Item
>
}
}
<
Descriptions
.
Item
label=
{
<
div
className=
'title-text'
style=
{
{
textAlign
:
'right'
,
width
:
60
}
}
>
标签
</
div
>
}
style=
{
{
paddingBottom
:
0
}
}
>
<
Descriptions
.
Item
label=
{
<
div
className=
'title-text'
style=
{
{
textAlign
:
'right'
,
width
:
60
}
}
>
标签
</
div
>
}
style=
{
{
paddingBottom
:
0
}
}
>
<
AppContext
.
Consumer
>
{
{
(
currentAction
===
'add'
||
currentAction
===
'edit'
)?<
Tag
styleType=
'complex'
id=
{
id
}
/>:<
Tag
id=
{
id
}
/>
value
=>
{
return
(
currentAction
===
'add'
||
currentAction
===
'edit'
)?<
Tag
styleType=
'complex'
id=
{
id
}
creator=
{
value
?.
user
?.
userName
||
''
}
/>:<
Tag
id=
{
id
}
creator=
{
value
?.
user
?.
userName
||
''
}
/>
}
}
}
</
AppContext
.
Consumer
>
</
Descriptions
.
Item
>
</
Descriptions
.
Item
>
</
Descriptions
>
</
Descriptions
>
</
div
>
</
div
>
...
...
src/view/Manage/Tag/Component/AddTagModal.jsx
View file @
a21c2933
import
React
,
{
useState
}
from
'react'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Modal
,
Button
,
AutoComplete
,
Input
,
Avatar
}
from
'antd'
;
import
{
Modal
,
Button
,
AutoComplete
,
Input
,
Avatar
,
TreeSelect
,
Form
}
from
'antd'
;
import
{
dispatch
}
from
'../../../../model'
;
import
{
dispatch
}
from
'../../../../model'
;
import
{
showMessage
}
from
'../../../../util'
;
import
{
showMessage
}
from
'../../../../util'
;
...
@@ -18,6 +18,18 @@ const AddTagModal = (props) => {
...
@@ -18,6 +18,18 @@ const AddTagModal = (props) => {
const
[
options
,
setOptions
]
=
useState
();
const
[
options
,
setOptions
]
=
useState
();
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
);
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
);
const
[
description
,
setDescription
]
=
useState
(
''
);
const
[
description
,
setDescription
]
=
useState
(
''
);
const
[
tagForm
,
setTagForm
]
=
useState
({});
const
[
form
]
=
Form
.
useForm
();
useEffect
(()
=>
{
if
(
visible
)
{
getTagByKeywordAndCreator
();
getSupportTagForm
();
}
},
[
visible
])
const
getTagByKeywordAndCreator
=
(
value
=
keyword
)
=>
{
const
getTagByKeywordAndCreator
=
(
value
=
keyword
)
=>
{
dispatch
({
dispatch
({
...
@@ -78,6 +90,20 @@ const AddTagModal = (props) => {
...
@@ -78,6 +90,20 @@ const AddTagModal = (props) => {
})
})
}
}
const
getSupportTagForm
=
()
=>
{
dispatch
({
type
:
'tag.getSupportTagForm'
,
payload
:
{
isDefault
:
false
,
type
:
'private'
,
creator
},
callback
:
data
=>
{
setTagForm
(
data
||
{});
}
})
}
const
onOk
=
()
=>
{
const
onOk
=
()
=>
{
if
(
keyword
===
''
)
{
if
(
keyword
===
''
)
{
showMessage
(
'warn'
,
'请先填写标签'
);
showMessage
(
'warn'
,
'请先填写标签'
);
...
@@ -118,33 +144,23 @@ const AddTagModal = (props) => {
...
@@ -118,33 +144,23 @@ const AddTagModal = (props) => {
setStep
(
0
);
setStep
(
0
);
}
}
const
onCreate
=
()
=>
{
const
onCreate
=
async
()
=>
{
setConfirmLoading
(
true
);
try
{
dispatch
({
const
row
=
await
form
?.
validateFields
();
type
:
'tag.getSupportTagForm'
,
payload
:
{
const
newTagForm
=
JSON
.
parse
(
JSON
.
stringify
(
tagForm
));
isDefault
:
true
,
(
newTagForm
?.
targetParameters
||
[]).
forEach
(
param
=>
{
type
:
'private'
,
param
.
value
=
row
[
param
.
name
];
creator
},
callback
:
data
=>
{
const
_tagForm
=
data
||
{};
(
_tagForm
.
targetParameters
||
[]).
forEach
(
param
=>
{
if
(
param
.
name
===
'name'
)
{
param
.
value
=
keyword
;
}
if
(
param
.
name
===
'desc'
)
{
param
.
value
=
description
;
}
})
})
setConfirmLoading
(
true
);
dispatch
({
dispatch
({
type
:
'tag.saveTag'
,
type
:
'tag.saveTag'
,
payload
:
{
payload
:
{
params
:
{
params
:
{
isDefault
:
tru
e
isDefault
:
fals
e
},
},
data
:
_t
agForm
data
:
newT
agForm
},
},
callback
:
data
=>
{
callback
:
data
=>
{
dispatch
({
dispatch
({
...
@@ -170,15 +186,10 @@ const AddTagModal = (props) => {
...
@@ -170,15 +186,10 @@ const AddTagModal = (props) => {
setConfirmLoading
(
false
);
setConfirmLoading
(
false
);
}
}
})
})
},
error
:
()
=>
{
setConfirmLoading
(
false
);
}
})
}
const
onFocus
=
()
=>
{
}
catch
(
errInfo
)
{
getTagByKeywordAndCreator
();
console
.
log
(
'Validate Failed:'
,
errInfo
);
}
}
}
const
onKeywordChange
=
(
value
)
=>
{
const
onKeywordChange
=
(
value
)
=>
{
...
@@ -219,6 +230,25 @@ const AddTagModal = (props) => {
...
@@ -219,6 +230,25 @@ const AddTagModal = (props) => {
setKeyword
(
''
);
setKeyword
(
''
);
}
}
const
loop
=
(
data
)
=>
data
.
map
(
item
=>
{
if
((
item
.
children
||
[]).
length
>
0
)
{
return
{
...
item
,
...{
title
:
item
.
name
,
value
:
item
.
idString
,
children
:
loop
(
item
.
children
)}
};
}
return
{
...
item
,
...{
title
:
item
.
name
,
value
:
item
.
idString
}};
});
const
formItemLayout
=
{
labelCol
:
{
xs
:
{
span
:
24
},
sm
:
{
span
:
4
},
},
wrapperCol
:
{
xs
:
{
span
:
24
},
sm
:
{
span
:
20
},
},
};
let
footer
=
[];
let
footer
=
[];
...
@@ -253,7 +283,6 @@ const AddTagModal = (props) => {
...
@@ -253,7 +283,6 @@ const AddTagModal = (props) => {
type=
"primary"
type=
"primary"
loading=
{
confirmLoading
}
loading=
{
confirmLoading
}
onClick=
{
onCreate
}
onClick=
{
onCreate
}
disabled=
{
description
===
''
}
>
>
创建
创建
</
Button
>
</
Button
>
...
@@ -276,19 +305,42 @@ const AddTagModal = (props) => {
...
@@ -276,19 +305,42 @@ const AddTagModal = (props) => {
allowClear
allowClear
value=
{
keyword
}
value=
{
keyword
}
onChange=
{
onKeywordChange
}
onChange=
{
onKeywordChange
}
onFocus=
{
onFocus
}
options=
{
options
}
options=
{
options
}
onSelect=
{
onSelect
}
onSelect=
{
onSelect
}
/>
/>
}
}
{
{
step
===
1
&&
<
TextArea
step
===
1
&&
<
Form
row=
{
4
}
{
...
formItemLayout
}
form=
{
form
}
initialValues=
{
{
name
:
keyword
}
}
>
{
(
tagForm
?.
targetParameters
||
[]).
map
((
param
,
index
)
=>
{
if
(
param
.
name
===
'usable'
)
return
null
;
return
(
<
Form
.
Item
key=
{
index
}
label=
{
param
.
cnName
||
''
}
name=
{
param
.
name
||
''
}
rules=
{
[{
required
:
param
.
required
,
message
:
`请选择${param.cnName}!`
}]
}
>
{
(
param
.
selectMode
===
'singleSelect'
)
?
<
TreeSelect
style=
{
{
width
:
'100%'
}
}
style=
{
{
width
:
'100%'
}
}
value=
{
description
}
dropdownStyle=
{
{
maxHeight
:
400
,
overflow
:
'auto'
}
}
onChange=
{
onDescriptionChange
}
treeData=
{
loop
(
param
?.
tagCatalogNode
?.
children
||
[])
}
placeholder=
'为您的新标签填写描述'
treeDefaultExpandAll
/>
allowClear
/>
:
<
Input
disabled=
{
param
.
name
===
'name'
}
/>
}
</
Form
.
Item
>
);
})
}
</
Form
>
}
}
</
Modal
>
</
Modal
>
)
)
...
...
src/view/Manage/Tag/index.jsx
View file @
a21c2933
...
@@ -6,7 +6,7 @@ import AddTagModal from './Component/AddTagModal';
...
@@ -6,7 +6,7 @@ import AddTagModal from './Component/AddTagModal';
import
{
dispatch
}
from
'../../../model'
;
import
{
dispatch
}
from
'../../../model'
;
const
TagColumn
=
(
props
)
=>
{
const
TagColumn
=
(
props
)
=>
{
const
{
id
,
type
=
'
dataModel'
,
creator
=
'demotest
'
,
styleType
=
'simple'
}
=
props
;
const
{
id
,
type
=
'
asset'
,
creator
=
'
'
,
styleType
=
'simple'
}
=
props
;
const
[
ownTags
,
setOwnTags
]
=
useState
([]);
const
[
ownTags
,
setOwnTags
]
=
useState
([]);
const
[
addTagModalVisible
,
setAddTagModalVisible
]
=
useState
(
false
);
const
[
addTagModalVisible
,
setAddTagModalVisible
]
=
useState
(
false
);
...
...
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