

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>首页</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
</head>
<body>

  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-col-md12">
        <div class="layui-row layui-col-space15">

          <div class="layui-col-md8">
            <div class="layui-card">
              <div class="layui-card-header">快捷方式</div>
              <div class="layui-card-body">

                <div class="layui-carousel layadmin-carousel layadmin-shortcut">
                  <div carousel-item>
                    <ul class="layui-row layui-col-space10">
                      <li class="shortcut layui-col-md2" data-permission="office.view_notice">
                        <a lay-href="notice/notice.html">
                          <i class="layui-icon layui-icon-notice"></i>
                          <cite>公告管理</cite>
                        </a>
                      </li>
                      <li class="shortcut layui-col-md2" data-permission="plan.view_sale_plan">
                        <a lay-href="plan/sale.html">
                          <i class="layui-icon layui-icon-form"></i>
                          <cite>销售计划</cite>
                        </a>
                      </li>
                      <li class="shortcut layui-col-md2" data-permission="plan.view_production_plan">
                        <a lay-href="plan/production.html">
                          <i class="layui-icon layui-icon-diamond"></i>
                          <cite>生产计划</cite>
                        </a>
                      </li>

                      <li class="shortcut layui-col-md2" data-permission="purchase.view_purchase_plan">
                        <a lay-href="purchase/purchase.html">
                          <i class="layui-icon layui-icon-cart-simple"></i>
                          <cite>采购计划</cite>
                        </a>
                      </li>
                      <li class="shortcut layui-col-md2" data-permission="order.view_sale_order">
                        <a lay-href="order/sale_order.html">
                          <i class="layui-icon layui-icon-read"></i>
                          <cite>销售订单</cite>
                        </a>
                      </li>
                    </ul>

                  </div>
                </div>

              </div>
            </div>
          </div>
          <div class="layui-col-md4">
            <div class="layui-card">
              <div class="layui-card-header">待处理</div>
              <div class="layui-card-body">

                <div class="layui-carousel layadmin-carousel layadmin-backlog">
                  <div carousel-item style="overflow: auto;">
                    <ul id="layui-nav-child">
                      <li class="layui-col-xs4" data-permission="plan.check_sale_plan">
                        <a href="javascript:;" class="layadmin-backlog-body">
                          <h3.8>未读公告</h3.8>
                            <br>
                          <p><cite id="notice_unread"></cite></p>
                        </a>
                      </li>
                      <li class="layui-col-xs4" data-permission="plan.check_sale_plan">
                        <a href="javascript:;" class="layadmin-backlog-body">
                          <h3.8>销售计划</h3.8>
                            <br>
                          <p><cite id="sale_plan_count"></cite></p>
                        </a>
                      </li>
                      <li class="layui-col-xs4" data-permission="order.check_sale_order">
                        <a href="javascript:;" class="layadmin-backlog-body">
                          <h3.8>销售订单</h3.8>
                            <br>
                          <p><cite id="sale_order_count"></cite></p>
                        </a>
                      </li>
                        <li class="layui-col-xs4" data-permission="plan.check_production_plan">
                        <a href="javascript:;" class="layadmin-backlog-body">
                          <h3.8>生产计划</h3.8>
                            <br>
                          <p><cite id="production_count"></cite></p>
                        </a>
                      </li>
                        <li class="layui-col-xs4" data-permission="purchase.check_purchase_plan">
                        <a href="javascript:;" class="layadmin-backlog-body">
                          <h3.8>采购计划</h3.8>
                            <br>
                          <p><cite id="purchase_count"></cite></p>
                        </a>
                      </li>
                      <li class="layui-col-xs4" data-permission="purchase.check_purchase_order">
                        <a href="javascript:;" class="layadmin-backlog-body">
                          <h3.8>合同管理</h3.8>
                            <br>
                          <p><cite id="purchase_order_count"></cite></p>
                        </a>
                      </li>

                      <li class="layui-col-xs4" data-permission="purchase.check_material_godown_entry">
                        <a href="javascript:;" class="layadmin-backlog-body">
                          <h3.8>原料入库</h3.8>
                            <br>
                          <p><cite id="material_godownentry_count"></cite></p>
                        </a>
                      </li>
                      <li class="layui-col-xs4" data-permission="material.check_material_deliver">
                        <a href="javascript:;" class="layadmin-backlog-body">
                          <h3.8>原料出库</h3.8>
                            <br>
                          <p><cite id="material_deliver_count"></cite></p>
                        </a>
                      </li>
                      <li class="layui-col-xs4" data-permission="purchase.check_material_godown_entry_return">
                        <a href="javascript:;" class="layadmin-backlog-body">
                          <h3.8>原料退货</h3.8>
                            <br>
                          <p><cite id="material_godownentry_return_count"></cite></p>
                        </a>
                      </li>
                      <li class="layui-col-xs4" data-permission="warehouse.check_material_inventory">
                        <a href="javascript:;" class="layadmin-backlog-body">
                          <h3.8>原料盘存</h3.8>
                            <br>
                          <p><cite id="material_inventory_count"></cite></p>
                        </a>
                      </li>
                      <li class="layui-col-xs4" data-permission="purchase.check_consumable_godown_entry">
                        <a href="javascript:;" class="layadmin-backlog-body">
                          <h3.8>耗材入库</h3.8>
                            <br>
                          <p><cite id="consumable_godownentry_count"></cite></p>
                        </a>
                      </li>
                      <li class="layui-col-xs4" data-permission="material.check_consumable_deliver">
                        <a href="javascript:;" class="layadmin-backlog-body">
                          <h3.8>耗材出库</h3.8>
                            <br>
                          <p><cite id="consumable_deliver_count"></cite></p>
                        </a>
                      </li>
                      <li class="layui-col-xs4" data-permission="purchase.check_consumable_godown_entry_return">
                        <a href="javascript:;" class="layadmin-backlog-body">
                          <h3.8>耗材退货</h3.8>
                            <br>
                          <p><cite id="consumable_godownentry_return_count"></cite></p>
                        </a>
                      </li>
                      <li class="layui-col-xs4" data-permission="warehouse.check_consumable_inventory">
                        <a href="javascript:;" class="layadmin-backlog-body">
                          <h3.8>耗材盘存</h3.8>
                            <br>
                          <p><cite id="consumable_inventory_count"></cite></p>
                        </a>
                      </li>
                      <li class="layui-col-xs4" data-permission="goods.check_goods_godown_entry">
                        <a href="javascript:;" class="layadmin-backlog-body">
                          <h3.8>成品入库</h3.8>
                            <br>
                          <p><cite id="goods_godownentry_count"></cite></p>
                        </a>
                      </li>
                      <li class="layui-col-xs4" data-permission="order.check_goods_deliver">
                        <a href="javascript:;" class="layadmin-backlog-body">
                          <h3.8>成品出库</h3.8>
                            <br>
                          <p><cite id="goods_deliver_count"></cite></p>
                        </a>
                      </li>
                      <li class="layui-col-xs4" data-permission="goods.check_goods_inventory">
                        <a href="javascript:;" class="layadmin-backlog-body">
                          <h3.8>成品盘存</h3.8>
                            <br>
                          <p><cite id="goods_inventory_count"></cite></p>
                        </a>
                      </li>

                    </ul>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>


    </div>
  </div>

  <script src="../../layuiadmin/layui/layui.js?t=1"></script>
  <script>
  layui.config({
    base: '../../layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'home'], function() {
      var $ = layui.$;
      var admin = layui.admin;

      var permissions = layui.data(layui.setter.tableName)['permissions'];
      $('.shortcut').each(function () {
          var perm = $(this).data("permission");
          //console.log(perm, permissions.indexOf(perm))
          if(permissions.indexOf(perm) == -1){
            $(this).remove();
          }
      });

      admin.req({
          url: '/account/count/'
          , done: function (res) {
              $('#notice_unread').html(res.data.notice_unread);
              $('#sale_plan_count').html(res.data.sale_plan_count);
              $('#sale_order_count').html(res.data.sale_order_count);
              $('#production_count').html(res.data.production_count);
              $('#purchase_count').html(res.data.purchase_count);
              $('#purchase_order_count').html(res.data.purchase_order_count);
              $('#material_godownentry_count').html(res.data.material_godownentry_count);
              $('#material_deliver_count').html(res.data.material_deliver_count);
              $('#material_godownentry_return_count').html(res.data.material_godownentry_return_count);
              $('#material_inventory_count').html(res.data.material_inventory_count);
              $('#consumable_godownentry_count').html(res.data.consumable_godownentry_count);
              $('#consumable_deliver_count').html(res.data.consumable_deliver_count);
              $('#consumable_godownentry_return_count').html(res.data.consumable_godownentry_return_count);
              $('#consumable_inventory_count').html(res.data.consumable_inventory_count);
              $('#goods_godownentry_count').html(res.data.goods_godownentry_count);
              $('#goods_deliver_count').html(res.data.goods_deliver_count);
              $('#goods_inventory_count').html(res.data.goods_inventory_count);
          }
      });

      var permissions = layui.data(layui.setter.tableName)['permissions'];
      $('#layui-nav-child li').each(function () {
          var perm = $(this).data("permission");
          if(permissions.indexOf(perm) == -1){
            $(this).remove();
          }
      });
    });

  </script>
</body>
</html>

