feat:字典表展示
parent
63ad3f5ebe
commit
f2bdb0e4d2
|
@ -108,3 +108,11 @@ export function getTableDataCount(id) {
|
|||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 根据数据源id查询字典类型数据
|
||||
export function getDictDataList(id) {
|
||||
return request({
|
||||
url: '/source/dictType/getDictDataList/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
<div class="card-panel-text">
|
||||
数据模型
|
||||
</div>
|
||||
<count-to :duration="3200" :end-val="count.assetStructureTableDataCount" :start-val="0" class="card-panel-num"/>
|
||||
<count-to :duration="3200" :end-val="count.assetStructureTableDataCount" :start-val="0"
|
||||
class="card-panel-num"/>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
|
@ -57,27 +58,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="(dict,index) in dictDataList" :md="8" :sm="24" :xs="12">
|
||||
<el-card class="box-card" style="height: 300px">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>{{ key }}</span>
|
||||
<span>{{dict.dictName+'('+dict.dictType+')'}}</span>
|
||||
<el-button style="float: right; padding: 3px 0"
|
||||
type="text"
|
||||
@click="val.push({ label: null, val: null, isEdit: true })"
|
||||
@click="dict.dictData.push({ dictLabel: null, dictValue: null, isEdit: true })"
|
||||
>新增
|
||||
</el-button>
|
||||
</div>
|
||||
<el-table :data="val" style="width: 100%" height="280px">
|
||||
<el-table-column prop="label" label="标签">
|
||||
<el-table :data="dict.dictData" style="width: 100%" height="280px">
|
||||
<el-table-column prop="dictLabel" 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.isEdit">{{ scope.row.dictLabel }}</span>
|
||||
<el-input v-if="scope.row.isEdit" v-model="scope.row.dictLabel" size="mini"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="val" label="值">
|
||||
<el-table-column prop="dictValue" 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.dictValue }}</span>
|
||||
<el-input v-if="scope.row.isEdit" v-model="scope.row.dictValue" size="mini"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="val" label="操作">
|
||||
|
@ -130,27 +131,25 @@ export default {
|
|||
assetStructureTableCount: null,
|
||||
assetStructureTableDataCount: null
|
||||
},
|
||||
childrenList: [],
|
||||
childrenList: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: "-"
|
||||
},
|
||||
dictDataList: {
|
||||
type: Array,
|
||||
default: []
|
||||
}
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
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: [],
|
||||
childrenParams: null
|
||||
}
|
||||
},
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
<el-container>
|
||||
<el-main>
|
||||
<OverallAssets v-if="showAssets == null" :count="count"/>
|
||||
<overall-specific-assets v-if="showAssets === 'dataSource'" :childrenList="childrenList" :count="count"
|
||||
:title="title"/>
|
||||
<overall-specific-assets v-if="showAssets === 'dataSource'" :children-list="childrenList" :count="count"
|
||||
:dict-data-list="dictDataList" :title="title"/>
|
||||
<overall-asset-structure v-if="showAssets === 'dataTable'" :children-params="childrenParams"
|
||||
:tableDataList="tableDataList"/>
|
||||
</el-main>
|
||||
|
@ -37,7 +37,7 @@ import OverallAssetStructure from './dashboard/OverallAssetStructure.vue'
|
|||
import {
|
||||
addTableData,
|
||||
getAssetList,
|
||||
getChildrenList, getTableDataCount,
|
||||
getChildrenList,
|
||||
selectTableData,
|
||||
selectTableDataCount
|
||||
} from "@/api/data/source";
|
||||
|
@ -52,6 +52,7 @@ export default {
|
|||
children: 'childrenList',
|
||||
label: 'name'
|
||||
},
|
||||
dictDataList: [],
|
||||
assetStructureList: [],
|
||||
childrenList: [],
|
||||
tableDataList: [],
|
||||
|
@ -80,17 +81,9 @@ export default {
|
|||
getTableDataCount(data.id).then(res => {
|
||||
this.count = res.data
|
||||
})
|
||||
getChildrenList(data).then(res => {
|
||||
console.log(res)
|
||||
this.childrenList = res.data
|
||||
resolve(this.childrenList)
|
||||
this.childrenList.forEach(children => {
|
||||
this.showTable.assetStructure = data
|
||||
this.showTable.tableName = children.name
|
||||
addTableData(this.showTable).then(res => {
|
||||
// console.log(res)
|
||||
})
|
||||
})
|
||||
getDictDataList(data.id).then(res => {
|
||||
this.dictDataList = res.data
|
||||
console.log(this.dictDataList)
|
||||
})
|
||||
}
|
||||
// this.showAssets = data.type;
|
||||
|
|
Loading…
Reference in New Issue