|
@@ -22,17 +22,17 @@
|
|
|
></el-input>
|
|
|
<Select @change='getList' v-model='floor' width='120' tipPlace='top' caption='楼层 :' :selectdata='floorSelect'></Select>
|
|
|
</div>
|
|
|
- <el-table :data='tableData' style='width: 100%' @row-click='innerVisible = true'>
|
|
|
- <el-table-column prop='floor' label='楼层' width='120'>
|
|
|
+ <el-table :data='tableData' :span-method='objectSpanMethod' border style='width: 100%' @row-click='innerVisible = true'>
|
|
|
+ <el-table-column prop='floor' label='楼层' width='200'>
|
|
|
<template slot-scope='{row}'>{{row.floor || '--'}}</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop='welldes' label='电井间' width='160'>
|
|
|
+ <el-table-column prop='welldes' label='电井间'>
|
|
|
<template slot-scope='{row}'>{{row.welldes || '--'}}</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop='meterbox' label='商铺电表数'>
|
|
|
+ <el-table-column prop='meterbox' label='商铺电表数' width='200'>
|
|
|
<template slot-scope='{row}'>{{row.meterbox || '--'}}</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop='shopsnum' label='商铺编号'>
|
|
|
+ <el-table-column prop='shopsnum' label='商铺编号' width='200'>
|
|
|
<template slot-scope='{row}'>{{row.shopsnum || '--'}}</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -59,14 +59,32 @@ export default {
|
|
|
computed: {
|
|
|
...mapGetters(['floorSelect'])
|
|
|
},
|
|
|
-
|
|
|
+ props: ['param'],
|
|
|
methods: {
|
|
|
+ objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
|
|
+ if (columnIndex === 0) {
|
|
|
+ if (row.col0count > 0) {
|
|
|
+ return {
|
|
|
+ rowspan: row.col0count,
|
|
|
+ colspan: 1
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return {
|
|
|
+ rowspan: 0,
|
|
|
+ colspan: 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
pageChanged(page) {
|
|
|
this.currentPage = page
|
|
|
this.getList()
|
|
|
},
|
|
|
getList() {
|
|
|
- let getParams = {}
|
|
|
+ let getParams = {
|
|
|
+ page: 1,
|
|
|
+ size: 10
|
|
|
+ }
|
|
|
if (this.floor) {
|
|
|
getParams.floor = this.floorSelect
|
|
|
}
|
|
@@ -82,12 +100,37 @@ export default {
|
|
|
}
|
|
|
queryShops({ getParams }).then(res => {
|
|
|
console.log(res)
|
|
|
- this.tableData = res.data.data
|
|
|
- this.total = res.data.count
|
|
|
+ this.tableData = []
|
|
|
+ let floor = {}
|
|
|
+ res.data.forEach(i => {
|
|
|
+ Object.keys(i).forEach(key => (floor[key] = 0)) // 初始化每一楼层个数为0
|
|
|
+ Object.values(i).forEach(j => {
|
|
|
+ Object.values(j).forEach(k => {
|
|
|
+ this.tableData.push(...k)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ this.tableData.map(n => {
|
|
|
+ if (floor[n.floor] === 0) {
|
|
|
+ const count = this.tableData.filter(m => m.floor === n.floor).length
|
|
|
+ floor[n.floor] = count
|
|
|
+ n.col0count = count
|
|
|
+ } else {
|
|
|
+ n.col0count = 0
|
|
|
+ }
|
|
|
+ return n
|
|
|
+ })
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
+ watch: {
|
|
|
+ param(newV, oldV) {
|
|
|
+ if (newV !== oldV) {
|
|
|
+ this.getList()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
mounted() {
|
|
|
this.getList()
|
|
|
}
|