index.vue
2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!-- 权限管理 -->
<template>
<d2-container class="role">
<d2-table-header title="角色列表"><auth-button category="action" label="创建角色"></auth-button></d2-table-header>
<d2-table
ref="roleTable"
:tableParams="tableParams"
:pagination="pagination"
:getListApi="getListApi"
>
<auth-button
slot="auth-button"
slot-scope="scope"
:data="scope.scope"
></auth-button>
</d2-table>
<edit-dialog
:isVisible="editVisible"
:editData="editData"
></edit-dialog>
</d2-container>
</template>
<script>
import { RoleList, RoleDetail } from '@/api/sys.account'
// import notice from '@/common/notice'
import { mapActions } from 'vuex'
import { BaseData } from '@/common/constants'
export default {
name: 'FimsRoles',
components: {
'EditDialog': () => import('./editDialog')
},
data() {
return {
getListApi: RoleList,
// 新增/编辑弹窗
editVisible: false,
// 表格
pagination: false,
// 表格参数
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'roles',
tableOption: true,
tableColumns: Object.freeze([
{
label: '角色名称',
prop: 'roleName'
},
{
label: '描述',
prop: 'description'
},
{
label: '创建时间',
prop: 'createTime'
}
])
}
}
},
mounted() {
// this.fetchData()
this.$event.$on('e-role-dialog-close', async isReload => {
if (isReload) {
const { roles } = await RoleList()
this.set({ name: BaseData.ROLE.KEY, value: roles })
this.$refs.roleTable.refreshTable()
}
this.editVisible = false
})
},
methods: {
...mapActions('d2admin/base', ['set']),
async handleEdit(row) {
// this.editData = row && await RoleDetail({ roleId: row.roleId })
this.editData = row && Object.assign(row, await RoleDetail({ roleId: row.roleId }))
this.editVisible = true
}
}
}
</script>
<style scoped>
</style>