<!-- 新增爬虫 -->
<template>
    <el-dialog title="信息录入" v-model="dialogVisible" :close-on-click-modal="false" width="50%">
        <el-form ref="form" :model="formData" label-width="80px">
            <el-form-item label="站点">
                <el-input v-model="formData.site" placeholder="剑鱼"></el-input>
            </el-form-item>
            <el-form-item label="栏目">
                <el-input v-model="formData.channel" placeholder="中标结果"></el-input>
            </el-form-item>
            <el-form-item label="地址">
                <el-input v-model="formData.url" placeholder="https://www.jianyu360.cn"></el-input>
            </el-form-item>
            <el-form-item label="代码">
                <el-input v-model="formData.code" placeholder="0015"></el-input>
            </el-form-item>
            <el-form-item label="开发者">
                <el-input v-model="formData.author" placeholder="外包1"></el-input>
            </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
            <el-button @click="dialogVisible = false">取 消</el-button>
            <el-button type="primary" @click="handleSave">保 存</el-button>
        </span>
    </el-dialog>
</template>
<script setup>
import { ref, defineComponent } from 'vue';
import { ElMessage, ElMessageBox } from 'element-plus'
const formData = ref({
    site: '',
    channel: '',
    url: '',
    code: '',
    author: '',
});

const dialogVisible = ref(false);

const props = defineProps({
    onSubmit: Function,
});

const handleSave = () => {
    dialogVisible.value = false;
    props.onSubmit({ ...formData.value });
    formData.value = {}
    ElMessageBox.alert('已经成功添加爬虫任务', '提示信息', {
        callback: (action) => {
        },
    })
}
//这里是重点
defineExpose({
    dialogVisible
})
</script>