Jelajahi Sumber

Merge branch 'stable' of http://39.98.153.250:9080/yudao/yudao-admin-yiqun into stable

xzc 1 Minggu lalu
induk
melakukan
31f7c2ba8f

+ 34 - 11
yudao-ui-admin-vue3/src/views/pressure2/boilerchecker/components/InspectionItemList.vue

@@ -47,15 +47,15 @@
           <div class="group-header" v-if="partId != ''">
             <h5 class="group-title">{{ getPartNameById(partId) }}</h5>
             <div class="group-actions">
-              <el-button 
-                @click="handleCopyItemPart(partId)"
-                :disabled="orderInfo?.taskStatus === PressureTaskOrderTaskStatus['REPORT_END'] || canAddReportItem" 
-                type="success" 
-                size="small"
-                v-if="partId != ''"
-                :icon="CopyDocument"
-                title="复制部件"
-              />
+<!--              <el-button-->
+<!--                @click="handleCopyItemPart(partId)"-->
+<!--                :disabled="orderInfo?.taskStatus === PressureTaskOrderTaskStatus['REPORT_END'] || canAddReportItem"-->
+<!--                type="success"-->
+<!--                size="small"-->
+<!--                v-if="partId != ''"-->
+<!--                :icon="CopyDocument"-->
+<!--                title="复制部件"-->
+<!--              />-->
 <!--                复制
               </el-button>-->
               <el-button 
@@ -162,6 +162,7 @@
     </div>
 
     <!-- 右键菜单 -->
+    <Teleport to="body">
     <div 
       v-show="contextMenuVisible" 
       class="context-menu"
@@ -237,6 +238,7 @@
         <!-- <span v-if="contextMenuItem && !canVoidItem(contextMenuItem)" class="disabled-tip">(当前状态不可作废)</span> -->
       </div>
     </div>
+    </Teleport>
         <!-- 检验录入-模板 -->
     <InlineEditCheckRecord
       v-if="showInlineEditCheckRecord"
@@ -671,11 +673,32 @@ const handleContextMenu = (event: MouseEvent, item: ReportItemVO) => {
     left: `${event.clientX}px`,
     top: `${event.clientY}px`,
     position: 'fixed',
-    zIndex: '9999'
+    zIndex: '9999',
+    opacity: '0'
   }
+  contextMenuVisible.value = true
 
   nextTick(() => {
-    contextMenuVisible.value = true
+    const el = document.querySelector('.context-menu') as HTMLElement
+    if (!el) return
+    const rect = el.getBoundingClientRect()
+    let left = event.clientX
+    let top = event.clientY
+    // 右侧超出视口则向左偏移
+    if (left + rect.width > window.innerWidth) {
+      left = window.innerWidth - rect.width - 10
+    }
+    // 底部超出视口则向上弹出
+    if (top + rect.height > window.innerHeight) {
+      top = top - rect.height
+    }
+    contextMenuStyle.value = {
+      left: `${left}px`,
+      top: `${top}px`,
+      position: 'fixed',
+      zIndex: '9999',
+      opacity: '1'
+    }
   })
 }
 // 获取检验员名称

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

@@ -1347,7 +1347,7 @@ const rectificationStatusMap = reactive({
 const getReportAuditInfo = async () => {
   if (props.selectedItem?.reportType === PressureReportType['SUGGUESTION']) {
     const res = await BoilerTaskOrderApi.exportCheckBookDetail({
-      id: props.taskId
+      id: props.selectedItem?.id
     })
     console.log(res, '查询检验意见通知书详细信息')
     if (res) {

+ 27 - 9
yudao-ui-admin-vue3/src/views/pressure2/components/RectificationUpload.vue

@@ -143,21 +143,39 @@ const handleItemClick = (file) => {
   }
 }
 
-const handleDownload = (file) => {
-  const link = document.createElement('a')
-  link.href = file.url
-  link.download = file.name
-  document.body.appendChild(link)
-  link.click()
-  document.body.removeChild(link)
+const handleDownload = async (file) => {
+  try {
+    const response = await fetch(file.url, {
+      headers: { authorization: 'Bearer ' + getAccessToken() }
+    })
+    if (!response.ok) {
+      ElMessage.error('下载失败')
+      return
+    }
+    const blob = await response.blob()
+    const blobUrl = URL.createObjectURL(blob)
+    const link = document.createElement('a')
+    link.href = blobUrl
+    link.download = file.name || ''
+    document.body.appendChild(link)
+    link.click()
+    document.body.removeChild(link)
+    URL.revokeObjectURL(blobUrl)
+  } catch {
+    ElMessage.error('下载失败')
+  }
 }
 
 const handleRemove = (file) => {
   const newList = [...props.fileList]
+  const fileUrl = file.url
   const index = newList.findIndex(f => {
+    // uid 优先匹配
     if (file.uid && f.uid) return f.uid === file.uid
-    if (file.url && f.url) return f.url === file.url
-    return f.name === file.name
+    // url 统一经过 buildFileUrl 处理后比较
+    const fUrl = f.url || f.path || ''
+    const builtFUrl = buildFileUrl(fUrl)
+    return builtFUrl === fileUrl
   })
   if (index > -1) {
     newList.splice(index, 1)

+ 25 - 2
yudao-ui-admin-vue3/src/views/pressure2/pipechecker/components/InspectionItemList.vue

@@ -120,6 +120,7 @@
     </div>
 
     <!-- 右键菜单 -->
+    <Teleport to="body">
     <div 
       v-show="contextMenuVisible" 
       class="context-menu"
@@ -204,6 +205,7 @@
         <!-- <span v-if="contextMenuItem && !canVoidItem(contextMenuItem)" class="disabled-tip">(当前状态不可作废)</span> -->
       </div>
     </div>
+    </Teleport>
         <!-- 检验录入-模板 -->
     <InlineEditCheckRecord
       v-if="showInlineEditCheckRecord"
@@ -593,11 +595,32 @@ const handleContextMenu = (event: MouseEvent, item: ReportItemVO) => {
     left: `${event.clientX}px`,
     top: `${event.clientY}px`,
     position: 'fixed',
-    zIndex: '9999'
+    zIndex: '9999',
+    opacity: '0'
   }
+  contextMenuVisible.value = true
 
   nextTick(() => {
-    contextMenuVisible.value = true
+    const el = document.querySelector('.context-menu') as HTMLElement
+    if (!el) return
+    const rect = el.getBoundingClientRect()
+    let left = event.clientX
+    let top = event.clientY
+    // 右侧超出视口则向左偏移
+    if (left + rect.width > window.innerWidth) {
+      left = window.innerWidth - rect.width - 10
+    }
+    // 底部超出视口则向上弹出
+    if (top + rect.height > window.innerHeight) {
+      top = top - rect.height
+    }
+    contextMenuStyle.value = {
+      left: `${left}px`,
+      top: `${top}px`,
+      position: 'fixed',
+      zIndex: '9999',
+      opacity: '1'
+    }
   })
 }
 // 获取检验员名称