From 78ed99b949cc65b0a03abc75563033736a8bbe1d Mon Sep 17 00:00:00 2001 From: wangziyangyang <707231019@qq.com> Date: Thu, 2 Apr 2020 14:59:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Etab=E5=8D=A1=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/js/layuimodule/sp/spLayui.js | 30 +++ .../templates/technology/bom/addOrUpdate.ftl | 195 +++++++++++++----- .../templates/technology/bom/list.ftl | 10 +- 3 files changed, 180 insertions(+), 55 deletions(-) diff --git a/mes/src/main/resources/static/js/layuimodule/sp/spLayui.js b/mes/src/main/resources/static/js/layuimodule/sp/spLayui.js index 4c6e1a7..6ac851d 100644 --- a/mes/src/main/resources/static/js/layuimodule/sp/spLayui.js +++ b/mes/src/main/resources/static/js/layuimodule/sp/spLayui.js @@ -416,6 +416,7 @@ layui.define(["element", "jquery"], function (exports) { * @param tabId **/ this.checkTab = function (tabId, isIframe) { + console.log('this'+tabId); // 判断选项卡上是否有 var checkTab = false; if (isIframe == undefined || isIframe == false) { @@ -428,6 +429,7 @@ layui.define(["element", "jquery"], function (exports) { } else { parent.layui.$(".layui-tab-title li").each(function () { checkTabId = $(this).attr('lay-id'); + console.log('search'+checkTabId); if (checkTabId != null && checkTabId == tabId) { checkTab = true; } @@ -656,6 +658,31 @@ layui.define(["element", "jquery"], function (exports) { } }).resize(); }; + /** + * 手动新增一个选项卡 + * @author wangziyang + * @param url + */ + this.createTableItem = function (tabId, title, icon) { + title = ' ' + title + ''; + // 判断该窗口是否已经打开过 + var checkTab = spLayui.checkTab(tabId,true); + if (!checkTab) { + var splayuiTabInfo = JSON.parse(sessionStorage.getItem("splayuiTabInfo")); + if (splayuiTabInfo == null) { + splayuiTabInfo = {}; + } + splayuiTabInfo[tabId] = {href: tabId, title: title} + sessionStorage.setItem("splayuiTabInfo", JSON.stringify(splayuiTabInfo)); + parent.layui.element.tabAdd('splayuiTab', { + title: title + 'ဆ' //用于演示 + , content: '' + , id: tabId + }); + } + parent.layui.element.tabChange('splayuiTab', tabId); + spLayui.tabRoll(); + }; }; /** @@ -676,6 +703,7 @@ layui.define(["element", "jquery"], function (exports) { * 打开新窗口 */ $('body').on('click', '[data-tab]', function () { + console.log('打开新窗口'); var loading = layer.load(0, {shade: false, time: 2 * 1000}); var tabId = $(this).attr('data-tab'), href = $(this).attr('data-tab'), @@ -722,6 +750,7 @@ layui.define(["element", "jquery"], function (exports) { * 在iframe子菜单上打开新窗口 */ $('body').on('click', '[data-iframe-tab]', function () { + console.log('在iframe子菜单上打开新窗口'); var loading = parent.layer.load(0, {shade: false, time: 2 * 1000}); var tabId = $(this).attr('data-iframe-tab'), href = $(this).attr('data-iframe-tab'), @@ -757,6 +786,7 @@ layui.define(["element", "jquery"], function (exports) { parent.layer.close(loading); }); + /** * 左侧菜单的切换 */ diff --git a/mes/src/main/resources/templates/technology/bom/addOrUpdate.ftl b/mes/src/main/resources/templates/technology/bom/addOrUpdate.ftl index fd7b426..73150db 100644 --- a/mes/src/main/resources/templates/technology/bom/addOrUpdate.ftl +++ b/mes/src/main/resources/templates/technology/bom/addOrUpdate.ftl @@ -66,7 +66,18 @@ - +