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
2 years ago
Commit
d4bd7306c8906e6c67a7a7e59b85578658c1bb5c
1 parent
f59d070a
chore: 请求参数优化
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
89 additions
and
75 deletions
hg-monitor-web-base/src/main/resources/static/src/controller/common.js
hg-monitor-web-base/src/main/resources/static/src/controller/login.js
hg-monitor-web-base/src/main/resources/static/src/controller/mxgraphView.js
hg-monitor-web-base/src/main/resources/static/src/controller/pageForwardMJ.js
hg-monitor-web-base/src/main/resources/static/src/lib/extend/cascader.js
hg-monitor-web-base/src/main/resources/static/src/lib/mxgraph/src/js/mxClient.js
hg-monitor-web-base/src/main/resources/static/src/lib/view.js
hg-monitor-web-qh/src/main/resources/static/src/controller/common.js
hg-monitor-web-base/src/main/resources/static/src/controller/common.js
View file @
d4bd730
...
...
@@ -1258,21 +1258,21 @@ layui.define(['xmSelect', 'md5'], function (exports) {
}
// End Wang 2021/12/13 19:43 权限列表,如果能从缓存中加载到数据,则获取缓存中的数据
var
pers
=
[];
$
.
ajax
({
type
:
'get'
,
url
:
obj
.
domainName
+
'/api-u/users/current?access_token='
+
access_token
,
contentType
:
"application/json; charset=utf-8"
,
async
:
false
,
success
:
function
(
data
)
{
pers
=
data
.
permissions
;
$
(
"[permission]"
).
each
(
function
()
{
var
per
=
$
(
this
).
attr
(
"permission"
);
if
(
$
.
inArray
(
per
,
pers
)
<
0
)
{
$
(
this
).
hide
();
}
});
}
});
// $.ajax({
// type: 'get',
// url: obj.domainName + '/api-u/users/current?access_token=' + access_token,
// contentType: "application/json; charset=utf-8",
// async: false,
// success: function (data) {
// pers = data.permissions;
// $("[permission]").each(function () {
// var per = $(this).attr("permission");
// if ($.inArray(per, pers) < 0) {
// $(this).hide();
// }
// });
// }
// });
return
pers
;
},
/* pid转children形式 */
...
...
hg-monitor-web-base/src/main/resources/static/src/controller/login.js
View file @
d4bd730
...
...
@@ -52,20 +52,20 @@ layui.define(['sessions', 'form', 'common'], function (exports) {
if
(
localStorage
.
layuiAdmin
)
{
var
access_token
=
JSON
.
parse
(
localStorage
.
layuiAdmin
).
access_token
;
if
(
access_token
!=
null
&&
access_token
.
trim
().
length
!=
0
)
{
$
.
ajax
({
type
:
'get'
,
url
:
common
.
domainName
+
'/api-u/users/current?access_token='
+
access_token
,
dataType
:
'jsonp'
,
// 处理Ajax跨域问题
success
:
function
(
data
)
{
location
.
hash
=
search
.
redirect
?
decodeURIComponent
(
search
.
redirect
)
:
'/'
;
},
error
:
function
(
xhr
,
textStatus
,
errorThrown
)
{
if
(
xhr
.
status
==
401
)
{
localStorage
.
removeItem
(
"access_token"
);
localStorage
.
removeItem
(
"initTips"
);
}
}
});
// $.ajax({
// type: 'get',
// url: common.domainName + '/api-u/users/current?access_token=' + access_token,
// dataType: 'jsonp', // 处理Ajax跨域问题
// success: function (data) {
// location.hash = search.redirect ? decodeURIComponent(search.redirect) : '/';
// },
// error: function (xhr, textStatus, errorThrown) {
// if (xhr.status == 401) {
// localStorage.removeItem("access_token");
// localStorage.removeItem("initTips");
// }
// }
// });
}
}
...
...
hg-monitor-web-base/src/main/resources/static/src/controller/mxgraphView.js
View file @
d4bd730
...
...
@@ -18,7 +18,7 @@ layui.define(['common', 'sessions', 'commonDetail', 'mxClient', 'cascader'], fun
//对外暴露的接口
exports
(
'mxgraphView'
,
function
()
{
var
sessions
=
layui
.
sessions
;
var
accessToken
=
sessions
.
getToken
().
access_token
;
var
accessToken
=
common
.
getMjToken
()
;
var
router
=
layui
.
router
();
var
topoId
=
router
.
search
.
id
;
var
from
=
router
.
search
.
from
;
...
...
@@ -300,7 +300,7 @@ layui.define(['common', 'sessions', 'commonDetail', 'mxClient', 'cascader'], fun
if
(
topoId
)
{
//编辑拓扑
$
(
"#gotoedittopo"
).
unbind
(
'click'
).
on
(
"click"
,
function
()
{
$
(
this
).
attr
(
"lay-href"
,
"/mxgraph/setting/id="
+
topoId
)
$
(
this
).
attr
(
"lay-href"
,
"/
grapheditor-web/
mxgraph/setting/id="
+
topoId
)
});
}
}
else
if
(
res
.
object
&&
res
.
object
.
xmlInfo
&&
(
new
Date
(
res
.
object
.
createTime
)
>
new
Date
(
'2021-03-23 17:28'
)))
{
...
...
@@ -312,11 +312,11 @@ layui.define(['common', 'sessions', 'commonDetail', 'mxClient', 'cascader'], fun
//xwx 2021-10-29 拓扑视图下拉选择框默认回填 --end
// $("#mxgraph-topoTitle").text(" - " + res.object.topoName);
}
$
(
'#newViewGraphContainer iframe'
).
attr
(
'src'
,
`
$
{
common
.
graphEditorOrigin
}
/jgraph/g
rapheditor
/
viewer
.
html
?
access_token
=
$
{
accessToken
}
&
id
=
$
{
topoId
}
`
);
$
(
'#newViewGraphContainer iframe'
).
attr
(
'src'
,
`
/
grapheditor
-
web
/
jgraph
/
grapheditor
/
viewer
.
html
?
access_token
=
$
{
accessToken
}
&
id
=
$
{
topoId
}
`
);
if
(
topoId
)
{
//编辑拓扑
$
(
"#gotoedittopo"
).
unbind
(
'click'
).
on
(
"click"
,
function
()
{
var
url
=
common
.
graphEditorOrigin
+
"
/jgraph/grapheditor/index.html?access_token="
+
accessToken
+
'&id='
+
topoId
;
var
url
=
"/grapheditor-web
/jgraph/grapheditor/index.html?access_token="
+
accessToken
+
'&id='
+
topoId
;
window
.
open
(
url
);
});
}
...
...
@@ -715,30 +715,28 @@ layui.define(['common', 'sessions', 'commonDetail', 'mxClient', 'cascader'], fun
}
}
//拓扑树组件渲染
$
.
ajax
({
admin
.
req
({
url
:
common
.
domainName
+
'/api-web/mxgraph/getPageByTree?isDefault=1&access_token='
+
accessToken
,
type
:
'get'
,
success
:
function
(
res
)
{
if
(
res
&&
res
.
data
)
{
var
data
=
res
.
data
var
JtopoIds
=
res
.
str
.
split
(
','
);
cascader
({
elem
:
"#mxgraph_topoTree"
,
data
:
data
,
triggerType
:
"change"
,
showLastLevels
:
true
,
success
:
function
(
valData
,
labelData
)
{
console
.
log
(
valData
,
labelData
);
var
topoId
=
valData
[
valData
.
length
-
1
]
if
(
JtopoIds
.
indexOf
(
topoId
)
!==
-
1
)
{
renderMxgraphView
(
topoId
)
}
data
:
{
}
}).
done
(
function
(
res
)
{
if
(
res
&&
res
.
data
)
{
var
data
=
res
.
data
var
JtopoIds
=
res
.
str
.
split
(
','
);
cascader
({
elem
:
"#mxgraph_topoTree"
,
data
:
data
,
triggerType
:
"change"
,
showLastLevels
:
true
,
success
:
function
(
valData
,
labelData
)
{
console
.
log
(
valData
,
labelData
);
var
topoId
=
valData
[
valData
.
length
-
1
]
if
(
JtopoIds
.
indexOf
(
topoId
)
!==
-
1
)
{
renderMxgraphView
(
topoId
)
}
});
}
}
});
}
})
});
});
});
...
...
hg-monitor-web-base/src/main/resources/static/src/controller/pageForwardMJ.js
View file @
d4bd730
...
...
@@ -58,7 +58,8 @@ layui.define(['sessions', 'form', 'common'], function (exports) {
var
authKey
=
getUrlParam
(
"AuthKey"
);
var
authVal
=
getUrlParam
(
"AuthVal"
);
localStorage
.
setItem
(
"AuthKey"
,
authKey
);
localStorage
.
setItem
(
"AuthVal"
,
authVal
);
layer
.
getTokenInfo
(
setter
,
sessions
,
authKey
,
authVal
);
// 跳转地址
...
...
hg-monitor-web-base/src/main/resources/static/src/lib/extend/cascader.js
View file @
d4bd730
...
...
@@ -350,4 +350,4 @@ layui.define(["jquery", "laytpl", "layer"], function (exports) {
return
thisCas
.
call
(
ins
);
});
})
layui
.
link
(
'
../..
/src/style/css/cascader.css'
)
layui
.
link
(
'
/monitor-web
/src/style/css/cascader.css'
)
...
...
hg-monitor-web-base/src/main/resources/static/src/lib/mxgraph/src/js/mxClient.js
View file @
d4bd730
...
...
@@ -445,7 +445,6 @@ if (typeof (mxBasePath) != 'undefined' && mxBasePath.length > 0) {
if
(
mxBasePath
.
substring
(
mxBasePath
.
length
-
1
)
==
'/'
)
{
mxBasePath
=
mxBasePath
.
substring
(
0
,
mxBasePath
.
length
-
1
);
}
debugger
mxClient
.
basePath
=
mxBasePath
;
}
else
{
mxClient
.
basePath
=
'.'
;
...
...
hg-monitor-web-base/src/main/resources/static/src/lib/view.js
View file @
d4bd730
...
...
@@ -7,7 +7,8 @@
*/
layui
.
define
([
'laytpl'
,
'layer'
],
function
(
exports
)
{
layui
.
define
([
'laytpl'
,
'layer'
,
'common'
],
function
(
exports
)
{
var
common
=
layui
.
common
;
var
$
=
layui
.
jquery
,
laytpl
=
layui
.
laytpl
,
layer
=
layui
.
layer
...
...
@@ -116,8 +117,12 @@ layui.define(['laytpl', 'layer'], function (exports) {
// // ? options.headers[request.tokenName]
// // : (layui.data(setter.tableName)[request.tokenName] || '');
// }
let
tokenVal
=
common
.
getMjToken
();
let
tokenKey
=
common
.
getMjTokenKey
();
if
(
request
.
tokenName
)
{
if
(
options
.
type
==
'post'
){
options
.
headers
[
tokenKey
]
=
tokenVal
;
}
else
if
(
request
.
tokenName
)
{
let
tokenVal
=
options
.
data
[
request
.
tokenName
];
if
(
!
tokenVal
||
tokenVal
==
''
){
options
.
data
[
request
.
tokenName
]
=
localStorage
.
getItem
(
request
.
tokenName
);
...
...
hg-monitor-web-qh/src/main/resources/static/src/controller/common.js
View file @
d4bd730
...
...
@@ -33,6 +33,17 @@ layui.define(['xmSelect', 'md5'], function (exports) {
alarmTimer
:
null
,
//首页告警刷新定时器
limit
:
50
,
//全局分页条目数
limits
:
[
50
,
100
,
150
,
200
],
//全局分页条目数组
/**
* 获取墨镜平台的token
* @returns {string}
*/
getMjToken
:
()
=>
{
return
localStorage
.
getItem
(
"AuthVal"
)
},
getMjTokenKey
:
()
=>
{
return
localStorage
.
getItem
(
"AuthKey"
)
},
//base64加密
Base64
:
{
_keyStr
:
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
,
...
...
@@ -1265,21 +1276,21 @@ layui.define(['xmSelect', 'md5'], function (exports) {
}
// End Wang 2021/12/13 19:43 权限列表,如果能从缓存中加载到数据,则获取缓存中的数据
var
pers
=
[];
$
.
ajax
({
type
:
'get'
,
url
:
obj
.
domainName
+
'/api-u/users/current?access_token='
+
access_token
,
contentType
:
"application/json; charset=utf-8"
,
async
:
false
,
success
:
function
(
data
)
{
pers
=
data
.
permissions
;
$
(
"[permission]"
).
each
(
function
()
{
var
per
=
$
(
this
).
attr
(
"permission"
);
if
(
$
.
inArray
(
per
,
pers
)
<
0
)
{
$
(
this
).
hide
();
}
});
}
});
// $.ajax({
// type: 'get',
// url: obj.domainName + '/api-u/users/current?access_token=' + access_token,
// contentType: "application/json; charset=utf-8",
// async: false,
// success: function (data) {
// pers = data.permissions;
// $("[permission]").each(function () {
// var per = $(this).attr("permission");
// if ($.inArray(per, pers) < 0) {
// $(this).hide();
// }
// });
// }
// });
return
pers
;
},
/* pid转children形式 */
...
...
Please
register
or
login
to post a comment