|
|
@@ -19,7 +19,6 @@
|
|
|
<div class="operation-inner">
|
|
|
<div class="btn-list">
|
|
|
<el-dropdown
|
|
|
- v-if="props.businessType === 400 ? isAddMainquestion !== 'view' : true"
|
|
|
class="mr-[12px]"
|
|
|
>
|
|
|
<el-button type="success">
|
|
|
@@ -33,12 +32,10 @@
|
|
|
>小程序推送</el-dropdown-item
|
|
|
>
|
|
|
<el-dropdown-item
|
|
|
- :disabled="!downloadPdfPath"
|
|
|
@click="() => serviceOrderSubmitForm('email')"
|
|
|
>邮箱推送</el-dropdown-item
|
|
|
>
|
|
|
<el-dropdown-item
|
|
|
- :disabled="props.businessType === 400 ? false : !downloadPdfPath"
|
|
|
@click="serviceOrderDownload"
|
|
|
>下载</el-dropdown-item
|
|
|
>
|
|
|
@@ -273,6 +270,7 @@ import {editReport} from "@/utils/reportUtil";
|
|
|
import {DynamicTbColApi} from "@/api/pressure2/dynamictbcol";
|
|
|
import {SpreadViewer} from "@/components/DynamicReport";
|
|
|
import {InitParams} from "@/components/DynamicReport/SpreadInterface";
|
|
|
+import {PipeInputApi} from "@/api/pressure2/pipeInput";
|
|
|
|
|
|
|
|
|
const approvalUserVisible = ref(false)
|
|
|
@@ -420,14 +418,65 @@ const serviceOrderDialogFormRules = ref<FormRules<any>>({
|
|
|
{ type: 'email', message: '请输入正确的接收人邮箱' }
|
|
|
]
|
|
|
})
|
|
|
+
|
|
|
+// PDF预览相关
|
|
|
const serviceOrderDownload = async () => {
|
|
|
- // if (!downloadSignFilePdf.value) return
|
|
|
- // const url = import.meta.env.VITE_FILE_URL + '/' + downloadSignFilePdf.value
|
|
|
- const uploadUrl = unref(downloadSignFilePdf)
|
|
|
- ? buildFileUrl(unref(downloadSignFilePdf))
|
|
|
- : unref(recordSource)
|
|
|
- window.open(uploadUrl, '_blank')
|
|
|
+
|
|
|
+ if (!curReportId.value){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ let data: any[] = []
|
|
|
+ data.push({
|
|
|
+ taskStatus: 100,
|
|
|
+ templateId: templateParams.value.templateId,
|
|
|
+ reportUrl: '',
|
|
|
+ id: curReportId.value,
|
|
|
+ })
|
|
|
+
|
|
|
+ const loadingInstance = ElLoading.service({
|
|
|
+ fullscreen: true,
|
|
|
+ text: '正在生成...'
|
|
|
+ })
|
|
|
+
|
|
|
+ try {
|
|
|
+ // 调用 API 获取 ZIP blob
|
|
|
+ const pdfBlob = await PipeInputApi.handlePrint(data)
|
|
|
+
|
|
|
+ if (pdfBlob) {
|
|
|
+
|
|
|
+ // 创建下载链接
|
|
|
+ const url = window.URL.createObjectURL(pdfBlob)
|
|
|
+ const link = document.createElement('a')
|
|
|
+ link.href = url
|
|
|
+ if (props.businessType === 400){
|
|
|
+ link.download = `重大问题线索_${curReportId.value}.pdf` // 设置下载文件名
|
|
|
+ }else{
|
|
|
+ link.download = `检验情况告知_${curReportId.value}.pdf` // 设置下载文件名
|
|
|
+ }
|
|
|
+
|
|
|
+ // 触发下载
|
|
|
+ document.body.appendChild(link)
|
|
|
+ link.click()
|
|
|
+
|
|
|
+ // 清理
|
|
|
+ document.body.removeChild(link)
|
|
|
+ window.URL.revokeObjectURL(url)
|
|
|
+
|
|
|
+ ElMessage.success('报告下载成功')
|
|
|
+
|
|
|
+ } else {
|
|
|
+ ElMessage.error('获取文件失败')
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('下载失败:', error)
|
|
|
+ ElMessage.error('下载失败')
|
|
|
+ } finally {
|
|
|
+ loadingInstance.close()
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
// 关闭对话框
|
|
|
const handleClose = () => {
|
|
|
serviceOrderDialogVisible.value = false
|
|
|
@@ -505,10 +554,8 @@ const handleEmailPush = () => {
|
|
|
const params: Record<string, any> = {
|
|
|
id: props.taskOrderDetail.id,
|
|
|
businessType: props.businessType == 1000 ? 200 : props.businessType,
|
|
|
- email: serviceFormReceiverEmail
|
|
|
- }
|
|
|
- if (props.businessType === 400) {
|
|
|
- params.orderItemId = props.orderItemId
|
|
|
+ email: serviceFormReceiverEmail,
|
|
|
+ reportId: curReportId.value
|
|
|
}
|
|
|
// 提交表单数据
|
|
|
BoilerTaskOrderApi.inspectionServiceEmailPush(params).then(() => {
|