feat: 数据字典

master
rouchen 2024-04-28 22:10:22 +08:00
parent 5d3d0b3c76
commit 0b4392c9e8
7 changed files with 143 additions and 136 deletions

2
src/api/bes.js 100644
View File

@ -0,0 +1,2 @@
import Vue from 'vue';
export default new Vue;

View File

@ -160,3 +160,19 @@ export function selectDictionaryTypeId(data) {
data
})
}
//修改
export function utilAssetModel(data) {
return request({
url: '/kvt/kvt/utilAssetModel',
method: 'post',
data
})
}
//查询数据的总个数
export function overallDataStructure() {
return request({
url: '/kvt/kvt/OverallDataStructure',
method: 'post'
})
}

View File

@ -1,6 +1,6 @@
import Vue from 'vue'
import Cookies from 'js-cookie'
Vue.prototype.$EventBus = new Vue();
Vue.prototype.$Eventstatus = new Vue();
import Element from 'element-ui'
import './assets/styles/element-variables.scss'

View File

@ -3,9 +3,7 @@
<el-card>
<div slot="header" class="clearfix">
<span>资产模型基本信息</span>
{{selectAll}}
</div>
{{childrenMess}}
<el-descriptions border :column="2" >
<el-descriptions-item label="表名称">{{childrenMess.name}}</el-descriptions-item>
@ -18,7 +16,7 @@
</el-card>
<el-card style=" margin-top: 20px;">
<div slot="header" class="clearfix">
<span> {{selectData}}资产模型详细信息</span>
<span> 资产模型详细信息</span>
</div>
<el-table
:data="selectData"
@ -58,13 +56,9 @@
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="字典值"/>
<el-table :data="thisDict[scope.row.dictKey]">
<el-table-column property="dictionaryName" label="字典标签"/>
<el-table-column dictionaryValue="value" label="字典值"/>
</el-table>
<el-tag slot="reference">{{scope.row.dictKey}}</el-tag>
</el-popover>
@ -77,8 +71,10 @@
</el-table-column>
</el-table>
</el-card>
<el-dialog title="资产结构修改" width="80%" :visible.sync="formStatus">
<el-form :model="form" label-width="120px">
{{form}}
<el-row>
<el-col :span="12">
<el-form-item label="名称">
@ -149,28 +145,28 @@
</el-form-item>
</el-col>
</el-row>
<el-row v-if="form.isDict === 'Y'">
<el-col :span="24">
<el-form-item label="字典">
<el-select v-model="form.dictKey">
<el-option v-for="(value, key) in dictMap" :key="key" :label="key" :value="key"></el-option>
<el-select v-model="form.dictKey" @change="selectedChange">
<el-option v-for="(value, key) in dictMap" :key="value.id" :label="value.name" :value="value.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item>
<el-table :data="dictMap[form.dictKey]" striped border>
<el-table-column property="label" label="字典标签"/>
<el-table-column property="val" label="字典值"/>
<el-table :data="thisDict" striped border>
<el-table-column property="dictionaryName" label="字典标签"/>
<el-table-column property="dictionaryValue" 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="formStatus = false"> </el-button>
<el-button type="primary" @click=" utilAssetModel(form,thisDict)"> </el-button>
</div>
</el-dialog>
</div>
@ -180,13 +176,15 @@
import bus from '@/api/bus'
import buss from '@/api/buss'
import bues from '@/api/bues'
import { utilAssetModel } from '@/api/kvt/kvt'
import bes from '@/api/bes'
export default {
name: 'OverallAssetStructure',
props: [
'selectData',
'childrenMess',
'selectAll',
'dictName'
],
data() {
return {
@ -204,75 +202,22 @@ export default {
// defaultValue: "-",
// isDict: "N",
// dictKey: "-",
// },
// {
// id: 2,
// name: "name",
// comment: "",
// isPrimaryKey: "N",
// type: "varchar",
// mappingType: "String",
// length: "64",
// decimalPlaces: "-",
// isNull: "N",
// defaultValue: "-",
// isDict: "N",
// dictKey: "-",
// }, {
// id: 3,
// name: "sex",
// comment: "",
// isPrimaryKey: "N",
// type: "char",
// mappingType: "String",
// length: "1",
// decimalPlaces: "-",
// isNull: "N",
// defaultValue: "-",
// isDict: "Y",
// dictKey: "system_sex",
// }, {
// id: 4,
// name: "price",
// comment: "",
// isPrimaryKey: "N",
// type: "double",
// mappingType: "BigDecimal",
// length: "10",
// decimalPlaces: "2",
// isNull: "N",
// defaultValue: "0.00",
// isDict: "N",
// dictKey: "-",
// }, {
// id: 5,
// name: "create_time",
// comment: "",
// isPrimaryKey: "N",
// type: "datetime",
// mappingType: "Date",
// length: "-",
// decimalPlaces: "-",
// isNull: "Y",
// defaultValue: "-",
// isDict: "N",
// dictKey: "-",
// },
// }
],
form: {},
formStatus: false,
dictMap: {
"system_sex": [
{ label: '男', val: '1', isEdit: false },
{ label: '女', val: '2', isEdit: false },
{ label: '未知', val: '0', isEdit: false },
],
"system_y_n": [
{ label: '是', val: '1', isEdit: false },
{ label: '否', val: '0', isEdit: false }
],
}
dictMap: [],
// "system_sex": [
// { label: '', val: '1', isEdit: false },
// { label: '', val: '2', isEdit: false },
// { label: '', val: '0', isEdit: false },
// ],
// "system_y_n": [
// { label: '', val: '1', isEdit: false },
// { label: '', val: '0', isEdit: false }
// ],
dict: [],
thisDict:[]
}
},
created() {
@ -283,22 +228,34 @@ export default {
this.$off('send',this.childrenMess );
this.$off('大头小头',this.selectData);
},
methods: {
utilAssetModel(from){
utilAssetModel(from).then(res => {
this.$message.success(res.data)
})
this.formStatus = false
},
selectedChange(val){
console.log(111,val)
this.thisDict=this.dictMap.filter(x=>x.id===val)[0].dictionaryTypes;
},
sendSelectAll(){
bus.$emit("sendSelecr", this. selectAll)
},
ENEN(){
buss.$on('send',data => {
this.childrenMess = data
console.log("childrenMess",this.childrenMess )
})
bues.$on('大头小头',(data) =>{
console.log("大头小头",data)
this.selectData = data
console.log("senddddd",this.selectData)
})
bues.$on('ss',(data) =>{
this.dictMap = data
})
},
update(row) {
console.log("rrrrrrrrrrrrr",row)
this.form = row;
this.formStatus = true;
}

View File

@ -13,7 +13,7 @@
<div class="card-panel-text">
数据接入
</div>
<count-to :duration="2600" :end-val="2" :start-val="0" class="card-panel-num"/>
<count-to :duration="2600" :end-val="this.DataStructure.kvt" :start-val="0" class="card-panel-num"/>
</div>
</div>
</el-col>
@ -26,7 +26,7 @@
<div class="card-panel-text">
资产模型
</div>
<count-to :duration="3000" :end-val="96" :start-val="0" class="card-panel-num"/>
<count-to :duration="3000" :end-val="this.DataStructure.table" :start-val="0" class="card-panel-num"/>
</div>
</div>
</el-col>
@ -39,7 +39,7 @@
<div class="card-panel-text">
数据模型
</div>
<count-to :duration="3200" :end-val="560" :start-val="0" class="card-panel-num"/>
<count-to :duration="3200" :end-val="this.DataStructure.datas" :start-val="0" class="card-panel-num"/>
</div>
</div>
</el-col>
@ -48,13 +48,28 @@
<script>
import CountTo from 'vue-count-to'
import { overallDataStructure } from '@/api/kvt/kvt'
export default {
components: {
CountTo
},
data() {
return {
DataStructure: {}
}
},
mounted() {
this.selectDataStructure()
},
methods: {
selectDataStructure(){
overallDataStructure().then(res =>{
console.log(res)
this.DataStructure = res.data
})
},
handleSetLineChartData(type) {
this.$emit('handleSetLineChartData', type)
}

View File

@ -12,7 +12,7 @@
<div class="card-panel-text">
资产模型
</div>
<count-to :duration="3000" :end-val="15" :start-val="0" class="card-panel-num"/>
<count-to :duration="3000" :end-val="this.DataStructure.table" :start-val="0" class="card-panel-num"/>
</div>
</div>
</el-col>
@ -25,14 +25,15 @@
<div class="card-panel-text">
数据模型
</div>
<count-to :duration="3200" :end-val="230" :start-val="0" class="card-panel-num"/>
<count-to :duration="3200" :end-val="this.DataStructure.datas" :start-val="0" class="card-panel-num"/>
</div>
</div>
</el-col>
{{dictAddName}}
<el-col :span="24">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span> <span>{{dictAddName}}</span>基础字典</span>
<span> <span></span>基础字典</span>
<el-popover
placement="top-start"
title="基础字典"
@ -50,13 +51,13 @@
<el-input v-model="dictAddName"></el-input>
</el-col>
<el-col :span="6">
<el-button @click="addDict(dictAddName)"></el-button>
<el-button @click="addDict(bb,dictAddName)"></el-button>
</el-col>
</el-row>
<el-button style="float: right; padding: 3px 0" type="text" slot="reference" >新增字典</el-button>
</el-popover>
</div>
{{dictName}}
<el-row :gutter="20">
<el-col :key="index" v-for="(item ,index) in dictName" :md="8" :sm="24" :xs="12">
<el-card class="box-card" style="height: 300px">
@ -69,7 +70,6 @@
</div>
<el-table :data="item.dictionaryTypes" style="width: 100%" height="280px">
<el-table-column prop="dictionaryName" label="标签">
<template slot-scope="scope">
<span v-if="scope.row.dictionStatus === 0">{{scope.row.dictionaryName}}</span>
@ -108,7 +108,7 @@
</el-col>
<el-col :span="24" style="margin-top: 20px">
<pre>{{selectData}}</pre>
<pre></pre>
</el-col>
<el-col :span="24" style="margin-top: 20px" >
@ -132,12 +132,20 @@ import OverallAssetStructure from './OverallAssetStructure.vue'
import bus from '@/api/bus'
import bues from '@/api/bues'
import buss from '@/api/buss'
import { dictionaryTypeAdd, dictionTypeAdd, selectChild, selectDataStur, selectDictionaryTypeId } from '@/api/kvt/kvt'
import {
dictionTypeAdd,
overallDataStructure,
selectChild,
selectDataStur,
selectDictionaryTypeId
} from '@/api/kvt/kvt'
import bes from '@/api/bes'
export default {
props: [
'selectAll',
'dictName'
'dictName',
'bb'
],
// watch:{
// activeTab(newVal,oldVal){
@ -165,7 +173,7 @@ export default {
},
selectData: [],
chirien: [],
DataStructure:{}
}
},
components: {
@ -173,29 +181,35 @@ export default {
CountTo
},
mounted() {
bus.$on('sendSelecr',data => {
status$on('sendSelecr',data => {
this.selectAll = data
})
},
methods: {
this.selectDataStructure()
},
methods: {
selectDataStructure(){
overallDataStructure().then(res =>{
console.log(res)
this.DataStructure = res.data
})
},
selectDataStur(tab){
console.log("tab",tab)
this.selectedItem = this.selectAll.find(item => item.name == tab.label);
console.log("awdesfgrd",this.selectedItem)
selectDataStur(this.selectedItem.name).then(res => {
this.selectData = res.data
})
selectChild(this.selectedItem.name).then(res => {
this.chirien = res.data
buss.$emit("send",this.chirien)
console.log("wwwwwww",this.selectData)
bues.$emit("大头小头",this.selectData)
bues.$emit("ss",this.dictName)
})
},
//
editConfirm(item,row){
console.log(item)
console.log("row",row)
console.log("item",item)
if (!row.dictionaryName || !row.dictionaryValue) {
this.$message.error('字典标签或字典值,不可为空');
return;
@ -206,6 +220,7 @@ export default {
let dictionaryy ={}
const id =row.id
const type = item.type
console.log("type",type)
const dictionaryName = row.dictionaryName
const dictionaryValue =row.dictionaryValue
const status =row.dictionStatus
@ -220,11 +235,11 @@ export default {
this.$message.success(res.data)
})
},
addDict(dictAddName){
addDict(bb,dictAddName){
console.log("ddddd",bb)
if (dictAddName == null || dictAddName ==''){
this.$message.error('数据字典,不可为空');
return;
@ -232,11 +247,12 @@ export default {
const parts=this.dictAddName.split(',');
let dictionaryType = {}
const dataAccess =bb
const name =parts[0]
const type =parts[1]
const dictionaryName = dictAddName
dictionaryType = {
name,type,dictionaryName
dataAccess,name,type,dictionaryName
}
dictionTypeAdd(dictionaryType).then(res =>{
this.$message.success(res.data)
@ -251,8 +267,9 @@ export default {
}
},
util(row){
console.log(row)
}
console.log("rowrow",row)
this.form = row;
this.formStatus = true; }
}
</script>

View File

@ -17,8 +17,8 @@
<el-container>
<el-main>
<OverallAssets v-if="showAssets == null"/>
<overall-specific-assets v-if="showAssets == 1" v-bind:dictName="dictAddName" v-bind:selectAll="chir" v-bind:childrenMess="childr" v-bind:selectData="dataStructure" :title="title"/>
<overall-asset-structure v-if="showAssets == 2" v-bind:dictName="dictAddName" v-bind:selectAll="chir" v-bind:childrenMess="childr" v-bind:selectData="dataStructure" :title="title"/>
<overall-specific-assets v-if="showAssets == 1" v-bind:bb="aa" v-bind:dictName="dictAddName" v-bind:selectAll="chir" v-bind:childrenMess="childr" v-bind:selectData="dataStructure" :title="title"/>
<overall-asset-structure v-if="showAssets == 2" v-bind:bb="aa" v-bind:dictName="dictAddName" v-bind:selectAll="chir" v-bind:childrenMess="childr" v-bind:selectData="dataStructure" :title="title"/>
</el-main>
</el-container>
@ -33,7 +33,8 @@ import {
selectChildAll,
selectDataSource,
selectDataStur,
selectDepartmen, selectDictionaryy
selectDepartmen,
selectDictionaryy
} from '@/api/kvt/kvt'
export default {
@ -64,11 +65,11 @@ export default {
// }
],
childrenMess:[
{
name: "",
as: "",
dataTotal: 0
}
// {
// name: "",
// as: "",
// dataTotal: 0
// }
],
showAssets: null,
title: null,
@ -77,14 +78,15 @@ export default {
dataStructure:[],
childr:[],
chir: [],
dictAddName: []
dictAddName: [],
aa: 0,
}
},
created() {
this.selectDataSource()
},
methods: {
selctChild(tableName){
// console.log("table",tableName)
// selectChild(tableName).then(res =>{
@ -100,31 +102,30 @@ export default {
},
selectDataSource(){
selectDataSource().then(res=>{
console.log("ressss",res)
this.assetStructureList = res.data
console.log("wdesf",this.assetStructureList)
})
},
expandTable(node, resolve){
if (node.level === 0) return resolve(this.assetStructureList);
const {data} = node;
this.showAssets = data.type;
console.log("data",data)
selectChildAll().then(res=>{
console.log("resssssr",res)
console.log(res)
this.chir = res.data
})
console.log(node)
selectDepartmen(node.data.databaseName).then(res=>{
this.childrenList = res.data
})
if (data.type == 1){
selectDepartmen(data.databaseName).then(res=>{
console.log("res",res)
this.childrenList = res.data
})
this.aa=data.id
console.log("55555555555555555",data)
selectDictionaryy(data.id).then(res => {
console.log("rrrr",res)
console.log("res",res)
this.dictAddName = res.data
})
}
@ -140,13 +141,12 @@ export default {
this.showAssets = data.type;
this.dataname= data.name,
this.databaseNam= data.databaseName
console.log("dataname",data.name)
selectChild(data.name).then(res =>{
console.log("childrenList",res)
this.childr=res.data
})
selectDataStur(data.name).then(res=>{
console.log("aaaaaa",res)
this.dataStructure= res.data
})
}