<template>
    <Drawer ref="drawerRef" v-model="visible" :title="title" :onOk="submit" :colesAfter="refresh">
        <a-form-model layout="vertical" :model="form" :rules="rules" ref="DrawerForm">
            <a-form-model-item label="编码" prop="categoryCode">
                <a-input v-model="form.categoryCode" :disabled="isView" />
            </a-form-model-item>
            <a-form-model-item label="名称" prop="categoryName">
                <a-input v-model="form.categoryName" :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>
    </Drawer>
</template>

<script>
import Drawer from '@/components/table/drawer.vue';
import FormMixin from '@/components/FormMixin';
import Api from '@/api/oceanus';

export default {
    components: { Drawer },
    props: {
        refresh: Function,
    },
    mixins: [FormMixin],
    data() {
        return {
            visible: false,
            form: {},
            rules: {
                categoryCode: [{ required: true, message: 'Please select Activity zone', trigger: 'change' }],
                categoryName: [{ required: true, message: 'Please select Activity zone', trigger: 'change' }],
                remark: [{ required: true, message: 'Please select Activity zone', trigger: 'change' }],
            },
            Api,
        };
    },
    async mounted() {},
    methods: {
        open() {
            this.form = {};
            this.visible = true;
        },
        add() {
            return Api.addOceanusTree(this.form);
        },
        edit() {
            return Api.updateOceanusTree(this.form);
        },
    },
};
</script>
