<template>
  <div id='app' class="basic-main" style="height: 100%">
    <criteria-paged :model="model" :pager='false'>
      <criteria partial='criteria' @condition-changed='$parent.reSearch' class="search_area">
        <div novalidate class="form-horizontal select-overspread container-fluid auto" partial>
          <div class="row">
            <div class="col-sm-4 form-group">
              <role-selector-safe
                role-name="安检员"
                role-lable="安&ensp;检&ensp;员"
                @re-res="$parent.$parent.getRes"
                :value.sync="model.f_checker_id"
                v-model="model.f_checker_id"
                condition="tcp.f_checker_name = '{}'">
              </role-selector-safe>
            </div>
            <div class="col-sm-2 form-group">
              <label for="startDate" class="font_normal_body">开始日期:</label>
              <datepicker id="startDate" placeholder="开始日期"
                          v-model="model.startDate"
                          :value.sync="model.startDate"
                          style="width: 60%;"
                          :disabled-days-of-Week="[]"
                          :format="'yyyy-MM-dd 00:00:00'"
                          condition="tcp.f_upload_date >= '{}'"
                          :show-reset-button="reset">
              </datepicker>
            </div>
            <div class="col-sm-2 form-group">
              <label for="endDate" class="font_normal_body">结束日期:</label>
              <datepicker id="endDate" placeholder="结束日期"
                          v-model="model.endDate"
                          :value.sync="model.endDate"
                          :disabled-days-of-Week="[]"
                          style="width: 60%;"
                          condition="tcp.f_upload_date <= '{}'"
                          :format="'yyyy-MM-dd 23:59:59'"
                          :show-reset-button="reset">
              </datepicker>
            </div>
            <div class="form-group col-sm-2"  >
              <label class="font_normal_body">小&emsp;&emsp;区</label>
              <input type="text" class="input_search" v-model="model.f_residential_area"
                     style="width: 60%" placeholder="小区" condition="tcp.f_residential_area like '%{}%'">
            </div>
            <div class="col-sm-4 form-group" style="margin-top: 8px">
              <button class="button_search button_spacing" @click="search()">查询</button>
              <report-print id='checkerPrint' top='3cm' left='0' width='100%' height='100%' :preview="true"></report-print>
              <report-excel id='checkerPrint'></report-excel>
            </div>
          </div>
        </div>
      </criteria>
      <div partial='list' id='checkerPrint' class="list_area" style="overflow-y: scroll">
        <table class='tableprint' style="margin: 0px auto">
          <thead>
          <tr>
            <th colspan='9' style="font-weight: normal; text-align: left;">
              <h3 style="text-align: center">隐患类型明细表(民用)</h3>
            </th>
          </tr>
          <tr>
            <th colspan='9' style="font-weight: normal; text-align: center;">
              开始时间：{{model.model.startDate}}&nbsp;&nbsp;&nbsp;
              结束时间：{{ model.model.endDate }}
            </th>
          </tr>
          </thead>
          <tr>
            <th colspan='9' style="font-weight: normal;">
              {{{ model.data.substring(26,model.data.length-8) }}}
            </th>
          </tr>
          <tr style="height: 100px"></tr>
        </table>
      </div>
    </criteria-paged>
  </div>

</template>

<script>
import {DataModel, HttpResetClass} from 'vue-client'

export default {
  title: '隐患类型明细表',
  data () {
    let model = new DataModel('rs/report/areaPitfallReport', {})
    // model.f_filialeid = '(' + this.$login.f.orgid + ')'
    return {
      user_types: [{label:'全部',value:''},{label:'民用',value:'民用'},{label:'非民用',value:'非民用'}],
      userid: this.$login.f.id,
      source: `tool.getFullTree(this.getRights().where(row.getType() != $zone$).where(row.getType() == $organization$))`,
      model: model
    }
  },
  methods: {
    getRes (obj) {
      this.model.f_filialeid = this.$login.convertToIn(obj.resids)
    },
    reSearch(args){
      args.condition += ` and tcp.f_check_type = '民用' `
      this.model.search(args.condition, args.model)
    }
  },
  ready () {
  },
  computed: {
    selected () {
      return this.$refs.grid.selected
    }
  }
}
</script>
