Toggle navigation
Toggle navigation
This project
Loading...
Sign in
monitor_v3
/
hg-monitor-web
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
wf
2 years ago
Commit
5706b77107869dbae9a0db0177973817f30c752d
1 parent
ba74de33
资源类型打标签
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
1 deletions
hg-monitor-web-base/src/main/resources/static/src/controller/kpiAdd.js
hg-monitor-web-base/src/main/resources/static/src/controller/resourcetype.js
hg-monitor-web-base/src/main/resources/static/src/views/baseconfig/resourcetype/index.html
hg-monitor-web-base/src/main/resources/static/src/controller/kpiAdd.js
View file @
5706b77
...
...
@@ -169,7 +169,6 @@ layui.define(['table', 'admin', 'form', 'laydate', 'common', 'sessions', 'xmSele
tagIds
.
push
(
$
(
this
).
attr
(
"id"
))
}
$
(
"#selectTagIds"
).
val
(
tagIds
)
console
.
log
(
tagIds
);
});
}
...
...
hg-monitor-web-base/src/main/resources/static/src/controller/resourcetype.js
View file @
5706b77
...
...
@@ -20,6 +20,7 @@ layui.define(['form', 'admin', 'layer', 'laytpl', 'common', 'view', 'sessions',
var
resource_view
=
''
;
var
biz_view
=
''
;
var
collTypeSelect
=
''
;
var
tagIds
=
[];
//传递参数
let
resTypes
=
data
&&
data
.
resTypes
?
data
.
resTypes
:
[];
let
showType
=
data
&&
data
.
showType
==
0
?
data
.
showType
:
1
;
...
...
@@ -433,6 +434,7 @@ layui.define(['form', 'admin', 'layer', 'laytpl', 'common', 'view', 'sessions',
// 如果是编辑,回显数据
if
(
actionType
===
'edit'
)
{
var
oldResTypeCode
=
resType
.
resTypeCode
;
// 获取关联表信息
admin
.
req
({
url
:
domainName
+
'/api-web/manage/restypeProtocol/restype/'
+
resType
.
resTypeCode
...
...
@@ -509,6 +511,11 @@ layui.define(['form', 'admin', 'layer', 'laytpl', 'common', 'view', 'sessions',
})
}
refreshProtocolItems
();
// 获取标签
getTags
(
oldResTypeCode
);
}
else
{
// 获取标签
getTags
()
}
});
...
...
@@ -737,6 +744,7 @@ layui.define(['form', 'admin', 'layer', 'laytpl', 'common', 'view', 'sessions',
layer
.
closeAll
();
layer
.
msg
(
response
.
msg
,
{
icon
:
1
,
time
:
3000
});
loadResTypeTable
();
saveResTypeTagRel
(
resType
.
resTypeCode
);
}
else
{
layer
.
msg
(
actionName
+
'失败!'
,
{
icon
:
2
,
time
:
3000
});
}
...
...
@@ -749,6 +757,62 @@ layui.define(['form', 'admin', 'layer', 'laytpl', 'common', 'view', 'sessions',
}
};
//保存标签关系
function
saveResTypeTagRel
(
resTypeCode
){
var
selectTagIds
=
$
(
"#selectResTypeTagIds"
).
val
();
var
parmas
=
{
id
:
resTypeCode
,
tags
:
selectTagIds
,
type
:
"RESTYPE"
}
admin
.
req
({
url
:
common
.
domainName
+
'/api-web/systag/save'
,
method
:
'get'
,
data
:
parmas
,
sync
:
false
,
success
:
function
(
res
)
{
console
.
log
(
"标签保存成功!"
)
}
});
}
function
getTags
(
resType
)
{
tagIds
=
[];
admin
.
req
({
url
:
common
.
domainName
+
'/api-web/systag/list?type=RESTYPE&id='
+
resType
,
type
:
'get'
,
sync
:
false
,
success
:
function
(
res
)
{
var
html
=
''
;
if
(
res
.
data
&&
res
.
data
.
length
>
0
){
var
activeTag
=
""
;
res
.
data
.
forEach
((
v
,
i
)
=>
{
if
(
v
.
selTag
){
tagIds
.
push
(
v
.
id
);
activeTag
=
"activeTag"
;
}
else
{
activeTag
=
""
;
}
html
+=
`
<
span
class
=
"tag ${activeTag}"
id
=
"${v.id}"
>
$
{
v
.
name
}
<
/span>`
;
});
}
$
(
"#restype-tags"
).
html
(
html
);
//添加点击事件
$
(
"#restype-tags"
).
find
(
".tag"
).
on
(
"click"
,
function
()
{
if
(
$
(
this
).
hasClass
(
"activeTag"
)){
$
(
this
).
removeClass
(
"activeTag"
);
tagIds
.
splice
(
$
(
this
).
attr
(
'id'
),
1
);
}
else
{
$
(
this
).
addClass
(
"activeTag"
);
tagIds
.
push
(
$
(
this
).
attr
(
"id"
))
}
$
(
"#selectResTypeTagIds"
).
val
(
tagIds
)
});
}
});
}
//查找子节点
function
getChilds
(
resTypeCode
)
{
$
.
each
(
$
(
'.ew-tree-table'
).
find
(
'table tbody tr'
),
function
()
{
...
...
hg-monitor-web-base/src/main/resources/static/src/views/baseconfig/resourcetype/index.html
View file @
5706b77
...
...
@@ -122,6 +122,14 @@
<
input
type
=
"hidden"
id
=
'input-restype-options'
name
=
"options"
required
lay
-
verify
=
"required"
placeholder
=
"请输入配置信息"
class
=
"layui-input"
>
<
/div
>
<
div
class
=
"layui-form-item"
>
<
label
class
=
"layui-form-label"
>
标签:
<
/label
>
<
div
class
=
"layui-input-block input-with-prefix"
>
<
div
id
=
"restype-tags"
style
=
"line-height: 40px"
><
/div
>
<
/div
>
<
input
type
=
"hidden"
id
=
"selectResTypeTagIds"
>
<
/div
>
<
button
id
=
"btn-restype-submit"
class
=
"hide"
lay
-
submit
lay
-
filter
=
"res-type-submit"
>
提交
<
/button
>
<
/form
>
<
form
class
=
"layui-form form-edit layui-form-pane"
onsubmit
=
"return false;"
>
...
...
Please
register
or
login
to post a comment