添加资产授权

pull/7/head^2
Yueng 2024-09-04 11:25:33 +08:00
parent 0ba53a33eb
commit 143527169a
7 changed files with 363 additions and 181 deletions

View File

@ -7,12 +7,4 @@ export function getExtractDataTableNameList() {
})
}
export function findTableValueList(basicId,dataId,tableName) {
return request({
url: '/property/dataSource/findTableValueList?basicId='+basicId+"&dataId="+dataId+"&tableName="+tableName,
method: 'post',
data: data
})
}

View File

@ -1,9 +1,42 @@
import request from '@/utils/request'
export function getConnectList(data) {
export function getExtractDataTableNameList() {
return request({
url: '/property/connect/selectConnect',
url: '/property/dataRunName/extractDataTableName',
method: 'post',
data: data
})
}
export function addDeptAssetAuthorization(data) {
return request({
url: '/property/dataRunName/addDeptAssetAuthorization',
method: 'post',
data:data
})
}
export function delDeptAssetAuthorization(data) {
return request({
url: '/property/dataRunName/delDeptAssetAuthorization',
method: 'post',
data:data
})
}
export function addUserAssetAuthorization(data) {
return request({
url: '/property/dataRunName/addUserAssetAuthorization',
method: 'post',
data:data
})
}
export function delUserAssetAuthorization(data) {
return request({
url: '/property/dataRunName/delUserAssetAuthorization',
method: 'post',
data:data
})
}

View File

@ -6,17 +6,3 @@ export function getExtractDataTableNameList() {
method: 'post',
})
}
export function findTableValue(dataId,name) {
return request({
url: '/property/dataRunName/findTableValue?dataId='+dataId+"&tableName="+name,
method: 'post',
})
}
export function selectBasicList() {
return request({
url: '/property/dataRunName/selectBasicList',
method: 'post',
})
}

View File

@ -48,10 +48,3 @@ export function selectHandleClick(data) {
})
}
export function extractDataName(data) {
return request({
url: '/property/dataRunName/extractDataName',
method: 'post',
data: data
})
}

View File

@ -38,7 +38,7 @@
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">是否核心</template>
<dict-tag :options="dict.type.sys_no" :value="tableBasic.isCenter"/>
<el-tag size="small" v-if="dataNum!=0"></el-tag>
</el-descriptions-item>
</el-descriptions>
</template>
@ -51,13 +51,13 @@
</div>
<el-row :gutter="20">
<!-- -->
<el-col :span="6" v-for="DataValue in assetShowList" style="margin-top: 20px">
<el-descriptions :title="tableBasic.tableRemark+'.'+tableBasic.tableName+'.'+DataValue.key" direction="vertical"
<el-col :span="6" v-for="DataValue in tableStructure" style="margin-top: 20px">
<el-descriptions :title="测试+'.'+tableBasic.name+'.'+DataValue.field" direction="vertical"
border :column="1">
<el-descriptions-item label="Type">
<el-tag size="small">{{ DataValue.type }}</el-tag>
<el-tag size="small">{{ DataValue.dataMapping}}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="Value">{{ DataValue.value }}</el-descriptions-item>
<el-descriptions-item label="Value">{{ DataValue.dataValue }}</el-descriptions-item>
</el-descriptions>
@ -65,15 +65,15 @@
</el-row>
</el-card>
<el-table
:data="DataValue"
:data="tableStructure"
style="width: 100%">
<el-table-column
prop="key"
prop="field"
label="key"
width="180">
</el-table-column>
<el-table-column
prop="label"
prop="annotation"
label="label"
width="180">
</el-table-column>
@ -82,11 +82,10 @@
label="type">
</el-table-column>
<el-table-column
prop="value"
prop="dataValue"
label="value">
</el-table-column>
</el-table>
</el-main>
</el-container>
@ -142,24 +141,12 @@ export default {
},
handleNodeClick(data){
console.log("...."+data)
this.tableBasic=data
console.log(this.tableBasic)
dataNum=this.tableBasic.tableFie.length
// findStructureByTableId(data.id).then((res)=>{
// this.tableStructure=res.data
// })
findTableValueList(data.id,data.dataId,data.tableName).then(res=>{
this.assetShowList=res.data;
this.DataValue=res.data;
})
console.log("-----"+this.DataValue);
console.log("...."+data.basicId)
}
this.dataNum=data.tableFie.length
this.tableStructure=data.tableFie
console.log(this.tableStructure)
},
},
// - 访this",
created() {

View File

@ -1,118 +1,183 @@
<template>
<div>
<h1>数据资产授权</h1>
<h1>资产授权</h1>
<el-container>
<el-aside width="400px">
<el-tree :data="data" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
</el-aside>
<el-main>
<el-form :inline="true" :model="tableBasic" class="demo-form-inline">
<el-form-item label="数据库名称">
<el-input v-model="tableBasic.name" placeholder="数据库/表名称" disabled></el-input>
</el-form-item>
<el-form-item label="中文名称">
<el-input v-model="text" placeholder="中文名称" disabled></el-input>
</el-form-item>
<el-form-item label="数据量">
<el-input v-model="dataNum" placeholder="数据量" disabled></el-input>
</el-form-item>
</el-form>
<el-card class="box-card">
<div slot="header" class="clearfix">
<span style="font-size: xx-large"></span>
<template>
<el-descriptions class="margin-top" title="资产模型基本信息" :column="2" border>
<el-descriptions-item>
<template slot="label">数据接入名称</template>
{{ tableBasics.accSourName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">系统名称</template>
{{ tableBasics.dataSourSystemName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">数据库名称</template>
{{ tableBasics }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">表名称</template>
{{ this.tableBasics.name }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">表中文名</template>
{{ this.tableBasics.name }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">数据量</template>
{{ dataNum}}
</el-descriptions-item>
</el-descriptions>
</template>
<span>卡片名称</span>
</div>
<template>
<el-tabs v-model="activeName" type="card" @tab-click="handleClick">
<el-tab-pane label="部门授权" name="first">
<el-table
v-if="refreshTable"
v-loading="loading"
:data="deptList"
:default-expand-all="isExpandAll"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
row-key="deptId">
<el-table-column label="部门名称" prop="deptName" width="260"></el-table-column>
<el-table-column label="部门负责人" prop="leader" width="260"></el-table-column>
<el-table-column label="邮箱" prop="email" width="260"></el-table-column>
<el-table-column align="center" label="创建时间" prop="createTime" width="200">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column align="center" class-name="small-padding fixed-width" label="操作(授权)">
<template slot-scope="scope">
<el-switch
:value="isDeptAccredited(scope.row.deptId)"
@change="handleDeptAccreditChange(scope.row.deptId,$event)"
active-color="#13ce66"
inactive-color="#ff4949">
</el-switch>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="用户授权" name="second">
<el-table v-loading="loading" :data="userList">
<el-table-column v-if="columns[0].visible" key="userId" align="center" label="用户编号" prop="userId"/>
<el-table-column v-if="columns[1].visible" key="userName" :show-overflow-tooltip="true" align="center" label="用户名称"
prop="userName"/>
<el-table-column v-if="columns[2].visible" key="nickName" :show-overflow-tooltip="true" align="center" label="用户昵称"
prop="nickName"/>
<el-table-column v-if="columns[3].visible" key="deptName" :show-overflow-tooltip="true" align="center" label="部门"
prop="dept.deptName"/>
<el-table-column v-if="columns[4].visible" key="phonenumber" align="center" label="手机号码"
prop="phonenumber" width="120"/>
<el-table-column v-if="columns[7].visible" key="email" align="center" label="邮箱"
prop="email" width="120"/>
<el-table-column v-if="columns[6].visible" align="center" label="创建时间" prop="createTime" width="160">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column align="center" class-name="small-padding fixed-width" label="操作(授权)" width="160">
<template slot-scope="scope">
<el-switch
:value="isAccredited(scope.row.userId)"
@change="handleAccreditChange(scope.row.userId,$event)"
active-color="#13ce66"
inactive-color="#ff4949">
</el-switch>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
</template>
</el-card>
<el-tabs type="border-card">
<el-tab-pane label="用户管理">
<el-card class="box-card" title="资产模型基本信息" :column="2" >
<el-table
:data="tableBasic" style="width: 100%">
<el-table-column label="部门名称" prop="field"></el-table-column>
<el-table-column label="部门负责人" prop="annotation"></el-table-column>
<el-table-column label="邮箱" prop="primarys"></el-table-column>
<el-table-column label="创建时间" prop="type"></el-table-column>
<el-table-column label="操作" prop="types"></el-table-column>
</el-table>
</el-card>
</el-tab-pane>
<el-tab-pane label="配置管理">
</el-tab-pane>
</el-tabs>
</el-main>
</el-container>
</div>
</template>
<style>
.el-main {
background-color: #ececec;
color: #000000;
line-height: 147px;
}
</style>
<script>
//jsjsjson,
//import from ',
import { findTableValue, getExtractDataTableNameList, selectBasicList } from '@/api/property/astr'
import {
addDeptAssetAuthorization,
addUserAssetAuthorization,
delDeptAssetAuthorization,
delUserAssetAuthorization,
getExtractDataTableNameList,
findDeptIdList,
findUserIdList
} from '@/api/property/asauth'
import { listUser } from '@/api/system/user'
import { listDept } from '@/api/system/dept'
import { parseTime } from '@/utils/muyu'
export default {
//import使"
components: {},
dicts: ['sys_no'],
dicts: ['sys_yes_no','sys_normal_disable'],
props: {},
data() {
//"
return {
tableMapping:[],
//
AccreditValue:false,
//
userList:[],
//
columns: [
{key: 0, label: `用户编号`, visible: false},
{key: 1, label: `用户名称`, visible: true},
{key: 2, label: `用户昵称`, visible: true},
{key: 3, label: `部门`, visible: true},
{key: 4, label: `手机号码`, visible: true},
{key: 5, label: `状态`, visible: false},
{key: 6, label: `创建时间`, visible: true},
{key: 7, label: `邮箱`, visible: true}
],
dataNum:0,
//
loading: true,
//
showSearch: true,
//
deptList: [],
//
deptOptions: [],
//
title: "",
//
open: false,
//
isExpandAll: true,
//
refreshTable: true,
//
queryParams: {
deptName: undefined,
status: undefined
},
data:[],
defaultProps: {
children: 'tableNames',
label: 'name'
},
dataNum:0,
tableBasic:{},
tableStructure:[],
tableBasics:{},
javaType:[],
valueList:[],
activeName: 'first',
AssetImPowerListReq:{
basicId:null,
tableId:null,
deptId:null,
userId:null
},
userIdList:[],
deptIdList:[],
};
},
// data",
@ -121,40 +186,190 @@ export default {
watch: {},
//",
methods: {
getSelectList(){
getExtractDataTableNameList().then((res)=>{
parseTime,
//switch
handleDeptAccreditChange(deptId, value) {
this.AssetImPowerListReq.basicId = this.tableBasic.basicId
this.AssetImPowerListReq.tableId = this.tableBasic.id
this.AssetImPowerListReq.deptId = deptId
if (this.tableBasic.children != null) {
this.AssetImPowerListReq.tableId = null;
} else {
this.AssetImPowerListReq.basicId = null;
}
if (value === true) {
//
addDeptAssetAuthorization(this.AssetImPowerListReq).then((res) => {
if (res.code === 200) {
this.$modal.msgSuccess("权限赋予成功");
} else {
this.$modal.msgError("权限赋予失败");
}
this.findDeptIdList();
this.isDeptAccredited()
})
} else {
//
delDeptAssetAuthorization(this.AssetImPowerListReq).then((res) => {
if (res.code === 200) {
this.$modal.msgSuccess("权限删除成功");
} else {
this.$modal.msgError("权限删除失败");
}
this.findDeptIdList();
this.isDeptAccredited()
})
}
},
//switch,
handleAccreditChange(userId, value) {
console.log("userId的值:" + userId);
console.log("value的值" + value)
this.AssetImPowerListReq.basicId = this.tableBasic.basicId
this.AssetImPowerListReq.tableId = this.tableBasic.id
this.AssetImPowerListReq.userId = userId
if (this.tableBasic.children != null) {
this.AssetImPowerListReq.tableId = null;
} else {
this.AssetImPowerListReq.basicId = null;
}
if (value === true) {
//
addUserAssetAuthorization(this.AssetImPowerListReq).then((res) => {
if (res.code === 200) {
this.$modal.msgSuccess("权限赋予成功");
} else {
this.$modal.msgError("权限赋予失败");
}
this.findUserIdList()
this.isAccredited()
})
} else {
//
delUserAssetAuthorization(this.AssetImPowerListReq).then((res) => {
if (res.code === 200) {
this.$modal.msgSuccess("权限删除成功");
} else {
this.$modal.msgError("权限删除失败");
}
this.findUserIdList()
this.isAccredited()
})
}
},
// ID
isAccredited(userId) {
return this.userIdList.includes(userId);
},
//ID
isDeptAccredited(deptId) {
return this.deptIdList.includes(deptId);
},
/**
* 查询用户列表
*/
getUserList() {
this.loading = true;
listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.userList = response.data.rows;
this.total = response.data.total;
this.loading = false;
console.log(response.data.rows)
}
);
},
/**
* 查询部门列表
*/
getList() {
this.loading = true;
listDept(this.queryParams).then(response => {
this.deptList = this.handleTree(response.data, "deptId");
this.loading = false;
});
},
/**
* 查询数据库和相关联表
*
* @returns {AxiosPromise} 返回集合
*/
findByTableName() {
getExtractDataTableNameList().then((res) => {
this.data = res.data
})
},
handleNodeClick(data){
debugger;
console.log(data)
if (this.tableBasic.name===data.name){
this.tableBasic={}
}
console.log(this.tableBasic.length)
if (this.tableBasic.length === undefined){
selectBasicList().then(ress=>{
this.tableBasic = ress.data
this.tableBasics.data
})
this.dataNum=data.tableFie.length
this.tableStructure=data.tableFie
findTableValue(data.dataId,data.name).then(res=>{
let tableMapping=res.data
})
}
/**
* 查询资产赋权用户信息
* @param data 参数信息
* @returns {*} 响应结果
*/
findUserIdList(){
findUserIdList(this.AssetImPowerListReq).then((res) => {
this.userIdList = res.data
})
},
/**
* 查询资产赋权部门信息
* @param data 参数信息
* @returns {*} 响应结果
*/
findDeptIdList(){
findDeptIdList(this.AssetImPowerListReq).then((res) => {
this.deptIdList = res.data
})
},
/**\
* 树形结构
* @param data
*/
handleNodeClick(data) {
this.tableBasic = data
this.AssetImPowerListReq.tableId = this.tableBasic.id
this.AssetImPowerListReq.basicId = this.tableBasic.basicId
this.AssetImPowerListReq.deptId = this.tableBasic.deptId
if (this.tableBasic.children != null) {
this.AssetImPowerListReq.tableId = null;
} else {
this.AssetImPowerListReq.basicId = null;
}
/**
* 查询资产赋权用户信息
* @param data 参数信息
* @returns {*} 响应结果
*/
findUserIdList(this.AssetImPowerListReq).then((res) => {
this.userIdList = res.data
})
/**
* 查询资产赋权部门信息
* @param data 参数信息
* @returns {*} 响应结果
*/
findDeptIdList(this.AssetImPowerListReq).then((res) => {
this.deptIdList = res.data
})
},
},
// - 访this",
created() {
this.getSelectList();
//
this.findByTableName()
//
this.getList()
//
this.getUserList()
},
// - 访DOM",

View File

@ -62,7 +62,7 @@
</template>
</el-table-column>
<el-table-column label="类型" prop="type"></el-table-column>
<el-table-column label="映射类型" prop="types"></el-table-column>
<el-table-column label="映射类型" prop="dataMapping"></el-table-column>
<el-table-column label="是否为空" prop="nullable"></el-table-column>
<el-table-column label="是否字典" prop="isDictionary"></el-table-column>
<el-table-column label="映射字典" prop="dictionaryTable"></el-table-column>
@ -87,7 +87,7 @@
//jsjsjson,
//import from ',
import { findTableValue, getExtractDataTableNameList } from '@/api/property/astr'
import { getExtractDataTableNameList } from '@/api/property/astr'
export default {
//import使"
@ -124,34 +124,10 @@ export default {
})
},
handleNodeClick(data){
// console.log(data)
this.tableBasic=data
this.dataNum=data.tableFie.length
this.tableStructure=data.tableFie
// console.log(this.tableStructure)
findTableValue(data.dataId,data.name).then(res=>{
let tableMapping = res.data
// console.log(res.data)
for (const index in tableMapping) {
for (const i in this.tableStructure) {
if (tableMapping[index].key === this.tableStructure[i].field) {
this.tableStructure[i].types.push(tableMapping[index].type)
console.log(this.tableStructure[i].types)
if (i !== 0&& this.tableStructure[i].types==this.tableStructure[0].types){
alert("dawdwadad")
return
}
}
}
}
})
},