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
wangtao
3 years ago
Commit
f9747aca14f9307e63d64387ca029bea81438e60
1 parent
3ebcacc4
页面右键提示信息支持页面(layui页面)配置
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
153 additions
and
153 deletions
hg-monitor-web-base/src/main/resources/static/src/controller/commonCols.js
hg-monitor-web-base/src/main/resources/static/src/controller/shutdownplanIndex.js
hg-monitor-web-base/src/main/resources/static/src/index.js
hg-monitor-web-base/src/main/resources/static/src/lib/view.js
hg-monitor-web-base/src/main/resources/static/src/pageTips.js
hg-monitor-web-base/src/main/resources/static/src/controller/commonCols.js
View file @
f9747ac
...
...
@@ -3003,156 +3003,6 @@ layui.define(['soulTable', 'commonDetail', 'common', 'laytpl', 'view', 'admin',
layer
.
close
(
nameClickLoading
);
},
//start lsq 停机计划中的右键点击事件 2022-05-19
contextmenuEvent
:
function
(){
var
contextmenuTips
;
let
urlHash
=
window
.
location
.
hash
;
$
(
'[type=button]'
).
attr
(
'title'
,
'点击鼠标右键查看功能点描述信息'
)
$
(
'td .layui-table-link'
).
attr
(
'title'
,
'点击鼠标右键查看功能点描述信息'
)
$
(
'table thead tr th span'
).
attr
(
'title'
,
'点击鼠标右键查看功能点描述信息'
)
$
(
'[type=button]'
).
contextmenu
(
function
(
e
)
{
e
.
preventDefault
();
//按钮
let
that
=
$
(
this
);
let
elementName
=
that
.
text
().
replace
(
regular
,
""
);
admin
.
req
({
url
:
common
.
domainName
+
'/api-web/bHalt'
,
data
:{
urlHash
:
urlHash
,
elementName
:
elementName
}
,
async
:
false
,
done
:
function
(
res
)
{
let
liEle
=
''
var
contextmenuEl
=
'<ul id="tipContextmenu" class="contextmenu-style" style="color:#fff;">'
;
if
(
res
.
data
&&
res
.
data
.
length
>
0
){
let
tipData
=
res
.
data
;
tipData
.
map
(
item
=>
{
contextmenuEl
+=
'<li>'
+
item
.
elementExplain
+
'</li>'
;
})
}
else
{
contextmenuEl
+=
'<li>'
+
elementName
+
'</li>'
;
}
contextmenuEl
+=
'</ul>'
;
contextmenuTips
=
layer
.
tips
(
contextmenuEl
,
that
,
{
time
:
0
,
tips
:
[
3
,
'#1e9fff'
],
success
()
{
}
})
}
})
})
// $('.layui-table-link').parents('td').contextmenu(function (e) {
$
(
'td .layui-table-link'
).
contextmenu
(
function
(
e
)
{
e
.
preventDefault
();
//超链接
let
that
=
$
(
this
);
let
elementName
=
that
.
text
().
replace
(
regular
,
""
);
admin
.
req
({
url
:
common
.
domainName
+
'/api-web/bHalt'
,
data
:{
urlHash
:
urlHash
,
elementName
:
elementName
}
,
async
:
false
,
done
:
function
(
res
)
{
let
liEle
=
''
var
contextmenuEl
=
'<ul id="tipContextmenu" class="contextmenu-style" style="color:#fff;">'
;
if
(
res
.
data
&&
res
.
data
.
length
>
0
){
let
tipData
=
res
.
data
;
tipData
.
map
(
item
=>
{
contextmenuEl
+=
'<li>'
+
item
.
elementExplain
+
'</li>'
;
})
}
else
{
contextmenuEl
+=
'<li>'
+
elementName
+
'</li>'
;
}
contextmenuEl
+=
'</ul>'
;
contextmenuTips
=
layer
.
tips
(
contextmenuEl
,
that
,
{
time
:
0
,
tips
:
[
3
,
'#1e9fff'
],
success
()
{
}
})
}
})
})
// $('table thead tr th').contextmenu(function (e) {
$
(
'table thead tr th span'
).
contextmenu
(
function
(
e
)
{
e
.
preventDefault
();
//表头
let
that
=
$
(
this
);
let
elementName
=
that
.
text
().
replace
(
regular
,
""
);
admin
.
req
({
url
:
common
.
domainName
+
'/api-web/bHalt'
,
data
:{
urlHash
:
urlHash
,
elementName
:
elementName
}
,
async
:
false
,
done
:
function
(
res
)
{
let
liEle
=
''
var
contextmenuEl
=
'<ul id="tipContextmenu" class="contextmenu-style" style="color:#fff;">'
;
if
(
res
.
data
&&
res
.
data
.
length
>
0
){
let
tipData
=
res
.
data
;
tipData
.
map
(
item
=>
{
contextmenuEl
+=
'<li>'
+
item
.
elementExplain
+
'</li>'
;
})
}
else
{
contextmenuEl
+=
'<li>'
+
elementName
+
'</li>'
;
}
contextmenuEl
+=
'</ul>'
;
contextmenuTips
=
layer
.
tips
(
contextmenuEl
,
that
,
{
time
:
0
,
tips
:
[
3
,
'#1e9fff'
],
success
()
{
}
})
}
})
})
/*$('[data-contextmenu]').contextmenu(function (e) {
e.preventDefault();
let text='';
if($(this).data('contextmenu')=='link'){
//超链接
text='超链接';
}else if($(this).data('contextmenu')=='button'){
//按钮
text='按钮';
}else if($(this).data('contextmenu')=='th'){
//表头
text='表头';
}
var contextmenuEl='<ul class="contextmenu-style" style="color:#fff;">';
contextmenuEl+='<li>name--'+text+'->'+$(this).text()+'</li>';
contextmenuEl+='</ul>';
contextmenuTips = layer.tips(contextmenuEl, $(this), {
time: 0,
tips: [1, '#1e9fff'],
success() {
}
})
})*/
$
(
document
).
on
(
'click'
,
function
(
event
)
{
//lsq 停机计划右键tip取消 2022-05-19
// var _con1 = $('[data-contextmenu]'); // 设置目标区域
var
_con1
=
$
(
'[type=button]'
);
// 设置目标区域
var
_con2
=
$
(
'.layui-table-link'
);
// 设置目标区域
var
_con3
=
$
(
'table thead tr th'
);
// 设置目标区域
/*if (contextmenuTips && !_con1.is(event.target) && _con1.has(event.target).length === 0) {
layer.close(contextmenuTips);
}*/
if
(
contextmenuTips
&&
(
!
_con1
.
is
(
event
.
target
)
||
!
_con2
.
is
(
event
.
target
)
||
!
_con3
.
is
(
event
.
target
))
&&
(
_con1
.
has
(
event
.
target
).
length
===
0
||
_con2
.
has
(
event
.
target
).
length
===
0
||
_con3
.
has
(
event
.
target
).
length
===
0
))
{
layer
.
close
(
contextmenuTips
);
}
})
}
//end lsq 停机计划中的右键点击事件 2022-05-19
};
//对外暴露的接口
...
...
hg-monitor-web-base/src/main/resources/static/src/controller/shutdownplanIndex.js
View file @
f9747ac
...
...
@@ -253,8 +253,6 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common',
}
}]],
done
:
function
(
res
,
curr
,
count
)
{
//lsq 停机计划中的右键点击事件 2022-05-19
layui
.
commonCols
.
contextmenuEvent
();
//点击名称 进行编辑
$
(
'[shutdownplan-data-edit]'
).
on
(
'click'
,
function
()
{
...
...
hg-monitor-web-base/src/main/resources/static/src/index.js
View file @
f9747ac
...
...
@@ -12,7 +12,7 @@ layui.extend({
,
admin
:
'lib/admin'
//核心模块
/*,sessions: 'controller/sessions'*/
,
view
:
'lib/view'
//核心模块
}).
define
([
'setter'
,
'admin'
],
function
(
exports
)
{
}).
define
([
'setter'
,
'admin'
,
'pageTips'
],
function
(
exports
)
{
var
setter
=
layui
.
setter
,
element
=
layui
.
element
,
admin
=
layui
.
admin
...
...
hg-monitor-web-base/src/main/resources/static/src/lib/view.js
View file @
f9747ac
...
...
@@ -244,6 +244,12 @@ layui.define(['laytpl', 'layer'], function(exports){
that
.
parse
(
html
);
view
.
removeLoad
();
// 弹框
try
{
layui
.
pageTips
.
init
();
}
catch
(
e
)
{
console
.
log
(
e
)
}
if
(
that
.
done
){
that
.
done
(
res
);
delete
that
.
done
;
...
...
hg-monitor-web-base/src/main/resources/static/src/pageTips.js
0 → 100644
View file @
f9747ac
//性能曲线图
layui
.
define
([
'element'
,
'admin'
],
function
(
exports
)
{
var
$
=
layui
.
$
;
var
admin
=
layui
.
admin
;
var
domainName
=
sessionStorage
.
getItem
(
'domainName'
);
var
obj
=
{
data
:
{
contextmenuTips
:
null
,
contextmenus
:
[],
classNams
:
[]
},
getCurrentHash
:
function
()
{
return
window
.
location
.
hash
;
},
init
:
function
()
{
var
that
=
this
;
if
(
that
.
data
.
contextmenus
.
length
>
0
)
{
that
.
bindContextMenuEvent
();
return
that
.
data
.
contextmenus
;
}
if
(
'#/user/login/redirect=%2F'
==
that
.
getCurrentHash
()){
return
;
}
// 获取配置的信息
admin
.
req
({
url
:
domainName
+
'/api-web/manage/ddic/findSucDdics/contextmenus'
,
method
:
'POST'
,
async
:
false
,
success
:
function
(
res
)
{
$
.
each
(
res
.
data
,
function
(
i
,
v
)
{
that
.
data
.
contextmenus
.
push
(
v
.
ddicCode
);
});
that
.
bindContextMenuEvent
();
}
})
},
/**
* 获取当前元素的提示信息
* @param elementName 文本内容
* @param currentEl 当前元素
*/
getTipsDetail
(
elementName
,
currentEl
)
{
var
that
=
this
;
admin
.
req
({
url
:
domainName
+
'/api-web/bHalt'
,
data
:
{
urlHash
:
that
.
getCurrentHash
(),
elementName
:
elementName
}
,
async
:
false
,
done
:
function
(
res
)
{
var
contextmenuEl
=
'<ul id="tipContextmenu" class="contextmenu-style" style="color:#fff;">'
;
if
(
res
.
data
&&
res
.
data
.
length
>
0
)
{
let
tipData
=
res
.
data
;
tipData
.
map
(
item
=>
{
contextmenuEl
+=
'<li>'
+
item
.
elementExplain
+
'</li>'
;
})
}
else
{
contextmenuEl
+=
'<li>'
+
elementName
+
'</li>'
;
}
contextmenuEl
+=
'</ul>'
;
that
.
data
.
contextmenuTips
=
layer
.
tips
(
contextmenuEl
,
currentEl
,
{
time
:
0
,
tips
:
[
3
,
'#1e9fff'
],
success
()
{
}
})
setTimeout
(
function
(){
layer
.
closeAll
(
'tips'
);
},
5000
)
}
})
},
bindContextMenuEvent
()
{
var
that
=
this
;
var
contextmenus
=
that
.
data
.
contextmenus
;
var
bindContextEvent
=
function
(
selector
,
index
)
{
var
el
=
$
(
selector
);
// 超过30秒
if
(
index
>
60
)
{
return
;
}
if
(
el
==
null
||
el
.
length
==
0
)
{
setTimeout
(
function
()
{
bindContextEvent
(
selector
,
++
index
);
},
500
)
return
;
}
el
.
attr
(
'title'
,
'点击鼠标右键查看功能点描述信息'
)
el
.
contextmenu
(
function
(
e
)
{
e
.
preventDefault
();
let
thatItem
=
$
(
this
);
// 获取当前元素名称正则表达式
var
reg
=
sessionStorage
.
getItem
(
'regular'
);
let
elementName
=
thatItem
.
text
().
replace
(
reg
,
""
);
that
.
getTipsDetail
(
elementName
,
thatItem
);
})
}
// 循环绑定事件
var
bind
=
function
(){
$
(
contextmenus
).
each
(
function
(
index
)
{
let
val
=
contextmenus
[
index
];
if
(
val
.
indexOf
(
'el::'
)
!=
-
1
)
{
let
elName
=
val
.
replace
(
'el::'
,
''
);
bindContextEvent
(
elName
,
0
);
}
})
}
// 获取当前页面,是否在配置中
var
page
=
that
.
getCurrentHash
();
$
(
contextmenus
).
each
(
function
(
index
)
{
let
val
=
contextmenus
[
index
];
if
(
val
.
indexOf
(
'page::'
)
!=
-
1
)
{
let
elName
=
val
.
replace
(
'page::'
,
''
);
if
(
elName
==
page
){
bind
();
return
;
}
}
})
// 点击关闭所有tips
$
(
document
).
on
(
'click'
,
function
(
event
)
{
layer
.
closeAll
(
'tips'
);
})
}
}
// 页面刷新默认初始化
setTimeout
(
function
()
{
obj
.
init
();
},
1000
)
//对外暴露 的接口
exports
(
'pageTips'
,
obj
);
});
...
...
Please
register
or
login
to post a comment