<template>
  <div>
    <el-button :disabled="data.status != '新建'" type="primary" size="mini" @click="editBtn">编 辑</el-button>
    <el-drawer
      title="我是标题"
      :visible.sync="drawer"
      :with-header="false"
      direction="rtl"
      size="80%"
      append-to-body
      @close="closeDrawer">
      <div>
        <router-view/>
      </div>
    </el-drawer>
  </div>
</template>

<script>
import {mapGetters} from 'vuex'

export default {
  props:['data'],
  data () {
    return {
      drawer:false
    }
  },
  computed: {
    ...mapGetters({
      DrawerShow:'DrawerShow'
    })
  },
  watch: {
    $route (val) {
      // if (val.path == '/submit_mag') {
      //   this.$refs.list.listData()
      // }
    },
    DrawerShow (val) {
      val ? this.drawer = true : this.drawer = false
    }
  },
  methods:{
    closeDrawer () {
      this.$store.dispatch('DrawerShowChange',false)
      this.$router.back()
    },
    editBtn () {
      this.$store.dispatch('DrawerShowChange',true)
      this.$router.push({path:'/editContract',query:{type:this.data.type == '项目' ? this.data.typemx == '直销' ? '直销项目' : '经销项目' : this.data.type ,id:this.data.sa_contractid}})
    }
  },
  created() {
  },
  mounted () {
  }
}

</script>
<style scoped>
/deep/.el-drawer {
  background: #F1F2F3 !important;
}
</style>