当前位置: 首页 > news >正文

el-draw的文件列表和清单内容布局实现

效果:左中右布局:左侧是清单内容,中间是清单的文件列表,点击文件列表可以预览文件详情,右侧是文件预览效果

el-draw部分:

 <el-drawer :title="showPdfViewer.title" :close-on-click-modal="false" v-model="showPdfViewer.visible" size="100%" append-to-body><div class="shenpi-content"><el-card shadow="hover" style="width: 25%; margin-right: 10px; "><template #header><span style="color: #409EFF;">备案信息</span></template><div class="shenpi-form"><el-form ref="beianShenpiFormRef" :model="form" :rules="rules" label-width="100px"><el-form-item label="技术名称" prop="techName">{{form.techName}}</el-form-item><!--            <el-form-item label="医院名称" prop="hospName">--><!--              {{form.hospName}}--><!--            </el-form-item>--><el-form-item label="申请类型" prop="shenqingLeixing">{{ CaoZuoLeiXingLabelMap[form.shenqingLeixing]  }}</el-form-item><el-form-item label="申请人姓名" prop="shenqingren">{{form.shenqingren}}</el-form-item><el-form-item label="申请日期" prop="shenqingRiqi">{{form.shenqingRiqi}}</el-form-item><el-form-item label="审批人" prop="shenpiRen">{{form.shenqingRiqi}}</el-form-item><el-form-item label="审批时间" prop="shenpiShijian">{{form.shenpiShijian}}</el-form-item><el-form-item label="状态" prop="zhuangtai"><el-tag v-if="form.zhuangtai == '1'" type="warning" effect="light">待审批</el-tag><el-tag v-if="form.zhuangtai == '2'" type="success" effect="light">审批通过</el-tag><el-tag v-if="form.zhuangtai == '3'" type="danger" effect="light">审批驳回</el-tag></el-form-item><el-form-item label="备注" prop="remark">{{form.remark}}</el-form-item><el-form-item label="审批意见" prop="shenpiYijian"><el-input type="textarea" :disabled="form.zhuangtai!=1" :rows="5" v-model="form.shenpiYijian"></el-input></el-form-item><el-form-item label="操作" v-if="form.zhuangtai == '1'"><el-row :gutter="10" style="display: flex; align-items: center;"><el-col :span="12"><el-button type="primary" @click="shenpiTongGuo()" style="width: 100%;">审批通过</el-button></el-col><el-col :span="12"><el-button type="warning" @click="shenpiBohui()" style="width: 100%;">审批驳回</el-button></el-col></el-row></el-form-item></el-form></div></el-card><el-card shadow="hover" style="width:28%; margin-right: 10px;" ><template #header><span style="color: #409EFF;">附件列表</span></template><div class="shenpi-fujians"><div class="file-list" style="max-height: 700px; overflow-y: auto;"><ul class="file-list-ul"><liclass="file-list-item":class="{ selected: showPdfViewer.ossId === item.ossId }":key="item.ossId"@click="handleShowPdfViewer(item)"v-for="item in beianFiles"><span v-if="item.shenQingLeiXing" style="color: red">【{{ CaoZuoLeiXingLabelMap[item.shenQingLeiXing]}}】</span>{{ item.detptAndRenYuanName ? '(' + item.detptAndRenYuanName + ')' + item.cailiaoMingcheng : item.cailiaoMingcheng }}</li></ul></div></div></el-card><div style="height: 100%;width: 70%;" v-if="showPdfViewer.ossId"><oss-pdf-viewer v-if="showPdfViewer.visible" :oss-id="showPdfViewer.ossId"></oss-pdf-viewer></div></div></el-drawer>

style部分:

<style lang="scss">
.shenpi-content {height: 100%;display: flex;gap: 10px;// 表单.shenpi-form {display: flex;}// 附件列表.shenpi-fujians {display: flex;margin-left: 20px;width: 100%;}
}
// 文件列表
.file-list-ul {list-style: none;padding: 0;margin: 0;width: 300px;.file-list-item {width: 100%;padding: 10px;margin-bottom: 5px;background-color: #f9f9f9;border-radius: 4px;cursor: pointer;transition: background-color 0.3s ease;font-size: 14px;&:hover {background-color: #e0e0e0;}&.selected {background-color: #d1e7dd; /* 选中时的背景颜色 */font-weight: bold; /* 选中时的字体加粗 */}}
}
</style>

 pdf组件预览组件:

proxy?.$download.ossBlod(props.ossId)替换成自己的实际下载方法就行返回Promise<Blob>,我用的是若依框架

预览组件:

<template><!--  {{pdfUrl}}--><iframe :src="pdfUrl" style="border: none; width: 100%; height: 100%;"></iframe><!--    <pdf-viewer :pdf-url="pdfUrl"></pdf-viewer>-->
</template><script setup name="OssPdfViewer" lang="ts">
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const props = defineProps({ossId: {type: [String , Number],required: true,},
});
const pdfUrl = ref('')
const handleDownload = () => {proxy?.$download.ossBlod(props.ossId).then(data=>{const blob = new Blob([data],{type:'application/pdf'})let url = window.URL.createObjectURL(blob)pdfUrl.value = url})
}
watch(()=>props.ossId,()=>{handleDownload()
})onMounted(()=>{handleDownload()
})
</script>
http://www.xdnf.cn/news/888535.html

相关文章:

  • 兰亭妙微 | 医疗软件的界面设计能有多专业?
  • 软件测试全攻略:Postman工具的使用
  • 将 WTL 向导集成到 Visual Studio 2022 的完整教程
  • HBuilder 发行Android(apk包)全流程指南
  • MySQL 的锁机制【深度全面】
  • windows命令行面板升级Git版本
  • 4G 模块工作原理及应用场景
  • 【AI News | 20250605】每日AI进展
  • 使用Node.js分片上传大文件到阿里云OSS
  • Gemini开源项目DeepResearch:基于LangGraph的智能研究代理技术原理与实现
  • freeRTOS 消息队列之一个事件添加到消息队列超时怎么处理
  • 【threejs】每天一个小案例讲解
  • Dubbo Logback 远程调用携带traceid
  • 【Algorithm】Segment Tree 简单介绍
  • C#异步编程:从线程到Task的进化之路
  • Linux 内核队列调度相关内核选项详解
  • Java + Spring Boot + Mybatis 插入数据后,获取自增 id 的方法
  • 【.net core】.KMZ文件解压为.KML文件并解析为GEOJSON坐标数据集。附KML处理多线(LineString)闭环问题
  • 【LLIE专题】NTIRE 2025 低照度图像增强第二名方案
  • EtherCAT Module and Slot
  • Python训练第四十五天
  • 中国森林地上和地下植被碳储量数据集(2002~2021)
  • 【EN 18031】访问控制机制(ACM - 3):儿童玩具的防护盾
  • 我认为STM32输入只分为模拟输入 与 数字输入
  • 实现基于Yolo的异常聚集算法
  • 会话技术:Cookie 与 Session 详解
  • Ubuntu崩溃修复方案
  • 基于Java(Jsp+servelet+Javabean)+MySQL实现图书管理系统
  • Vue中实现表格吸底滚动条效果,列太多时左右滚动条始终显示在页面中
  • android知识总结