Edit D:\xinhaisoft\crisis_new\Scripts\jquery.treeselect.js
/* * ????????? * ?????(QQ33080907) * ????????2021.02.15 * ?????????????????????????????????? */ (function ($) { $.fn.treeselect = function (options) { var defaults = { server: '', cache: true, notop: false } var opts = $.extend(defaults, options) var $this = $(this) var amui = typeof AMUI === 'object' if ($this.length === 0) { return } else if ($this.length > 1) { alert('jquery.treeselect.js: the DOM\'s length > 1') } else if ($this.prop('tagName').toLowerCase() !== 'input') { alert('jquery.treeselect.js: only bind to input') } else if (!opts.url) { alert('jquery.treeselect.js: missing options (url)') } else { var deferreds = [] if (typeof ($.fn.zTree) !== 'function') { deferreds.push($.ajax('/Scripts/ztree/js/jquery.ztree.core.min.js', { dataType: 'script', cache: true })) } if (opts.server === '' && typeof Global === 'undefined') { deferreds.push($.ajax('/Scripts/global.js', { dataType: 'script', cache: true })) } $.when.apply(null, deferreds).done(function () { var key = 'treeselect-' + opts.url.substring(1).replace(/\/|\?|=|&/g, '-') var list = JSON.parse(localStorage.getItem(key)) if (opts.cache && list && list.length) { dealDom() makeselect(list) } else { $.getJSON((opts.server || Global.Host) + opts.url, { c: 'ztree' }, function (json) { if (json.code !== 0) { alert(json.message) } else { list = json.data dealDom() makeselect(list) localStorage.setItem(key, JSON.stringify(list)) } }) } }) } return this // ???CSS??OM function dealDom() { // ???ztree???????SS var style = '.ztree * {' + 'font-size: 14px;' + '}' + '.ztree {' + 'display: none;' + 'position: absolute;' + 'border: 1px solid #aaa;' + 'border-radius: 5px;' + 'background: #fff;' + 'box-shadow:0 1px 3px #ccc;' + 'z-index:3;' + 'overflow-y:auto;' + '}' + '.ztree li span.button.switch.level0 {' + 'visibility: hidden;' + 'width: 1px;' + '}' + '.ztree li ul.level0 {' + 'padding: 0;' + 'background: none;' + '}' + '.treeselect {' + 'position:relative;' + 'display:inline-block;' + 'vertical-align:middle;' + '}' if (!amui) { style += '.treeselect-tree-path-str {' + 'border: 1px solid #aaa;' + 'border-radius: 5px;' + 'background: linear-gradient(#fff 20%, #f6f6f6 50%, #eee 52%, #f4f4f4 100%);' + 'height: 23px;' + 'color: #333;' + 'font-size: 14px;' + 'cursor: pointer;' + 'line-height:23px;' + 'padding: 0 6px;' + 'vertical-align:middle;' + '}' + '.treeselect-tree-path-str i {' + 'font-style: normal;' + 'color: #999;' + 'margin-left: 5px;' + 'font-size: 18px;' + '}' } $('head') .append('<link rel="stylesheet" href="/Scripts/ztree/css/zTreeStyle/zTreeStyle.min.css">') .append('<style>' + style + '</style>') $this .hide() .prop('readonly', true) .wrap('<div class="treeselect"></div>') // ??????ID????????????undefined .after('<ul id="treeselect-' + Math.random().toString().slice(-4) + '" class="ztree"></ul>') if (amui) { $this.after('<div class="treeselect-tree-path-str am-btn am-btn-default am-radius am-btn-sm"><span>???????</span> <i class="am-icon-caret-down"></i></div>') } else { $this.after('<div class="treeselect-tree-path-str"><span>???????</span><i>??</i></div>') } $this.next('div.treeselect-tree-path-str').on('click', function () { var btn = $(this) var tree = $this.siblings('ul.ztree') if (tree.is(':hidden')) { var winHeight = $(window).height() var position = btn.position() position.top += btn.outerHeight() + 1 tree.css(position).css('max-height', winHeight - tree.offset().top - 110).slideDown() amui ? btn.children('i').attr('class', 'am-icon-caret-up') : btn.children('i').text('??') $(document).on('mousedown', function (e) { // ??????????????????????????UG?? if (!($(e.target).is('ul.ztree') || $(e.target).parents('ul.ztree').length > 0)) { tree.fadeOut('fast') amui ? btn.children('i').attr('class', 'am-icon-caret-down') : btn.children('i').text('??') $(document).off('mousedown') } }) } else { tree.fadeOut('fast') amui ? btn.children('i').attr('class', 'am-icon-caret-down') : btn.children('i').text('??') $(document).off('mousedown') } }) } // ????????? function makeselect(list) { var btn = $this.next('div.treeselect-tree-path-str') var ul = $this.siblings('ul.ztree') var parent = list.find(item => item.pId === 0) if ($this.val() === '') { $this.val(parent.id) } btn.children('span').text(parent.name) // ????? var tree = $.fn.zTree.init(ul, { data: { simpleData: { enable: true } }, callback: { onClick: function (event, treeId, treeNode) { $this.val(treeNode.id) setPathStr(tree) ul.fadeOut('fast') amui ? btn.children('i').attr('class', 'am-icon-caret-down') : btn.children('i').text('??') $(document).off('mousedown') } } }, list) // ????? tree.selectNode(tree.getNodeByParam('id', $this.val())) setPathStr(tree) } // ??????????? function setPathStr(tree) { var btn = $this.next('div.treeselect-tree-path-str') var node = tree.getSelectedNodes() if (node.length) { var path = node[0].getPath() var pathStr = '' if (path.length === 1) { pathStr = path[0].name } else { for (let i = 1; i < path.length; i++) { pathStr += (i === 1 ? '' : '<span style="margin:0 5px;">/</span>') + path[i].name } } btn.children('span').html(pathStr) } } } })(jQuery)
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de