<template>
    <criteria-paged :model="model" v-ref:paged>
      <criteria partial='criteria' v-ref:criteria @condition-changed='$parent.searchCondition'>
        <div novalidate class="form-horizontal select-overspread container-fluid auto" partial>
          <div class="col-sm-2">
            <label class="font_normal_body">客户名称</label>
            <input type="text" class="input_search" style="width:60%"
                   v-model="model.f_user_name"
                   placeholder='客户名称'
                   :size="model.f_user_name ? model.f_user_name.length : 6"
                   condition="f_user_name like '%{}%'">
          </div>
          <div class="col-sm-2">
            <label class="font_normal_body">工程编号</label>
            <input type="text" class="input_search" style="width:60%"
                   v-model="model.f_project_code"
                   placeholder='工程编号'
                   :size="model.f_project_code ? model.f_project_code.length : 10"
                   condition="f_project_code like '%{}%'">
          </div>
          <div class="col-sm-2">
            <label class="font_normal_body">联系电话</label>
            <input type="text" class="input_search" style="width:60%"
                   v-model="model.f_phone"
                   placeholder='联系电话'
                   :size="model.f_phone ? model.f_phone.length : 11"
                   condition="f_phone like '%{}%'">
          </div>
          <div class="col-sm-2">
            <label class="font_normal_body">用户地址</label>
            <input type="text" class="input_search" style="width:60%"
                   v-model="model.f_project_address"
                   placeholder='用户地址'
                   :size="model.f_project_address ? model.f_project_address.length : 11"
                   condition="f_project_address like '%{}%'">
          </div>
          <div class="col-sm-2">
            <label class="font_normal_body">报建类型</label>
            <v-select :value.sync="model.f_apply_type" v-model="model.f_apply_type"
                      placeholder='报建类型'
                      value-single="true"
                      :options='$parent.$parent.applyType'
                      close-on-select
                      condition="f_apply_type = '{}'"
            ></v-select>
          </div>
          <div class="col-sm-2">
            <label class="font_normal_body">报建来源</label>
            <v-select :value.sync="model.f_apply_source" v-model="model.f_apply_source"
                      placeholder='报建来源'
                      value-single="true"
                      :options='$parent.$parent.applySource'
                      close-on-select
                      condition="f_apply_source = '{}'"
            ></v-select>
          </div>
          <div class="col-sm-2">
            <label class="font_normal_body">状态</label>
            <v-select :value.sync="model.f_process_state" v-model="model.f_process_state"
                      placeholder='状态'
                      value-single="true"
                      :options='$parent.$parent.processState'
                      close-on-select
                      condition="f_process_state = '{}'"
            ></v-select>
          </div>
          <div class="form-group col-sm-2">
            <label  for="startDate" class="font_normal_body">开始时间</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="f_orderdate >= '{}'">
            </datepicker>
          </div>
          <div class="form-group col-sm-2">
            <label for="endDate" class="font_normal_body">结束时间</label>
            <datepicker id="endDate" placeholder="结束日期"
                        style="width: 60%!important;"
                        v-model="model.endDate"
                        :value.sync="model.endDate"
                        :format="'yyyy-MM-dd 23:59:59'"
                        :show-reset-button="true"
                        condition="f_orderdate <= '{}'">
            </datepicker>
          </div>
          <div class="col-sm-2 form-group" style="float:right">
            <button class="button_search button_spacing" @click="search()" v-el:cba>查询</button>
            <button class="button_search button_spacing" @click="$parent.$parent.clearmsg">清空</button>
            <button class="button_search button_spacing" @click="$parent.$parent.idsearch()" v-el:cba>新增</button>
          </div>
        </div>
      </criteria>
      <data-grid :model="model"
                 partial='list'
                 style="overflow: auto"
                 class="list_area table_sy"
                 v-ref:grid >
        <template partial='head'>
          <tr>
            <th style="text-align:center"><nobr>工程编号</nobr></th>
            <th style="text-align:center"><nobr>客户名称</nobr></th>
            <th style="text-align:center"><nobr>电话</nobr></th>
            <th style="text-align:center"><nobr>地址</nobr></th>
            <th style="text-align:center"><nobr>来源</nobr></th>
            <th style="text-align:center"><nobr>状态</nobr></th>
            <th style="text-align:center"><nobr>报建类型</nobr></th>
            <th style="text-align:center"><nobr>土地获取方式</nobr></th>
            <th style="text-align:center"><nobr>建设规模及内容</nobr></th>
          </tr>
        </template>
        <template partial='body' style="height: 80vh">
          <tr>
            <td style="text-align:center"><nobr>{{ row.f_apply_code }}</nobr></td>
            <td style="text-align:center"><nobr>{{ row.f_user_name }}</nobr></td>
            <td style="text-align:center"><nobr>{{ row.f_phone }}</nobr></td>
            <td style="text-align:center"><nobr>{{ row.f_project_address }}</nobr></td>
            <td style="text-align:center"><nobr>{{ row.f_apply_source }}</nobr></td>
            <td style="text-align:center"><nobr>{{ row.f_process_state }}</nobr></td>
            <td style="text-align:center"><nobr>{{ row.f_apply_type }}</nobr></td>
            <td style="text-align:center"><nobr>{{ row.f_land_acquisition_methods }}</nobr></td>
            <td style="text-align:center"><nobr>{{ row.f_construction_content }}</nobr></td>
          </tr>
        </template>
      </data-grid>
    </criteria-paged>
</template>

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

export default {
  title: '政府报建',
  data () {
    return {
      model: new PagedList('rs/sql/getApplyPushList', 30, null),
      row: null,
      applyType: [{label: '全部', value: ''}, {label: '散户', value: '散户'}, {label: '小区', value: '小区'},{label: '商业', value: '商业'},{label: '工业', value: '工业'}],
      applySource: [{label: '全部', value: ''}, {label: '燃气公司', value: '燃气公司'}, {label: '工建', value: '工建'}],
      handingLinks: [{label: '全部', value: ''}, {label: '报装申请', value: '报装申请'}, {label: '报建受理', value: '报建受理'}, {label: '现场勘察', value: '现场勘察'}, {label: '收费标准', value: '收费标准'}, {label: '报装缴费', value: '报装缴费'}, {label: '合同签订', value: '合同签订'}, {label: '设计出图', value: '设计出图'}, {label: '工程派工', value: '工程派工'}, {label: '工程队派工', value: '工程队派工'}, {label: '监理单位派工', value: '监理单位派工'}, {label: '工程施工', value: '工程施工'}, {label: '点火通气', value: '点火通气'}, {label: '完工', value: '完工'}],
      processState: [{label: '全部', value: ''}, {label: '受理', value: '受理'}, {label: '施工', value: '施工'}, {label: '完工', value: '完工'}],
      criteriaShow: false,
      isdeal: true
    }
  },
  props: {
    id: {
      type: String
    }
  },
  ready () {
    this.search()
  },
  load () {
  },
  watch: {
  },
  methods: {
    search (args) {
      // this.$refs.cp.$refs.cri.search()
      this.$dispatch('search')
    },
    searchCondition (args) {
      args.condition += this.orgcondition ? this.orgcondition : ''
      args.tablename = 't_third_apply'
      console.log('看看是啥', args)
      this.model.search(args.condition, args.model)
      // this.$dispatch('search')
    },
    idsearch () {
      this.$emit('add', '111')
      this.search()
    },
    clearmsg () {
      this.$refs.paged.$refs.criteria.model = {}
    },
    applyDetails (self) {
      console.log('查看报装详情 --- ' + self)
    }
  },
  computed: {
  }
}
</script>
<style scoped>
.form-input-group label {
  text-align: right;
  width: auto;
}
</style>
