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>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="注释">
|
<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-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="是否主键">
|
<el-form-item label="是否主键">
|
||||||
<el-tag size="small" :type="form.isPrimaryKey === 'Y' ? 'success' : 'danger'">
|
<el-tag size="small" :type="form.primaryOrNot === 'Y' ? 'success' : 'danger'">
|
||||||
{{form.isPrimaryKey}}
|
{{form.primaryOrNot}}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
@ -110,15 +110,15 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="小数位">
|
<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-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="是否为空">
|
<el-form-item label="是否为空">
|
||||||
<el-tag size="small" :type="form.isNull === 'Y' ? 'success' : 'danger'">
|
<el-tag size="small" :type="form.nullOrNot === 'Y' ? 'success' : 'danger'">
|
||||||
{{form.isNull}}
|
{{form.nullOrNot}}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
|
@ -49,7 +49,8 @@
|
||||||
trigger="click">
|
trigger="click">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="18">
|
<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>
|
||||||
<el-col :span="6">
|
<el-col :span="6">
|
||||||
<el-button @click="addDict">确定</el-button>
|
<el-button @click="addDict">确定</el-button>
|
||||||
|
@ -59,27 +60,27 @@
|
||||||
</el-popover>
|
</el-popover>
|
||||||
</div>
|
</div>
|
||||||
<el-row :gutter="20">
|
<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">
|
<el-card class="box-card" style="height: 300px">
|
||||||
<div slot="header" class="clearfix">
|
<div slot="header" class="clearfix">
|
||||||
<span>{{ key }}</span>
|
<span>{{ item.name }}({{ item.type }})</span>
|
||||||
<el-button style="float: right; padding: 3px 0"
|
<el-button style="float: right; padding: 3px 0"
|
||||||
type="text"
|
type="text"
|
||||||
@click="val.push({ label: null, val: null, isEdit: true })"
|
@click="item.dataDictionaryTypeList.push({ label: null, value: null, isEdit: true })"
|
||||||
>新增
|
>新增
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</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="标签">
|
<el-table-column prop="label" label="标签">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span v-if="!scope.row.isEdit">{{ scope.row.label }}</span>
|
<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>
|
<el-input v-if="scope.row.isEdit" v-model="scope.row.label" size="mini"></el-input>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="val" label="值">
|
<el-table-column prop="value" label="值">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span v-if="!scope.row.isEdit">{{ scope.row.val }}</span>
|
<span v-if="!scope.row.isEdit">{{ scope.row.value }}</span>
|
||||||
<el-input v-if="scope.row.isEdit" v-model="scope.row.val" size="mini"></el-input>
|
<el-input v-if="scope.row.isEdit" v-model="scope.row.value" size="mini"></el-input>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="val" label="操作">
|
<el-table-column prop="val" label="操作">
|
||||||
|
@ -89,12 +90,12 @@
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@click="scope.row.isEdit = true"
|
@click="$set(scope.row,'isEdit',true)"
|
||||||
>修改
|
>修改
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="scope.row.isEdit"
|
v-if="scope.row.isEdit"
|
||||||
@click="editConfirm(scope.row)"
|
@click="controlsDictionaryType(scope.row,item.id)"
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-finished"
|
icon="el-icon-finished"
|
||||||
|
@ -112,8 +113,7 @@
|
||||||
<el-col :span="24" style="margin-top: 20px">
|
<el-col :span="24" style="margin-top: 20px">
|
||||||
<el-tabs v-model="activeName" type="border-card">
|
<el-tabs v-model="activeName" type="border-card">
|
||||||
<el-tab-pane v-for="(item,index) in structureTableDataCount.childrenList"
|
<el-tab-pane v-for="(item,index) in structureTableDataCount.childrenList"
|
||||||
:label="item.tableName + '(' + item.tableNameAnnotation + ')'" :name="index"
|
:label="item.tableName + '(' + item.tableNameAnnotation + ')'" :name="index">
|
||||||
@tab-click="checkTableName">
|
|
||||||
<overall-asset-structure :assetTableDetailsList="item.assetTableDetailsList" :tableName="item.tableName"
|
<overall-asset-structure :assetTableDetailsList="item.assetTableDetailsList" :tableName="item.tableName"
|
||||||
:tableNameAnnotation="item.tableNameAnnotation"
|
:tableNameAnnotation="item.tableNameAnnotation"
|
||||||
:tableDataCount="item.tableDataCount"/>
|
:tableDataCount="item.tableDataCount"/>
|
||||||
|
@ -127,6 +127,7 @@
|
||||||
<script>
|
<script>
|
||||||
import CountTo from 'vue-count-to'
|
import CountTo from 'vue-count-to'
|
||||||
import OverallAssetStructure from "@/views/data/structure/dashlboard/OverallAssetStructure.vue";
|
import OverallAssetStructure from "@/views/data/structure/dashlboard/OverallAssetStructure.vue";
|
||||||
|
import {dictionaryList, dictionarySave, saveDictionaryType, updateDictionaryType} from "@/api/data/dictionary";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
created() {
|
created() {
|
||||||
|
@ -141,25 +142,21 @@ export default {
|
||||||
tableCount: null,
|
tableCount: null,
|
||||||
tableDataCount: null,
|
tableDataCount: null,
|
||||||
childrenList: []
|
childrenList: []
|
||||||
}
|
},
|
||||||
|
dictionaryList: [],
|
||||||
|
structureId: null,
|
||||||
|
formLabelWidth: '120px'
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
activeName: 0,
|
activeName: 0,
|
||||||
dictAddName: null,
|
// 字典名称
|
||||||
dictMap: {
|
name: null,
|
||||||
"性别(system_sex)": [
|
// 字典类型值,
|
||||||
{label: '男', val: '1', isEdit: false},
|
type: null,
|
||||||
{label: '女', val: '2', isEdit: false},
|
|
||||||
{label: '未知', val: '0', isEdit: false},
|
|
||||||
],
|
|
||||||
"开关(system_y_n)": [
|
|
||||||
{label: '是', val: '1', isEdit: false},
|
|
||||||
{label: '否', val: '0', isEdit: false}
|
|
||||||
],
|
|
||||||
},
|
|
||||||
tableList: [],
|
tableList: [],
|
||||||
tableParams: null
|
tableParams: null,
|
||||||
|
dataDictionaryId: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
@ -171,12 +168,60 @@ export default {
|
||||||
this.$emit('handleSetLineChartData', type)
|
this.$emit('handleSetLineChartData', type)
|
||||||
},
|
},
|
||||||
addDict() {
|
addDict() {
|
||||||
if (!this.dictAddName) {
|
if (!this.name) {
|
||||||
this.$message.error('数据字典,不可为空');
|
this.$message.error('字典名,不可为空');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.dictMap[this.dictAddName] = []
|
if (!this.type) {
|
||||||
this.dictAddName = null
|
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-container>
|
||||||
<el-main>
|
<el-main>
|
||||||
<OverallAssets v-if="showAssets == null" :assetStructureDataCount="assetStructureDataCount"/>
|
<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"/>
|
:structureTableDataCount="structureTableDataCount"/>
|
||||||
<overall-asset-structure v-if="showAssets === 'dataTable'" :assetTableDetailsList="assetTableDetailsList" :tableName="tableName"
|
<overall-asset-structure v-if="showAssets === 'dataTable'" :assetTableDetailsList="assetTableDetailsList" :tableName="tableName"
|
||||||
:tableNameAnnotation="tableNameAnnotation"
|
:tableNameAnnotation="tableNameAnnotation"
|
||||||
:tableDataCount="tableDataCount" :title="title"/>
|
:tableDataCount="tableDataCount"
|
||||||
|
:title="title"/>
|
||||||
</el-main>
|
</el-main>
|
||||||
</el-container>
|
</el-container>
|
||||||
</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 OverallAssets from "@/views/data/structure/dashlboard/OverallAssets.vue";
|
||||||
import OverallSpecificAssets from "@/views/data/structure/dashlboard/OverallSpecificAssets.vue";
|
import OverallSpecificAssets from "@/views/data/structure/dashlboard/OverallSpecificAssets.vue";
|
||||||
import OverallAssetStructure from "@/views/data/structure/dashlboard/OverallAssetStructure.vue";
|
import OverallAssetStructure from "@/views/data/structure/dashlboard/OverallAssetStructure.vue";
|
||||||
|
import {dictionaryList} from "@/api/data/dictionary";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'assetStructure',
|
name: 'assetStructure',
|
||||||
|
@ -44,6 +49,7 @@ export default {
|
||||||
children: 'childrenList',
|
children: 'childrenList',
|
||||||
label: 'name'
|
label: 'name'
|
||||||
},
|
},
|
||||||
|
structureId: null,
|
||||||
// 数据库
|
// 数据库
|
||||||
assetStructureList: [],
|
assetStructureList: [],
|
||||||
// 数据库表
|
// 数据库表
|
||||||
|
@ -66,7 +72,9 @@ export default {
|
||||||
tableCount: null,
|
tableCount: null,
|
||||||
tableDataCount: null,
|
tableDataCount: null,
|
||||||
childrenList: [],
|
childrenList: [],
|
||||||
}
|
},
|
||||||
|
// 字典列表
|
||||||
|
dictionaryList: []
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -175,6 +183,14 @@ export default {
|
||||||
this.structureTableDataCount.tableDataCount = response.data.tableDataCount
|
this.structureTableDataCount.tableDataCount = response.data.tableDataCount
|
||||||
this.structureTableDataCount.childrenList = this.childrenList
|
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") {
|
if (data.type === "dataTable") {
|
||||||
this.tableParams = {
|
this.tableParams = {
|
||||||
|
|
Loading…
Reference in New Issue