<template>
  <el-dialog title="新增附件信息" :visible.sync="visible" width="85%" append-to-body>
    <edit-document ref="editDocumentRef" :toolId="toolId" @docSubmitData="editDocumentSubmit" :relatedTool="false"/>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" icon="el-icon-check" @click="submitForm()">保 存</el-button>
      <el-button icon="el-icon-close" @click="cancel()">关 闭</el-button>
    </div>
  </el-dialog>
</template>
<script>
import editDocument from "../document/editDocument";
export default {
  components: {
    editDocument
  },
  props: {
    /**
     * 控制显示/隐藏
     */
    show: {
      type: Boolean,
      default: false
    },
    /**
     * 工具id
     */
    toolId: {
      type: String,
      default: ''
    }
  },
  computed: {
    visible: {
      get() {
        return this.show
      },
      set(val) {
        this.$emit('update:show', false)
      }
    }
  },
  data () {
    return {

    }
  },
  methods: {
    editDocumentSubmit(data){
      this.$emit("addFileData", data)
      this.visible = false
    },
    cancel() {
      this.$refs.editDocumentRef.cancel()
      this.visible = false
    },
    submitForm(){
      this.$refs.editDocumentRef.assembleSubmit()
    },
    resetForm(){
      this.$refs.editDocumentRef.resetForm()
    }
  }
}
</script>
