<template>
  <el-dialog class="field-setting-dialog" :modal-append-to-body="false" :close-on-click-modal="false" :before-close="crud.cancelCU" :visible="crud.status.cu > 0" :title="crud.status.title">
    <div class="setting-dialog">
      <SettingForm ref="editForm" :is-disabled="false" :is-add="crud.status.add === 1" :this-fields="form" />
      <div slot="footer" class="dialog-footer">
        <el-button @click="crud.cancelCU">
          取消
        </el-button>
        <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">
          确定
        </el-button>
      </div>
    </div>
  </el-dialog>
</template>

<script>
import { form } from '@crud/crud'
import SettingForm from '@/views/components/category/SettingForm'

const defaultForm = {
  id: null,
  fieldName: null,
  fieldCnName: null,
  isDefaultValue: null,
  isInputClass: 'text',
  isDataType: null,
  isDataTypeDetails: null,
  isColumnLength: null,
  isColumnType: 1,
  isSequence: null,
  isType: 2,
  isSystem: true,
  isLine: false,
  isInput: true,
  isRequired: false,
  isAutomatic: false,
  isAdd: null,
  isSearch: null,
  isInherit: null,
  isFilling: false,
  fillingDigit: null,
  isRepeat: null,
  isDisplay: false,
  displayOrder: null,
  isDisplayformat: null,
  displayformatType: null,
  editLength: 196,
  displayLength: null,
  dictionaryConfigId: {
    id: null
  }
}
export default {
  components: { SettingForm },
  mixins: [
    form(function() {
      return Object.assign({ categoryId: this.$parent.selectedCategory.id }, defaultForm)
    })
  ],
  data() {
    return {
    }
  }
}
</script>
