关于element table表格横向数据展示封装
关于element table表格横向数据展示封装
·
1、模板
<JNPF-column :stripe="true" :data="data" height="100%">
<el-table-column prop="label" label="危险度" align="center" />
<el-table-column
v-for="(item, index) in dataSource"
:key="index"
:label="item.deptName"
align="center"
>
<template slot-scope="scope">
<span > {{ (scope.row.option[index]) }} </span>
</template>
</el-table-column>
</JNPF-column>
2、传值
getStatus() {
this.listLoading = true
getTicketStastic(this.query).then(res => {
if (res.code == 200) {
let data = res.data
//遍历取出所有的状态类型
let arr = []
data[0].ticketStatusLabel.forEach((item,index) => {
let obj = {
label:""
}
obj.label = item.label
arr.push(obj)
})
this.formatData2 = arr
this.formatData2.forEach((item,index) => {
let arr2 =[]
data.forEach((subItem,subIndex) => {
arr2.push(subItem.ticketStatusLabel[index].value)
})
this.formatData2[index]['option'] = arr2
})
this.formatData2 = arr
this.$refs.ticketStatic.init(this.formatData2,data)
this.listLoading=false;
}
}).catch(err=>{
this.listLoading=false;
})
}
更多推荐


所有评论(0)