feat()选中不同节点展示不同效果重写

dev-1
王熙朝 2024-04-28 22:32:13 +08:00
parent 22708ed023
commit 4ce26e6362
8 changed files with 98 additions and 98 deletions

View File

@ -54,9 +54,9 @@ export function selNameTableList(name) {
}) })
} }
// 根据表名获取表结构 // 根据表名获取表结构
export function selNameListStructure(tableName) { export function selNameListStructure(tableName,databaseName) {
return request({ return request({
url: '/system/accredit/selNameListStructure/'+ tableName, url: '/system/accredit/selNameListStructure?tableName=' + tableName + '&databaseName=' + databaseName,
method: 'post' method: 'post'
}) })
} }
@ -74,11 +74,6 @@ export function updateListStructure(data) {
}) })
} }
/**
* 查看父类表
* @param data
* @returns {*}
*/
export function selectFrimary(data) { export function selectFrimary(data) {
return request({ return request({
url: '/system/accredit/selectFrimary', url: '/system/accredit/selectFrimary',
@ -87,9 +82,30 @@ export function selectFrimary(data) {
}) })
} }
export function listMiddle(name) { export function listMiddle(tableName,databaseName) {
return request({ return request({
url: '/system/accredit/listMiddle?name=' + name, url: '/system/accredit/listMiddle?tableName=' + tableName + '&databaseName=' + databaseName,
method: 'post'
})
}
export function listMiddle2(databaseName) {
return request({
url: '/system/accredit/listMiddle2?databaseName=' + databaseName,
method: 'post'
})
}
export function listUserMiddle(tableName,databaseName) {
return request({
url: '/system/accredit/listUserMiddle?tableName=' + tableName + '&databaseName=' + databaseName,
method: 'post'
})
}
export function listUserMiddle2(databaseName) {
return request({
url: '/system/accredit/listUserMiddle2?databaseName=' + databaseName,
method: 'post' method: 'post'
}) })
} }

View File

@ -414,7 +414,6 @@ export default {
const {data} = node; const {data} = node;
this.showAssets = data.type; this.showAssets = data.type;
if (data.type === 'dataTable') { if (data.type === 'dataTable') {
this.tableName = data.name
return resolve([]) return resolve([])
} }
setTimeout(() => { setTimeout(() => {

View File

@ -26,14 +26,14 @@
<el-table <el-table
ref="deptTable" ref="deptTable"
v-loading="loading" v-loading="loading"
:data="depts" :data="deptList"
:default-expand-all="true" :default-expand-all="true"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"> :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
<el-table-column label="部门名称" prop="deptName" ></el-table-column> <el-table-column label="部门名称" prop="deptName" ></el-table-column>
<el-table-column label="部门负责人" prop="leader" ></el-table-column> <el-table-column label="部门负责人" prop="leader" ></el-table-column>
<el-table-column label="邮箱" prop="email" ></el-table-column> <el-table-column label="邮箱" prop="email" ></el-table-column>
<el-table-column align="center" label="创建时间" prop="createTime" ></el-table-column> <el-table-column align="center" label="创建时间" prop="createTime"></el-table-column>
<el-table-column align="center" label="操作" prop="createTime" > <el-table-column align="center" label="操作" >
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch
style="display: block" style="display: block"
@ -76,9 +76,17 @@
</template> </template>
<script> <script>
import { listDeptVo, listSelectSysUser } from '@/api/system/accredit' import { listMiddle2, listUserMiddle2 } from '@/api/system/accredit'
export default { export default {
props: {
title: {
type: Object
},
stats: {
type: Object
}
},
name: "AuthDataSource", name: "AuthDataSource",
data() { data() {
return { return {
@ -97,7 +105,6 @@ export default {
}, },
// //
deptList: [], deptList: [],
depts: [],
// //
userList: [] userList: []
}; };
@ -109,13 +116,13 @@ export default {
}, },
methods: { methods: {
init() { init() {
this.baseInfo = this.stats
// //
listDeptVo().then(res => { listMiddle2(this.title.databaseName).then(res => {
this.depts = res.data this.deptList = res.data
console.log(this.depts)
}) })
// //
listSelectSysUser().then(res => { listUserMiddle2(this.title.databaseName).then(res => {
this.userList = res.data this.userList = res.data
}) })
}, },

View File

@ -75,7 +75,9 @@
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch
style="display: block" style="display: block"
v-model="scope.row.isAuth" v-model="scope.row.mid"
active-value="1"
inactive-value="0"
active-color="#13ce66" active-color="#13ce66"
inactive-color="#ff4949" inactive-color="#ff4949"
active-text="已授权" active-text="已授权"
@ -92,9 +94,14 @@
<script> <script>
import { listDeptVo, listSelectSysUser } from "@/api/system/accredit"; import { listMiddle, listUserMiddle } from "@/api/system/accredit";
export default { export default {
props: {
title: {
type: Object
},
},
name: "AuthTable", name: "AuthTable",
data() { data() {
return { return {
@ -128,10 +135,13 @@ export default {
}, },
methods: { methods: {
init(){ init(){
listDeptVo().then(res => { console.log(this.title.databaseName)
console.log(this.title.tableName)
listMiddle(this.title.tableName,this.title.databaseName).then(res => {
this.deptList = res.data this.deptList = res.data
console.log(res.data)
}) })
listSelectSysUser().then(res => { listUserMiddle(this.title.tableName,this.title.databaseName).then(res => {
this.userList = res.data this.userList = res.data
}) })
} }

View File

@ -9,21 +9,21 @@
:props="defaultProps"> :props="defaultProps">
<div class="custom-tree-node" slot-scope="{ node, data }"> <div class="custom-tree-node" slot-scope="{ node, data }">
<div v-if="data.type === 'dataSource'">{{ data.name + '('+data.databaseName + '-' + data.systemName+')' }}</div> <div v-if="data.type === 'dataSource'">{{ data.name + '('+data.databaseName + '-' + data.systemName+')' }}</div>
<div v-if="data.type === 'dataTable'">{{ data.name + '-'+data.as + '(' + data.dataTotal+')' }}</div> <div v-if="data.type === 'dataTable'">{{ data.tableName + '-'+data.as + '(' + data.dataTotal+')' }}</div>
</div> </div>
</el-tree> </el-tree>
</el-aside> </el-aside>
<el-container> <el-container>
<el-main> <el-main>
<auth-data-source v-if="showAuth === 'dataSource'"/> <auth-data-source v-if="showAuth === 'dataSource'" :title="title" :stats="stats" />
<auth-table v-else-if="showAuth === 'dataTable'"/> <auth-table v-else-if="showAuth === 'dataTable'" :title="title" />
</el-main> </el-main>
</el-container> </el-container>
</el-container> </el-container>
</template> </template>
<script> <script>
import { tableNameList } from '@/api/system/accredit' import { tableNameList, selectFrimary } from '@/api/system/accredit'
import AuthDataSource from './auth/AuthDataSource.vue' import AuthDataSource from './auth/AuthDataSource.vue'
import AuthTable from './auth/AuthTable.vue' import AuthTable from './auth/AuthTable.vue'
// jsjsjson, // jsjsjson,
@ -35,39 +35,15 @@ export default {
data() { data() {
// " // "
return { return {
tableName: [], title: null,
stats: null,
mainHeight: window.innerHeight - 85, mainHeight: window.innerHeight - 85,
defaultProps: { defaultProps: {
children: 'childrenList', children: 'childrenList',
label: 'name' label: 'name'
}, },
showAuth: null, showAuth: null,
assetStructureList: [ assetStructureList: [],
{
name: "测试1",
systemName: "云计算系统",
databaseName: "yunjisuan",
type: "dataSource"
},
{
name: "测试2",
systemName: "网站系统",
databaseName: "wangzhan",
type: "dataSource"
},
{
name: "测试3",
systemName: "物联网系统",
databaseName: "wulianwang",
type: "dataSource"
},
{
name: "测试4",
systemName: "传媒系统",
databaseName: "chuanmei",
type: "dataSource"
},
],
childrenList: [] childrenList: []
} }
}, },
@ -84,21 +60,29 @@ export default {
return resolve([]) return resolve([])
} }
setTimeout(() => { setTimeout(() => {
resolve(this.childrenList) resolve(data.tableLists)
}, 500); }, 500);
}, },
thisLib() { init() {
selectFrimary().then(res => {
this.assetStructureList = res.data
})
tableNameList().then(res => { tableNameList().then(res => {
this.childrenList = res.data; this.childrenList = res.data;
}) })
}, },
selName(data) { selName(data) {
this.showAuth=data.type this.showAuth=data.type
this.stats = data
this.title = {
tableName: data.name,
databaseName: data.databaseName
}
} }
}, },
// - 访this", // - 访this",
created() { created() {
this.thisLib() this.init()
}, },
// - 访DOM", // - 访DOM",
mounted() { mounted() {

View File

@ -44,7 +44,6 @@
</el-table> </el-table>
</span> </span>
</span> </span>
<el-tag slot="reference">{{scope.row.dictionary}}</el-tag> <el-tag slot="reference">{{scope.row.dictionary}}</el-tag>
</el-popover> </el-popover>
</template> </template>
@ -158,7 +157,6 @@
</template> </template>
<script> <script>
import { import {
listListstructure,
selNameListStructure, selNameListStructure,
updateListStructure updateListStructure
} from '@/api/system/accredit' } from '@/api/system/accredit'
@ -166,14 +164,23 @@ import { listDictType, selectDictType } from "@/api/system/dicts";
export default { export default {
props: { props: {
title: { tableParams: {
type: String type: Object
}, },
}, },
watch: {
handler(val) {
if (val != null) {
this.init()
}
}
},
name: 'OverallAssetStructure', name: 'OverallAssetStructure',
data() { data() {
return { return {
childrenList: [], childrenList: [],
tableName: '',
databaseName: '',
form: { form: {
tableName: '', tableName: '',
columnLassName: '', columnLassName: '',
@ -189,11 +196,6 @@ export default {
dictionary: '' dictionary: ''
}, },
formStatus: false, formStatus: false,
tableName: '',
dictMap:{
dictType: '',
dictDataList: []
},
dictMap2:{ dictMap2:{
dictType: '', dictType: '',
dictDataList: [] dictDataList: []
@ -202,47 +204,30 @@ export default {
} }
}, },
methods: { methods: {
selData(thanName){
selectDictType(thanName).then(res => {
this.dictMap = res.data
})
},
selData2(thanName){ selData2(thanName){
selectDictType(thanName).then(res => { selectDictType(thanName).then(res => {
this.dictMap2 = res.data this.dictMap2 = res.data
}) })
}, },
update(row) { update(row) {
console.log(row)
this.form = row; this.form = row;
this.formStatus = true; this.formStatus = true;
}, },
updYesTrue(row) { updYesTrue(row) {
console.log(row)
updateListStructure(row).then(res => { updateListStructure(row).then(res => {
this.$message.success(res.data) this.$message.success(res.data)
this.formStatus = false this.formStatus = false
}) })
}, },
init() { init() {
console.log(this.title) selNameListStructure(this.tableParams.tableName,this.tableParams.databaseName).then(res => {
if (this.title === undefined){
listListstructure().then(res => {
this.childrenList = res.data this.childrenList = res.data
}) })
}else{
selNameListStructure(this.title).then(res => {
this.childrenList = res.data
})
}
listDictType().then(res => { listDictType().then(res => {
this.dictOut = res.data this.dictOut = res.data
console.log(this.dictOut)
}) })
} }
}, },
// - 访this",
created() { created() {
this.init() this.init()
} }

View File

@ -136,7 +136,7 @@ export default {
title: { title: {
type: String, type: String,
default: "-" default: "-"
}, }
}, },
data() { data() {
return { return {
@ -163,17 +163,16 @@ export default {
return val return val
}, },
checkTableName(checkTab){ checkTableName(checkTab){
console.log(checkTab)
this.tableParams = this.tableList.findLast(item => item.tableName === checkTab.name) this.tableParams = this.tableList.findLast(item => item.tableName === checkTab.name)
}, },
updData(row) { updData(row) {
console.log(row)
selectDictData(row).then(res => { selectDictData(row).then(res => {
this.dictData = res.data this.dictData = res.data
}) })
row.isEdit = true row.isEdit = true
}, },
editConfirm(row) { editConfirm(row) {
console.log(row)
if (!row.dictLabel || !row.dictValue) { if (!row.dictLabel || !row.dictValue) {
this.$message.error('字典标签或字典值,不可为空'); this.$message.error('字典标签或字典值,不可为空');
return; return;
@ -184,7 +183,6 @@ export default {
row.isEdit = false; row.isEdit = false;
}, },
delType(row) { delType(row) {
console.log(row)
deleteDictType(row).then(res => { deleteDictType(row).then(res => {
this.$message.success(res.data) this.$message.success(res.data)
}) })

View File

@ -16,8 +16,8 @@
<el-container> <el-container>
<el-main> <el-main>
<OverallAssets v-if="showAssets == null"/> <OverallAssets v-if="showAssets == null"/>
<overall-specific-assets v-if="showAssets === 'dataSource'" :title="title"/> <overall-specific-assets v-if="showAssets === 'dataSource'" :title="title" />
<overall-asset-structure v-if="showAssets === 'dataTable'" :title="tableName"/> <overall-asset-structure v-if="showAssets === 'dataTable'" :table-params="tableParams" />
</el-main> </el-main>
</el-container> </el-container>
</el-container> </el-container>
@ -33,7 +33,6 @@ export default {
components: { OverallAssetStructure, OverallSpecificAssets, OverallAssets }, components: { OverallAssetStructure, OverallSpecificAssets, OverallAssets },
data() { data() {
return { return {
tableName: {},
mainHeight: window.innerHeight - 85, mainHeight: window.innerHeight - 85,
defaultProps: { defaultProps: {
children: 'childrenList', children: 'childrenList',
@ -42,6 +41,8 @@ export default {
assetStructureList: [], assetStructureList: [],
childrenList: [], childrenList: [],
showAssets: null, showAssets: null,
tableParams: null,
stats: null,
title: null title: null
} }
}, },
@ -57,15 +58,15 @@ export default {
resolve(data.tableLists) resolve(data.tableLists)
}, 500); }, 500);
}, },
showAssetsFun(data){ showAssetsFun(data) {
this.title = data.name + '('+data.databaseName + '-' + data.systemName+')' this.title = data.name + '(' + data.databaseName + '-' + data.systemName + ')'
this.showAssets = data.type; this.showAssets = data.type;
if (data.as === undefined){ this.stats = data
this.tableName = data.databaseName console.log(this.stats)
}else{ this.tableParams = {
this.tableName = data.name tableName: data.name,
databaseName: data.databaseName
} }
}, },
init() { init() {
selectFrimary().then(res => { selectFrimary().then(res => {