Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

最新版表格处《合计数据导出异常问题》 #1747

Open
4 tasks done
xxcniao opened this issue Apr 2, 2024 · 6 comments
Open
4 tasks done

最新版表格处《合计数据导出异常问题》 #1747

xxcniao opened this issue Apr 2, 2024 · 6 comments
Labels
enhancement 改进或增强

Comments

@xxcniao
Copy link

xxcniao commented Apr 2, 2024

议题条件

  • 我确认已查看官方使用文档:https://layui.dev ,但没有找到相关解决方案。
  • 我确认已在 Issues 中搜索过类似的问题,但没有找到相关解决方案。
  • 我已仔细阅读: 🍀 Layui Issue 贡献指南

议题类型

疑是 BUG

使用版本

v2.9.8

问题描述

表格数据导出,开启合计,合计数据展示没有问题一切正常,用默认的导出功能,合计处数据(始终都是默认的累计和)后台接口自定义数据无法完美导出【官方综合示例也是同类问题,自定义合计数据导出异常】。
image
image

业务代码

<table class="layui-table" lay-options="{height:'full',url:'/dcrb/apishylist',page:true,toolbar:'#toolbarDemo',totalRow:true,limit:30,limits:[15,30,60,90]}" id="table-demo">
  <thead>
    <tr>
      <th lay-options="{field:'id',sort:true,width:70,totalRow:'合计'}" rowspan="3">ID</th>
      <th lay-options="{field:'zgbh',totalRow:'-'}" rowspan="3">在岗编号</th>
      <th lay-options="{field:'tjr',totalRow:'-'}" rowspan="3">提交人</th>
      <th lay-options="{field:'banci',totalRow:'-'}" rowspan="3">班次</th>
      <th lay-options="{field:'banzu',totalRow:'-'}" rowspan="3">班组</th>
      <th lay-options="{field:'lrtime',totalRow:'-'}" rowspan="3">提交时间</th>
      <th lay-options="{align:'center'}" colspan="4">给水</th>
      <th lay-options="{align:'center'}" colspan="4">过热</th>
      <th lay-options="{align:'center'}" colspan="2">除盐水</th>
    </tr>
    <tr>
      <th lay-options="{align:'center'}" colspan="2">钠(ug/L)≤350</th>
      <th lay-options="{align:'center'}" colspan="2">硅(ug/L)≤50</th>
      <th lay-options="{align:'center'}" colspan="2">钠(ug/L)≤15</th>
      <th lay-options="{align:'center'}" colspan="2">硅(ug/L)≤20</th>
      <th lay-options="{align:'center'}" colspan="2">硅(ug/L)≤50</th>
    </tr>
    <tr>
      <th lay-options="{align:'center',field:'gsnamax',totalRow:'-'}">最高</th>
      <th lay-options="{align:'center',field:'gsnamin',totalRow:'{{= d.TOTAL_ROW.gsna}}'}">最低</th>
      <th lay-options="{align:'center',field:'gsguimax',totalRow:'-'}">最高</th>
      <th lay-options="{align:'center',field:'gsguimin',totalRow:'{{= d.TOTAL_ROW.gsgui}}'}">最低</th>
      <th lay-options="{align:'center',field:'grnamax',totalRow:'-'}">最高</th>
      <th lay-options="{align:'center',field:'grnamin',totalRow:'{{= d.TOTAL_ROW.grna}}'}">最低</th>
      <th lay-options="{align:'center',field:'grguimax',totalRow:'-'}">最高</th>
      <th lay-options="{align:'center',field:'grguimin',totalRow:'{{= d.TOTAL_ROW.grgui}}'}">最低</th>
      <th lay-options="{align:'center',field:'cyguimax',totalRow:'-'}">最高</th>
      <th lay-options="{align:'center',field:'cyguimin',totalRow:'{{= d.TOTAL_ROW.cygui}}'}">最低</th>
    </tr>
  </thead>
</table>
<script src="/static/third/layuivnew/layui.js"></script>

截图补充

image
image

浏览器

chrome

演示地址

No response

友好承诺

  • 我承诺将本着相互尊重、理解和友善的态度进行交流,共同维护 Layui 良好的社区氛围。
@xxcniao
Copy link
Author

xxcniao commented Apr 2, 2024

表格是多级表头展示,导出来的excel文件表头变一行了,多表头变单表头这也是一个问题

@sentsim
Copy link
Member

sentsim commented Apr 2, 2024

最近几个版本均未对 table 合计区域进行改动,先排查下历史版本是否存在同样的问题,或者是从哪个版本开始出现该导出异常。

@xxcniao
Copy link
Author

xxcniao commented Apr 2, 2024

最近几个版本均未对 table 合计区域进行改动,先排查下历史版本是否存在同样的问题,或者是从哪个版本开始出现该导出异常。

从最开始的2.8.0+到2.9.0+,均存在相同的问题
数据表格通过模板配置渲染
【单表头和多表头数据导出均存在如下问题】
ID处‘合计两个字’和‘时间处’都累加展示了,自定义的其他数据要么不展示要么就是不生效数据依然表现为累加(通过接口取的数据无法正常导出)
image
image

多表头导出时,表头展示异常,无法正常导出为多表头格式
合计项自定数据均不生效,还是走的默认累加
image
image

@bxjt123
Copy link
Collaborator

bxjt123 commented Apr 2, 2024

ID处‘合计两个字’和‘时间处’都累加展示了

或许这个问题可以参考综合演示,使用纯自定义文字时可以用totalRowText替代totalRow

@xxcniao
Copy link
Author

xxcniao commented Apr 2, 2024

ID处‘合计两个字’和‘时间处’都累加展示了

或许这个问题可以参考综合演示,使用纯自定义文字时可以用totalRowText替代totalRow
综合演示,本身导出也存在问题,(接口返回的自定义数据:人物 唐代2)这些导出后不显示,我这里的情况是【有的不显示,有的导出后还是按默认的累计数,接口返回的自定义数据不生效,多表头也无法正常导出会仅显示最下面的单表头】

@Sight-wcg
Copy link
Collaborator

我这里的情况是【有的不显示,有的导出后还是按默认的累计数

目前合计行导出逻辑和普通行确实存在一些差异,合计行使用原始值,普通行使用 exportTemplet > template > 原始值。
只要 totalRow 的值为 “真”,就会启用内置的前端合计,totalRow 的模板只能格式化单元格中显示的值。

这一点目前不能改,等待 #1476

接口返回的自定义数据不生效

无法重现

多表头也无法正常导出会仅显示最下面的单表头

表格内置导出是 csv 实现,csv 不支持单元格合并,暂无计划内置 xlsx 导出,等待 #1476

@Sight-wcg Sight-wcg added the enhancement 改进或增强 label Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 改进或增强
Projects
None yet
Development

No branches or pull requests

4 participants