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