feat: 新增了资产授权功能
资产授权功能包括,数据源分别给部门和用户的授权,数据源下的表分别给部门和用户的授权,以及给父级部门授权时,也会给此部门所有自己部门授权,取消授权也一样,用户授权也实现了,用户只能查看已授权的数据源和数据源下的表信息master
parent
e90fa588c7
commit
44c247cdea
|
@ -9,6 +9,14 @@ export function listAccredit(query) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 根据表id查询授权信息
|
||||||
|
export function getAssetAccreditByDataAssetId(id) {
|
||||||
|
return request({
|
||||||
|
url: '/etl/assetAccredit/GetAssetAccreditByDataAssetId?id='+id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 查询【请填写功能名称】详细
|
// 查询【请填写功能名称】详细
|
||||||
export function getAccredit(id) {
|
export function getAccredit(id) {
|
||||||
return request({
|
return request({
|
||||||
|
@ -18,7 +26,7 @@ export function getAccredit(id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增【请填写功能名称】
|
// 新增【请填写功能名称】
|
||||||
export function addAccredit(data) {
|
export function addAssetAccredit(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/etl/assetAccredit',
|
url: '/etl/assetAccredit',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
@ -26,6 +34,15 @@ export function addAccredit(data) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 新增【请填写功能名称】
|
||||||
|
export function deleteAssetAccreditByAssetIds(data) {
|
||||||
|
return request({
|
||||||
|
url: '/etl/assetAccredit/DeleteAssetAccreditByAssetIds',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 修改【请填写功能名称】
|
// 修改【请填写功能名称】
|
||||||
export function updateAccredit(data) {
|
export function updateAccredit(data) {
|
||||||
return request({
|
return request({
|
||||||
|
|
|
@ -9,6 +9,14 @@ export function listAccredit(query) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 根据数据源id查询授权信息
|
||||||
|
export function getSourceAccreditByDataSourceId(id) {
|
||||||
|
return request({
|
||||||
|
url: '/etl/sourceAccredit/GetSourceAccreditByDataSourceId?id='+id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 查询【请填写功能名称】详细
|
// 查询【请填写功能名称】详细
|
||||||
export function getAccredit(id) {
|
export function getAccredit(id) {
|
||||||
return request({
|
return request({
|
||||||
|
@ -18,7 +26,7 @@ export function getAccredit(id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增【请填写功能名称】
|
// 新增【请填写功能名称】
|
||||||
export function addAccredit(data) {
|
export function addSourceAccredit(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/etl/sourceAccredit',
|
url: '/etl/sourceAccredit',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
@ -26,6 +34,15 @@ export function addAccredit(data) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 新增【请填写功能名称】
|
||||||
|
export function deleteSourceAccreditBySourceIds(data) {
|
||||||
|
return request({
|
||||||
|
url: '/etl/sourceAccredit/DeleteSourceAccreditBySourceIds',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 修改【请填写功能名称】
|
// 修改【请填写功能名称】
|
||||||
export function updateAccredit(data) {
|
export function updateAccredit(data) {
|
||||||
return request({
|
return request({
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
<!-- <div v-for="o in 4" :key="o" class="text item">-->
|
<!-- <div v-for="o in 4" :key="o" class="text item">-->
|
||||||
<!-- {{'列表内容 ' + o }}-->
|
<!-- {{'列表内容 ' + o }}-->
|
||||||
<!-- </div>-->
|
<!-- </div>-->
|
||||||
<el-descriptions class="margin-top" :title="notice.noticeTitle" :column="2" :size="size" border>
|
<el-descriptions class="margin-top" :title="notice.noticeTitle" :column="2" border>
|
||||||
<template slot="extra">
|
<template slot="extra">
|
||||||
<el-button size="small" @click="readNotice(notice)">阅读消息</el-button>
|
<el-button size="small" @click="readNotice(notice)">阅读消息</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
<el-switch
|
<el-switch
|
||||||
style="display: block"
|
style="display: block"
|
||||||
v-model="scope.row.isAuth"
|
v-model="scope.row.isAuth"
|
||||||
|
@change="authChange(scope.row)"
|
||||||
active-color="#13ce66"
|
active-color="#13ce66"
|
||||||
inactive-color="#ff4949"
|
inactive-color="#ff4949"
|
||||||
active-text="已授权"
|
active-text="已授权"
|
||||||
|
@ -52,7 +53,6 @@
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<pagination v-show="total> 0" :limit.sync="pageSize" :page.sync="pageNum" :total="total"/>
|
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="用户授权" name="user">
|
<el-tab-pane label="用户授权" name="user">
|
||||||
<el-table ref="table" v-loading="loading" :data="userList">
|
<el-table ref="table" v-loading="loading" :data="userList">
|
||||||
|
@ -67,6 +67,7 @@
|
||||||
<el-switch
|
<el-switch
|
||||||
style="display: block"
|
style="display: block"
|
||||||
v-model="scope.row.isAuth"
|
v-model="scope.row.isAuth"
|
||||||
|
@change="authChange(scope.row)"
|
||||||
active-color="#13ce66"
|
active-color="#13ce66"
|
||||||
inactive-color="#ff4949"
|
inactive-color="#ff4949"
|
||||||
active-text="已授权"
|
active-text="已授权"
|
||||||
|
@ -75,7 +76,7 @@
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<pagination v-show="total> 0" :limit.sync="pageSize" :page.sync="pageNum" :total="total"/>
|
<pagination v-show="userQueryParams.total> 0" :limit.sync="userQueryParams.pageSize" :page.sync="userQueryParams.pageNum" :total="userQueryParams.total"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
|
@ -86,8 +87,22 @@
|
||||||
import { parseTime } from '@/utils/muyu'
|
import { parseTime } from '@/utils/muyu'
|
||||||
import {listDept} from "@/api/system/dept";
|
import {listDept} from "@/api/system/dept";
|
||||||
import {listUser} from "@/api/system/user";
|
import {listUser} from "@/api/system/user";
|
||||||
|
import {
|
||||||
|
addAccredit,
|
||||||
|
addSourceAccredit,
|
||||||
|
deleteSourceAccreditBySourceIds,
|
||||||
|
getSourceAccreditByDataSourceId
|
||||||
|
} from "@/api/etl/sourceAccredit";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
watch:{
|
||||||
|
'title':{
|
||||||
|
handler(val) {
|
||||||
|
this.getSourceAccreditByDataSourceId()
|
||||||
|
},
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
},
|
||||||
props:{
|
props:{
|
||||||
title:{}
|
title:{}
|
||||||
},
|
},
|
||||||
|
@ -103,31 +118,97 @@ export default {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
total: 0
|
total: 0
|
||||||
},
|
},
|
||||||
|
sourceAccreditReq:{
|
||||||
|
deptIds: null,
|
||||||
|
userId: null,
|
||||||
|
dataSourceId: null
|
||||||
|
},
|
||||||
// 基本信息
|
// 基本信息
|
||||||
baseInfo: {
|
baseInfo: {
|
||||||
name: "测试1",
|
|
||||||
systemName: "云计算系统",
|
|
||||||
databaseName: "yunjisuan",
|
|
||||||
},
|
},
|
||||||
// 部门列表
|
// 部门列表
|
||||||
deptList: [],
|
deptList: [],
|
||||||
// 用户列表
|
// 用户列表
|
||||||
userList: []
|
userList: [],
|
||||||
|
userAccreditIds: [],
|
||||||
|
deptAccreditIds: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
setTimeout(() => this.loading = false, 200)
|
setTimeout(() => this.loading = false, 200)
|
||||||
this.getList()
|
|
||||||
this.getUserList()
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
recursion(deptInfo){
|
||||||
|
let ids =[]
|
||||||
|
ids.push(deptInfo.deptId)
|
||||||
|
if (deptInfo.children){
|
||||||
|
deptInfo.children.forEach(item => {
|
||||||
|
ids.push(item.deptId)
|
||||||
|
if (item.children){
|
||||||
|
ids.push(...this.recursion(item))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return ids
|
||||||
|
},
|
||||||
|
authChange(row) {
|
||||||
|
this.sourceAccreditReq={
|
||||||
|
deptIds:null,
|
||||||
|
userId: null,
|
||||||
|
dataSourceId: null
|
||||||
|
}
|
||||||
|
if (row.nickName){
|
||||||
|
this.sourceAccreditReq.userId = row.userId
|
||||||
|
this.sourceAccreditReq.dataSourceId = this.title.id
|
||||||
|
}else{
|
||||||
|
let ids=this.recursion(row)
|
||||||
|
const uniqueIds = [...new Set(ids)];
|
||||||
|
this.sourceAccreditReq.deptIds = uniqueIds
|
||||||
|
this.sourceAccreditReq.dataSourceId = this.title.id
|
||||||
|
}
|
||||||
|
if (row.isAuth){
|
||||||
|
addSourceAccredit(this.sourceAccreditReq).then(res => {
|
||||||
|
this.getSourceAccreditByDataSourceId()
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
deleteSourceAccreditBySourceIds(this.sourceAccreditReq).then(res => {
|
||||||
|
this.getSourceAccreditByDataSourceId()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
parseTime,
|
parseTime,
|
||||||
|
getSourceAccreditByDataSourceId(){
|
||||||
|
if (this.title.id != undefined){
|
||||||
|
getSourceAccreditByDataSourceId(this.title.id).then(response => {
|
||||||
|
this.deptAccreditIds = response.data.deptAccreditModelIds
|
||||||
|
this.userAccreditIds = response.data.userAccreditModelIds
|
||||||
|
setTimeout(() => this.getList(), 50)
|
||||||
|
setTimeout(() => this.getUserList(), 50)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
recursionAuth(deptInfo){
|
||||||
|
deptInfo.isAuth = this.deptAccreditIds.indexOf(deptInfo.deptId) > -1
|
||||||
|
if (deptInfo.children){
|
||||||
|
deptInfo.children.forEach(item => {
|
||||||
|
item.isAuth = this.deptAccreditIds.indexOf(item.deptId) > -1
|
||||||
|
if (item.children){
|
||||||
|
this.recursionAuth(item)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
/** 查询部门列表 */
|
/** 查询部门列表 */
|
||||||
getList() {
|
getList() {
|
||||||
listDept(this.queryParams).then(response => {
|
listDept(this.queryParams).then(response => {
|
||||||
console.log(response.data)
|
|
||||||
this.deptList = this.handleTree(response.data, "deptId");
|
this.deptList = this.handleTree(response.data, "deptId");
|
||||||
|
this.deptList.forEach(dept => {
|
||||||
|
// dept.isAuth = this.deptAccreditIds.indexOf(dept.deptId) > -1
|
||||||
|
this.recursionAuth(dept)
|
||||||
|
})
|
||||||
console.log(this.deptList)
|
console.log(this.deptList)
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
|
@ -136,235 +217,13 @@ export default {
|
||||||
getUserList() {
|
getUserList() {
|
||||||
listUser(this.addDateRange(this.userQueryParams, [])).then(response => {
|
listUser(this.addDateRange(this.userQueryParams, [])).then(response => {
|
||||||
this.userList = response.data.rows;
|
this.userList = response.data.rows;
|
||||||
|
this.userList.forEach(user => {
|
||||||
|
user.isAuth = this.userAccreditIds.indexOf(user.userId) > -1
|
||||||
|
})
|
||||||
this.userQueryParams.total = response.data.total;
|
this.userQueryParams.total = response.data.total;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
init(){
|
|
||||||
let response = {
|
|
||||||
"code": 200,
|
|
||||||
"msg": "操作成功",
|
|
||||||
"data": [
|
|
||||||
{
|
|
||||||
"createBy": 1,
|
|
||||||
"createTime": "2023-09-29 11:47:27",
|
|
||||||
"updateBy": null,
|
|
||||||
"updateTime": null,
|
|
||||||
"deptId": 100,
|
|
||||||
"parentId": 0,
|
|
||||||
"ancestors": "0",
|
|
||||||
"deptName": "muyu牧鱼科技",
|
|
||||||
"orderNum": 0,
|
|
||||||
"leader": "muyu牧鱼",
|
|
||||||
"phone": "15888888888",
|
|
||||||
"email": "ry@qq.com",
|
|
||||||
"status": "0",
|
|
||||||
"delFlag": "0",
|
|
||||||
"parentName": null,
|
|
||||||
"children": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"createBy": 1,
|
|
||||||
"createTime": "2023-09-29 11:47:27",
|
|
||||||
"updateBy": null,
|
|
||||||
"updateTime": null,
|
|
||||||
"deptId": 101,
|
|
||||||
"parentId": 100,
|
|
||||||
"ancestors": "0,100",
|
|
||||||
"deptName": "深圳总公司",
|
|
||||||
"orderNum": 1,
|
|
||||||
"leader": "muyu牧鱼",
|
|
||||||
"phone": "15888888888",
|
|
||||||
"email": "ry@qq.com",
|
|
||||||
"status": "0",
|
|
||||||
"delFlag": "0",
|
|
||||||
"parentName": null,
|
|
||||||
"children": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"createBy": 1,
|
|
||||||
"createTime": "2023-09-29 11:47:27",
|
|
||||||
"updateBy": null,
|
|
||||||
"updateTime": null,
|
|
||||||
"deptId": 102,
|
|
||||||
"parentId": 100,
|
|
||||||
"ancestors": "0,100",
|
|
||||||
"deptName": "长沙分公司",
|
|
||||||
"orderNum": 2,
|
|
||||||
"leader": "muyu牧鱼",
|
|
||||||
"phone": "15888888888",
|
|
||||||
"email": "ry@qq.com",
|
|
||||||
"status": "0",
|
|
||||||
"delFlag": "0",
|
|
||||||
"parentName": null,
|
|
||||||
"children": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"createBy": 1,
|
|
||||||
"createTime": "2023-09-29 11:47:27",
|
|
||||||
"updateBy": null,
|
|
||||||
"updateTime": null,
|
|
||||||
"deptId": 103,
|
|
||||||
"parentId": 101,
|
|
||||||
"ancestors": "0,100,101",
|
|
||||||
"deptName": "研发部门",
|
|
||||||
"orderNum": 1,
|
|
||||||
"leader": "muyu牧鱼",
|
|
||||||
"phone": "15888888888",
|
|
||||||
"email": "ry@qq.com",
|
|
||||||
"status": "0",
|
|
||||||
"delFlag": "0",
|
|
||||||
"parentName": null,
|
|
||||||
"children": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"createBy": 1,
|
|
||||||
"createTime": "2023-09-29 11:47:27",
|
|
||||||
"updateBy": null,
|
|
||||||
"updateTime": null,
|
|
||||||
"deptId": 104,
|
|
||||||
"parentId": 101,
|
|
||||||
"ancestors": "0,100,101",
|
|
||||||
"deptName": "市场部门",
|
|
||||||
"isAuth": true,
|
|
||||||
"orderNum": 2,
|
|
||||||
"leader": "muyu牧鱼",
|
|
||||||
"phone": "15888888888",
|
|
||||||
"email": "ry@qq.com",
|
|
||||||
"status": "0",
|
|
||||||
"delFlag": "0",
|
|
||||||
"parentName": null,
|
|
||||||
"children": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"createBy": 1,
|
|
||||||
"createTime": "2023-09-29 11:47:27",
|
|
||||||
"updateBy": null,
|
|
||||||
"updateTime": null,
|
|
||||||
"deptId": 105,
|
|
||||||
"parentId": 101,
|
|
||||||
"ancestors": "0,100,101",
|
|
||||||
"deptName": "测试部门",
|
|
||||||
"orderNum": 3,
|
|
||||||
"leader": "muyu牧鱼",
|
|
||||||
"phone": "15888888888",
|
|
||||||
"email": "ry@qq.com",
|
|
||||||
"status": "0",
|
|
||||||
"delFlag": "0",
|
|
||||||
"parentName": null,
|
|
||||||
"children": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"createBy": 1,
|
|
||||||
"createTime": "2023-09-29 11:47:27",
|
|
||||||
"updateBy": null,
|
|
||||||
"updateTime": null,
|
|
||||||
"deptId": 106,
|
|
||||||
"parentId": 101,
|
|
||||||
"ancestors": "0,100,101",
|
|
||||||
"deptName": "财务部门",
|
|
||||||
"orderNum": 4,
|
|
||||||
"leader": "muyu牧鱼",
|
|
||||||
"phone": "15888888888",
|
|
||||||
"email": "ry@qq.com",
|
|
||||||
"status": "0",
|
|
||||||
"delFlag": "0",
|
|
||||||
"parentName": null,
|
|
||||||
"children": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"createBy": 1,
|
|
||||||
"createTime": "2023-09-29 11:47:27",
|
|
||||||
"updateBy": null,
|
|
||||||
"updateTime": null,
|
|
||||||
"deptId": 107,
|
|
||||||
"parentId": 101,
|
|
||||||
"ancestors": "0,100,101",
|
|
||||||
"deptName": "运维部门",
|
|
||||||
"orderNum": 5,
|
|
||||||
"leader": "muyu牧鱼",
|
|
||||||
"phone": "15888888888",
|
|
||||||
"email": "ry@qq.com",
|
|
||||||
"status": "0",
|
|
||||||
"delFlag": "0",
|
|
||||||
"parentName": null,
|
|
||||||
"children": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"createBy": 1,
|
|
||||||
"createTime": "2023-09-29 11:47:27",
|
|
||||||
"updateBy": null,
|
|
||||||
"updateTime": null,
|
|
||||||
"deptId": 108,
|
|
||||||
"parentId": 102,
|
|
||||||
"ancestors": "0,100,102",
|
|
||||||
"deptName": "市场部门",
|
|
||||||
"orderNum": 1,
|
|
||||||
"leader": "muyu牧鱼",
|
|
||||||
"phone": "15888888888",
|
|
||||||
"email": "ry@qq.com",
|
|
||||||
"status": "0",
|
|
||||||
"delFlag": "0",
|
|
||||||
"parentName": null,
|
|
||||||
"children": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"createBy": 1,
|
|
||||||
"createTime": "2023-09-29 11:47:27",
|
|
||||||
"updateBy": null,
|
|
||||||
"updateTime": null,
|
|
||||||
"deptId": 109,
|
|
||||||
"parentId": 102,
|
|
||||||
"ancestors": "0,100,102",
|
|
||||||
"deptName": "财务部门",
|
|
||||||
"orderNum": 2,
|
|
||||||
"leader": "muyu牧鱼",
|
|
||||||
"phone": "15888888888",
|
|
||||||
"email": "ry@qq.com",
|
|
||||||
"status": "0",
|
|
||||||
"delFlag": "0",
|
|
||||||
"parentName": null,
|
|
||||||
"children": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
this.deptList = this.handleTree(response.data, "deptId");
|
|
||||||
this.userList = [
|
|
||||||
{
|
|
||||||
"createBy": "admin",
|
|
||||||
"createTime": "2023-04-23 16:11:38",
|
|
||||||
"updateBy": null,
|
|
||||||
"updateTime": null,
|
|
||||||
"remark": "管理员",
|
|
||||||
"userId": 1,
|
|
||||||
"deptId": 103,
|
|
||||||
"userName": "admin",
|
|
||||||
"nickName": "智能车联",
|
|
||||||
"email": "ry@163.com",
|
|
||||||
"phonenumber": "15888888888",
|
|
||||||
"isAuth": true,
|
|
||||||
"dept": {
|
|
||||||
"deptName": "研发部门"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"createBy": "admin",
|
|
||||||
"createTime": "2023-04-23 16:11:38",
|
|
||||||
"updateBy": null,
|
|
||||||
"updateTime": null,
|
|
||||||
"remark": "测试员",
|
|
||||||
"userId": 2,
|
|
||||||
"deptId": 105,
|
|
||||||
"userName": "ry",
|
|
||||||
"nickName": "智能车联",
|
|
||||||
"email": "ry@qq.com",
|
|
||||||
"phonenumber": "15666666666",
|
|
||||||
"dept": {
|
|
||||||
"deptName": "测试部门"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
<el-switch
|
<el-switch
|
||||||
style="display: block"
|
style="display: block"
|
||||||
v-model="scope.row.isAuth"
|
v-model="scope.row.isAuth"
|
||||||
|
@change="authChange(scope.row)"
|
||||||
active-color="#13ce66"
|
active-color="#13ce66"
|
||||||
inactive-color="#ff4949"
|
inactive-color="#ff4949"
|
||||||
active-text="已授权"
|
active-text="已授权"
|
||||||
|
@ -81,6 +82,7 @@
|
||||||
<el-switch
|
<el-switch
|
||||||
style="display: block"
|
style="display: block"
|
||||||
v-model="scope.row.isAuth"
|
v-model="scope.row.isAuth"
|
||||||
|
@change="authChange(scope.row)"
|
||||||
active-color="#13ce66"
|
active-color="#13ce66"
|
||||||
inactive-color="#ff4949"
|
inactive-color="#ff4949"
|
||||||
active-text="已授权"
|
active-text="已授权"
|
||||||
|
@ -100,8 +102,18 @@
|
||||||
import { parseTime } from '@/utils/muyu'
|
import { parseTime } from '@/utils/muyu'
|
||||||
import {listDept} from "@/api/system/dept";
|
import {listDept} from "@/api/system/dept";
|
||||||
import {listUser} from "@/api/system/user";
|
import {listUser} from "@/api/system/user";
|
||||||
|
import {addAccredit, deleteSourceAccreditBySourceIds, getSourceAccreditByDataSourceId} from "@/api/etl/sourceAccredit";
|
||||||
|
import {addAssetAccredit, deleteAssetAccreditByAssetIds, getAssetAccreditByDataAssetId} from "@/api/etl/assetAccredit";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
watch:{
|
||||||
|
'title':{
|
||||||
|
handler(val) {
|
||||||
|
this.getAssetAccreditByDataAssetId()
|
||||||
|
},
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
},
|
||||||
props:{
|
props:{
|
||||||
title:{}
|
title:{}
|
||||||
},
|
},
|
||||||
|
@ -122,22 +134,88 @@ export default {
|
||||||
// 部门列表
|
// 部门列表
|
||||||
deptList: [],
|
deptList: [],
|
||||||
// 用户列表
|
// 用户列表
|
||||||
userList: []
|
userList: [],
|
||||||
|
deptAccreditIds:[],
|
||||||
|
userAccreditIds:[],
|
||||||
|
AssetAccreditReq:{
|
||||||
|
deptIds: null,
|
||||||
|
userId: null,
|
||||||
|
dataAssetId: null
|
||||||
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
setTimeout(() => this.loading = false, 200)
|
setTimeout(() => this.loading = false, 200)
|
||||||
this.getList()
|
|
||||||
this.getUserList()
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
recursion(deptInfo){
|
||||||
|
let ids =[]
|
||||||
|
ids.push(deptInfo.deptId)
|
||||||
|
if (deptInfo.children){
|
||||||
|
deptInfo.children.forEach(item => {
|
||||||
|
ids.push(item.deptId)
|
||||||
|
if (item.children){
|
||||||
|
ids.push(...this.recursion(item))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return ids
|
||||||
|
},
|
||||||
|
authChange(row) {
|
||||||
|
this.AssetAccreditReq={
|
||||||
|
deptIds:null,
|
||||||
|
userId: null,
|
||||||
|
dataAssetId: null
|
||||||
|
}
|
||||||
|
if (row.nickName){
|
||||||
|
this.AssetAccreditReq.userId = row.userId
|
||||||
|
this.AssetAccreditReq.dataAssetId = this.title.id
|
||||||
|
}else{
|
||||||
|
let ids=this.recursion(row)
|
||||||
|
const uniqueIds = [...new Set(ids)];
|
||||||
|
this.AssetAccreditReq.deptIds = uniqueIds
|
||||||
|
this.AssetAccreditReq.dataAssetId = this.title.id
|
||||||
|
}
|
||||||
|
if (row.isAuth){
|
||||||
|
addAssetAccredit(this.AssetAccreditReq).then(res => {
|
||||||
|
this.getAssetAccreditByDataAssetId()
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
deleteAssetAccreditByAssetIds(this.AssetAccreditReq).then(res => {
|
||||||
|
this.getAssetAccreditByDataAssetId()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
recursionAuth(deptInfo){
|
||||||
|
deptInfo.isAuth = this.deptAccreditIds.indexOf(deptInfo.deptId) > -1
|
||||||
|
if (deptInfo.children){
|
||||||
|
deptInfo.children.forEach(item => {
|
||||||
|
item.isAuth = this.deptAccreditIds.indexOf(item.deptId) > -1
|
||||||
|
if (item.children){
|
||||||
|
this.recursionAuth(item)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getAssetAccreditByDataAssetId() {
|
||||||
|
if (this.title.id != undefined) {
|
||||||
|
getAssetAccreditByDataAssetId(this.title.id).then(response => {
|
||||||
|
this.deptAccreditIds = response.data.deptAccreditModelIds
|
||||||
|
this.userAccreditIds = response.data.userAccreditModelIds
|
||||||
|
setTimeout(() => this.getList(), 50)
|
||||||
|
setTimeout(() => this.getUserList(), 50)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
/** 查询部门列表 */
|
/** 查询部门列表 */
|
||||||
getList() {
|
getList() {
|
||||||
listDept(this.queryParams).then(response => {
|
listDept(this.queryParams).then(response => {
|
||||||
console.log(response.data)
|
|
||||||
this.deptList = this.handleTree(response.data, "deptId");
|
this.deptList = this.handleTree(response.data, "deptId");
|
||||||
console.log(this.deptList)
|
this.deptList.forEach(dept => {
|
||||||
|
this.recursionAuth(dept)
|
||||||
|
})
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -145,49 +223,15 @@ export default {
|
||||||
getUserList() {
|
getUserList() {
|
||||||
listUser(this.addDateRange(this.userQueryParams, [])).then(response => {
|
listUser(this.addDateRange(this.userQueryParams, [])).then(response => {
|
||||||
this.userList = response.data.rows;
|
this.userList = response.data.rows;
|
||||||
|
this.userList.forEach(user => {
|
||||||
|
user.isAuth = this.userAccreditIds.indexOf(user.userId) > -1
|
||||||
|
})
|
||||||
this.userQueryParams.total = response.data.total;
|
this.userQueryParams.total = response.data.total;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
parseTime,
|
parseTime,
|
||||||
init(){
|
|
||||||
// this.deptList = this.handleTree(response.data, "deptId");
|
|
||||||
this.userList = [
|
|
||||||
{
|
|
||||||
"createBy": "admin",
|
|
||||||
"createTime": "2023-04-23 16:11:38",
|
|
||||||
"updateBy": null,
|
|
||||||
"updateTime": null,
|
|
||||||
"remark": "管理员",
|
|
||||||
"userId": 1,
|
|
||||||
"deptId": 103,
|
|
||||||
"userName": "admin",
|
|
||||||
"nickName": "智能车联",
|
|
||||||
"email": "ry@163.com",
|
|
||||||
"phonenumber": "15888888888",
|
|
||||||
"isAuth": true,
|
|
||||||
"dept": {
|
|
||||||
"deptName": "研发部门"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"createBy": "admin",
|
|
||||||
"createTime": "2023-04-23 16:11:38",
|
|
||||||
"updateBy": null,
|
|
||||||
"updateTime": null,
|
|
||||||
"remark": "测试员",
|
|
||||||
"userId": 2,
|
|
||||||
"deptId": 105,
|
|
||||||
"userName": "ry",
|
|
||||||
"nickName": "智能车联",
|
|
||||||
"email": "ry@qq.com",
|
|
||||||
"phonenumber": "15666666666",
|
|
||||||
"dept": {
|
|
||||||
"deptName": "测试部门"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -230,7 +230,7 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
async update(row) {
|
async update(row) {
|
||||||
await this.getDictionaryList()
|
this.getDictionaryList()
|
||||||
this.form = row;
|
this.form = row;
|
||||||
this.formStatus = true;
|
this.formStatus = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<el-col :lg="8" :sm="12" :xs="12" class="card-panel-col">
|
<el-col :lg="8" :sm="12" :xs="12" class="card-panel-col">
|
||||||
<div class="card-panel" @click="handleSetLineChartData('newVisitis')">
|
<div class="card-panel" @click="handleSetLineChartData('newVisitis')">
|
||||||
<div class="card-panel-icon-wrapper icon-people">
|
<div class="card-panel-icon-wrapper icon-people">
|
||||||
<svg-icon class-name="card-panel-icon" icon-class="database"/>
|
<svg-icon class-name="card-panel-icon" icon-class="table"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-panel-description">
|
<div class="card-panel-description">
|
||||||
<div class="card-panel-text">
|
<div class="card-panel-text">
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
<el-col :lg="8" :sm="12" :xs="12" class="card-panel-col">
|
<el-col :lg="8" :sm="12" :xs="12" class="card-panel-col">
|
||||||
<div class="card-panel" @click="handleSetLineChartData('purchases')">
|
<div class="card-panel" @click="handleSetLineChartData('purchases')">
|
||||||
<div class="card-panel-icon-wrapper icon-money">
|
<div class="card-panel-icon-wrapper icon-money">
|
||||||
<svg-icon class-name="card-panel-icon" icon-class="field"/>
|
<svg-icon class-name="card-panel-icon" icon-class="table"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-panel-description">
|
<div class="card-panel-description">
|
||||||
<div class="card-panel-text">
|
<div class="card-panel-text">
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<el-col :sm="12" :xs="12" class="card-panel-col">
|
<el-col :sm="12" :xs="12" class="card-panel-col">
|
||||||
<div class="card-panel" @click="handleSetLineChartData('purchases')">
|
<div class="card-panel" @click="handleSetLineChartData('purchases')">
|
||||||
<div class="card-panel-icon-wrapper icon-money">
|
<div class="card-panel-icon-wrapper icon-money">
|
||||||
<svg-icon class-name="card-panel-icon" icon-class="field"/>
|
<svg-icon class-name="card-panel-icon" icon-class="table"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-panel-description">
|
<div class="card-panel-description">
|
||||||
<div class="card-panel-text">
|
<div class="card-panel-text">
|
||||||
|
|
Loading…
Reference in New Issue