<template>
  <div class="auto">
    <div class="auto">
      <criteria-paged :model="model" v-ref:paged>
        <criteria partial='criteria' @condition-changed='search' v-ref:cri>
          <div partial>
            <form>
                <div class="row col-xs-12 col-sm-12 col-md-6 app-row">
                <div class="row col-xs-12 col-sm-6">
                  <div class="col-xs-4 col-sm-4 col-md-4">
                    <img src="../../assets/档案信息.png" style="width: 20px;margin-bottom: 5px" alt="">
                    <label for="f_plan_name" class="font text-left">小区名称：</label>
                  </div>
                  <div class="col-xs-8 col-sm-8" >
                    <input id="f_plan_name" class="search_input input-font"
                           v-model="model.F_RESIDENTIAL_AREA" condition="F_RESIDENTIAL_AREA like '%{}%'" />
                  </div>
                </div>
                <div class="row col-xs-12 col-sm-6">
                  <div class="col-xs-4 col-sm-4 col-md-4">
                    <img src="../../assets/档案信息.png" style="width: 20px;margin-bottom: 5px" alt="">
                    <label for="f_plan_name" class="font text-left">街道：</label>
                  </div>
                  <div class="col-xs-8 col-sm-8">
                    <input id="f_plan_name" class="search_input input-font"
                           v-model="model.f_street" condition="f_street like '%{}%'" />
                  </div>
                </div>
                <div class="row col-xs-12 col-sm-6">
                  <div class="col-xs-4 col-sm-4 col-md-4">
                    <img src="../../assets/档案信息.png" style="width: 20px;margin-bottom: 5px" alt="">
                    <label for="f_plan_name" class="font text-left">小区ID：</label>
                  </div>
                  <div class="col-xs-8 col-sm-8">
                    <input id="f_plan_name" class="search_input input-font"
                           v-model="model.oldid" condition="oldid = '{}'" />
                  </div>
                </div>

              </div>
              <div class="row app-row">
              </div>
              <div class="row col-xs-12 col-sm-12 col-md-6 text-center" style="margin-top: 20px;">
                <button type="button" class="btn btn-lg btn-font btn-color" style="width: 45%;" @click="search">查询</button>
              </div>
              <!--<div class="row col-xs-12 col-sm-12 col-md-6 app-btn">-->
              <!--<button class="btn btn-primary col-xs-6" type="button"  @click="search"><span class="glyphicon  glyphicon-search" style="margin-right: 20px;">查询</span></button>-->
              <!--</div>-->
              <div style="height:30px;"></div>
            </form>
          </div>
        </criteria>
        <list :model="model" partial='list'>
          <div partial>
            <div class="auto app-text"  @click="$parent.$parent.$parent.inspect(row)" style="margin-top: 5px;" >
              <div class="panel" style="padding: 10px 10px 5px 10px;">
                <div class="panel-body panel-self">
                  <div class="row col-xs-12 col-sm-12 col-md-6">
                    <p class="panel-title col-xs-4 col-sm-4 col-md-4 text-left font">小区名称</p>
                    <p class="panel-title col-xs-8 text-left input-font">{{ row.f_residential_area }}</p>
                  </div>
                  <div class="row col-xs-12 col-sm-12 col-md-6">
                    <p class="panel-title col-xs-4 col-sm-4 col-md-4 text-left font">街道</p>
                    <p class="panel-title col-xs-8 text-left input-font">{{row.f_street}}</p>
                  </div>
                  <div class="row col-xs-12 col-sm-12 col-md-6">
                    <p class="panel-title col-xs-4 col-sm-4 col-md-4 text-left font">小区ID</p>
                    <p class="panel-title col-xs-8 text-left input-font">{{row.oldid}}</p>
                  </div>
                  <!--</div>-->
                  <div class="row col-xs-12 col-sm-12 col-md-6 text-right">
                    <!--<button type="button" class="btn yybtn-color" v-on:click.stop.prevent='$parent.$parent.$parent.deletePlan(row)' v-if="!$parent.$parent.$parent.isDown(row)">清空</button>&nbsp;-->
                    <!--<button type="button" class="btn yybtn-color" v-on:click.stop.prevent='$parent.$parent.$parent.createUserInfo(row)' v-if="!$parent.$parent.$parent.isDown(row)">生成档案</button>&nbsp;-->
                  </div>
                </div>
              </div>

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

    <back-page :need-back='true'  @flag="$back()"></back-page>
  </div>

</template>
<script>
  import AppData from '../../stores/AppData'
  import { PagedList } from 'vue-client'
  import * as Util from '../Util'
  import co from 'co'
  import Vue from 'vue'

  export default {
    title: '计划下载',
    data () {
      return {
        model: new PagedList( `${this.$androidUtil.getProxyUrl()}/rs/sql/AreaPublicityGetAreaInfo`,20,
          {}),
        checkPlanInfo: [],
        localArea:[],
        showAddPlan:false,
        row:''
      }
    },
    ready () {
      // Vue.user.f_fengongsi = '中海油.海南分公司'
      // this.getlocalArea()
    },
    methods: {
      inspect(row){
        console.log('rowrow:row',row)
        let value = this.$androidUtil.path({alias: 'getLocalAreaPub', data:{f_area_id:row.id}})
        if(value.code == 200)
          this.$goto('take-photo',{row: row,pictureinfo:value.data},'self')
      },
      reload(){
        console.log('页面刷新 ')
        this.$refs.paged.loadPage(this.$refs.paged.model.pageIndex)
      },
      addPlanItem (row) {
        this.showAddPlan = true
        this.row = row
        if(this.row.f_residential_area != " ")
          this.addPlan.f_residential_area = this.row.f_residential_area
        if(this.row.f_street != " ")
          this.addPlan.f_street = this.row.f_street
      },
      logicWithHint(logic, data, callback, backresult) {
        HostApp.logicWithHint({
          // logic别名，key必须为logic
          'logic': logic,
          // 回调执行方法名，key必须为callback
          'callback': callback,
          // logic执行需要的业务参数
          'data': data,
          // 固定key，代表是否将logic执行结果作为参数传入回调方法，1代表true，0代表false，
          // 执行回调方法传入key为backresult
          // 如需额外拼接参数，写在logic返回值的params，例如xxlogic返回:{"params": "success"}
          'backresult': backresult
        })
      },
    },
    computed:{
      isDown(){
        return function (row) {
          console.log('当前小区===》'+JSON.stringify(row))
          for (let info of this.localArea) {
            console.log('infoinfoinfo===>'+JSON.stringify(info))
            if(info.f_area_id == row.id){
              return false
            }
          }
          return true
        }
      }
    }
  }
</script>
<style>
  .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>
