<extend name="Public/promote_base"/>
<block name="css">
  <link href="__CSS__/20180207/data.css" rel="stylesheet">
  <link href="__CSS__/20180207/manager.css" rel="stylesheet">
  <link href="__CSS__/20180207/finance.css" rel="stylesheet">
  <link href="__STATIC__/icons_alibaba/iconfont.css?v=1.2" rel="stylesheet">
</block>

<block name="body">
  <style>
    @media screen and (max-width: 1500px) {
      .normal_form {
        padding-top: 45px;
      }

      .trunk-search .normal_txt {
        width: 100px
      }

      .select2-container--default .select2-selection--single {
        width: 125px;
      }

      .trunk-search .select-time .txt {
        width: 100px;
      }

      .form-group .submit {
        width: 55px;
      }
    }

    .selected-color {
      color: #2bd8ed;
    }

    .pointer-hand {
      cursor: pointer;
    }

    .icon-spend {
      position: relative;
      font-size: 1.2rem;
      top: 3px;
      float: right;
      right: 10px;
    }

    .th-hide {
      display: none;
    }

    .form-group {
      float: left;
      margin-bottom: 10px;
    }
    .form-group label {
      line-height: 34px;
      height: 34px;
    }
    .form-group .txt {
      width: 180px;
      height: 34px;
    }
    .chakan {
    display: inline-block;
    margin-right: 10px;
    padding-left: 10px;
    padding-right: 10px;
    height: 34px;
    border: 1px solid #06C;
    color: red;
    border-radius: 4px;
    line-height: 34px;
    text-align: center;
    
    }
  </style>
  <div class="page-search normal_list query-recharge-search jssearch">
      <div class="trunk-title">
          <div class="location">
            <div class="location-container">当前位置:<span>下载管理></span><span>控制台</span></div>
          </div>
          <img src="__IMG__/20180207/icon_zhuce.png">
          <span class="title_main">下载日志</span>
          <span class="details">记录数据管理中导出数据事件</span>
        </div>
    <div class="trunk-content article">
      <div class="trunk-search clearfix">
        <div class="tab normal_tab">
        </div>
         <form action="{:U('download/listsIndex','model='.$model['name'],false)}" method="post" enctype="multipart/form-data" class="normal_form">



        <div class="form-group normal_space">
            <input type="text" name="dataname" class="txt normal_txt" id="uid" placeholder="请输入数据名称"
                   value="{:I('dataname')}">
          </div>
          <div class="form-group normal_space" style='margin-left:10px'>
            <input type="text" name="logid" class="txt normal_txt" id="lid" placeholder="输入日志编号"
                   value="{:I('logid')}">
          </div>

          <input type="hidden" id="top-promote-id" value="{$loginer.id}">
            <if condition="$loginer.level elt 1">
            <div class="form-group fl" style="margin-left:10px">
            <select name="level_promote_2" class="level-promote reselect select_gallery" style="width: 220px;"  data-level="2"  data-val="{:I('level_promote_2', 0)}">
                <option value="0">请选择部门长</option>
            </select>
            </div>
            </if>
            <if condition="$loginer.level elt 2">
            <div class="form-group fl" style="margin-left:10px">
                <select name="level_promote_3" class="level-promote reselect select_gallery" style="width: 220px;" data-level="3"  data-val="{:I('level_promote_3', 0)}">
                <option value="0">请选择组长</option>
                </select>
            </div>
            </if>
            <if condition="$loginer.level elt 3">
            <div class="form-group fl" style="margin-left:10px">
                <select name="level_promote_4" class="level-promote reselect select_gallery" style="width: 220px;"  data-level="4" data-val="{:I('level_promote_4', 0)}">
                <option value="0">请选择推广员</option>
                </select>
            </div>
            </if>


        <div class="form-group normal_space">
          <label class="form-title select-title" style="position: relative;">申请时间:</label>
          <div class="select-time">
            <input type="text" readonly id="sdate" class="txt" name="begtime" placeholder="开始时间" value="{:I('begtime')}">
          </div>
          <label class="form-title select-title zhi_color">&nbsp;—&nbsp;</label>
          <div class="select-time">
            <input type="text" readonly id="edate" class="txt" name="endtime" placeholder="结束时间" value="{:I('endtime')}">
          </div>
        </div>

        <div class="form-group normal_space">
          <input type="submit" class="submit" id='submit'  value="查询">
        </div>
         </form>
      </div>
      <div class="page-list apply-app_apply-list query-recharge-list">
        <div class="trunk-content article" style="margin-left: 0;margin-right: 0;">
          <div class="tabcon trunk-list">
            <table class="table normal_table">
                <tr class="odd">
                    <th>ID</th>  
                    <th>报表类型</th>
                    <th>操作人</th>
                    <th>申请时间</th>
                    <th>下载时间</th>
                    <th>状态</th>
      
                  </tr>
                  <empty name="data">
                    <tr class="num2">
                      <td colspan="8" style="text-align: center;height: 45vh;">
                        <img src="__IMG__/20180207/icon_wushujv2.png"/>
                        <p style="line-height: 40px;color: #A5A5A5;">暂无数据</p>
                      </td>
                    </tr>
                    <else/>
                    <volist name="data" id="vo">
                      <tr class="num2">
                        <td>{$vo.logid}</td>  
                        <td>{$vo.dataname}</td>
                        <td>{$vo.actor}</td>
                        <td>{$vo.addtime|date='Y-m-d H:i:s',###}</td>
                        <td>
                            <if condition="$vo['begintime'] neq 0">
                            {$vo.begintime|date='Y-m-d H:i:s',###}
                            <else />
                             暂无下载时间
                            </if>
                            </td>
                        <td>
                            <if condition="$vo['status'] eq 0">
                             <form action="{:U('download/export')}" method="post" id="downloadForm">
                                <input type="hidden" name="lid" value=""/>
                                <a  style="cursor: pointer" onclick="reload('{$vo.id}')" target="_blank" class="chakan"><span>可下载</span></a>
                              </form>
                            <else /> <a href="javascript:;"  class="current"><span style="color:#9D9D9D">已下载</span></a>
                           </if> 
                        </td>
                      </tr>
                    </volist>
                  </empty>
            </table>
          </div>
          <div class="pagenation clearfix">
            {$_page}
          </div>
        </div>
      </div>
    </div>

  </div>



</block>
<block name="script">
  <link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
  <link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
  <script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
  <script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
          charset="UTF-8"></script>
  <script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
  <script src="__STATIC__/layer/layer.js"></script>
  <script type="text/javascript" src="__JS__/common.js"></script>

  <script type="text/javascript">
      var promoteUrl = "{:U('Query/getSubPromotes')}"
      initPromoteSelect(promoteUrl)
      $().ready(function () {
          setValue('row', '{:I("get.row",10)}');

          $("#pagehtml a").on("click", function (event) {
              event.preventDefault();//使a自带的方法失效,即无法调整到href中的URL(http://www.baidu.com)
              var geturl = $(this).attr('href');
              $('#data_form').attr('action', geturl);
              $('#data_form').submit();
          });
          var date = "{$setdate}";
          $('#sdate').datetimepicker({
              format: 'yyyy-mm-dd',
              language: "zh-CN",
              minView: 2,
              autoclose: true,
              scrollMonth: false,
              scrollTime: false,
              scrollInput: false,
              endDate: date
          });

          $('#edate').datetimepicker({
              format: 'yyyy-mm-dd',
              language: "zh-CN",
              minView: 2,
              autoclose: true,
              pickerPosition: 'bottom-left',
              scrollMonth: false,
              scrollTime: false,
              scrollInput: false,
              endDate: date
          });

          $('#submit').click(function () {
              var sdate = Date.parse($('#sdate').val()) / 1000;
              var edate = Date.parse($('#edate').val()) / 1000;

              if (sdate > edate) {
                  layer.msg('开始时间必须小于等于结束时间', {icon: 5});
                  return false;
              }
              if ((edate - sdate) > 2592000) {
                  layer.msg('时间间隔不能超过31天,请重新选择日期', {icon: 5});
                  return false;
              }

              var url = $(this).attr('url');
              console.log(url);
              var query = $('.jssearch').find('input').serialize();
              query += "&" + $('.jssearch').find('select').serialize();
              query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
              query = query.replace(/^&/g, '');
              if (url.indexOf('?') > 0) {
                  url += '&' + query;
              } else {
                  url += '?' + query;
              }
              console.log(url)
              window.location.href = url;

          });

          $(".select_gallery").select2();
      });
  </script>
  <script>
      function reload(id) {
            $('input[name=lid]').val(id);
            document.getElementById('downloadForm').submit()
            setTimeout(function(){ window.location.reload(); }, 20000);
        }  
  </script>
</block>