|
@@ -411,10 +411,15 @@ const getFreightType = (row: any) => {
|
|
|
}
|
|
|
return result
|
|
|
}
|
|
|
+// 替换掉所有的特殊字符, 保留字母数中文和空格, 把不适合出现在url里面的字符替换成下划线
|
|
|
+let processName = (str: string) => {
|
|
|
+ if (typeof str !== 'string') return '_'
|
|
|
+ return str.replace(/[^\w\s\u4e00-\u9fa5]/g, '_').replace(/\s+/g, '_') // 替换多个空格为一个下划线
|
|
|
+}
|
|
|
const generatePDF = () => {
|
|
|
downloadPDF({
|
|
|
content: document.getElementById('pdfTarget')?.outerHTML,
|
|
|
- title: productInfo.product_name || '_',
|
|
|
+ title: processName(productInfo.product_name) || '_',
|
|
|
create_time: '_',
|
|
|
}).then((res: any) => {
|
|
|
console.log(res, 'res pdf')
|