From 9b4ae160ab67948e7ea597a25b62e08527f6b537 Mon Sep 17 00:00:00 2001 From: haozq <1611483981@qq.com> Date: Tue, 30 Jul 2024 17:54:07 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=B7=BB=E5=8A=A0=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/static/js/home/home.js | 14 ++++ src/main/resources/static/js/main.js | 68 ++++++++++++++----- .../resources/static/pages/home/home.html | 12 ++-- 3 files changed, 70 insertions(+), 24 deletions(-) diff --git a/src/main/resources/static/js/home/home.js b/src/main/resources/static/js/home/home.js index 4427113..960f6c1 100644 --- a/src/main/resources/static/js/home/home.js +++ b/src/main/resources/static/js/home/home.js @@ -12,6 +12,20 @@ layui.use(['form', 'layer', 'table', 'laydate','carousel','util'], function () { iniTable(); // layui-table-body }) + + +function openNewModule(type){ + console.log(type) + if(type==1){ + parent.parentOpen("pages/samples/samplesMge.html",152,"收样管理"); + } else if(type==2){ + parent.parentOpen("pages/basic/standard/testManagementList.html",154,"收样管理"); + } else if(type==3){ + parent.parentOpen("pages/basis/examine.html",161,"审查管理"); + } + + +} function initApproe(){ var dispatchWorkNum=0; var testNum =0; diff --git a/src/main/resources/static/js/main.js b/src/main/resources/static/js/main.js index 842defc..50456f7 100644 --- a/src/main/resources/static/js/main.js +++ b/src/main/resources/static/js/main.js @@ -1,3 +1,4 @@ +let urlIds=new Array(); initMenu(); initsy(); function initMenu(){ @@ -14,16 +15,16 @@ function initMenu(){ return; } var menu = $("#menu"); + $.each(data, function(i,item){ var a = $(""); - var css = item.css; if(css!=null && css!=""){ a.append(""); } a.append(""+item.name+""); a.attr("lay-id", item.id); - + urlIds.push(item.id); var href = item.href; if(href != null && href != ""){ a.attr("data-url", href); @@ -35,11 +36,10 @@ function initMenu(){ } li.append(a); menu.append(li); - //多级菜单 setChild(li, item.child) - }); + localStorage.setItem("uelData",urlIds.join("@")); } else if (result.status === 500) { layer.alert(result.msg, {icon: 2}) } @@ -69,7 +69,7 @@ function setChild(parentElement, child){ var ca = $(""); ca.attr("data-url", item2.href); ca.attr("lay-id", item2.id); - + urlIds.push(item2.id) var css2 = item2.css; if(css2!=null && css2!=""){ ca.append(""); @@ -82,9 +82,7 @@ function setChild(parentElement, child){ var dl = $("
"); dl.append(dd); - parentElement.append(dl); - // 递归 setChild(dd, item2.child); }); @@ -129,6 +127,9 @@ function showLoginInfo(){ }); } + + + function logout(){ $.ajax({ type : 'get', @@ -151,11 +152,12 @@ function changeUserPwd(){ var active; +var element ; -layui.use(['layer', 'element'], function() { + layui.use(['layer', 'element'], function() { var $ = layui.jquery, layer = layui.layer; - var element = layui.element; //导航的hover效果、二级菜单等功能,需要依赖element模块 + element = layui.element; //导航的hover效果、二级菜单等功能,需要依赖element模块 element.on('nav(demo)', function(elem){ //layer.msg(elem.text()); }); @@ -198,14 +200,7 @@ layui.use(['layer', 'element'], function() { resize(); }); - //iframe自适应 - function resize(){ - var $content = $('.admin-nav-card .layui-tab-content'); - $content.height($(this).height() - 147); - $content.find('iframe').each(function() { - $(this).height($content.height()); - }); - } + $(window).on('resize', function() { var $content = $('.admin-nav-card .layui-tab-content'); $content.height($(this).height() - 147); @@ -249,4 +244,41 @@ layui.use(['layer', 'element'], function() { shadeMobile.on('click', function () { $('body').removeClass('site-mobile'); }); -}); \ No newline at end of file +}); + +/** + * 打开新页面 + * @param url + * @param lay_id + * @param title + */ +function parentOpen(url,lay_id,title){ + const isContained = urlIds.includes(lay_id); + if(!isContained){ + return; + } + + if ($(".layui-tab-title li[lay-id='" + lay_id + "']").length > 0) { + active.tabChange(lay_id); + return; + } + element.tabAdd('admin-tab', { + title: title, + content: '', + id: lay_id + }); + + element.tabChange("admin-tab", lay_id); + resize(); +} + +//iframe自适应 +function resize(){ + var $content = $('.admin-nav-card .layui-tab-content'); + $content.height($(this).height() - 147); + $content.find('iframe').each(function() { + $(this).height($content.height()); + }); +} + + diff --git a/src/main/resources/static/pages/home/home.html b/src/main/resources/static/pages/home/home.html index 1cf9bcf..01e79da 100644 --- a/src/main/resources/static/pages/home/home.html +++ b/src/main/resources/static/pages/home/home.html @@ -36,21 +36,21 @@
-
+
待派工
0
更新至2024-07-18
-
+
待试验
0
更新至2024-07-18
-
+
待重新审阅
0
更新至2024-07-18
@@ -59,21 +59,21 @@
-
+
待审阅
0
更新至2024-07-18
-
+
待审核
0
更新至2024-07-18
-
+
待审批
0
更新至2024-07-18