表格组件

This commit is contained in:
yanran200730
2023-03-15 15:18:19 +08:00
parent 106535fc01
commit 529e0ddccf
7 changed files with 87 additions and 55 deletions

View File

@@ -37,6 +37,7 @@
:stripe="data.stripe"
:theme="theme"
:isShowIndex="data.isShowIndex"
:config="dvTableConfig"
:data="values">
</AiDvTable>
<AiRanking
@@ -87,7 +88,8 @@ export default {
chartList,
map: null,
lib: null,
timer: null
timer: null,
dvTableConfig: []
}
},
computed: {
@@ -103,12 +105,24 @@ export default {
currentType: v => v.data.type
},
watch: {
data: {
values: {
immediate: true,
deep: true, handler() {
if (this.currentType == 'map') {
// this.renderMap()
}
if (this.currentType === 'AiDvTable') {
this.dvTableConfig = this.data[this.data.dataType].map((v, i) => {
return {
color: this.data.config[i] ? (this.data.config[i].color || '') : '',
width: this.data.config[i] ? (this.data.config[i].width || '') : '',
align: this.data.config[i] ? (this.data.config[i].align || '') : ''
}
})
this.data.config = this.dvTableConfig
}
}
}
},

View File

@@ -85,7 +85,7 @@ export default {
this.dashboard = JSON.parse(res.data.config).dashboard
this.componentList.forEach((item, index) => {
if (item.dataType !== 'staticData' && ((item.type.indexOf('Chart') > -1) || ['display', 'table', 'map', 'summary'].includes(item.type))) {
if (item.dataType !== 'staticData' && ((item.type.indexOf('Chart') > -1) || ['display', 'table', 'map', 'summary', 'AiRanking', 'AiDvTable'].includes(item.type))) {
this.getSourceData(item, index)
}
if (item.type === 'monitor' && item.monitorType === 'cmcc') {

View File

@@ -8,16 +8,15 @@ export default {
left: 50, right: 0
},
tooltip: {
// trigger: 'axis', backgroundColor: 'rgba(14, 51, 111, 0.9)', borderColor: '#1A6ABC',
trigger: 'axis', backgroundColor: 'rgba(14, 51, 111, 0.9)', borderColor: '#1A6ABC',
textStyle: {color: '#fff'}
},
yAxis: {
nameGap: 23, minInterval: 1,
// splitLine: {lineStyle: {color: 'rgba(255,255,255,.2)', type: 'dashed'}},
splitLine: {lineStyle: {color: 'rgba(255,255,255,.2)', type: 'dashed'}},
axisLabel: {color: '#fff'}, axisPointer: {show: false}
},
axisPointer: {
type: 'none', show: true, triggerTooltip: false,
},
daemon: {type: 'bar', barWidth: 12, stack: 'stack'}
}

View File

@@ -5,9 +5,9 @@
v-for="(item, index) in header"
:key="index"
:style="{
width: item.width + 'px',
textAlign: item.align,
flex: item.width ? 'inherit' : 1
width: config[index].width ? config[index].width + 'px' : '',
textAlign: config[index].align,
flex: config[index].width ? 'inherit' : 1
}">
{{ item.v }}
</span>
@@ -18,10 +18,10 @@
v-for="(column, i) in item"
:key="i"
:style="{
color: column.color,
textAlign: column.align,
width: column.width + 'px',
flex: column.width ? 'inherit' : 1
color: config[i].color,
textAlign: config[i].align,
width: config[i].width ? config[i].width + 'px' : '',
flex: config[i].width ? 'inherit' : 1
}">
<i v-if="isShowIndex === '1' && i === 0">{{ index + 1 }}</i>
<span :title="column.v">{{ column.v }}</span>
@@ -54,6 +54,11 @@
theme: {
type: String,
default: '0'
},
config: {
type: Array,
default: () => []
}
},
@@ -80,6 +85,7 @@
methods: {
init (value) {
console.log(this.config)
if (!value.length) {
this.header = []
this.body = []