数据格式
[
{
"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]
}
}
}
}