elementui的table合并列,三个一组

在这里插入图片描述

 <el-table :span-method="objectSpanMethod" :cell-style="iCellStyle" :data="tableData" height="63vh" border style="width: 100%; margin-top: 6px"><el-table-column type="index" label="序号" width="50" align="center"></el-table-column><el-table-column prop="vocs" label="VOCs组分" align="center"></el-table-column><el-table-column label="源成分谱" align="center"><template slot-scope="{row}"><span v-if="row.type==1">化工</span><span v-if="row.type==2">制造业</span><span v-if="row.type==3">交通运输</span></template></el-table-column><el-table-column prop="value" label="成分浓度(ug/m3)" align="center"></el-table-column><el-table-column prop="rate" label="成分浓度贡献率" align="center"></el-table-column></el-table>
this.tableData=[{"type": "1","value": 8.008,"rate": 28.241932639746075,"vocs": "乙烷"},{"type": "2","value": 7.862,"rate": 27.727032269441022,"vocs": "乙烷"},{"type": "3","value": 12.485,"rate": 44.03103509081291,"vocs": "乙烷"},{"type": "1","value": 11.184,"rate": 39.46226315232349,"vocs": "乙烯"},{"type": "2","value": 12.289,"rate": 43.361208143678766,"vocs": "乙烯"},{"type": "3","value": 4.868,"rate": 17.176528703997743,"vocs": "乙烯"},{"type": "1","value": 7.467,"rate": 30.569884549250798,"vocs": "丙烷"},{"type": "2","value": 8.686,"rate": 35.56046835339393,"vocs": "丙烷"},{"type": "3","value": 8.273,"rate": 33.869647097355276,"vocs": "丙烷"},{"type": "1","value": 2.832,"rate": 11.786739917592708,"vocs": "丙烯"},{"type": "2","value": 8.472,"rate": 35.260332126357845,"vocs": "丙烯"},{"type": "3","value": 12.723,"rate": 52.95292795604944,"vocs": "丙烯"},{"type": "1","value": 8.091,"rate": 41.29957633607268,"vocs": "异丁烷"},{"type": "2","value": 6.747,"rate": 34.43928334439283,"vocs": "异丁烷"},{"type": "3","value": 4.753,"rate": 24.26114031953448,"vocs": "异丁烷"},{"type": "1","value": 1.93,"rate": 11.623005118940078,"vocs": "乙炔"},{"type": "2","value": 5.598,"rate": 33.71273712737127,"vocs": "乙炔"},{"type": "3","value": 9.077,"rate": 54.66425775368865,"vocs": "乙炔"},{"type": "1","value": 2.265,"rate": 13.758124278685537,"vocs": "正丁烷"},{"type": "2","value": 6.344,"rate": 38.53489643442872,"vocs": "正丁烷"},{"type": "3","value": 7.854,"rate": 47.70697928688574,"vocs": "正丁烷"},{"type": "1","value": 4.244,"rate": 60.99453866053464,"vocs": "反-2-丁烯"},{"type": "2","value": 1.362,"rate": 19.5745903995401,"vocs": "反-2-丁烯"},{"type": "3","value": 1.352,"rate": 19.430870939925267,"vocs": "反-2-丁烯"},{"type": "1","value": 0.236,"rate": 3.935957304869913,"vocs": "1-丁烯"},{"type": "2","value": 0.634,"rate": 10.57371581054036,"vocs": "1-丁烯"},{"type": "3","value": 5.126,"rate": 85.49032688458973,"vocs": "1-丁烯"},{"type": "1","value": 1.772,"rate": 37.32097725358046,"vocs": "顺-2-丁烯"},{"type": "2","value": 2.192,"rate": 46.16680707666386,"vocs": "顺-2-丁烯"},{"type": "3","value": 0.784,"rate": 16.512215669755687,"vocs": "顺-2-丁烯"}
]this.flagValue = "";this.flagArr = [];this.indexAllArr = [];this.intervalArr = [];let indexArr = [];this.tableData.forEach((item, index) => {if (this.flagValue != item.vocs) {if (!this.flagArr.includes(item.vocs)) {this.flagArr.push(item.vocs);this.indexAllArr.push(index);indexArr.push(index);} else {this.indexAllArr.push("-");}}});// 计算每一种类型都有多少个indexArr.forEach((ele, eleIndex) => {var indexNum = "";if (indexArr[eleIndex] != indexArr[indexArr.length - 1]) {indexNum = indexArr[eleIndex + 1] - ele;} else {indexNum = this.tableData.length - indexArr[eleIndex];}this.intervalArr.push(indexNum);});this.indexAllArr.forEach((item, index) => {if (!isNaN(Number(item)) && typeof Number(item) === "number") {} else {this.intervalArr.splice(index, 0, "-");}});
 // 合并列objectSpanMethod({ row, column, rowIndex, columnIndex }) {if (columnIndex === 1) {const _row = this.indexAllArr[rowIndex];const rowspanVal = this.intervalArr[rowIndex];if (rowIndex == _row) {return {rowspan: rowspanVal,colspan: 1,};}else{return {rowspan: 0,colspan: 0,};}}},iCellStyle: function ({ row, column, rowIndex, columnIndex }) {return "height:44px !import";},

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/225114.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

商城免费搭建之java商城 鸿鹄云商 B2B2C产品概述

【B2B2C平台】&#xff0c;以传统电商行业为基石&#xff0c;鸿鹄云商支持“商家入驻平台自营”多运营模式&#xff0c;积极打造“全新市场&#xff0c;全新 模式”企业级B2B2C电商平台&#xff0c;致力干助力各行/互联网创业腾飞并获取更多的收益。从消费者出发&#xff0c;助…

蓝桥杯day01——根据给定数字划分数组

题目描述 给你一个下标从 0 开始的整数数组 nums 和一个整数 pivot 。请你将 nums 重新排列&#xff0c;使得以下条件均成立&#xff1a; 所有小于 pivot 的元素都出现在所有大于 pivot 的元素 之前 。所有等于 pivot 的元素都出现在小于和大于 pivot 的元素 中间 。小于 piv…

如何通过内网穿透实现公网远程ssh连接kali系统

文章目录 1. 启动kali ssh 服务2. kali 安装cpolar 内网穿透3. 配置kali ssh公网地址4. 远程连接5. 固定连接SSH公网地址6. SSH固定地址连接测试 简单几步通过[cpolar 内网穿透](cpolar官网-安全的内网穿透工具 | 无需公网ip | 远程访问 | 搭建网站)软件实现ssh远程连接kali 1…

2023-11-26 LeetCode每日一题(统计子串中的唯一字符)

2023-11-26每日一题 一、题目编号 828. 统计子串中的唯一字符二、题目链接 点击跳转到题目位置 三、题目描述 我们定义了一个函数 countUniqueChars(s) 来统计字符串 s 中的唯一字符&#xff0c;并返回唯一字符的个数。 例如&#xff1a;s “LEETCODE” &#xff0c;则其…

Python爬虫之代理IP与访问控制

目录 前言 一、代理IP 1.1.使用代理IP的步骤 1.2.寻找可用的代理IP 1.3.设置代理IP 1.4.验证代理IP的可用性 二、访问控制 2.1.遵守Robots协议 2.2.设置访问时间间隔 2.3.多线程爬取 总结 前言 在进行Python爬虫过程中&#xff0c;代理IP与访问控制是我们经常需要处…

同为科技(TOWE)模块化定制化让每条PDU实现专属供电解决方案

作为追求最高功率和空间效率的动态数据中心的理想产品&#xff0c;模块化、定制化PDU是追求最高功率和空间效率的动态数据中心的理想产品。同为科技&#xff08;TOWE&#xff09;是我国PDU行业的开创者和领导者&#xff0c;曾率先于中国电源分配单元http://www.pdu.com.cn网站上…

【Cisco Packet Tracer】构造超网

​​&#x1f308;个人主页&#xff1a;Sarapines Programmer&#x1f525; 系列专栏&#xff1a;《Cisco Packet Tracer | 奇遇记》⏰寄 语&#xff1a;风翻云浪激&#xff0c;剑舞星河寂。 临风豪情壮志在&#xff0c;拨云见日昂首立。 目录 ⛳️1. Cisco Packet Trace…

LVS-DR实验

实验前准备 DR服务器&#xff1a;192.168.188.11 192.168.188.15 NFS服务器&#xff1a;192.168.188.14 Web服务器1&#xff1a;192.168.188.12 Web服务器2&#xff1a;192.168.188.13 Vip&#xff1a;192.168.188.188 客户端&#xff1a;192.168.188.200 配置负载均衡调度…

多个音频文件怎么生成二维码?扫码听音乐的方法

多个音频文件能放入一个二维码吗&#xff1f;现在扫码听音乐或者音频文件是很常见的一种方式&#xff0c;那么当我们手里有一个或者多个音频文件需要做成二维码时&#xff0c;该如何来操作才能快速将音频转二维码图片呢&#xff1f;下面就来教大家使用音频二维码生成器工具制作…

Echarts+Vue+dataV 首页大屏静态示例Demo

效果图: <template><div class="content bg"><!-- 全屏容器 --><!-- 第一行 --><div class="module-box"><div style="flex: 0 1 30%"><dv-decoration-10 style="height: 5px" />&l…

5 时间序列预测入门:LSTM+Transformer

0 引言 论文地址&#xff1a;https://arxiv.org/abs/1706.03762 1 Transformer Transformer 模型是一种用于处理序列数据的深度学习模型&#xff0c;主要用于解决自然语言处理&#xff08;NLP&#xff09;任务。它在许多 NLP 任务中取得了重大突破&#xff0c;如机器翻译、文本…

【密码学】【多方安全计算】不经意传输(Oblivious Transfer,OT)

文章目录 不经意传输&#xff08;oblivious transfer&#xff09;定义不经意传输的实例&#xff08;1 out 2&#xff0c;二选一不经意传输&#xff09;基于RSA的1 out 2 不经意传输疑问 不经意传输&#xff08;oblivious transfer&#xff09;定义 不经意传输&#xff08;obli…