diff --git a/app/customer/view/index/view.html b/app/customer/view/index/view.html index dad41f8..c10d701 100644 --- a/app/customer/view/index/view.html +++ b/app/customer/view/index/view.html @@ -166,7 +166,6 @@ const moduleInit = ['tool','employeepicker']; trace(); element.on('tab(customer)', function(data){ let index = data.index; - console.log(index); if(index == 1){ contact(); } diff --git a/app/user/view/user/view.html b/app/user/view/user/view.html index 4de12cc..489badd 100644 --- a/app/user/view/user/view.html +++ b/app/user/view/user/view.html @@ -95,7 +95,7 @@ {volist name="role_rule" id="vo"} - {notempty name="vo.children"} diff --git a/public/static/assets/gougu/css/layout.css b/public/static/assets/gougu/css/layout.css index 68e48c9..a2e3fbd 100644 --- a/public/static/assets/gougu/css/layout.css +++ b/public/static/assets/gougu/css/layout.css @@ -127,19 +127,19 @@ .gg-tabs-select.layui-nav .layui-nav-child dd.layui-this a {background-color: #f2f2f2 !important;color: #333} .gg-layout .layui-logo .logo{display: none} -.side-spread .gg-layout .layui-logo {width: 50px;} +.side-spread .gg-layout .layui-logo {width: 53px;} .side-spread .gg-layout .layui-logo .syslogo{display: none} .side-spread .gg-layout .layui-logo .logo{display: inline-block} -.side-spread .layui-side {left: 0;width: 50px} +.side-spread .layui-side {left: 0;width: 53px} .side-spread .page-tabs, .side-spread .gg-layout .layui-body, .side-spread .gg-layout .layui-footer, -.side-spread .gg-layout .layui-layout-left {left: 50px} +.side-spread .gg-layout .layui-layout-left {left: 53px} -.side-spread .layui-side-menu .layui-nav {position: static; width: 50px} +.side-spread .layui-side-menu .layui-nav {position: static; width: 53px} .side-spread .layui-side-menu .layui-nav-item {position: static} -.side-spread .layui-side-menu .layui-nav-item>a {padding-right: 0;padding-left:52px;} +.side-spread .layui-side-menu .layui-nav-item>a {padding-right: 0;padding-left:55px;} .side-spread .layui-side-menu .layui-nav-item cite, .side-spread .layui-side-menu .layui-nav>.layui-nav-item>.layui-nav-child, diff --git a/public/static/assets/gougu/module/menu.js b/public/static/assets/gougu/module/menu.js deleted file mode 100644 index c81d897..0000000 --- a/public/static/assets/gougu/module/menu.js +++ /dev/null @@ -1,516 +0,0 @@ -layui.define(['table', 'jquery', 'element'], function (exports) { - "use strict"; - - var MOD_NAME = 'menu', - $ = layui.jquery, - element = layui.element; - - var pearMenu = function (opt) { - this.option = opt; - }; - - pearMenu.prototype.render = function (opt) { - - var option = { - elem: opt.elem, - async: opt.async, - parseData: opt.parseData, - url: opt.url, - method: opt.method ? opt.method : "GET", - defaultOpen: opt.defaultOpen, - defaultSelect: opt.defaultSelect, - control: opt.control, - controlWidth: opt.controlWidth ? opt.controlWidth : 500, - defaultMenu: opt.defaultMenu, - accordion: opt.accordion, - height: opt.height, - theme: opt.theme, - data: opt.data ? opt.data : [], - change: opt.change ? opt.change : function () { }, - done: opt.done ? opt.done : function () { } - } - if (option.async) { - if (option.method === "GET") { - getData(option.url).then(function (data) { - option.data = data; - renderMenu(option); - }); - } else { - postData(option.url).then(function (data) { - option.data = data; - renderMenu(option); - }); - } - } else { - //renderMenu中需要调用done事件,done事件中需要menu对象,但是此时还未返回menu对象,做个延时提前返回对象 - window.setTimeout(function () { renderMenu(option); }, 500); - } - - // 处理高度 - $("#" + opt.elem).height(option.height) - - setTimeout(function () { - $("#" + opt.control + " .control").on("mousewheel DOMMouseScroll", function (event) { - - var delta = (event.originalEvent.wheelDelta && (event.originalEvent.wheelDelta > 0 ? 1 : -1)) || // chrome & ie - (event.originalEvent.detail && (event.originalEvent.detail > 0 ? -1 : 1)); // firefox - - if (delta > 0) { - for (var num = 1; num < 20; num++) { - setTimeout(function () { - if ($("#" + opt.control + " .control ul").css('left').replace("px", "") < 0) { - $("#" + opt.control + " .control ul").css("left", "+=2px"); - } - }, 10) - } - } else if (delta < 0) { - if (((Number)($("#" + opt.control + " .control ul").css("left").replace("px", "")) + ($("#" + opt.control + " .control ul").width() - $("#" + opt.control + " .control").width())) > 0) { - for (var num = 1; num < 20; num++) { - setTimeout(function () { - $("#" + opt.control + " .control ul").css("left", "-=2px"); - }, 10) - } - } - } - }); - }, 1000) - - return new pearMenu(opt); - } - - pearMenu.prototype.click = function (clickEvent) { - var _this = this; - $("body").on("click", "#" + _this.option.elem + " .site-demo-active", function () { - var dom = $(this); - var data = { - menuId: dom.attr("menu-id"), - menuTitle: dom.attr("menu-title"), - menuPath: dom.attr("menu-title"), - menuIcon: dom.attr("menu-icon"), - menuUrl: dom.attr("menu-url"), - openType: dom.attr("open-type") - }; - var doms = hash(dom); - if (doms != null) { - if (doms.text() != '') { - data['menuPath'] = doms.find("span").text() + " / " + data['menuPath']; - } - } - if (doms != null) { - var domss = hash(doms); - if (domss != null) { - if (domss.text() != '') { - data['menuPath'] = domss.find("span").text() + " / " + data['menuPath']; - } - } - } - if (domss != null) { - var domsss = hash(domss); - if (domsss != null) { - if (domsss.text() != '') { - data['menuPath'] = domsss.find("span").text() + " / " + data['menuPath']; - } - } - } - if ($("#" + _this.option.elem).is(".pear-nav-mini")) { - if (_this.option.accordion) { - activeMenus = $(this).parent().parent().parent().children("a"); - } else { - activeMenus.push($(this).parent().parent().parent().children("a")); - } - } - clickEvent(dom, data); - }) - } - - function hash(dom) { - var d = dom.parent().parent().prev(); - if (d.prop("tagName") === "UL") { - return null; - } - return d; - } - - pearMenu.prototype.skin = function (skin) { - var menu = $(".pear-nav-tree[lay-filter='" + this.option.elem + "']").parent(); - menu.removeClass("dark-theme"); - menu.removeClass("light-theme"); - menu.addClass(skin); - } - - pearMenu.prototype.selectItem = function (pearId) { - if (this.option.control != false) { - $("#" + this.option.elem + " a[menu-id='" + pearId + "']").parents(".layui-side-scroll ").find("ul").css({ - display: "none" - }); - $("#" + this.option.elem + " a[menu-id='" + pearId + "']").parents(".layui-side-scroll ").find(".layui-this").removeClass( - "layui-this"); - $("#" + this.option.elem + " a[menu-id='" + pearId + "']").parents("ul").css({ - display: "block" - }); - var controlId = $("#" + this.option.elem + " a[menu-id='" + pearId + "']").parents("ul").attr("pear-id"); - if (controlId != undefined) { - $("#" + this.option.control).find(".layui-this").removeClass("layui-this"); - $("#" + this.option.control).find("[pear-id='" + controlId + "']").addClass("layui-this"); - } - } - - $("#" + this.option.elem + " a[menu-id='" + pearId + "']").parents(".pear-nav-tree").find(".layui-this").removeClass( - "layui-this"); - if (!$("#" + this.option.elem).is(".pear-nav-mini")) { - let openEle = null; - let openEleHeight = 0; - $($("#" + this.option.elem + " a[menu-id='" + pearId + "']").parents('.layui-nav-child').get().reverse()).each(function () { - if (!$(this).parent().is('.layui-nav-itemed')) { - if(openEleHeight == 0){ - openEle = $(this); - } else { - $(this).parent().addClass('layui-nav-itemed'); - $(this).css({ - height:'auto', - }); - } - openEleHeight += $(this).children("dd").length * 48; - } - }); - if (this.option.accordion) { - if(openEleHeight > 0){ - var currentDom = openEle.parent().siblings('.layui-nav-itemed').children(".layui-nav-child"); - currentDom.animate({ - height: "0px" - }, 240, function () { - currentDom.css({ - height: "auto" - }); - $(this).parent().removeClass("layui-nav-itemed"); - $(this).find('.layui-nav-itemed').removeClass("layui-nav-itemed"); - }); - } - } - if(openEleHeight > 0){ - openEle.parent().addClass("layui-nav-itemed"); - openEle.height(0); - openEle.animate({ - height: openEleHeight + "px" - }, 240, function () { - $(this).css({height:'auto'}); - }); - } - } - $("#" + this.option.elem + " a[menu-id='" + pearId + "']").parent().addClass("layui-this"); - } - - var activeMenus; - pearMenu.prototype.collaspe = function (time) { - var elem = this.option.elem; - var config = this.option; - if ($("#" + this.option.elem).is(".pear-nav-mini")) { - $.each(activeMenus, function (i, item) { - $("#" + elem + " a[menu-id='" + $(this).attr("menu-id") + "']").parent().addClass("layui-nav-itemed"); - }) - $("#" + this.option.elem).removeClass("pear-nav-mini"); - $("#" + this.option.elem).animate({ - width: "220px" - }, 150); - isHoverMenu(false, config); - } else { - activeMenus = $("#" + this.option.elem).find(".layui-nav-itemed>a"); - $("#" + this.option.elem).find(".layui-nav-itemed").removeClass("layui-nav-itemed"); - $("#" + this.option.elem).addClass("pear-nav-mini"); - $("#" + this.option.elem).animate({ - width: "60px" - }, 400); - isHoverMenu(true, config); - } - } - - function getData(url) { - var defer = $.Deferred(); - $.get(url + "?fresh=" + Math.random(), function (result) { - defer.resolve(result) - }); - return defer.promise(); - } - - function postData(url) { - var defer = $.Deferred(); - $.post(url + "?fresh=" + Math.random(), function (result) { - defer.resolve(result) - }, "json"); - return defer.promise(); - } - - function renderMenu(option) { - if (option.parseData != false) { - option.parseData(option.data); - } - if (option.data.length > 0) { - if (option.control != false) { - createMenuAndControl(option); - } else { - createMenu(option); - } - } - element.init(); - downShow(option); - option.done(); - } - - function createMenu(option) { - var menuHtml = '
"; - // 将 菜 单 拼 接 到 初 始 化 容 器 中 - $("#" + option.elem).html(menuHtml); - } - - function createMenuAndControl(option) { - var control = '
"); - $("#" + option.control).append(controlPe); - $("#" + option.elem).html(menu); - $("#" + option.control + " .pear-nav-control").on("click", "[pear-id]", function () { - $("#" + option.elem).find(".pear-nav-tree").css({ - display: 'none' - }); - $("#" + option.elem).find(".pear-nav-tree[pear-id='" + $(this).attr("pear-id") + "']").css({ - display: 'block' - }); - $("#" + option.control).find(".pe-title").html($(this).attr("pear-title")); - $("#" + option.control).find("") - option.change($(this).attr("pear-id"), $(this).attr("pear-title"), $(this).attr("pear-href")) - }) - } - - /** 加载子菜单 (递归)*/ - function loadchild(obj) { - // 判 单 是 否 是 菜 单, 如 果 是 菜 单 直 接 返 回 - if (obj.type == 1) { - return ""; - } - // 创 建 子 菜 单 结 构 - var content = '
'; - // 如 果 嵌 套 不 等 于 空 - if (obj.children != null && obj.children.length > 0) { - // 遍 历 子 项 目 - $.each(obj.children, function (i, note) { - // 创 建 子 项 结 构 - content += '
'; - var href = "javascript:;"; - var target = ""; - var className = "site-demo-active"; - if (note.openType == "_blank" && note.type == 1) { - href = note.href; - target = "target='_blank'"; - className = ""; - } - // 判 断 子 项 类 型 - if (note.type == 0) { - // 创 建 目 录 结 构 - content += '' + note.title + ''; - } else if (note.type == 1) { - // 创 建 菜 单 结 构 - content += '' + note.title + ''; - } - // 加 载 子 项 目 录 - content += loadchild(note); - // 结 束 当 前 子 菜 单 - content += '
'; - }); - // 封 装 - } else { - content += '
目录为空
'; - } - content += '
'; - return content; - } - - function downShow(option) { - $("body #" + option.elem).on("click", "a[menu-type='0']", function () { - if (!$("#" + option.elem).is(".pear-nav-mini")) { - var superEle = $(this).parent(); - var ele = $(this).next('.layui-nav-child'); - var heights = ele.children("dd").length * 48; - - if ($(this).parent().is(".layui-nav-itemed")) { - if (option.accordion) { - var currentDom = $(this).parent().siblings('.layui-nav-itemed').children('.layui-nav-child'); - currentDom.animate({ - height: '0px' - }, 240, function(){ - currentDom.css({ - height: "auto", - }); - $(this).parent().removeClass("layui-nav-itemed"); - $(this).find('.layui-nav-itemed').removeClass("layui-nav-itemed"); - }); - } - ele.height(0); - ele.animate({ - height: heights + "px" - }, 240, function () { - ele.css({ - height: "auto" - }); - }); - } else { - $(this).parent().addClass("layui-nav-itemed"); - ele.animate({ - height: "0px" - }, 240, function () { - ele.css({ - height: "auto" - }); - $(this).parent().removeClass("layui-nav-itemed"); - }); - } - } - }) - } - - /** 二 级 悬 浮 菜 单*/ - function isHoverMenu(b, option) { - if (b) { - $("#" + option.elem + ".pear-nav-mini .layui-nav-item,#" + option.elem + ".pear-nav-mini dd").hover(function (e) { - e.stopPropagation(); - var _this = $(this); - _this.siblings().find(".layui-nav-child") - .removeClass("layui-nav-hover").css({ - left: 0, - top: 0 - }); - _this.children(".layui-nav-child").addClass("layui-nav-hover"); - _this.closest('.layui-nav-item').data('time') && clearTimeout(_this.closest('.layui-nav-item').data('time')); - var height = $(window).height(); - var topLength = _this.offset().top; - var thisHeight = _this.children(".layui-nav-child").height(); - if ((thisHeight + topLength) > height) { - topLength = height - thisHeight - 10; - } - var left = _this.offset().left + 60; - if (!_this.hasClass("layui-nav-item")) { - left = _this.offset().left + _this.width(); - } - _this.children(".layui-nav-child").offset({ - top: topLength, - left: left + 3 - }); - }, function (e) { - e.stopPropagation(); - var _this = $(this); - _this.closest('.layui-nav-item').data('time', setTimeout(function () { - _this.closest('.layui-nav-item') - .find(".layui-nav-child") - .removeClass("layui-nav-hover") - .css({ - left: 0, - top: 0 - }); - }, 50)); - }) - } else { - $("#" + option.elem + " .layui-nav-item").off('mouseenter').unbind('mouseleave'); - $("#" + option.elem + " dd").off('mouseenter').unbind('mouseleave'); - } - } - exports(MOD_NAME, new pearMenu()); -}) diff --git a/public/static/assets/gougu/module/tool.js b/public/static/assets/gougu/module/tool.js index 4eba8b1..51d1b01 100644 --- a/public/static/assets/gougu/module/tool.js +++ b/public/static/assets/gougu/module/tool.js @@ -30,8 +30,6 @@ layui.define([], function (exports) { let op_width = obj.outerWidth(); obj.animate({ left: '+=' + op_width + 'px' }, 200, 'linear', function () { $('body').removeClass('right-open'); - //$('.layui-anim-rl').remove(); - //$('.layui-layer-shade').remove(); layer.close(index); if (layui.pageTable) { layui.pageTable.resize(); @@ -52,8 +50,9 @@ layui.define([], function (exports) { return false; } that.loading = true; - if (width == 0) { - width = window.innerWidth > 1280 ? '1200px' : '996px'; + var sideWidth = window.innerWidth > 1280 ? '1200px' : '996px'; + if (width && width > 0) { + sideWidth = width + 'px'; } $.ajax({ url: url, @@ -64,26 +63,35 @@ layui.define([], function (exports) { layer.msg(res.msg); return false; } - var express = '
' + res + '
关闭
'; + var express = '
' + res + '
关闭
'; $('body').append(express).addClass('right-open'); $('#expressMask').fadeIn(200); $('#expressLayer').animate({ 'right': 0 }, 200, 'linear', function () { - openInit(); - }); - - $('#expressClose').click(function () { + if (typeof (openInit) == "function") { + openInit(); + } + }); + that.loading = false; + + //关闭 + $('body').on('click','.express-close', function () { $('#expressMask').fadeOut(100); $('body').removeClass('right-open'); - $('#expressLayer').animate({ 'right': '-100%' }, 100, 'linear', function () { + let op_width = $('#expressLayer').outerWidth(); + $('#expressLayer').animate({ left: '+=' + op_width + 'px' }, 200, 'linear', function () { $('#expressLayer').remove(); $('#expressMask').remove(); + if (layui.pageTable) { + layui.pageTable.resize(); + } }) }) $(window).resize(function () { width = window.innerWidth > 1280 ? '1200' : '996'; $('#expressLayer').width(width); - }) + }) + } , error: function (xhr, textstatus, thrown) { console.log('错误'); @@ -270,6 +278,13 @@ layui.define([], function (exports) { } return false; }); + $('body').on('click', '.open-a', function () { + let url = $(this).data('href'); + if (url && url !== '') { + tool.open(url); + } + return false; + }); $('body').on('click', '.link-a', function () { let url = $(this).data('href'); if (url && url !== '') {
+