Files
cz-web/src/views/project/cpns/ProjectFiles.vue
2026-10-01 10:53:13 +08:00

145 lines
3.6 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
import type { FileInfo } from '@/types/api'
import { formatFileSize } from '@/utils/format'
interface Props {
files: FileInfo[]
}
defineProps<Props>()
// ⚠️ 详情页只「展示」文件,不提供上传入口(上传在需求提报页)。
const emit = defineEmits<{
delete: [index: number]
preview: [index: number]
download: [index: number]
}>()
</script>
<template>
<section class="project-files">
<!-- 设计稿(785b3eb8)本页签**没有区块标题**,文件行直接起于分割线下方 24px;
标题只保留给读屏,视觉隐藏。 -->
<h2 class="project-files__title">
项目文件
</h2>
<ul class="project-files__list">
<li
v-for="(file, index) in files"
:key="`${file.name}-${index}`"
class="project-files__item"
>
<div class="project-files__info">
<span class="project-files__name" :title="file.name">{{ file.name }}</span>
<span class="project-files__meta">
{{ formatFileSize(file.size) }} · {{ file.uploadTime }}
</span>
</div>
<div class="project-files__actions">
<button class="project-files__btn" @click="emit('preview', index)">
预览
</button>
<button class="project-files__btn" @click="emit('download', index)">
下载
</button>
<button
class="project-files__btn project-files__btn--danger"
@click="emit('delete', index)"
>
删除
</button>
</div>
</li>
<li v-if="files.length === 0" class="project-files__empty text-secondary">
暂无项目文件
</li>
</ul>
</section>
</template>
<style lang="less" scoped>
// 设计稿实测(1920,1:1):无区块标题,文件行直接起于 (70,342);
// 行 1780×55 底 #F7F8FA、接缝 10;类型徽标 (87,352) 33×21;文件名 (130,352) 13px;
// 副行 (130,372) 11px #9CA3AF;操作 (1748,361) 12px #6B7280(预览 / 下载),右缘 x1845。
.project-files {
.flex(column, flex-start, stretch);
padding: 0;
// 设计稿无可见标题:仅读屏可读(不占位)
&__title {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
}
&__list {
.flex(column, flex-start, stretch);
gap: 10px;
margin-top: 24px; // 分割线 317 → 首行顶 342(785b3eb8)
}
// 整行通铺 #F7F8FA、圆角 8,行高 55(内容 35 + 上下 10)
&__item {
.flex(row, space-between, center);
gap: @spacing-base;
height: 55px;
box-sizing: border-box;
padding: 0 5.6px 0 17px; // 徽标左缘 87 = 内容区 70 + 17;操作右缘 1845 = 1850 − 5
border-radius: 8px;
background: @finance-row-bg;
}
&__info {
.flex(column, flex-start, stretch);
gap: 3px;
min-width: 0;
}
&__name {
max-width: 1410px;
font-size: 13px;
line-height: 17px;
color: @project-ink;
.ellipsis();
}
&__meta {
font-size: 11px;
line-height: 15px;
color: @project-muted;
}
&__actions {
.flex(row, flex-end, center);
gap: 14px; // 1748.39 → 1805.33 实测节距 57/40 → 用文字宽 + 14
flex-shrink: 0;
}
&__btn {
flex-shrink: 0;
font-size: 12px;
line-height: 16px;
color: @project-label;
transition: opacity 0.2s;
&:hover {
opacity: 0.75;
}
&--danger {
color: @danger-color;
}
}
&__empty {
font-size: @font-size-body;
}
}
</style>