Skip to content

Commit 5aff9de

Browse files
author
GongJS
committed
feat:用户可以在多个权限组里
1 parent 4723f8f commit 5aff9de

7 files changed

Lines changed: 60 additions & 27 deletions

File tree

.env.development

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
ENV = 'development'
22

3-
VUE_APP_BASE_URL = 'http://digital.7yue.pro/'
3+
VUE_APP_BASE_URL = 'http://pedro.7yue.pro/'

package-lock.json

Lines changed: 32 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/assets/styles/realize/element-variables.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ $typeMap: (primary:#3963BC,
842842
/* select */
843843
@include b(select) {
844844
.el-tag {
845-
background-color: #3963bc !important;
845+
// background-color: #3963bc !important;
846846
&__close.el-icon-close {
847847
background-color: #3963bc;
848848
right: -7px;

src/lin/models/admin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default class Admin {
3232
}
3333

3434
static getAllAuths() {
35-
return get('cms/admin/authority')
35+
return get('cms/admin/permission')
3636
}
3737

3838
static async getAdminUsers({ group_id, count = this.uCount, page = this.uPag }) {

src/lin/plugins/axios.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ _axios.interceptors.response.use(
128128
return
129129
}
130130
// 令牌相关,刷新令牌
131-
if (error_code === 10040 || error_code === 10050) {
131+
if (error_code === 10040 || error_code === 10041 || error_code === 10050 || error_code === 10051) {
132132
const cache = {}
133133
if (cache.url !== url) {
134134
cache.url = url

src/views/admin/user/UserInfo.vue

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@
1414
<el-input size="medium" clearable v-model="form.username" :disabled="isEdited"></el-input>
1515
</el-form-item>
1616
<el-form-item label="邮箱" prop="email">
17-
<el-input size="medium" clearable v-model="form.email" auto-complete="new-password"></el-input>
17+
<el-input
18+
size="medium"
19+
clearable
20+
v-model="form.email"
21+
:disabled="isEdited"
22+
auto-complete="new-password"
23+
></el-input>
1824
</el-form-item>
1925
<el-form-item v-if="pageType === 'add'" label="密码" prop="password">
2026
<el-input
@@ -31,8 +37,8 @@
3137
<el-form-item v-if="pageType !== 'password'" label="选择分组">
3238
<el-select
3339
size="medium"
34-
filterable
35-
v-model="form.group_id"
40+
multiple
41+
v-model="form.group_ids"
3642
:disabled="groups.length === 0"
3743
placeholder="请选择分组"
3844
>
@@ -124,7 +130,7 @@ export default {
124130
password: '',
125131
confirm_password: '',
126132
email: '',
127-
group_id: '请先创建分组',
133+
group_ids: [],
128134
},
129135
// 验证规则
130136
rules: {
@@ -172,13 +178,16 @@ export default {
172178
}
173179
} else {
174180
// 更新用户信息
175-
if (this.form.email === this.info.email && this.form.group_id === this.info.group_id) {
181+
if (
182+
this.form.email === this.info.email
183+
&& this.form.group_ids.sort().toString() === this.info.group_ids.sort().toString()
184+
) {
176185
this.$emit('handleInfoResult', false)
177186
return
178187
}
179188
try {
180189
this.loading = true
181-
res = await Admin.updateOneUser(this.form.email, this.form.group_id, this.id)
190+
res = await Admin.updateOneUser(this.form.email, this.form.group_ids, this.id)
182191
} catch (e) {
183192
this.loading = false
184193
console.log(e)
@@ -203,22 +212,26 @@ export default {
203212
if (this.pageType === 'edit') {
204213
this.setInfo()
205214
} else {
206-
this.form.group_id = this.groups[0].id
215+
this.form.group_ids = [this.groups[0].id]
207216
this.$refs[formName].resetFields()
208217
}
209218
},
210219
setInfo() {
211220
this.form.username = this.info.username
212221
this.form.email = this.info.email
213-
this.form.group_id = this.info.group_id
222+
const temp = []
223+
this.info.group_ids.forEach(item => {
224+
temp.push(item.id)
225+
})
226+
this.form.group_ids = temp
214227
},
215228
},
216229
watch: {
217230
groups: {
218231
// 默认选中管理员组
219232
handler() {
220233
if (this.groups && this.groups[0] && this.groups[0].id) {
221-
this.form.group_id = this.groups[0].id
234+
this.form.group_ids = [this.groups[0].id]
222235
}
223236
},
224237
immediate: true,

src/views/admin/user/UserList.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export default {
9393
password: '',
9494
confirm_password: '',
9595
email: '',
96-
group_id: '',
96+
group_ids: [],
9797
},
9898
loading: false,
9999
}
@@ -139,7 +139,7 @@ export default {
139139
this.id = selectedData.id
140140
this.form.username = selectedData.username
141141
this.form.email = selectedData.email
142-
this.form.group_id = selectedData.group_id
142+
this.form.group_ids = selectedData.groups
143143
this.dialogFormVisible = true
144144
},
145145
// 下拉框选择分组

0 commit comments

Comments
 (0)