fix: 修复 userTable 接口传参格式错误问题,修复role 编辑时内容回显问题

This commit is contained in:
@changcode
2022-01-25 16:25:49 +08:00
parent a16c27aaf5
commit d2d38c2d8c
3 changed files with 12 additions and 5 deletions

View File

@@ -84,7 +84,7 @@ export default {
handler (n) {
this.editRole = JSON.parse(JSON.stringify(n))
if (this.editRole.roles && this.editRole.roles.length > 0) {
this.editRole.roleIds = this.editRole.roles.map(t => t.id)
this.editRole.roleIds = this.editRole.roles.map(t => t.id).json(',')
}
}
}

View File

@@ -143,14 +143,14 @@ export default {
methods: {
statusChange (user) {
if (user.roles) {
user.roleIds = user.roles.map(t => t.id)
user.roleIds = user.roles.map(t => t.id).join(',')
}
// if (!user.id){
// return
// }
put('sys/user', user).then(response => {
if (response.code === 200) {
this.rightBox.show = false
// this.rightBox.show = false
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
} else {
this.$message.error(response.msg)

View File

@@ -67,7 +67,14 @@ export default {
url: api.role,
tableId: 'rolesTable', // 需要分页的table的id用于记录每页数量
blankObject: { // 空白对象
name: ''
name: '',
buildIn: '',
i18n: '',
id: '',
menuIds: [],
remark: '',
uby: 0,
utime: ''
}
}
},
@@ -75,7 +82,7 @@ export default {
edit (u) {
get(`${this.url}`, { ids: u.id }).then(response => {
if (response.code === 200) {
this.object = response.data
this.object = response.data.list[0]
this.rightBox.show = true
}
})