数据权限回显
This commit is contained in:
@@ -46,4 +46,12 @@ export function saveDataPermission(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, getDataScopeType, getDataPermissionOption, saveDataPermission }
|
||||
export function getDataShow(id) {
|
||||
return request({
|
||||
url: 'api/dataPermission/dataShow',
|
||||
method: 'post',
|
||||
data: id
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, getDataScopeType, getDataPermissionOption, saveDataPermission, getDataShow }
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
border
|
||||
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
|
||||
@select="handleSelectionChange"
|
||||
@select-all="onSelectAll"
|
||||
@current-change="clickChange"
|
||||
>
|
||||
<el-table-column v-if="!isSingle" type="selection" width="55" />
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
border
|
||||
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
|
||||
@select="handleSelectionChange"
|
||||
@select-all="onSelectAll"
|
||||
@current-change="clickChange"
|
||||
>
|
||||
<el-table-column v-if="!isSingle" type="selection" width="55" />
|
||||
|
||||
@@ -258,9 +258,12 @@
|
||||
>
|
||||
<el-table-column :selectable="checkboxT" type="selection" width="55" />
|
||||
<el-table-column prop="label" label="权限范围" />
|
||||
<el-table-column prop="permission_id" label="数据权限">
|
||||
<el-table-column label="数据权限">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.permission_id" placeholder="请选择" @change="openRelevance(scope.row)">
|
||||
<el-select
|
||||
v-model="scope.row.permission_id"
|
||||
placeholder="请选择"
|
||||
@change="openRelevance(scope.row, scope.$index)">
|
||||
<el-option
|
||||
v-for="item in permissions"
|
||||
:key="item.permission_id"
|
||||
@@ -270,16 +273,16 @@
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column-->
|
||||
<!-- label="操作"-->
|
||||
<!-- fixed="right"-->
|
||||
<!-- align="center"-->
|
||||
<!-- width="80"-->
|
||||
<!-- >-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <el-button type="text" icon="el-icon-arrow-right" @click="openRelevance(scope.row)">关联</el-button>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column-->
|
||||
<!-- label="操作"-->
|
||||
<!-- fixed="right"-->
|
||||
<!-- align="center"-->
|
||||
<!-- width="100"-->
|
||||
<!-- >-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <el-button type="text">查看明细</el-button>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
</el-table>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
@@ -288,7 +291,7 @@
|
||||
</div>
|
||||
</el-dialog>
|
||||
<relevance-user-dialog :dialog-show.sync="relevanceUser" :is-single="false" @selectUsers="selectUsers" />
|
||||
<relevance-dept-dialog :dialog-show.sync="relevanceDept" :is-single="false" @selectDepts="selectDepts"/>
|
||||
<relevance-dept-dialog :dialog-show.sync="relevanceDept" :is-single="false" @selectDepts="selectDepts" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -649,16 +652,40 @@ export default {
|
||||
this.dataDialog.username = row.username
|
||||
this.dataDialog.user_id = row.user_id
|
||||
this.dataPerm = true
|
||||
console.log(res)
|
||||
// console.log(res)
|
||||
// 回显数据
|
||||
crudDataPermission.getDataShow(row.user_id).then(res => {
|
||||
console.log('回显数据', res)
|
||||
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 (res[index].users) this.dataDialog.dataScopeType[i].users = res[index].users
|
||||
if (res[index].depts) this.dataDialog.dataScopeType[i].depts = res[index].depts
|
||||
// 选中
|
||||
this.$refs.dialogTable.toggleRowSelection(this.dataDialog.dataScopeType[i], true)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(this.dataDialog.dataScopeType)
|
||||
})
|
||||
})
|
||||
})
|
||||
},
|
||||
getRows(val) { // 获取行数据
|
||||
this.multipleSelection = val
|
||||
console.log(val)
|
||||
console.log('选中', val)
|
||||
},
|
||||
openRelevance(row) {
|
||||
openRelevance(row, index) {
|
||||
console.log('下标', index)
|
||||
console.log('关联的当行数据', row)
|
||||
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())
|
||||
}
|
||||
}
|
||||
this.$set(this.dataDialog.dataScopeType[index], this.dataDialog.dataScopeType[index].permission_id, row.permission_id)
|
||||
this.rowData = {}
|
||||
if (row.permission_id == '1601040560293023744') { // 用户
|
||||
this.rowData = row
|
||||
@@ -696,6 +723,7 @@ export default {
|
||||
user_id: this.dataDialog.user_id,
|
||||
datas: this.multipleSelection
|
||||
}
|
||||
console.log(this.dataDialog)
|
||||
crudDataPermission.saveDataPermission(param).then(res => {
|
||||
this.dataPerm = false
|
||||
this.crud.notify('添加数据权限成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
|
||||
Reference in New Issue
Block a user