|
|
@@ -3,7 +3,7 @@
|
|
|
<!--引用表格-->
|
|
|
<BasicTable @register="registerTable">
|
|
|
<!--插槽:table标题-->
|
|
|
- <template #tableTitle> </template>
|
|
|
+ <template #tableTitle></template>
|
|
|
<!--操作栏-->
|
|
|
<template #action="{ record }">
|
|
|
<TableAction :actions="getTableAction(record)" />
|
|
|
@@ -11,12 +11,12 @@
|
|
|
</BasicTable>
|
|
|
</div>
|
|
|
<!-- PDF预览弹窗 -->
|
|
|
- <!-- <BasicModal v-model="previewVisible" title="合同预览" width="80%" :showOkBtn="false" @cancel="previewVisible = false">
|
|
|
-
|
|
|
- </BasicModal> -->
|
|
|
- <div v-show="previewVisible" class="absolute left-9999999999999">
|
|
|
- <iframe :src="url" id="pdfPreviewIframe" frameborder="0" width="100%" height="550px" scrolling="auto"></iframe>
|
|
|
- </div>
|
|
|
+<!-- <BasicModal v-model:visible="previewVisible" title="合同预览" width="80%" :showOkBtn="false" @cancel="previewVisible = false">-->
|
|
|
+<!-- <iframe :src="iframeSrc" id="pdfPreviewIframe" frameborder="0" width="100%" height="550px" scrolling="auto"> </iframe>-->
|
|
|
+<!-- </BasicModal>-->
|
|
|
+ <!-- <div v-show="previewVisible" class="absolute">-->
|
|
|
+ <!-- <iframe :src="url" id="pdfPreviewIframe" frameborder="0" width="100%" height="550px" scrolling="auto"></iframe>-->
|
|
|
+ <!-- </div>-->
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
@@ -28,6 +28,9 @@
|
|
|
import { getViewUrl, list } from './signing.api';
|
|
|
import { getToken } from '/@/utils/auth';
|
|
|
import { useGlobSetting } from '/@/hooks/setting';
|
|
|
+ import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
+
|
|
|
+ const { createMessage } = useMessage();
|
|
|
const queryParam = reactive<any>({});
|
|
|
const previewVisible = ref(false);
|
|
|
const glob = useGlobSetting();
|
|
|
@@ -63,11 +66,22 @@
|
|
|
* 编辑事件
|
|
|
*/
|
|
|
async function handleEdit(record: Recordable) {
|
|
|
- const res = await getViewUrl({ signFlowId: record.signFlowId });
|
|
|
- if (res && res.length > 0 && res[0].downloadUrl) {
|
|
|
- let iframe = document.getElementById('pdfPreviewIframe');
|
|
|
- let json = { title: res[0].fileName, token: getToken(), url: res[0].downloadUrl };
|
|
|
- iframe!.contentWindow.postMessage(json, '*');
|
|
|
+ try {
|
|
|
+ createMessage.loading('正在下载文件...', 0);
|
|
|
+ const res = await getViewUrl({ signFlowId: record.signFlowId });
|
|
|
+ if (res && res.length > 0 && res[0].downloadUrl) {
|
|
|
+ const downloadUrl = res[0].downloadUrl;
|
|
|
+ const link = document.createElement('a');
|
|
|
+ link.href = downloadUrl;
|
|
|
+ link.download = '';
|
|
|
+ link.click();
|
|
|
+ link.remove();
|
|
|
+ createMessage.success('文件下载成功');
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ createMessage.error('文件下载失败');
|
|
|
+ } finally {
|
|
|
+ createMessage.destroy();
|
|
|
}
|
|
|
}
|
|
|
|