From 6e88705bd5b443a259b24c17c8a299765d059d96 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Thu, 23 Jul 2026 16:50:41 +0800
Subject: [PATCH] Merge branch 'master' of http://139.196.74.78:10010/r/jagzwxm/ja_web
---
applications/task-work-order/src/views/orderView/orderManage/inspectionReport/index.vue | 96 +++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 86 insertions(+), 10 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 1b1d54a..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) }}
@@ -54,10 +58,10 @@
{{ getTaskTypeLabel(row.resultType, workOrderTypeXT) }}
</template>
</el-table-column>
- <el-table-column label="操作" class-name="operation-btns">
+ <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="openForm(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,8 +139,8 @@
<script setup>
import { Search, RefreshRight, Download, Upload } from '@element-plus/icons-vue'
import { fjPageApi, fjSubmitApi, fjRemoveApi, fjUploadApi, fjDownloadByByteApi } from './inspectionRequestApi'
-import { useStore } from 'vuex'
-import { ref, computed, 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'
import { Base64 } from 'js-base64'
@@ -147,8 +151,7 @@
taskTypeCascaderProps,
} from '../taskTypeOptions'
-const store = useStore()
-const userInfo = computed(() => store.getters.userInfo)
+const router = useRouter()
@@ -269,17 +272,66 @@
];
const { VITE_APP_PREVIEW_URL } = import.meta.env
+// kkfileView 中,word/pdf 默认转成只读 pdf 预览,excel 才是可编辑的 html 模式。
+// 对这些类型追加 officePreviewType=html,让其以可编辑的 html 方式打开
+const editableOfficeTypes = ['doc', 'docx', 'pdf']
+
// 在线查看文档
function seeOnlineWord(row) {
// 获取点之后的文件格式名
- const fileType = row?.link?.split('.').pop() || ''
+ const fileType = (row?.link?.split('.').pop() || '').toLowerCase()
if (!row.link) {
ElMessage.warning('文件链接不存在')
} else if (allSupportedExtensions.includes(fileType)){
- window.open(`${VITE_APP_PREVIEW_URL}/onlinePreview?url=`+encodeURIComponent(Base64.encode(row.link)));
+ // let url = `${VITE_APP_PREVIEW_URL}/onlinePreview?url=` + encodeURIComponent(Base64.encode(row.link))
+ // // word/pdf 以可编辑的 html 模式打开(与 excel 一致)
+ // if (editableOfficeTypes.includes(fileType)) {
+ // url += '&officePreviewType=html'
+ // }
+ // window.open(url)
+ const route = router.resolve({
+ path: '/documentPreview/officeEdit',
+ query: {
+ attachId: row.id,
+ mode: 'view',
+ },
+ })
+ window.open(route.href, '_blank')
} else {
ElMessage.warning(`${fileType}文件格式,可以下载再查看`)
}
+}
+
+// 取行的文件扩展名(列表数据没有 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 (isZipRow(row)) {
+ ElMessage.warning('zip文件格式,不能编辑')
+ return
+ }
+
+ const route = router.resolve({
+ path: '/documentPreview/officeEdit',
+ query: {
+ attachId: row.id,
+ mode: 'edit',
+ },
+ })
+ window.open(route.href, '_blank')
+ // 标记已跳转去编辑,切回本页时刷新列表
+ pendingEditRefresh = true
}
// 删除
@@ -423,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