index.js
4.53 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
// 搜索model
export const listQuery = {
'name': '',
'statusList': '',
'includeChild': true
};
// 搜索表单配置
export const searchConfig = function() {
return {
list: [
{
type: 'input',
label: '关键字',
model: 'name',
options: {
placeholder: '用户名/姓名/手机号码'
}
},
{
type: 'select',
label: '状态',
model: 'statusList',
options: {
options: this.$enums.USER_STATUS.values()
}
}
],
config: {
onSearch: data => {
this.handleSubmit();
},
model: this.listQuery
}
};
};
// 表格展示配置
export const tableColumns = function() {
return [
{
type: 'checkbox',
fixed: 'left'
},
{
field: 'name',
text: '姓名',
minWidth: 100,
render: (h, param) => {
return h('QgButton', {
props: {},
on: {
click: () => {
// 查看
this.$router.push({
path: `/uc/user/view`,
query: {id: param.row.id}
});
}
}
}, param.row.name);
}
},
{
field: 'loginName',
text: '用户名',
minWidth: 120
},
{
type: 'mobile',
field: 'mobile',
text: '手机号码',
minWidth: 120
},
{
field: 'orgName',
text: '部门',
minWidth: 160
},
{
field: 'status',
text: '状态',
render: (h, param) => {
return this.$enums.USER_STATUS.getText(param.row.status);
}
},
{
field: 'opt',
fixed: 'right',
text: '操作',
width: 110,
render: (h, param) => {
const row = param.row;
const optArr = [];
const editBtn = h('QgButton', {
props: {
toolTip: '编辑',
type: 'text',
icon: 'el-icon-edit'
},
on: {
click: () => {
// 编辑
this.handleOpt('edit', row);
}
}
});
const restPwdBtn = h('QgButton', {
props: {
toolTip: '重置密码',
type: 'text',
icon: 'rest_pwd'
},
on: {
click: () => {
this.handleOpt('resetPwd', [row.id]);
}
}
});
const enableBtn = h('QgButton', {
props: {
toolTip: '启用',
type: 'text',
icon: 'enable'
},
on: {
click: () => {
this.handleOpt('enable', [row.id]);
}
}
});
const disableBtn = h('QgButton', {
props: {
toolTip: '停用',
type: 'text',
icon: 'disable'
},
on: {
click: () => {
this.handleOpt('disable', [row.id]);
}
}
});
// 超级管理员 只能修改密码
if (row.code === 'admin') {
return h('div', [restPwdBtn], '');
}
optArr.push(editBtn);
optArr.push(restPwdBtn);
if (row.status === this.$enums.USER_STATUS.ENABLED.key) {
optArr.push(disableBtn);
} else {
optArr.push(enableBtn);
}
return h('div', optArr, '');
}
}
];
};