<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="User"
                @create="$refs.form.open()">
                <template slot-scope="{ row }"
                    slot="command">
                    <Button size="small"
                        title="角色"
                        type="info"
                        custom-icon="fa fa-users"
                        @click="$refs.roleTable.open({userID: row.id})"></Button>
                    <Button size="small"
                        title="编辑"
                        type="primary"
                        custom-icon="fa fa-edit"
                        @click="$refs.form.open(row)"></Button>
                    <Button size="small"
                        title="删除"
                        type="warning"
                        custom-icon="fa fa-trash-alt"
                        @click="$refs.table.remove(row)"></Button>
                </template>
            </view-table>
        </Card>
        <modal-form ref="form"
            view-code="UserEdit"
            @on-after-save="$refs.table.loadData()" />
        <modal-table ref="roleTable"
            view-code="UserRole"
            @create="(param)=>$refs.roleForm.openDefault(param)" />
        <modal-form ref="roleForm"
            view-code="UserRoleEdit"
            @on-after-save="$refs.roleTable.loadData()" />
    </div>
</template>
<script>
    import { mixinPage } from '/src/index.js';

    export default {
        name: 'system-user',
        mixins: [mixinPage],
        components: {},
        data() {
            return {
                userID: null,
                factories: []
            };
        },
        computed: {},
        created() {},
        methods: {}
    };
</script>
