|
@@ -71,7 +71,7 @@
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column label="操作" fixed="right" header-align="center" align="center" class="right-operation" width="140">
|
|
<el-table-column label="操作" fixed="right" header-align="center" align="center" class="right-operation" width="140">
|
|
-
|
|
|
|
|
|
+
|
|
<template #default="{ row }" >
|
|
<template #default="{ row }" >
|
|
<el-link
|
|
<el-link
|
|
class="my-el-link mr12 ml12"
|
|
class="my-el-link mr12 ml12"
|
|
@@ -119,7 +119,7 @@
|
|
type="primary"
|
|
type="primary"
|
|
icon="ele-Tickets"
|
|
icon="ele-Tickets"
|
|
size="small"
|
|
size="small"
|
|
- @click="onDownloadRecord(row)"
|
|
|
|
|
|
+ @click="onDownloadRecord(row.guid)"
|
|
:underline="false"
|
|
:underline="false"
|
|
target="_blank"
|
|
target="_blank"
|
|
>下载记录</el-link>
|
|
>下载记录</el-link>
|
|
@@ -139,7 +139,7 @@
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
- <template>
|
|
|
|
|
|
+ <template>
|
|
<a ref="downloadLink" style="display: none;"></a>
|
|
<a ref="downloadLink" style="display: none;"></a>
|
|
</template>
|
|
</template>
|
|
</el-card>
|
|
</el-card>
|
|
@@ -162,6 +162,8 @@ import {
|
|
import type {pageInput} from "/@/api/admin/shareDto/shareDto";
|
|
import type {pageInput} from "/@/api/admin/shareDto/shareDto";
|
|
import eventBus from "/@/utils/mitt";
|
|
import eventBus from "/@/utils/mitt";
|
|
import {SoftwarePackageManagementApi} from "/@/api/admin/deviceAuthorization/softwarePackageManagementApi";
|
|
import {SoftwarePackageManagementApi} from "/@/api/admin/deviceAuthorization/softwarePackageManagementApi";
|
|
|
|
+import { storeToRefs } from 'pinia'
|
|
|
|
+import { useUserInfo } from '/@/stores/userInfo'
|
|
|
|
|
|
/**引入组件*/
|
|
/**引入组件*/
|
|
const EditDialog = defineAsyncComponent(() => import('./components/form-edit.vue'))
|
|
const EditDialog = defineAsyncComponent(() => import('./components/form-edit.vue'))
|
|
@@ -325,28 +327,43 @@ const onRelease = (row) => {
|
|
|
|
|
|
/**下载*/
|
|
/**下载*/
|
|
const onDownload = (row) => {
|
|
const onDownload = (row) => {
|
|
- var RowData = JSON.parse(JSON.stringify(row))
|
|
|
|
- const params = RowData as softwarePackageManagement_TableData
|
|
|
|
- //const link = downloadLink.value;
|
|
|
|
- //const url = `http://localhost:8000/api/app/software/download-file`;
|
|
|
|
- //link.href = url;
|
|
|
|
- //link.click();
|
|
|
|
- const filename = params.fileName?.toString();
|
|
|
|
- /* var res = new SoftwarePackageManagementApi().DownloadFile(row as softwarePackageManagement_TableData) */
|
|
|
|
- const fileUrl = import.meta.env.VITE_API_URL +'/api/app/software/download-file?guid='+params.guid; // 替换为实际文件URL
|
|
|
|
- fetch(fileUrl)
|
|
|
|
- .then(response => response.blob())
|
|
|
|
- .then(blob => {
|
|
|
|
- const link = document.createElement('a');
|
|
|
|
- link.href = URL.createObjectURL(blob);
|
|
|
|
- link.download = filename;
|
|
|
|
- link.click();
|
|
|
|
- })
|
|
|
|
- .catch(error => {
|
|
|
|
- console.error('下载失败:', error);
|
|
|
|
- });
|
|
|
|
- // var res = new SoftwarePackageManagementApi().DownloadFile(RowData as softwarePackageManagement_TableData)
|
|
|
|
-
|
|
|
|
|
|
+ softwareData.loading = true;
|
|
|
|
+ var RowData = JSON.parse(JSON.stringify(row))
|
|
|
|
+ const params = RowData as softwarePackageManagement_TableData
|
|
|
|
+ //const link = downloadLink.value;
|
|
|
|
+ //const url = `http://localhost:8000/api/app/software/download-file`;
|
|
|
|
+ //link.href = url;
|
|
|
|
+ //link.click();
|
|
|
|
+ const filename = params.fileName?.toString();
|
|
|
|
+ const { userInfos } = storeToRefs(useUserInfo());
|
|
|
|
+ const accessToken = userInfos.value.token
|
|
|
|
+ const token = `Bearer ${accessToken}`
|
|
|
|
+ var myHeaders = new Headers();
|
|
|
|
+myHeaders.append("Authorization", token);
|
|
|
|
+
|
|
|
|
+const requestOptions: RequestInit = {
|
|
|
|
+ method: 'GET',
|
|
|
|
+ headers: myHeaders,
|
|
|
|
+ redirect: 'follow', // 此处使用枚举值 'follow'
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+ /* var res = new SoftwarePackageManagementApi().DownloadFile(row as softwarePackageManagement_TableData) */
|
|
|
|
+ const fileUrl = import.meta.env.VITE_API_URL +'/api/app/software/download-file?guid='+params.guid; // 替换为实际文件URL
|
|
|
|
+ fetch(fileUrl,requestOptions)
|
|
|
|
+ .then(response => response.blob())
|
|
|
|
+ .then(blob => {
|
|
|
|
+ const link = document.createElement('a');
|
|
|
|
+ link.href = URL.createObjectURL(blob);
|
|
|
|
+ link.download = filename;
|
|
|
|
+ link.click();
|
|
|
|
+ softwareData.loading = false
|
|
|
|
+ })
|
|
|
|
+ .catch(error => {
|
|
|
|
+ console.error('下载失败:', error);
|
|
|
|
+ softwareData.loading = false
|
|
|
|
+ });
|
|
|
|
+ // var res = new SoftwarePackageManagementApi().DownloadFile(RowData as softwarePackageManagement_TableData)
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
/**失效*/
|
|
/**失效*/
|
|
@@ -359,8 +376,8 @@ const onFailure = (row) => {
|
|
}
|
|
}
|
|
|
|
|
|
/**下载记录*/
|
|
/**下载记录*/
|
|
-const onDownloadRecord = (row) => {
|
|
|
|
- downloadDialogRef.value.openDialog(row)
|
|
|
|
|
|
+const onDownloadRecord = (id) => {
|
|
|
|
+ downloadDialogRef.value.openDialog(id)
|
|
//alert('下载记录')
|
|
//alert('下载记录')
|
|
}
|
|
}
|
|
|
|
|