瀏覽代碼

检验通知书调整

xy 1 天之前
父節點
當前提交
509ed6e4ca

+ 1 - 0
yudao-ui-admin-vue3/src/views/pressure2/boilerchecker/components/StatusOperationPanel.vue

@@ -1462,6 +1462,7 @@ const ectificationMaterialsVisible = ref(false)
 
 const handleRectificationMaterials = () => {
   ectificationMaterialsVisible.value = true
+  checkBookDetail.value.id =  props.selectedItem?.id
 }
 
 // 获取检验员名称

+ 31 - 62
yudao-ui-admin-vue3/src/views/pressure2/inspectionOpinion/indexBoilerTab.vue

@@ -214,11 +214,10 @@
         <template #default="{ row }">
           <div class="flex justify-center">
 <!--            <el-button link type="primary" v-if="filerFileUrlShowFn(row)" @click="handleFilePreview(row)"> 查看附件 </el-button>-->
-            <el-button link type="primary" @click="fiePreviewEmitFn(row)"> 消息推送 </el-button>
+            <el-button link type="primary" @click="handleRePush(row)"> 消息推送 </el-button>
             <el-button link type="primary" @click="() => handleFollowRecord(row)">
               跟进记录
             </el-button>
-            <el-button link type="primary" @click="handleViewPdf(row)"> 预览 </el-button>
             <el-button
               link
               type="primary"
@@ -657,11 +656,16 @@
 
  <unitContainerForm ref="unitContainerFormRef" />
 
-  <!-- PDF预览弹窗 -->
-  <PdfPreviewDialog
-    v-model="pdfPreviewVisible"
-    :pdfBlob="currentPdfBlob"
-    @close="handlePdfPreviewClose"
+  <!-- PDF预览 + 消息推送弹窗 -->
+  <FilePreview
+    v-if="previewVisible"
+    v-model="previewVisible"
+    :id="currentPreviewId"
+    :reportId="currentReportId"
+    :filename="currentFilename"
+    :title="'检验意见通知书'"
+    @close="handlePreviewClose"
+    @sbmit="fiePreviewEmitFn"
   />
 
 </template>
@@ -698,7 +702,6 @@ import { cloneDeep } from 'lodash-es'
 import { useUserStoreWithOut } from '@/store/modules/user'
 import { buildFileUrl } from '@/utils'
 import {PipeInputApi} from "@/api/pressure2/pipeInput";
-import PdfPreviewDialog from "@/views/pressure2/boilertaskorder/PdfPreviewDialog.vue";
 
 const currentPreviewId = ref<string>('')
 const currentFilename = ref<string>('')
@@ -891,17 +894,27 @@ const handleRePush = async (row) => {
   recipientType.value = 'single'
   currentReportId.value = row.opinionReportedUrl
   currentPreviewId.value = row.id
-  recipientDialogVisible.value = true
-
+  currentFilename.value = '检验意见通知书.pdf'
+  // 重置上次推送的接收人信息
+  recipientFormData.recipient = ''
+  recipientFormData.recipientPhone = ''
+  previewVisible.value = true
 }
-const fiePreviewEmitFn = (row) => {
-  recipientRow.value = row
-  recipientType.value = 'single'
-  currentReportId.value = row.opinionReportedUrl
-  currentPreviewId.value = row.id
-
-  recipientFormData.recipient = row.defaultRecipient || ''
-  recipientFormData.recipientPhone = row.defaultRecipientPhone || ''
+const fiePreviewEmitFn = async () => {
+  try {
+    const result = await BoilerTaskOrderApi.exportCheckBookDetail({id: currentPreviewId.value})
+    if (result) {
+      recipientFormData.recipient = result.correspondName || (recipientRow.value as any).defaultRecipient || ''
+      recipientFormData.recipientPhone = result.correspondPhone || (recipientRow.value as any).defaultRecipientPhone || ''
+    }
+  } catch (e) {
+    console.warn('获取推送接收人信息失败,使用默认值', e)
+  }
+  // 兜底使用行数据中的默认值
+  if (!recipientFormData.recipient) {
+    recipientFormData.recipient = (recipientRow.value as any).defaultRecipient || ''
+    recipientFormData.recipientPhone = (recipientRow.value as any).defaultRecipientPhone || ''
+  }
   recipientDialogVisible.value = true
 }
 const handleFilePreview = (row) => {
@@ -1236,50 +1249,6 @@ const downloadFile = async (blob, filename) => {
   }
 }
 
-// PDF预览相关
-const pdfPreviewVisible = ref(false)
-const currentPdfBlob = ref<Blob | null>(null)
-const handleViewPdf = async (row) => {
-
-  let data: any[] = []
-  data.push({
-    taskStatus: 100,
-    resultTemplateId: '',
-    templateId: row.templateId,
-    id: row.reportId,
-  })
-
-  const loadingInstance = ElLoading.service({
-    fullscreen: true,
-    text: '正在生成...'
-  })
-
-  try {
-    // 调用 API 获取 ZIP blob
-    const pdfBlob = await PipeInputApi.handlePrint(data)
-
-    if (pdfBlob) {
-
-      currentPdfBlob.value = pdfBlob
-      pdfPreviewVisible.value = true
-
-    } else {
-      ElMessage.error('获取文件失败')
-    }
-  } catch (error) {
-    console.error('预览失败:', error)
-    ElMessage.error('预览失败')
-  } finally {
-    loadingInstance.close()
-  }
-
-}
-
-// PDF预览关闭处理
-const handlePdfPreviewClose = () => {
-  currentPdfBlob.value = null
-}
-
 const handleRowDownload = async (row) => {
 
   let data: any[] = []

+ 31 - 62
yudao-ui-admin-vue3/src/views/pressure2/inspectionOpinion/indexPipeTab.vue

@@ -214,11 +214,10 @@
         <template #default="{ row }">
           <div class="flex justify-center">
 <!--            <el-button link type="primary" v-if="filerFileUrlShowFn(row)" @click="handleFilePreview(row)"> 查看附件 </el-button>-->
-            <el-button link type="primary" @click="fiePreviewEmitFn(row)"> 消息推送 </el-button>
+            <el-button link type="primary" @click="handleRePush(row)"> 消息推送 </el-button>
             <el-button link type="primary" @click="() => handleFollowRecord(row)">
               跟进记录
             </el-button>
-            <el-button link type="primary" @click="handleViewPdf(row)"> 预览 </el-button>
             <el-button
               link
               type="primary"
@@ -657,11 +656,16 @@
 
  <unitContainerForm ref="unitContainerFormRef" />
 
-  <!-- PDF预览弹窗 -->
-  <PdfPreviewDialog
-    v-model="pdfPreviewVisible"
-    :pdfBlob="currentPdfBlob"
-    @close="handlePdfPreviewClose"
+  <!-- PDF预览 + 消息推送弹窗 -->
+  <FilePreview
+    v-if="previewVisible"
+    v-model="previewVisible"
+    :id="currentPreviewId"
+    :reportId="currentReportId"
+    :filename="currentFilename"
+    :title="'检验意见通知书'"
+    @close="handlePreviewClose"
+    @sbmit="fiePreviewEmitFn"
   />
 
 </template>
@@ -698,7 +702,6 @@ import { cloneDeep } from 'lodash-es'
 import { useUserStoreWithOut } from '@/store/modules/user'
 import { buildFileUrl } from '@/utils'
 import {PipeInputApi} from "@/api/pressure2/pipeInput";
-import PdfPreviewDialog from "@/views/pressure2/boilertaskorder/PdfPreviewDialog.vue";
 
 const currentPreviewId = ref<string>('')
 const currentFilename = ref<string>('')
@@ -891,17 +894,27 @@ const handleRePush = async (row) => {
   recipientType.value = 'single'
   currentReportId.value = row.opinionReportedUrl
   currentPreviewId.value = row.id
-  recipientDialogVisible.value = true
-
+  currentFilename.value = '检验意见通知书.pdf'
+  // 重置上次推送的接收人信息
+  recipientFormData.recipient = ''
+  recipientFormData.recipientPhone = ''
+  previewVisible.value = true
 }
-const fiePreviewEmitFn = (row) => {
-  recipientRow.value = row
-  recipientType.value = 'single'
-  currentReportId.value = row.opinionReportedUrl
-  currentPreviewId.value = row.id
-
-  recipientFormData.recipient = row.defaultRecipient || ''
-  recipientFormData.recipientPhone = row.defaultRecipientPhone || ''
+const fiePreviewEmitFn = async () => {
+  try {
+    const result = await PipeTaskOrderApi.exportCheckBookDetail({id: currentPreviewId.value})
+    if (result) {
+      recipientFormData.recipient = result.correspondName || (recipientRow.value as any).defaultRecipient || ''
+      recipientFormData.recipientPhone = result.correspondPhone || (recipientRow.value as any).defaultRecipientPhone || ''
+    }
+  } catch (e) {
+    console.warn('获取推送接收人信息失败,使用默认值', e)
+  }
+  // 兜底使用行数据中的默认值
+  if (!recipientFormData.recipient) {
+    recipientFormData.recipient = (recipientRow.value as any).defaultRecipient || ''
+    recipientFormData.recipientPhone = (recipientRow.value as any).defaultRecipientPhone || ''
+  }
   recipientDialogVisible.value = true
 }
 const handleFilePreview = (row) => {
@@ -1236,50 +1249,6 @@ const downloadFile = async (blob, filename) => {
   }
 }
 
-// PDF预览相关
-const pdfPreviewVisible = ref(false)
-const currentPdfBlob = ref<Blob | null>(null)
-const handleViewPdf = async (row) => {
-
-  let data: any[] = []
-  data.push({
-    taskStatus: 100,
-    resultTemplateId: '',
-    templateId: row.templateId,
-    id: row.reportId,
-  })
-
-  const loadingInstance = ElLoading.service({
-    fullscreen: true,
-    text: '正在生成...'
-  })
-
-  try {
-    // 调用 API 获取 ZIP blob
-    const pdfBlob = await PipeInputApi.handlePrint(data)
-
-    if (pdfBlob) {
-
-      currentPdfBlob.value = pdfBlob
-      pdfPreviewVisible.value = true
-
-    } else {
-      ElMessage.error('获取文件失败')
-    }
-  } catch (error) {
-    console.error('预览失败:', error)
-    ElMessage.error('预览失败')
-  } finally {
-    loadingInstance.close()
-  }
-
-}
-
-// PDF预览关闭处理
-const handlePdfPreviewClose = () => {
-  currentPdfBlob.value = null
-}
-
 const handleRowDownload = async (row) => {
 
   let data: any[] = []

+ 1 - 0
yudao-ui-admin-vue3/src/views/pressure2/pipechecker/components/StatusOperationPanel.vue

@@ -1416,6 +1416,7 @@ const ectificationMaterialsVisible = ref(false)
 
 const handleRectificationMaterials = () => {
   ectificationMaterialsVisible.value = true
+  checkBookDetail.value.id =  props.selectedItem?.id
 }
 
 // 获取检验员名称