<template>
  <div style="height: 100%; overflow: auto;">
    <QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
    <div class="draft">
      <el-button-group>
        <el-button type="primary" @click="turnback">{{ $t('global.return') }}</el-button>
      </el-button-group>
    </div>
  </div>
</template>

<script>
import { getPermissonDetail } from '@/api/management/author';

export default {
    name: 'Author',
    components: {
    },
    data() {
        return {
            PermissionTypeList: [],
            pagerConfig: {
                pageSize: 'pageSize',
                pageIndex: 'pageNum'
            },
            queryForm: {
                labelWidth: '140px',
                reset: true,
                show: false,
                queryObject: {
                }
            },
            queryList: {
                query: this.queryFunction,
                selectCheckShow: false,
                indexShow: true,
                columns: [
                    {
                        title: this.$t('orderAuthor.permissionName'),
                        prop: 'name'
                    },
                    {
                        title: this.$t('orderAuthor.permissionType'),
                        prop: 'type',
                        type: 'tag',
                        columnValue: (row) => { return this.$convertField(row.type, this.PermissionTypeList, ['value', 'label']); },
                        tagType: (row) => { return ''; }
                    },
                    {
                        type: 'button',
                        title: this.$t('global.operate'),
                        width: '150',
                        buttons: [
                        ]
                    }
                ],
                actions: [
                ]
            }
        };
    },

    mounted() {
        this.loadInitData();
    },
    methods: {
        loadInitData() {
            this.$Dictionary.permissionType().then(list => {
                this.$convertList(list, this.PermissionTypeList, elem => {
                    return true;
                });
            });
        },
        queryFunction() {
            return getPermissonDetail(this.$route.params.id);
        },
        reloadTable() {
            if (this.queryList && this.queryList.reload) {
                this.queryList.reload();
            }
        },
        turnback() {
            this.$router.go(-1);
        }
    }
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
    .draft {
        width: 400px;
        text-align: center;
        margin: 20px auto;
    }
</style>
