1.1.45 采购审批单导出pdf版本

dev
yinq 3 weeks ago
parent dbc7e4dc6c
commit d3b293da28

@ -98,6 +98,18 @@ export function getErpProjectPurchaseList (query) {
* @param projectId
* @param spareFlag
*/
/**
* PDF
* @param projectPurchaseId ID
*/
export const exportProjectPurchaseApprovalPdf = (projectPurchaseId: string | number) => {
return request({
url: '/oa/erp/projectPurchase/exportApprovalPdf/' + projectPurchaseId,
method: 'get',
responseType: 'blob'
});
};
export const getProjectMaterialsByProjectId = (
projectId: string | number,
spareFlag: string,

@ -91,7 +91,7 @@
<dict-tag :options="active_flag" :value="scope.row.activeFlag" />
</template>
</el-table-column>
<el-table-column label="操作" align="center" fixed="right" width="160" class-name="small-padding fixed-width">
<el-table-column label="操作" align="center" fixed="right" width="200" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip v-if="!canEdit(scope.row)" content="查看详情" placement="top">
<el-button link type="info" icon="DocumentChecked" @click="handleView(scope.row)"></el-button>
@ -108,6 +108,15 @@
v-hasPermi="['oa/erp:projectPurchase:export']"
></el-button>
</el-tooltip>
<el-tooltip content="审批单导出" placement="top" v-if="scope.row.projectPurchaseStatus == 3">
<el-button
link
type="primary"
icon="Tickets"
@click="handleExportApprovalPdf(scope.row)"
v-hasPermi="['oa/erp:projectPurchase:export']"
></el-button>
</el-tooltip>
<!-- <el-tooltip content="删除" placement="top">-->
<!-- <el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['oa/erp:projectPurchase:remove']"></el-button>-->
<!-- </el-tooltip>-->
@ -125,7 +134,7 @@ import { reactive, ref, toRefs, getCurrentInstance, onMounted } from 'vue';
import type { ComponentInternalInstance } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import type { FormInstance } from 'element-plus';
import { listProjectPurchase, delProjectPurchase } from '@/api/oa/erp/projectPurchase';
import { listProjectPurchase, delProjectPurchase, exportProjectPurchaseApprovalPdf } from '@/api/oa/erp/projectPurchase';
import type { ProjectPurchaseVO, ProjectPurchaseQuery } from '@/api/oa/erp/projectPurchase/types';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@ -284,6 +293,24 @@ const handleExportSingle = (row: ProjectPurchaseVO) => {
);
};
const handleExportApprovalPdf = async (row: ProjectPurchaseVO) => {
try {
const res = await exportProjectPurchaseApprovalPdf(row.projectPurchaseId);
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.projectCode}_${row.purchaseCode}.pdf`;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
window.URL.revokeObjectURL(url);
proxy?.$modal.msgSuccess('审批单导出成功');
} catch {
proxy?.$modal.msgError('审批单导出失败,请确认采购单已审批完成');
}
};
onMounted(() => {
getList();
});

Loading…
Cancel
Save