mirror of https://github.com/jumpserver/jumpserver
Bugfix (#3014)
* [Bugfix] 修复英文时间时期的bug * [bugfix] 修复session时间日期的问题 * [Bugfix] 修改时间日志格式化错误 * [Update] 修改函数名称 * [Update] 修改函数顺序 * [Bugfix] 修复节点刷新菜单一直append的bugpull/3015/head
parent
9454854f6c
commit
421e98696c
|
@ -68,10 +68,12 @@ var treeUrl = '{% url 'api-assets:node-children-tree' %}?assets=0';
|
||||||
// "otherMenu": "",
|
// "otherMenu": "",
|
||||||
// "showAssets": false,
|
// "showAssets": false,
|
||||||
// }
|
// }
|
||||||
|
var inited = false;
|
||||||
function initNodeTree(options) {
|
function initNodeTree(options) {
|
||||||
if (options.showAssets) {
|
if (options.showAssets) {
|
||||||
treeUrl = setUrlParam(treeUrl, 'assets', '1')
|
treeUrl = setUrlParam(treeUrl, 'assets', '1')
|
||||||
}
|
}
|
||||||
|
var asyncTreeUrl = setUrlParam(treeUrl, 'refresh', '0');
|
||||||
var setting = {
|
var setting = {
|
||||||
view: {
|
view: {
|
||||||
dblClickExpand: false,
|
dblClickExpand: false,
|
||||||
|
@ -84,7 +86,7 @@ function initNodeTree(options) {
|
||||||
},
|
},
|
||||||
async: {
|
async: {
|
||||||
enable: true,
|
enable: true,
|
||||||
url: treeUrl,
|
url: asyncTreeUrl,
|
||||||
autoParam: ["id=key", "name=n", "level=lv"],
|
autoParam: ["id=key", "name=n", "level=lv"],
|
||||||
type: 'get'
|
type: 'get'
|
||||||
},
|
},
|
||||||
|
@ -110,15 +112,19 @@ function initNodeTree(options) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$.get(treeUrl, function (data, status) {
|
$.get(treeUrl, function (data, status) {
|
||||||
zNodes = data;
|
zTree = $.fn.zTree.init($("#nodeTree"), setting, data);
|
||||||
zTree = $.fn.zTree.init($("#nodeTree"), setting, zNodes);
|
|
||||||
rootNodeAddDom(zTree, function () {
|
rootNodeAddDom(zTree, function () {
|
||||||
treeUrl = setUrlParam(treeUrl, 'refresh', '1');
|
treeUrl = setUrlParam(treeUrl, 'refresh', '1');
|
||||||
initTree();
|
initNodeTree(options);
|
||||||
treeUrl = setUrlParam(treeUrl, 'refresh', '0')
|
treeUrl = setUrlParam(treeUrl, 'refresh', '0');
|
||||||
});
|
});
|
||||||
|
inited = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (inited) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (options.showMenu) {
|
if (options.showMenu) {
|
||||||
showMenu = true;
|
showMenu = true;
|
||||||
rMenu = $("#rMenu");
|
rMenu = $("#rMenu");
|
||||||
|
|
|
@ -122,7 +122,7 @@ function initTree() {
|
||||||
$.fn.zTree.init($("#assetTree"), setting, data);
|
$.fn.zTree.init($("#assetTree"), setting, data);
|
||||||
zTree = $.fn.zTree.getZTreeObj("assetTree");
|
zTree = $.fn.zTree.getZTreeObj("assetTree");
|
||||||
rootNodeAddDom(zTree, function () {
|
rootNodeAddDom(zTree, function () {
|
||||||
treeUrl = treeUrl.replace('cache_policy=1', 'cache_policy=2');
|
treeUrl = setUrlParam(treeUrl, 'cache_policy', '2');
|
||||||
initTree();
|
initTree();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<script>
|
<script>
|
||||||
var assetTableUrl = "{% url 'api-perms:user-assets' pk=object.id %}?cache_policy=1";
|
var assetTableUrl = "{% url 'api-perms:user-assets' pk=object.id %}?cache_policy=1";
|
||||||
var selectUrl = '{% url "api-perms:user-node-assets" pk=object.id node_id=DEFAULT_PK %}?cache_policy=1&all=1';
|
var selectUrl = '{% url "api-perms:user-node-assets" pk=object.id node_id=DEFAULT_PK %}?cache_policy=1&all=1';
|
||||||
var treeUrl = "{% url 'api-perms:user-nodes-as-tree' pk=object.id %}?&cache_policy=1";
|
var treeUrl = "{% url 'api-perms:user-nodes-as-tree' pk=object.id %}?cache_policy=1";
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
initTree();
|
initTree();
|
||||||
|
|
Loading…
Reference in New Issue