feat(): 资产结构数据的数据字典
parent
0c308623db
commit
7e70abebbf
|
@ -0,0 +1,35 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询字典列表
|
||||
export function dictionaryList(id) {
|
||||
return request({
|
||||
url: '/data/dictionary/dictionaryList/' + id,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 新字典信息
|
||||
export function dictionarySave(data) {
|
||||
return request({
|
||||
url: '/data/dictionary/dictionarySave',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 新增数据源信息
|
||||
export function saveDictionaryType(data) {
|
||||
return request({
|
||||
url: '/data/dictionaryType',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改数据源信息
|
||||
export function updateDictionaryType(data) {
|
||||
return request({
|
||||
url: '/data/dictionaryType',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
|
@ -84,15 +84,15 @@
|
|||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="注释">
|
||||
<el-input v-model="form.comment" readonly autocomplete="off"></el-input>
|
||||
<el-input v-model="form.annotation" 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.isPrimaryKey === 'Y' ? 'success' : 'danger'">
|
||||
{{form.isPrimaryKey}}
|
||||
<el-tag size="small" :type="form.primaryOrNot === 'Y' ? 'success' : 'danger'">
|
||||
{{form.primaryOrNot}}
|
||||
</el-tag>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
@ -110,15 +110,15 @@
|
|||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="小数位">
|
||||
<el-input v-model="form.decimalPlaces" readonly autocomplete="off"></el-input>
|
||||
<el-input v-model="form.decimalPoint" 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.isNull === 'Y' ? 'success' : 'danger'">
|
||||
{{form.isNull}}
|
||||
<el-tag size="small" :type="form.nullOrNot === 'Y' ? 'success' : 'danger'">
|
||||
{{form.nullOrNot}}
|
||||
</el-tag>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
|
|
@ -49,7 +49,8 @@
|
|||
trigger="click">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="18">
|
||||
<el-input v-model="dictAddName"></el-input>
|
||||
<el-input v-model="name" placeholder="字典名"></el-input>
|
||||
<el-input v-model="type" placeholder="字典类型"></el-input>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-button @click="addDict">确定</el-button>
|
||||
|
@ -59,27 +60,27 @@
|
|||
</el-popover>
|
||||
</div>
|
||||
<el-row :gutter="20">
|
||||
<el-col v-for="(val,key) in dictMap" :md="8" :sm="24" :xs="12">
|
||||
<el-col v-for="item in dictionaryList" :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="val.push({ label: null, val: null, isEdit: true })"
|
||||
@click="item.dataDictionaryTypeList.push({ label: null, value: null, isEdit: true })"
|
||||
>新增
|
||||
</el-button>
|
||||
</div>
|
||||
<el-table :data="val" style="width: 100%" height="280px">
|
||||
<el-table :data="item.dataDictionaryTypeList" style="width: 100%" height="280px">
|
||||
<el-table-column prop="label" 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>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="val" label="值">
|
||||
<el-table-column prop="value" 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.isEdit">{{ scope.row.value }}</span>
|
||||
<el-input v-if="scope.row.isEdit" v-model="scope.row.value" size="mini"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="val" label="操作">
|
||||
|
@ -89,12 +90,12 @@
|
|||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="scope.row.isEdit = true"
|
||||
@click="$set(scope.row,'isEdit',true)"
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.isEdit"
|
||||
@click="editConfirm(scope.row)"
|
||||
@click="controlsDictionaryType(scope.row,item.id)"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-finished"
|
||||
|
@ -112,8 +113,7 @@
|
|||
<el-col :span="24" style="margin-top: 20px">
|
||||
<el-tabs v-model="activeName" type="border-card">
|
||||
<el-tab-pane v-for="(item,index) in structureTableDataCount.childrenList"
|
||||
:label="item.tableName + '(' + item.tableNameAnnotation + ')'" :name="index"
|
||||
@tab-click="checkTableName">
|
||||
:label="item.tableName + '(' + item.tableNameAnnotation + ')'" :name="index">
|
||||
<overall-asset-structure :assetTableDetailsList="item.assetTableDetailsList" :tableName="item.tableName"
|
||||
:tableNameAnnotation="item.tableNameAnnotation"
|
||||
:tableDataCount="item.tableDataCount"/>
|
||||
|
@ -127,6 +127,7 @@
|
|||
<script>
|
||||
import CountTo from 'vue-count-to'
|
||||
import OverallAssetStructure from "@/views/data/structure/dashlboard/OverallAssetStructure.vue";
|
||||
import {dictionaryList, dictionarySave, saveDictionaryType, updateDictionaryType} from "@/api/data/dictionary";
|
||||
|
||||
export default {
|
||||
created() {
|
||||
|
@ -141,25 +142,21 @@ export default {
|
|||
tableCount: null,
|
||||
tableDataCount: null,
|
||||
childrenList: []
|
||||
}
|
||||
},
|
||||
dictionaryList: [],
|
||||
structureId: null,
|
||||
formLabelWidth: '120px'
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
activeName: 0,
|
||||
dictAddName: null,
|
||||
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}
|
||||
],
|
||||
},
|
||||
// 字典名称
|
||||
name: null,
|
||||
// 字典类型值,
|
||||
type: null,
|
||||
tableList: [],
|
||||
tableParams: null
|
||||
tableParams: null,
|
||||
dataDictionaryId: null
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
@ -171,12 +168,60 @@ export default {
|
|||
this.$emit('handleSetLineChartData', type)
|
||||
},
|
||||
addDict() {
|
||||
if (!this.dictAddName) {
|
||||
this.$message.error('数据字典,不可为空');
|
||||
if (!this.name) {
|
||||
this.$message.error('字典名,不可为空');
|
||||
return;
|
||||
}
|
||||
this.dictMap[this.dictAddName] = []
|
||||
this.dictAddName = null
|
||||
if (!this.type) {
|
||||
this.$message.error('字典类型,不可为空');
|
||||
return;
|
||||
}
|
||||
let row = {
|
||||
assetStructureId: this.structureId,
|
||||
name: this.name,
|
||||
type: this.type
|
||||
}
|
||||
dictionarySave(row).then(response => {
|
||||
dictionaryList(this.structureId).then(response => {
|
||||
this.dictionaryList = response.data
|
||||
})
|
||||
})
|
||||
},
|
||||
controlsDictionaryType(row, id) {
|
||||
if (!row.label) {
|
||||
this.$message.error('标签,不可为空');
|
||||
return;
|
||||
}
|
||||
if (!row.value) {
|
||||
this.$message.error('值,不可为空');
|
||||
return;
|
||||
}
|
||||
if (row.id === undefined){
|
||||
let rows = {
|
||||
dataDictionaryId: id,
|
||||
label: row.label,
|
||||
value: row.value
|
||||
}
|
||||
saveDictionaryType(rows).then(response => {
|
||||
dictionaryList(this.structureId).then(res => {
|
||||
this.dictionaryList = res.data
|
||||
this.dictionaryList.forEach(item => {
|
||||
item.isEdit = false
|
||||
})
|
||||
this.isEdit = false
|
||||
})
|
||||
})
|
||||
}else {
|
||||
updateDictionaryType(row).then(response => {
|
||||
dictionaryList(this.structureId).then(res => {
|
||||
this.dictionaryList = res.data
|
||||
this.dictionaryList.forEach(item => {
|
||||
item.isEdit = false
|
||||
})
|
||||
this.isEdit = false
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,11 +19,15 @@
|
|||
<el-container>
|
||||
<el-main>
|
||||
<OverallAssets v-if="showAssets == null" :assetStructureDataCount="assetStructureDataCount"/>
|
||||
<overall-specific-assets v-if="showAssets === 'dataSource'" :title="title"
|
||||
<overall-specific-assets v-if="showAssets === 'dataSource'"
|
||||
:title="title"
|
||||
:dictionaryList="dictionaryList"
|
||||
:structureId="structureId"
|
||||
:structureTableDataCount="structureTableDataCount"/>
|
||||
<overall-asset-structure v-if="showAssets === 'dataTable'" :assetTableDetailsList="assetTableDetailsList" :tableName="tableName"
|
||||
:tableNameAnnotation="tableNameAnnotation"
|
||||
:tableDataCount="tableDataCount" :title="title"/>
|
||||
:tableDataCount="tableDataCount"
|
||||
:title="title"/>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</el-container>
|
||||
|
@ -33,6 +37,7 @@ import {listAssetStructure, selectAssetSouructureTableList} from "@/api/data/str
|
|||
import OverallAssets from "@/views/data/structure/dashlboard/OverallAssets.vue";
|
||||
import OverallSpecificAssets from "@/views/data/structure/dashlboard/OverallSpecificAssets.vue";
|
||||
import OverallAssetStructure from "@/views/data/structure/dashlboard/OverallAssetStructure.vue";
|
||||
import {dictionaryList} from "@/api/data/dictionary";
|
||||
|
||||
export default {
|
||||
name: 'assetStructure',
|
||||
|
@ -44,6 +49,7 @@ export default {
|
|||
children: 'childrenList',
|
||||
label: 'name'
|
||||
},
|
||||
structureId: null,
|
||||
// 数据库
|
||||
assetStructureList: [],
|
||||
// 数据库表
|
||||
|
@ -66,7 +72,9 @@ export default {
|
|||
tableCount: null,
|
||||
tableDataCount: null,
|
||||
childrenList: [],
|
||||
}
|
||||
},
|
||||
// 字典列表
|
||||
dictionaryList: []
|
||||
|
||||
}
|
||||
},
|
||||
|
@ -175,6 +183,14 @@ export default {
|
|||
this.structureTableDataCount.tableDataCount = response.data.tableDataCount
|
||||
this.structureTableDataCount.childrenList = this.childrenList
|
||||
});
|
||||
|
||||
dictionaryList(data.id).then(response => {
|
||||
this.dictionaryList = response.data
|
||||
this.dictionaryList.forEach(item => {
|
||||
item.isEdit = false
|
||||
})
|
||||
this.structureId = data.id
|
||||
})
|
||||
}
|
||||
if (data.type === "dataTable") {
|
||||
this.tableParams = {
|
||||
|
|
Loading…
Reference in New Issue