feat: 字典表

master
rouchen 2024-04-26 16:37:40 +08:00
parent 053b05b38f
commit 5e596c844f
6 changed files with 174 additions and 37 deletions

View File

@ -128,3 +128,41 @@ export function selectDept() {
method: 'post'
})
}
//查询字典
export function selectDictionaryy(id) {
return request({
url: '/kvt/kvt/selectDictionaryy?id=' + id,
method: 'post'
})
}
//字典添加
export function dictionaryTypeAdd(data) {
return request({
url: '/kvt/kvt/dictionaryTypeAdd',
method: 'post',
data
})
}
//字典添加类型
export function dictionTypeAdd(data) {
return request({
url: '/kvt/kvt/dictionTypeAdd',
method: 'post',
data
})
}
//查询字典类型
export function selectDictionaryType() {
return request({
url: '/kvt/kvt/selectDictionaryType',
method: 'post'
})
}
//查询字典类型
export function selectDictionaryTypeId(data) {
return request({
url: '/kvt/kvt/selectDictionaryTypeId',
method: 'post',
data
})
}

View File

@ -185,7 +185,8 @@ export default {
props: [
'selectData',
'childrenMess',
'selectAll'
'selectAll',
],
data() {
return {
@ -277,6 +278,11 @@ export default {
created() {
this.ENEN()
},
beforeDestroy() {
this.$off();
this.$off('send',this.childrenMess );
this.$off('大头小头',this.selectData);
},
methods: {
sendSelectAll(){
bus.$emit("sendSelecr", this. selectAll)

View File

@ -2,6 +2,7 @@
<el-row :gutter="40" class="panel-group">
<div class="title-header">
整体数据资产结构概述
</div>
<el-col :lg="8" :sm="12" :xs="12" class="card-panel-col">
<div class="card-panel" @click="handleSetLineChartData('newVisitis')">
@ -12,7 +13,7 @@
<div class="card-panel-text">
数据接入
</div>
<count-to :duration="2600" :end-val="4" :start-val="0" class="card-panel-num"/>
<count-to :duration="2600" :end-val="2" :start-val="0" class="card-panel-num"/>
</div>
</div>
</el-col>
@ -49,6 +50,7 @@
import CountTo from 'vue-count-to'
export default {
components: {
CountTo
},

View File

@ -32,7 +32,7 @@
<el-col :span="24">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>基础字典</span>
<span> <span>{{dictAddName}}</span>基础字典</span>
<el-popover
placement="top-start"
title="基础字典"
@ -41,38 +41,59 @@
content="这个字典是数据资产项目当中的字典内容,而不是本项目当中的字典内容。主要作用为数据清洗过程中数据字典映射作用">
<i class="el-icon-question" slot="reference"></i>
</el-popover>
<el-popover
placement="right"
width="400"
trigger="click">
<el-row :gutter="20">
<el-col :span="18">
<el-input v-model="dictAddName"></el-input>
</el-col>
<el-col :span="6">
<el-button @click="addDict(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 v-for="(val,key) in dictMap" :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">
<div slot="header" class="clearfix">
<span>{{key}}</span>
<span>{{item.name}}({{item.type}})</span>
<el-button style="float: right; padding: 3px 0"
type="text"
@click="item.dictionaryTypes.push( {dictionaryName: null, dictionaryValue: null, dictionStatus :1 })"
>新增</el-button>
</div>
<el-table :data="val" style="width: 100%" height="280px">
<el-table-column prop="label" label="标签">
<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.isEdit">{{scope.row.label}}</span>
<el-input v-if="scope.row.isEdit" v-model="scope.row.label" size="mini"></el-input>
<span v-if="scope.row.dictionStatus === 0">{{scope.row.dictionaryName}}</span>
<el-input v-if="scope.row.dictionStatus ===1" v-model="scope.row.dictionaryName" size="mini"></el-input>
</template>
</el-table-column>
<el-table-column prop="val" label="值">
<el-table-column prop="dictionaryValue" label="值">
<template slot-scope="scope">
<span v-if="!scope.row.isEdit">{{scope.row.val}}</span>
<el-input v-if="scope.row.isEdit" v-model="scope.row.val" size="mini"></el-input>
<span v-if="scope.row.dictionStatus === 0">{{scope.row.dictionaryValue}}</span>
<el-input v-if="scope.row.dictionStatus === 1" v-model="scope.row.dictionaryValue" size="mini"></el-input>
</template>
</el-table-column>
<el-table-column prop="val" label="操作">
<template slot-scope="scope">
<el-button
v-if="!scope.row.isEdit"
v-if="scope.row.dictionStatus === 0"
size="mini"
type="text"
icon="el-icon-edit"
@click="scope.row.isEdit = true"
@click="scope.row.dictionStatus =1"
>修改</el-button>
<el-button
v-if="scope.row.isEdit"
@click="scope.row.isEdit = false"
v-if="scope.row.dictionStatus === 1"
@click="editConfirm(item,scope.row)"
size="mini"
type="text"
icon="el-icon-finished"
@ -84,7 +105,6 @@
</el-col>
</el-row>
</el-card>
{{selectAll}}
</el-col>
<el-col :span="24" style="margin-top: 20px">
@ -112,11 +132,12 @@ import OverallAssetStructure from './OverallAssetStructure.vue'
import bus from '@/api/bus'
import bues from '@/api/bues'
import buss from '@/api/buss'
import { selectChild, selectDataStur } from '@/api/kvt/kvt'
import { dictionaryTypeAdd, dictionTypeAdd, selectChild, selectDataStur, selectDictionaryTypeId } from '@/api/kvt/kvt'
export default {
props: [
'selectAll'
'selectAll',
'dictName'
],
// watch:{
// activeTab(newVal,oldVal){
@ -126,19 +147,25 @@ export default {
data() {
return {
activeTab: 'someDefaultValue',
title:null,
dictAddName: [],
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 }
],
// "(system_sex)": [
// { label: '', val: '1', isEdit: false },
// { label: '', val: '2', isEdit: false },
// { label: '', val: '0', isEdit: false },
// ],
// "(system_y_n)": [
// // this.dictAddName
// { label: '', val: '1', isEdit: false },
// { label: '', val: '0', isEdit: false }
// ],
},
selectData: [],
chirien: []
chirien: [],
}
},
components: {
@ -166,11 +193,66 @@ export default {
bues.$emit("大头小头",this.selectData)
})
},
//
editConfirm(item,row){
console.log(item)
if (!row.dictionaryName || !row.dictionaryValue) {
this.$message.error('字典标签或字典值,不可为空');
return;
}
row.dictionStatus = 0
console.log(this.selectAll.dataAccess)
let dictionaryy ={}
const id =row.id
const type = item.type
const dictionaryName = row.dictionaryName
const dictionaryValue =row.dictionaryValue
const status =row.dictionStatus
dictionaryy = {
id: id,
type: type,
dictionaryName: dictionaryName,
dictionaryValue: dictionaryValue,
dictionStatus: status
}
selectDictionaryTypeId(dictionaryy).then(res =>{
this.$message.success(res.data)
})
},
addDict(dictAddName){
if (dictAddName == null || dictAddName ==''){
this.$message.error('数据字典,不可为空');
return;
}
const parts=this.dictAddName.split(',');
let dictionaryType = {}
const name =parts[0]
const type =parts[1]
const dictionaryName = dictAddName
dictionaryType = {
name,type,dictionaryName
}
dictionTypeAdd(dictionaryType).then(res =>{
this.$message.success(res.data)
})
console.log("parts",parts)
this.dictName[this.dictName.dictionaryTypes] = []
this.dictName.dictionaryTypes = null
},
handleSetLineChartData(type) {
this.$emit('handleSetLineChartData', type)
}
},
util(row){
console.log(row)
},
beforeDestroy(){
this.selectDataStur(tab)
}

View File

@ -1,13 +1,14 @@
<template>
<el-container :style="{height: mainHeight + 'px'}">
<el-aside>
{{assetStructureList}}
<el-tree :data="assetStructureList"
:expand-on-click-node="false"
:load="expandTable"
lazy
@node-click="showAssetsFun"
:props="defaultProps">
<div class="custom-tree-node" @click="selectDepartment(data.databaseName)" slot-scope="{ node, data }">
<div class="custom-tree-node" @click="selectDepartment(data.id,data.databaseName)" slot-scope="{ node, data }">
<div v-if="data.type == 1" @click="selctChild(data.name)">{{ data.name + '('+data.databaseName + '-' + data.systemName+')' }}</div>
<div v-if="data.type == 2" @click="selctChild(data.name)">{{ data.name + '-'+data.as + '(' + data.dataTotal+')' }}</div>
</div>
@ -16,8 +17,8 @@
<el-container>
<el-main>
<OverallAssets v-if="showAssets == null"/>
<overall-specific-assets v-if="showAssets == 1" v-bind:selectAll="chir" v-bind:childrenMess="childr" v-bind:selectData="dataStructure" :title="title"/>
<overall-asset-structure v-if="showAssets == 2" v-bind:selectAll="chir" v-bind:childrenMess="childr" v-bind:selectData="dataStructure" :title="title"/>
<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"/>
</el-main>
</el-container>
@ -33,7 +34,7 @@ import {
selectDataSource,
selectDataStructure,
selectDataStur,
selectDepartmen
selectDepartmen, selectDictionaryy
} from '@/api/kvt/kvt'
export default {
@ -76,7 +77,8 @@ export default {
databaseNam: null,
dataStructure:[],
childr:[],
chir: []
chir: [],
dictAddName: []
}
},
created() {
@ -91,15 +93,20 @@ export default {
this.childr=res.data
})
},
selectDepartment(selectDepartment){
selectDepartment(id,selectDepartment){
selectDepartmen(selectDepartment).then(res=>{
console.log("res",res)
this.childrenList = res.data
})
selectDictionaryy(id).then(res => {
console.log("rrrr",res)
this.dictAddName = res.data
})
},
selectDataSource(){
selectDataSource().then(res=>{
console.log(res)
console.log("ressss",res)
this.assetStructureList = res.data
console.log("wdesf",this.assetStructureList)
})

View File

@ -458,7 +458,9 @@ export default {
methods: {
//
synchronizationAdd(row){
synchronizationAdd(row).then(res=>{})
synchronizationAdd(row).then(res=>{
this.$message.success(res.data)
})
},
dataTypeList(){
dataTypeList().then(res=> {