随手记1.0

server/2024/10/18 23:29:33/

easyexcel多级表头导出各级设置样式(继承HorizontalCellStyleStrategy实现)

package com.example.wxmessage.entity;import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.write.handler.context.CellWriteHandlerContext;
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.IndexedColors;/*** @author chenyuhuan* @ClassName CellStyleStrategy.java* @Description TODO* @createTime 2023年12月01日*/
public class CellStyleStrategy extends HorizontalCellStyleStrategy {private final WriteCellStyle headWriteCellStyle;public CellStyleStrategy(WriteCellStyle headWriteCellStyle) {this.headWriteCellStyle = headWriteCellStyle;}@Overrideprotected void setHeadCellStyle(CellWriteHandlerContext context) {// 根据行索引为不同级别的表头应用不同样式if (context.getRowIndex() == 0) {headWriteCellStyle.setFillForegroundColor(IndexedColors.YELLOW.getIndex());headWriteCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND);} else if (context.getRowIndex() == 1) {headWriteCellStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex());headWriteCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND);}if (stopProcessing(context)) {return;}WriteCellData<?> cellData = context.getFirstCellData();WriteCellStyle.merge(this.headWriteCellStyle, cellData.getOrCreateStyle());}
}###########################调用###############################EasyExcel.write(response.getOutputStream(), ParamWorkdaysExportExcel.class).registerWriteHandler(new CellStyleStrategy(new WriteCellStyle())).sheet("模板").doWrite(data);

image.png1701659747655.png

image.png

修改默认滚动条样式::-webkit-scrollbar {color: transparent;height: 3px;width: 3px;}:hover::-webkit-scrollbar-thumb {background-color: rgba(0, 0, 0, 0.2);border-radius: 6px;-webkit-box-shadow: inset 0 0 10px transparent;}修改el-table/deep/ .el-table{border-radius: 8px 8px 8px 8px;overflow: hidden;border: 1px solid #e6e6e6;
}
/deep/ .el-table::before{height: 0;
}
/deep/ .el-table::after{height: 0;
}

js比对时间

daysBetweenDates(date1, date2) {// 将日期字符串转换为Date对象const d1 = new Date(date1)const d2 = new Date(date2)// 计算毫秒差const diffInMs = Math.abs(d2 - d1)// 转换为天数return Math.ceil(diffInMs / (1000 * 60 * 60 * 24))},

vue2 复制文本功能

# 复制async copyText(value) {try {// 检查浏览器是否支持 Clipboard APIif (navigator.clipboard && navigator.clipboard.writeText) {await navigator.clipboard.writeText(value)this.feedback = '复制成功'this.$message({message: '复制成功',type: 'success'})} else {this.feedback = '浏览器不支持 Clipboard API'this.$message({message: '复制失败',type: 'error'})}} catch (error) {console.error('复制失败', error)this.feedback = '复制失败'this.$message({message: '复制失败',type: 'error'})}},

使用第三方插件 vue2

npm install vue-clipboard2 --save在main文件引入import Clipboard from 'vue-clipboard2'Vue.use(Clipboard)使用封装方法
opyText(value) {if (!value) {return}const that = thisthis.$copyText(value).then(function(e) {console.log('copy arguments e:', e)that.$message({message: '复制成功',type: 'success'})},function(e) {console.log('copy arguments e:', e)that.$message({message: '复制失败',type: 'error'})})},使用方法<el-button type="primary" @click="copyText(text)">复制</el-button>

http://www.ppmy.cn/server/96569.html

相关文章

Docker-容器修改

拷贝容器 修改 拷贝回去 第二种 示例

LeetCode 139. 单词拆分

更多题解尽在 https://sugar.matrixlab.dev/algorithm 每日更新。 组队打卡&#xff0c;更多解法等你一起来参与哦&#xff01; LeetCode 139. 单词拆分&#xff0c;难度中等。 DP 解题思路&#xff1a; 使用 Set 来存储字典中的单词&#xff0c;这样可以在常数时间内检查一…

公司数据混乱怎么安全保存

当公司面临数据混乱的问题时&#xff0c;确保数据的安全保存变得尤为重要。 一、建立完善的数据管理制度 制定数据安全政策&#xff1a;企业应制定一套明确的数据安全政策&#xff0c;包括数据的分类、分级、存储、传输等方面的规定&#xff0c;以及数据的保管、使用和销毁等…

内网穿透--ICMP隧道转发实验

实验背景 通过公司带有防火墙功能的路由器接入互联网&#xff0c;然后由于私网IP的缘故&#xff0c;公网无法直接访问内部web服务器主机。通过内网其它主机做代理&#xff0c;穿透访问内网web服务器主机边界路由器或防火墙做静态NAT映射访问内网服务器inux主机&#xff0c;且策…

Qt:自定义钟表组件

使用QWidget绘制两种钟表组件&#xff0c;效果如下&#xff1a; 源码下载链接&#xff1a;GitHub - DengYong1988/Clock-Widget: Qt 自定义钟表组件 https://download.csdn.net/download/ouyangxiaozi/89616407 主要代码如下&#xff1a; ClockWgt.h #ifndef CLOCKWGT_H #d…

批量合并视频/图像,合并前重命名避免覆盖

血的教训&#xff1a;采用md5哈希算法时间戳重命名&#xff0c;避免覆盖 合并后就能安安心心排序了 import os import hashlib import shutil# 指定的源文件夹列表 source_dirs ["video/vox2/8-12/10s", "video/vox2/12-20/10s", "video/vox2/20-3…

探索 GPT-4o Mini:提升开发效率与创新能力的利器

探索 GPT-4o Mini&#xff1a;提升开发效率与创新能力的利器 随着人工智能技术的迅猛发展&#xff0c;OpenAI 最新发布的 GPT-4o Mini 模型以其卓越的性能和极具竞争力的价格引发了广泛关注。作为开发者&#xff0c;如何有效利用这一“迄今为止最具成本效益的小模型”来提升开…

WPF学习(2)-UniformGrid控件(均分布局)+StackPanel控件(栈式布局)

UniformGrid控件&#xff08;均分布局&#xff09; UniformGrid和Grid有些相似&#xff0c;只不过UniformGrid的每个单元格面积都是相等的&#xff0c;不管是横向的单元格&#xff0c;或是纵向的单元格&#xff0c;它们会平分整个UniformGrid。 UniformGrid控件提供了3个属性…