<template>
    <a-form-model layout="vertical" :model="form" :rules="rules" ref="DrawerForm">
        <a-form-model-item label="任务名称" prop="taskName">
            <a-input v-model="form.taskName" :disabled="isView" />
        </a-form-model-item>
        <a-form-model-item label="调度规则" prop="taskRule">
            <ACron v-model="form.taskRule" :disabled="isView" />
        </a-form-model-item>
        <a-form-model-item label="实现类" prop="implementClass">
            <a-input v-model="form.implementClass" :disabled="isView" />
        </a-form-model-item>
        <a-form-model-item label="说明" prop="remark">
            <a-textarea v-model="form.remark" :disabled="isView" :rows="4" />
        </a-form-model-item>
    </a-form-model>
</template>

<script>
import { addTaskApi, updateTaskApi } from '@/api';
import FormMixin from '@/components/FormMixin';
import ACron from '@/components/Acron/ACron.vue';

export default {
    components: { ACron },
    props: ['row'],
    mixins: [FormMixin],
    data() {
        return {
            rules: {
                taskName: [{ required: true }],
                taskRule: [{ required: true }],
            },
        };
    },
    methods: {
        add() {
            return addTaskApi({ ...this.form });
        },
        edit() {
            return updateTaskApi({ ...this.form });
        },
    },
};
</script>
