<template>
  <!--新增 / 编辑 表单组件-->
  <el-dialog class="preview-dialog" :modal-append-to-body="false" :close-on-click-modal="false" :before-close="handleClose" :visible="formVisible" :title="formTitle">
    <span class="dialog-right-top" />
    <span class="dialog-left-bottom" />
    <div class="setting-dialog">
      <!-- form -->
      <!-- <PreviewForm ref="previewForm" :form-preview-data.sync="formPreviewData" :selected-category="selectedCategory" :parents-id="parentsId" :arc-id="arcId" :is-des-form-type="isDesFormType" @emitTableList="getTableList" /> -->
      <div slot="footer" class="dialog-footer">
        <!-- :loading="crud.status.cu === 2"  -->
        <el-button type="text" @click="formVisible = false">取消</el-button>
        <el-button type="primary" @click="formVisible = false">确定</el-button>
      </div>
    </div>
  </el-dialog>
</template>

<script>
// import PreviewForm from '@/views/components/category/PreviewForm'
export default {
  // components: { PreviewForm },
  data() {
    return {
      formVisible: false,
      formTitle: '新增文件',
      loading: false
    }
  },
  methods: {
    handleClose(done) {
      done()
    },
    save() {
      // this.loading = true
      // if (this.title === '新增文件') {
      //   const addData = this.formData.fields.map((item) => {
      //     return {
      //       dictionaryId: item.id,
      //       fieldName: item.fieldName,
      //       fieldCnName: item.fieldCnName,
      //       connector: item.connector,
      //       categoryId: item.categoryId
      //     }
      //   })
      //   add(addData).then((res) => {
      //     this.$message({
      //       message: '保存成功',
      //       type: 'success',
      //       duration: 2500
      //     })
      //     this.cuDialogVisible = false
      //     this.loading = false
      //     this.$emit('refresh')
      //   })
      // } else {
      //   edit(this.formData.fields).then((res) => {
      //     this.$message({
      //       message: '保存成功',
      //       type: 'success',
      //       duration: 2500
      //     })
      //     this.cuDialogVisible = false
      //     this.loading = false
      //     this.$emit('refresh')
      //   })
      // }
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.fields-list {
  max-height: calc(100vh - 312px);
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
}
</style>
