修复 R7E 真机反馈回流与移动入口 WF8-11A R7E-16A R7E-16B BIZ8-12A
这个提交包含在:
@@ -0,0 +1,22 @@
|
||||
export const PDF_FILE_ACCEPT = ".pdf,application/pdf";
|
||||
|
||||
export function isPdfFile(file: File) {
|
||||
return file.type === "application/pdf" || file.name.toLowerCase().endsWith(".pdf");
|
||||
}
|
||||
|
||||
export function splitPdfFiles(files: File[] | FileList | null | undefined) {
|
||||
const source = Array.from(files ?? []);
|
||||
return {
|
||||
accepted: source.filter(isPdfFile),
|
||||
rejected: source.filter((file) => !isPdfFile(file)),
|
||||
};
|
||||
}
|
||||
|
||||
export function rejectedPdfMessage(rejected: File[]) {
|
||||
if (!rejected.length) {
|
||||
return "";
|
||||
}
|
||||
const names = rejected.slice(0, 3).map((file) => file.name || "未命名文件").join("、");
|
||||
const suffix = rejected.length > 3 ? `等 ${rejected.length} 个文件` : "";
|
||||
return `发票上传仅支持 PDF,已忽略 ${names}${suffix}。`;
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户