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 data
}) })
} }
export function del(params) { export function del(params) {
return api({ return api({
url: '/role', 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 } export default { add, edit, del, getList }

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

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

Loading…
Cancel
Save