From 1662cd2f5c686973a9a596865dfe412fc5c8ae6d Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期三, 20 十二月 2023 16:02:15 +0800
Subject: [PATCH] #

---
 zy-asrs-wms/src/main/webapp/views/index.html |  101 ++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 97 insertions(+), 4 deletions(-)

diff --git a/zy-asrs-wms/src/main/webapp/views/index.html b/zy-asrs-wms/src/main/webapp/views/index.html
index cbe75fb..79eeb03 100644
--- a/zy-asrs-wms/src/main/webapp/views/index.html
+++ b/zy-asrs-wms/src/main/webapp/views/index.html
@@ -10,6 +10,7 @@
   <link rel="stylesheet" href="../static/layui/css/layui.css" media="all">
   <link rel="stylesheet" href="../static/css/admin.css?v=318" media="all">
   <link rel="stylesheet" href="../static/css/loader.css" media="all">
+  <link rel="stylesheet" href="../static/css/originTable.css" media="all">
   <style>
     .layui-logo img {
       width: 25px;
@@ -42,8 +43,11 @@
     </ul>
     <ul class="layui-nav layui-layout-right">
       <li class="layui-nav-item" lay-unselect>
-        <a ew-event="note" title="渚跨"><i class="layui-icon layui-icon-note"></i></a>
+        <a id="hostName"></a>
       </li>
+<!--      <li class="layui-nav-item" lay-unselect>-->
+<!--        <a ew-event="note" title="渚跨"><i class="layui-icon layui-icon-note"></i></a>-->
+<!--      </li>-->
       <li class="layui-nav-item layui-hide-xs" lay-unselect>
         <a ew-event="fullScreen" title="鍏ㄥ睆"><i class="layui-icon layui-icon-screen-full"></i></a>
       </li>
@@ -102,13 +106,14 @@
     base: baseUrl + "/static/layui/lay/modules/"
   }).extend({
     notice: 'notice/notice',
-  }).use(['index', 'element', 'layer', 'admin', 'notice'], function () {
+  }).use(['index', 'element', 'layer', 'admin', 'notice', 'table'], function () {
     var $ = layui.jquery;
     var index = layui.index;
     var element = layui.element;
     var layer = layui.layer;
     var admin = layui.admin;
     var notice = layui.notice;
+    var table = layui.table;
 
     var easywebIframeMsg = localStorage.getItem("easyweb-iframe");
     if (!isEmpty(easywebIframeMsg)) {
@@ -140,15 +145,36 @@
       }
     });
 
+    // 妫�娴嬫槸鍚︿负瓒呯骇绠$悊鍛�
+    $.ajax({
+      url: baseUrl + "/show/host.action",
+      headers: {'token': localStorage.getItem('token')},
+      method: 'GET',
+      success: function (res) {
+        if (res.code === 200) {
+          if (!isEmpty(res.data.hostName)) {
+            $('#hostName').text(res.data.hostName);
+          }
+          if (res.data.root) {
+            showHost();
+          }
+        } else if (res.code === 403) {
+          top.location.href = baseUrl + "/login";
+        } else {
+          layer.msg(res.msg, {icon: 2});
+        }
+      }
+    });
+
     // 榛樿鍔犺浇涓婚〉
     index.loadHome({
-      menuPath: baseUrl+'/views/home/navigation.html',
+      menuPath: baseUrl + '/views/home/navigation.html',
       menuName: '<i class="layui-icon layui-icon-home"></i>'
     });
 
     $('#username').text(localStorage.getItem('username'));
 
-    $(document).on('click','#logout', function () {
+    $(document).on('click', '#logout', function () {
       window.location.href = "login.html";
       localStorage.removeItem('token');
       localStorage.removeItem('username');
@@ -160,6 +186,73 @@
     var url = logout.getAttribute('href');
     logout.setAttribute('href', baseUrl + "/login");
 
+    // 澶氫粨搴撴ā寮�
+    function showHost() {
+      // var dele = layer.msg('姝e湪鍒犻櫎', {icon: 16, time: 10000}, function(){
+      //     layer.msg('鎴愬姛鍒犻櫎', {icon: 1})
+      // });
+      admin.open({
+        type: 1,
+        title: '浠撳簱閫夋嫨',
+        area: '250px',
+        offset: 'r',
+        shade: false,
+        shadeClose: true,
+        content: '<table id="originTable" lay-filter="originTable"></table>',
+        success: function (layero) {
+          var insTb = table.render({
+            elem: '#originTable',
+            url: baseUrl + '/host/list/auth',
+            height: 'full-600',
+            headers: {token: localStorage.getItem('token')},
+            request: {
+              pageName: 'curr',
+              pageSize: 'limit'
+            },
+            parseData: function (res) {
+              return {
+                'code': res.code,
+                'msg': res.msg,
+                'count': res.data.total,
+                'data': res.data.records
+              }
+            },
+            response: {
+              statusCode: 200
+            },
+            defaultToolbar: [],
+            cols: [[
+              {field: 'id', title: '缂栧彿', width: 70, align: 'center'},
+              {field: 'name', title: '椤圭洰鍚嶇О'}
+            ]],
+            done: function (res, curr, count) {
+              $('.layui-table, .layui-table-view').css("margin", 0);
+              // $('#originTable+.layui-table-view .layui-table-body tbody>tr:first').trigger('click');
+            }
+          });
+          /* 鐩戝惉琛屽崟鍑讳簨浠� */
+          table.on('row(originTable)', function (obj) {
+            obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click');
+            // 妫�娴嬫槸鍚︿负瓒呯骇绠$悊鍛�
+            $.ajax({
+              url: baseUrl + "/root/change/host/auth?hostId=" + obj.data.id,
+              headers: {'token': localStorage.getItem('token')},
+              method: 'GET',
+              success: function (res) {
+                if (res.code === 200) {
+                  window.location.reload();
+                } else if (res.code === 403) {
+                  top.location.href = baseUrl + "/login";
+                } else {
+                  layer.msg(res.msg, {icon: 2});
+                }
+              }
+            });
+          });
+        }
+      });
+    }
+
   });
 </script>
 <script type="text/html" id="menuTpl">

--
Gitblit v1.9.1