<?php

/* ========================================================================
 * $Id: table.php 2956 2020-06-25 12:04:59Z onez $
 * 
 * Email: www@onez.cn
 * QQ: 6200103
 * HomePage: http://www.onez.cn
 * ========================================================================
 * Copyright 2016-2017 佳蓝科技.
 * 
 * ======================================================================== */

!defined('IN_ONEZ') && exit('Access Denied');
# datatable
#请求数据
if($MODE=='$post'){
  $action=onez()->gp('action');
  if($action=='data'){
    $items=array();
    $A['items']=$items;
  }
  return;
}
?>
<section :class="data.noContent?'':'content'">
  <div v-if="data.btns" class="btns" style="padding-bottom: 10px">
    <div class="pull-left">
      <a :href="item.href" :args="item.args" v-for="item in data.btns" class="btn" :class="'btn-'+(item.skin||'success')">
        {{item.name}}
      </a>
    </div>
    <div class="pull-right">
      
    </div>
    <div class="clearfix"></div>
  </div>
  <div class="box box-info">
    <div class="box-header with-border">
      <form class="form-search" method="post" v-if="data.search">
        <div class="input-group">
          <input type="text" ref="kw" class="form-control kw" style="width: 300px" placeholder="请输入您要搜索的关键词" :value="data.kw">
          <button type="button" @click="search" class="btn btn-info">搜索</button>
        </div>
      </form>
      <h3 class="box-title" v-else v-html="data.caption||data.title"></h3>
    </div>
<form class="form-table" method="post">
    <div class="box-body  table-responsive no-padding">
      <table class="table table-striped">
        <thead>
          <tr>
            <th v-for="item in data.cols" :class="[item.autoHide?'autoHide':'']" :style="{width:item.width?item.width+'px':''}">
              {{item.title}}
              <i v-if="item.faq" @click="onez.document(item.faq)" data-toggle="tooltip" :title="item.faq" class="layui-icon layui-icon-about onez-document"></i>
            </th>
          </tr>
        </thead>
        <tbody>
          <tr v-for="item in data.record">
            <td v-for="col in data.cols">
              <div v-if="col.btns">
                <button type="button" v-if="!btn.id||item['show_'+btn.id]" @click="click(btn.event,item)" v-for="btn in col.btns" :class="'btn btn-xs btn-'+btn.skin">
                  {{btn.name}}
                </button>
              </div>
              <div v-else-if="col.href">
                <a :href="format(col.href,item)" :args="col.args" v-html="getValue(item,col)"></a>
              </div>
              <div v-else-if="col.event">
                <a @click="click(col.event,item)" :target="col.target||'_blank'" href="javascript:;" v-html="getValue(item,col)"></a>
              </div>
              <div v-else v-html="getValue(item,col)"></div>
            </td>
          </tr>
         </tbody>
      </table>
    </div>
    <div class="box-footer clearfix" v-if="data.pages && data.pages>1">
      <ul class="pagination">
        <li v-for="item in data.pages">
          <a v-if="item.page==data.page" class="current">{{item.name}}</a>
          <a :href="onez.getUrl({page:item.page})" v-else>{{item.name}}</a>
        </li>
      </ul>
    </div>
  <input type="hidden" name="action" value="">
</form>
  </div>
</section>
