roleConst.js
1.55 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
import { deleteUserRoleById } from '@/api/api'
const roleCreateStructure = {
id: Number,
roleName: '',
description: '',
departId: '',
departName: '',
departPath: '',
rights: [],
state: 1
// createTime: ''
}
const roleDataColumn = [{
label: '序号',
prop: 'id'
}, {
label: '角色名字',
prop: 'roleName'
}, {
label: '所属部门',
prop: 'departName'
}, {
label: '状态',
prop: 'state',
formatter: (cellValue) => {
return cellValue < 1 ? '禁止' : '启动'
}
}, {
label: '创建时间',
prop: 'createTime',
formatter: (cellValue) => {
if (cellValue.createTime) {
return new Date(cellValue.createTime).format('yyyy-MM-dd HH:mm:ss')
}
}
}]
const userRoleDetailColumn = [{
label: '序号',
prop: 'userId'
}, {
label: '账号',
prop: 'username'
}, {
label: '用户名称',
prop: 'realname'
}, {
label: '状态',
prop: 'state',
formatter: (cellValue) => {
return cellValue < 1 ? '禁止' : '启动'
}
}]
const userRoleDetailConsole = {
// show: true,
label: '操作',
prop: 'option',
button: [{
label: '删除',
type: 'text',
callback: (index, rows) => {
const data = rows[index]
const params = { roleId: data.roleId, userId: data.userId }
deleteUserRoleById.req(params).then(res => {
// 加入提示消息!!!
rows.splice(index, 1)
// console.log(res)
}).catch(err => {
console.log(err)
})
}
}]
}
export {
roleCreateStructure,
roleDataColumn,
userRoleDetailColumn,
userRoleDetailConsole
}