Browse Source

添加更新数据权限接口

master
李磊 3 years ago
parent
commit
fc8278b1e2
  1. 12
      src/api/role.js
  2. 15
      src/views/user/components/data-permission.vue

12
src/api/role.js

@ -16,6 +16,7 @@ export function edit(data) {
data
})
}
export function del(params) {
return api({
url: '/role',
@ -49,4 +50,15 @@ export function getAllRole() {
})
}
export function updateDataScope(data) {
return api({
url: '/role/updateDataScope',
method: 'put',
data,
paramsSerializer: function(data) {
return qs.stringify(data, { indices: false })
}
})
}
export default { add, edit, del, getList }

15
src/views/user/components/data-permission.vue

@ -58,7 +58,7 @@
</template>
<script>
import CrudRole from '@/api/role'
import { updateDataScope } from '@/api/role'
import { getAll } from '@/api/data_scope_department'
export default {
@ -149,11 +149,14 @@ export default {
}
},
update() {
console.log(this.checkedIds)
console.log(Array.from(this.checkedIds))
this.permission.dataScopeDepartmentIds = Array.from(this.checkedIds)
console.log(this.permission)
CrudRole.edit(this.permission).then(() => this.$notify.success('操作成功'))
updateDataScope({
roleId: this.permission.id,
dataScope: this.permission.dataScope,
departmentIds: Array.from(this.checkedIds)
}).then(() => {
this.$notify.success('操作成功')
this.close()
})
},
handleCheckAllChange(val, checked) {
if (checked) {

Loading…
Cancel
Save