feat(customer): 新增客户相关配卷和财务信息查询接口 fix(base.vue): 修复发货单时间条件显示问题 refactor(CustomerEdit): 替换地址选择组件为普通输入框 feat(CoilSelector): 增加入场卷号查询条件并调整对话框宽度 style(OrderEdit): 调整客户名称和销售员选择框宽度 refactor(ChinaAreaSelect): 优化地址解析逻辑并支持空对象处理 feat(FileUpload/FileList): 新增文件预览功能组件 refactor(KLPService/CustomerSelect): 优化客户选择组件并支持自定义字段绑定 fix(AbnormalForm): 修复异常位置校验逻辑并保留当前卷号 feat(ContractTabs): 新增合同附件展示功能 refactor(warehouse/record): 重构操作记录统计展示方式 feat(contract): 集成客户选择组件并优化合同信息填充 refactor(order): 调整订单表单布局并集成合同信息 feat(FilePreview): 新增文件预览组件 feat(customer): 新增财务状态和发货配卷展示 refactor(CustomerOrder): 移除冗余代码并优化布局 feat(PlanDetailForm): 新增合同附件查看功能 feat(dict): 新增字典管理页面
194 lines
3.7 KiB
Vue
194 lines
3.7 KiB
Vue
<template>
|
|
<div class="file-list-container">
|
|
<!-- 空数据提示 -->
|
|
<div v-if="fileList.length === 0 && !loading" class="empty-tip">
|
|
<el-empty description="暂无文件数据"></el-empty>
|
|
</div>
|
|
<!-- 自定义文件列表 -->
|
|
<div v-else class="file-list" v-loading="loading">
|
|
<div
|
|
v-for="file in fileList"
|
|
:key="file.ossId"
|
|
class="file-item"
|
|
>
|
|
<div class="file-info">
|
|
<i class="el-icon-document"></i>
|
|
<span class="file-name">{{ file.originalName }}</span>
|
|
</div>
|
|
<div class="file-actions">
|
|
<el-button
|
|
type="text"
|
|
icon="el-icon-view"
|
|
@click="handlePreview(file)"
|
|
size="small"
|
|
class="preview-btn"
|
|
>
|
|
预览
|
|
</el-button>
|
|
<el-button
|
|
type="text"
|
|
icon="el-icon-download"
|
|
@click="downloadFile(file)"
|
|
size="small"
|
|
class="download-btn"
|
|
>
|
|
下载
|
|
</el-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 文件预览组件 -->
|
|
<file-preview
|
|
:visible.sync="previewVisible"
|
|
:file-url="previewFileUrl"
|
|
:file-name="previewFileName"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { listByIds } from "@/api/system/oss";
|
|
import FilePreview from "../FilePreview";
|
|
|
|
export default {
|
|
name: "FileList",
|
|
components: {
|
|
FilePreview
|
|
},
|
|
props: {
|
|
ossIds: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
},
|
|
data() {
|
|
return {
|
|
fileList: [],
|
|
loading: false, // 加载状态
|
|
// 预览相关
|
|
previewVisible: false,
|
|
previewFileUrl: '',
|
|
previewFileName: ''
|
|
}
|
|
},
|
|
watch: {
|
|
ossIds: {
|
|
handler(val) {
|
|
if (val) {
|
|
this.getFileList();
|
|
} else {
|
|
this.fileList = []; // 清空文件列表
|
|
}
|
|
},
|
|
immediate: true,
|
|
}
|
|
},
|
|
methods: {
|
|
async getFileList() {
|
|
if (!this.ossIds) return;
|
|
|
|
this.loading = true;
|
|
try {
|
|
let res = await listByIds(this.ossIds);
|
|
this.fileList = res.data || [];
|
|
} catch (error) {
|
|
this.$message.error('获取文件列表失败:' + (error.message || '未知错误'));
|
|
this.fileList = [];
|
|
} finally {
|
|
this.loading = false;
|
|
}
|
|
},
|
|
|
|
// 文件下载方法
|
|
downloadFile(file) {
|
|
if (!file || !file.ossId) {
|
|
this.$message.warning('文件下载地址不存在');
|
|
return;
|
|
}
|
|
this.$download.oss(file.ossId);
|
|
},
|
|
// 预览文件
|
|
handlePreview(file) {
|
|
this.previewFileUrl = file.url;
|
|
this.previewFileName = file.originalName;
|
|
this.previewVisible = true;
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.file-list-container {
|
|
width: 100%;
|
|
min-height: 100px;
|
|
}
|
|
|
|
.empty-tip {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
height: 200px;
|
|
}
|
|
|
|
.file-list {
|
|
width: 100%;
|
|
border: 1px solid #ebeef5;
|
|
border-radius: 4px;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.file-item {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 12px 16px;
|
|
border-bottom: 1px solid #ebeef5;
|
|
transition: background-color 0.3s;
|
|
}
|
|
|
|
.file-actions {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 16px;
|
|
}
|
|
|
|
.file-item:last-child {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.file-item:hover {
|
|
background-color: #f5f7fa;
|
|
}
|
|
|
|
.file-info {
|
|
display: flex;
|
|
align-items: center;
|
|
flex: 1;
|
|
}
|
|
|
|
.file-info .el-icon-document {
|
|
margin-right: 8px;
|
|
color: #409eff;
|
|
font-size: 16px;
|
|
}
|
|
|
|
.file-name {
|
|
font-size: 14px;
|
|
color: #606266;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
flex: 1;
|
|
}
|
|
|
|
.download-btn {
|
|
margin: 0;
|
|
font-size: 14px;
|
|
color: #409eff;
|
|
}
|
|
|
|
.download-btn:hover {
|
|
color: #66b1ff;
|
|
}
|
|
</style> |