修改用户列表中,角色未更改时,不提交请求

This commit is contained in:
jacky 2024-04-10 21:27:53 +08:00
parent efe8222dde
commit d95ad35903
1 changed files with 20 additions and 0 deletions

View File

@ -468,6 +468,10 @@ const changeAuthority = async(row, flag, removeAuth) => {
}
return
}
if (equalArr(tempAuth[row.ID], row.authorityIds)) {
return
}
await nextTick()
const res = await setUserAuthorities({
ID: row.ID,
@ -485,6 +489,22 @@ const changeAuthority = async(row, flag, removeAuth) => {
}
}
const equalArr = (arr1, arr2) => {
console.log(arr1.length, arr2.length)
if (arr1.length !== arr2.length) {
return false
}
let i = 0
arr1.forEach(item => {
arr2.forEach(item2 => {
if (item == item2) {
i++
}
})
})
return i === arr1.length
}
const openEdit = (row) => {
dialogFlag.value = 'edit'
userInfo.value = JSON.parse(JSON.stringify(row))