|
@@ -52,6 +52,7 @@
|
|
|
<el-table
|
|
|
class="wenzi"
|
|
|
:data="warehouseList"
|
|
|
+ :span-method="arraySpanMethod"
|
|
|
style="width: 100%; margin-top: 20px"
|
|
|
height="780"
|
|
|
>
|
|
@@ -187,15 +188,51 @@ export default {
|
|
|
this.showType = this.isShow
|
|
|
},
|
|
|
methods: {
|
|
|
+ arraySpanMethod(obj){
|
|
|
+ if (obj.columnIndex === 1 ) {
|
|
|
+ // 二维数组存储的数据 取出
|
|
|
+ var _row = this.spanArr[obj.rowIndex]
|
|
|
+ var _col = _row > 0 ? 1 : 0
|
|
|
+ return {
|
|
|
+ rowspan: _row,
|
|
|
+ colspan: _col
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getSpanArr:function(data) {
|
|
|
+ var vm = this;
|
|
|
+ vm.spanArr = [];
|
|
|
+ vm.pos = 0;
|
|
|
+ data.forEach(function(item, index){
|
|
|
+ //判断是否是第一项
|
|
|
+ if (index === 0) {
|
|
|
+ vm.spanArr.push(1);
|
|
|
+ vm.pos = 0;
|
|
|
+ } else {
|
|
|
+ //不是第一项时,就根据标识去存储
|
|
|
+ if (data[index].warehouseName === data[index - 1].warehouseName ) {
|
|
|
+ // 查找到符合条件的数据时每次要把之前存储的数据+1
|
|
|
+ vm.spanArr[vm.pos] += 1;
|
|
|
+ vm.spanArr.push(0);
|
|
|
+ } else {
|
|
|
+ // 没有符合的数据时,要记住当前的index
|
|
|
+ vm.spanArr.push(1);
|
|
|
+ vm.pos = index
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
changeradio(e) {
|
|
|
this.selectWarehouse()
|
|
|
},
|
|
|
warehouselocation(){
|
|
|
this.$router.push({ path: 'warehouselocation',query:{cangId:this.cangid}})
|
|
|
},
|
|
|
- weightedsubsidiary(){
|
|
|
- console.log(this.cangid)
|
|
|
- this.$router.push({ path: 'weightedsubsidiary',query:{cangId:this.cangid} })
|
|
|
+ weightedsubsidiary(item){
|
|
|
+ // console.log(item)
|
|
|
+ this.$router.push({ path: 'weightedsubsidiary',query:{cangId:item.warehouseId} })
|
|
|
},
|
|
|
warehouseNameChange(e) {
|
|
|
for(let i = 0 ; i < this.warehouseList1.length; i++){
|
|
@@ -257,7 +294,7 @@ export default {
|
|
|
this.getList()
|
|
|
},
|
|
|
handleCurrentChange(val) {
|
|
|
- this.currentPage = val
|
|
|
+ this.currectPage = val
|
|
|
console.log(`当前页: ${val}`)
|
|
|
this.getList()
|
|
|
},
|
|
@@ -319,6 +356,7 @@ export default {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ this.getSpanArr(arr)
|
|
|
this.warehouseList = arr
|
|
|
this.deptBudgetTotal=response.total
|
|
|
})
|