<template>
  <div class="flex">
    <criteria-paged :model="model" v-ref:paged>
      <criteria partial='criteria' @condition-changed='$parent.selfSearch' v-ref:criteria>
        <div novalidate class="form-horizontal select-overspread container-fluid auto" partial>
          <div class="row">
            <div class="form-group col-sm-3" >
              <label class="font_normal_body">用户姓名</label>
              <input type="text" class="input_search" style="width:60%" v-model="model.f_user_name" placeholder='用户姓名'
                     condition="re.f_user_name like '%{}%'" @keyup.enter="search()">
            </div>
            <div class="form-group col-sm-3" >
              <label class="font_normal_body">用户电话</label>
              <input type="text" class="input_search" style="width:60%" v-model="model.f_user_phone" placeholder='用户电话'
                     condition="re.f_user_phone like '%{}%'" @keyup.enter="search()">
            </div>
            <div class="form-group col-sm-3" >
              <label class="font_normal_body">用户满意度</label>
              <input type="text" class="input_search" style="width:60%" v-model="model.f_reply_type" placeholder='用户满意度'
                     condition="sm.f_reply_type = '{}'" @keyup.enter="search()">
            </div>
            <div class="form-group col-sm-3 button-range" >
              <button class="button_search" style="margin-right: 10px"  @click="search()" v-el:cba>查询</button>
            </div>
          </div>
        </div>
      </criteria>
      <data-grid :model="model" class="table_sy"  partial='list' v-ref:grid >
        <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>
          </tr>
        </template>
        <template partial='body' >
          <tr >
            <td style="text-align:center;">{{$index+1}}</td>
            <td style="text-align:center">{{row.f_user_name}}</td>
            <td style="text-align:center">{{row.f_user_type}}</td>
            <td style="text-align:center">{{row.f_user_phone}}</td>
            <td style="text-align:center;white-space: nowrap;">{{row.f_address}}</td>
            <td style="text-align:center">{{row.f_sendtime}}</td>
            <td style="text-align:center">{{row.f_last_check_state}}</td>
            <td style="text-align:center">{{row.state}}</td>
            <td style="text-align:center">{{row.f_reply_time}}</td>
            <td style="text-align:center">{{row.f_reply_content}}</td>
            <td style="text-align:center">{{row.f_reply_time}}</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('api/af-safecheck/sql/getMessage', 50, {}),
      }
    },
    ready () {
      this.model.search("1=1")
      console.log(this.model)
    },
    methods: {
      search () {
        this.$refs.paged.$refs.criteria.search()
      },
      selfSearch (args) {
        // args.condition = `${args.condition} and f_price_id = '${this.priceid}'`
        console.log("11111111111111111")
        //console.log(this.checkrow,this.$parent.$refs.list,'cew')
        var cc= this.model.condition
        console.log(this.model.condition)
        console.log(cc)
        this.condition = args.condition
        args.condition=args.condition
        console.log( this.condition,args.condition)


        console.log( this.condition,args.condition)
        this.model.search(args.condition)
      }
    },
    watch: {
      'checkrow' () {
        this.search()
      }
    },

  }
</script>
