<template>
    <Drawer ref="drawerRef" v-model="visible" title="用户配置">
        <!-- <a-form-model layout="vertical" :model="form" :rules="rules" ref="DrawerForm">
            <a-form-model-item label="名称" prop="jobName">
                <a-input v-model="form.jobName" :disabled="isView" />
            </a-form-model-item>
            <a-form-model-item label="描述" prop="jobDescription">
                <a-textarea v-model="form.jobDescription" :disabled="isView" :rows="4" />
            </a-form-model-item>
        </a-form-model> -->

        <a-steps :current="current">
            <a-step v-for="item in steps" :key="item.title" :title="item.title" />
        </a-steps>
        <a-form-model layout="vertical" :model="form" :rules="rules" ref="DrawerForm">
            <a-form-model-item label="名称" prop="jobName">
                <a-input v-model="form.jobName" :disabled="isView" />
            </a-form-model-item>
        </a-form-model>
        <template #footer>
            <a-button type="primary" @click="prev" v-if="current > 0"> 上一步 </a-button>
            <a-button type="primary" @click="next" v-if="current < 2"> 下一步 </a-button>
        </template>
    </Drawer>
</template>

<script>
import Drawer from '@/components/table/drawer.vue';
import JobsApi from '@/api/organization';
import FormMixin from '@/components/FormMixin';
export default {
    components: { Drawer },
    mixins: [FormMixin],
    data() {
        return {
            visible: false,
            rules: {
                jobName: [{ required: true, message: 'Please select Activity zone', trigger: 'change' }],
                jobDescription: [
                    { required: true, message: 'Please select Activity zone', trigger: 'change' },
                ],
            },
            current: 0,
            steps: [
                {
                    title: '基本信息',
                },
                {
                    title: '证件设置',
                },
                {
                    title: '岗位设置',
                },
            ],
        };
    },
    methods: {
        open() {
            this.visible = true;
        },
        next() {
            this.current++;
        },
        prev() {
            this.current--;
        },

        add() {
            return JobsApi.addJobs({ ...this.form });
        },
        edit() {
            return JobsApi.updateJobs({ ...this.form });
        },
    },
};
</script>
