xy 5 روز پیش
والد
کامیت
fb562f8fc7

+ 4 - 0
yudao-ui-admin-vue3/src/api/pressure2/boilertaskorder/index.ts

@@ -820,4 +820,8 @@ export const BoilerTaskOrderApi = {
   updateSituation: async (data: any) => {
     return await request.post({ url: `/pressure2/boiler-task-order/order-item/update-situation`, data })
   },
+
+  inspectionServiceEmailPush: async (data: any) => {
+    return await request.post({ url: `/pressure2/order-report/serviceFromSendEmail`, data })
+  },
 }

+ 4 - 0
yudao-ui-admin-vue3/src/api/pressure2/pipetaskorder/index.ts

@@ -802,4 +802,8 @@ export const PipeTaskOrderApi = {
   inspectionServicePush: async (data: any) => {
     return await request.post({ url: `/pressure2/boiler-task-order-sign-file/create`, data })
   },
+
+  inspectionServiceEmailPush: async (data: any) => {
+    return await request.post({ url: `/pressure2/order-report/serviceFromSendEmail`, data })
+  },
 }

+ 1 - 1
yudao-ui-admin-vue3/src/views/pressure2/acceptorder/index.vue

@@ -347,7 +347,7 @@
               {
                 isAuditPage.value ? <>
                   {
-                    ((row.currentNode === '业务审核' && getCurrentUserRoles.value.includes('business_review')) || (row.currentNode === '容器技术审核' && getCurrentUserRoles.value.includes('technical_review')))
+                    ((row.currentNode === '业务审核' && getCurrentUserRoles.value.includes('business_review')) || (row.currentNode === '锅炉技术审核' && getCurrentUserRoles.value.includes('technical_review')))
                     &&
                     <>
                       <el-button link type="primary" onClick={()=>handleBatchPassOrder(row)}>通过</el-button> 

+ 1 - 1
yudao-ui-admin-vue3/src/views/pressure2/acceptorder/pipeIndex.vue

@@ -346,7 +346,7 @@
               {
                 isAuditPage.value ? <>
                   {
-                    ((row.currentNode === '业务审核' && getCurrentUserRoles.value.includes('business_review')) || (row.currentNode === '容器技术审核' && getCurrentUserRoles.value.includes('technical_review')))
+                    ((row.currentNode === '业务审核' && getCurrentUserRoles.value.includes('business_review')) || (row.currentNode === '管道技术审核' && getCurrentUserRoles.value.includes('technical_review')))
                     &&
                     <>
                       <el-button link type="primary" onClick={()=>handleBatchPassOrder(row)}>通过</el-button> 

+ 3 - 1
yudao-ui-admin-vue3/src/views/pressure2/boilertaskorder/components/OrderDialog.vue

@@ -125,7 +125,9 @@ const handlePushConfirm = async () => {
       await BoilerTaskOrderApi.inspectionServiceEmailPush({
         id: props.orderId,
         businessType: 100,
-        email: pushDialogFormData.value.serviceFormReceiverEmail
+        email: pushDialogFormData.value.serviceFormReceiverEmail,
+        orderId: props.orderId,
+        reportId: currentOrder.value.id,
       })
     }
     ElMessage.success('推送成功')

+ 60 - 13
yudao-ui-admin-vue3/src/views/pressure2/boilertaskorder/components/ServiceRecordList.vue

@@ -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(() => {

+ 60 - 13
yudao-ui-admin-vue3/src/views/pressure2/pipetaskorder/components/ServiceRecordList.vue

@@ -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">
@@ -28,17 +27,14 @@
             <template #dropdown>
               <el-dropdown-menu>
                 <el-dropdown-item
-                  :disabled="wxPushDisabled"
                   @click="() => serviceOrderSubmitForm('wx')"
                   >小程序推送</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
                 >
@@ -413,14 +409,6 @@ const serviceOrderDialogFormRules = ref<FormRules<any>>({
     { type: 'email', message: '请输入正确的接收人邮箱' }
   ]
 })
-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')
-}
 // 关闭对话框
 const handleClose = () => {
   serviceOrderDialogVisible.value = false
@@ -493,7 +481,8 @@ const handleEmailPush = () => {
   const params: Record<string, any> = {
     id: props.taskOrderDetail.id,
     businessType: props.businessType == 1000 ? 200 : props.businessType,
-    email: serviceFormReceiverEmail
+    email: serviceFormReceiverEmail,
+    reportId: curReportId.value
   }
   // 提交表单数据
   PipeTaskOrderApi.inspectionServiceEmailPush(params).then(() => {
@@ -859,6 +848,64 @@ const initPreview=()=>{
   console.log('initPreview', initData.value)
 }
 
+// PDF预览相关
+const serviceOrderDownload = async () => {
+
+  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()
+  }
+
+}
+
 onMounted(async () => {
   await updateServiceOrderDialogFormData()
   await handleRefresh()