| | |
| | | :headers="upload.headers" |
| | | :action="upload.url + '?updateSupport=' + upload.updateSupport" |
| | | :disabled="upload.isUploading" |
| | | :showTip="true" |
| | | @success="handleFileSuccess" |
| | | :downloadTemplate="handleDownloadTemplate" |
| | | /> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | |
| | | import { getToken } from "@/utils/auth.js"; |
| | | import { FileUpload } from "@/components/Upload"; |
| | | import { ElMessage } from "element-plus"; |
| | | import { downloadProductModelImportTemplate } from "@/api/basicData/product.js"; |
| | | |
| | | defineOptions({ |
| | | name: "产品维护导入", |
| | |
| | | ElMessage({ message: msg, type: "error" }); |
| | | } |
| | | }; |
| | | |
| | | // 下载 Excel 导入模板 |
| | | const handleDownloadTemplate = () => { |
| | | downloadProductModelImportTemplate() |
| | | .then((blobData) => { |
| | | const blob = |
| | | blobData instanceof Blob |
| | | ? blobData |
| | | : new Blob([blobData], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" }); |
| | | const url = window.URL.createObjectURL(blob); |
| | | const link = document.createElement("a"); |
| | | link.href = url; |
| | | link.download = "产品导入模板.xlsx"; |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | document.body.removeChild(link); |
| | | window.URL.revokeObjectURL(url); |
| | | ElMessage({ message: "模板下载成功", type: "success" }); |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ message: "模板下载失败", type: "error" }); |
| | | }); |
| | | }; |
| | | </script> |