<template>
  <el-button :disabled="disabled"  @click.stop="delClickHandler" title="删除"  :priv="'com.zving.cms.Catalog.Delete.'+catalogId" class="table-operate-icon">
    <i class="fa fa-remove f16"></i>删除
  </el-button>
</template>
<script>
import util from '@src/common/util.js'
export default {
  props: {
    catalogId: {
      type: Number,
      default: 0,
      required: true
    },
    disabled: {
      type: Boolean,
      default: false,
      required: false
    }
  },
  data() {
    return {
      isShowModal: false,
      submitLoading: false,
      cleanChildren: false //  是否包含子栏目
    }
  },
  methods: {
    async delClickHandler() {
      if (!this.catalogId) {
        return
      }
      try {
        await this.$confirm('警告：您确认要删除这个栏目吗？', '系统提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        })
        let res = await axios.delete(`/ui/catalogs/${this.catalogId}`)
        if (res.data.status === 2) {
          await util.showProgress(res.data.taskID, `正在删除[` + res.data.name + `]栏目`)
          this.$emit('callback', 'del')
        } else {
          util.showMessage(res)
        }
      } catch (e) {

      }
    }
  }
}
</script>

<style scoped>

</style>
<style>
.similar-catalog-dlg .el-dialog{
  width:500px;
}
@media (max-width:480px){
  .similar-catalog-dlg .el-dialog{
    width:96%;
  }
}
</style>
