<template>
  <div style="flex:1; " class="flex">
    <criteria-paged :model="model" v-ref:paged>
      <criteria partial='criteria' @condition-changed='$parent.selfSearch' v-ref:cri>
        <div novalidate class="form-inline" partial>
          <div class="form-group">
            <input type="text" class="form-control" v-model="model.f_userinfo_code"
                   condition="f_userinfo_code='{}'" placeholder='用户编号'
                   :size="model.f_userinfo_code ? model.f_userinfo_code.length : 4">
          </div>
          <div class="form-group">
            <input type="text" class="form-control" v-model="model.f_user_name"
                   condition="f_user_name like '%{}%'" placeholder='用户姓名'
                   :size="model.f_user_name ? model.f_user_name.length * 2 : 4">
          </div>
          <div class="form-group">
            <button class="btn btn-success width-100" @click="$parent.$parent.search()" v-el:cx id="comprehen-gasBra-gasBraLis-查询">查询</button>
          </div>
        </div>
      </criteria>
      <data-grid  :model="model" partial='list' v-ref:grid>
        <template partial='head'>
          <tr>
            <th>序号</th>
            <th>用户编号</th>
            <th>用户姓名</th>
            <th>用户地址</th>
            <th>用户电话</th>
            <th>用户状态</th>
          </tr>
        </template>
        <template partial='body'>
          <tr>
            <td style="text-align:center">{{$index+1}}</td>
            <td style="text-align:center">{{row.f_userinfo_code}}</td>
            <td style="text-align:center">{{row.f_user_name}}</td>
            <td style="text-align:center">{{row.f_address}}</td>
            <td style="text-align:center">{{row.f_user_phone}}</td>
            <td style="text-align:center">{{row.f_user_state}}</td>
          </tr>
        </template>
        <template partial='foot'></template>
      </data-grid>
    </criteria-paged>
  </div>
</template>

<script>
/**
 *阶梯气价查询列表
 */
  import { PagedList } from 'vue-client'
  export default {
    title: '用户信息',
    data () {
      return {
        model: new PagedList('rs/sql/singleTable_OrderBy', 30, {items: '"*"', tablename: '"t_userinfo"', orderitem: '"f_userinfo_id  desc"'}),
      }
    },
    props: [],
    ready () {
      this.search()
    },
    methods: {
      search() {
        this.$refs.paged.$refs.cri.search()
      },
      selfSearch (args) {
        args.condition = `${args.condition} and f_filialeids  = '${this.$login.f.f_orgids}'`
        this.model.search(args.condition, args.model)
      }
    }
  }
</script>
