<template>
  <el-dialog :title="title" :visible="show" :width="width">
    <config-form ref="form" :keys="keys" @success="cancel" @cancel="cancel"/>
    <template #footer>
      <el-button type="primary" @click="submitForm">确 定</el-button>
      <el-button @click="cancel">取 消</el-button>
    </template>
  </el-dialog>
</template>
<script>
import ConfigForm from '@/components/Business/Config/ConfigForm.vue'

export default {
  name: "ConfigDialog",
  components: { ConfigForm },
  props: {
    title: {
      type: String,
      default: "配置",
    },
    show: {
      type: Boolean,
      default: false,
    },
    width: {
      type: String,
      default: "500px"
    },
    keys: {
      type: Array,
      default: () => {
        return []
      }
    }
  },
  methods: {
    cancel() {
      this.$emit("update:show", false);
    },
    submitForm() {
      this.$refs.form.onSubmit();
    }
  }
}
</script>
