<template>
    <div>
        <div class="i-layout-page-header">
            <PageHeader :title="$route.meta.title"
                :content="$route.meta.description"
                hidden-breadcrumb />
        </div>
        <Card :bordered="false"
            dis-hover
            class="ivu-mt">
            <view-table ref="table"
                view-code="Dict"
                @create="createdDict()"
                @edit="({row, index})=>$refs.form.open(row)" />
        </Card>
        <modal-form ref="form"
            view-code="DictEdit"
            @on-after-save="$refs.table.loadData()" />
    </div>
</template>
<script>
    import { mixinPage } from '/src/index.js';

    export default {
        name: 'system-dict',
        mixins: [mixinPage],
        components: {},
        data() {
            return {};
        },
        computed: {},
        created() {},
        methods: {
            createdDict() {
                if (this.$refs.table.filter.typeID) {
                    this.$refs.form.openDefault({
                        typeID: this.$refs.table.filter.typeID
                    });
                } else {
                    this.warning('请先选择枚举类型！');
                }
            }
        }
    };
</script>
