<template>
  <div id="archivesmanage" class="flex-row">
    <div :class="{'basic-main':!isHalf,'binary-left':isHalf}">
      <archives-list v-ref:arealist :style="style" :f_filialeids.sync="f_filialeids" :list-show="isHalf" @select-changed="modify"></archives-list>
    </div>
    <div v-show="listShow" class="binary-right" style="width: 50%">
      <div class="flex">
        <archives-add v-ref:addareamsg :f_filialeids.sync="f_filialeids" :row="row"></archives-add>
      </div>
    </div>
    <div v-if="operateShow" class="binary-right" style="width: 50%">
      <div class="flex">
        <userfiles-list :f_filialeids.sync="f_filialeids" :f_civill_id="f_civill_id"></userfiles-list>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  title: '团缴管理',
  components: {},
  data () {
    return {
      // 分公司id串
      f_filialeids: this.$login.f.f_orgids,
      f_civill_id: null,
      listShow: false,
      operateShow: false,
      row: {},
      style: 'col-sm-3 form-group'
    }
  },
  ready () {
  },
  props: {},
  methods: {
    // archives-add显示
    show1 () {
      this.listShow = true
      this.operateShow = false
    },
    show2 () {
      this.listShow = false
      this.operateShow = true
    },
    modify (row) {
      this.style = 'col-sm-3 form-group'
      this.$refs.addareamsg.areamodel = Object.assign({}, row.val)
      this.show1()
    }
  },
  computed: {
    isHalf () {
      return (this.listShow || this.operateShow)
    }
  },
  events: {
    'add' () {
      this.$refs.addareamsg.areamodelInit()
      this.show1()
    },
    'confirm' () {
      this.$refs.arealist.$refs.paged.$refs.cri.search()
    },
    'cancel' () {
      this.$refs.arealist.$refs.paged.$refs.cri.search()
    },
    'newsearch' () {
      this.listShow = false
      this.operateShow = false
    },
    operate (row) {
      this.f_civill_id = row.id
      this.show2()
    }
  }
}
</script>

