<template>
  <div>
    <el-button size="small" icon="el-icon-plus" @click="createFolder">新建文件夹</el-button>
  </div>
</template>

<script>
export default {
  data () {
    return {
      params:{
        "classname": "system.attachment.MediaCenter",
        "method": "createFolder",
        "content": {
            "foldername": "文件夹名称",
            "parentid": ''
        }
      }
    }
  },
  methods:{
    createFolder () {
      this.$emit('addClick')
    },
    async createFolderComplete (folder) {
      let id = this.$route.query.id?this.$route.query.id:0
      this.params.content.parentid = id
      this.params.content.foldername = folder.document
      const res = await this.$api.requested(this.params)
      if (res.code === 1) {
        this.$emit('onSuccess')
        this.$message({
          message:'新建文件夹成功',
          type:'success'
        })
      } else {
        this.$message({
          message:res.data,
          type:'error'
        })
      }
    }
  }
}

</script>
<style>
</style>