| | |
| | | <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) }} |
| | |
| | | <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> |
| | |
| | | <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' |
| | |
| | | } |
| | | } |
| | | |
| | | // 取行的文件扩展名(列表数据没有 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 |
| | | } |
| | | |
| | |
| | | }, |
| | | }) |
| | | window.open(route.href, '_blank') |
| | | // 标记已跳转去编辑,切回本页时刷新列表 |
| | | pendingEditRefresh = true |
| | | } |
| | | |
| | | // 删除 |
| | |
| | | } |
| | | } |
| | | |
| | | // 在线编辑跳转标记:从编辑页切回本页时刷新列表 |
| | | 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> |