From c567cbca3b78a7e06a827acbab56a46657e31aa1 Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Sat, 11 Jul 2026 14:08:07 +0800
Subject: [PATCH] feat:名称增加点击弹窗、zip格式禁用、跳转再点击刷新
---
applications/task-work-order/src/views/orderView/orderManage/inspectionReport/index.vue | 52 ++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 46 insertions(+), 6 deletions(-)
diff --git a/applications/task-work-order/src/views/orderView/orderManage/inspectionReport/index.vue b/applications/task-work-order/src/views/orderView/orderManage/inspectionReport/index.vue
index 0b8fcb2..4a1b61f 100644
--- a/applications/task-work-order/src/views/orderView/orderManage/inspectionReport/index.vue
+++ b/applications/task-work-order/src/views/orderView/orderManage/inspectionReport/index.vue
@@ -41,7 +41,11 @@
<el-table class="gd-table" :data="list" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="46" />
<el-table-column type="index" width="64" label="序号" />
- <el-table-column prop="nickName" show-overflow-tooltip label="文档名称" />
+ <el-table-column prop="nickName" class-name="operation-btns" show-overflow-tooltip label="文档名称">
+ <template v-slot="{ row }">
+ <el-link type="primary" @click="openForm(row)">{{ row.nickName }}</el-link>
+ </template>
+ </el-table-column>
<el-table-column prop="attachSize" show-overflow-tooltip label="文档大小">
<template v-slot="{ row }">
{{ formatFileSize(row.attachSize) }}
@@ -57,7 +61,7 @@
<el-table-column label="操作" class-name="operation-btns" fixed="right">
<template v-slot="{ row }">
<el-link type="primary" @click="seeOnlineWord(row)">查看</el-link>
- <el-link type="primary" @click="openOfficeEdit(row)">在线编辑</el-link>
+ <el-link type="primary" :disabled="isZipRow(row)" @click="openOfficeEdit(row)">在线编辑</el-link>
<el-link type="primary" @click="handleDelete(row)">删除</el-link>
</template>
</el-table-column>
@@ -135,7 +139,7 @@
<script setup>
import { Search, RefreshRight, Download, Upload } from '@element-plus/icons-vue'
import { fjPageApi, fjSubmitApi, fjRemoveApi, fjUploadApi, fjDownloadByByteApi } from './inspectionRequestApi'
-import { ref, onMounted } from 'vue'
+import { ref, onMounted, onBeforeUnmount } from 'vue'
import { useRouter } from 'vue-router'
import { ElMessage, ElMessageBox } from 'element-plus'
import PreviewFiles from '@/components/PreviewFiles/PreviewFiles.vue'
@@ -298,13 +302,23 @@
}
}
+// 取行的文件扩展名(列表数据没有 extension 字段,回退用 link 解析)
+function getRowExtension(row) {
+ return (row?.extension || row?.link?.split('.').pop() || '').toLowerCase()
+}
+
+// 是否为 zip 文件(zip 不支持在线编辑)
+function isZipRow(row) {
+ return getRowExtension(row) === 'zip'
+}
+
function openOfficeEdit(row) {
if (!row?.id) {
ElMessage.warning('附件ID不存在')
return
}
- if (row?.extension === 'zip') {
- ElMessage.warning(`${row?.extension}文件格式,不能编辑`)
+ if (isZipRow(row)) {
+ ElMessage.warning('zip文件格式,不能编辑')
return
}
@@ -316,6 +330,8 @@
},
})
window.open(route.href, '_blank')
+ // 标记已跳转去编辑,切回本页时刷新列表
+ pendingEditRefresh = true
}
// 删除
@@ -459,9 +475,33 @@
}
}
+// 在线编辑跳转标记:从编辑页切回本页时刷新列表
+let pendingEditRefresh = false
+function handleVisibilityChange() {
+ if (document.visibilityState === 'visible' && pendingEditRefresh) {
+ pendingEditRefresh = false
+ getList()
+ }
+}
+
onMounted(() => {
getDictList()
getList()
+ document.addEventListener('visibilitychange', handleVisibilityChange)
+})
+
+onBeforeUnmount(() => {
+ document.removeEventListener('visibilitychange', handleVisibilityChange)
})
</script>
-<style scoped lang="scss"></style>
+<style scoped lang="scss">
+// 操作列里链接的文字(span)被主题强制刷成蓝色 #0075FF,
+// 禁用时需在这里把 span 一并置灰,否则「在线编辑」禁用了还是蓝的
+:deep(.operation-btns) {
+ .el-link.is-disabled,
+ .el-link.is-disabled span {
+ color: #c0c4cc !important;
+ cursor: not-allowed !important;
+ }
+}
+</style>
--
Gitblit v1.9.3