<template >
  <div id="pc-finduser-page" class="bg-white p-10">
    <criteria-paged :model="model" v-ref:paged v-if="!show">
      <criteria partial='criteria' v-ref:criteria  @condition-changed='$parent.selfsearch'>
        <div novalidate class="form-horizontal select-overspread container-fluid auto" partial>
          <div class="col-sm-3 form-group form-input-group" style="width: 10%" >
            <label class="font_normal_body" style="width: 35%">回访人</label>
            <input  type="text" class="form-control" v-model="model.f_visitman" placeholder='回访人'
            condition="f_visitman like '%{}%'"
            :size="model.f_visitman ? model.f_visitman.length : 6">
          </div>
          <div class="col-sm-3 form-group form-input-group" style="width: 20%">
            <label class="font_normal_body" style="width: 25%">电话号码</label>
            <input  type="text" class="form-control" v-model="model.f_phone" placeholder='电话号码'
            condition="f_phone like '%{}%'"
            :size="model.f_phone ? model.f_phone.length * 2 : 8">
          </div>

          <div class="col-sm-3 form-group form-input-group" style="width: 20%">
            <label class="font_normal_body" style="width: 25%">回访时间</label>
            <datepicker  placeholder="回访时间"
              v-model="model.comingtime"
              :value.sync="model.comingtime"
              condition="f_visitdate > '{}'"
              :format="'yyyy-MM-dd 00:00:00'"
              ></datepicker>
          </div>
          <div class="col-sm-3 form-group form-input-group" style="width: 20%">
            <label class="font_normal_body" style="width: 25%">至</label>
            <datepicker  placeholder="回访时间"
              v-model="model.endtime"
              :value.sync="model.endtime"
              condition="f_visitdate <  '{}'"
              :format="'yyyy-MM-dd 23:59:59'"
              ></datepicker>
          </div>
          <div class="col-sm-3 form-group form-input-group" style="width: 19%;margin-left: 10px">
            <button type="button" name="button" class="button_search button_spacing" @click='search()' >查询</button>
            <button type="button" name="button" class="button_search button_spacing" @click="$parent.$parent.clearmsg">置空</button>
          </div>
        </div>
      </criteria>
      <data-grid :model="model" partial='list' v-ref:grid class="list_area table_sy"  classname="table tablenew table-bordered table-striped table-hover">
        <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' >
          <td style="text-align: center"><nobr>{{$index + 1}}</nobr></td>
          <td style="text-align: center"><nobr>{{row.f_visitman}}</nobr></td>
          <td style="text-align: center"><nobr>{{row.f_phone}}</nobr></td>
          <td style="text-align: center"><nobr>{{row.f_visitdate}}</nobr></td>
          <td style="text-align: center"><nobr>{{row.f_type}}</nobr></td>
          <td style="text-align: center"><nobr>{{row.f_remarks}}</nobr></td>
          <td style="text-align: center"><nobr>{{row.f_qualitycore}}</nobr></td>
          <td style="text-align: center"><nobr>{{row.f_servicescore}}</nobr></td>
          <td style="text-align: center"><nobr>{{row.f_user_name}}</nobr></td>
          <td style="text-align: center"><nobr>{{row.f_address}}</nobr></td>
          <td style="text-align: center"><nobr>{{row.f_rvisit_source}}</nobr></td>
        </template>
      </data-grid>
     </criteria-paged>
  </div>
  <!--<div v-if="show">-->
    <!--<modal :show.sync="show" v-ref:modal backdrop="false">-->
      <!--<header slot="modal-header" class="modal-header">-->
        <!--<h2 class="modal-title">正在播放{{wavflie}}语音文件</h2>-->
      <!--</header>-->
      <!--<article slot="modal-body" class="modal-body">-->
        <!--<audio controls>-->
          <!--<source src="{{'/Dual/GetWAV/'+ wavflie +'.wav'}}" type="audio/wav" >-->
          <!--您的浏览器不支持 audio 元素。-->
        <!--</audio>-->
      <!--</article>-->
      <!--<footer slot="modal-footer" class="modal-footer">-->
        <!--<button  type="button" class="btn btn-default" @click='closemodel'>返回</button>-->
      <!--</footer>-->
    <!--</modal>-->
  <!--</div>-->
</template>

<script>
import { PagedList } from 'vue-client'
export default {
  title: '回访记录',
  data () {
    return {
      model: new PagedList('api/af-safecheck/sql/singleTable_OrderBy', 20, {items: "'*'", tablename: "'t_telvisit'",
        orderitem: "'f_visitdate desc'"}),
      row: null,
      show: false,
      wavflie: '',
      orderMan: '',
      msgs: [],
      service: Object,
      pendingCount: 0,
      serobj:Object
    }
  },
  ready () {
    this.model.search(`1=1 and f_rvisit_source='安检回访'`)
  },
  methods: {
    //置空 查询条件
    clearmsg(){
      this.$refs.paged.$refs.criteria.model={}
    },
    playWav(val){
      this.wavflie=val;
      this.show = true
    },
    closemodel () {
      this.wavflie='';
      this.show = false
    },
    // search () {
    //   this.model.rows = []
    //   this.$refs.paged.$refs.criteria.search()
    // }
    selfsearch (args) {
      args.condition = `${args.condition} and f_rvisit_source='安检回访'`
      this.model.search(args.condition, args.model, args.condValue)
    }
  },
  computed: {
    types () {
      return [{label: '全部', value: ''}, ...this.$appdata.getParam('回访类型')]
    }
  }
}
</script>
