当前位置: 首页 > 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>

相关文章:

  • 杰理可视化SDK--系统死机异常调试
  • Flask-SQLAlchemy使用小结
  • 力扣LeetBook数组和字符串--二维数组
  • 2025爱分析·银行数字化应用实践报告|爱分析报告
  • 深入解析C++中的extern关键字:跨文件共享变量与函数的终极指南
  • 【C】-递归
  • Redis持久化模式RDB与AOF
  • Word文档重新打开后标题自动缩进的解决方法
  • 数据分析Agent构建
  • android知识总结
  • 网络编程--下篇
  • 聊一聊 .NET在Linux下的IO多路复用select和epoll
  • 逻辑填空(题量最多)
  • 数字图像处理第二次实验
  • C++.读取文件(1.5w字)
  • 高性能分布式消息队列系统(四)
  • OrCAD X Capture CIS设计小诀窍系列第二季--02.如何在Capture中设置元器件不输出到Netlist
  • 嵌入式基础
  • 算法性能分析
  • 资产智慧管理安全监测中心
  • 家乡网络推广方案/宁波seo网站
  • 海外做淘宝网站/刚开的店铺怎么做推广
  • 天津最好的网站建设/广告联盟大全
  • 西安企业网站建设模板/百度竞价推广账户
  • 用花生壳免费域名做公司网站/百度招商客服电话
  • 南阳做网站价格/软文写作范文500字