EasyExcel设置表头上面的那种大标题(前端传递来的大标题)

1、首先得先引用easyExcel的版本依赖,我那

<dependency>
   <groupId>com.alibaba</groupId>
   <artifactId>easyexcel</artifactId>
   <version>2.2.6</version>
</dependency>

2、然后得弄直接的实体类,(这个实体类是关键,主要的功能就是为了导出的表头还有大标题做准备)

解释:   @ExcelProperty(value ={"${bigHead}","区划名称"},index = 0) 

这个主要 ${bigHead} 这个是 大标题 ,这个标题是动态生成的,

package com.inspur.grp.hrss.labour.project.labourReport;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.inspur.grp.hrss.labour.framework.base.BaseDomain;
import lombok.EqualsAndHashCode;

/**
 * 每日更新统计记录(这个是是抽取出来的)对象 labour_day_updatetime
 *
 */
@EqualsAndHashCode
public class LabourDayUpdatetime extends BaseDomain {
    /** 主键 */
    @ExcelIgnore
    private String id;
    @ExcelProperty(value ={"${bigHead}","区划名称"},index = 0)
    private String mc;

    /** 区的编码 */
    @ExcelIgnore
    private String area;

    /** 镇的编码 */
    @ExcelIgnore
    private String town;

    /** 村的编码 */
    @ExcelIgnore
    private String community;

    /** 就业去向 */
    @ExcelIgnore
    private String employDestination;

    /** 人员类别 */
    @ExcelIgnore
    private String category;

    /** 是否就业 */
    @ExcelIgnore
    private String isEmployed;

    /** 农村劳动力人数 */
    @ExcelProperty(value ={"${bigHead}","农村劳动力人数"},index = 1)
    private String ncldlrs;

    /** 更新人数 */
    @ExcelProperty(value ={"${bigHead}","农村劳动力更新人数"},index = 2)
    private String gxrsa;

    @ExcelProperty(value ={"${bigHead}","更新率"},index = 3)
    private String gxla;

    /** 就业人数 */
    @ExcelProperty(value ={"${bigHead}","就业人数"},index = 4)
    private String jyrsa;

    @ExcelProperty(value ={"${bigHead}","国外务工(劳动力)"},index = 5)
    private String guowaiwug;

    @ExcelProperty(value ={"${bigHead}","省外务工(劳动力)"},index = 6)
    private String shengwai;

    @ExcelProperty(value ={"${bigHead}","省外市内务工(劳动力)"},index = 7)
    private String shiwaishengnei;

    @ExcelProperty(value ={"${bigHead}","县外市内务工(劳动力)"},index = 8)
    private String xianwaishinwug;

    @ExcelProperty(value ={"${bigHead}","乡(镇)外县内务工(劳动力)"},index = 9)
    private String xiangzhenwaixianneiwug;
    @ExcelProperty(value ={"${bigHead}","乡(镇)内务工(劳动力)"},index = 10)
    private String xiangzhennwug;
    @ExcelProperty(value ={"${bigHead}","就业率(劳动力)"},index = 11)
    private String jyla;

    /** 脱贫劳动力人数 */
    @ExcelProperty(value ={"${bigHead}","脱贫劳动力人数"},index = 12)
    private String tpldlrs;

    @ExcelProperty(value ={"${bigHead}","更新人数(脱贫)"},index = 13)
    private String gxrsb;

    @ExcelProperty(value ={"${bigHead}","更新率(脱贫)"},index = 14)
    private String gxlb;

    @ExcelProperty(value ={"${bigHead}","就业人数(脱贫)"},index = 15)
    private String jyrsb;

    @ExcelProperty(value ={"${bigHead}","国外务工(脱贫)"},index = 16)
    private String tpguowaiwug;
    @ExcelProperty(value ={"${bigHead}","省外务工(脱贫)"},index = 17)
    private String tpshengwai;

    @ExcelProperty(value ={"${bigHead}","市外省内务工(脱贫)"},index = 18)
    private String tpshiwaishengnei;

    @ExcelProperty(value ={"${bigHead}","县外市内务工(脱贫)"},index = 19)
    private String tpxianwaishinwug;
    @ExcelProperty(value ={"${bigHead}","乡(镇)外县内务工(脱贫)"},index = 20)
    private String tpxiangzhenwaixianneiwug;
    @ExcelProperty(value ={"${bigHead}","乡(镇)内务工(脱贫)"},index = 21)
    private String tpxiangzhennwug;

    @ExcelProperty(value ={"${bigHead}","就业率(脱贫)"},index = 22)
    private String jylb;

    @ExcelProperty(value ={"${bigHead}","易迁劳动力人数"},index = 23)
    private String yqldlrs;

    @ExcelProperty(value ={"${bigHead}","更新人数(易迁)"},index = 24)
    private String gxrsc;

    @ExcelProperty(value ={"${bigHead}","更新率(易迁)"},index = 25)
    private String gxlc;
    @ExcelProperty(value ={"${bigHead}","就业人数(易迁)"},index = 26)
    private String jyrsc;

    @ExcelProperty(value ={"${bigHead}","国外务工(易迁)"},index = 27)
    private String yqguowaiwug;
    @ExcelProperty(value ={"${bigHead}","省外务工(易迁)"},index = 28)
    private String yqshengwai;

    @ExcelProperty(value ={"${bigHead}","市外省内(易迁)"},index = 29)
    private String yqshiwaishengnei;

    @ExcelProperty(value ={"${bigHead}","县外市内务工(易迁)"},index = 30)
    private String yqxianwaishinwug;
    @ExcelProperty(value ={"${bigHead}","乡(镇)外县内务工(易迁)"},index = 31)
    private String yqxiangzhenwaixianneiwug;
    @ExcelProperty(value ={"${bigHead}","乡(镇)内务工(易迁)"},index = 32)
    private String yqxiangzhennwug;



    @ExcelProperty(value ={"${bigHead}","就业率(易迁)"},index = 33)
    private String jylc;

    @ExcelProperty(value ={"${bigHead}","未更新的人数"},index = 34)
    private String xtzwgxdldlrs;

    public String getMc() {
        return mc;
    }

    public void setMc(String mc) {
        this.mc = mc;
    }

    public String getGxla() {
        return gxla;
    }

    public void setGxla(String gxla) {
        this.gxla = gxla;
    }

    public String getJyla() {
        return jyla;
    }

    public void setJyla(String jyla) {
        this.jyla = jyla;
    }

    public String getGxlb() {
        return gxlb;
    }

    public void setGxlb(String gxlb) {
        this.gxlb = gxlb;
    }

    public String getJylb() {
        return jylb;
    }

    public void setJylb(String jylb) {
        this.jylb = jylb;
    }

    public String getGxlc() {
        return gxlc;
    }

    public void setGxlc(String gxlc) {
        this.gxlc = gxlc;
    }

    public String getJylc() {
        return jylc;
    }

    public void setJylc(String jylc) {
        this.jylc = jylc;
    }

    public String getXtzwgxdldlrs() {
        return xtzwgxdldlrs;
    }

    public void setXtzwgxdldlrs(String xtzwgxdldlrs) {
        this.xtzwgxdldlrs = xtzwgxdldlrs;
    }

    public void setId(String id)
    {
        this.id = id;
    }

    public String getId() 
    {
        return id;
    }



    public void setArea(String area)
    {
        this.area = area;
    }

    public String getArea() 
    {
        return area;
    }

    public void setTown(String town) 
    {
        this.town = town;
    }

    public String getTown() 
    {
        return town;
    }
    public void setCommunity(String community) 
    {
        this.community = community;
    }

    public String getCommunity() 
    {
        return community;
    }
    public void setEmployDestination(String employDestination) 
    {
        this.employDestination = employDestination;
    }

    public String getEmployDestination() 
    {
        return employDestination;
    }
    public void setCategory(String category) 
    {
        this.category = category;
    }

    public String getCategory() 
    {
        return category;
    }
    public void setIsEmployed(String isEmployed) 
    {
        this.isEmployed = isEmployed;
    }

    public String getIsEmployed() 
    {
        return isEmployed;
    }
    public void setNcldlrs(String ncldlrs) 
    {
        this.ncldlrs = ncldlrs;
    }

    public String getNcldlrs() 
    {
        return ncldlrs;
    }
    public void setGxrsa(String gxrsa) 
    {
        this.gxrsa = gxrsa;
    }

    public String getGxrsa() 
    {
        return gxrsa;
    }
    public void setJyrsa(String jyrsa) 
    {
        this.jyrsa = jyrsa;
    }

    public String getJyrsa() 
    {
        return jyrsa;
    }
    public void setTpldlrs(String tpldlrs) 
    {
        this.tpldlrs = tpldlrs;
    }

    public String getTpldlrs() 
    {
        return tpldlrs;
    }
    public void setGxrsb(String gxrsb) 
    {
        this.gxrsb = gxrsb;
    }

    public String getGxrsb() 
    {
        return gxrsb;
    }
    public void setJyrsb(String jyrsb) 
    {
        this.jyrsb = jyrsb;
    }

    public String getJyrsb() 
    {
        return jyrsb;
    }
    public void setYqldlrs(String yqldlrs) 
    {
        this.yqldlrs = yqldlrs;
    }

    public String getYqldlrs() 
    {
        return yqldlrs;
    }
    public void setGxrsc(String gxrsc) 
    {
        this.gxrsc = gxrsc;
    }

    public String getGxrsc() 
    {
        return gxrsc;
    }
    public void setJyrsc(String jyrsc) 
    {
        this.jyrsc = jyrsc;
    }

    public String getJyrsc() 
    {
        return jyrsc;
    }
    public void setShengwai(String shengwai) 
    {
        this.shengwai = shengwai;
    }

    public String getShengwai() 
    {
        return shengwai;
    }
    public void setShiwaishengnei(String shiwaishengnei) 
    {
        this.shiwaishengnei = shiwaishengnei;
    }

    public String getShiwaishengnei() 
    {
        return shiwaishengnei;
    }
    public void setTpshengwai(String tpshengwai) 
    {
        this.tpshengwai = tpshengwai;
    }

    public String getTpshengwai() 
    {
        return tpshengwai;
    }
    public void setTpshiwaishengnei(String tpshiwaishengnei) 
    {
        this.tpshiwaishengnei = tpshiwaishengnei;
    }

    public String getTpshiwaishengnei() 
    {
        return tpshiwaishengnei;
    }
    public void setYqshengwai(String yqshengwai) 
    {
        this.yqshengwai = yqshengwai;
    }

    public String getYqshengwai() 
    {
        return yqshengwai;
    }
    public void setYqshiwaishengnei(String yqshiwaishengnei) 
    {
        this.yqshiwaishengnei = yqshiwaishengnei;
    }

    public String getYqshiwaishengnei() 
    {
        return yqshiwaishengnei;
    }
    public void setGuowaiwug(String guowaiwug) 
    {
        this.guowaiwug = guowaiwug;
    }

    public String getGuowaiwug() 
    {
        return guowaiwug;
    }
    public void setXianwaishinwug(String xianwaishinwug) 
    {
        this.xianwaishinwug = xianwaishinwug;
    }

    public String getXianwaishinwug() 
    {
        return xianwaishinwug;
    }
    public void setXiangzhennwug(String xiangzhennwug) 
    {
        this.xiangzhennwug = xiangzhennwug;
    }

    public String getXiangzhennwug() 
    {
        return xiangzhennwug;
    }
    public void setXiangzhenwaixianneiwug(String xiangzhenwaixianneiwug) 
    {
        this.xiangzhenwaixianneiwug = xiangzhenwaixianneiwug;
    }

    public String getXiangzhenwaixianneiwug() 
    {
        return xiangzhenwaixianneiwug;
    }
    public void setTpguowaiwug(String tpguowaiwug) 
    {
        this.tpguowaiwug = tpguowaiwug;
    }

    public String getTpguowaiwug() 
    {
        return tpguowaiwug;
    }
    public void setTpxianwaishinwug(String tpxianwaishinwug) 
    {
        this.tpxianwaishinwug = tpxianwaishinwug;
    }

    public String getTpxianwaishinwug() 
    {
        return tpxianwaishinwug;
    }
    public void setTpxiangzhennwug(String tpxiangzhennwug) 
    {
        this.tpxiangzhennwug = tpxiangzhennwug;
    }

    public String getTpxiangzhennwug() 
    {
        return tpxiangzhennwug;
    }
    public void setTpxiangzhenwaixianneiwug(String tpxiangzhenwaixianneiwug) 
    {
        this.tpxiangzhenwaixianneiwug = tpxiangzhenwaixianneiwug;
    }

    public String getTpxiangzhenwaixianneiwug() 
    {
        return tpxiangzhenwaixianneiwug;
    }
    public void setYqguowaiwug(String yqguowaiwug) 
    {
        this.yqguowaiwug = yqguowaiwug;
    }

    public String getYqguowaiwug() 
    {
        return yqguowaiwug;
    }
    public void setYqxianwaishinwug(String yqxianwaishinwug) 
    {
        this.yqxianwaishinwug = yqxianwaishinwug;
    }

    public String getYqxianwaishinwug() 
    {
        return yqxianwaishinwug;
    }
    public void setYqxiangzhennwug(String yqxiangzhennwug) 
    {
        this.yqxiangzhennwug = yqxiangzhennwug;
    }

    public String getYqxiangzhennwug() 
    {
        return yqxiangzhennwug;
    }
    public void setYqxiangzhenwaixianneiwug(String yqxiangzhenwaixianneiwug) 
    {
        this.yqxiangzhenwaixianneiwug = yqxiangzhenwaixianneiwug;
    }

    public String getYqxiangzhenwaixianneiwug() 
    {
        return yqxiangzhenwaixianneiwug;
    }

}

3、然后定义一个接口接收的DTO类

package com.inspur.grp.hrss.labour.project.labourReport.dto;

import com.inspur.grp.hrss.labour.project.labourReport.LabourDayUpdatetime;

import java.util.List;

public class ExportDataRequestDto {
    private List<LabourDayUpdatetime> labourDayUpdatetimeList;
    private String addressName; // 这个是前端传递的过了的标题名称

    // Getters and Setters
    public List<LabourDayUpdatetime> getLabourDayUpdatetimeList() {
        return labourDayUpdatetimeList;
    }

    public void setLabourDayUpdatetimeList(List<LabourDayUpdatetime> labourDayUpdatetimeList) {
        this.labourDayUpdatetimeList = labourDayUpdatetimeList;
    }

    public String getAddressName() {
        return addressName;
    }

    public void setAddressName(String addressName) {
        this.addressName = addressName;
    }
}

4、封装标题工具类

package com.inspur.grp.hrss.labour.util.IDCardUtils;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.Head;
import com.alibaba.excel.write.handler.CellWriteHandler;
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
import com.alibaba.excel.write.metadata.holder.WriteTableHolder;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.springframework.util.PropertyPlaceholderHelper;

import java.util.List;
import java.util.Properties;

public class ExcelTitleHandler implements CellWriteHandler {
    /**
     错误信息处理时正则表达式的格式
     */
    private final String EXCEL_ERROR_REG = "^(.*)(\\(错误:)(.*)(\\))$";

    private String bigHead;


    PropertyPlaceholderHelper placeholderHelper = new PropertyPlaceholderHelper("${", "}");

    public ExcelTitleHandler( String bigHead) {
        this.bigHead = bigHead; //表头1
    }

    @Override
    public void beforeCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row, Head head, Integer columnIndex, Integer relativeRowIndex, Boolean isHead) {
        // 动态设置表头字段
        if (!ObjectUtil.isEmpty(head)) {
            List<String> headNameList = head.getHeadNameList();
            if (CollectionUtil.isNotEmpty(headNameList)) {
                Properties properties = new Properties();
                properties.setProperty("bigHead", bigHead);
                for (int i = 0 ; i < headNameList.size() ; i++){
                    // 循环遍历替换
                    headNameList.set(i, placeholderHelper.replacePlaceholders(headNameList.get(i), properties));
                }
            }
        }
    }
    @Override
    public void afterCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) {
    }

    @Override
    public void afterCellDataConverted(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, CellData cellData, Cell cell, Head head, Integer integer, Boolean aBoolean) {

    }

    @Override
    public void afterCellDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, List<CellData> list, Cell cell, Head head, Integer integer, Boolean aBoolean) {

    }
}

5、开始接口请求

   //每日更新统计导出
    @PostMapping("/exportDataUpdate")
    public void exportDataUpdate(@RequestBody ExportDataRequestDto exportDataRequestDto, HttpServletResponse response) {
        labourDayUpdatetimeService.exportDataUpdate(exportDataRequestDto, response);
    }

6、service层

void exportDataUpdate(ExportDataRequestDto exportDataRequestDto, HttpServletResponse response);

7、serviceImpl实现类

 private void setIntValueFromDoubleString(LabourDayUpdatetime recode, String value, Consumer<String> setter) {
        if (value != null && !value.isEmpty()) {
            try {
                int intValue = (int) Double.parseDouble(value);
                setter.accept(String.valueOf(intValue));
            } catch (NumberFormatException e) {
                setter.accept("0");
            }
        } else {
            setter.accept("0");
        }
    }
    private void setFormattedPercentage(LabourDayUpdatetime recode, String value, Consumer<String> setter) {
        if (value != null && !value.isEmpty()) {
            try {
                double doubleValue = Double.parseDouble(value);
                String formattedValue = String.format("%.2f%%", doubleValue * 100);
                setter.accept(formattedValue);
            } catch (NumberFormatException e) {
                setter.accept("0.00%");
            }
        } else {
            setter.accept("0.00%");
        }
    }


    @Override
    public void exportDataUpdate(ExportDataRequestDto exportDataRequestDto, HttpServletResponse response) {
        String bigHead=exportDataRequestDto.getAddressName()+"劳动力更新报表";
        List<LabourDayUpdatetime> labourDayUpdatetimeList = exportDataRequestDto.getLabourDayUpdatetimeList();
        labourDayUpdatetimeList.stream().forEach(recode->{

            setIntValueFromDoubleString(recode, recode.getNcldlrs(), recode::setNcldlrs);
            setIntValueFromDoubleString(recode, recode.getGxrsa(), recode::setGxrsa);
            setFormattedPercentage(recode, recode.getGxla(), recode::setGxla);
            setIntValueFromDoubleString(recode, recode.getJyrsa(), recode::setJyrsa);
            setIntValueFromDoubleString(recode, recode.getGuowaiwug(), recode::setGuowaiwug);
            setIntValueFromDoubleString(recode, recode.getShengwai(), recode::setShengwai);
            setIntValueFromDoubleString(recode, recode.getShiwaishengnei(), recode::setShiwaishengnei);
            setIntValueFromDoubleString(recode, recode.getXianwaishinwug(), recode::setXianwaishinwug);
            setIntValueFromDoubleString(recode, recode.getXiangzhennwug(), recode::setXiangzhenwaixianneiwug);
            setIntValueFromDoubleString(recode, recode.getXiangzhennwug(), recode::setXiangzhennwug);
            setFormattedPercentage(recode, recode.getJyla(), recode::setJyla);

            setIntValueFromDoubleString(recode, recode.getTpldlrs(), recode::setTpldlrs);
            setIntValueFromDoubleString(recode, recode.getGxrsb(), recode::setGxrsb);
            setFormattedPercentage(recode, recode.getGxlb(), recode::setGxlb);
            setIntValueFromDoubleString(recode, recode.getJyrsb(), recode::setJyrsb);
            setIntValueFromDoubleString(recode, recode.getTpguowaiwug(), recode::setTpguowaiwug);
            setIntValueFromDoubleString(recode, recode.getTpshengwai(), recode::setTpshengwai);
            setIntValueFromDoubleString(recode, recode.getTpshiwaishengnei(), recode::setTpshiwaishengnei);
            setIntValueFromDoubleString(recode, recode.getTpxianwaishinwug(), recode::setTpxianwaishinwug);
            setIntValueFromDoubleString(recode, recode.getTpxiangzhenwaixianneiwug(), recode::setTpxiangzhenwaixianneiwug);
            setIntValueFromDoubleString(recode, recode.getTpxiangzhennwug(), recode::setTpxiangzhennwug);
            setFormattedPercentage(recode, recode.getJylb(), recode::setJylb);

            setIntValueFromDoubleString(recode, recode.getYqldlrs(), recode::setYqldlrs);
            setIntValueFromDoubleString(recode, recode.getGxrsc(), recode::setGxrsc);
            setFormattedPercentage(recode, recode.getGxlc(), recode::setGxlc);
            setIntValueFromDoubleString(recode, recode.getJyrsc(), recode::setJyrsc);
            setIntValueFromDoubleString(recode, recode.getYqguowaiwug(), recode::setYqguowaiwug);
            setIntValueFromDoubleString(recode, recode.getYqshengwai(), recode::setYqshengwai);
            setIntValueFromDoubleString(recode, recode.getYqshiwaishengnei(), recode::setYqshiwaishengnei);
            setIntValueFromDoubleString(recode, recode.getYqxianwaishinwug(), recode::setYqxianwaishinwug);
            setIntValueFromDoubleString(recode, recode.getYqxiangzhenwaixianneiwug(), recode::setYqxiangzhenwaixianneiwug);
            setIntValueFromDoubleString(recode, recode.getYqxiangzhennwug(), recode::setYqxiangzhennwug);
            setFormattedPercentage(recode, recode.getJylc(), recode::setJylc);

            setIntValueFromDoubleString(recode, recode.getXtzwgxdldlrs(), recode::setXtzwgxdldlrs);

        });

        try {
            response.setContentType("application/vnd.ms-excel");
            response.setCharacterEncoding("utf-8");
            response.setHeader("Content-disposition", "attachment;filename=" + "数据" + ".xlsx");
            WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
            contentWriteCellStyle.setBorderLeft(BorderStyle.THIN);
            contentWriteCellStyle.setBorderTop(BorderStyle.THIN);
            contentWriteCellStyle.setBorderRight(BorderStyle.THIN);
            contentWriteCellStyle.setBorderBottom(BorderStyle.THIN);
            contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
            WriteCellStyle headWriteCellStyle = new WriteCellStyle();
            headWriteCellStyle.setBorderLeft(BorderStyle.THIN);
            headWriteCellStyle.setBorderTop(BorderStyle.THIN);
            headWriteCellStyle.setBorderRight(BorderStyle.THIN);
            headWriteCellStyle.setBorderBottom(BorderStyle.THIN);
            //设置头部标题居中
            headWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
            // 这个策略是 头是头的样式 内容是内容的样式 其他的策略可以自己实现
            HorizontalCellStyleStrategy horizontalCellStyleStrategy =
                    new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle);

            EasyExcel.write(response.getOutputStream(), LabourDayUpdatetime.class)
                    .sheet("数据")
                    .registerWriteHandler(new ExcelTitleHandler(bigHead))
                    .registerWriteHandler(new SimpleColumnWidthStyleStrategy(20)).registerWriteHandler(horizontalCellStyleStrategy)
                    .doWrite(labourDayUpdatetimeList);
        }catch (Exception e){
            throw new RuntimeException(e);
        }
    }

7、前端vue的接口

具体代码就不列出了,这个   daochu 就是一个按钮button

daochu(){
            if(this.tableData.length==0){
                this.$message({ message: '请确保有数据进行导出', type: 'warning' });return;
            }else{
                const loading = this.$loading({lock: true,text: '导出中',spinner: 'el-icon-loading',background: ' rgba(255, 255, 255, 0.6)'});
                var data = {
                    labourDayUpdatetimeList: this.tableData, // 这个tableData 这个是你要导出的数据
                    addressName: this.addressName // 这个是你要给你的excel设置的大标题
                }
                //发送接口请求
                labourReportApi.exportDataUpdate(data).then(res => { 

                    const url = window.URL.createObjectURL(new Blob([res]));
                    const link = document.createElement('a');
                    link.href = url;
                    link.setAttribute('download', '每日更新情况调度统计.xlsx');
                    document.body.appendChild(link);
                    link.click();
                    document.body.removeChild(link);
                    window.URL.revokeObjectURL(url);
                    this.$message({message: '导出数据成功', type: 'success' });
                    setTimeout(() => {loading.close();}, 1000);
                })
            }
        },

8、具体vue请求

这个是一个js,你可以赋值到你自己的接口js里面去

import request from "@/util/request";
var prefixD = customConfig.VUE_APP_CLIENT_ID + "/labourReport/updatetimeDayTj";
export default {

  //每日更新导出
  exportDataUpdate: async function (params) {
    return request
    ({
      url: prefixD + "/exportDataUpdate",
      method: "post",
      data: params,
      responseType: "arraybuffer",
      headers: {
        'Content-Type': 'application/json'
      }
    })
  },


}

9、导出已经完成了,展示效果

因为数据量很多,就展示部分

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

数据仓库-集群管理

主要介绍操作类问题中的集群管理问题。 无法成功创建数据仓库集群时怎么处理&#xff1f; 请检查用户账户余额是否少于100元&#xff0c;是否已经没有配额创建新的数据仓库集群&#xff0c;以及是否存在网络问题。 如账户余额、配额、网络均未发现问题&#xff0c;请联系客户…

双目摄像头标定方法

打开matlab 找到这个标定 将双目左右目拍的图像上传&#xff08;左右目最好不少于20张&#xff09; 等待即可 此时已经完成标定&#xff0c;左下角为反投影误差&#xff0c;右边为外参可视化 把这些误差大的删除即可。 点击导出 此时回到主页面&#xff0c;即可看到成功导出 Ca…

python学opencv|读取图像(七)抓取像素数据顺利修改图像大小

【1】引言 前序我们已经学习图像的基本读取操作&#xff0c;文章链接为&#xff1a; python学opencv|读取图像-CSDN博客 也掌握了彩色图像的保存&#xff1a; python学opencv|读取图像&#xff08;二&#xff09;保存彩色图像_python opencv 读取图像转为彩色-CSDN博客 以…

【论文阅读笔记】One Diffusion to Generate Them All

One Diffusion to Generate Them All 介绍理解 引言二、相关工作三、方法预备知识训练推理实现细节训练细节 数据集构建实验分结论附录 介绍 Paper&#xff1a;https://arxiv.org/abs/2411.16318 Code&#xff1a;https://github.com/lehduong/onediffusion Authors&#xff1…

【橘子容器】如何构建一个docker镜像

你肯定打过docker镜像是吧&#xff0c;作为一个开发这很正常&#xff0c;那么你用的什么打包方式呢&#xff0c;这里我们来梳理几种常用的docker镜像构建方式。 ps&#xff1a;这里不是太讲原理&#xff0c;更多的是一种科普和操作。因为讲原理的东西网上已经够多了。 一、Dock…

神经网络基础-激活函数

文章目录 1. 什么是激活函数2. sigmoid 激活函数3. tanh 激活函数4. ReLU 激活函数5. SoftMax 激活函数6. 其他常见的激活函数7. 激活函数的选择方法 1. 什么是激活函数 激活函数用于对每层的输出数据进行变换, 进而为整个网络注入了非线性因素。此时, 神经网络就可以拟合各种…

开源低代码平台-Microi吾码-平台简介

Microi吾码-平台介绍 开源低代码平台-Microi吾码-平台简介预览图平台亮点版本区别成功案例源码目录说明Microi吾码 - 系列文档 开源低代码平台-Microi吾码-平台简介 技术框架&#xff1a;.NET8 Redis MySql/SqlServer/Oracle Vue2/3 Element-UI/Element-Plus平台始于2014年…

Rust之抽空学习系列(三)—— 编程通用概念(中)

Rust之抽空学习系列&#xff08;三&#xff09;—— 编程通用概念&#xff08;中&#xff09; 1、变量&可变性 在Rust中&#xff0c;变量默认是不可变的 fn main() {let x 5;println!("x is {}", x); }使用let来声明一个变量&#xff0c;此时变量默认是不可变…

【经典】制造供应链四类策略(MTS、MTO、ATO、ETO)细说

关注作者 制造供应链的牛鞭问题与复杂问题主要是从两个方面解决&#xff0c;一是同步化供应链消减从需求到供应的放大效应&#xff0c;二是供应链细分&#xff0c;针对不同的客户、不同的需求供应的匹配策略来应对复杂性&#xff0c;更好的满足客户并以最低的总成本来实现。 对…

多模态大模型(二)——用Transformer Encoder和Decoder的方法(BLIP、CoCa、BEiTv3)

文章目录 BLIP: Bootstrapping Language-Image Pre-training for Unified Vision-Language Understanding and Generation 理解、生成我都要&#xff0c;一个很有效的、根据图片生成caption的工具1. BLIP的研究动机2. BLIP的模型结构3. CapFilt Model4. BLIP的训练过程 CoCa: C…

可视化报表如何制作?一文详解如何用报表工具开发可视化报表

在如今这个数据驱动的商业时代&#xff0c;众多企业正如火如荼地推进数字化转型&#xff0c;力求在激烈的市场竞争中占据先机。然而&#xff0c;随着业务规模的扩大和运营复杂度的提升&#xff0c;企业的数据量爆炸式增长&#xff0c;传统报表格式单一、信息呈现密集且不易解读…

基于XML配置Bean和基于XML自动装配

目录 基于XML配置Bean id分配规则 通过id获取bean 通过类型获取bean 通过C命名空间配置bean 使用C命名空间 通过P命名空间配置bean 通过util:list进行配置bean 指定id&#xff0c;直接ref引用过来 通过外部属性文件配置Bean Bean信息重用&#xff08;继承&#xff09;…

(九)机器学习 - 多项式回归

多项式回归&#xff08;Polynomial Regression&#xff09;是一种回归分析方法&#xff0c;它将自变量 xx 和因变量 yy 之间的关系建模为 nn 次多项式。多项式回归的目的是找到一个 nn 次多项式函数&#xff0c;使得这个函数能够最好地拟合给定的数据点。 多项式回归的数学表达…

Leetcode 每日一题9.回文数

&#x1f308;&#x1f308;&#x1f308;今天给大家分享的是:回文数的解法 目录 ​编辑 问题描述 输入输出格式 示例 约束条件 进阶挑战 解决方案 问题分析 过题图片 字符串转换法 数学方法 算法解释 题目链接 结论 问题描述 给定一个整数 x&#xff0c;我们需要…

美团2024年秋招第一场笔试【前端移动端】

美团2024年秋招第一场笔试【前端&移动端】 2024/12/12 1.在一个长度为28的数组中删除第5个元素时&#xff08;元素序号&#xff1a;1~28&#xff09;&#xff0c;需要向前移动&#xff08;23&#xff09;个元素。 2.如下图一个树型结构&#xff0c;其结点E在树的中序遍历…

光谱相机

光谱相机是一种能够同时获取目标物体的空间图像信息和光谱信息的成像设备。 1、工作原理 光谱相机通过光学系统将目标物体的光聚焦到探测器上&#xff0c;在探测器前设置分光元件&#xff0c;如光栅、棱镜或滤光片等&#xff0c;将光按不同波长分解成多个光谱通道&#xff0c…

Oracle plsqldev1106 安装及TNS配置

Oracle plsqldev1106 安装及TNS配置 下载好安装包&#xff0c;直接双击安装 点击 I Agree 默认是C盘的&#xff0c;我改了D盘&#xff0c;根据自己实际情况修改 这里用默认的for current user 也可以&#xff0c;我选了for all user 点Finish&#xff0c;等待安装完成即可 …

2024153读书笔记|《春烂漫:新平摄影作品选》——跳绳酷似人生路,起落平常,进退平常,莫惧征途万里长

2024153读书笔记|《春烂漫&#xff1a;新平摄影作品选》——跳绳酷似人生路&#xff0c;起落平常&#xff0c;进退平常&#xff0c;莫惧征途万里长 《春烂漫&#xff1a;新平摄影作品选》作者新平&#xff0c;2019.12.25年读完的小书&#xff0c;当时就觉得挺不错&#xff0c;今…

掌握 MySQL 事务:ACID、隔离级别详解

一、前言 事务是关系型数据库中的重要概念&#xff0c;用于保证一组数据库操作作为一个单独的工作单元来执行。无论是银行转账、订单处理还是复杂的数据修改&#xff0c;事务都能保证操作的一致性和完整性。 本文将带您从基础概念到高级技巧&#xff0c;全面了解 MySQL 事务的…

Nacos 3.0 Alpha 发布,在安全、泛用、云原生更进一步

自 2021 年发布以来&#xff0c;Nacos 2.0 在社区的支持下已走过近三年&#xff0c;期间取得了诸多成就。在高性能与易扩展性方面&#xff0c;Nacos 2.0 取得了显著进展&#xff0c;同时在易用性和安全性上也不断提升。想了解更多详细信息&#xff0c;欢迎阅读我们之前发布的回…