<template>
  <div class="flex-row">
    <div class="basic-main">
      <criteria-paged :model="model" v-ref:cp>
        <criteria partial='criteria' @condition-changed='search' v-ref:cri>
          <div class="form-horizontal select-overspread container-fluid auto" partial>
            <div class="row">
              <div class="form-group col-sm-2">
                <label class="font_normal_body"><strong>报建编号：</strong></label>
                <input type="text" class="input_search" style="width: 60%" v-model="model.f_apply_num"
                       v-on:keyup.enter="$parent.$parent.search()" condition="u.f_apply_num like '%{}%'"
                       placeholder='报建编号'>
              </div>
              <div class="form-group col-sm-2">
                <label class="font_normal_body"><strong>用户名称：</strong></label>
                <input type="text" class="input_search" style="width: 60%" v-model="model.f_user_name"
                       v-on:keyup.enter="$parent.$parent.search()" condition="u.f_user_name like '%{}%'"
                       placeholder='用户名称'>
              </div>
              <div class="form-group col-sm-2">
                <label class="font_normal_body"><strong>电&emsp;&emsp;话：</strong></label>
                <input type="text" class="input_search" style="width: 60%" v-model="model.f_phone"
                       v-on:keyup.enter="$parent.$parent.search()" condition="u.f_phone like '%{}%'"
                       placeholder='电话'>
              </div>
              <div class="form-group col-sm-3 button-range">
                <button class="button_search button_spacing" @click="$parent.$parent.search()" v-el:cx>查询</button>
                <button class="button_clear button_spacing" @click="$parent.$parent.clear()">清空</button>
                <export-excel :data="$parent.$parent.getCondition"
                              :field="$parent.$parent.getfield"
                              sqlurl="rs/logic/applyExportfile"
                              sql-name="getOldDevices"
                              template-name='设备记录信息导出'
                              :choose-col="true"></export-excel>
                <div
                  :class="{'button_shrink_top':$parent.$parent.criteriaShow,'button_shrink_bottom':!$parent.$parent.criteriaShow}"
                  @click="$parent.$parent.criteriaShow = !$parent.$parent.criteriaShow"
                  class="button_spacing"
                  style="float: right">
                </div>
              </div>
            </div>
            <div class="row" v-show="$parent.$parent.criteriaShow">
              <div class="form-group col-sm-2">
                <label class="font_normal_body"><strong>报建类型：</strong></label>
                <v-select
                  v-model="model.f_apply_type"
                  placeholder='请选择'
                  condition="u.f_apply_type = '{}'"
                  :value.sync="model.f_apply_type"
                  :options='$parent.$parent.applytype'
                  class="select select_list"
                  :value-single="true"
                  close-on-select></v-select>
              </div>
              <div class="form-group col-sm-2">
                <label for="startDate" class="font_normal_body"><strong>开始时间：</strong></label>
                <datepicker id="startDate" placeholder="开始日期"
                            style="width: 60%!important;"
                            v-model="model.startDate"
                            :value.sync="model.startDate"
                            :format="'yyyy-MM-dd 00:00:00'"
                            :show-reset-button="true"
                            condition="ct.f_create_date >= '{}'">
                </datepicker>
              </div>
              <div class="form-group col-sm-2">
                <label for="endDate" class="font_normal_body"><strong>结束时间：</strong></label>
                <datepicker id="endDate" placeholder="结束日期"
                            style="width: 60%!important;"
                            v-model="model.endDate"
                            :value.sync="model.endDate"
                            :format="'yyyy-MM-dd 23:59:59'"
                            :sho w-reset-button="true"
                            condition="ct.f_create_date <= '{}'">
                </datepicker>
              </div>
            </div>
          </div>
        </criteria>
        <data-grid :model="model" partial='list' v-ref:grid style="overfl'榆林.'uto" class="list_area table_sy">
          <template partial='head'>
            <tr>
              <th style="white-space: nowrap;">序号</th>
              <th style="white-space: nowrap;">用户名称</th>
              <th style="white-space: nowrap;">施工合同编号</th>
              <th style="white-space: nowrap;">供气合同编号</th>
              <th style="white-space: nowrap;">电话</th>
              <th style="white-space: nowrap;">火眼</th>
              <th style="white-space: nowrap;">小火眼</th>
              <th style="white-space: nowrap;">壁挂炉</th>
              <th style="white-space: nowrap;">家用灶</th>
              <th style="white-space: nowrap;">热水器</th>
              <th style="white-space: nowrap;">采暖炉</th>
              <th style="white-space: nowrap;">茶水炉</th>
              <th style="white-space: nowrap;">蒸车</th>
              <th style="white-space: nowrap;">蒸汽发生器</th>
              <th style="white-space: nowrap;">灶具</th>
              <th style="white-space: nowrap;">压缩机</th>
              <th style="white-space: nowrap;">模块炉</th>
              <th style="white-space: nowrap;">单位(KW)</th>
              <th style="white-space: nowrap;">锅炉单位(MW)</th>
              <th style="white-space: nowrap;">锅炉吨位(T)</th>
              <th style="white-space: nowrap;">报建编号</th>
              <th style="white-space: nowrap;">合同状态</th>
              <th style="white-space: nowrap;">报建类型</th>
              <th style="white-space: nowrap;">报建性质</th>
              <th style="white-space: nowrap;">安装处数</th>
            </tr>
          </template>
          <template partial='body'>
            <tr>
              <td style="text-align: center;">
                <nobr><font>{{ $index + 1 }}</font></nobr>
              </td>
              <td style="text-align: center;">
                <nobr><font>{{ row.f_user_name }}</font></nobr>
              </td>
              <td style="text-align: center;">
                <nobr><font>{{ row.f_entrust_contract_number }}</font></nobr>
              </td>
              <td style="text-align: center;">
                <nobr><font>{{ row.f_contract_number }}</font></nobr>
              </td>
              <td style="text-align: center;">
                <nobr><font>{{ row.f_phone }}</font></nobr>
              </td>
              <td style="text-align: center;">
                <nobr><font>{{ row.huoyan }}</font></nobr>
              </td>
              <td style="text-align: center;">
                <nobr><font>{{ row.xiaohuoyan }}</font></nobr>
              </td>
              <td style="text-align: center;">
                <nobr><font>{{ row.bigualu }}</font></nobr>
              </td>
              <td style="text-align: center;">
                <nobr><font>{{ row.jiayongzao }}</font></nobr>
              </td>
              <td style="text-align: center;">
                <nobr><font>{{ row.reshuiqi }}</font></nobr>
              </td>
              <td style="text-align: center;">
                <nobr><font>{{ row.cainuanlu }}</font></nobr>
              </td>
              <td style="text-align: center;">
                <nobr><font>{{ row.chashuilu }}</font></nobr>
              </td>
              <td style="text-align: center;">
                <nobr><font>{{ row.zhengche }}</font></nobr>
              </td>
              <td style="text-align: center;">
                <nobr><font>{{ row.zhengqifashengqi }}</font></nobr>
              </td>
              <td style="text-align: center;">
                <nobr><font>{{ row.zaoju }}</font></nobr>
              </td>
              <td style="text-align: center;">
                <nobr><font>{{ row.yasuoji }}</font></nobr>
              </td>
              <td style="text-align: center;">
                <nobr><font>{{ row.mokuailu }}</font></nobr>
              </td>
              <td style="text-align: center;">
                <nobr><font>{{ row.danweikw }}</font></nobr>
              </td>
              <td style="text-align: center;">
                <nobr><font>{{ row.danweimw }}</font></nobr>
              </td>
              <td style="text-align: center;">
                <nobr><font>{{ row.dunwei }}</font></nobr>
              </td>
              <td style="text-align: center;">
                <nobr><font>{{ row.f_apply_num }}</font></nobr>
              </td>
              <td style="text-align: center;">
                <nobr><font>{{ row.f_contract_state }}</font></nobr>
              </td>
              <td style="text-align: center;">
                <nobr><font>{{ row.f_apply_type }}</font></nobr>
              </td>
              <td style="text-align: center;">
                <nobr><font>{{ row.f_apply_nature }}</font></nobr>
              </td>
              <td style="text-align: center;">
                <nobr><font>{{ row.f_install_count }}</font></nobr>
              </td>
            </tr>
          </template>
        </data-grid>
      </criteria-paged>
    </div>
  </div>
</template>

<script>
import {PagedList} from 'vue-client'
export default {
  title: '原报建设备列表',
  data () {
    return {
      model: new PagedList('rs/sql/getOldDevices', 20, {
        data: {
          f_filiale: "榆林."+this.$login.f.orgs
        }
      }),
      applytype: [{label: '全部', value: ''}, ...this.$appdata.getParam('报建类型')?this.$appdata.getParam('报建类型'):[]],
      criteriaShow: false,
      getfield: {
        'f_apply_num': ' 报 建 编 号 ',
        'f_user_name': ' 用 户 名 称 ',
        'f_contact': '  联 系 人  ',
        'f_address': '      地        址     ',
        'f_phone': '  电      话  ',
        'f_apply_type': ' 报 建 类 型 ',
        'f_apply_nature': ' 报建性质 ',
        'f_install_count': ' 安装处数 ',
        'huoyan': ' 火眼 ',
        'xiaohuoyan': ' 小火眼 ',
        'bigualu': ' 壁挂炉 ',
        'jiayongzao': ' 家用灶 ',
        'reshuiqi': ' 热水器 ',
        'cainuanlu': ' 采暖炉 ',
        'chashuilu': ' 茶水炉 ',
        'zhengche': ' 蒸车 ',
        'zhengqifashengqi': ' 蒸汽发生器 ',
        'zaoju': ' 灶具 ',
        'yasuoji': ' 压缩机 ',
        'mokuailu': ' 模块炉 ',
        'danweikw': ' 锅炉单位(KW) ',
        'danweimw': ' 锅炉单位(MW) ',
        'dunwei': ' 锅炉吨位(T) ',
        'f_entrust_contract_number': '施工合同编号',
        'f_contract_number': '供气合同编号',
        'f_create_date': '合同创建日期',
        'f_due_money': ' 合同金额 ',
        'f_contract_state': '合同状态',
        'f_budget_money': '税额'

      }
    }
  },
  ready () {
    // 调用查询
    this.search()
  },
  methods: {
    clear () {
      Object.keys(this.$refs.cp.$refs.cri.model).forEach((key) => {
        this.$refs.cp.$refs.cri.model[key] = []
      })
    },
    // 查询
    search () {
      this.$refs.cp.$refs.cri.search()
    }
  },
  computed: {
    getCondition () {
      return {
        condition: this.$refs.cp.$refs.cri.condition,
        data: {
          f_filiale: "榆林."+this.$login.f.orgs
        }
      }
    }
  }
}
</script>

<style scoped>
</style>
