资产结构测试7

etl-xin
xiaohuang 2024-04-28 09:57:20 +08:00
parent 0f8c27aeca
commit 88359ed9e6
6 changed files with 1135 additions and 973 deletions

View File

@ -61,6 +61,14 @@ export function getTableTree(){
}) })
} }
// 修改资产数据结构
export function updateStructureInfo(data) {
return request({
url: '/etl/info/updateStructureInfo',
method: 'put',
data
})
}
//获取字典 //获取字典
export function getDict(id){ export function getDict(id){

View File

@ -57,7 +57,6 @@ export default {
structureNum: null, structureNum: null,
} }
}, },
watch: { watch: {
infoOpen(newName, oldName) { infoOpen(newName, oldName) {
console.log(newName) console.log(newName)

View File

@ -1,6 +1,5 @@
<template> <template>
<div> <div>
<el-row :gutter="40" class="panel-group"> <el-row :gutter="40" class="panel-group">
<div class="title-header"> <div class="title-header">
{{ this.name }} {{ this.name }}
@ -33,9 +32,6 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="40" class="panel-group"> <el-row :gutter="40" class="panel-group">
<el-card> <el-card>
<el-tabs type="border-card" @tab-click="handleClick"> <el-tabs type="border-card" @tab-click="handleClick">
<el-tab-pane <el-tab-pane
@ -43,37 +39,57 @@
:label="tableInfo.tableName+'('+tableInfo.info.tableRemark+')'"> :label="tableInfo.tableName+'('+tableInfo.info.tableRemark+')'">
<el-card> <el-card>
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>基础字典</span> <span>基础字典</span>
<!--新增字典表--> <!--新增字典表-->
<el-button type="text" style="float: right" @click="insertDictOpen = true">新增字典</el-button> <el-button type="text" style="float: right" @click="insertDictOpen = true">新增字典</el-button>
</div> </div>
<el-row> <el-row>
<el-card style="width: 3000px; float: left;margin: 10px" v-for="dictInfo in dictList"> <el-card style="width: 300px; float: left;margin:10px" v-for="dictInfo in dictList">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span> <span>{{ dictInfo.dictName }}({{ dictInfo.dictType }})</span>
<!--新增字典具体信息-->
{{dictInfo.dictName}} <el-button style="float: right; padding: 3px 0" type="text" @click="insertDictList(dictInfo)">
({{dictInfo.dictType}}) </el-button>
</span>
</div> </div>
<el-table :data="dictInfo.dictInfoList" height="216">
<el-table-column label="标签">
<template slot-scope="scope">
<span v-if="!scope.row.isEdit">{{ scope.row.infoName }}</span>
<el-input :value="scope.row.infoName"
v-model="scope.row.infoName"
v-if="scope.row.isEdit"></el-input>
</template>
</el-table-column>
<el-table-column label="值">
<template slot-scope="scope">
<span v-if="!scope.row.isEdit">{{ scope.row.infoValue }}</span>
<el-input :value="scope.row.infoValue"
v-model="scope.row.infoValue"
v-if="scope.row.isEdit"></el-input>
</template>
</el-table-column>
<el-table-column>
<template slot-scope="scope">
<el-button type="text" v-if="!scope.row.isEdit" @click="scope.row.isEdit = true">
</el-button>
<el-button type="text" v-if="scope.row.isEdit" @click="insertDictInfo(dictInfo.id,scope.row)">
确认
</el-button>
</template>
</el-table-column>
</el-table>
</el-card> </el-card>
</el-row> </el-row>
</el-card> </el-card>
<!--资产模型基本信息--> <!--资产模型基本信息-->
<el-card> <el-card>
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>资产模型基本信息</span> <span>资产模型基本信息</span>
</div> </div>
<el-descriptions <el-descriptions
class="margin-top" class="margin-top"
:column="2" :column="2"
border> border>
<el-descriptions-item> <el-descriptions-item>
<template slot="label"> <template slot="label">
<i class="el-icon-user"></i> <i class="el-icon-user"></i>
@ -81,7 +97,6 @@
</template> </template>
{{ tableInfo.info.tableName }} {{ tableInfo.info.tableName }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label"> <template slot="label">
<i class="el-icon-mobile-phone"></i> <i class="el-icon-mobile-phone"></i>
@ -89,7 +104,6 @@
</template> </template>
{{ tableInfo.info.tableRemark }} {{ tableInfo.info.tableRemark }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label"> <template slot="label">
<i class="el-icon-location-outline"></i> <i class="el-icon-location-outline"></i>
@ -97,45 +111,82 @@
</template> </template>
{{ tableInfo.info.dataNum }} {{ tableInfo.info.dataNum }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label"> <template slot="label">
<i class="el-icon-tickets"></i> <i class="el-icon-tickets"></i>
备注 备注
</template> </template>
<el-tag size="small">小黄</el-tag> <el-tag size="small">学校</el-tag>
</el-descriptions-item> </el-descriptions-item>
</el-descriptions> </el-descriptions>
</el-card> </el-card>
<!--数据模型--> <!--数据模型-->
<el-card> <el-card>
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>数据模型</span> <span>数据模型</span>
</div> </div>
<el-table <el-table
:data="tableInfo.info.structureList" :data="tableInfo.info.structureList"
style="width: 100%"> style="width: 100%"
>
<el-table-column fixed prop="columnName" label="字段名称" width="200px"/> <el-table-column fixed prop="columnName" label="字段名称" width="200px"/>
<el-table-column fixed prop="columnRemark" label="字段注释"/> <el-table-column fixed prop="columnRemark" label="字段注释"/>
<el-table-column fixed prop="isPrimary" label="是否主键" /> <el-table-column fixed prop="isPrimary" label="是否主键">
<template slot-scope="scope">
<el-tag :type="scope.row.isPrimary==='Y'?'success':'danger'">
{{ scope.row.isPrimary }}
</el-tag>
</template>
</el-table-column>
<el-table-column fixed prop="columnType" label="数据类型"/> <el-table-column fixed prop="columnType" label="数据类型"/>
<el-table-column fixed prop="javaType" label="映射类型"/> <el-table-column fixed prop="javaType" label="映射类型"/>
<el-table-column fixed prop="columnLength" label="字段长度"/> <el-table-column fixed prop="columnLength" label="字段长度"/>
<el-table-column fixed prop="columnDecimals" label="小数位数"/> <el-table-column fixed prop="columnDecimals" label="小数位数"/>
<el-table-column fixed prop="isNull" label="是否为空" /> <el-table-column fixed prop="isNull" label="是否为空">
<el-table-column fixed prop="defaultValue" label="默认值" />
<el-table-column fixed prop="isDictionary" label="是否字典" />
<el-table-column fixed prop="dictionaryTable" label="映射字典" />
<el-table-column fixed prop="dictionaryTable" label="映射字典" >
<template slot-scope="scope"> <template slot-scope="scope">
操作 <el-tag :type="scope.row.isNull==='Y'?'success':'danger'">
{{ scope.row.isNull }}
</el-tag>
</template>
</el-table-column>
<el-table-column fixed prop="defaultValue" label="默认值"/>
<el-table-column fixed prop="isDictionary" label="是否字典">
<template slot-scope="scope">
<el-tag v-if="scope.row.isDictionary!==null"
:type="scope.row.isDictionary==='Y'?'success':'danger'">
{{ scope.row.isDictionary }}
</el-tag>
{{ scope.row.isDictionary }}
</template>
</el-table-column>
<el-table-column fixed label="映射字典">
<template slot-scope="scope">
<el-popover trigger="hover" placement="left"
@mouseover.native="findDictList(scope.row.dictionaryTable)"
v-if="scope.row.dictionaryTable !== null">
<el-table
:data="findedDictList"
border
style="width: 100%">
<el-table-column prop="infoName" label="标签" width="180"></el-table-column>
<el-table-column prop="infoValue" label="值" width="180"></el-table-column>
</el-table>
<div slot="reference" class="name-wrapper">
<el-tag >
{{ scope.row.dictionaryTable }}
</el-tag>
</div>
</el-popover>
</template>
</el-table-column>
<el-table-column fixed prop="dictionaryTable" label="操作">
<template slot-scope="scope">
<el-button
type="text"
@click="editDictInfo(scope.row)">
编辑
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -144,71 +195,160 @@
</el-tabs> </el-tabs>
</el-card> </el-card>
</el-row> </el-row>
<!-- 添加新字典表对话框--> <!-- 添加新字典表对话框-->
<el-dialog title="字典表基础信息" style="float:left; margin:20px" :visible.sync="insertDictOpen"> <el-dialog title="字典表基础信息" style="float:left; margin:20px" :visible.sync="insertDictOpen">
<el-form :model="assetDictFormInfo"> <el-form :model="assetDictFormInfo">
<el-form-item label="字典表名" label-width="120px"> <el-form-item label="字典表名" label-width="120px">
<el-input v-model="assetDictFormInfo.dictName" autocomplete="off"></el-input> <el-input v-model="assetDictFormInfo.dictName" autocomplete="off"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="字典类型" label-width="120px"> <el-form-item label="字典类型" label-width="120px">
<el-input v-model="assetDictFormInfo.dictType" autocomplete="off"></el-input> <el-input v-model="assetDictFormInfo.dictType" autocomplete="off"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="insertDictOpen = false"> </el-button> <el-button @click="insertDictOpen = false"> </el-button>
<el-button type="primary" @click="insertDict(tableInfo.info)"> </el-button> <el-button type="primary" @click="insertDict(tableInfo.info)"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 编辑字典详细信息 -->
<el-dialog title="数据详情修改" :visible.sync="structureInfoFormOpen">
{{ this.structureInfoForm }}
<el-form :model="structureInfoForm" :inline="true" label-width="150px">
<el-row>
<el-col :span="12">
<el-form-item label="字段名">
<el-input v-model="structureInfoForm.columnName" disabled autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="是否主键">
<el-tag :type="structureInfoForm.isPrimary==='Y'?'success':'danger'" v-model="structureInfoForm.isNull">
{{ structureInfoForm.isPrimary }}
</el-tag>
</el-form-item>
<el-form-item label="数据类型">
<el-input v-model="structureInfoForm.columnType" disabled autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="长度">
<el-input v-model="structureInfoForm.columnLength" disabled autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="是否字典">
<el-switch
v-model="structureInfoForm.isDictionary"
active-value="Y"
inactive-value="N"
active-color="#13ce66"
inactive-color="#ff4949">
</el-switch>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注名">
<el-input v-model="structureInfoForm.columnRemark" disabled autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="是否非空">
<el-tag :type="structureInfoForm.isNull==='Y'?'success':'danger'" v-model="structureInfoForm.isNull">
{{ structureInfoForm.isNull }}
</el-tag>
</el-form-item>
<el-form-item label="java类型">
<el-input v-model="structureInfoForm.javaType" disabled autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="小数点位数">
<el-input v-model="structureInfoForm.columnDecimals" disabled autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="选择字典" v-if="structureInfoForm.isDictionary==='Y'">
<el-select v-model="structureInfoForm.dictionaryTable" placeholder="选择系统中的字典"
@change="checkDictList">
<el-option v-for="dictInfo in dictList" :label="dictInfo.dictName"
:value="dictInfo.dictType"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<!-- 显示所选字典内容-->
<el-row :gutter="20">
<el-col :span="12" :offset="6">
<div class="grid-content bg-purple">
<el-table :data="selectDictList">
<el-table-column label="标签" prop="infoName"></el-table-column>
<el-table-column label="值" prop="infoValue"></el-table-column>
</el-table>
</div>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="outEdit"> </el-button>
<el-button type="primary" @click="updateStructureInfo"> </el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import CountTo from "vue-count-to"; import CountTo from 'vue-count-to'
import {insertDict,insertDictInfo} from "@/api/etl/etl"; import {insertDict, insertDictInfo, updateStructureInfo} from "@/api/etl/etl";
export default { export default {
props: { props: {
name: null, name: null,
tableInfoList: Array, tableInfoList: Array,
dictList: Array dictList: Array
}, },
watch: { watch: {
//
tableInfoList: { tableInfoList: {
handler(newValue,oldValue){ handler(newValue) {
this.structureNum = 0 this.structureNum = 0
console.log('new')
console.log(oldValue)
console.log(newValue)
newValue.forEach(asset => { newValue.forEach(asset => {
this.structureNum += asset.info.structureList.length this.structureNum += asset.info.structureList.length
}) })
console.log(this.structureNum)
}, },
immediate: true, immediate: true,
deep: true deep: true
},
'structureInfoForm.isDictionary': {
handler(newValue) {
// if (newValue === "") {
//
// } else {
// console.log('' + newValue)
// if (!newValue) {
// this.structureInfoForm.dictionaryTable = null
// this.structureInfoForm.isDictTionary = null
// this.selectDictList = []
// }
// }
//
},
// immediate: true,
// deep: true
} }
}, },
name: 'AssetsModel', name: 'AssetsModel',
components: { components: {
CountTo CountTo
}, },
data() { data() {
return { return {
//
findedDictList: [],
//
selectDictList: [],
//
structureInfoFormOpen: false,
//
structureInfoForm: {
isDirectory: false,
dictionaryTable: null,
},
structureNum: null, structureNum: null,
//
tableInfoList: this.tableInfoList, tableInfoList: this.tableInfoList,
dictList: this.dictList, dictList: this.dictList,
// //
insertDictOpen: false, insertDictOpen: false,
//
dictFormInfoOpen: false, dictFormInfoOpen: false,
// //
assetDictFormInfo: { assetDictFormInfo: {
dictName: null, dictName: null,
@ -216,13 +356,43 @@ export default {
}, },
} }
}, },
methods: { methods: {
// //
updateDictInfo(row) { findDictList(dictName) {
row.isEdit = true console.log(11111111)
this.findedDictList = this.dictList.find(item => item.dictType === dictName).dictInfoList
//this.$set
console.log(this.findedDictList)
},
//
updateStructureInfo() {
console.log(this.structureInfoForm)
updateStructureInfo(this.structureInfoForm).then(res => {
this.$message.success(res.msg)
})
this.structureInfoFormOpen = false
this.structureInfoForm.isDictionary = 'N'
this.structureInfoForm.dictionaryTable = null
this.reset()
},
//
checkDictList(data) {
//data === dictType
this.selectDictList = this.dictList.find(item => item.dictType === data).dictInfoList
},
//
outEdit() {
this.structureInfoFormOpen = false
this.structureInfoForm.isDictionary = 'N'
this.structureInfoForm.dictionaryTable = null
},
//
editDictInfo(data) {
this.structureInfoFormOpen = true
let info = data
this.structureInfoForm = info
this.structureInfoForm.isDictionary = info.isDictionary === 'Y'
}, },
// //
insertDictList(data) { insertDictList(data) {
console.log(data) console.log(data)
@ -233,19 +403,16 @@ export default {
'isEdit': true, 'isEdit': true,
}) })
}, },
// //
insertDict(data) { insertDict(data) {
console.log(data) console.log(data)
// //
this.insertDictOpen = false this.insertDictOpen = false
this.assetDictFormInfo.basicId = data.basicId this.assetDictFormInfo.basicId = data.basicId
console.log(this.assetDictFormInfo) console.log(this.assetDictFormInfo)
insertDict(this.insertDictOpen) insertDict(this.assetDictFormInfo)
this.reset() this.reset()
}, },
// //
insertDictInfo(id, row) { insertDictInfo(id, row) {
console.log(row) console.log(row)
@ -270,7 +437,7 @@ export default {
}, },
// //
reset() { reset() {
// this.$emit('watchChild'); //$emitwatchChild
} }
} }
} }
@ -393,8 +560,3 @@ export default {
line-height: 100px; line-height: 100px;
} }
</style> </style>

View File

@ -1,4 +1,3 @@
@ -0,0 +1,221 @@
<template> <template>
<el-row :gutter="40" class="panel-group"> <el-row :gutter="40" class="panel-group">
<el-card> <el-card>
@ -73,7 +72,6 @@
</el-table> </el-table>
</el-card> </el-card>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</el-card> </el-card>
@ -85,13 +83,18 @@ import CountTo from 'vue-count-to'
export default { export default {
props:{ props:{
tableInfo:[], tableInfo:Array,
}, },
name: 'TableInfoModel', name: 'TableInfoModel',
components: { components: {
CountTo CountTo
}, },
data() {
return{
tableInfo:this.tableInfo
}
},
methods: { methods: {
handleSetLineChartData(type) { handleSetLineChartData(type) {
this.$emit('handleSetLineChartData', type) this.$emit('handleSetLineChartData', type)

View File

@ -4,18 +4,13 @@
<el-aside> <el-aside>
<el-tree :data="assetStructureList" <el-tree :data="assetStructureList"
:props="defaultProps" :props="defaultProps"
@node-click="handleNodeClick"> @node-click="handleNodeClick"></el-tree>
</el-tree>
</el-aside> </el-aside>
<el-main> <el-main>
<AssetsBasic v-if="!infoOpen" :info-open="infoOpen" :fund-data-num="fundDataNum"></AssetsBasic> <AssetsBasic v-if="!infoOpen" :infoOpen="infoOpen" :fundDataNum="fundDataNum"></AssetsBasic>
<AssetsModel v-if="this.tableInfoList.length!==0" :name="vueName" :dictList="dictList" :tableInfoList="tableInfoList"></AssetsModel> <AssetsModel v-if="this.tableInfoList.length!==0" @watchChild="handleNodeClick" :name="vueName" :dictList="dictList" :tableInfoList="tableInfoList"></AssetsModel>
<TableInfoModel v-if="this.tableInfoList.length===0" :table-info="tableInfoForm"></TableInfoModel> <TableInfoModel v-if="this.tableInfoList.length===0" :table-info="tableInfoForm"></TableInfoModel>
</el-main> </el-main>
</el-container> </el-container>
</div> </div>
</template> </template>
@ -31,7 +26,6 @@ export default {
name: 'construction', name: 'construction',
components: { TableInfoModel, AssetsModel, AssetsBasic}, components: { TableInfoModel, AssetsModel, AssetsBasic},
data() { data() {
return { return {
vueName:null, vueName:null,
@ -52,14 +46,13 @@ export default {
structureNum: null, structureNum: null,
}, },
childrenList: [], childrenList: [],
// //
assetStructureList: [], assetStructureList: [],
// //
defaultProps: { defaultProps: {
children: 'children', children: 'children',
label: 'tableName' label: 'tableName'
}, },
// //
dictList: [], dictList: [],
} }
@ -99,24 +92,23 @@ export default {
'tableName': info.dataResourceName + '(' + info.databaseName + '-' + info.dataSourcesSystemName + ')', 'tableName': info.dataResourceName + '(' + info.databaseName + '-' + info.dataSourcesSystemName + ')',
'children': child, 'children': child,
}) })
}) })
}) })
console.log(this.assetStructureList) console.log(this.assetStructureList)
}, },
// //
handleNodeClick(data) { handleNodeClick(data) {
// console.log(data)
console.log(data) console.log(data)
if (data===undefined){
data = sessionStorage.getItem('handleNodeClickData')
}
sessionStorage.setItem('handleNodeClickData',data)
//undefined //undefined
// console.log(data.children) // console.log(data.children)
this.infoOpen = true this.infoOpen = true
//infoForm //infoForm
this.tableInfoForm = data this.tableInfoForm = data
//form list //form list
if (data.children !== undefined) { if (data.children !== undefined) {
this.vueName = data.tableName this.vueName = data.tableName
this.tableInfoList = data.children this.tableInfoList = data.children
@ -127,7 +119,6 @@ export default {
this.dictList = response.data this.dictList = response.data
}) })
} else { } else {
// this.tableInfoList = this.assetStructureList.find(assent => // this.tableInfoList = this.assetStructureList.find(assent =>
// assent.info.id === this.tableInfoForm.info.basicId // assent.info.id === this.tableInfoForm.info.basicId
// ).children // ).children

View File

@ -110,7 +110,6 @@
/> />
<!-- 添加或修改对话框 --> <!-- 添加或修改对话框 -->
<el-dialog :title="title" :visible.sync="open" width="1200px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="1200px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="150px"> <el-form ref="form" :model="form" :rules="rules" label-width="150px">
<el-card> <el-card>
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
@ -134,8 +133,8 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="主机ip地址" prop="host"> <el-form-item label="用户名" prop="host">
<el-input v-model="form.username" placeholder="请输入主机ip地址" /> <el-input v-model="form.username" placeholder="请输入用户名" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -148,8 +147,8 @@
<el-form-item label="数据库名称" prop="databaseName"> <el-form-item label="数据库名称" prop="databaseName">
<el-input v-model="form.databaseName" placeholder="请输入数据库名称" /> <el-input v-model="form.databaseName" placeholder="请输入数据库名称" />
</el-form-item> </el-form-item>
<el-form-item label="数据库名称" prop="databaseName"> <el-form-item label="密码" prop="databaseName">
<el-input v-model="form.password" placeholder="请输入数据库名称" /> <el-input v-model="form.password" placeholder="请输入密码" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>