<template>
  <el-dialog
    v-dialogDrag
    title="检查配置接口"
    :visible.sync="dialogVisible"
    :before-close="doClose"
    center
    width="400px"
    :close-on-click-modal="false"
    :z-index="2000"
    append-to-body
  >
    <el-form ref="form" :model="formModel" class="checkConfig" label-width="160px">
      <el-form-item prop="check" label="是否检查" :required="true">
        <el-switch
          v-model="formModel.check"
          active-color="#409eff"
          inactive-color="#dcdfe6"
        />
      </el-form-item>
    </el-form>
    <div class="bottomBtnGroup">
      <el-button type="primary" size="medium" @click="onSubmit">确定</el-button>
    </div>
  </el-dialog>
</template>
<script>
import { checkConfig } from '@/api/jmap/mapdraft';
export default {
    name:'CheckConfig',
    data() {
        return {
            dialogVisible:false,
            formModel:{
                check:false
            }
        };
    },
    methods:{
        doShow() {
            this.dialogVisible = true;
        },
        doClose() {
            this.formModel = {
                check:false
            };
            this.dialogVisible = false;
        },
        onSubmit() {
            checkConfig(this.$route.params.mapId, this.formModel).then(res=>{
                this.$message.success('检查配置成功');
                this.$emit('checkOver');
                this.doClose();
            }).catch(error=>{
                this.$messageBox('检查配置失败：' + error.meessage);
            });
        }
    }
};
</script>
<style lang="scss" scoped>
.checkConfig{}
.bottomBtnGroup{
    width: 100%;
    margin-top:10px;
    text-align: center;
    display: inline-block
}
</style>
