<style scoped>
  .bg {
    background-color: blue;
    height: 1px;
    border: 0;
  }
  .app-row {
    background-color: white;
    padding: 10px 10px 0 10px;
    border-bottom: 1px solid rgba(235, 235, 235, 0.5);
  }
  .search_input {
    border: 0;
    outline: none;
  }
  .font{
    font: 15px PingFang-SC-Medium;
    color: #666666;
  }
  .input-font{
    font: 15px PingFang-SC-Medium;
    color: #333333;
  }
  .btn-font{
    font:600 16px PingFang-SC-Bold;
    color: #499EDF;
  }
  .btn-color{
    background-color: #FFFFFF;
    border-radius: 10px ;
    border: 1px solid #499EDF;
  }
  .app-text {
    font-size: 12px;
  }
  .panel-self{
    border-radius: 10px;
    border:1px solid #499EDF;
    background-color: #F8F8F8;
  }
  .yybtn-color{
    background-color:#499edf;
    border-radius: 4px ;
    border: 1px solid #499EDF;
    color: #FFFFFF;
    font: 14px PingFang-SC-Bold;
  }
  .qxbtn-color{
    background-color: #FFFFFF;
    border-radius: 4px ;
    color: #499edf;
    font: 14px PingFang-SC-Bold;
    border: 1px solid #499EDF;
  }
</style>

<template>
  <div class="auto">
    <criteria-paged :model="model" v-ref:paged>
      <criteria partial='criteria' @condition-changed='search' v-ref:cri>
        <div partial>
          <form>
            <div class="auto repair-info-content compatible">
            <div class="row app-row">
              <div class="col-xs-4 col-sm-4 col-md-4 form-input-group mg8">
                <input type="text" class="form-control"
                       placeholder="用户id" v-model="model.f_userinfo_id" condition="  b.f_userinfo_id = '{}'"
                />
              </div>
              <div class="col-xs-4 col-sm-4 col-md-4 form-input-group mg8">

                <input type="text" class="form-control"
                       placeholder="用户名称" v-model="model.f_user_name" condition="  b.f_user_name like '%{}%'"
                />
              </div>
              <div class="col-xs-4 col-sm-4 col-md-4 form-input-group mg8">
                <input type="text" class="form-control"
                       placeholder="住址" v-model="model.f_address"  condition="  c.f_address like '%{}%'"
                >
              </div>
              <div class="col-xs-4 col-sm-4 col-md-4 form-input-group mg8">
                <input type="text" class="form-control"
                       placeholder="手机号" v-model="model.f_user_phone"condition="  b.f_user_phone = '{}'"
                >
              </div>
              <div class="col-xs-6 col-sm-6 col-md-6 form-input-group mg8">
                <v-select placeholder="选择类型"
                          :value.sync="model.f_user_type"
                          v-model="model.f_user_type"
                          :options="$parent.$parent.option"
                          :value-single="true"  condition=" a.f_user_type = '{}'"
                          close-on-select>
                </v-select>
              </div>
            </div>
            <div class="row text-center" style="margin-top: 20px;">
              <button type="button" class="btn btn-lg btn-font btn-color" style="width: 45%;" @click="$parent.$parent.selfSearch">查询</button>
            </div>
            <div style="height:30px;"></div>
            </div>
          </form>
        </div>
      </criteria>
      <list :model="model" partial='list'>
        <div partial>
          <div  class="auto app-text" style="margin-top: 5px;">
            <div class="panel" style="padding: 10px 10px 5px 10px;">
              <div class="panel-body panel-self">
                <div class="row">
                  <p class="panel-title col-xs-4 text-left font">用户编号</p>
                  <p class="panel-title col-xs-8 text-left input-font">{{ row.f_userinfo_id }}</p>
                </div>
                <div class="row">
                  <p class="panel-title col-xs-4 text-left font">用户名称</p>
                  <p class="panel-title col-xs-8 text-left input-font">{{ row.f_user_name }}</p>
                </div>
                <div class="row">
                  <p class="panel-title col-xs-4 text-left font">用户类型</p>
                  <p class="panel-title col-xs-8 text-left input-font">{{ row.f_user_type }}
                  </p>
                </div>
                <div class="row">
                  <p class="panel-title col-xs-4 text-left font">用户住址</p>
                  <p class="panel-title col-xs-8 text-left input-font">{{ row.f_address }}
                  </p>
                </div>
                <div class="row">
                  <p class="panel-title col-xs-4 text-left font">用户电话</p>
                  <p class="panel-title col-xs-8 text-left input-font">{{ row.f_user_phone }}
                  </p>
                </div>
                <div class="row">
                  <p class="panel-title col-xs-4 text-left font">开户时间</p>
                  <p class="panel-title col-xs-8 text-left input-font">{{ row.f_open_date }}
                  </p>
                </div>


              </div>
            </div>
          </div>
        </div>
      </list>
    </criteria-paged>

  </div>
</template>

<script>

  import Vue from 'vue'
  import { PagedList } from 'vue-client'


  export default {
    title: '档案查询',
    data() {
      return {
        option:[{label:"民用",value:"民用"},{label: "非民用",value:"非民用"},],
        model:  new PagedList( 'rs/sql/query_file',3,{condition:'this.condition'}),
        showModal: false,
        param: null,
      }
    },
    ready(){
      //   this.selfSearch()
    },
    methods: {
      search(args) {
        this.model.rows = []
        this.model.search(args.condition, args.model)
      },
      selfSearch () {
        let condition = "1=1"
        if(this.$refs.paged.$refs.cri.model.f_userinfo_id)
          condition += " and b.f_userinfo_id = '"+this.$refs.paged.$refs.cri.model.f_userinfo_id+"'"
        if(this.$refs.paged.$refs.cri.model.f_user_name)
          condition += " and b.f_user_name like  '%"+this.$refs.paged.$refs.cri.model.f_user_name+"%'"
        if(this.$refs.paged.$refs.cri.model.f_address)
          condition += " and c.f_address like  '%"+this.$refs.paged.$refs.cri.model.f_address+"%'"
        if(this.$refs.paged.$refs.cri.model.f_user_phone)
          condition += " and b.f_user_phone =   '"+this.$refs.paged.$refs.cri.model.f_user_phone+"'"
        if(this.$refs.paged.$refs.cri.model.f_user_type)
          condition += " and a.f_user_type =   '"+this.$refs.paged.$refs.cri.model.f_user_type+"'"

        this.model.search(condition);
      },
    }
  }
</script>
