<template>
  <el-dialog
    v-loading="loading"
    v-if="dialogVisible"
    :append-to-body="appendToBody"
    :visible.sync="dialogVisible"
    title="编辑">
    <el-input v-model="name" placeholder="请输入内容"/>
    <div slot="footer" class="dialog-footer">
      <el-button @click="goBack">取 消</el-button>
      <el-button type="primary" @click="save">确 定</el-button>
    </div>
  </el-dialog>
</template>

<style>
.custom-tree-node {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  padding-right: 8px;
}
</style>

<script>
import Pagination from '@/components/Pagination'
import waves from '@/directive/waves'
import uploadFile from '../../../components/UploadFile'

export default {
  components: { uploadFile, Pagination },
  directives: { waves },
  props: {
    appendToBody: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      dialogVisible: false,
      loading: false,
      name: '',
      e: {}
    }
  },
  methods: {
    init(e) {
      this.e = e
      if (e) {
        this.name = e.NAME
      }
      this.dialogVisible = true
    },
    goBack() {
      this.dialogVisible = false
    },
    save() {
      if (!this.name) {
        this.$message.error('节点名称必填!')
        return
      }
      this.e.NAME = this.name
      this.$emit('getResult', this.e)
      this.dialogVisible = false
    }
  }
}

</script>
