|
@@ -24,6 +24,7 @@
|
|
|
v-model:pdf-list="pdfUrlList"
|
|
|
v-model:file-name-list="fileNameList"
|
|
|
:limit="10"
|
|
|
+ :show-tip="false"
|
|
|
:generate-pdf="true"
|
|
|
@finished="testFiles"
|
|
|
/>
|
|
@@ -62,6 +63,14 @@
|
|
|
v-hasPerm="[buttonPermission.BasicData.BTNS.picture_edit]"
|
|
|
>编辑</el-button
|
|
|
>
|
|
|
+ <el-button
|
|
|
+ @click="downloadFile(row, index)"
|
|
|
+ :loading="downloadBtnLoading"
|
|
|
+ text
|
|
|
+ type="primary"
|
|
|
+ v-hasPerm="[buttonPermission.BasicData.BTNS.picture_download]"
|
|
|
+ >下载</el-button
|
|
|
+ >
|
|
|
</template>
|
|
|
<template #menu-left="{ size }">
|
|
|
<el-button
|
|
@@ -163,6 +172,8 @@ onMounted?.(() => {
|
|
|
dataEditList();
|
|
|
});
|
|
|
|
|
|
+
|
|
|
+
|
|
|
const onSelectedFinish = (selectedValue) => {
|
|
|
form.value.associationCode = selectedValue.materialCode;
|
|
|
form.value.associationName = selectedValue.materialName;
|
|
@@ -413,4 +424,32 @@ const deleteRecord = (row, index, done) => {
|
|
|
deleteRow(row, index, done);
|
|
|
dataEditList();
|
|
|
};
|
|
|
+
|
|
|
+const downloadBtnLoading = ref(false);
|
|
|
+const downloadFile = async (row, index, done) => {
|
|
|
+
|
|
|
+ downloadBtnLoading.value = true;
|
|
|
+ let url = import.meta.env.VITE_APP_UPLOAD_URL + row.drawingPath;
|
|
|
+
|
|
|
+ // 1. 获取资源并转为Blob
|
|
|
+ const response = await fetch(url);
|
|
|
+ const blob = await response.blob();
|
|
|
+
|
|
|
+ // 2. 创建临时对象URL
|
|
|
+ const tempUrl = URL.createObjectURL(blob);
|
|
|
+
|
|
|
+ // 3. 创建隐藏a标签触发下载
|
|
|
+ const link = document.createElement("a");
|
|
|
+ link.href = tempUrl;
|
|
|
+ link.download = row.filename;
|
|
|
+ link.style.display = "none";
|
|
|
+ document.body.appendChild(link);
|
|
|
+ link.click();
|
|
|
+
|
|
|
+ // 4. 清理内存
|
|
|
+ URL.revokeObjectURL(tempUrl);
|
|
|
+ document.body.removeChild(link)
|
|
|
+ downloadBtnLoading.value = false;
|
|
|
+}
|
|
|
+
|
|
|
</script>
|