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 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 Vue from 'vue'
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
Vue.prototype.$EventBus = new Vue(); Vue.prototype.$Eventstatus = new Vue();
import Element from 'element-ui' import Element from 'element-ui'
import './assets/styles/element-variables.scss' import './assets/styles/element-variables.scss'

View File

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

View File

@ -13,7 +13,7 @@
<div class="card-panel-text"> <div class="card-panel-text">
数据接入 数据接入
</div> </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>
</div> </div>
</el-col> </el-col>
@ -26,7 +26,7 @@
<div class="card-panel-text"> <div class="card-panel-text">
资产模型 资产模型
</div> </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>
</div> </div>
</el-col> </el-col>
@ -39,7 +39,7 @@
<div class="card-panel-text"> <div class="card-panel-text">
数据模型 数据模型
</div> </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>
</div> </div>
</el-col> </el-col>
@ -48,13 +48,28 @@
<script> <script>
import CountTo from 'vue-count-to' import CountTo from 'vue-count-to'
import { overallDataStructure } from '@/api/kvt/kvt'
export default { export default {
components: { components: {
CountTo CountTo
}, },
data() {
return {
DataStructure: {}
}
},
mounted() {
this.selectDataStructure()
},
methods: { methods: {
selectDataStructure(){
overallDataStructure().then(res =>{
console.log(res)
this.DataStructure = res.data
})
},
handleSetLineChartData(type) { handleSetLineChartData(type) {
this.$emit('handleSetLineChartData', type) this.$emit('handleSetLineChartData', type)
} }

View File

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

View File

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