1.1.46 出差审批单导出pdf版本

dev
yinq 3 weeks ago
parent d3b293da28
commit 6be14494ba

@ -86,3 +86,15 @@ export const submitBusinessTripApplyAndFlowStart = (data: BusinessTripApplyForm)
data: data
});
};
/**
* PDF
* @param tripId ID
*/
export const exportBusinessTripApplyPdf = (tripId: string | number) => {
return request({
url: '/oa/crm/businessTripApply/exportTripApplyPdf/' + tripId,
method: 'get',
responseType: 'blob'
});
};

@ -145,7 +145,7 @@
<el-table-column label="流程状态" align="center" prop="flowStatus" width="100" v-if="columns[22].visible" />
<el-table-column label="备注" align="center" prop="remark" width="150" show-overflow-tooltip v-if="columns[23].visible" />
<!-- <el-table-column label="附件ID" align="center" prop="ossId" v-if="columns[24].visible" /> -->
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width" width="160">
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width" width="200">
<template #default="scope">
<el-tooltip
content="修改"
@ -157,6 +157,15 @@
<el-tooltip content="查看详情" placement="top" v-if="scope.row.flowStatus !== 'draft' && scope.row.flowStatus">
<el-button link type="info" icon="DocumentChecked" @click="handleView(scope.row)"></el-button>
</el-tooltip>
<el-tooltip content="申请单导出" placement="top" v-if="scope.row.tripStatus === '3'">
<el-button
link
type="primary"
icon="Tickets"
@click="handleExportTripApplyPdf(scope.row)"
v-hasPermi="['oa/crm:businessTripApply:export']"
></el-button>
</el-tooltip>
<!-- <el-tooltip-->
<!-- content="填写反馈"-->
<!-- placement="top"-->
@ -208,7 +217,12 @@
</template>
<script setup name="BusinessTripApply" lang="ts">
import { listBusinessTripApply, delBusinessTripApply, updateBusinessTripApply } from '@/api/oa/crm/businessTripApply';
import {
listBusinessTripApply,
delBusinessTripApply,
updateBusinessTripApply,
exportBusinessTripApplyPdf
} from '@/api/oa/crm/businessTripApply';
import { BusinessTripApplyVO, BusinessTripApplyQuery } from '@/api/oa/crm/businessTripApply/types';
import { getUserList, listUser } from '@/api/system/user';
import { UserQuery, UserVO } from '@/api/system/user/types';
@ -366,6 +380,24 @@ const handleDelete = async (row?: BusinessTripApplyVO) => {
await getList();
};
const handleExportTripApplyPdf = async (row: BusinessTripApplyVO) => {
try {
const res = await exportBusinessTripApplyPdf(row.tripId);
const blob = new Blob([res as unknown as BlobPart], { type: 'application/pdf' });
const url = window.URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = `出差申请单_${row.applyCode || row.tripId}.pdf`;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
window.URL.revokeObjectURL(url);
proxy?.$modal.msgSuccess('申请单导出成功');
} catch {
proxy?.$modal.msgError('申请单导出失败,请确认出差申请已审批完成');
}
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(

Loading…
Cancel
Save