当前位置: 首页 > article >正文

列表导出功能

前端

  handleExport() {
      let downloadUrl = `/elecSaleNet/export?${this.website.tokenHeader}=${getToken()}`;
      const {} = this.query;
      let values = {
        "ids":this.ids
      };
      this.$confirm("是否导出数据?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        NProgress.start();
        exportBlob(downloadUrl, values).then(res => {
          downloadXls(res.data, `电费销售(上网)开票通知单${dateNow()}.xlsx`);
          NProgress.done();
        })
      });
    },

后端

/**
	 * 导出数据
	 *
	 * @param ids 电费销售上网主键集合
	 */
	@GetMapping("/export")
	public void export(@RequestParam String ids, HttpServletResponse response) {
		try {
			List<TpElecSaleNetExcel> list = this.elecSaleNetService.export(Func.toLongList(ids));
			IOUtils.exportExcel(response, "电费销售上网"
					+ DateUtils.getCurrentDateStrByFormat(DateFormat.Y_M_D_HMS),
				"电费销售上网表", TpElecSaleNetExcel.class, list);
		} catch (IOException e) {
			LOGGER.error("导出数据异常", e);
		}
	}


	/**
	 * 导出模板
	 * @param response
	 */
	@GetMapping("export-template")
	@ApiOperationSupport(order = 14)
	@ApiOperation(value = "导出模板")
	public void exportUser(HttpServletResponse response) {
		List<TpElecSaleNetExcel> list = new ArrayList<>();
		ExcelUtil.export(response, "电费销售上网模板", "电费销售上网表", list, TpElecSaleNetExcel.class);
	}


http://www.kler.cn/a/527854.html

相关文章:

  • 深度解析:网站快速收录与服务器性能的关系
  • 算法随笔_33: 132模式
  • 前端学习-事件委托(三十)
  • 实验八 JSP访问数据库
  • DeepSeek模型:开启人工智能的新篇章
  • VLLM性能调优
  • 深度解析:网站快速收录与服务器性能的关系
  • DeepSeek的介绍
  • 2025:影刀RPA使用新实践--CSDN博客下载
  • 【AIGC专栏】AI在自然语言中的应用场景
  • 用QT做一个网络调试助手
  • 芯片AI深度实战:让verilog不再是 AI 的小众语言
  • 开发过程中如何减少属性注释?
  • Cursor 背后的技术栈:从 VS Code 到 AI 集成
  • 数据结构 树1
  • LeetCode题练习与总结:不含连续1的非负整数--600
  • level-icmp(ping)详细过程_6
  • 输入一行字符,分别统计出其中英文字母,空格,数字和其他字符的个数。
  • 团体程序设计天梯赛-练习集——L1-028 判断素数
  • 课程设计|结构力学
  • 蓝桥杯真题k倍区间
  • C# Winform enter键怎么去关联button
  • 分层多维度应急管理系统的设计
  • 疯狂拆单词01
  • 文件上传功能(一)
  • 抽象类与抽象方法详解