feat:完成资产结构

master
20300 2024-04-27 09:12:07 +08:00
parent 9daaca9dea
commit 2933a0f5de
7 changed files with 285 additions and 55 deletions

View File

@ -8,6 +8,14 @@ export function getAssetsModelListByTableIds(ids) {
})
}
export function updateAssetsModel(assetsModel) {
return request({
url: '/data/assets/updateAssetsModel',
method: 'post',
data: assetsModel
})
}
export function getAssetsModelByDataTableId(id) {
return request({
url: '/data/assets/getAssetsModelByDataTableId?id='+id,

View File

@ -43,40 +43,140 @@
<el-table-column prop="defaultValue" label="默认值" />
<el-table-column prop="isDict" label="是否字典" >
<template slot-scope="scope">
<el-tag v-if="scope.row.isDictionary === 1" size="small" type="success">
<el-tag v-if="scope.row.isDictionary === 'Y'" size="small" type="success">
{{scope.row.isDictionary}}
</el-tag>
<el-tag v-if="scope.row.isDictionary === 'N'" size="small" type="error">
{{scope.row.isDictionary}}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="reflectionDictionary" label="映射字典" >
<el-table-column prop="dictionaryName" label="映射字典" >
<template slot-scope="scope">
<div @mouseenter="getDictionaryInfoList(scope.row)" @mouseout="isOpen = false">
<el-tag slot="reference" >{{scope.row.dictionaryName}}</el-tag>
</div>
<el-popover
v-if="scope.row.isDictionary === 1"
v-if="flagId == scope.row.id"
placement="left"
width="200"
trigger="hover">
<el-table :data="[
{ label: '男', value: '1' },
{ label: '女', value: '2' },
{ label: '未知', value: '0' },
]">
<el-table-column property="label" label="字典标签"/>
<el-table-column property="value" label="字典值"/>
v-model="isOpen"
trigger="hover"
width="200">
<el-table :data="tagSelectDictionaryInfoList">
<el-table-column property="dictionaryInfoTag" label="字典标签"/>
<el-table-column property="dictionaryInfoValue" label="字典值"/>
</el-table>
<el-tag slot="reference">{{scope.row.dictKey}}</el-tag>
</el-popover>
</template>
</el-table-column>
<el-table-column prop="id" label="操作" >
<template slot-scope="scope">
<el-button type="text">编辑</el-button>
<el-button type="text" @click="update(scope.row)"></el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog title="资产结构修改" width="80%" :visible.sync="formStatus">
<el-form :model="form" label-width="120px">
<el-row>
<el-col :span="12">
<el-form-item label="名称">
<el-input v-model="form.fieldsName" readonly autocomplete="off"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="注释">
<el-input v-model="form.fieldsAnnotation" readonly autocomplete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="是否主键">
<el-tag size="small" :type="form.isDictionary === 'Y' ? 'success' : 'danger'">
{{form.isDictionary}}
</el-tag>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="数据类型">
<el-input v-model="form.baseType" readonly autocomplete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="数据长度">
<el-input v-model="form.fieldsLength" readonly autocomplete="off"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="小数位">
<el-input v-model="form.decimalPlace" readonly autocomplete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="是否为空">
<el-tag size="small" :type="form.isEmpty === 'Y' ? 'success' : 'danger'">
{{form.isEmpty}}
</el-tag>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="默认值">
<el-input v-model="form.defaultValue" readonly autocomplete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="映射字段">
<el-input v-model="form.javaType" readonly autocomplete="off"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否字典">
<el-switch
v-model="form.isDictionary"
active-value='Y'
inactive-value='N'
active-color="#13ce66"
inactive-color="#ff4949">
</el-switch>
</el-form-item>
</el-col>
</el-row>
<el-row v-show="form.isDictionary === 'Y'">
<el-col :span="24">
<el-form-item label="字典">
<el-select v-model="form.dictionaryId" @change="giveSelect">
<el-option v-for="dict in dictList" :key="dict.dictionary.id" :label="dict.dictionary.dictionaryName" :value="dict.dictionary.id">{{dict.dictionary.dictionaryName}}</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item>
<el-table :data="selectedDictionaryInfoList" striped border>
<el-table-column property="dictionaryInfoTag" label="字典标签"/>
<el-table-column property="dictionaryInfoValue" label="字典值"/>
</el-table>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="formStatus = false"> </el-button>
<el-button type="primary" @click="updateAssetsModel()"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {getDictionaryRespByDataSourceId} from "@/api/dataSource/dictionary";
import {getAssetsModelByDataTableId, updateAssetsModel} from "@/api/dataSource/assets";
export default {
name: 'OverallAssetStructure',
props: {
@ -89,8 +189,98 @@ export default {
},
data() {
return {
isOpen: false,
tagSelectDictionaryInfoList: [],
dictionaryIdAndName: {
dictionaryName: null,
id: null
},
selectedDictionaryInfoList: [],
form: {},
formStatus: false,
dictList: [],
flagId: 0
}
},
watch: {
form:{
// variable
handler(item1){
this.dictList.forEach(dict => {
if (dict.dictionary.id == item1.dictionaryId){
this.$set(this, "selectedDictionaryInfoList", dict.dictionaryInfoList);
this.$set(this, "dictionaryIdAndName", dict.dictionary)
console.log(this.selectedDictionaryInfoList)
}
})
}
}
},
methods: {
getDictionaryInfoList(row) {
console.log("鼠标滑过:",row)
this.isOpen = true
this.flagId = row.id
getDictionaryRespByDataSourceId(this.tableInfo.dataSourceId).then(res => {
this.dictList = res.data
this.dictList.forEach(dict => {
if (dict.dictionary.id == row.dictionaryId){
this.$set(this, "tagSelectDictionaryInfoList", dict.dictionaryInfoList);
console.log(this.tagSelectDictionaryInfoList)
}
})
})
},
updateAssetsModel(){
console.log(this.form)
if (this.form.isDictionary == "Y"){
this.form.dictionaryId = this.dictionaryIdAndName.id;
this.form.dictionaryName = this.dictionaryIdAndName.dictionaryName;
}else {
this.form.dictionaryId = null;
this.form.dictionaryName = null;
}
updateAssetsModel(this.form).then(
res => {
this.$message.success(res.msg);
this.formStatus = false
this.form = {}
}
)
this.selectedDictionaryInfoList = []
},
giveSelect() {
console.log("id和名字",this.dictionaryIdAndName)
this.dictList.forEach(dict => {
if (dict.dictionary.id == this.form.dictionaryId){
this.$set(this, "selectedDictionaryInfoList", dict.dictionaryInfoList);
this.$set(this, "dictionaryIdAndName", dict.dictionary)
console.log(this.selectedDictionaryInfoList)
}
})
},
update(row){
console.log("tableInfo",this.tableInfo)
getDictionaryRespByDataSourceId(this.tableInfo.dataSourceId).then(
res => {
console.log("获取的所有当前表字典",res.data)
this.dictList = res.data
console.log("字典:",this.dictList)
this.form = row;
if (this.form.dictionaryId){
this.form.dictionaryId = Number(row.dictionaryId) // Number
}
console.log("form",this.form)
}
)
this.formStatus = true;
}
}
}
</script>
<style scoped lang="scss">

View File

@ -86,12 +86,11 @@
size="mini"
type="text"
icon="el-icon-edit"
@click="updateEdit(scope.row.id)"
:key="scope.row.id + this.nowTime"
@click="$set(scope.row,'isEdit',true)"
>修改</el-button>
<el-button
v-if="scope.row.isEdit"
@click="editConfirm(scope.row)"
@click="editConfirm(scope.row,dictionaryInfoResp.dictionary.id)"
size="mini"
type="text"
icon="el-icon-finished"
@ -107,7 +106,7 @@
</el-col>
<el-col :span="24">
<el-tabs v-model="activeName" type="border-card" >
<el-tab-pane :label="assetsModelResp.dataTable.tableName" :key="assetsModelResp.dataTable.id" v-for="assetsModelResp in assetsModelRespArrayList">
<el-tab-pane :name="assetsModelResp.dataTable.tableName" :label="assetsModelResp.dataTable.tableName" :key="assetsModelResp.dataTable.id" v-for="assetsModelResp in assetsModelRespArrayList">
<overall-asset-structure :tableInfo="assetsModelResp.dataTable" :assetsModelList="assetsModelResp.assetsModelList" />
</el-tab-pane>
</el-tabs>
@ -119,26 +118,17 @@
<script>
import CountTo from 'vue-count-to'
import OverallAssetStructure from './OverallAssetStructure.vue'
import {getDictionaryRespByDataSourceId} from "@/api/dataSource/dictionary";
import {getDictionaryRespByDataSourceId, insertDictionary, insertDictionaryInfo} from "@/api/dataSource/dictionary";
export default {
watch:{
dataSourceId:{
assetsModelRespArrayList:{
// variable
handler(item1,item2){
console.log("新值",item1)
this.activeName=item1[0].dataTable.tableName
console.log("name:",this.activeName)
console.log("旧址",item2)
getDictionaryRespByDataSourceId(item1).then(
res => {
console.log("字典表响应对象:",res.data)
this.dictionaryInfoRespList = res.data
this.dictionaryInfoRespList.forEach(dictionaryInfoResp => {
dictionaryInfoResp.dictionaryInfoList.forEach(dictionaryInfo => {
dictionaryInfo.isEdit = false;
})
})
}
)
}
}
},
@ -149,16 +139,16 @@ export default {
dataSourceObj: {
type: Object
},
dataSourceId: {
type: Number,
dictionaryInfoRespList: {
type: Array
}
},
data() {
return {
nowTime: null,
dictionaryInfoRespList: [],
activeName: 'first',
dictionary: {}
activeName: '',
dictionary: {},
giveObj: []
}
},
components: {
@ -167,24 +157,46 @@ export default {
},
methods: {
updateEdit(row) {
this.$set(row,'isEdit',true)
console.log("行对象:"+row)
this.dictionaryInfoRespList.forEach(dictionaryInfoResp => {
dictionaryInfoResp.dictionaryInfoList.forEach(dictionaryInfo => {
if (dictionaryInfo.id == row){
console.log("进来了",dictionaryInfo.isEdit)
dictionaryInfo.isEdit = true
}
})
})
this.$forceUpdate()
this.nowTime = new Date()
// this.dictionaryInfoRespList.forEach(dictionaryInfoResp => {
// dictionaryInfoResp.dictionaryInfoList.forEach(dictionaryInfo => {
// if (dictionaryInfo.id == row){
// console.log("",dictionaryInfo.isEdit)
// this.$set(dictionaryInfo,'isEdit',true)
// dictionaryInfo.isEdit = true
// }
// })
// })
},
editConfirm(row){
if (!row.dictionaryInfoTag || !row.dictionaryInfoValue) {
editConfirm(row,dictId){
row.dictionaryId = dictId
console.log("字典信息",row)
if (row.dictionaryInfoTag.length == 0 || row.dictionaryInfoValue.length == 0) {
this.$message.error('字典标签或字典值,不可为空');
return;
}
row.isEdit = false;
insertDictionaryInfo(row).then(
res => {
console.log("添加字典详情:",res.data)
}
)
this.getDictionaryResp()
},
getDictionaryResp() {
getDictionaryRespByDataSourceId(this.dataSourceObj.dataSource.id).then(
res => {
console.log("字典表响应对象:",res.data)
this.giveObj = res.data
this.giveObj.forEach(dictionaryInfoResp => {
dictionaryInfoResp.dictionaryInfoList.forEach(dictionaryInfo => {
this.$set(dictionaryInfo,'isEdit',false)
})
})
this.$emit('handleSetLineChartData', this.giveObj)
}
)
},
handleSetLineChartData(type) {
this.$emit('handleSetLineChartData', type)
@ -194,7 +206,14 @@ export default {
this.$message.error('数据字典,不可为空');
return;
}
console.log(this.dictionary.dictionaryName)
this.dictionary.dataSourceId = this.dataSourceObj.dataSource.id
insertDictionary(this.dictionary).then(
res => {
console.log(res)
this.dictionary = {}
this.getDictionaryResp()
}
)
},
}
}

View File

@ -16,7 +16,7 @@
<el-container>
<el-main>
<OverallAssets :dataSourceCount="dataSourceCount" :allTableCount="allTableCount" :allDataModelCount="allDataModelCount" v-if="showAssets == null"/>
<overall-specific-assets :dataSourceId="dataSourceId" :dataSourceObj="dataSourceObj" :assetsModelRespArrayList="assetsModelRespArrayList" v-if="showAssets === 'dataSource'" :title="title"/>
<overall-specific-assets @changeDictionaryInfoRespList="changeDictionaryInfoRespList" :dictionaryInfoRespList="dictionaryInfoRespList" :dataSourceObj="dataSourceObj" :assetsModelRespArrayList="assetsModelRespArrayList" v-if="showAssets === 'dataSource'" :title="title"/>
<overall-asset-structure :tableInfo="tableInfo" :assetsModelList="assetsModelList" v-if="showAssets === 'dataTable'" :title="title"/>
</el-main>
</el-container>
@ -71,9 +71,22 @@ export default {
console.log("this.assetsModelRespArrayList",this.assetsModelRespArrayList)
}
)
this.dataSourceId = data.dataSource.id
getDictionaryRespByDataSourceId(data.dataSource.id).then(
res => {
console.log("字典表响应对象:",res.data)
this.dictionaryInfoRespList = res.data
this.dictionaryInfoRespList.forEach(dictionaryInfoResp => {
dictionaryInfoResp.dictionaryInfoList.forEach(dictionaryInfo => {
this.$set(dictionaryInfo,'isEdit',false)
})
})
}
)
this.dataSourceObj = data
console.log("obj",this.dataSourceObj)
},
changeDictionaryInfoRespList(value){
this.dictionaryInfoRespList = value
},
getTableStructure(data) {
console.log(data.dataTable.id)

View File

@ -44,7 +44,7 @@
</el-row>
<el-row :gutter="20">
<el-col :lg="12" :sm="24" style="padding-left: 20px">
<h2>若依后台管理框架</h2>
<h2>ELT数据扭转系统</h2>
<p>
一直想做一款后台管理系统看了很多优秀的开源项目但是发现没有合适自己的于是利用空闲休息时间开始自己写一套后台系统如此有了若依管理系统她可以用于所有的Web应用程序如网站管理后台网站会员中心CMSCRMOA等等当然您也可以对她进行深度定制以做出更强系统所有前端后台代码封装过后十分精简易上手出错概率低同时支持移动客户端访问系统会陆续更新一些实用功能
</p>

View File

@ -1,7 +1,7 @@
<template>
<div class="login">
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
<h3 class="title">若依后台管理系统</h3>
<h3 class="title">ELT数据扭转系统</h3>
<el-form-item prop="username">
<el-input
v-model="loginForm.username"

View File

@ -1,7 +1,7 @@
<template>
<div class="register">
<el-form ref="registerForm" :model="registerForm" :rules="registerRules" class="register-form">
<h3 class="title">若依后台管理系统</h3>
<h3 class="title">ELT数据管理系统</h3>
<el-form-item prop="username">
<el-input v-model="registerForm.username" auto-complete="off" placeholder="账号" type="text">
<svg-icon slot="prefix" class="el-input__icon input-icon" icon-class="user"/>