<template>
  <modal :show.sync="isshow" :width='width'  v-ref:modal backdrop="false">
    <header slot="modal-header" class="modal-header">
      <button type="button" class="close" @click="closeTree"><span>&times;</span></button>
      <h4 class="modal-title">地址管理</h4>
    </header>
    <article slot="modal-body" class="modal-body">
      <div class="from-group" style="height: 450px;overflow: auto;">
        <address-tree :f_location="f_location" :isquery="isquery" :isinspect="true" :isbasch="isbasch" v-ref:addresstree></address-tree>
        <!--<address-select v-if="isselect" :f_location="f_location" v-ref:addressSelect  :show="showType" :value="value"  @re-ref="selectclick"></address-select>-->
      </div>
    </article>
    <footer slot="modal-footer">
      <button  type="button" class="btn btn-success" @click='confirm'>确认</button>
    </footer>
  </modal>
</template>

<script>
  export default {
    name: "AddressModel",
    title: '地址管理弹窗',
    props: {
      // 地址查询方式
      isquery: {
        type: Boolean,
        default: true,
      },
      //位置信息
      f_location: {
        type: Object,
        default: {
          f_locationId: '1535',
          f_locationType: 't_organization',
        }
      },
      //是否显示
      isshow: {
        type: Boolean,
        default : false,
      },
      // 是否选中
      isselect: {
        type: Boolean,
        default: false,
      },
      // 默认显示地址
      value:{
        type: Object
      },
      // 下拉选择 || 树选择
      showType: {
        type: Boolean,
        default: false
      },
      // 是否显示批量添加
      isbasch: {
        type: Boolean,
        default: true,
      }
    },
    data(){
      return{
        width: '90%'
      }
    },
    methods:{
      confirm(){
        this.$emit('addressno')
      },
      // 关闭 弹窗
      closeTree() {
        this.isshow = false
        this.$emit('addressno')
      }
      // 选中
      // selectclick(newobj, address) {
      //   this.$emit('re-ref', newobj, address)
      // }
    },
    watch:{
      //显示改变且为true
      'isshow'(val){
        if(val){
          //刷新数据
          this.$refs.addresstree.init()
        }
      }
    }
  }
</script>

<style scoped>

</style>
