<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <meta name="format-detection"content="telephone=no">
    <title>停送电管理</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
    <link rel="stylesheet" href="../../css/aui.css">
    <link rel="stylesheet" href="../../css/projeck.css">
    <style media="screen">
      *{
        box-sizing: border-box;
      }
      .grid_wrap{
        padding: 10px;
        background: #fff;
      }
      .grid{
         display: -webkit-flex;
         display: flex;
         justify-content: flex-start;
         -webkit-justify-content: flex-start;
         flex-wrap: wrap;
         -webkit-flex-wrap: wrap;
         align-items: center;
         background: #fff;
      }
      .grid-item{
        width: 25%;
        text-align: center;
        font-size:14px;
        margin-bottom: 10px;
      }
      .grid-item img{
        width: 40px;
        height: 40px;
        border-radius: 50%;
        margin: auto;
      }
      .grid-item p{
        height: 42px;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        padding:0 5px;
        margin-top:10px;
      }
    </style>
  </head>
  <body>
    <div class="grid_wrap">
      <ul class="grid" id="seeApply">

      </ul>
    </div>
    <div class="noText hide">
      <img src="../../image/noText.png" alt="">
    </div>
  </body>
</html>
<!-- onclick="openChangeFill('{{=value.id}}','{{=value.title}}')" -->
<script type="text/template" id="templateApply">
  {{~it:value}}
   {{?value.id === 5 || value.id === 6}}
     <li class="grid-item" onclick="openPowerOffPage('{{=value.id}}')">
       <img src="{{=value.icon}}" alt="">
       <p>{{=value.title}}</p>
     </li>
   {{?}}
  {{~}}
</script>
<script type="text/javascript" src="../../script/api.js"></script>
<script src="../../script/config.js" charset="utf-8"></script>
<script type="text/javascript" src="../../script/doT.min.js"></script>
<script type="text/javascript">
  var toast = new auiToast()
      apiready = function(){
        var info = $api.getStorage('data'),
        token = JSON.parse(info).data.access_token;
        openOrderList(token)
      };
  // 可申请工单列表
  function openOrderList(token) {
      var headers = {
          "Authorization": "Bearer " + token
      };
      $http.fnReuestData(UrlRouter.getAll_list,headers,'get','',function (ret,err) {
        toast.hide()
        if (ret && ret.code == 0) {
            if (ret.data.length>0) {
                $apis.html(seeApply,'#templateApply',ret.data);
                $api.addCls($api.dom('.noText'), 'hide')
            }else {
                $apis.html(seeApply,'#templateApply',ret.data);
                $api.removeCls($api.dom('.noText'), 'hide');
            }
          }else {
           api.toast({
               msg: '加载超时，请检查网络',
               duration: 2000,
               location: 'bottom'
           });
        }
      })
  }
        // 填写停送电工单
  function openChangeFill(ids,title) {
    var pageParam = {
      id:ids,
      title:title
    }
    $event.openWin('changeFill_win','changefillword_win',pageParam,'')
  }
  function openPowerOffPage(id) {
    if(id == 5) {
      $event.openTabLayout('stopPower','../powerOff/stopPower','停电审核','')
    } else if (id == 6) {
      $event.openTabLayout('sendPower','../powerOff/sendPower','送电审核','')
    }
  }
</script>
