feat: 大屏改为纯流式自适应布局,新增KPI带与产线动态拓扑地图
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<el-card>
|
||||
<!-- 附件中心:集中查阅 + 下载/预览 + 逻辑删除 + 归档清理。
|
||||
<!-- 附件中心:集中查阅 + 下载/预览 + 逻辑删除。
|
||||
物理落盘统一为 <Upload.Dir>/年/月/日/<文件类型>/<uuid>.<ext>,库内只存相对路径。 -->
|
||||
<el-alert v-if="disk.level !== 'ok'" :type="disk.level === 'critical' ? 'error' : 'warning'"
|
||||
:closable="false" show-icon style="margin-bottom:12px"
|
||||
@@ -8,9 +8,7 @@
|
||||
<template #default>
|
||||
<div style="font-size:12px;line-height:1.7">
|
||||
附件根目录:{{ disk.rootDir }}|剩余 {{ freePercent }}%(剩余 {{ fmtSize(disk.freeBytes) }} / 共 {{ fmtSize(disk.totalBytes) }})
|
||||
<el-button v-if="disk.level === 'critical' && can('sys.attachment:manage')" link type="danger"
|
||||
style="margin-left:8px" @click="doArchive">立即归档清理</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-alert>
|
||||
|
||||
@@ -42,8 +40,6 @@
|
||||
<el-form-item>
|
||||
<el-button type="primary" :loading="loading" @click="search">查询</el-button>
|
||||
<el-button @click="resetFilters">重置</el-button>
|
||||
<el-button v-if="can('sys.attachment:manage')" type="warning" plain :loading="archiving"
|
||||
@click="doArchive">归档清理</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
@@ -56,11 +52,6 @@
|
||||
<el-tag size="small" type="info">{{ fileTypeText(row.fileType) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="访问路径" min-width="260" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" :underline="false" @click="preview(row)">{{ fullUrl(row) }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="大小" width="100" align="right">
|
||||
<template #default="{ row }">{{ fmtSize(row.fileSize) }}</template>
|
||||
</el-table-column>
|
||||
@@ -77,7 +68,6 @@
|
||||
<el-table-column label="状态" width="90" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.deleted" size="small" type="danger">已删除</el-tag>
|
||||
<el-tag v-else-if="row.archived" size="small" type="warning">已归档</el-tag>
|
||||
<el-tag v-else size="small" type="success">有效</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -141,7 +131,6 @@ const list = ref([])
|
||||
const total = ref(0)
|
||||
const page = reactive({ current: 1, size: 20 })
|
||||
const loading = ref(false)
|
||||
const archiving = ref(false)
|
||||
const disk = reactive({ level: 'ok', message: '', rootDir: '', usedPercent: 0, freeBytes: 0, totalBytes: 0 })
|
||||
|
||||
const freePercent = computed(() => Math.max(0, 100 - (disk.usedPercent || 0)))
|
||||
@@ -204,12 +193,6 @@ function preview(row) {
|
||||
if (!row.previewUrl) return ElMessage.warning('无预览地址')
|
||||
window.open(row.previewUrl, '_blank')
|
||||
}
|
||||
// 路径改完整 URL(绝对可访问地址,便于复制/对接)
|
||||
function fullUrl(row) {
|
||||
if (!row.url) return row.filePath || '-'
|
||||
try { return location.origin + row.url } catch { return row.url }
|
||||
}
|
||||
|
||||
// 下载:带鉴权走 id 路由,服务端给出中文文件名
|
||||
async function download(row) {
|
||||
const token = getToken()
|
||||
@@ -235,27 +218,6 @@ async function remove(row) {
|
||||
await load()
|
||||
}
|
||||
|
||||
// 归档:先 dryRun 预览数量,确认后执行(早于本地保留年数的附件移动到外部备份目录并标记已归档)
|
||||
async function doArchive() {
|
||||
const pre = await request.post('/attachment/archive', { dryRun: true })
|
||||
if (!pre?.marked) return ElMessage.info('没有需要归档的附件(早于 ' + pre?.cutYear + ' 年的记录)')
|
||||
const tip = pre.archiveDir
|
||||
? `将把 ${pre.marked} 个早于 ${pre.cutYear} 年的附件移动到备份目录:\n${pre.archiveDir}`
|
||||
: `将把 ${pre.marked} 个早于 ${pre.cutYear} 年的附件标记为已归档(未配置备份目录,不移动物理文件)`
|
||||
try {
|
||||
await ElMessageBox.confirm(tip + '\n\n确认执行归档吗?', '归档确认', {
|
||||
confirmButtonText: '确认归档', cancelButtonText: '取消', type: 'warning'
|
||||
})
|
||||
} catch { return }
|
||||
archiving.value = true
|
||||
try {
|
||||
const res = await request.post('/attachment/archive', { dryRun: false })
|
||||
ElMessage.success(`归档完成:移动 ${res?.moved || 0},标记 ${res?.marked || 0},失败 ${res?.failed || 0}`)
|
||||
await load()
|
||||
} finally {
|
||||
archiving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(load)
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user