<template>
  <div class="basic__layout__panel">
    <div style="padding:16px 16px 0 16px;" class="flex-align-center flex-between" >
      <div class="flex-align-center ">
        <div class="inline-16" v-if="activeApp" style="font-size:26px;font-weight:300">{{$t(customTitle ? customTitle : activeApp.meta.title)}}&nbsp;
          <div v-if="!customTitle" style="display:inline">
            <img width="20" v-if="showAppCollection()" src="@/assets/icons/incoll.svg" alt="">
            <img width="20" v-else src="@/assets/icons/uncoll.svg" @click="addToAsideBar" alt="">
          </div>
        </div>
        <slot name="titleRight"></slot>
      </div>
      <div>
        <slot name="refresh"></slot>
      </div>
    </div>
    <slot name="content"></slot>
    <drawer></drawer>
  </div>
</template>

<script>

import {mapGetters} from 'vuex'
export default {
  props:['tableName','idName','tableData','apiId','formPath','oldFormPath','options','autoQuery','detailPath','customTitle','hidePagination'],
  components:{
    drawer:() =>  import('./drawerDetail/drawer'),

  },
  computed:{
    ...mapGetters({
      activeApp:'activeApp',
      searchValue:'searchValue',
      menuApp:'menuApp',
    })
  },
  data () {
    return {

    }
  },
  methods:{
    // 创建快捷应用
    async addToAsideBar () {
      const res = await this.$api.requested({
        "classname": "sysmanage.develop.userauthforweb.userauth",
        "method": "create_usershortcuts",
        "content": {
          "systemappid":this.activeApp.systemappid
        }
      })
      this.$store.dispatch('setAppMenu')
    },
    showAppCollection () {
			let _isSame = this.menuApp.some(m=>this.activeApp.name === m.systemapp)
			return _isSame
		},
    refresh () {
      this.$emit('onRefresh')
    }
  },
  mounted () {
  },
  created () {
  }
}

</script>
<style>
.layout-header-panel .el-input-group__append, .el-input-group__prepend{
  background-color: #fff !important;
  color: #999 !important;
  border: 1px solid #dcdfe6 !important;
  cursor: pointer;
}
</style>
<style scoped>

/* .basic__layout__panel{
  padding: 16px 0;
} */
.basic__layout__panel{
  /*height: calc(100vh - 150px);*/
}
.card__list{
  display: flex;
}
.collection{
  color: orange !important;
}
</style>
