<template>
  <div class="flex-row">
    <div class="basic-main">
      <criteria-paged :model="model" v-ref:paged @sort="sort">
        <criteria partial='criteria' class="search_area" @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-2" style="width: auto;margin-top:8px;float: right">
                <export-excel-safe :data="$parent.$parent.searchData"
                              :field="$parent.$parent.excelHeaders"
                              progress="safeGetExportProgress"
                              sqlurl="rs/logic/SafeExportExcel" sql-name="FilialeCheckCount" template-name='当前周期各公司安检汇总情况'></export-excel-safe>

                <button class="button_spacing button_search" @click="search()">查询</button>
              </div>
            </div>
          </div>
        </criteria>
        <data-grid class="list_area table_sy" style="overflow: hidden" :model="model" 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>
            </tr>
          </template>
          <template partial='body'>

            <td style="text-align: center">{{row.f_orgname}}</td>
            <td style="text-align: center">{{row.hushu}}</td>
            <td style="text-align: center">{{row.yijian}}</td>
            <td style="text-align: center">{{row.weijian}}</td>
            <td style="text-align: center">{{row.ruhu}}</td>
            <td style="text-align: center">{{row.daofang}}</td>
            <td style="text-align: center">{{row.jujian}}</td>
            <td style="text-align: center">{{row.ruhulv}}</td>
            <td style="text-align: center">{{row.anjianlv}}</td>
          </template>
        </data-grid>
      </criteria-paged>
    </div>
  </div>
</template>

<script>
  import {PagedList} from 'vue-client'

  export default {
    title: '总公司安检汇总',
    data() {
      let model = new PagedList('rs/sql/FilialeCheckCount', 20)
      return {
        searchData: {
          condition: "1 = 1"
        },
        model: model,
        //searchData:searchData,
        excelHeaders: {
          'f_orgname': '公司',
          'hushu': '总户数',
          'yijian': '已检户数',
          'weijian': '未检户数',
          'ruhu': '入户数',
          'daofang': '到访不遇数',
          'jujian': '拒检数',
          'ruhulv': '入户率',
          'anjianlv': '安检率',
        }
      }
    },
    methods: {
      refresh() {
        this.$refs.paged.$refs.criteria.search()
      },
      search() {
        this.$refs.paged.$refs.criteria.search()
      },
      selfSearch(args) {
        this.model.search(args.condition, args.model, args.condValue)
      }
    },

    ready() {
      this.search()
    }
  }
</script>
