feat:数据接入(优化)
parent
2a3bf3c375
commit
64cb892156
|
@ -1,13 +1,13 @@
|
|||
<template>
|
||||
<div>
|
||||
<div v-if="tableParams != null">
|
||||
<el-card>
|
||||
<div slot="header" class="clearfix">
|
||||
<span>资产模型基本信息</span>
|
||||
</div>
|
||||
<el-descriptions border :column="2">
|
||||
<el-descriptions-item label="表名称">{{title.tableName}}</el-descriptions-item>
|
||||
<el-descriptions-item label="表备注">{{title.tableComment}}</el-descriptions-item>
|
||||
<el-descriptions-item label="数据量">{{title.tableCount}}</el-descriptions-item>
|
||||
<el-descriptions-item label="表名称">{{tableParams.tableName}}</el-descriptions-item>
|
||||
<el-descriptions-item label="表备注">{{tableParams.tableAsName}}</el-descriptions-item>
|
||||
<el-descriptions-item label="数据量">12536</el-descriptions-item>
|
||||
<el-descriptions-item label="是否核心">
|
||||
<el-tag size="small">是</el-tag>
|
||||
</el-descriptions-item>
|
||||
|
@ -55,9 +55,13 @@
|
|||
placement="left"
|
||||
width="200"
|
||||
trigger="hover">
|
||||
<el-table :data="scope.row.dictionaryDatas">
|
||||
<el-table :data="[
|
||||
{ label: '男', value: '1' },
|
||||
{ label: '女', value: '2' },
|
||||
{ label: '未知', value: '0' },
|
||||
]">
|
||||
<el-table-column property="label" label="字典标签"/>
|
||||
<el-table-column property="val" label="字典值"/>
|
||||
<el-table-column property="value" label="字典值"/>
|
||||
</el-table>
|
||||
<el-tag slot="reference">{{scope.row.dictKey}}</el-tag>
|
||||
</el-popover>
|
||||
|
@ -146,13 +150,13 @@
|
|||
<el-col :span="24">
|
||||
<el-form-item label="字典">
|
||||
<el-select v-model="form.dictKey">
|
||||
<el-option v-for="dict in dictMap" :key="dict.id" :label="dict.dictionaryName+'('+dict.dictionaryKey+')'" :value="dict.dictionaryKey"></el-option>
|
||||
<el-option v-for="(value, key) in dictMap" :key="key" :label="key" :value="key"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item>
|
||||
<el-table :data="dictionaryDataList" striped border>
|
||||
<el-table :data="dictMap[form.dictKey]" striped border>
|
||||
<el-table-column property="label" label="字典标签"/>
|
||||
<el-table-column property="val" label="字典值"/>
|
||||
</el-table>
|
||||
|
@ -162,75 +166,120 @@
|
|||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="formStatus = false">取 消</el-button>
|
||||
<el-button type="primary" @click="updDict()">确 定</el-button>
|
||||
<el-button type="primary" @click="formStatus = false">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {assetModelList, updateAssetModel, updateSource} from "@/api/dataSource/source";
|
||||
import {getDictionaryList} from "@/api/dataSource/dictionary";
|
||||
|
||||
export default {
|
||||
name: 'OverallAssetStructure',
|
||||
watch:{
|
||||
'title': {
|
||||
handler(val) {
|
||||
this.getDictionaryList()
|
||||
this.assetModelList()
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
'form.dictKey':{
|
||||
handler(val) {
|
||||
this.dictMap.forEach(dict => {
|
||||
if (dict.dictionaryKey === val){
|
||||
this.dictionaryDataList = dict.dictionaryDataList
|
||||
this.form.dictionaryId = dict.id
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
props: {
|
||||
title: {
|
||||
tableParams: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
tableParams: {
|
||||
handler(val) {
|
||||
if (val != null){
|
||||
this.init()
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dictionaryDataList:[],
|
||||
tableData: [
|
||||
{
|
||||
id: 1,
|
||||
name: "id",
|
||||
comment: "主键",
|
||||
isPrimaryKey: "Y",
|
||||
type: "bigint",
|
||||
mappingType: "Long",
|
||||
length: "-",
|
||||
decimalPlaces: "-",
|
||||
isNull: "N",
|
||||
defaultValue: "-",
|
||||
isDict: "N",
|
||||
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: {},
|
||||
formStatus: false,
|
||||
tableData: [],
|
||||
dictMap: {}
|
||||
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}
|
||||
],
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
},
|
||||
methods: {
|
||||
assetModelList(){
|
||||
assetModelList(this.title).then(res => {
|
||||
this.tableData = res.data
|
||||
this.formStatus = false
|
||||
console.log(this.tableData)
|
||||
})
|
||||
init() {
|
||||
console.log("查询")
|
||||
},
|
||||
updDict(){
|
||||
console.log(this.form)
|
||||
updateAssetModel(this.form).then(res => {
|
||||
this.assetModelList()
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
getDictionaryList() {
|
||||
getDictionaryList(this.title.dataSourceId).then(res => {
|
||||
this.dictMap = res.data
|
||||
console.log(this.dictMap)
|
||||
})
|
||||
},
|
||||
async update(row) {
|
||||
this.getDictionaryList()
|
||||
update(row) {
|
||||
this.form = row;
|
||||
this.formStatus = true;
|
||||
}
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
<el-col :lg="8" :sm="12" :xs="12" class="card-panel-col">
|
||||
<div class="card-panel" @click="handleSetLineChartData('newVisitis')">
|
||||
<div class="card-panel-icon-wrapper icon-people">
|
||||
<svg-icon class-name="card-panel-icon" icon-class="table"/>
|
||||
<svg-icon class-name="card-panel-icon" icon-class="database"/>
|
||||
</div>
|
||||
<div class="card-panel-description">
|
||||
<div class="card-panel-text">
|
||||
数据接入
|
||||
</div>
|
||||
<count-to :duration="2600" :end-val="statisticsInfo.dataAsset" :start-val="0" class="card-panel-num"/>
|
||||
<count-to :duration="2600" :end-val="4" :start-val="0" class="card-panel-num"/>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
|
@ -25,20 +25,20 @@
|
|||
<div class="card-panel-text">
|
||||
资产模型
|
||||
</div>
|
||||
<count-to :duration="3000" :end-val="statisticsInfo.assetModel" :start-val="0" class="card-panel-num"/>
|
||||
<count-to :duration="3000" :end-val="96" :start-val="0" class="card-panel-num"/>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :lg="8" :sm="12" :xs="12" class="card-panel-col">
|
||||
<div class="card-panel" @click="handleSetLineChartData('purchases')">
|
||||
<div class="card-panel-icon-wrapper icon-money">
|
||||
<svg-icon class-name="card-panel-icon" icon-class="table"/>
|
||||
<svg-icon class-name="card-panel-icon" icon-class="field"/>
|
||||
</div>
|
||||
<div class="card-panel-description">
|
||||
<div class="card-panel-text">
|
||||
数据模型
|
||||
</div>
|
||||
<count-to :duration="3200" :end-val="statisticsInfo.dataModel" :start-val="0" class="card-panel-num"/>
|
||||
<count-to :duration="3200" :end-val="560" :start-val="0" class="card-panel-num"/>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
|
@ -47,30 +47,15 @@
|
|||
|
||||
<script>
|
||||
import CountTo from 'vue-count-to'
|
||||
import {statisticsInfo} from "@/api/dataSource/source";
|
||||
|
||||
export default {
|
||||
|
||||
components: {
|
||||
CountTo
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
statisticsInfo: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleSetLineChartData(type) {
|
||||
this.$emit('handleSetLineChartData', type)
|
||||
},
|
||||
statistics(){
|
||||
statisticsInfo().then(res => {
|
||||
this.statisticsInfo = res.data
|
||||
})
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.statistics()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<el-row :gutter="40" class="panel-group">
|
||||
<div class="title-header">
|
||||
{{title.dataSourceName+'('+title.databaseName+'-'+title.systemName+')'}} - 资产结构概述
|
||||
{{title.name+'('+title.databaseName+'-'+title.systemName+')'}} - 资产结构概述
|
||||
</div>
|
||||
<el-col :sm="12" :xs="12" class="card-panel-col">
|
||||
<div class="card-panel" @click="handleSetLineChartData('messages')">
|
||||
|
@ -12,20 +12,20 @@
|
|||
<div class="card-panel-text">
|
||||
资产模型
|
||||
</div>
|
||||
<count-to :duration="3000" :end-val="assetModel" :start-val="0" class="card-panel-num"/>
|
||||
<count-to :duration="3000" :end-val="15" :start-val="0" class="card-panel-num"/>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :sm="12" :xs="12" class="card-panel-col">
|
||||
<div class="card-panel" @click="handleSetLineChartData('purchases')">
|
||||
<div class="card-panel-icon-wrapper icon-money">
|
||||
<svg-icon class-name="card-panel-icon" icon-class="table"/>
|
||||
<svg-icon class-name="card-panel-icon" icon-class="field"/>
|
||||
</div>
|
||||
<div class="card-panel-description">
|
||||
<div class="card-panel-text">
|
||||
数据模型
|
||||
</div>
|
||||
<count-to :duration="3200" :end-val="dataModel" :start-val="0" class="card-panel-num"/>
|
||||
<count-to :duration="3200" :end-val="230" :start-val="0" class="card-panel-num"/>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
|
@ -43,63 +43,54 @@
|
|||
</el-popover>
|
||||
<el-popover
|
||||
placement="right"
|
||||
width="200px"
|
||||
width="400"
|
||||
trigger="click">
|
||||
|
||||
<el-form :inline="true" :model="dictInfo" class="demo-form-inline">
|
||||
<el-form-item label="字典名称:">
|
||||
<el-input v-model="dictInfo.dictionaryName" style="width: 150px"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="字典Key:">
|
||||
<el-input v-model="dictInfo.dictionaryKey" style="width: 150px"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<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">确定</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-button style="float: right; padding: 3px 0" type="text" slot="reference">新增字典</el-button>
|
||||
</el-popover>
|
||||
</div>
|
||||
<el-row :gutter="20">
|
||||
<el-col v-for="dict in dictMap" :md="8" :sm="24" :xs="12">
|
||||
<el-col v-for="(val,key) in dictMap" :md="8" :sm="24" :xs="12">
|
||||
<el-card class="box-card" style="height: 300px">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>{{dict.dictionaryName+'('+dict.dictionaryKey+')'}}</span>
|
||||
<span>{{key}}</span>
|
||||
<el-button style="float: right; padding: 3px 0"
|
||||
type="text"
|
||||
@click="deleteDictionary(dict.id)"
|
||||
>删除</el-button>
|
||||
<el-button style="float: right; padding: 3px 0;margin-right: 8px"
|
||||
type="text"
|
||||
@click="dict.dictionaryDataList.push({ label: null, val: null, edit: true })"
|
||||
@click="val.push({ label: null, val: null, isEdit: true })"
|
||||
>新增</el-button>
|
||||
</div>
|
||||
<el-table :data="dict.dictionaryDataList" style="width: 100%" height="280px">
|
||||
<el-table :data="val" style="width: 100%" height="280px">
|
||||
<el-table-column prop="label" label="标签">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="!scope.row.edit">{{scope.row.label}}</span>
|
||||
<el-input v-if="scope.row.edit" v-model="scope.row.label" size="mini"></el-input>
|
||||
<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="值">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="!scope.row.edit">{{scope.row.val}}</span>
|
||||
<el-input v-if="scope.row.edit" v-model="scope.row.val" size="mini"></el-input>
|
||||
<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>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="val" label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
v-if="!scope.row.edit"
|
||||
v-if="!scope.row.isEdit"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="scope.row.edit = true"
|
||||
@click="scope.row.isEdit = true"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.edit"
|
||||
@click="editConfirm(dict,scope.row)"
|
||||
v-if="scope.row.isEdit"
|
||||
@click="editConfirm(scope.row)"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-finished"
|
||||
|
@ -113,10 +104,11 @@
|
|||
</el-card>
|
||||
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-tabs v-model="activeName" type="border-card">
|
||||
<el-tab-pane v-for="tableAsset in title.tableList" :label="tableAsset.tableName+'('+tableAsset.tableComment+')'" :name="tableAsset.tableName">
|
||||
<overall-asset-structure ref="assetStru" v-if="activeName == tableAsset.tableName" :title="tableAsset"/>
|
||||
<el-col :span="24" style="margin-top: 20px">
|
||||
<el-tabs v-model="activeName" type="border-card" @tab-click="checkTableName">
|
||||
<el-tab-pane v-for="table in tableList" :label="table.tableName+'('+table.tableAsName+')'"
|
||||
:name="table.tableName">
|
||||
<overall-asset-structure v-if="table.tableName === tableParams.tableName" :table-params="tableParams"/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-col>
|
||||
|
@ -127,111 +119,73 @@
|
|||
<script>
|
||||
import CountTo from 'vue-count-to'
|
||||
import OverallAssetStructure from './OverallAssetStructure.vue'
|
||||
import {addDictionary, deleteDictionary, getDictionaryList} from "@/api/dataSource/dictionary";
|
||||
import {addData, updateData} from "@/api/dataSource/data";
|
||||
|
||||
export default {
|
||||
watch:{
|
||||
'title':{
|
||||
handler(val){
|
||||
this.getDictionaryList()
|
||||
this.activeName = val.tableList[0].tableName
|
||||
this.assetModel = 0
|
||||
this.dataModel = 0
|
||||
val.tableList.forEach(table => {
|
||||
if (table.tableCount!=null){
|
||||
this.dataModel = parseInt(this.dataModel) + parseInt(table.tableCount);
|
||||
}
|
||||
if (table.fields!=null){
|
||||
this.assetModel = parseInt(this.assetModel) + parseInt(table.fields);
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
props: {
|
||||
title:{}
|
||||
title: {
|
||||
type: String,
|
||||
default: "-"
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dictInfo: {
|
||||
dictionaryName: null,
|
||||
dictionaryKey: null,
|
||||
dataSourceId: null
|
||||
activeName: null,
|
||||
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 }
|
||||
],
|
||||
},
|
||||
dictMap: {},
|
||||
activeName: '',
|
||||
assetModel: 0,
|
||||
dataModel: 0
|
||||
tableList: [],
|
||||
tableParams: null
|
||||
}
|
||||
},
|
||||
components: {
|
||||
OverallAssetStructure,
|
||||
CountTo
|
||||
},
|
||||
created() {
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
deleteDictionary(id) {
|
||||
deleteDictionary(id).then(res => {
|
||||
this.getDictionaryList()
|
||||
// this.$nextTick(() => {
|
||||
// this.$refs.assetStru.assetModelList()
|
||||
// })
|
||||
})
|
||||
|
||||
checkTableName(checkTab){
|
||||
this.tableParams = this.tableList.findLast(item => item.tableName === checkTab.name)
|
||||
},
|
||||
getDictionaryList() {
|
||||
getDictionaryList(this.title.id).then(res => {
|
||||
this.dictMap = res.data
|
||||
})
|
||||
init(){
|
||||
let rows = [
|
||||
{
|
||||
tableName: "sys_user",
|
||||
tableAsName: "用户表"
|
||||
},
|
||||
editConfirm(dict,row){
|
||||
{
|
||||
tableName: "sys_dept",
|
||||
tableAsName: "部门表"
|
||||
},
|
||||
];
|
||||
this.tableList = rows;
|
||||
this.activeName = rows[0].tableName;
|
||||
this.tableParams = rows[0]
|
||||
},
|
||||
editConfirm(row){
|
||||
if (!row.label || !row.val) {
|
||||
this.$message.error('字典标签或字典值,不可为空');
|
||||
return;
|
||||
}
|
||||
console.log(row)
|
||||
if (row.id) {
|
||||
console.log('修改')
|
||||
updateData(row).then(res => {
|
||||
row.edit = false;
|
||||
this.getDictionaryList()
|
||||
// this.$nextTick(() => {
|
||||
// this.$refs.assetStru.assetModelList()
|
||||
// })
|
||||
})
|
||||
}else{
|
||||
console.log('添加')
|
||||
row.dictionaryId=dict.id
|
||||
addData(row).then(res => {
|
||||
row.edit = false;
|
||||
this.getDictionaryList()
|
||||
// this.$nextTick(() => {
|
||||
// this.$refs.assetStru.assetModelList()
|
||||
// })
|
||||
})
|
||||
}
|
||||
|
||||
row.isEdit = false;
|
||||
},
|
||||
addDict(){
|
||||
if (!this.dictInfo.dictionaryName){
|
||||
this.$message.error('字典名称,不可为空');
|
||||
if (!this.dictAddName){
|
||||
this.$message.error('数据字典,不可为空');
|
||||
return;
|
||||
}
|
||||
if (!this.dictInfo.dictionaryKey){
|
||||
this.$message.error('字典Key,不可为空');
|
||||
return;
|
||||
}
|
||||
this.dictInfo.dataSourceId = this.title.id
|
||||
addDictionary(this.dictInfo).then(res => {
|
||||
this.dictInfo = {
|
||||
dictionaryName: null,
|
||||
dictionaryKey: null,
|
||||
dataSourceId: null
|
||||
}
|
||||
this.getDictionaryList()
|
||||
})
|
||||
|
||||
this.dictMap[this.dictAddName] = []
|
||||
this.dictAddName = null
|
||||
},
|
||||
handleSetLineChartData(type) {
|
||||
this.$emit('handleSetLineChartData', type)
|
||||
|
|
Loading…
Reference in New Issue