mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-11-07 01:18:54 +08:00
- 移除调试用的console.log语句 - 调整表格列对齐方式,将操作列从居中改为右对齐 - 添加搜索表单功能,包括账单号、店铺名称、生成时间等筛选条件 - 重构axios拦截器逻辑,简化错误处理流程 - 实现统一的token刷新机制,使用单例模式避免重复请求 - 优化防抖函数实现,提高性能表现 - 添加401和403状态码的特殊处理逻辑 - 统一错误提示信息的显示方式 - 优化表格列宽度设置,调整金额相关列的显示效果 - 删除未使用的组件文件和样式代码 - 移除调试相关的代码和注释 - 优化图标组件的导入方式,使用markRaw包装 - 优化热词统计图表的数据显示逻辑,添加空数据提示
35 lines
1.3 KiB
JavaScript
35 lines
1.3 KiB
JavaScript
/**
|
||
* 打印指定 DOM 区域(替代 vue-print-nb)
|
||
*/
|
||
export function printElement(elementId, title = "打印") {
|
||
const el = document.getElementById(elementId);
|
||
if (!el) {
|
||
return;
|
||
}
|
||
const iframe = document.createElement("iframe");
|
||
iframe.style.cssText = "position:fixed;right:0;bottom:0;width:0;height:0;border:0";
|
||
document.body.appendChild(iframe);
|
||
const doc = iframe.contentWindow.document;
|
||
doc.open();
|
||
doc.write(
|
||
`<!DOCTYPE html><html><head><title>${title}</title><style>
|
||
body{font-family:Arial,sans-serif;padding:12px;color:#333}
|
||
table{width:100%;border-collapse:collapse}
|
||
td,th{border:1px solid #ddd;padding:6px}
|
||
.lineH30{line-height:30px}
|
||
.f14{font-size:14px;color:#333}
|
||
.printgoodtitle{font-size:14px;line-height:1.5;margin-top:15px;color:#333}
|
||
.printgoodinfo{padding:10px}
|
||
.printgooditem{display:flex;justify-content:space-between;padding:8px 0;border-bottom:1px solid #eee}
|
||
.printgoodname{flex:1}
|
||
.printgoodguid{margin-top:4px;color:#666;font-size:12px}
|
||
.printgoodguiditem{margin-right:8px}
|
||
.printgoodnumber{white-space:nowrap;margin-left:12px}
|
||
</style></head><body>${el.innerHTML}</body></html>`
|
||
);
|
||
doc.close();
|
||
iframe.contentWindow.focus();
|
||
iframe.contentWindow.print();
|
||
setTimeout(() => document.body.removeChild(iframe), 1000);
|
||
}
|