<template>
  <div id="unit" class="flex-row">
    <div class="basic-main" @keyup.enter="search">
      <div class="flex">
        <criteria-paged :model="model" v-ref:paged>
          <criteria partial='criteria' v-ref:criteria @condition-changed="$parent.selfSearch">
            <div novalidate class="form-inline auto" partial>
              <div class="row">
<!--              <div class="col-sm-2 form-group">-->
<!--                <label class="font_normal_body">组织机构</label>-->
<!--                <res-select :initresid='$parent.$parent.curorgid'-->
<!--                            @res-select="$parent.$parent.getorg"-->
<!--                            class="select select_list"-->
<!--                            restype='organization'-->
<!--                            style="width: 60%">-->
<!--                </res-select>-->
<!--              </div>-->
                <div class="col-sm-2 form-group">
                  <label class="font_normal_body">&emsp;分公司</label>
                  <input type="text" class="input_search"  style="width: 60%" v-model="model.f_filiale"
                         condition="f_filiale = '{}'" placeholder='分公司'>
                </div>
                <div class="col-sm-2 form-group">
                  <label class="font_normal_body">&emsp;网点&emsp;</label>
                  <input type="text" class="input_search"  style="width: 60%" v-model="model.f_parentname4"
                         condition="f_parentname4 = '{}'" placeholder='网点'>
                </div>

                <div class="col-sm-2 form-group">
                  <label class="font_normal_body">客户编号</label>
                  <input type="text" class="input_search"  style="width: 60%" v-model="model.f_userid"
                         condition="f_userid = '{}'" placeholder='客户编号'>
                </div>
                <div class="col-sm-2 form-group">
                  <label class="font_normal_body">客户姓名</label>
                  <input type="text" class="input_search"  style="width: 60%" v-model="model.f_username"
                         condition="f_username like '%{}%'" placeholder='客户姓名'>
                </div>
                <div class="col-sm-2 form-group">
                  <label class="font_normal_body">客户电话</label>
                  <input type="text" class="input_search"  style="width: 60%" v-model="model.f_phone"
                         condition="f_phone like '%{}%'" placeholder='客户电话'>
                </div>
                <div class="span" style="float:right;">
                  <button class="button_search" @click="search()">查 询</button>
                  <div style="float: right"  class="button_spacing" :class="{'button_shrink_top':$parent.$parent.criteriaShow,'button_shrink_bottom':!$parent.$parent.criteriaShow}"    @click="$parent.$parent.criteriaShow=!$parent.$parent.criteriaShow"></div>

                </div>
              </div>
              <div class="row" v-show="$parent.$parent.criteriaShow">

                <div class="col-sm-2 form-group">
                  <label class="font_normal_body">&emsp;旧表号</label>
                  <input type="text" class="input_search"  style="width: 60%" v-model="model.f_meternumber"
                         condition="f_meternumber = '{}'" placeholder='旧表号'>
                </div>
                <div class="col-sm-2 form-group">
                  <label class="font_normal_body">&emsp;新表号</label>
                  <input type="text" class="input_search"  style="width: 60%" v-model="model.f_cmnewmeternumber"
                         condition="f_cmnewmeternumber = '{}'" placeholder='新表号'>
                </div>
                <div class="col-sm-2 form-group">
                  <label class="font_normal_body">旧表品牌</label>
                  <input type="text" class="input_search"  style="width: 60%" v-model="model.f_gaswatchbrand"
                         condition="f_gaswatchbrand = '{}'" placeholder='旧表品牌'>
                </div>
                <div class="col-sm-2 form-group">
                  <label class="font_normal_body">新表品牌</label>
                  <input type="text" class="input_search"  style="width: 60%" v-model="model.f_cmnewgaswatchbrand"
                         condition="f_cmnewgaswatchbrand = '{}'" placeholder='新表品牌'>
                </div>
                <div class="col-sm-2 form-group">
                  <label class="font_normal_body">客户地址</label>
                  <input type="text" class="input_search"  style="width: 60%" v-model="model.f_address"
                         condition="f_address like '%{}%'" placeholder='客户地址'>
                </div>

                <div class="col-sm-2 form-group">
                  <label class="font_normal_body">换表类型</label>
                  <input type="text" class="input_search"  style="width: 60%" v-model="model.f_watchtype"
                         condition="f_watchtype = '{}'" placeholder='换表类型'>
                </div>
                <div class="col-sm-2 form-group">
                  <label class="font_normal_body">&emsp;换表人</label>
                  <input type="text" class="input_search"  style="width: 60%" v-model="model.f_cmoperator"
                         condition="f_cmoperator like '%{}%'" placeholder='换表人'>
                </div>
                <div class="col-sm-2 form-group">
                  <label class="font_normal_body">换表时间</label>
                  <datepicker :format="'yyyy-MM-dd'"
                              :value.sync="model.f_cmdate"
                              condition="f_cmdate >= '{} 00:00:00'"
                              placeholder="开始时间"
                              style="width: 60%"
                              v-model="model.f_cmdate">
                  </datepicker>
                </div>
                <div class="col-sm-2 form-group">
                  <label class="font_normal_body">&emsp;&emsp;至&emsp;</label>
                  <datepicker :format="'yyyy-MM-dd'"
                              :value.sync="model.f_cmdate2"
                              condition="f_cmdate <= '{} 23:59:59'"
                              placeholder="结束时间"
                              style="width: 60%"
                              v-model="model.f_cmdate2">
                  </datepicker>
                </div>

              </div>
            </div>

          </criteria>
          <data-grid :model="model" v-ref:grid class="list_area table_sy" 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>
                <th>
                  <nobr>旧表号</nobr>
                </th>
                <th>
                  <nobr>新表号</nobr>
                </th>
                <th>
                  <nobr>旧气表品牌</nobr>
                </th>
                <th>
                  <nobr>新气表品牌</nobr>
                </th>
                <th>
                  <nobr>旧气表型号</nobr>
                </th>
                <th>
                  <nobr>新气表型号</nobr>
                </th>
                <th>
                  <nobr>旧表剩余补气量</nobr>
                </th>

                <th>
                  <nobr>备注</nobr>
                </th>
                <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;"><nobr>{{$index + 1}}</nobr></td>
<!--              <td style="text-align: center;"><nobr>-->
<!--                {{row.f_userinfo_code}}-->
<!--              </nobr> </td>-->
              <td style="text-align: center;">
                <nobr>{{row.f_username}}</nobr>
              </td>
              <td style="text-align: center;">
                <nobr>{{row.f_address}}</nobr>
              </td>
              <td style="text-align: center;">
                <nobr>{{row.f_watchtype}}</nobr>
              </td>
              <td style="text-align: center;">
                <nobr>{{row.f_watchfee}}</nobr>
              </td>
              <td style="text-align: center;">
                <nobr>{{row.f_meternumber}}</nobr>
              </td>
              <td style="text-align: center;">
                <nobr>{{row.f_cmnewmeternumber}}</nobr>
              </td>
              <td style="text-align: center;">
                <nobr>{{row.f_gaswatchbrand}}</nobr>
              </td>
              <td style="text-align: center;">
                <nobr>{{row.f_cmnewgaswatchbrand}}</nobr>
              </td>
              <td style="text-align: center;">
                <nobr>{{row.f_metertype}}</nobr>
              </td>
              <td style="text-align: center;">
                <nobr>{{row.f_cmnewmetertype}}</nobr>
              </td>
              <td style="text-align: center;">
                <nobr>{{row.f_nextaddgasamount}}</nobr>
              </td>

              <td style="text-align: center;">
                <nobr>{{row.f_cnote}}</nobr>
              </td>
              <td style="text-align: center;">
                <nobr>{{row.f_cmoperator}}</nobr>
              </td>
              <td style="text-align: center;">
                <nobr>{{row.f_state}}</nobr>
              </td>
              <td style="text-align: center;">
                <nobr>{{row.f_cmdate}}</nobr>
              </td>
              <td style="text-align: center;">
                <nobr>{{row.f_cmoperator}}</nobr>
              </td>
              <td style="text-align: center;">
                <nobr>{{row.f_parentname4}}</nobr>
              </td>
              <td style="text-align: center;">
                <nobr>{{row.f_filiale}}</nobr>
              </td>

            </template>
          </data-grid>
        </criteria-paged>
      </div>
    </div>
  </div>
</template>

<script>
  import {PagedList} from 'vue-client'
  const myMap = new Map()

  export default {
    'title': '旧表信息查看',
    data () {
      return {
        model: new PagedList('rs/sql/singleTable_OrderBy', 20,
          {tablename: '`t_oldchangmeter`', items: '`*`', orderitem: '`id desc`'}),
        // 控制查询条件显示
        criteriaShow: false,
        curorgid: [this.$login.f.orgid],
        f_orgid: '',
        whetherPay: [{label: '全部', value: ''}, {label: '是', value: '是'}, {label: '否', value: '否'}]
      }
    },
    ready () {
      // this.search()
      // this.getwarehouse()
    },
    methods: {
      getorg (val) {
        this.f_orgid = this.$login.convertToIn(val)
        // this.f_filialeid = val[0]
      },

      search () {
        this.$refs.paged.$refs.criteria.search()
      },
      selfSearch (args) {
        this.model.search(args.condition, args.model)
      }

    },
    computed: {
    }
  }
</script>
<style>
  .datapanel {
    color: #333;
    background-color: white;
    padding: 10px 20px;
    border-radius: 15px;
  }
</style>
