配种计划导出更新

This commit is contained in:
zyk
2026-03-07 12:38:58 +08:00
parent 5fb6cecde5
commit 191ea111f7

View File

@@ -107,6 +107,13 @@
type="info" :closable="false" show-icon />
</div>
<div class="mt10">
<el-button type="success" icon="Download" @click="handleDownloadTemplate">
下载配对模板
</el-button>
<span style="font-size:12px;color:#909399;margin-left:10px">下载空白模板填写耳号后上传</span>
</div>
<el-form :model="importForm" label-width="100px" class="mt16" style="max-width:600px">
<el-form-item label="计划类型" required>
<el-select v-model="importForm.planType" placeholder="请选择计划类型" style="width:260px">
@@ -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([])