diff --git a/src/views/mating_plan/mating_plan/generate/index.vue b/src/views/mating_plan/mating_plan/generate/index.vue index e4147c6..9c8ca59 100644 --- a/src/views/mating_plan/mating_plan/generate/index.vue +++ b/src/views/mating_plan/mating_plan/generate/index.vue @@ -107,6 +107,13 @@ type="info" :closable="false" show-icon /> +
+ + 下载配对模板 + + 下载空白模板,填写耳号后上传 +
+ @@ -364,7 +371,8 @@ import { confirmApproveBreedPlan, viewBreedPlan, exportBreedPlanDetails, - delBreedPlanGenerate + delBreedPlanGenerate, + downloadPairTemplate } from '@/api/mating_plan/generate' const { proxy } = getCurrentInstance() @@ -520,6 +528,23 @@ function handleClearImport() { if (uploadRef.value) uploadRef.value.clearFiles() } +async function handleDownloadTemplate() { + try { + const res = await downloadPairTemplate() + const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }) + const url = window.URL.createObjectURL(blob) + const a = document.createElement('a') + a.href = url + a.download = '配种配对模板.xlsx' + document.body.appendChild(a) + a.click() + document.body.removeChild(a) + window.URL.revokeObjectURL(url) + } catch (e) { + proxy.$modal.msgError('下载模板失败:' + e.message) + } +} + // =================== Tab3:计划列表 =================== const listLoading = ref(false) const planList = ref([])