#
luxiaotao1123
2024-02-18 b7a644b54ca351b8106c842a5611fa8c22e383b8
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>
@@ -75,7 +79,7 @@
  <div class="layui-body"></div>
  <!-- 底部 -->
  <div class="layui-footer layui-text">
    copyright © 2022 <a href="http://www.zoneyung.com" target="_blank">浙江中扬立库技术有限公司</a> all rights reserved.
    copyright © 2024 <a href="http://www.zoneyung.com" target="_blank">浙江中扬立库技术有限公司</a> all rights reserved.
    <span class="pull-right">Version 1.0.0</span>
  </div>
@@ -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('正在删除', {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-500',
            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">
@@ -168,7 +261,7 @@
    <a><i class="layui-icon {{this.menuIcon}}"></i>&emsp;<cite>{{this.menu}}</cite></a>
    <dl class="layui-nav-child">
      {{#each this.subMenu}}
      <dd><a lay-href="{{this.code}}?resourceId={{this.id}}">{{this.name}}</a></dd>
      <dd><a lay-href="{{this.code}}?resourceId={{this.id}}{{this.param}}">{{this.name}}</a></dd>
      {{/each}}
    </dl>
  </li>