<template>
  <div>
    <div id="h">
      <criteria-paged :model="model">
        <criteria partial='criteria' v-ref:search @condition-changed='search'>
          <div novalidate class="form-inline auto" partial>
            <div class="form-group">
              <!-- 营业网点:
              <v-select :value.sync="model.network"
                  :options='$parent.$parent.network' placeholder='请选择'
                  close-on-select clear-button
                  v-model="model.network"></v-select>
              操作员姓名:
              <v-select :value.sync="model.operator"
                  :options='$parent.$parent.operator' placeholder='请选择'
                  close-on-select clear-button
                  v-model="model.operator"></v-select> -->
              <label for="startDate">开始日期:</label>
              <datepicker id="startDate" placeholder="开始日期"
                          v-model="model.startDate"
                          :value.sync="model.startDate"
                          :disabled-days-of-Week="[]"
                          :format="'yyyy-MM-dd'"
                          :show-reset-button="reset">
              </datepicker>
              <label for="endDate">结束日期:</label>
              <datepicker id="endDate" placeholder="开始日期"
                          v-model="model.endDate"
                          :value.sync="model.endDate"
                          :disabled-days-of-Week="[]"
                          :format="'yyyy-MM-dd'"
                          :show-reset-button="reset">
              </datepicker>
              <label for="f_outlets">营业网点:</label>
              <v-select :value.sync="model.outlets" v-model='model.outlets'
                        :options='$parent.$parent.outlets' placeholder='营业网点'
                        default-value="['']"
                        close-on-select v-el:cc></v-select>
              <button class="btn btn-default" @click="search()">查询</button>
              <report-print id='gongyee' top='1cm' left='1cm' width='100%' height='100%'></report-print>
              <report-excel id='gongyee'></report-excel>
            </div>
          </div>
        </criteria>

        <div partial='list' id='gongyee'>
          <data-grid :model="model" classname="reporttable" partial='list'>
            <template partial='head'>
              <tr>
                <th colspan='11' style="border: 1px solid white; border-bottom: 1px solid black; text-align: center;">
                  <h1 align="center">维修员日报表</h1>
                </th>
              </tr>
              <tr>
                <th rowspan="2">姓名</th>
                <th rowspan="2">日派单量</th>
                <th rowspan="2">完成量</th>
                <th rowspan="2">入户量</th>
                <th rowspan="2">入户率(%)</th>
                <th rowspan="2">入户平均时长(min)</th>
                <th rowspan="2">入户总时长(min)</th>
                <th colspan="2">工单处理时效</th>
                <th colspan="2">工单处理数量</th>
              </tr>
              <tr>
                <th>紧急</th>
                <th>非紧急</th>
                <th>紧急</th>
                <th>非紧急</th>
              </tr>
            </template>
            <template partial='body'>
              <tr>
                <td style="text-align: center;">{{row.f_name}}</td>
                <td style="text-align: center;">{{row.dowork+row.notwork+row.repwork}}</td>
                <td style="text-align: center;">{{row.dowork}}</td>
                <td style="text-align: center;">{{row.dowork-row.notintohome}}</td>
                <td style="text-align: center;">{{(((row.dowork-row.notintohome)/(row.dowork+row.notwork+row.repwork))*100).toFixed(0)+'%'}}</td>
                <td style="text-align: center;">{{(row.dowork)===0?0:(row.sumworkminite/row.dowork).toFixed(0)}}</td>
                <td style="text-align: center;">{{row.sumworkminite}}</td>
                <td style="text-align: center;">{{(row.countjingjitime)===0?0:(row.summinite/row.countjingjitime)}}</td>
                <td style="text-align: center;">{{(row.counallitime-row.countjingjitime)===0?0:((row.allsumminite-row.summinite)/(row.counallitime-row.countjingjitime))}}</td>
                <td style="text-align: center;">{{row.countjingjitime}}</td>
                <td style="text-align: center;">{{row.counallitime-row.countjingjitime}}</td>
              </tr>
            </template>
          </data-grid>
        </div>
      </criteria-paged>
    </div>

</template>
<script>
  import { PagedList } from 'vue-client'
  import AppData from '../../stores/AppData'
  export default {
    title: '维修员日报表',
    data () {
      return {
        model: new PagedList('rs/sql/getRepairDayNum', 20, {startDate: 'this.model.startDate',endDate:'this.model.endDate',outlets:'this.model.outlets[0]'})
      }
    },
    computed: {
      outlets () {
        return [{label: '全部', value: ''}, ...AppData.getParam('营业网点')]
      }
    },
  }
</script>
