el-table的指定列进行合算的方法

1、表格结构
 
<el-card class="huizong" style="margin-bottom: 10px">
          <el-table :data="data_group" show-summary :summary-method="getSummaries" border style="width: 100%"
            :header-cell-style="setTitle">
            <el-table-column prop="classId" label="组别" width="50" align="center" />
            <el-table-column prop="gmv_mubiao" label="GMV目标" width="110">
            </el-table-column>
            <el-table-column prop="gmv" label="GMV完成" width="100" />
            <el-table-column prop="gmv_rate" label="GMV进度">
              <template slot-scope="scope">
                <el-progress :percentage="scope.row.gmv_rate"
                  :color="scope.row.gmv_rate > scope.row.bfb || scope.row.gmv_rate >= 100 ? colorGreen : colorYellow"></el-progress>
              </template>
            </el-table-column>
            <el-table-column prop="gongxian_gmv" label="GMV贡献">
              <template slot-scope="scope">
                <el-progress :percentage="scope.row.gongxian_gmv" :color="DarkOrange"></el-progress>
              </template>
            </el-table-column>
            <el-table-column prop="quekou" label="GMV缺口" width="100" />
            <el-table-column prop="item_gmv_over_mubiao" label="超额目标" width="100" />
            <el-table-column prop="grossProfit" label="超额毛利" width="100">
            </el-table-column>
            <el-table-column prop="item_gmv_over_rate" label="超额进度">
              <template slot-scope="scope">
                <el-progress :percentage="scope.row.item_gmv_over_rate" :color="DarkTurquoise"></el-progress>
              </template>
            </el-table-column>
            <el-table-column prop="gongxian_grossProfit" label="毛利贡献">
              <template slot-scope="scope">
                <el-progress :percentage="scope.row.gongxian_grossProfit" :color="pink"></el-progress>
              </template>
            </el-table-column>
            <el-table-column prop="dazong_gmv" label="大宗gmv" width="100" />
            <el-table-column prop="dazong_gmv_rate" label="大宗占比">
              <template slot-scope="scope">
                <el-progress :percentage="scope.row.dazong_gmv_rate" :color="RoyalBlue"></el-progress>
              </template>
            </el-table-column>
            <el-table-column prop="ziran_rate" label="自然占比">
              <template slot-scope="scope">
                <el-progress :percentage="scope.row.ziran_rate" :color="RoyalBlue"></el-progress>
              </template>
            </el-table-column>
            <el-table-column prop="natural_order_rate" label="自然订单毛利率">
              <template slot-scope="scope">
                <el-progress :percentage="scope.row.natural_order_rate" :color="Fuchsia"></el-progress>
              </template>
            </el-table-column>

          </el-table>
2、过summary-method编写一个函数,自定义合计的逻辑 

3、借助column的property属性:
 4、可以发现其实就是全部的属性名称,那么我们就可以根据它判断,实现自定义核算了 

5、设置自己想要核算这一列的值:
6、效果
 
  • 10
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值