layui数据表格的复杂表头(仅展示)

在这里插入图片描述


layui.use(['table'], function () {
	var table =layui.table;
	
	var tableCol = []
    var tableCol = new Array()

	tableCol = [
       [
           { type: 'numbers', title: '序号', align: 'center', width:4 + '%', rowspan: 2,},
           { field: 'sku_code', title: 'SKU编码', align: 'center',sort: true, width:8 + '%', rowspan: 2},
           { field: 'brand', title: '品牌', align: 'center', width:8 + '%', rowspan: 2},
           { field: 'type_name', title: '品类', sort: true, align: 'center', width:8 + '%', rowspan: 2},
           { field: 'spec_name', title: '产品型号', sort: true, align: 'center', width:8 + '%', rowspan: 2},
           { field: 'bar_code', title: '条形码', sort: true, align: 'center', width:8 + '%', rowspan: 2},
           { field: 'msr_price', title: '建议零售价', sort: true, align: 'center', width:8 + '%', rowspan: 2},
           { field: 'store_price', title: '门店标价', sort: true, align: 'center', width:8 + '%', rowspan: 2},
           {  title: '变更前含税供货价', align: 'center', width:8 + '%',colspan: 2},
           {  title: `变更前供货折扣<i class="layui-icon alone-tips analyseTips">&#xe60b;</i>`, align: 'center', width:8 + '%',colspan: 2},
           {  title: '含税供货价', align: 'center', width:8 + '%',colspan: 2},
           {  title: `供货折扣<i class="layui-icon alone-tips analyseTips">&#xe60b;</i>`, align: 'center', width:8 + '%',colspan: 2},
           { field: 'status', align: 'center', title: '变更类型', width:8 + '%',
               templet: function(d){
                 return tempType(d.change_type)
               },
           }
       ],
       [
           {field: 'old_supply_price',title: '大货/样机', align: 'center', templet: function(d){
               return '<a>'+d.old_supply_price+' / '+d.old_model_price+'</a>';
           }},
           {title: '', field:'', hide: true},
           {field: 'old_supply_discount',title: '大货/样机', align: 'center',templet: function(d){
               return '<a>'+d.old_supply_discount+' / '+d.old_model_discount+'</a>';
           }},
           {title: '', field:'', hide: true} ,
           {field: 'supply_price',title: '大货/样机', align: 'center', templet: function(d){
               return '<a>'+d.supply_price+' / '+d.model_price+'</a>';
           }},
           {title: '', field:'', hide: true} ,
           {field: 'supply_discount',title: '大货/样机', align: 'center',templet: function(d){
               return '<a>'+d.supply_discount+' / '+d.model_discount+'</a>';
           }},
           {title: '', field:'', hide: true} 
       ]
   ]
})

对应关系
在这里插入图片描述
注:colspan:1会出现空白列,所以讲colspan设为2,对应中其中一项设置hide: true

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值