RoleManagement.vue 1.44 KB
Newer Older
wb-ct393452's avatar
wb-ct393452 committed
1
<template>
水落(YangLei)'s avatar
水落(YangLei) committed
2
    <my-table url="/api/v1/roles" rowKey="roleId" :addBtn="addBtn" ref="table" noPage>
3
        <template #drawer>
水落(YangLei)'s avatar
水落(YangLei) committed
4 5
            <Form ref="form" />
        </template>
陈浩玮's avatar
角色  
陈浩玮 committed
6 7 8
        <a-table-column title="角色名称" data-index="roleName" />
        <a-table-column title="角色编码" data-index="roleCode" />
        <a-table-column title="角色说明" data-index="remark" />
水落(YangLei)'s avatar
水落(YangLei) committed
9 10 11 12 13 14 15 16 17 18
        <a-table-column title="操作">
            <template #default="row">
                <a @click="() => view(row, 2)">查看</a>
                <a-divider type="vertical" />
                <a @click="() => view(row, 1)">编辑</a>
                <a-divider type="vertical" />
                <PopconfirmDelete :url="`/api/v1/roles/${row.roleId}`" :cb="refreshTable" />
            </template>
        </a-table-column>
    </my-table>
wb-ct393452's avatar
wb-ct393452 committed
19
</template>
水落(YangLei)'s avatar
水落(YangLei) committed
20 21 22 23 24 25 26 27 28

<script>
import Form from './form.vue';
import PopconfirmDelete from '@/components/popconfirm_delete/index.vue';

export default {
    components: { Form, PopconfirmDelete },
    data() {
        return {
水落(YangLei)'s avatar
水落(YangLei) committed
29
            addBtn: { onOk: () => this.$refs['form']?.submit() },
水落(YangLei)'s avatar
水落(YangLei) committed
30 31 32 33 34 35 36
        };
    },
    methods: {
        refreshTable() {
            this.$refs['table']?.getData();
        },
        view(data, type) {
水落(YangLei)'s avatar
水落(YangLei) committed
37
            this.$refs['table']?.show({ type, noFooter: type === 2 });
水落(YangLei)'s avatar
水落(YangLei) committed
38
            this.$nextTick(() => {
陈浩玮's avatar
角色  
陈浩玮 committed
39
                this.$refs['form'].setData({ ...data }, type);
水落(YangLei)'s avatar
水落(YangLei) committed
40 41 42 43 44
            });
        },
    },
};
</script>