<template>
  <div class="flex bg-white p-10 datapanel" >
    <div style="flex: 1.5" class="flex">
      <div class="flex">
        <!--<button class="btn btn-xs" style="background: #d2e4f5;padding: 0" v-show="!this.searchshow" @click="this.searchshow = true">-->
          <!--<span class="glyphicon glyphicon-chevron-down" style="color: #000;"></span>-->
        <!--</button>-->
        <criteria-paged :model="model" :pager="false" v-ref:paged>
          <criteria partial='criteria' v-ref:criteria @condition-changed="$parent.selfSearch" v-show="$parent.searchshow">
            <div novalidate class="form-inline auto" partial>
              <div class="form-group">
                <input type="text" class="form-control" v-model="model.f_warehouse_name"
                       condition="f_warehouse_name like '%{}%'" placeholder='仓库名称' :size="8">
              </div>
              <div class="form-group">
                <button class="btn btn-success width-100" @click="search()">查 询</button>
                <!--<button class="btn" @click="$parent.$parent.searchshow = false" style="margin-left: 10px">-->
                  <!--<span class="glyphicon glyphicon-chevron-up"></span>-->
                <!--</button>-->
              </div>
            </div>
          </criteria>
          <data-grid :model="model" v-ref:grid  partial='list'>
            <template partial='head'>
              <tr>
                <th><nobr>序号</nobr></th>
                <th><nobr>仓库名称</nobr></th>
                <th><nobr>库存总数</nobr></th>
                <th><nobr>已领取数量</nobr></th>
                <th><nobr>未领取数量</nobr></th>
                <th><nobr>建库日期</nobr></th>
              </tr>
            </template>
            <template partial='body'>
              <td style="text-align: center;">{{$index + 1}}</td>
              <td style="text-align: center;">{{row.f_warehouse_name}}</td>
              <td style="text-align: center;">{{row.f_warehouse_number}}</td>
              <td style="text-align: center;">{{row.f_receive_number}}</td>
              <td style="text-align: center;">{{row.f_notreceive_number}}</td>
              <td style="text-align: center;">{{row.f_operate_date}}</td>
            </template>
          </data-grid>
        </criteria-paged>
      </div>
    </div>
  </div>
</template>

<script>
  import { PagedList } from 'vue-client'
  export default {
    'title': '仓库列表',
    data () {
      return {
        model: new PagedList('rs/sql/singleTable_OrderBy', 99999, {items: '`*`', tablename: '`t_warehouse`', orderitem: '`id`'}),
        // 控制查询条件显示
        searchshow: true,

        f_operator: this.$login.f.name,
        f_filiale: this.$login.f.f_fengongsi,
        f_outlets: this.$login.f.f_parentname,
        f_orgstr:this.$login.f.orgpathstr,
        f_filialeids:this.$login.f.f_orgids,
      }
    },
    ready () {
      this.search()
    },
    methods: {
      search () {
        this.$refs.paged.$refs.criteria.search()
      },
      selfSearch (args) {
        args.condition = `${args.condition} and f_filialeids  = '${this.f_filialeids}'`
        this.model.search(args.condition, args.model)
      },
    },
    computed: {
    },
    watch: {
    }
  }
</script>
<style>
  .datapanel {
    color: #333;
    background-color: white;
    padding: 10px 20px;
    border-radius:15px;
  }
</style>
