2021-03-11element合并单元格

23 篇文章 0 订阅

数据格式

[
    {
        "carton_id": "10020711",
        "carton_name": "100207-1",
        "carton_sort": "0",
        "created_at": "0",
        "id": "1",
        "is_deleted": "0",
        "logistics": null,
        "order_id": "1002071",
        "state": "3",
        "type": "1",
        "update_at": "0",
        "work_order_id": "1585",
        "order_sn": "0251000017-3",
        "wuliudanhao": ""
    },
    {
        "carton_id": "10021621",
        "carton_name": "0251002127(S17991) - 1",
        "carton_sort": "1",
        "created_at": "1615272218",
        "id": "13",
        "is_deleted": "0",
        "logistics": null,
        "order_id": "9",
        "state": "3",
        "type": "3",
        "update_at": "1615272218",
        "work_order_id": "3",
        "order_sn": "客厅 双开布艺帘 3.960米 x 2.420米 ",
        "wuliudanhao": ""
    },
    {
        "carton_id": "10021621",
        "carton_name": "0251002127(S17991) - 1",
        "carton_sort": "1",
        "created_at": "1615272218",
        "id": "13",
        "is_deleted": "0",
        "logistics": null,
        "order_id": "9",
        "state": "3",
        "type": "3",
        "update_at": "1615272218",
        "work_order_id": "3",
        "order_sn": "客厅 杆轨 802-6单直轨3.960米",
        "wuliudanhao": ""
    }
]

表格

<el-table
    ref="multipleTable"
    :data="newtableData"
    tooltip-effect="dark"
	max-height="70%"
    :span-method="objectSpanMethod"
    style="width: 100%;font-size:20px"
	border
    @selection-change="handleSelectionChange">
    
    <el-table-column
    prop="carton_name"
      label="箱号">
      <!-- <template slot-scope="scope">{{ scope.row.carton_name }}</template> -->
    </el-table-column>
    <el-table-column
      prop="order_sn"
      label="物品条目">
    </el-table-column>
    <el-table-column
      prop="wuliudanhao"
      label="物流单号">
    </el-table-column>
    <el-table-column
      label="操作"
      width="100">
      <template slot-scope="scope">
        <el-button @click="handleClick(scope.row)" type="text" size="small">输入物流单号</el-button>
      </template>
    </el-table-column>
    <el-table-column
      type="selection"
	  width="55">
    </el-table-column>
  </el-table>

合并单元格

 if(columnIndex == 0 || columnIndex == 2 || columnIndex == 3 || columnIndex == 4){

                    let current = row.carton_name;

                    if(current == (this.newtableData[rowIndex - 1] || {}).carton_name){

                        return [0, 0]

                    }

                    else{

                        let rowspan = 1;

                        for(var i = rowIndex; i < this.newtableData.length; i++){

                            let next = (this.newtableData[i + 1] || {}).carton_name;

                            if(current == next){

                                rowspan++

                            }else{

                                return [rowspan, 1]

                            }

                        }

                    }

                }

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值