合同附件

This commit is contained in:
syruan 2025-02-25 17:12:00 +08:00
parent ebfc63e335
commit a215c91c87
1 changed files with 26 additions and 2 deletions

View File

@ -731,6 +731,29 @@ const downloadContract = () => {
window.open(wordUrl.value)
}
//
const downloadAnnex = async () => {
const baseUrl = window.location.origin;
const fileUrl = `${baseUrl}/contract-annex.docx`;
try {
const response = await fetch(fileUrl);
if (!response.ok) throw new Error('网络响应不正常');
const blob = await response.blob();
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.style.display = 'none';
a.href = url;
a.download = 'contract-annex.docx'; //
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
} catch (error) {
console.error('下载失败:', error);
}
}
const wordUrl = ref('')
//
@ -2046,11 +2069,12 @@ const pickUpView = async(item: any) => {
:close-on-click-modal="false"
>
<div style="display: flex; justify-content: flex-end; margin-bottom: 10px">
<span class="dialog-footer">
<span class="dialog-footer">
<el-button type="success" @click="downloadAnnex"> 下载附件 </el-button>
<el-button @click="downloadContract" type="success"> 下载合同 </el-button>
<el-button type="primary" @click="dialogFormVisibleSettleWord = false"
> </el-button
>
<el-button @click="downloadContract" type="success"> 下载 </el-button>
</span>
</div>
<div id="mmm" style="height: 600px"></div>