feat:增加了字典的新增,修改操作

fix: 修复了点击数据源默认数据库表默认选中的问题
master_dyf
Yunfei Du 2024-04-27 18:40:57 +08:00
parent 947401fd52
commit ad3f4bd2fc
3 changed files with 60 additions and 18 deletions

View File

@ -17,7 +17,7 @@ export function insertDictionary(dictionary) {
export function insertDictionaryInfo(dictionaryInfo) {
return request({
url: '/dataSource/dict/insertDictionaryInfo',
url: '/dataSource/dict/insertDictionarySelect',
method: 'post',
data: dictionaryInfo
})

View File

@ -1,6 +1,8 @@
<template>
<el-row :gutter="40" class="panel-group">
<div class="title-header">
{{dataSourceObj.dataSource.fromSystem}} - 资产结构概述
</div>
<el-col :sm="12" :xs="12" class="card-panel-col">
@ -47,7 +49,7 @@
trigger="click">
<el-row :gutter="20">
<el-col :span="18">
<el-input v-model="dictionary.dictionaryName"></el-input>
<el-input v-model="dictionaryNameAndVue"></el-input>
</el-col>
<el-col :span="6">
<el-button @click="addDict"></el-button>
@ -57,10 +59,12 @@
</el-popover>
</div>
<el-row :gutter="20">
<el-col v-for="dictionaryInfoResp in dictionaryInfoRespList" :md="8" :sm="24" :xs="12">
{{dictionaryInfoResp.dictionaryList}}
<el-card class="box-card" style="height: 300px">
<div slot="header" class="clearfix">
<span>{{dictionaryInfoResp.dictionaryName}}</span>
<span>{{dictionaryInfoResp.dictionaryNameAndValue}}</span>
<el-button style="float: right; padding: 3px 0"
type="text"
@click="dictionaryInfoResp.dictionaryList.push({ label: null, value: null, isEdit: true })"
@ -92,7 +96,7 @@
>修改</el-button>
<el-button
v-if="scope.row.isEdit"
@click="editConfirm(scope.row)"
@click="editConfirm(scope.row,dictionaryInfoResp.id)"
size="mini"
type="text"
icon="el-icon-finished"
@ -104,11 +108,10 @@
</el-col>
</el-row>
</el-card>
</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 :label="assetsModelResp.dataTable.tableName" :key="assetsModelResp.dataTable.id" v-for="(assetsModelResp , index) in assetsModelRespArrayList" :name="index">
<overall-asset-structure :tableInfo="assetsModelResp.dataTable" :assetsModelList="assetsModelResp.assetsModelList" />
</el-tab-pane>
</el-tabs>
@ -120,10 +123,11 @@
<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 {
props: {
dictionaryInfoRespList:{
type:Array,
@ -142,36 +146,60 @@ export default {
},
data() {
return {
originalString: "性别(system_sex)",
dictionaryInfoRespList: [],
activeName: 'first',
activeName: '0',
// activeName: assetsModelRespArrayList[0].dataTableList.tableList.tableName,
dictionary: {}
dictionaryNameAndVue:"",
dictionary: {},
}
},
components: {
OverallAssetStructure,
CountTo
},
methods: {
updateEdit(){
editConfirm(row){
},
editConfirm(row,dictionaryId){
if (!row.label || !row.value) {
this.$message.error('字典标签或字典值,不可为空');
return;
}
row.isEdit = false;
row.dictionaryId=dictionaryId
insertDictionaryInfo(row).then(
res => {
console.log("插入字典",res)
}
)
},
handleSetLineChartData(type) {
this.$emit('handleSetLineChartData', type)
},
addDict(){
if (!this.dictionary.dictionaryName){
if (!this.dictionaryNameAndVue){
this.$message.error('数据字典,不可为空');
return;
}
console.log(this.dictionary.dictionaryName)
this.dictionary.dictionaryName=this.dictionaryNameAndVue.split('(')[0].trim()
this.dictionary.dictionaryValue=this.dictionaryNameAndVue.match(/\(([^)]+)\)/)[1];
this.dictionary.dataSourceId=this.dataSourceId
console.log(this.dictionary)
insertDictionary(this.dictionary).then(
res=>{
console.log("插入字典",res)
this.$message.success("插入字典成功")
this.getBigStructure()
}
)
},
}
}

View File

@ -180,6 +180,18 @@
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="用户名" prop="dataSourceUsername">
<el-input v-model="form.dataSourceUsername" placeholder="请输入用户名"/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="密码" prop="dataSourcePassword">
<el-input v-model="form.dataSourcePassword" placeholder="请输入密码"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-card>
<div slot="header" class="clearfix">
@ -346,6 +358,12 @@ export default {
additionalConfiguration: [
{required: true, message: "数据连接参数不能为空", trigger: "blur"}
],
dataSourceUsername: [
{required: true, message: "用户名不能为空", trigger: "blur"}
],
dataSourcePassword: [
{required: true, message: "密码不能为空", trigger: "blur"}
],
initialNumberOfConnections: [
{required: true, message: "初始连接数量不能为空", trigger: "blur"}
],
@ -535,11 +553,7 @@ export default {
testConnect(row) {
testConnect(row).then(
res => {
if (res.code ===200){
this.$message.success(res.msg)
}else {
this.$message.error(res.msg)
}
this.$message (res==true?"成功":"失败");
}
)
console.log("test:",row)