Commit dd4c0cf6f70dfc525d885f932d839b1f8e046954

Authored by liujun001
1 parent b57d22c5

修改超时时间

src/main/java/com/bsth/controller/video/VideoController.java
... ... @@ -158,7 +158,7 @@ public class VideoController {
158 158 tree.setType(401);
159 159 tree.setIcon("layui-icon-video");
160 160 String name = Objects.isNull(map.get("name")) ? map.get("channelId") + "_" + map.get("deviceId") : map.get("name").toString();
161   - tree.setText("<img src='/metronic_v4.5.4/layui/icon/movie.ico' class ='imageIcon' />"+name);
  161 + tree.setText("<span><img src='/metronic_v4.5.4/layui/icon/movie.ico' class ='imageIcon' /></span><span>"+name+"</span>");
162 162 tree.setNodePValue(carNo);
163 163  
164 164 trees.add(tree);
... ...
src/main/java/com/bsth/service/impl/videoimpl/VideoServiceImpl.java
... ... @@ -111,7 +111,7 @@ public class VideoServiceImpl implements VideoService {
111 111  
112 112 private VideoTree combnationOfCar(String carNo, String line) {
113 113 String name = Objects.isNull(basicData) || MapUtils.isEmpty(basicData.nbbmCompanyPlateMap) ? null : basicData.nbbmCompanyPlateMap.get(carNo);
114   - return combinationVideoTree(carNo, carNo, line, carNo, 301, "bus", carNo);
  114 + return combinationVideoTree(carNo, carNo, line, carNo, 301, "bus1", carNo);
115 115 }
116 116  
117 117 private VideoTree combinationOfLine(String code, Line line) {
... ... @@ -248,7 +248,7 @@ public class VideoServiceImpl implements VideoService {
248 248 private VideoTree combinationVideoTree(Object id, String text, String parent, Object sourceId, Integer type, String icon, Object code) {
249 249 VideoTree videoTree = new VideoTree();
250 250 videoTree.setId(id);
251   - videoTree.setText("<img src='/metronic_v4.5.4/layui/icon/"+icon+".ico' class ='imageIcon' />"+text);
  251 + videoTree.setText("<span><img src='/metronic_v4.5.4/layui/icon/"+icon+".ico' class ='imageIcon' /></span><span>"+text+"</span>");
252 252 videoTree.setSourceId(sourceId);
253 253 videoTree.setNodePValue(parent);
254 254 videoTree.setType(type);
... ...
src/main/resources/static/metronic_v4.5.4/layui/icon/bus.ico deleted 100644 → 0
No preview for this file type
src/main/resources/static/other/video/jquery.ztree.core-3.5.js 0 → 100644
  1 +/*
  2 + * JQuery zTree core v3.5.19.2
  3 + * http://zTree.me/
  4 + *
  5 + * Copyright (c) 2010 Hunter.z
  6 + *
  7 + * Licensed same as jquery - MIT License
  8 + * http://www.opensource.org/licenses/mit-license.php
  9 + *
  10 + * email: hunter.z@263.net
  11 + * Date: 2015-11-15
  12 + */
  13 +(function($){
  14 + var settings = {}, roots = {}, caches = {},
  15 + //default consts of core
  16 + _consts = {
  17 + className: {
  18 + BUTTON: "button",
  19 + LEVEL: "level",
  20 + ICO_LOADING: "ico_loading",
  21 + SWITCH: "switch",
  22 + NAME: 'node_name'
  23 + },
  24 + event: {
  25 + NODECREATED: "ztree_nodeCreated",
  26 + CLICK: "ztree_click",
  27 + EXPAND: "ztree_expand",
  28 + COLLAPSE: "ztree_collapse",
  29 + ASYNC_SUCCESS: "ztree_async_success",
  30 + ASYNC_ERROR: "ztree_async_error",
  31 + REMOVE: "ztree_remove",
  32 + SELECTED: "ztree_selected",
  33 + UNSELECTED: "ztree_unselected"
  34 + },
  35 + id: {
  36 + A: "_a",
  37 + ICON: "_ico",
  38 + SPAN: "_span",
  39 + SWITCH: "_switch",
  40 + UL: "_ul"
  41 + },
  42 + line: {
  43 + ROOT: "root",
  44 + ROOTS: "roots",
  45 + CENTER: "center",
  46 + BOTTOM: "bottom",
  47 + NOLINE: "noline",
  48 + LINE: "line"
  49 + },
  50 + folder: {
  51 + OPEN: "open",
  52 + CLOSE: "close",
  53 + DOCU: "docu"
  54 + },
  55 + node: {
  56 + CURSELECTED: "curSelectedNode"
  57 + }
  58 + },
  59 + //default setting of core
  60 + _setting = {
  61 + treeId: "",
  62 + treeObj: null,
  63 + view: {
  64 + addDiyDom: null,
  65 + autoCancelSelected: true,
  66 + dblClickExpand: true,
  67 + expandSpeed: "fast",
  68 + fontCss: {},
  69 + nameIsHTML: false,
  70 + selectedMulti: true,
  71 + showIcon: true,
  72 + showLine: true,
  73 + showTitle: true,
  74 + txtSelectedEnable: false
  75 + },
  76 + data: {
  77 + key: {
  78 + children: "children",
  79 + name: "name",
  80 + title: "",
  81 + url: "url",
  82 + icon: "icon"
  83 + },
  84 + simpleData: {
  85 + enable: false,
  86 + idKey: "id",
  87 + pIdKey: "pId",
  88 + rootPId: null
  89 + },
  90 + keep: {
  91 + parent: false,
  92 + leaf: false
  93 + }
  94 + },
  95 + async: {
  96 + enable: false,
  97 + contentType: "application/x-www-form-urlencoded",
  98 + type: "post",
  99 + dataType: "text",
  100 + url: "",
  101 + autoParam: [],
  102 + otherParam: [],
  103 + dataFilter: null
  104 + },
  105 + callback: {
  106 + beforeAsync:null,
  107 + beforeClick:null,
  108 + beforeDblClick:null,
  109 + beforeRightClick:null,
  110 + beforeMouseDown:null,
  111 + beforeMouseUp:null,
  112 + beforeExpand:null,
  113 + beforeCollapse:null,
  114 + beforeRemove:null,
  115 +
  116 + onAsyncError:null,
  117 + onAsyncSuccess:null,
  118 + onNodeCreated:null,
  119 + onClick:null,
  120 + onDblClick:null,
  121 + onRightClick:null,
  122 + onMouseDown:null,
  123 + onMouseUp:null,
  124 + onExpand:null,
  125 + onCollapse:null,
  126 + onRemove:null
  127 + }
  128 + },
  129 + //default root of core
  130 + //zTree use root to save full data
  131 + _initRoot = function (setting) {
  132 + var r = data.getRoot(setting);
  133 + if (!r) {
  134 + r = {};
  135 + data.setRoot(setting, r);
  136 + }
  137 + r[setting.data.key.children] = [];
  138 + r.expandTriggerFlag = false;
  139 + r.curSelectedList = [];
  140 + r.noSelection = true;
  141 + r.createdNodes = [];
  142 + r.zId = 0;
  143 + r._ver = (new Date()).getTime();
  144 + },
  145 + //default cache of core
  146 + _initCache = function(setting) {
  147 + var c = data.getCache(setting);
  148 + if (!c) {
  149 + c = {};
  150 + data.setCache(setting, c);
  151 + }
  152 + c.nodes = [];
  153 + c.doms = [];
  154 + },
  155 + //default bindEvent of core
  156 + _bindEvent = function(setting) {
  157 + var o = setting.treeObj,
  158 + c = consts.event;
  159 + o.bind(c.NODECREATED, function (event, treeId, node) {
  160 + tools.apply(setting.callback.onNodeCreated, [event, treeId, node]);
  161 + });
  162 +
  163 + o.bind(c.CLICK, function (event, srcEvent, treeId, node, clickFlag) {
  164 + tools.apply(setting.callback.onClick, [srcEvent, treeId, node, clickFlag]);
  165 + });
  166 +
  167 + o.bind(c.EXPAND, function (event, treeId, node) {
  168 + tools.apply(setting.callback.onExpand, [event, treeId, node]);
  169 + });
  170 +
  171 + o.bind(c.COLLAPSE, function (event, treeId, node) {
  172 + tools.apply(setting.callback.onCollapse, [event, treeId, node]);
  173 + });
  174 +
  175 + o.bind(c.ASYNC_SUCCESS, function (event, treeId, node, msg) {
  176 + tools.apply(setting.callback.onAsyncSuccess, [event, treeId, node, msg]);
  177 + });
  178 +
  179 + o.bind(c.ASYNC_ERROR, function (event, treeId, node, XMLHttpRequest, textStatus, errorThrown) {
  180 + tools.apply(setting.callback.onAsyncError, [event, treeId, node, XMLHttpRequest, textStatus, errorThrown]);
  181 + });
  182 +
  183 + o.bind(c.REMOVE, function (event, treeId, treeNode) {
  184 + tools.apply(setting.callback.onRemove, [event, treeId, treeNode]);
  185 + });
  186 +
  187 + o.bind(c.SELECTED, function (event, treeId, node) {
  188 + tools.apply(setting.callback.onSelected, [treeId, node]);
  189 + });
  190 + o.bind(c.UNSELECTED, function (event, treeId, node) {
  191 + tools.apply(setting.callback.onUnSelected, [treeId, node]);
  192 + });
  193 + },
  194 + _unbindEvent = function(setting) {
  195 + var o = setting.treeObj,
  196 + c = consts.event;
  197 + o.unbind(c.NODECREATED)
  198 + .unbind(c.CLICK)
  199 + .unbind(c.EXPAND)
  200 + .unbind(c.COLLAPSE)
  201 + .unbind(c.ASYNC_SUCCESS)
  202 + .unbind(c.ASYNC_ERROR)
  203 + .unbind(c.REMOVE)
  204 + .unbind(c.SELECTED)
  205 + .unbind(c.UNSELECTED);
  206 + },
  207 + //default event proxy of core
  208 + _eventProxy = function(event) {
  209 + var target = event.target,
  210 + setting = data.getSetting(event.data.treeId),
  211 + tId = "", node = null,
  212 + nodeEventType = "", treeEventType = "",
  213 + nodeEventCallback = null, treeEventCallback = null,
  214 + tmp = null;
  215 +
  216 + if (tools.eqs(event.type, "mousedown")) {
  217 + treeEventType = "mousedown";
  218 + } else if (tools.eqs(event.type, "mouseup")) {
  219 + treeEventType = "mouseup";
  220 + } else if (tools.eqs(event.type, "contextmenu")) {
  221 + treeEventType = "contextmenu";
  222 + } else if (tools.eqs(event.type, "click")) {
  223 + if (tools.eqs(target.tagName, "span") && target.getAttribute("treeNode"+ consts.id.SWITCH) !== null) {
  224 + tId = tools.getNodeMainDom(target).id;
  225 + nodeEventType = "switchNode";
  226 + } else {
  227 + tmp = tools.getMDom(setting, target, [{tagName:"a", attrName:"treeNode"+consts.id.A}]);
  228 + if (tmp) {
  229 + tId = tools.getNodeMainDom(tmp).id;
  230 + nodeEventType = "clickNode";
  231 + }
  232 + }
  233 + } else if (tools.eqs(event.type, "dblclick")) {
  234 + treeEventType = "dblclick";
  235 + tmp = tools.getMDom(setting, target, [{tagName:"a", attrName:"treeNode"+consts.id.A}]);
  236 + if (tmp) {
  237 + tId = tools.getNodeMainDom(tmp).id;
  238 + nodeEventType = "switchNode";
  239 + }
  240 + }
  241 + if (treeEventType.length > 0 && tId.length == 0) {
  242 + tmp = tools.getMDom(setting, target, [{tagName:"a", attrName:"treeNode"+consts.id.A}]);
  243 + if (tmp) {tId = tools.getNodeMainDom(tmp).id;}
  244 + }
  245 + // event to node
  246 + if (tId.length>0) {
  247 + node = data.getNodeCache(setting, tId);
  248 + switch (nodeEventType) {
  249 + case "switchNode" :
  250 + if (!node.isParent) {
  251 + nodeEventType = "";
  252 + } else if (tools.eqs(event.type, "click")
  253 + || (tools.eqs(event.type, "dblclick") && tools.apply(setting.view.dblClickExpand, [setting.treeId, node], setting.view.dblClickExpand))) {
  254 + nodeEventCallback = handler.onSwitchNode;
  255 + } else {
  256 + nodeEventType = "";
  257 + }
  258 + break;
  259 + case "clickNode" :
  260 + nodeEventCallback = handler.onClickNode;
  261 + break;
  262 + }
  263 + }
  264 + // event to zTree
  265 + switch (treeEventType) {
  266 + case "mousedown" :
  267 + treeEventCallback = handler.onZTreeMousedown;
  268 + break;
  269 + case "mouseup" :
  270 + treeEventCallback = handler.onZTreeMouseup;
  271 + break;
  272 + case "dblclick" :
  273 + treeEventCallback = handler.onZTreeDblclick;
  274 + break;
  275 + case "contextmenu" :
  276 + treeEventCallback = handler.onZTreeContextmenu;
  277 + break;
  278 + }
  279 + var proxyResult = {
  280 + stop: false,
  281 + node: node,
  282 + nodeEventType: nodeEventType,
  283 + nodeEventCallback: nodeEventCallback,
  284 + treeEventType: treeEventType,
  285 + treeEventCallback: treeEventCallback
  286 + };
  287 + return proxyResult
  288 + },
  289 + //default init node of core
  290 + _initNode = function(setting, level, n, parentNode, isFirstNode, isLastNode, openFlag) {
  291 + if (!n) return;
  292 + var r = data.getRoot(setting),
  293 + childKey = setting.data.key.children;
  294 + n.level = level;
  295 + n.tId = setting.treeId + "_" + (++r.zId);
  296 + n.parentTId = parentNode ? parentNode.tId : null;
  297 + n.open = (typeof n.open == "string") ? tools.eqs(n.open, "true") : !!n.open;
  298 + if (n[childKey] && n[childKey].length > 0) {
  299 + n.isParent = true;
  300 + n.zAsync = true;
  301 + } else {
  302 + n.isParent = (typeof n.isParent == "string") ? tools.eqs(n.isParent, "true") : !!n.isParent;
  303 + n.open = (n.isParent && !setting.async.enable) ? n.open : false;
  304 + n.zAsync = !n.isParent;
  305 + }
  306 + n.isFirstNode = isFirstNode;
  307 + n.isLastNode = isLastNode;
  308 + n.getParentNode = function() {return data.getNodeCache(setting, n.parentTId);};
  309 + n.getPreNode = function() {return data.getPreNode(setting, n);};
  310 + n.getNextNode = function() {return data.getNextNode(setting, n);};
  311 + n.getIndex = function() {return data.getNodeIndex(setting, n);};
  312 + n.getPath = function() {return data.getNodePath(setting, n);};
  313 + n.isAjaxing = false;
  314 + data.fixPIdKeyValue(setting, n);
  315 + },
  316 + _init = {
  317 + bind: [_bindEvent],
  318 + unbind: [_unbindEvent],
  319 + caches: [_initCache],
  320 + nodes: [_initNode],
  321 + proxys: [_eventProxy],
  322 + roots: [_initRoot],
  323 + beforeA: [],
  324 + afterA: [],
  325 + innerBeforeA: [],
  326 + innerAfterA: [],
  327 + zTreeTools: []
  328 + },
  329 + //method of operate data
  330 + data = {
  331 + addNodeCache: function(setting, node) {
  332 + data.getCache(setting).nodes[data.getNodeCacheId(node.tId)] = node;
  333 + },
  334 + getNodeCacheId: function(tId) {
  335 + return tId.substring(tId.lastIndexOf("_")+1);
  336 + },
  337 + addAfterA: function(afterA) {
  338 + _init.afterA.push(afterA);
  339 + },
  340 + addBeforeA: function(beforeA) {
  341 + _init.beforeA.push(beforeA);
  342 + },
  343 + addInnerAfterA: function(innerAfterA) {
  344 + _init.innerAfterA.push(innerAfterA);
  345 + },
  346 + addInnerBeforeA: function(innerBeforeA) {
  347 + _init.innerBeforeA.push(innerBeforeA);
  348 + },
  349 + addInitBind: function(bindEvent) {
  350 + _init.bind.push(bindEvent);
  351 + },
  352 + addInitUnBind: function(unbindEvent) {
  353 + _init.unbind.push(unbindEvent);
  354 + },
  355 + addInitCache: function(initCache) {
  356 + _init.caches.push(initCache);
  357 + },
  358 + addInitNode: function(initNode) {
  359 + _init.nodes.push(initNode);
  360 + },
  361 + addInitProxy: function(initProxy, isFirst) {
  362 + if (!!isFirst) {
  363 + _init.proxys.splice(0,0,initProxy);
  364 + } else {
  365 + _init.proxys.push(initProxy);
  366 + }
  367 + },
  368 + addInitRoot: function(initRoot) {
  369 + _init.roots.push(initRoot);
  370 + },
  371 + addNodesData: function(setting, parentNode, index, nodes) {
  372 + var childKey = setting.data.key.children, params;
  373 + if (!parentNode[childKey]) {
  374 + parentNode[childKey] = [];
  375 + index = -1;
  376 + } else if (index >= parentNode[childKey].length) {
  377 + index = -1;
  378 + }
  379 +
  380 + if (parentNode[childKey].length > 0 && index === 0) {
  381 + parentNode[childKey][0].isFirstNode = false;
  382 + view.setNodeLineIcos(setting, parentNode[childKey][0]);
  383 + } else if (parentNode[childKey].length > 0 && index < 0) {
  384 + parentNode[childKey][parentNode[childKey].length - 1].isLastNode = false;
  385 + view.setNodeLineIcos(setting, parentNode[childKey][parentNode[childKey].length - 1]);
  386 + }
  387 + parentNode.isParent = true;
  388 +
  389 + if (index<0) {
  390 + parentNode[childKey] = parentNode[childKey].concat(nodes);
  391 + } else {
  392 + params = [index, 0].concat(nodes);
  393 + parentNode[childKey].splice.apply(parentNode[childKey], params);
  394 + }
  395 + },
  396 + addSelectedNode: function(setting, node) {
  397 + var root = data.getRoot(setting);
  398 + if (!data.isSelectedNode(setting, node)) {
  399 + root.curSelectedList.push(node);
  400 + }
  401 + },
  402 + addCreatedNode: function(setting, node) {
  403 + if (!!setting.callback.onNodeCreated || !!setting.view.addDiyDom) {
  404 + var root = data.getRoot(setting);
  405 + root.createdNodes.push(node);
  406 + }
  407 + },
  408 + addZTreeTools: function(zTreeTools) {
  409 + _init.zTreeTools.push(zTreeTools);
  410 + },
  411 + exSetting: function(s) {
  412 + $.extend(true, _setting, s);
  413 + },
  414 + fixPIdKeyValue: function(setting, node) {
  415 + if (setting.data.simpleData.enable) {
  416 + node[setting.data.simpleData.pIdKey] = node.parentTId ? node.getParentNode()[setting.data.simpleData.idKey] : setting.data.simpleData.rootPId;
  417 + }
  418 + },
  419 + getAfterA: function(setting, node, array) {
  420 + for (var i=0, j=_init.afterA.length; i<j; i++) {
  421 + _init.afterA[i].apply(this, arguments);
  422 + }
  423 + },
  424 + getBeforeA: function(setting, node, array) {
  425 + for (var i=0, j=_init.beforeA.length; i<j; i++) {
  426 + _init.beforeA[i].apply(this, arguments);
  427 + }
  428 + },
  429 + getInnerAfterA: function(setting, node, array) {
  430 + for (var i=0, j=_init.innerAfterA.length; i<j; i++) {
  431 + _init.innerAfterA[i].apply(this, arguments);
  432 + }
  433 + },
  434 + getInnerBeforeA: function(setting, node, array) {
  435 + for (var i=0, j=_init.innerBeforeA.length; i<j; i++) {
  436 + _init.innerBeforeA[i].apply(this, arguments);
  437 + }
  438 + },
  439 + getCache: function(setting) {
  440 + return caches[setting.treeId];
  441 + },
  442 + getNodeIndex: function(setting, node) {
  443 + if (!node) return null;
  444 + var childKey = setting.data.key.children,
  445 + p = node.parentTId ? node.getParentNode() : data.getRoot(setting);
  446 + for (var i=0, l=p[childKey].length-1; i<=l; i++) {
  447 + if (p[childKey][i] === node) {
  448 + return i;
  449 + }
  450 + }
  451 + return -1;
  452 + },
  453 + getNextNode: function(setting, node) {
  454 + if (!node) return null;
  455 + var childKey = setting.data.key.children,
  456 + p = node.parentTId ? node.getParentNode() : data.getRoot(setting);
  457 + for (var i=0, l=p[childKey].length-1; i<=l; i++) {
  458 + if (p[childKey][i] === node) {
  459 + return (i==l ? null : p[childKey][i+1]);
  460 + }
  461 + }
  462 + return null;
  463 + },
  464 + getNodeByParam: function(setting, nodes, key, value) {
  465 + if (!nodes || !key) return null;
  466 + var childKey = setting.data.key.children;
  467 + for (var i = 0, l = nodes.length; i < l; i++) {
  468 + if (nodes[i][key] == value) {
  469 + return nodes[i];
  470 + }
  471 + var tmp = data.getNodeByParam(setting, nodes[i][childKey], key, value);
  472 + if (tmp) return tmp;
  473 + }
  474 + return null;
  475 + },
  476 + getNodeCache: function(setting, tId) {
  477 + if (!tId) return null;
  478 + var n = caches[setting.treeId].nodes[data.getNodeCacheId(tId)];
  479 + return n ? n : null;
  480 + },
  481 + getNodeName: function(setting, node) {
  482 + var nameKey = setting.data.key.name;
  483 + return "" + node[nameKey];
  484 + },
  485 + getNodePath: function(setting, node) {
  486 + if (!node) return null;
  487 +
  488 + var path;
  489 + if(node.parentTId) {
  490 + path = node.getParentNode().getPath();
  491 + } else {
  492 + path = [];
  493 + }
  494 +
  495 + if (path) {
  496 + path.push(node);
  497 + }
  498 +
  499 + return path;
  500 + },
  501 + getNodeTitle: function(setting, node) {
  502 + var t = setting.data.key.title === "" ? setting.data.key.name : setting.data.key.title;
  503 + return "" + node[t];
  504 + },
  505 + getNodes: function(setting) {
  506 + return data.getRoot(setting)[setting.data.key.children];
  507 + },
  508 + getNodesByParam: function(setting, nodes, key, value) {
  509 + if (!nodes || !key) return [];
  510 + var childKey = setting.data.key.children,
  511 + result = [];
  512 + for (var i = 0, l = nodes.length; i < l; i++) {
  513 + if (nodes[i][key] == value) {
  514 + result.push(nodes[i]);
  515 + }
  516 + result = result.concat(data.getNodesByParam(setting, nodes[i][childKey], key, value));
  517 + }
  518 + return result;
  519 + },
  520 + getNodesByParamFuzzy: function(setting, nodes, key, value) {
  521 + if (!nodes || !key) return [];
  522 + var childKey = setting.data.key.children,
  523 + result = [];
  524 + value = value.toLowerCase();
  525 + for (var i = 0, l = nodes.length; i < l; i++) {
  526 + if (typeof nodes[i][key] == "string" && nodes[i][key].toLowerCase().indexOf(value)>-1) {
  527 + result.push(nodes[i]);
  528 + }
  529 + result = result.concat(data.getNodesByParamFuzzy(setting, nodes[i][childKey], key, value));
  530 + }
  531 + return result;
  532 + },
  533 + getNodesByFilter: function(setting, nodes, filter, isSingle, invokeParam) {
  534 + if (!nodes) return (isSingle ? null : []);
  535 + var childKey = setting.data.key.children,
  536 + result = isSingle ? null : [];
  537 + for (var i = 0, l = nodes.length; i < l; i++) {
  538 + if (tools.apply(filter, [nodes[i], invokeParam], false)) {
  539 + if (isSingle) {return nodes[i];}
  540 + result.push(nodes[i]);
  541 + }
  542 + var tmpResult = data.getNodesByFilter(setting, nodes[i][childKey], filter, isSingle, invokeParam);
  543 + if (isSingle && !!tmpResult) {return tmpResult;}
  544 + result = isSingle ? tmpResult : result.concat(tmpResult);
  545 + }
  546 + return result;
  547 + },
  548 + getPreNode: function(setting, node) {
  549 + if (!node) return null;
  550 + var childKey = setting.data.key.children,
  551 + p = node.parentTId ? node.getParentNode() : data.getRoot(setting);
  552 + for (var i=0, l=p[childKey].length; i<l; i++) {
  553 + if (p[childKey][i] === node) {
  554 + return (i==0 ? null : p[childKey][i-1]);
  555 + }
  556 + }
  557 + return null;
  558 + },
  559 + getRoot: function(setting) {
  560 + return setting ? roots[setting.treeId] : null;
  561 + },
  562 + getRoots: function() {
  563 + return roots;
  564 + },
  565 + getSetting: function(treeId) {
  566 + return settings[treeId];
  567 + },
  568 + getSettings: function() {
  569 + return settings;
  570 + },
  571 + getZTreeTools: function(treeId) {
  572 + var r = this.getRoot(this.getSetting(treeId));
  573 + return r ? r.treeTools : null;
  574 + },
  575 + initCache: function(setting) {
  576 + for (var i=0, j=_init.caches.length; i<j; i++) {
  577 + _init.caches[i].apply(this, arguments);
  578 + }
  579 + },
  580 + initNode: function(setting, level, node, parentNode, preNode, nextNode) {
  581 + for (var i=0, j=_init.nodes.length; i<j; i++) {
  582 + _init.nodes[i].apply(this, arguments);
  583 + }
  584 + },
  585 + initRoot: function(setting) {
  586 + for (var i=0, j=_init.roots.length; i<j; i++) {
  587 + _init.roots[i].apply(this, arguments);
  588 + }
  589 + },
  590 + isSelectedNode: function(setting, node) {
  591 + var root = data.getRoot(setting);
  592 + for (var i=0, j=root.curSelectedList.length; i<j; i++) {
  593 + if(node === root.curSelectedList[i]) return true;
  594 + }
  595 + return false;
  596 + },
  597 + removeNodeCache: function(setting, node) {
  598 + var childKey = setting.data.key.children;
  599 + if (node[childKey]) {
  600 + for (var i=0, l=node[childKey].length; i<l; i++) {
  601 + arguments.callee(setting, node[childKey][i]);
  602 + }
  603 + }
  604 + data.getCache(setting).nodes[data.getNodeCacheId(node.tId)] = null;
  605 + },
  606 + removeSelectedNode: function(setting, node) {
  607 + var root = data.getRoot(setting);
  608 + for (var i=0, j=root.curSelectedList.length; i<j; i++) {
  609 + if(node === root.curSelectedList[i] || !data.getNodeCache(setting, root.curSelectedList[i].tId)) {
  610 + root.curSelectedList.splice(i, 1);
  611 + setting.treeObj.trigger(consts.event.UNSELECTED, [setting.treeId, node]);
  612 + i--;j--;
  613 + }
  614 + }
  615 + },
  616 + setCache: function(setting, cache) {
  617 + caches[setting.treeId] = cache;
  618 + },
  619 + setRoot: function(setting, root) {
  620 + roots[setting.treeId] = root;
  621 + },
  622 + setZTreeTools: function(setting, zTreeTools) {
  623 + for (var i=0, j=_init.zTreeTools.length; i<j; i++) {
  624 + _init.zTreeTools[i].apply(this, arguments);
  625 + }
  626 + },
  627 + transformToArrayFormat: function (setting, nodes) {
  628 + if (!nodes) return [];
  629 + var childKey = setting.data.key.children,
  630 + r = [];
  631 + if (tools.isArray(nodes)) {
  632 + for (var i=0, l=nodes.length; i<l; i++) {
  633 + r.push(nodes[i]);
  634 + if (nodes[i][childKey])
  635 + r = r.concat(data.transformToArrayFormat(setting, nodes[i][childKey]));
  636 + }
  637 + } else {
  638 + r.push(nodes);
  639 + if (nodes[childKey])
  640 + r = r.concat(data.transformToArrayFormat(setting, nodes[childKey]));
  641 + }
  642 + return r;
  643 + },
  644 + transformTozTreeFormat: function(setting, sNodes) {
  645 + var i,l,
  646 + key = setting.data.simpleData.idKey,
  647 + parentKey = setting.data.simpleData.pIdKey,
  648 + childKey = setting.data.key.children;
  649 + if (!key || key=="" || !sNodes) return [];
  650 +
  651 + if (tools.isArray(sNodes)) {
  652 + var r = [];
  653 + var tmpMap = [];
  654 + for (i=0, l=sNodes.length; i<l; i++) {
  655 + tmpMap[sNodes[i][key]] = sNodes[i];
  656 + }
  657 + for (i=0, l=sNodes.length; i<l; i++) {
  658 + if (tmpMap[sNodes[i][parentKey]] && sNodes[i][key] != sNodes[i][parentKey]) {
  659 + if (!tmpMap[sNodes[i][parentKey]][childKey])
  660 + tmpMap[sNodes[i][parentKey]][childKey] = [];
  661 + tmpMap[sNodes[i][parentKey]][childKey].push(sNodes[i]);
  662 + } else {
  663 + r.push(sNodes[i]);
  664 + }
  665 + }
  666 + return r;
  667 + }else {
  668 + return [sNodes];
  669 + }
  670 + }
  671 + },
  672 + //method of event proxy
  673 + event = {
  674 + bindEvent: function(setting) {
  675 + for (var i=0, j=_init.bind.length; i<j; i++) {
  676 + _init.bind[i].apply(this, arguments);
  677 + }
  678 + },
  679 + unbindEvent: function(setting) {
  680 + for (var i=0, j=_init.unbind.length; i<j; i++) {
  681 + _init.unbind[i].apply(this, arguments);
  682 + }
  683 + },
  684 + bindTree: function(setting) {
  685 + var eventParam = {
  686 + treeId: setting.treeId
  687 + },
  688 + o = setting.treeObj;
  689 + if (!setting.view.txtSelectedEnable) {
  690 + // for can't select text
  691 + o.bind('selectstart', handler.onSelectStart).css({
  692 + "-moz-user-select":"-moz-none"
  693 + });
  694 + }
  695 + o.bind('click', eventParam, event.proxy);
  696 + o.bind('dblclick', eventParam, event.proxy);
  697 + o.bind('mouseover', eventParam, event.proxy);
  698 + o.bind('mouseout', eventParam, event.proxy);
  699 + o.bind('mousedown', eventParam, event.proxy);
  700 + o.bind('mouseup', eventParam, event.proxy);
  701 + o.bind('contextmenu', eventParam, event.proxy);
  702 + },
  703 + unbindTree: function(setting) {
  704 + var o = setting.treeObj;
  705 + o.unbind('selectstart', handler.onSelectStart)
  706 + .unbind('click', event.proxy)
  707 + .unbind('dblclick', event.proxy)
  708 + .unbind('mouseover', event.proxy)
  709 + .unbind('mouseout', event.proxy)
  710 + .unbind('mousedown', event.proxy)
  711 + .unbind('mouseup', event.proxy)
  712 + .unbind('contextmenu', event.proxy);
  713 + },
  714 + doProxy: function(e) {
  715 + var results = [];
  716 + for (var i=0, j=_init.proxys.length; i<j; i++) {
  717 + var proxyResult = _init.proxys[i].apply(this, arguments);
  718 + results.push(proxyResult);
  719 + if (proxyResult.stop) {
  720 + break;
  721 + }
  722 + }
  723 + return results;
  724 + },
  725 + proxy: function(e) {
  726 + var setting = data.getSetting(e.data.treeId);
  727 + if (!tools.uCanDo(setting, e)) return true;
  728 + var results = event.doProxy(e),
  729 + r = true, x = false;
  730 + for (var i=0, l=results.length; i<l; i++) {
  731 + var proxyResult = results[i];
  732 + if (proxyResult.nodeEventCallback) {
  733 + x = true;
  734 + r = proxyResult.nodeEventCallback.apply(proxyResult, [e, proxyResult.node]) && r;
  735 + }
  736 + if (proxyResult.treeEventCallback) {
  737 + x = true;
  738 + r = proxyResult.treeEventCallback.apply(proxyResult, [e, proxyResult.node]) && r;
  739 + }
  740 + }
  741 + return r;
  742 + }
  743 + },
  744 + //method of event handler
  745 + handler = {
  746 + onSwitchNode: function (event, node) {
  747 + var setting = data.getSetting(event.data.treeId);
  748 + if (node.open) {
  749 + if (tools.apply(setting.callback.beforeCollapse, [setting.treeId, node], true) == false) return true;
  750 + data.getRoot(setting).expandTriggerFlag = true;
  751 + view.switchNode(setting, node);
  752 + } else {
  753 + if (tools.apply(setting.callback.beforeExpand, [setting.treeId, node], true) == false) return true;
  754 + data.getRoot(setting).expandTriggerFlag = true;
  755 + view.switchNode(setting, node);
  756 + }
  757 + return true;
  758 + },
  759 + onClickNode: function (event, node) {
  760 + var setting = data.getSetting(event.data.treeId),
  761 + clickFlag = ( (setting.view.autoCancelSelected && (event.ctrlKey || event.metaKey)) && data.isSelectedNode(setting, node)) ? 0 : (setting.view.autoCancelSelected && (event.ctrlKey || event.metaKey) && setting.view.selectedMulti) ? 2 : 1;
  762 + if (tools.apply(setting.callback.beforeClick, [setting.treeId, node, clickFlag], true) == false) return true;
  763 + if (clickFlag === 0) {
  764 + view.cancelPreSelectedNode(setting, node);
  765 + } else {
  766 + view.selectNode(setting, node, clickFlag === 2);
  767 + }
  768 + setting.treeObj.trigger(consts.event.CLICK, [event, setting.treeId, node, clickFlag]);
  769 + return true;
  770 + },
  771 + onZTreeMousedown: function(event, node) {
  772 + var setting = data.getSetting(event.data.treeId);
  773 + if (tools.apply(setting.callback.beforeMouseDown, [setting.treeId, node], true)) {
  774 + tools.apply(setting.callback.onMouseDown, [event, setting.treeId, node]);
  775 + }
  776 + return true;
  777 + },
  778 + onZTreeMouseup: function(event, node) {
  779 + var setting = data.getSetting(event.data.treeId);
  780 + if (tools.apply(setting.callback.beforeMouseUp, [setting.treeId, node], true)) {
  781 + tools.apply(setting.callback.onMouseUp, [event, setting.treeId, node]);
  782 + }
  783 + return true;
  784 + },
  785 + onZTreeDblclick: function(event, node) {
  786 + var setting = data.getSetting(event.data.treeId);
  787 + if (tools.apply(setting.callback.beforeDblClick, [setting.treeId, node], true)) {
  788 + tools.apply(setting.callback.onDblClick, [event, setting.treeId, node]);
  789 + }
  790 + return true;
  791 + },
  792 + onZTreeContextmenu: function(event, node) {
  793 + var setting = data.getSetting(event.data.treeId);
  794 + if (tools.apply(setting.callback.beforeRightClick, [setting.treeId, node], true)) {
  795 + tools.apply(setting.callback.onRightClick, [event, setting.treeId, node]);
  796 + }
  797 + return (typeof setting.callback.onRightClick) != "function";
  798 + },
  799 + onSelectStart: function(e){
  800 + var n = e.originalEvent.srcElement.nodeName.toLowerCase();
  801 + return (n === "input" || n === "textarea" );
  802 + }
  803 + },
  804 + //method of tools for zTree
  805 + tools = {
  806 + apply: function(fun, param, defaultValue) {
  807 + if ((typeof fun) == "function") {
  808 + return fun.apply(zt, param?param:[]);
  809 + }
  810 + return defaultValue;
  811 + },
  812 + canAsync: function(setting, node) {
  813 + var childKey = setting.data.key.children;
  814 + return (setting.async.enable && node && node.isParent && !(node.zAsync || (node[childKey] && node[childKey].length > 0)));
  815 + },
  816 + clone: function (obj){
  817 + if (obj === null) return null;
  818 + var o = tools.isArray(obj) ? [] : {};
  819 + for(var i in obj){
  820 + o[i] = (obj[i] instanceof Date) ? new Date(obj[i].getTime()) : (typeof obj[i] === "object" ? arguments.callee(obj[i]) : obj[i]);
  821 + }
  822 + return o;
  823 + },
  824 + eqs: function(str1, str2) {
  825 + return str1.toLowerCase() === str2.toLowerCase();
  826 + },
  827 + isArray: function(arr) {
  828 + return Object.prototype.toString.apply(arr) === "[object Array]";
  829 + },
  830 + $: function(node, exp, setting) {
  831 + if (!!exp && typeof exp != "string") {
  832 + setting = exp;
  833 + exp = "";
  834 + }
  835 + if (typeof node == "string") {
  836 + return $(node, setting ? setting.treeObj.get(0).ownerDocument : null);
  837 + } else {
  838 + return $("#" + node.tId + exp, setting ? setting.treeObj : null);
  839 + }
  840 + },
  841 + getMDom: function (setting, curDom, targetExpr) {
  842 + if (!curDom) return null;
  843 + while (curDom && curDom.id !== setting.treeId) {
  844 + for (var i=0, l=targetExpr.length; curDom.tagName && i<l; i++) {
  845 + if (tools.eqs(curDom.tagName, targetExpr[i].tagName) && curDom.getAttribute(targetExpr[i].attrName) !== null) {
  846 + return curDom;
  847 + }
  848 + }
  849 + curDom = curDom.parentNode;
  850 + }
  851 + return null;
  852 + },
  853 + getNodeMainDom:function(target) {
  854 + return ($(target).parent("li").get(0) || $(target).parentsUntil("li").parent().get(0));
  855 + },
  856 + isChildOrSelf: function(dom, parentId) {
  857 + return ( $(dom).closest("#" + parentId).length> 0 );
  858 + },
  859 + uCanDo: function(setting, e) {
  860 + return true;
  861 + }
  862 + },
  863 + //method of operate ztree dom
  864 + view = {
  865 + addNodes: function(setting, parentNode, index, newNodes, isSilent) {
  866 + if (setting.data.keep.leaf && parentNode && !parentNode.isParent) {
  867 + return;
  868 + }
  869 + if (!tools.isArray(newNodes)) {
  870 + newNodes = [newNodes];
  871 + }
  872 + if (setting.data.simpleData.enable) {
  873 + newNodes = data.transformTozTreeFormat(setting, newNodes);
  874 + }
  875 + if (parentNode) {
  876 + var target_switchObj = $$(parentNode, consts.id.SWITCH, setting),
  877 + target_icoObj = $$(parentNode, consts.id.ICON, setting),
  878 + target_ulObj = $$(parentNode, consts.id.UL, setting);
  879 +
  880 + if (!parentNode.open) {
  881 + view.replaceSwitchClass(parentNode, target_switchObj, consts.folder.CLOSE);
  882 + view.replaceIcoClass(parentNode, target_icoObj, consts.folder.CLOSE);
  883 + parentNode.open = false;
  884 + target_ulObj.css({
  885 + "display": "none"
  886 + });
  887 + }
  888 +
  889 + data.addNodesData(setting, parentNode, index, newNodes);
  890 + view.createNodes(setting, parentNode.level + 1, newNodes, parentNode, index);
  891 + if (!isSilent) {
  892 + view.expandCollapseParentNode(setting, parentNode, true);
  893 + }
  894 + } else {
  895 + data.addNodesData(setting, data.getRoot(setting), index, newNodes);
  896 + view.createNodes(setting, 0, newNodes, null, index);
  897 + }
  898 + },
  899 + appendNodes: function(setting, level, nodes, parentNode, index, initFlag, openFlag) {
  900 + if (!nodes) return [];
  901 + var html = [],
  902 + childKey = setting.data.key.children;
  903 +
  904 + var tmpPNode = (parentNode) ? parentNode: data.getRoot(setting),
  905 + tmpPChild = tmpPNode[childKey],
  906 + isFirstNode, isLastNode;
  907 +
  908 + if (!tmpPChild || index >= tmpPChild.length) {
  909 + index = -1;
  910 + }
  911 +
  912 + for (var i = 0, l = nodes.length; i < l; i++) {
  913 + var node = nodes[i];
  914 + if (initFlag) {
  915 + isFirstNode = ((index===0 || tmpPChild.length == nodes.length) && (i == 0));
  916 + isLastNode = (index < 0 && i == (nodes.length - 1));
  917 + data.initNode(setting, level, node, parentNode, isFirstNode, isLastNode, openFlag);
  918 + data.addNodeCache(setting, node);
  919 + }
  920 +
  921 + var childHtml = [];
  922 + if (node[childKey] && node[childKey].length > 0) {
  923 + //make child html first, because checkType
  924 + childHtml = view.appendNodes(setting, level + 1, node[childKey], node, -1, initFlag, openFlag && node.open);
  925 + }
  926 + if (openFlag) {
  927 +
  928 + view.makeDOMNodeMainBefore(html, setting, node);
  929 + view.makeDOMNodeLine(html, setting, node);
  930 + data.getBeforeA(setting, node, html);
  931 + view.makeDOMNodeNameBefore(html, setting, node);
  932 + data.getInnerBeforeA(setting, node, html);
  933 + view.makeDOMNodeIcon(html, setting, node);
  934 + data.getInnerAfterA(setting, node, html);
  935 + view.makeDOMNodeNameAfter(html, setting, node);
  936 + data.getAfterA(setting, node, html);
  937 + if (node.isParent && node.open) {
  938 + view.makeUlHtml(setting, node, html, childHtml.join(''));
  939 + }
  940 + view.makeDOMNodeMainAfter(html, setting, node);
  941 + data.addCreatedNode(setting, node);
  942 + }
  943 + }
  944 + return html;
  945 + },
  946 + appendParentULDom: function(setting, node) {
  947 + var html = [],
  948 + nObj = $$(node, setting);
  949 + if (!nObj.get(0) && !!node.parentTId) {
  950 + view.appendParentULDom(setting, node.getParentNode());
  951 + nObj = $$(node, setting);
  952 + }
  953 + var ulObj = $$(node, consts.id.UL, setting);
  954 + if (ulObj.get(0)) {
  955 + ulObj.remove();
  956 + }
  957 + var childKey = setting.data.key.children,
  958 + childHtml = view.appendNodes(setting, node.level+1, node[childKey], node, -1, false, true);
  959 + view.makeUlHtml(setting, node, html, childHtml.join(''));
  960 + nObj.append(html.join(''));
  961 + },
  962 + asyncNode: function(setting, node, isSilent, callback) {
  963 + var i, l;
  964 + if (node && !node.isParent) {
  965 + tools.apply(callback);
  966 + return false;
  967 + } else if (node && node.isAjaxing) {
  968 + return false;
  969 + } else if (tools.apply(setting.callback.beforeAsync, [setting.treeId, node], true) == false) {
  970 + tools.apply(callback);
  971 + return false;
  972 + }
  973 + if (node) {
  974 + node.isAjaxing = true;
  975 + var icoObj = $$(node, consts.id.ICON, setting);
  976 + icoObj.attr({"style":"", "class":consts.className.BUTTON + " " + consts.className.ICO_LOADING});
  977 + }
  978 +
  979 + var tmpParam = {};
  980 + for (i = 0, l = setting.async.autoParam.length; node && i < l; i++) {
  981 + var pKey = setting.async.autoParam[i].split("="), spKey = pKey;
  982 + if (pKey.length>1) {
  983 + spKey = pKey[1];
  984 + pKey = pKey[0];
  985 + }
  986 + tmpParam[spKey] = node[pKey];
  987 + }
  988 + if (tools.isArray(setting.async.otherParam)) {
  989 + for (i = 0, l = setting.async.otherParam.length; i < l; i += 2) {
  990 + tmpParam[setting.async.otherParam[i]] = setting.async.otherParam[i + 1];
  991 + }
  992 + } else {
  993 + for (var p in setting.async.otherParam) {
  994 + tmpParam[p] = setting.async.otherParam[p];
  995 + }
  996 + }
  997 +
  998 + var _tmpV = data.getRoot(setting)._ver;
  999 + $.ajax({
  1000 + contentType: setting.async.contentType,
  1001 + cache: false,
  1002 + type: setting.async.type,
  1003 + url: tools.apply(setting.async.url, [setting.treeId, node], setting.async.url),
  1004 + data: tmpParam,
  1005 + dataType: setting.async.dataType,
  1006 + success: function(msg) {
  1007 + if (_tmpV != data.getRoot(setting)._ver) {
  1008 + return;
  1009 + }
  1010 + var newNodes = [];
  1011 + try {
  1012 + if (!msg || msg.length == 0) {
  1013 + newNodes = [];
  1014 + } else if (typeof msg == "string") {
  1015 + newNodes = eval("(" + msg + ")");
  1016 + } else {
  1017 + newNodes = msg;
  1018 + }
  1019 + } catch(err) {
  1020 + newNodes = msg;
  1021 + }
  1022 +
  1023 + if (node) {
  1024 + node.isAjaxing = null;
  1025 + node.zAsync = true;
  1026 + }
  1027 + view.setNodeLineIcos(setting, node);
  1028 + if (newNodes && newNodes !== "") {
  1029 + newNodes = tools.apply(setting.async.dataFilter, [setting.treeId, node, newNodes], newNodes);
  1030 + view.addNodes(setting, node, -1, !!newNodes ? tools.clone(newNodes) : [], !!isSilent);
  1031 + } else {
  1032 + view.addNodes(setting, node, -1, [], !!isSilent);
  1033 + }
  1034 + setting.treeObj.trigger(consts.event.ASYNC_SUCCESS, [setting.treeId, node, msg]);
  1035 + tools.apply(callback);
  1036 + },
  1037 + error: function(XMLHttpRequest, textStatus, errorThrown) {
  1038 + if (_tmpV != data.getRoot(setting)._ver) {
  1039 + return;
  1040 + }
  1041 + if (node) node.isAjaxing = null;
  1042 + view.setNodeLineIcos(setting, node);
  1043 + setting.treeObj.trigger(consts.event.ASYNC_ERROR, [setting.treeId, node, XMLHttpRequest, textStatus, errorThrown]);
  1044 + }
  1045 + });
  1046 + return true;
  1047 + },
  1048 + cancelPreSelectedNode: function (setting, node, excludeNode) {
  1049 + var list = data.getRoot(setting).curSelectedList,
  1050 + i, n;
  1051 + for (i=list.length-1; i>=0; i--) {
  1052 + n = list[i];
  1053 + if (node === n || (!node && (!excludeNode || excludeNode !== n))) {
  1054 + $$(n, consts.id.A, setting).removeClass(consts.node.CURSELECTED);
  1055 + if (node) {
  1056 + data.removeSelectedNode(setting, node);
  1057 + break;
  1058 + } else {
  1059 + list.splice(i, 1);
  1060 + setting.treeObj.trigger(consts.event.UNSELECTED, [setting.treeId, n]);
  1061 + }
  1062 + }
  1063 + }
  1064 + },
  1065 + createNodeCallback: function(setting) {
  1066 + if (!!setting.callback.onNodeCreated || !!setting.view.addDiyDom) {
  1067 + var root = data.getRoot(setting);
  1068 + while (root.createdNodes.length>0) {
  1069 + var node = root.createdNodes.shift();
  1070 + tools.apply(setting.view.addDiyDom, [setting.treeId, node]);
  1071 + if (!!setting.callback.onNodeCreated) {
  1072 + setting.treeObj.trigger(consts.event.NODECREATED, [setting.treeId, node]);
  1073 + }
  1074 + }
  1075 + }
  1076 + },
  1077 + createNodes: function(setting, level, nodes, parentNode, index) {
  1078 + if (!nodes || nodes.length == 0) return;
  1079 + var root = data.getRoot(setting),
  1080 + childKey = setting.data.key.children,
  1081 + openFlag = !parentNode || parentNode.open || !!$$(parentNode[childKey][0], setting).get(0);
  1082 + root.createdNodes = [];
  1083 + var zTreeHtml = view.appendNodes(setting, level, nodes, parentNode, index, true, openFlag),
  1084 + parentObj, nextObj;
  1085 +
  1086 + if (!parentNode) {
  1087 + parentObj = setting.treeObj;
  1088 + //setting.treeObj.append(zTreeHtml.join(''));
  1089 + } else {
  1090 + var ulObj = $$(parentNode, consts.id.UL, setting);
  1091 + if (ulObj.get(0)) {
  1092 + parentObj = ulObj;
  1093 + //ulObj.append(zTreeHtml.join(''));
  1094 + }
  1095 + }
  1096 + if (parentObj) {
  1097 + if (index >= 0) {
  1098 + nextObj = parentObj.children()[index];
  1099 + }
  1100 + if (index >=0 && nextObj) {
  1101 + $(nextObj).before(zTreeHtml.join(''));
  1102 + } else {
  1103 + parentObj.append(zTreeHtml.join(''));
  1104 + }
  1105 + }
  1106 +
  1107 + view.createNodeCallback(setting);
  1108 + },
  1109 + destroy: function(setting) {
  1110 + if (!setting) return;
  1111 + data.initCache(setting);
  1112 + data.initRoot(setting);
  1113 + event.unbindTree(setting);
  1114 + event.unbindEvent(setting);
  1115 + setting.treeObj.empty();
  1116 + delete settings[setting.treeId];
  1117 + },
  1118 + expandCollapseNode: function(setting, node, expandFlag, animateFlag, callback) {
  1119 + var root = data.getRoot(setting),
  1120 + childKey = setting.data.key.children;
  1121 + if (!node) {
  1122 + tools.apply(callback, []);
  1123 + return;
  1124 + }
  1125 + if (root.expandTriggerFlag) {
  1126 + var _callback = callback;
  1127 + callback = function(){
  1128 + if (_callback) _callback();
  1129 + if (node.open) {
  1130 + setting.treeObj.trigger(consts.event.EXPAND, [setting.treeId, node]);
  1131 + } else {
  1132 + setting.treeObj.trigger(consts.event.COLLAPSE, [setting.treeId, node]);
  1133 + }
  1134 + };
  1135 + root.expandTriggerFlag = false;
  1136 + }
  1137 + if (!node.open && node.isParent && ((!$$(node, consts.id.UL, setting).get(0)) || (node[childKey] && node[childKey].length>0 && !$$(node[childKey][0], setting).get(0)))) {
  1138 + view.appendParentULDom(setting, node);
  1139 + view.createNodeCallback(setting);
  1140 + }
  1141 + if (node.open == expandFlag) {
  1142 + tools.apply(callback, []);
  1143 + return;
  1144 + }
  1145 + var ulObj = $$(node, consts.id.UL, setting),
  1146 + switchObj = $$(node, consts.id.SWITCH, setting),
  1147 + icoObj = $$(node, consts.id.ICON, setting);
  1148 +
  1149 + if (node.isParent) {
  1150 + node.open = !node.open;
  1151 + if (node.iconOpen && node.iconClose) {
  1152 + icoObj.attr("style", view.makeNodeIcoStyle(setting, node));
  1153 + }
  1154 +
  1155 + if (node.open) {
  1156 + view.replaceSwitchClass(node, switchObj, consts.folder.OPEN);
  1157 + view.replaceIcoClass(node, icoObj, consts.folder.OPEN);
  1158 + if (animateFlag == false || setting.view.expandSpeed == "") {
  1159 + ulObj.show();
  1160 + tools.apply(callback, []);
  1161 + } else {
  1162 + if (node[childKey] && node[childKey].length > 0) {
  1163 + ulObj.slideDown(setting.view.expandSpeed, callback);
  1164 + } else {
  1165 + ulObj.show();
  1166 + tools.apply(callback, []);
  1167 + }
  1168 + }
  1169 + } else {
  1170 + view.replaceSwitchClass(node, switchObj, consts.folder.CLOSE);
  1171 + view.replaceIcoClass(node, icoObj, consts.folder.CLOSE);
  1172 + if (animateFlag == false || setting.view.expandSpeed == "" || !(node[childKey] && node[childKey].length > 0)) {
  1173 + ulObj.hide();
  1174 + tools.apply(callback, []);
  1175 + } else {
  1176 + ulObj.slideUp(setting.view.expandSpeed, callback);
  1177 + }
  1178 + }
  1179 + } else {
  1180 + tools.apply(callback, []);
  1181 + }
  1182 + },
  1183 + expandCollapseParentNode: function(setting, node, expandFlag, animateFlag, callback) {
  1184 + if (!node) return;
  1185 + if (!node.parentTId) {
  1186 + view.expandCollapseNode(setting, node, expandFlag, animateFlag, callback);
  1187 + return;
  1188 + } else {
  1189 + view.expandCollapseNode(setting, node, expandFlag, animateFlag);
  1190 + }
  1191 + if (node.parentTId) {
  1192 + view.expandCollapseParentNode(setting, node.getParentNode(), expandFlag, animateFlag, callback);
  1193 + }
  1194 + },
  1195 + expandCollapseSonNode: function(setting, node, expandFlag, animateFlag, callback) {
  1196 + var root = data.getRoot(setting),
  1197 + childKey = setting.data.key.children,
  1198 + treeNodes = (node) ? node[childKey]: root[childKey],
  1199 + selfAnimateSign = (node) ? false : animateFlag,
  1200 + expandTriggerFlag = data.getRoot(setting).expandTriggerFlag;
  1201 + data.getRoot(setting).expandTriggerFlag = false;
  1202 + if (treeNodes) {
  1203 + for (var i = 0, l = treeNodes.length; i < l; i++) {
  1204 + if (treeNodes[i]) view.expandCollapseSonNode(setting, treeNodes[i], expandFlag, selfAnimateSign);
  1205 + }
  1206 + }
  1207 + data.getRoot(setting).expandTriggerFlag = expandTriggerFlag;
  1208 + view.expandCollapseNode(setting, node, expandFlag, animateFlag, callback );
  1209 + },
  1210 + isSelectedNode: function (setting, node) {
  1211 + if (!node) {
  1212 + return false;
  1213 + }
  1214 + var list = data.getRoot(setting).curSelectedList,
  1215 + i;
  1216 + for (i=list.length-1; i>=0; i--) {
  1217 + if (node === list[i]) {
  1218 + return true;
  1219 + }
  1220 + }
  1221 + return false;
  1222 + },
  1223 + makeDOMNodeIcon: function(html, setting, node) {
  1224 + var nameStr = data.getNodeName(setting, node),
  1225 + name = setting.view.nameIsHTML ? nameStr : nameStr.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
  1226 + html.push("<span id='", node.tId, consts.id.ICON,
  1227 + "' title='' treeNode", consts.id.ICON," class='", view.makeNodeIcoClass(setting, node),
  1228 + "' style='", view.makeNodeIcoStyle(setting, node), "'></span><span id='", node.tId, consts.id.SPAN,
  1229 + "' class='", consts.className.NAME,
  1230 + "'>",name,"</span>");
  1231 + },
  1232 + makeDOMNodeLine: function(html, setting, node) {
  1233 + html.push("<span id='", node.tId, consts.id.SWITCH, "' title='' class='", view.makeNodeLineClass(setting, node), "' treeNode", consts.id.SWITCH,"></span>");
  1234 + },
  1235 + makeDOMNodeMainAfter: function(html, setting, node) {
  1236 + html.push("</li>");
  1237 + },
  1238 + makeDOMNodeMainBefore: function(html, setting, node) {
  1239 + html.push("<li id='", node.tId, "' class='", consts.className.LEVEL, node.level,"' tabindex='0' hidefocus='true' treenode>");
  1240 + },
  1241 + makeDOMNodeNameAfter: function(html, setting, node) {
  1242 + html.push("</a>");
  1243 + },
  1244 + makeDOMNodeNameBefore: function(html, setting, node) {
  1245 + var title = data.getNodeTitle(setting, node),
  1246 + url = view.makeNodeUrl(setting, node),
  1247 + fontcss = view.makeNodeFontCss(setting, node),
  1248 + fontStyle = [];
  1249 + for (var f in fontcss) {
  1250 + fontStyle.push(f, ":", fontcss[f], ";");
  1251 + }
  1252 + html.push("<a id='", node.tId, consts.id.A, "' class='", consts.className.LEVEL, node.level,"' treeNode", consts.id.A," onclick=\"", (node.click || ''),
  1253 + "\" ", ((url != null && url.length > 0) ? "href='" + url + "'" : ""), " target='",view.makeNodeTarget(node),"' style='", fontStyle.join(''),
  1254 + "'");
  1255 + if (tools.apply(setting.view.showTitle, [setting.treeId, node], setting.view.showTitle) && title) {html.push("title='", title.replace(/'/g,"&#39;").replace(/</g,'&lt;').replace(/>/g,'&gt;'),"'");}
  1256 + html.push(">");
  1257 + },
  1258 + makeNodeFontCss: function(setting, node) {
  1259 + var fontCss = tools.apply(setting.view.fontCss, [setting.treeId, node], setting.view.fontCss);
  1260 + return (fontCss && ((typeof fontCss) != "function")) ? fontCss : {};
  1261 + },
  1262 + makeNodeIcoClass: function(setting, node) {
  1263 + var icoCss = ["ico"];
  1264 + if (!node.isAjaxing) {
  1265 + icoCss[0] = (node.iconSkin ? node.iconSkin + "_" : "") + icoCss[0];
  1266 + if (node.isParent) {
  1267 + icoCss.push(node.open ? consts.folder.OPEN : consts.folder.CLOSE);
  1268 + } else {
  1269 + icoCss.push(consts.folder.DOCU);
  1270 + }
  1271 + }
  1272 + return consts.className.BUTTON + " " + icoCss.join('_');
  1273 + },
  1274 + makeNodeIcoStyle: function(setting, node) {
  1275 + var icoStyle = [];
  1276 + if (!node.isAjaxing) {
  1277 + var icon = (node.isParent && node.iconOpen && node.iconClose) ? (node.open ? node.iconOpen : node.iconClose) : node[setting.data.key.icon];
  1278 + if (icon) icoStyle.push("background:url(", icon, ") 0 0 no-repeat;");
  1279 + if (setting.view.showIcon == false || !tools.apply(setting.view.showIcon, [setting.treeId, node], true)) {
  1280 + icoStyle.push("width:0px;height:0px;");
  1281 + }
  1282 + }
  1283 + return icoStyle.join('');
  1284 + },
  1285 + makeNodeLineClass: function(setting, node) {
  1286 + var lineClass = [];
  1287 + if (setting.view.showLine) {
  1288 + if (node.level == 0 && node.isFirstNode && node.isLastNode) {
  1289 + lineClass.push(consts.line.ROOT);
  1290 + } else if (node.level == 0 && node.isFirstNode) {
  1291 + lineClass.push(consts.line.ROOTS);
  1292 + } else if (node.isLastNode) {
  1293 + lineClass.push(consts.line.BOTTOM);
  1294 + } else {
  1295 + lineClass.push(consts.line.CENTER);
  1296 + }
  1297 + } else {
  1298 + lineClass.push(consts.line.NOLINE);
  1299 + }
  1300 + if (node.isParent) {
  1301 + lineClass.push(node.open ? consts.folder.OPEN : consts.folder.CLOSE);
  1302 + } else {
  1303 + lineClass.push(consts.folder.DOCU);
  1304 + }
  1305 + return view.makeNodeLineClassEx(node) + lineClass.join('_');
  1306 + },
  1307 + makeNodeLineClassEx: function(node) {
  1308 + return consts.className.BUTTON + " " + consts.className.LEVEL + node.level + " " + consts.className.SWITCH + " ";
  1309 + },
  1310 + makeNodeTarget: function(node) {
  1311 + return (node.target || "_blank");
  1312 + },
  1313 + makeNodeUrl: function(setting, node) {
  1314 + var urlKey = setting.data.key.url;
  1315 + return node[urlKey] ? node[urlKey] : null;
  1316 + },
  1317 + makeUlHtml: function(setting, node, html, content) {
  1318 + html.push("<ul id='", node.tId, consts.id.UL, "' class='", consts.className.LEVEL, node.level, " ", view.makeUlLineClass(setting, node), "' style='display:", (node.open ? "block": "none"),"'>");
  1319 + html.push(content);
  1320 + html.push("</ul>");
  1321 + },
  1322 + makeUlLineClass: function(setting, node) {
  1323 + return ((setting.view.showLine && !node.isLastNode) ? consts.line.LINE : "");
  1324 + },
  1325 + removeChildNodes: function(setting, node) {
  1326 + if (!node) return;
  1327 + var childKey = setting.data.key.children,
  1328 + nodes = node[childKey];
  1329 + if (!nodes) return;
  1330 +
  1331 + for (var i = 0, l = nodes.length; i < l; i++) {
  1332 + data.removeNodeCache(setting, nodes[i]);
  1333 + }
  1334 + data.removeSelectedNode(setting);
  1335 + delete node[childKey];
  1336 +
  1337 + if (!setting.data.keep.parent) {
  1338 + node.isParent = false;
  1339 + node.open = false;
  1340 + var tmp_switchObj = $$(node, consts.id.SWITCH, setting),
  1341 + tmp_icoObj = $$(node, consts.id.ICON, setting);
  1342 + view.replaceSwitchClass(node, tmp_switchObj, consts.folder.DOCU);
  1343 + view.replaceIcoClass(node, tmp_icoObj, consts.folder.DOCU);
  1344 + $$(node, consts.id.UL, setting).remove();
  1345 + } else {
  1346 + $$(node, consts.id.UL, setting).empty();
  1347 + }
  1348 + },
  1349 + setFirstNode: function(setting, parentNode) {
  1350 + var childKey = setting.data.key.children, childLength = parentNode[childKey].length;
  1351 + if ( childLength > 0) {
  1352 + parentNode[childKey][0].isFirstNode = true;
  1353 + }
  1354 + },
  1355 + setLastNode: function(setting, parentNode) {
  1356 + var childKey = setting.data.key.children, childLength = parentNode[childKey].length;
  1357 + if ( childLength > 0) {
  1358 + parentNode[childKey][childLength - 1].isLastNode = true;
  1359 + }
  1360 + },
  1361 + removeNode: function(setting, node) {
  1362 + var root = data.getRoot(setting),
  1363 + childKey = setting.data.key.children,
  1364 + parentNode = (node.parentTId) ? node.getParentNode() : root;
  1365 +
  1366 + node.isFirstNode = false;
  1367 + node.isLastNode = false;
  1368 + node.getPreNode = function() {return null;};
  1369 + node.getNextNode = function() {return null;};
  1370 +
  1371 + if (!data.getNodeCache(setting, node.tId)) {
  1372 + return;
  1373 + }
  1374 +
  1375 + $$(node, setting).remove();
  1376 + data.removeNodeCache(setting, node);
  1377 + data.removeSelectedNode(setting, node);
  1378 +
  1379 + for (var i = 0, l = parentNode[childKey].length; i < l; i++) {
  1380 + if (parentNode[childKey][i].tId == node.tId) {
  1381 + parentNode[childKey].splice(i, 1);
  1382 + break;
  1383 + }
  1384 + }
  1385 + view.setFirstNode(setting, parentNode);
  1386 + view.setLastNode(setting, parentNode);
  1387 +
  1388 + var tmp_ulObj,tmp_switchObj,tmp_icoObj,
  1389 + childLength = parentNode[childKey].length;
  1390 +
  1391 + //repair nodes old parent
  1392 + if (!setting.data.keep.parent && childLength == 0) {
  1393 + //old parentNode has no child nodes
  1394 + parentNode.isParent = false;
  1395 + parentNode.open = false;
  1396 + tmp_ulObj = $$(parentNode, consts.id.UL, setting);
  1397 + tmp_switchObj = $$(parentNode, consts.id.SWITCH, setting);
  1398 + tmp_icoObj = $$(parentNode, consts.id.ICON, setting);
  1399 + view.replaceSwitchClass(parentNode, tmp_switchObj, consts.folder.DOCU);
  1400 + view.replaceIcoClass(parentNode, tmp_icoObj, consts.folder.DOCU);
  1401 + tmp_ulObj.css("display", "none");
  1402 +
  1403 + } else if (setting.view.showLine && childLength > 0) {
  1404 + //old parentNode has child nodes
  1405 + var newLast = parentNode[childKey][childLength - 1];
  1406 + tmp_ulObj = $$(newLast, consts.id.UL, setting);
  1407 + tmp_switchObj = $$(newLast, consts.id.SWITCH, setting);
  1408 + tmp_icoObj = $$(newLast, consts.id.ICON, setting);
  1409 + if (parentNode == root) {
  1410 + if (parentNode[childKey].length == 1) {
  1411 + //node was root, and ztree has only one root after move node
  1412 + view.replaceSwitchClass(newLast, tmp_switchObj, consts.line.ROOT);
  1413 + } else {
  1414 + var tmp_first_switchObj = $$(parentNode[childKey][0], consts.id.SWITCH, setting);
  1415 + view.replaceSwitchClass(parentNode[childKey][0], tmp_first_switchObj, consts.line.ROOTS);
  1416 + view.replaceSwitchClass(newLast, tmp_switchObj, consts.line.BOTTOM);
  1417 + }
  1418 + } else {
  1419 + view.replaceSwitchClass(newLast, tmp_switchObj, consts.line.BOTTOM);
  1420 + }
  1421 + tmp_ulObj.removeClass(consts.line.LINE);
  1422 + }
  1423 + },
  1424 + replaceIcoClass: function(node, obj, newName) {
  1425 + if (!obj || node.isAjaxing) return;
  1426 + var tmpName = obj.attr("class");
  1427 + if (tmpName == undefined) return;
  1428 + var tmpList = tmpName.split("_");
  1429 + switch (newName) {
  1430 + case consts.folder.OPEN:
  1431 + case consts.folder.CLOSE:
  1432 + case consts.folder.DOCU:
  1433 + tmpList[tmpList.length-1] = newName;
  1434 + break;
  1435 + }
  1436 + obj.attr("class", tmpList.join("_"));
  1437 + },
  1438 + replaceSwitchClass: function(node, obj, newName) {
  1439 + if (!obj) return;
  1440 + var tmpName = obj.attr("class");
  1441 + if (tmpName == undefined) return;
  1442 + var tmpList = tmpName.split("_");
  1443 + switch (newName) {
  1444 + case consts.line.ROOT:
  1445 + case consts.line.ROOTS:
  1446 + case consts.line.CENTER:
  1447 + case consts.line.BOTTOM:
  1448 + case consts.line.NOLINE:
  1449 + tmpList[0] = view.makeNodeLineClassEx(node) + newName;
  1450 + break;
  1451 + case consts.folder.OPEN:
  1452 + case consts.folder.CLOSE:
  1453 + case consts.folder.DOCU:
  1454 + tmpList[1] = newName;
  1455 + break;
  1456 + }
  1457 + obj.attr("class", tmpList.join("_"));
  1458 + if (newName !== consts.folder.DOCU) {
  1459 + obj.removeAttr("disabled");
  1460 + } else {
  1461 + obj.attr("disabled", "disabled");
  1462 + }
  1463 + },
  1464 + selectNode: function(setting, node, addFlag) {
  1465 + if (!addFlag) {
  1466 + view.cancelPreSelectedNode(setting, null, node);
  1467 + }
  1468 + $$(node, consts.id.A, setting).addClass(consts.node.CURSELECTED);
  1469 + data.addSelectedNode(setting, node);
  1470 + setting.treeObj.trigger(consts.event.SELECTED, [setting.treeId, node]);
  1471 + },
  1472 + setNodeFontCss: function(setting, treeNode) {
  1473 + var aObj = $$(treeNode, consts.id.A, setting),
  1474 + fontCss = view.makeNodeFontCss(setting, treeNode);
  1475 + if (fontCss) {
  1476 + aObj.css(fontCss);
  1477 + }
  1478 + },
  1479 + setNodeLineIcos: function(setting, node) {
  1480 + if (!node) return;
  1481 + var switchObj = $$(node, consts.id.SWITCH, setting),
  1482 + ulObj = $$(node, consts.id.UL, setting),
  1483 + icoObj = $$(node, consts.id.ICON, setting),
  1484 + ulLine = view.makeUlLineClass(setting, node);
  1485 + if (ulLine.length==0) {
  1486 + ulObj.removeClass(consts.line.LINE);
  1487 + } else {
  1488 + ulObj.addClass(ulLine);
  1489 + }
  1490 + switchObj.attr("class", view.makeNodeLineClass(setting, node));
  1491 + if (node.isParent) {
  1492 + switchObj.removeAttr("disabled");
  1493 + } else {
  1494 + switchObj.attr("disabled", "disabled");
  1495 + }
  1496 + icoObj.removeAttr("style");
  1497 + icoObj.attr("style", view.makeNodeIcoStyle(setting, node));
  1498 + icoObj.attr("class", view.makeNodeIcoClass(setting, node));
  1499 + },
  1500 + setNodeName: function(setting, node) {
  1501 + var title = data.getNodeTitle(setting, node),
  1502 + nObj = $$(node, consts.id.SPAN, setting);
  1503 + nObj.empty();
  1504 + if (setting.view.nameIsHTML) {
  1505 + nObj.html(data.getNodeName(setting, node));
  1506 + } else {
  1507 + nObj.text(data.getNodeName(setting, node));
  1508 + }
  1509 + if (tools.apply(setting.view.showTitle, [setting.treeId, node], setting.view.showTitle)) {
  1510 + var aObj = $$(node, consts.id.A, setting);
  1511 + aObj.attr("title", !title ? "" : title);
  1512 + }
  1513 + },
  1514 + setNodeTarget: function(setting, node) {
  1515 + var aObj = $$(node, consts.id.A, setting);
  1516 + aObj.attr("target", view.makeNodeTarget(node));
  1517 + },
  1518 + setNodeUrl: function(setting, node) {
  1519 + var aObj = $$(node, consts.id.A, setting),
  1520 + url = view.makeNodeUrl(setting, node);
  1521 + if (url == null || url.length == 0) {
  1522 + aObj.removeAttr("href");
  1523 + } else {
  1524 + aObj.attr("href", url);
  1525 + }
  1526 + },
  1527 + switchNode: function(setting, node) {
  1528 + if (node.open || !tools.canAsync(setting, node)) {
  1529 + view.expandCollapseNode(setting, node, !node.open);
  1530 + } else if (setting.async.enable) {
  1531 + if (!view.asyncNode(setting, node)) {
  1532 + view.expandCollapseNode(setting, node, !node.open);
  1533 + return;
  1534 + }
  1535 + } else if (node) {
  1536 + view.expandCollapseNode(setting, node, !node.open);
  1537 + }
  1538 + }
  1539 + };
  1540 + // zTree defind
  1541 + $.fn.zTree = {
  1542 + consts : _consts,
  1543 + _z : {
  1544 + tools: tools,
  1545 + view: view,
  1546 + event: event,
  1547 + data: data
  1548 + },
  1549 + getZTreeObj: function(treeId) {
  1550 + var o = data.getZTreeTools(treeId);
  1551 + return o ? o : null;
  1552 + },
  1553 + destroy: function(treeId) {
  1554 + if (!!treeId && treeId.length > 0) {
  1555 + view.destroy(data.getSetting(treeId));
  1556 + } else {
  1557 + for(var s in settings) {
  1558 + view.destroy(settings[s]);
  1559 + }
  1560 + }
  1561 + },
  1562 + init: function(obj, zSetting, zNodes) {
  1563 + var setting = tools.clone(_setting);
  1564 + $.extend(true, setting, zSetting);
  1565 + setting.treeId = obj.attr("id");
  1566 + setting.treeObj = obj;
  1567 + setting.treeObj.empty();
  1568 + settings[setting.treeId] = setting;
  1569 + //For some older browser,(e.g., ie6)
  1570 + if(typeof document.body.style.maxHeight === "undefined") {
  1571 + setting.view.expandSpeed = "";
  1572 + }
  1573 + data.initRoot(setting);
  1574 + var root = data.getRoot(setting),
  1575 + childKey = setting.data.key.children;
  1576 + zNodes = zNodes ? tools.clone(tools.isArray(zNodes)? zNodes : [zNodes]) : [];
  1577 + if (setting.data.simpleData.enable) {
  1578 + root[childKey] = data.transformTozTreeFormat(setting, zNodes);
  1579 + } else {
  1580 + root[childKey] = zNodes;
  1581 + }
  1582 +
  1583 + data.initCache(setting);
  1584 + event.unbindTree(setting);
  1585 + event.bindTree(setting);
  1586 + event.unbindEvent(setting);
  1587 + event.bindEvent(setting);
  1588 +
  1589 + var zTreeTools = {
  1590 + setting : setting,
  1591 + addNodes : function(parentNode, index, newNodes, isSilent) {
  1592 + if (!parentNode) parentNode = null;
  1593 + if (parentNode && !parentNode.isParent && setting.data.keep.leaf) return null;
  1594 +
  1595 + var i = parseInt(index, 10);
  1596 + if (isNaN(i)) {
  1597 + isSilent = !!newNodes;
  1598 + newNodes = index;
  1599 + index = -1;
  1600 + } else {
  1601 + index = i;
  1602 + }
  1603 + if (!newNodes) return null;
  1604 +
  1605 +
  1606 + var xNewNodes = tools.clone(tools.isArray(newNodes)? newNodes: [newNodes]);
  1607 + function addCallback() {
  1608 + view.addNodes(setting, parentNode, index, xNewNodes, (isSilent==true));
  1609 + }
  1610 +
  1611 + if (tools.canAsync(setting, parentNode)) {
  1612 + view.asyncNode(setting, parentNode, isSilent, addCallback);
  1613 + } else {
  1614 + addCallback();
  1615 + }
  1616 + return xNewNodes;
  1617 + },
  1618 + cancelSelectedNode : function(node) {
  1619 + view.cancelPreSelectedNode(setting, node);
  1620 + },
  1621 + destroy : function() {
  1622 + view.destroy(setting);
  1623 + },
  1624 + expandAll : function(expandFlag) {
  1625 + expandFlag = !!expandFlag;
  1626 + view.expandCollapseSonNode(setting, null, expandFlag, true);
  1627 + return expandFlag;
  1628 + },
  1629 + expandNode : function(node, expandFlag, sonSign, focus, callbackFlag) {
  1630 + if (!node || !node.isParent) return null;
  1631 + if (expandFlag !== true && expandFlag !== false) {
  1632 + expandFlag = !node.open;
  1633 + }
  1634 + callbackFlag = !!callbackFlag;
  1635 +
  1636 + if (callbackFlag && expandFlag && (tools.apply(setting.callback.beforeExpand, [setting.treeId, node], true) == false)) {
  1637 + return null;
  1638 + } else if (callbackFlag && !expandFlag && (tools.apply(setting.callback.beforeCollapse, [setting.treeId, node], true) == false)) {
  1639 + return null;
  1640 + }
  1641 + if (expandFlag && node.parentTId) {
  1642 + view.expandCollapseParentNode(setting, node.getParentNode(), expandFlag, false);
  1643 + }
  1644 + if (expandFlag === node.open && !sonSign) {
  1645 + return null;
  1646 + }
  1647 +
  1648 + data.getRoot(setting).expandTriggerFlag = callbackFlag;
  1649 + if (!tools.canAsync(setting, node) && sonSign) {
  1650 + view.expandCollapseSonNode(setting, node, expandFlag, true, function() {
  1651 + if (focus !== false) {try{$$(node, setting).focus().blur();}catch(e){}}
  1652 + });
  1653 + } else {
  1654 + node.open = !expandFlag;
  1655 + view.switchNode(this.setting, node);
  1656 + if (focus !== false) {try{$$(node, setting).focus().blur();}catch(e){}}
  1657 + }
  1658 + return expandFlag;
  1659 + },
  1660 + getNodes : function() {
  1661 + return data.getNodes(setting);
  1662 + },
  1663 + getNodeByParam : function(key, value, parentNode) {
  1664 + if (!key) return null;
  1665 + return data.getNodeByParam(setting, parentNode?parentNode[setting.data.key.children]:data.getNodes(setting), key, value);
  1666 + },
  1667 + getNodeByTId : function(tId) {
  1668 + return data.getNodeCache(setting, tId);
  1669 + },
  1670 + getNodesByParam : function(key, value, parentNode) {
  1671 + if (!key) return null;
  1672 + return data.getNodesByParam(setting, parentNode?parentNode[setting.data.key.children]:data.getNodes(setting), key, value);
  1673 + },
  1674 + getNodesByParamFuzzy : function(key, value, parentNode) {
  1675 + if (!key) return null;
  1676 + return data.getNodesByParamFuzzy(setting, parentNode?parentNode[setting.data.key.children]:data.getNodes(setting), key, value);
  1677 + },
  1678 + getNodesByFilter: function(filter, isSingle, parentNode, invokeParam) {
  1679 + isSingle = !!isSingle;
  1680 + if (!filter || (typeof filter != "function")) return (isSingle ? null : []);
  1681 + return data.getNodesByFilter(setting, parentNode?parentNode[setting.data.key.children]:data.getNodes(setting), filter, isSingle, invokeParam);
  1682 + },
  1683 + getNodeIndex : function(node) {
  1684 + if (!node) return null;
  1685 + var childKey = setting.data.key.children,
  1686 + parentNode = (node.parentTId) ? node.getParentNode() : data.getRoot(setting);
  1687 + for (var i=0, l = parentNode[childKey].length; i < l; i++) {
  1688 + if (parentNode[childKey][i] == node) return i;
  1689 + }
  1690 + return -1;
  1691 + },
  1692 + getSelectedNodes : function() {
  1693 + var r = [], list = data.getRoot(setting).curSelectedList;
  1694 + for (var i=0, l=list.length; i<l; i++) {
  1695 + r.push(list[i]);
  1696 + }
  1697 + return r;
  1698 + },
  1699 + isSelectedNode : function(node) {
  1700 + return data.isSelectedNode(setting, node);
  1701 + },
  1702 + reAsyncChildNodes : function(parentNode, reloadType, isSilent) {
  1703 + if (!this.setting.async.enable) return;
  1704 + var isRoot = !parentNode;
  1705 + if (isRoot) {
  1706 + parentNode = data.getRoot(setting);
  1707 + }
  1708 + if (reloadType=="refresh") {
  1709 + var childKey = this.setting.data.key.children;
  1710 + for (var i = 0, l = parentNode[childKey] ? parentNode[childKey].length : 0; i < l; i++) {
  1711 + data.removeNodeCache(setting, parentNode[childKey][i]);
  1712 + }
  1713 + data.removeSelectedNode(setting);
  1714 + parentNode[childKey] = [];
  1715 + if (isRoot) {
  1716 + this.setting.treeObj.empty();
  1717 + } else {
  1718 + var ulObj = $$(parentNode, consts.id.UL, setting);
  1719 + ulObj.empty();
  1720 + }
  1721 + }
  1722 + view.asyncNode(this.setting, isRoot? null:parentNode, !!isSilent);
  1723 + },
  1724 + refresh : function() {
  1725 + this.setting.treeObj.empty();
  1726 + var root = data.getRoot(setting),
  1727 + nodes = root[setting.data.key.children]
  1728 + data.initRoot(setting);
  1729 + root[setting.data.key.children] = nodes
  1730 + data.initCache(setting);
  1731 + view.createNodes(setting, 0, root[setting.data.key.children], null, -1);
  1732 + },
  1733 + removeChildNodes : function(node) {
  1734 + if (!node) return null;
  1735 + var childKey = setting.data.key.children,
  1736 + nodes = node[childKey];
  1737 + view.removeChildNodes(setting, node);
  1738 + return nodes ? nodes : null;
  1739 + },
  1740 + removeNode : function(node, callbackFlag) {
  1741 + if (!node) return;
  1742 + callbackFlag = !!callbackFlag;
  1743 + if (callbackFlag && tools.apply(setting.callback.beforeRemove, [setting.treeId, node], true) == false) return;
  1744 + view.removeNode(setting, node);
  1745 + if (callbackFlag) {
  1746 + this.setting.treeObj.trigger(consts.event.REMOVE, [setting.treeId, node]);
  1747 + }
  1748 + },
  1749 + selectNode : function(node, addFlag) {
  1750 + if (!node) return;
  1751 + if (tools.uCanDo(setting)) {
  1752 + addFlag = setting.view.selectedMulti && addFlag;
  1753 + if (node.parentTId) {
  1754 + view.expandCollapseParentNode(setting, node.getParentNode(), true, false, function() {
  1755 + try{$$(node, setting).focus().blur();}catch(e){}
  1756 + });
  1757 + } else {
  1758 + try{$$(node, setting).focus().blur();}catch(e){}
  1759 + }
  1760 + view.selectNode(setting, node, addFlag);
  1761 + }
  1762 + },
  1763 + transformTozTreeNodes : function(simpleNodes) {
  1764 + return data.transformTozTreeFormat(setting, simpleNodes);
  1765 + },
  1766 + transformToArray : function(nodes) {
  1767 + return data.transformToArrayFormat(setting, nodes);
  1768 + },
  1769 + updateNode : function(node, checkTypeFlag) {
  1770 + if (!node) return;
  1771 + var nObj = $$(node, setting);
  1772 + if (nObj.get(0) && tools.uCanDo(setting)) {
  1773 + view.setNodeName(setting, node);
  1774 + view.setNodeTarget(setting, node);
  1775 + view.setNodeUrl(setting, node);
  1776 + view.setNodeLineIcos(setting, node);
  1777 + view.setNodeFontCss(setting, node);
  1778 + }
  1779 + }
  1780 + }
  1781 + root.treeTools = zTreeTools;
  1782 + data.setZTreeTools(setting, zTreeTools);
  1783 +
  1784 + if (root[childKey] && root[childKey].length > 0) {
  1785 + view.createNodes(setting, 0, root[childKey], null, -1);
  1786 + } else if (setting.async.enable && setting.async.url && setting.async.url !== '') {
  1787 + view.asyncNode(setting);
  1788 + }
  1789 + return zTreeTools;
  1790 + }
  1791 + };
  1792 +
  1793 + var zt = $.fn.zTree,
  1794 + $$ = tools.$,
  1795 + consts = zt.consts;
  1796 +})(jQuery);
0 1797 \ No newline at end of file
... ...
src/main/resources/static/other/video/video.css
1 1 .skeyewebplayerDivContent_one{
2   - width: 99%;
3   - height: 99%;
  2 + width: 100%;
  3 + height: 100%;
4 4 border: 1px solid #000000;
5 5 overflow:hidden;
6 6 }
7 7  
8 8 .skeyewebplayerDivContent_Four{
9   - width: 49%;
10   - height: 49%;
  9 + width: 49.9%;
  10 + height: 49.5%;
11 11 float: left;
12 12 border: 1px solid #000000;
13 13 overflow:hidden;
14 14 }
15 15 .skeyewebplayerDivContent_nine{
16   - width: 33%;
  16 + width: 33.3%;
17 17 height: 33%;
18 18 float: left;
19 19 border: 1px solid #000000;
... ... @@ -39,4 +39,14 @@
39 39 width: 20px;
40 40 height: 20px;
41 41 margin-right: 5px;
  42 +}
  43 +.custom-tree-item-clicked{
  44 + color: #FC9003;
  45 +}
  46 +
  47 +.layui-tree-txt-back{
  48 + display: inline-block;
  49 + vertical-align: middle;
  50 + color: #555;
  51 + background-color: #eaeae8;
42 52 }
43 53 \ No newline at end of file
... ...
src/main/resources/static/other/video/video.html
... ... @@ -255,26 +255,13 @@
255 255 <script src="/assets/js/eventproxy.js"></script>
256 256 <script src="/metronic_v4.5.4/layui/layui.js" ></script>
257 257  
  258 +
258 259 <script src="video.js"></script>
259 260  
260 261  
261 262 </head>
262   -<body>
263   -<div class="page-head">
264   - <div class="page-title">
265   - <h1>视频管理</h1>
266   - </div>
267   -</div>
268   -
269   -<ul class="page-breadcrumb breadcrumb">
270   - <li><a href="/pages/home.html" data-pjax>$$$$$${txt-3807}</a> <i class="fa fa-circle"></i></li>
271   - <li><span class="active">视频管理</span> <i class="fa fa-circle"></i></li>
272   -</ul>
273   -<div id="deviceVedioDiv" style="display: none">
274   - <div>$$$$$${txt-3520}<input type="input" id="dateTimeStr" /></div>
275   -</div>
276   -
277   -<div class="row" style="display: flex;width:100%">
  263 +<body style="margin: 0;padding-left: 15px;">
  264 +<div class="row" style="display: flex;width:100%;height: 100%;margin: 0;padding: 0">
278 265 <div class="col-md-4" style="padding-right: 0px;width: 20%">
279 266 <div class="portlet light bordered" >
280 267 <div class="portlet-body">
... ... @@ -282,22 +269,22 @@
282 269 <input type="text" placeholder="请输入车辆内部编号" autocomplete="off" class="layui-input" id="insideCode_like" style="display:inline-block;width: 200px"/>
283 270 <button type="button" class="layui-btn layui-btn-primary" lay-on="get-vercode" onclick="queryTreeTable()">查询</button>
284 271 </div>
285   - <div id="video_tree" style="height: 695px;overflow:scroll"></div>
  272 + <div id="video_tree" style="height: 91.5%;overflow:scroll"></div>
286 273  
287 274 </div>
288 275 </div>
289 276 </div>
290 277  
291   - <div class="col-md-6" style="padding-left: 0px;width: 76%;height: 100%">
  278 + <div class="col-md-6" style="padding-left: 0px;width: 79.95%;height: 100%">
292 279 <div class="portlet light bordered" >
293   - <div class="portlet-body">
  280 + <div>
294 281 <div class="layui-tab layui-tab-card" lay-filter="video-hash">
295 282 <ul class="layui-tab-title">
296 283 <li class="layui-this" lay-id="live_broadcast_lay_id">直播</li>
297 284 <li lay-id="history_lay_id">历史数据</li>
298 285 </ul>
299   - <div class="layui-tab-content">
300   - <div class="layui-tab-item layui-show" id="live_broadcastDiv" style="height: 644px;100%">
  286 + <div class="layui-tab-content" style="height: 90%">
  287 + <div class="layui-tab-item layui-show" id="live_broadcastDiv" >
301 288 <div>分屏:
302 289 <a href="#" class="layui-btn layui-btn-primary layui-btn-xs" onclick="skeyewebplayerOne()">□</a>
303 290 <a href="#" class="layui-btn layui-btn-primary layui-btn-xs" onclick="skeyewebplayerFour()">▤</a>
... ... @@ -307,7 +294,7 @@
307 294 <div class="skeyewebplayerDivContent_one skeyewebplayerDivContent_play_selected " id="skeyewebplayerDivContent_play_0" onclick="skeyewebplayerDivContent_play_click(this)"><div class="skeyewebplayerDiv_title"></div><div id="skeyewebplayerDiv_play_content_0" class="skeyewebplayerDiv_play_content" style="height: 95%"></div></div>
308 295 </div>
309 296 </div>
310   - <div class="layui-tab-item" style="height: 572px;width: 100%">
  297 + <div class="layui-tab-item" style="width: 100%;height: 90%">
311 298 <div class="layui-form-item" style="width: 100%; float: left">
312 299 <div class="layui-inline">
313 300 <label class="layui-form-label">$$$$$${txt-4004}</label>
... ... @@ -319,9 +306,9 @@
319 306 </div>
320 307 </div>
321 308 <div class="layui-table-fixed-l" >
322   - <div class="layui-table-body" style="height: 500px;overflow:auto;">
  309 +
323 310 <table cellspacing="0" cellpadding="0" border="0" class="layui-table"><tbody id="deviceVideoTbody" style="text-align: center;justify-content: center;"></tbody></table>
324   - </div>
  311 +
325 312 </div>
326 313 </div>
327 314 </div>
... ...
src/main/resources/static/other/video/video.js
1   -var loading = loadingFunction();
  1 +var loading = null;
2 2 var player = null;
3 3 let skeyWebPlayer_myVar = null;
4 4 let option = null;
... ... @@ -7,7 +7,8 @@ let treeSelectNode = null;
7 7 let lay_id= "live_broadcast_lay_id";
8 8 let treeData = null;
9 9 $(document).ready(function () {
10   -
  10 + loading = loadingFunction();
  11 + i18n4dom();
11 12 $("#deviceVideoDate").datetimepicker({
12 13 format: 'YYYY-MM-DD',
13 14 locale: 'zh-cn'
... ... @@ -25,8 +26,6 @@ $(document).ready(function () {
25 26 initTree(rep.data);
26 27 }
27 28  
28   -
29   - // initTable();
30 29 });
31 30  
32 31 });
... ... @@ -38,8 +37,49 @@ function initTree(data) {
38 37 var opt = initTreeOpt(data, tree);
39 38 // 渲染
40 39 var treeObj = tree.render(opt);
  40 + bindClick();
41 41 closeLoading();
42 42 });
  43 +
  44 +}
  45 +
  46 +function bindClick(opt){
  47 +
  48 + $("span",$("#video_tree")).each(function (index,node){
  49 + let $node = $(node);
  50 + if($node.attr("class") ==="layui-tree-iconClick layui-tree-icon"){
  51 + let parent = $node.parent().parent().parent();
  52 + let data_id = parent.attr("data-id");
  53 + $node.attr("onclick","iconClickFun('"+data_id+"')");
  54 + }
  55 + });
  56 +
  57 + treeClickBack();
  58 +
  59 +}
  60 +
  61 +function iconClickFun(data_id){
  62 + let node = findDateById(data_id,treeData);
  63 + let obj = new Object();
  64 + obj.data=node;
  65 + treeClickFun(obj,layui.tree);
  66 +}
  67 +
  68 +function findDateById(id,datas){
  69 + if(datas){
  70 + let length = datas.length;
  71 + for (let i = 0; i < length; i++) {
  72 + if(datas[i].id===id){
  73 + return datas[i];
  74 + }else if(datas[i].children){
  75 + let dataNode = findDateById(id,datas[i].children);
  76 + if(!isEmpty(dataNode)){
  77 + return dataNode;
  78 + }
  79 + }
  80 + }
  81 + }
  82 + return null;
43 83 }
44 84  
45 85 function initTreeOpt(data, tree) {
... ... @@ -51,29 +91,59 @@ function initTreeOpt(data, tree) {
51 91 onlyIconControl: false, // 是否仅允许节点左侧图标控制展开收缩
52 92 showLine: true, // 是否开启连接线
53 93 click: function (node) {
54   - if(node.data.initChild == true){
55   - return;
56   - }
57   - loading = loadingFunction();
  94 + treeSelectNode = node;
  95 + treeClickFun(node,tree);
  96 + }
  97 + };
  98 + return opt;
  99 +}
58 100  
59   - if (node.data.type < 400) {
60   - lasyCarNo(node, tree);
61   - node.initChild = true;
62   - } else {
63   - treeSelectNode = node;
64   - if("live_broadcast_lay_id" === lay_id){
65   - playWvpVideo1(node);
66   - }else{
67   - deviceVidemoQueryHistory();
  101 +function treeClickFun(node,tree){
  102 + if(node.data.initChild == true){
  103 + return;
  104 + }
  105 + loading = loadingFunction();
  106 +
  107 + $("#skeyewebplayerDivContent").html('<div class="skeyewebplayerDivContent_one skeyewebplayerDivContent_play_selected " id="skeyewebplayerDivContent_play_0" onclick="skeyewebplayerDivContent_play_click(this)"><div class="skeyewebplayerDiv_title"></div><div id="skeyewebplayerDiv_play_content_0" class="skeyewebplayerDiv_play_content" style="height: 95%"></div></div>')
  108 + $("#deviceVideoTbody").html("");
  109 + if (node.data.type < 400) {
  110 + lasyCarNo(node, tree);
  111 + node.initChild = true;
  112 + } else {
  113 + treeSelectNode = node;
  114 + if("live_broadcast_lay_id" === lay_id){
  115 + playWvpVideo1(node);
  116 + }
  117 + closeLoading();
  118 + }
  119 +}
  120 +
  121 +function treeClickBack(){
  122 + if(treeSelectNode){
  123 + $("div",$("#video_tree")).each(function (index,node1){
  124 + let $node=$(node1);
  125 + if($node.attr("data-id") && treeSelectNode.data.id && $node.attr("data-id").toString()===treeSelectNode.data.id.toString()){
  126 + $("span",$("#video_tree")).each(function (index,node1){
  127 +
  128 + if($(node1).attr("class")==='layui-tree-txt layui-tree-txt-back'){
  129 + $(node1).attr("class","layui-tree-txt");
  130 + }
  131 +
  132 + });
  133 +
  134 + $nodes = $("span",$node);
  135 + let len = $nodes.length;
  136 + for (let i = 0; i < len; i++) {
  137 + if($($nodes[i]).attr("class") === "layui-tree-txt"){
  138 + $($nodes[i]).attr("class","layui-tree-txt layui-tree-txt-back");
  139 + break;
  140 + }
68 141 }
69   - closeLoading();
70 142 }
71 143  
72   - }, dblClick: function (node) {
73   - // lasyCarNo(node,tree,data);
74   - }
75   - };
76   - return opt;
  144 + });
  145 + }
  146 +
77 147 }
78 148  
79 149 function lasyCarNo(node, tree) {
... ... @@ -88,6 +158,7 @@ function lasyCarNo(node, tree) {
88 158  
89 159 if(data && data.length > 0) {
90 160 tree.reload('video_tree', {data: treeData});
  161 + bindClick(treeData,node);
91 162 }
92 163 closeLoading();
93 164 }
... ... @@ -100,13 +171,13 @@ function lasyCarNo(node, tree) {
100 171 });
101 172  
102 173 if(data && data.data && data.data.length > 0){
103   - console.log(treeData);
104 174 tree.reload('video_tree', {data: treeData});
105 175 }
106   -
  176 + treeClickBack();
107 177 closeLoading();
108 178 });
109 179 } else {
  180 + treeClickBack();
110 181 closeLoading();
111 182 }
112 183  
... ... @@ -126,9 +197,11 @@ function layCarNoConcatArr(d, node, data, result) {
126 197 if (d.id === node.data.id && d.type === node.data.type) {
127 198 d.children = [];
128 199  
129   - layDataParent(d,treeData);
  200 + layDataClose(treeData);
  201 + layDataParent(d,treeData,treeData);
130 202 d.spread = true;
131 203 d.initChild= true;
  204 + console.log(treeData)
132 205 if (result) {
133 206 $.each(data, function (index, d1) {
134 207 d1.wvpLiveBroadcast = result.wvpLiveBroadcast;
... ... @@ -144,61 +217,32 @@ function layCarNoConcatArr(d, node, data, result) {
144 217 }
145 218 }
146 219  
147   -function layDataParent(d,datas){
  220 +function layDataParent(d,datas,treeData){
148 221 if(d && datas){
149 222 $.each(datas,function (index,data){
150   - if(data.id && d.nodePValue === data.id.toString()){
  223 + if(data.id && d.nodePValue && d.nodePValue.toString() === data.id.toString()){
151 224 data.spread = true;
152   - layDataParent(data);
153   - return;
  225 + layDataParent(data,treeData,treeData);
154 226 }else if(data.children){
155   - layDataParent(d,data.children);
  227 + layDataParent(d,data.children,treeData);
156 228 }
157 229 })
158 230  
159 231 }
160 232 }
161 233  
162   -
163   -function initTable(treeNode) {
164   - var queryURL = "/video/tree/table?1=1";
165   - if (treeNode) {
166   - if (treeNode.data.type === 1) {
167   - queryURL = queryURL + "&businessCode_eq=" + treeNode.data.code;
168   - }
169   -
170   - if (treeNode.data.type === 2) {
171   - queryURL = queryURL + "&brancheCompanyCode_eq=" + treeNode.data.code;
172   - }
173   - }
174   - treeURL = queryURL;
175   - option = initTreeTableOption(queryURL);
176   - layui.use(function () {
177   - var treeTable = layui.treeTable;
178   - // 渲染
179   - treeTable.render(option);
180   - treeTable.on('rowDouble(treeTable)', function (obj) {
181   - var targetDataIndex = obj.dataIndex + "-0";
182   - $("div[lay-table-id='treeTable']").find("tr").each(function (index, node) {
183   - var sourceDataIndex = $(node).attr("data-index");
184   - if (sourceDataIndex === targetDataIndex) {
185   - queryChannelByCarNo(node, obj);
186   - return;
187   - }
188   - });
189   - });
190   -
191   - treeTable.on('tool(treeTable)', function (obj) {
192   - switch (obj.event) {
193   - case 'SkeyeWebPlayerEvent':
194   - skeyewebplayerOpen(obj.data.carCode);
195   -
196   - break;
  234 +function layDataClose(datas){
  235 + if(datas){
  236 + $.each(datas,function (index,data){
  237 + data.spread = false;
  238 + if(data.children){
  239 + layDataClose(data.children);
197 240 }
198   - });
199   - });
  241 + })
  242 + }
200 243 }
201 244  
  245 +
202 246 function queryTreeTable() {
203 247 let url = "/video/tree/search?1=1";
204 248  
... ... @@ -223,113 +267,7 @@ function isEmpty(val) {
223 267 return null == val || undefined == val || "" == val;
224 268 }
225 269  
226   -function initTreeTableOption(queryURL) {
227   - var option = {
228   - elem: '#treeTable',
229   - url: queryURL,
230   - loading: true,
231   - treeColIndex: 1,
232   - even: true,
233   - treeSpid: 0,
234   - limit: 5,
235   - limits: [5, 10, 20, 50],
236   - maxHeight: '701px',
237   - cols: [[
238   - {field: 'name', title: '车辆编号', width: 140},
239   - {field: 'insideCode', title: '内部编号', width: 120},
240   - {field: 'equipmentCode', title: '设备编号', width: 160},
241   - {field: 'carPlate', title: i18n('txt-3704'), width: 160},
242   - {field: 'company', title: '所在公司', width: 160},
243   - {field: 'brancheCompany', title: '所在分公司', width: 160},
244   - {
245   - field: 'sfdc', title: i18n('txt-4087'), width: 80, templet: function (obj) {
246   - if (obj.sfdc == 'true' || obj.sfdc == true) {
247   - return i18n('txt-4257')
248   - } else if (obj.sfdc == 'false' || obj.sfdc == false) {
249   - return i18n('txt-4260');
250   - }
251   - return i18n('txt-4058');
252   - }
253   - },
254   - {
255   - field: 'scrapState', title: i18n('txt-3874'), width: 80, templet: function (obj) {
256   - if (obj.scrapState == 'true' || obj.scrapState == true) {
257   - return i18n('txt-4257')
258   - } else if (obj.scrapState == 'false' || obj.scrapState == false) {
259   - return i18n('txt-4260');
260   - }
261   - return i18n('txt-4058');
262   - }
263   - },
264   - {title: i18n('txt-3942'), width: 80, toolbar: '#treeTable-tools'}
265   - ]],
266   - page: true
267   - };
268   - return option;
269   -}
270   -
271   -function queryChannelByCarNo(treeNode, obj) {
272   - loading = loadingFunction();
273   - var url = "/video/car/channel/" + obj.data.name;
274   - $.getJSON(url, function (rep) {
275   - if (rep.status === "SUCCESS") {
276   - var html = "<td data-field=\"name\" colspan='8' data-key=\"1-" + obj.dataIndex + "-0\" class=\"\" >";
277   - html += "<table cellspacing=\"0\" cellpadding=\"0\" border=\"1\" class=\"layui-table\" style='padding-left: 15px;boder:1px solid #000;margin-bottom: 15px;'><thead><tr>";
278   - html += "<th data-field=\"name\" data-key=\"1-" + obj.dataIndex + "-0\" class=\"\" title=\"通道编号\"><div class=\"layui-table-cell \" style='width: 200px;'><span>通道编号</span></div></th>";
279   - html += "<th data-field=\"name\" data-key=\"2-" + obj.dataIndex + "-0\" class=\"\" title=\"设备编号\"><div class=\"layui-table-cell \" style='width: 200px;'><span>设备编号</span></div></th>";
280   - html += "<th data-field=\"name\" data-key=\"3-" + obj.dataIndex + "-0\" class=\"\" title=\"通道名称\"><div class=\"layui-table-cell\" style='width: 100px;'><span>通道名称</span></div></th>";
281   - html += "<th data-field=\"name\" data-key=\"4-" + obj.dataIndex + "-0\" class=\"\" title=\"快照\"><div class=\"layui-table-cell \"><span>快照</span></div></th>";
282   - html += "<th data-field=\"name\" data-key=\"5-" + obj.dataIndex + "-0\" class=\"\" title=\"厂家\"><div class=\"layui-table-cell \" style='width: 100px;'><span>厂家</span></div></th>";
283   - html += "<th data-field=\"name\" data-key=\"6-" + obj.dataIndex + "-0\" class=\"\" title=\"开启音频\"><div class=\"layui-table-cell \"><span>开启音频</span></div></th>";
284   - html += "<th data-field=\"name\" data-key=\"7-" + obj.dataIndex + "-0\" class=\"\" title=\"" + i18n('txt-3874') + "\"><div class=\"layui-table-cell \"><span>" + i18n('txt-3874') + "</span></div></th>";
285   - html += "<th data-field=\"name\" data-key=\"8-" + obj.dataIndex + "-0\" class=\"\" title=\"" + i18n('txt-3874') + "\"><div class=\"layui-table-cell \" style='width: 100px;'><span>" + i18n('txt-3874') + "</span></div></th>";
286   - html += "</tr>";
287   - if (rep.data) {
288   - $.each(rep.data, function (index, node) {
289   - html += "<tr><td>" + node.channelId + "</td><td>" + node.deviceId + "</td><td>" + node.name + "</td><td>" + getBigSnap(rep.channelImageURL, node.deviceId, node.channelId) + "</td><td>" + node.manufacture;
290   - html += "</td><td>" + hasAudioText(node.hasAudio) + "</td><td>" + wvpStatusText(node.status) + "</td><td><button class=\"layui-btn layui-btn-primary layui-border\" onclick=\"playWvpVideo('";
291   - html += rep.wvpLiveBroadcast + "','" + node.deviceId + "','" + node.channelId + "')\">播放</button><button class=\"layui-btn layui-btn-primary layui-border\" onclick=\"deviceVedioPage('" + node.deviceId + "','" + node.channelId + "')\">设备录像</button></td></tr>";
292   - });
293   - }
294   -
295   - html += "</thead></table></td>";
296   -
297   - $(treeNode).html(html);
298   -
299   - closeLoading();
300   - }
301   - })
302   -}
303   -
304   -function hasAudioText(hasAudio) {
305   - return "true" == hasAudio || true == hasAudio ? "开启" : i18n('txt-4015');
306   -}
307   -
308   -function wvpStatusText(status) {
309   - return "true" == status || true == status ? "在线" : i18n('txt-4184');
310   -}
311   -
312   -function getBigSnap(imageURL, deviceId, channelId) {
313   - return "<image src=" + imageURL + deviceId + "/" + channelId + " />"
314   -}
315   -
316   -function playWvpVideo(playURL, deviceId, channelId) {
317   - var idDiv = "video_" + (Date.now());
318   - var html = "'<div id='" + idDiv + "' style='padding-top: 0;'></div>'";
319   - playURL = playURL.replace("{device}", deviceId).replace("{channel}", channelId);
320   -
321   -
322   - var index = layer.open({
323   - type: 2,
324   - title: "视频播放",
325   - area: ['1000px', '650px'],
326   - height: '800px',
327   - content: playURL,
328   - success: function (layero, index, that) {
329   - }
330   - });
331 270  
332   -}
333 271  
334 272 function playWvpVideo1(node) {
335 273 let url = node.data.wvpLiveBroadcast.replace("{device}", node.data.sourceId).replace("{channel}", node.data.id);
... ... @@ -338,28 +276,10 @@ function playWvpVideo1(node) {
338 276 $play.find(".skeyewebplayerDiv_play_content").html("<iframe src='"+url+"' style='width: 100%;height: 95%' frameborder='0' boder='0'/>");
339 277 let title = isEmpty(node.data.text)?isEmpty(node.data.title)?node.data.code+"_"+node.data.sourceId:node.data.title:node.data.text;
340 278 $play.find(".skeyewebplayerDiv_title").html(title);
341   -}
342   -
343   -function playVideo(url, ID, time) {
344   - return new WebMediaPlayer(url, ID, function () {
345   - }, {
346   - autoplay: 1,
347   - currentTime: time
348   - }).play();
  279 + treeClickBack();
349 280 }
350 281  
351 282  
352   -function playVideo1(url, ID) {
353   - let html = "<video id=\"video\" class=\"video-js vjs-default-skin vjs-fluid\" width=\"375\" height=\"200\" controls preload=\"none\" ";
354   - html += " data-setup='{ \"html5\" : { \"nativeTextTracks\" : false } }'><source src=\"" + url + "\" type=\"video/mp4\" /> </video>";
355   - $("#" + ID).html(html);
356   -}
357   -
358   -function playVideo2(url, jqeruyObj, style) {
359   -
360   - let html = " <video id=\"video\" controls=\"\" src=\"" + url + "\" style=\"width:100%; height:100%; object-fit: fill\" autoplay></video>";
361   - jqeruyObj.html(html);
362   -}
363 283  
364 284 function loadingFunction() {
365 285 closeLoading();
... ... @@ -368,51 +288,36 @@ function loadingFunction() {
368 288 title: '加载中..',
369 289 shade: [0.5, '#000']
370 290 });
  291 +
  292 + myVar= setInterval(function(){closeLoading(loading)},10000);
  293 + window.clearTimeout(myVar)
371 294 return loading;
372 295 }
373 296  
374   -function closeLoading() {
  297 +function closeLoading(lo) {
  298 + if(lo){
  299 + loading == lo;
  300 + }
375 301 if (loading) {
376 302 layer.close(loading);
377 303 loading = null;
378 304 }
379 305 }
380 306  
381   -function deviceVedioPage(device, channel) {
382   - var idDiv = "device_video_" + (Date.now());
383   - var html = "<div id='" + idDiv + "'></div>";
384   -
385   - var index = layer.open({
386   - type: 1,
387   - title: "设备录像",
388   - area: ['1300px', '650px'],
389   - content: html,
390   - success: function (layero, index, that) {
391   - $("#" + idDiv).html($("#deviceVideoDiv").html());
392   - var $deviceVideoDiv = $("#" + idDiv);
393   - $("#deviceVideoDate", $deviceVideoDiv).datetimepicker({
394   - format: 'YYYY-MM-DD',
395   - locale: 'zh-cn'
396   - });
397   -
398   - $("#queryDeviecChannel", $deviceVideoDiv).click(function () {
399   - deviceVidemoQueryHistory(device, channel, $deviceVideoDiv, idDiv);
400   - })
401   - }, beforeEnd: function (layero, index, that) {
402   - if (player) {
403   - player = null;
404   - }
405   - }
406   - });
407   -}
408   -
409   -function deviceVidemoQueryHistory(device, channel, $deviceVideoDiv, idDiv) {
  307 +function deviceVidemoQueryHistory(nodeClick,device, channel, $deviceVideoDiv, idDiv) {
410 308 var dateStr = $("#deviceVideoDate", $deviceVideoDiv).val();
411 309 if (null === dateStr || undefined === dateStr || "" === dateStr) {
412 310 layer.alert('请选择需要查看的时间');
413 311 return;
414 312 }
415 313  
  314 + if(isEmpty(treeSelectNode) || treeSelectNode.data.type < 400){
  315 + layer.alert('请选择视频通道');
  316 + return;
  317 + }
  318 +
  319 + console.log(treeSelectNode);
  320 +
416 321  
417 322 if(treeSelectNode){
418 323 loading = loadingFunction();
... ... @@ -436,12 +341,15 @@ function deviceVidemoQueryHistory(device, channel, $deviceVideoDiv, idDiv) {
436 341 });
437 342  
438 343 $("#deviceVideoTbody", $deviceVideoDiv).html(html);
  344 + treeClickBack();
439 345 closeLoading();
440 346 } else {
  347 + treeClickBack();
441 348 closeLoading();
442 349 }
443 350 });
444 351 }else{
  352 + treeClickBack();
445 353 layer.alert('请选择需要查看的通道');
446 354 }
447 355  
... ... @@ -468,35 +376,6 @@ function playDeviceVidemoQueryHistory(title, url, device, channel, startTime, en
468 376  
469 377 }
470 378  
471   -function skeyewebplayerOpen(carNo) {
472   - loading = loadingFunction();
473   -
474   - layer.open({
475   - type: 1,
476   - content: '<div id="skeyewebplayer"></div>',
477   - title: "分页显示",
478   - area: ['320px', '195px'], // 初始宽高
479   - success: function (layero, index) {
480   - layer.full(index); // 最大化
481   - let $skeyewebplayer = $("#skeyewebplayer");
482   - $("#skeyewebplayer").html($("#skeyewebplayerDiv").html());
483   - let width = $(window).width();
484   - let height = $(window).height();
485   - height = height - height * 0.0605;
486   - let channelHeight = height - height * 0.03;
487   - $("#skeyewebplayerDivChannel", $skeyewebplayer).attr("style", "height:" + channelHeight + "px;");
488   - $("#skeyewebplayerDiv_main", $skeyewebplayer).attr("style", "width:" + width + "px;height:" + height + "px");
489   - skeyWebPlayer(1, "skeyewebplayer");
490   - skeywebPlayerChannel($skeyewebplayer, carNo);
491   - },
492   - beforeEnd: function (layero, index, that) {
493   - if (skeyWebPlayer_myVar) {
494   - window.clearInterval(skeyWebPlayer_myVar);
495   - }
496   - $("#skeyewebplayer").html("");
497   - }
498   - });
499   -}
500 379  
501 380 function skeywebPlayerChannel($skeyewebplayer, carNo) {
502 381 var url = "/video/car/channel/" + carNo;
... ... @@ -567,14 +446,9 @@ function skeyewebplayerNine() {
567 446 function skeyWebPlayer(len, parentId) {
568 447 var $skeyewebplayerDivContent = $("#skeyewebplayerDivContent", $("#" + parentId));
569 448 var classCss = "skeyewebplayerDivContent_one skeyewebplayerDivContent_play_selected ";
570   - let width = $(window).width();
571   - width = width - width * 0.25;
572   - $skeyewebplayerDivContent.attr("style", "width:" + width + "px;height:90%;");
573   - skeyWebPlayer_myVar = setInterval(function () {
574   - width = $(window).width();
575   - width = width - width * 0.25;
576   - $skeyewebplayerDivContent.attr("style", "width:" + width + "px;height:98%;");
577   - }, 1000);
  449 +
  450 + $skeyewebplayerDivContent.attr("style", "width:99.999%;height:99.9%;");
  451 +
578 452  
579 453 if (len === 4) {
580 454 classCss = "skeyewebplayerDivContent_Four";
... ...
src/main/resources/static/other/video/zTreeStyle.css 0 → 100644
  1 +/*-------------------------------------
  2 +zTree Style
  3 +
  4 +version: 3.5.19
  5 +author: Hunter.z
  6 +email: hunter.z@263.net
  7 +website: http://code.google.com/p/jquerytree/
  8 +
  9 +-------------------------------------*/
  10 +
  11 +.ztree * {padding:0; margin:0; font-size:12px; font-family: Verdana, Arial, Helvetica, AppleGothic, sans-serif}
  12 +.ztree {margin:0; padding:5px; color:#333}
  13 +.ztree li{padding:0; margin:0; list-style:none; line-height:14px; text-align:left; white-space:nowrap; outline:0}
  14 +.ztree li ul{ margin:0; padding:0 0 0 18px}
  15 +.ztree li ul.line{ background:url(./img/line_conn.gif) 0 0 repeat-y;}
  16 +
  17 +.ztree li a {padding:1px 3px 0 0; margin:0; cursor:pointer; height:17px; color:#333; background-color: transparent;
  18 + text-decoration:none; vertical-align:top; display: inline-block}
  19 +.ztree li a:hover {text-decoration:underline}
  20 +.ztree li a.curSelectedNode {padding-top:0px; background-color:#FFE6B0; color:black; height:16px; border:1px #FFB951 solid; opacity:0.8;}
  21 +.ztree li a.curSelectedNode_Edit {padding-top:0px; background-color:#FFE6B0; color:black; height:16px; border:1px #FFB951 solid; opacity:0.8;}
  22 +.ztree li a.tmpTargetNode_inner {padding-top:0px; background-color:#316AC5; color:white; height:16px; border:1px #316AC5 solid;
  23 + opacity:0.8; filter:alpha(opacity=80)}
  24 +.ztree li a.tmpTargetNode_prev {}
  25 +.ztree li a.tmpTargetNode_next {}
  26 +.ztree li a input.rename {height:14px; width:80px; padding:0; margin:0;
  27 + font-size:12px; border:1px #7EC4CC solid; *border:0px}
  28 +.ztree li span {line-height:16px; margin-right:2px}
  29 +.ztree li span.button {line-height:0; margin:0; width:16px; height:16px; display: inline-block; vertical-align:middle;
  30 + border:0 none; cursor: pointer;outline:none;
  31 + background-color:transparent; background-repeat:no-repeat; background-attachment: scroll;
  32 + background-image:url("./img/zTreeStandard.png"); *background-image:url("./img/zTreeStandard.gif")}
  33 +
  34 +.ztree li span.button.chk {width:13px; height:13px; margin:0 3px 0 0; cursor: auto}
  35 +.ztree li span.button.chk.checkbox_false_full {background-position:0 0}
  36 +.ztree li span.button.chk.checkbox_false_full_focus {background-position:0 -14px}
  37 +.ztree li span.button.chk.checkbox_false_part {background-position:0 -28px}
  38 +.ztree li span.button.chk.checkbox_false_part_focus {background-position:0 -42px}
  39 +.ztree li span.button.chk.checkbox_false_disable {background-position:0 -56px}
  40 +.ztree li span.button.chk.checkbox_true_full {background-position:-14px 0}
  41 +.ztree li span.button.chk.checkbox_true_full_focus {background-position:-14px -14px}
  42 +.ztree li span.button.chk.checkbox_true_part {background-position:-14px -28px}
  43 +.ztree li span.button.chk.checkbox_true_part_focus {background-position:-14px -42px}
  44 +.ztree li span.button.chk.checkbox_true_disable {background-position:-14px -56px}
  45 +.ztree li span.button.chk.radio_false_full {background-position:-28px 0}
  46 +.ztree li span.button.chk.radio_false_full_focus {background-position:-28px -14px}
  47 +.ztree li span.button.chk.radio_false_part {background-position:-28px -28px}
  48 +.ztree li span.button.chk.radio_false_part_focus {background-position:-28px -42px}
  49 +.ztree li span.button.chk.radio_false_disable {background-position:-28px -56px}
  50 +.ztree li span.button.chk.radio_true_full {background-position:-42px 0}
  51 +.ztree li span.button.chk.radio_true_full_focus {background-position:-42px -14px}
  52 +.ztree li span.button.chk.radio_true_part {background-position:-42px -28px}
  53 +.ztree li span.button.chk.radio_true_part_focus {background-position:-42px -42px}
  54 +.ztree li span.button.chk.radio_true_disable {background-position:-42px -56px}
  55 +
  56 +.ztree li span.button.switch {width:18px; height:18px}
  57 +.ztree li span.button.root_open{background-position:-92px -54px}
  58 +.ztree li span.button.root_close{background-position:-74px -54px}
  59 +.ztree li span.button.roots_open{background-position:-92px 0}
  60 +.ztree li span.button.roots_close{background-position:-74px 0}
  61 +.ztree li span.button.center_open{background-position:-92px -18px}
  62 +.ztree li span.button.center_close{background-position:-74px -18px}
  63 +.ztree li span.button.bottom_open{background-position:-92px -36px}
  64 +.ztree li span.button.bottom_close{background-position:-74px -36px}
  65 +.ztree li span.button.noline_open{background-position:-92px -72px}
  66 +.ztree li span.button.noline_close{background-position:-74px -72px}
  67 +.ztree li span.button.root_docu{ background:none;}
  68 +.ztree li span.button.roots_docu{background-position:-56px 0}
  69 +.ztree li span.button.center_docu{background-position:-56px -18px}
  70 +.ztree li span.button.bottom_docu{background-position:-56px -36px}
  71 +.ztree li span.button.noline_docu{ background:none;}
  72 +
  73 +.ztree li span.button.ico_open{margin-right:2px; background-position:-110px -16px; vertical-align:top; *vertical-align:middle}
  74 +.ztree li span.button.ico_close{margin-right:2px; background-position:-110px 0; vertical-align:top; *vertical-align:middle}
  75 +.ztree li span.button.ico_docu{margin-right:2px; background-position:-110px -32px; vertical-align:top; *vertical-align:middle}
  76 +.ztree li span.button.edit {margin-right:2px; background-position:-110px -48px; vertical-align:top; *vertical-align:middle}
  77 +.ztree li span.button.remove {margin-right:2px; background-position:-110px -64px; vertical-align:top; *vertical-align:middle}
  78 +
  79 +.ztree li span.button.ico_loading{margin-right:2px; background:url(./img/loading.gif) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}
  80 +
  81 +ul.tmpTargetzTree {background-color:#FFE6B0; opacity:0.8; filter:alpha(opacity=80)}
  82 +
  83 +span.tmpzTreeMove_arrow {width:16px; height:16px; display: inline-block; padding:0; margin:2px 0 0 1px; border:0 none; position:absolute;
  84 + background-color:transparent; background-repeat:no-repeat; background-attachment: scroll;
  85 + background-position:-110px -80px; background-image:url("./img/zTreeStandard.png"); *background-image:url("./img/zTreeStandard.gif")}
  86 +
  87 +ul.ztree.zTreeDragUL {margin:0; padding:0; position:absolute; width:auto; height:auto;overflow:hidden; background-color:#cfcfcf; border:1px #00B83F dotted; opacity:0.8; filter:alpha(opacity=80)}
  88 +.zTreeMask {z-index:10000; background-color:#cfcfcf; opacity:0.0; filter:alpha(opacity=0); position:absolute}
  89 +
  90 +/* level style*/
  91 +/*.ztree li span.button.level0 {
  92 + display:none;
  93 +}
  94 +.ztree li ul.level0 {
  95 + padding:0;
  96 + background:none;
  97 +}*/
0 98 \ No newline at end of file
... ...