数据权限
This commit is contained in:
@@ -32,7 +32,6 @@
|
||||
end-placeholder="结束日期"
|
||||
align="right"
|
||||
@change="queryData"
|
||||
@blur="queryData"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item v-show="showOptions" label="时间段">
|
||||
|
||||
@@ -53,8 +53,8 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="名称" prop="name" />
|
||||
<el-table-column label="排序" prop="dept_sort" />
|
||||
<el-table-column prop="create_time" label="创建日期" />
|
||||
<el-table-column label="排序" prop="deptSort" />
|
||||
<el-table-column prop="createTime" label="创建日期" />
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
@@ -76,7 +76,7 @@ export default {
|
||||
name: 'RelevanceDeptDialog',
|
||||
components: { rrOperation, pagination },
|
||||
cruds() {
|
||||
return CRUD({ title: '部门', idField: 'dept_id', url: 'api/dept/vo', crudMethod: { ...crudDept }, query: { is_used: '1' }})
|
||||
return CRUD({ title: '部门', idField: 'deptId', url: 'api/dept/vo', crudMethod: { ...crudDept }, query: { isUsed: '1' }})
|
||||
},
|
||||
mixins: [presenter(), header()],
|
||||
dicts: ['product_series'],
|
||||
@@ -119,7 +119,7 @@ export default {
|
||||
this.$nextTick(function() {
|
||||
for (var k = 0; k < this.depts.length; k++) {
|
||||
for (var i = 0; i < this.crud.data.length; i++) {
|
||||
if (this.crud.data[i].dept_id == this.depts[k].dept_id) {
|
||||
if (this.crud.data[i].deptId == this.depts[k].deptId) {
|
||||
this.$refs.table.toggleRowSelection(this.crud.data[i], true)
|
||||
break
|
||||
}
|
||||
@@ -160,7 +160,7 @@ export default {
|
||||
// console.log(this.rows)
|
||||
},
|
||||
getDeptDatas(tree, treeNode, resolve) {
|
||||
const params = { pid: tree.dept_id }
|
||||
const params = { pid: tree.deptId }
|
||||
setTimeout(() => {
|
||||
crudDept.getDeptvo(params).then(res => {
|
||||
resolve(res.content)
|
||||
|
||||
@@ -47,14 +47,14 @@
|
||||
</el-table-column>
|
||||
<el-table-column prop="username" label="用户名" :min-width="flexWidth('username',crud.data,'用户名')" />
|
||||
<el-table-column
|
||||
prop="person_name"
|
||||
prop="personName"
|
||||
label="姓名"
|
||||
:min-width="flexWidth('person_name',crud.data,'姓名')"
|
||||
:min-width="flexWidth('personName',crud.data,'姓名')"
|
||||
/>
|
||||
<el-table-column show-overflow-tooltip prop="deptnames" label="部门" />
|
||||
<el-table-column label="状态" align="center" prop="enabled">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.is_used==1?'启用':'禁用'}}
|
||||
{{scope.row.isUsed==1?'启用':'禁用'}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -78,7 +78,7 @@ export default {
|
||||
name: 'RelevanceUserDialog',
|
||||
components: { rrOperation, pagination },
|
||||
cruds() {
|
||||
return CRUD({ title: '用户', idField: 'user_id', url: 'api/users', crudMethod: { ...crudUser }, query: {is_used: '1'}})
|
||||
return CRUD({ title: '用户', idField: 'userId', url: 'api/users', crudMethod: { ...crudUser }, query: {isUsed: '1'}})
|
||||
},
|
||||
mixins: [presenter(), header()],
|
||||
dicts: ['product_series'],
|
||||
@@ -118,9 +118,10 @@ export default {
|
||||
},
|
||||
open() {
|
||||
this.$nextTick(function() {
|
||||
console.log(this.crud.data)
|
||||
for (var k = 0; k < this.users.length; k++) {
|
||||
for (var i = 0; i < this.crud.data.length; i++) {
|
||||
if (this.crud.data[i].user_id == this.users[k].user_id) {
|
||||
if (this.crud.data[i].userId == this.users[k].userId) {
|
||||
this.$refs.table.toggleRowSelection(this.crud.data[i], true)
|
||||
break
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ export default {
|
||||
name: 'ShowDataPermissionDialog',
|
||||
components: { rrOperation, pagination },
|
||||
cruds() {
|
||||
return CRUD({ title: '权限明细', idField: 'user_id', url: 'api/dataPermission/dataDetail'})
|
||||
return CRUD({ title: '权限明细', idField: 'userId', url: 'api/dataPermission/dataDetail'})
|
||||
},
|
||||
mixins: [presenter(), header()],
|
||||
dicts: ['product_series'],
|
||||
|
||||
@@ -249,7 +249,7 @@
|
||||
<el-form-item label="用户名" prop="username">
|
||||
<el-input v-model="dataDialog.username" disabled style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="姓名" prop="preson_name">
|
||||
<el-form-item label="姓名" prop="presonName">
|
||||
<el-input v-model="dataDialog.personName" disabled style="width: 200px;" />
|
||||
</el-form-item>
|
||||
<el-table
|
||||
@@ -263,15 +263,15 @@
|
||||
<el-table-column label="数据权限">
|
||||
<template slot-scope="scope">
|
||||
<el-select
|
||||
v-model="scope.row.permission_id"
|
||||
v-model="scope.row.permissionId"
|
||||
placeholder="请选择"
|
||||
@change="openRelevance(scope.row, scope.$index)"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in permissions"
|
||||
:key="item.permission_id"
|
||||
:key="item.permissionId"
|
||||
:label="item.name"
|
||||
:value="item.permission_id"
|
||||
:value="item.permissionId"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
@@ -306,11 +306,11 @@
|
||||
>
|
||||
<el-table-column prop="permission_scope_type" label="权限类型" min-width="100" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.permission_scope_type[scope.row.permission_scope_type] }}
|
||||
{{ dict.label.permissionScopeType[scope.row.permissionScopeType] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="permission_name" label="权限范围" min-width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="dept_name" label="部门名称" min-width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="permissionName" label="权限范围" min-width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="deptName" label="部门名称" min-width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="personName" label="用户名称" min-width="100" show-overflow-tooltip />
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
@@ -393,7 +393,7 @@ export default {
|
||||
dataPerm: false,
|
||||
dataDialog: {},
|
||||
permissions: [],
|
||||
permission_id: '',
|
||||
permissionId: '',
|
||||
multipleSelection: [], // 选中
|
||||
relevanceUser: false, // 关联用户
|
||||
rowData: {}, // 当行数据
|
||||
@@ -686,19 +686,20 @@ export default {
|
||||
this.dataDialog.dataScopeType = res
|
||||
// permissions
|
||||
crudDataPermission.getDataPermissionOption().then(res => {
|
||||
// console.log(res)
|
||||
this.permissions = res
|
||||
this.dataDialog.personName = row.personName
|
||||
this.dataDialog.username = row.username
|
||||
this.dataDialog.user_id = row.user_id
|
||||
this.dataDialog.userId = row.userId
|
||||
this.dataPermissionTitle = '[' + row.personName + '] 数据权限'
|
||||
this.dataPerm = true
|
||||
// 回显数据
|
||||
crudDataPermission.getDataShow(row.user_id).then(res => {
|
||||
crudDataPermission.getDataShow(row.userId).then(res => {
|
||||
this.$nextTick(function() {
|
||||
for (var index = 0; index < res.length; index++) {
|
||||
for (var i = 0; i < this.dataDialog.dataScopeType.length; i++) {
|
||||
if (this.dataDialog.dataScopeType[i].value == res[index].permission_scope_type) {
|
||||
this.dataDialog.dataScopeType[i].permission_id = res[index].permission_id
|
||||
if (this.dataDialog.dataScopeType[i].value == res[index].permissionScopeType) {
|
||||
this.dataDialog.dataScopeType[i].permissionId = res[index].permissionId
|
||||
if (res[index].users) this.dataDialog.dataScopeType[i].users = res[index].users
|
||||
if (res[index].depts) this.dataDialog.dataScopeType[i].depts = res[index].depts
|
||||
// 选中
|
||||
@@ -717,25 +718,26 @@ export default {
|
||||
},
|
||||
openRelevance(row, index) {
|
||||
for (var i = 0; i < this.permissions.length; i++) {
|
||||
if (this.permissions[i].permission_id != undefined && this.permissions[i].permission_id && this.permissions[i].permission_id != row.permission_id) {
|
||||
this.$delete(this.dataDialog.dataScopeType[index], this.permissions[i].permission_id.toString())
|
||||
if (this.permissions[i].permissionId != undefined && this.permissions[i].permissionId && this.permissions[i].permissionId != row.permissionId) {
|
||||
this.$delete(this.dataDialog.dataScopeType[index], this.permissions[i].permissionId.toString())
|
||||
}
|
||||
}
|
||||
this.$set(this.dataDialog.dataScopeType[index], this.dataDialog.dataScopeType[index].permission_id, row.permission_id)
|
||||
this.$set(this.dataDialog.dataScopeType[index], this.dataDialog.dataScopeType[index].permissionId, row.permissionId)
|
||||
this.rowData = {}
|
||||
this.deptIds = []
|
||||
this.userIds = []
|
||||
if (row.permission_id == '1601040560293023744') { // 选择用户
|
||||
console.log(row)
|
||||
if (row.permissionId == '1605129738328870912') { // 选择用户
|
||||
this.userIds = this.dataDialog.dataScopeType[index].users
|
||||
this.rowData = row
|
||||
this.relevanceUser = true
|
||||
} else if (row.permission_id == '1601040621190123520') { // 选择部门
|
||||
} else if (row.permissionId == '1605129882164137984') { // 选择部门
|
||||
this.deptIds = this.dataDialog.dataScopeType[index].depts
|
||||
this.rowData = row
|
||||
this.relevanceDept = true
|
||||
} else if (row.permission_id == '1601038030326599680') { // 自身
|
||||
} else if (row.permissionId == '1605128919449735168') { // 自身
|
||||
const param = {
|
||||
user_id: this.dataDialog.user_id
|
||||
userId: this.dataDialog.userId
|
||||
}
|
||||
this.dataDialog.dataScopeType[index].users = []
|
||||
this.dataDialog.dataScopeType[index].users.push(param)
|
||||
@@ -746,7 +748,7 @@ export default {
|
||||
},
|
||||
selectUsers(row) { // row对话框传来的数据
|
||||
for (var i = 0; i < this.dataDialog.dataScopeType.length; i++) {
|
||||
if (this.dataDialog.dataScopeType[i].dict_id == this.rowData.dict_id) {
|
||||
if (this.dataDialog.dataScopeType[i].dictId == this.rowData.dictId) {
|
||||
if (this.dataDialog.dataScopeType[i].depts != undefined && this.dataDialog.dataScopeType[i].depts.length > 0) this.dataDialog.dataScopeType[i].depts = []
|
||||
this.dataDialog.dataScopeType[i].users = row
|
||||
break
|
||||
@@ -756,7 +758,7 @@ export default {
|
||||
},
|
||||
selectDepts(row) {
|
||||
for (var i = 0; i < this.dataDialog.dataScopeType.length; i++) {
|
||||
if (this.dataDialog.dataScopeType[i].dict_id == this.rowData.dict_id) {
|
||||
if (this.dataDialog.dataScopeType[i].dictId == this.rowData.dictId) {
|
||||
if (this.dataDialog.dataScopeType[i].users != undefined && this.dataDialog.dataScopeType[i].users.length > 0) this.dataDialog.dataScopeType[i].users = []
|
||||
this.dataDialog.dataScopeType[i].depts = row
|
||||
break
|
||||
@@ -769,9 +771,10 @@ export default {
|
||||
},
|
||||
savePermise() {
|
||||
const param = {
|
||||
user_id: this.dataDialog.user_id,
|
||||
userId: this.dataDialog.userId,
|
||||
datas: this.multipleSelection
|
||||
}
|
||||
console.log('param', param)
|
||||
crudDataPermission.saveDataPermission(param).then(res => {
|
||||
this.dataPerm = false
|
||||
this.crud.notify('添加数据权限成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
@@ -861,12 +864,12 @@ export default {
|
||||
},
|
||||
showDatas(row) {
|
||||
const param = {
|
||||
user_id: this.dataDialog.user_id,
|
||||
permission_scope_type: row.value
|
||||
userId: this.dataDialog.userId,
|
||||
permissionScopeType: row.value
|
||||
}
|
||||
// crudDataPermission.getDataDetail(param).then(res => {
|
||||
// this.dataPermissions = res
|
||||
// })
|
||||
crudDataPermission.getDataDetail(param).then(res => {
|
||||
this.dataPermissions = res
|
||||
})
|
||||
this.showData = true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user