|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<div :class="prefixCls" class="w-full h-full">
|
|
|
<div
|
|
|
- class="w-full py-4 sm:max-w-540px md:max-w-720px lg:max-w-960px xl:max-w-1140px mx-auto py-4"
|
|
|
+ class="w-full py-4 sm:max-w-540px md:max-w-720px lg:max-w-960px xl:max-w-1140px 2xl:max-w-1600px mx-auto"
|
|
|
>
|
|
|
<nav class="flex justify-between items-center">
|
|
|
<span
|
|
@@ -11,7 +11,7 @@
|
|
|
</nav>
|
|
|
</div>
|
|
|
<div
|
|
|
- class="container w-full py-4 sm:max-w-540px md:max-w-720px lg:max-w-960px xl:max-w-1140px mx-auto"
|
|
|
+ class="container w-full py-4 sm:max-w-540px md:max-w-720px lg:max-w-960px xl:max-w-1140px 2xl:max-w-1600px mx-auto"
|
|
|
>
|
|
|
<div class="flex flex-col h-full">
|
|
|
<section class="content flex h-full">
|
|
@@ -25,44 +25,42 @@
|
|
|
/>
|
|
|
</div>
|
|
|
<div class="rounded-md bg-white h-full right-menu">
|
|
|
- <header class="flex justify-between border-">
|
|
|
- <span class="text-xl">{{ detail.name }}</span>
|
|
|
- <a-button type="success" pre-icon="ic:outline-file-download">下载</a-button>
|
|
|
+ <header class="border-b">
|
|
|
+ <div class="flex justify-between p-4">
|
|
|
+ <div>
|
|
|
+ <span class="text-xl">{{ detail.name }}</span>
|
|
|
+ <span class="text-xl ml-3 font-medium">{{ detail.code2 }}</span>
|
|
|
+ </div>
|
|
|
+ <a-button type="success" pre-icon="ic:outline-file-download" @click="uploadExecl"
|
|
|
+ >下载</a-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
</header>
|
|
|
- <section> </section>
|
|
|
+ <section class="pdf-content">
|
|
|
+ <iframe
|
|
|
+ v-if="showPdf"
|
|
|
+ :src="pdfUrl"
|
|
|
+ frameborder="0"
|
|
|
+ width="100%"
|
|
|
+ height="100%"
|
|
|
+ class="rounded-b-md"
|
|
|
+ ></iframe>
|
|
|
+ <div
|
|
|
+ v-if="detail.name && !detail.pdfData.fid"
|
|
|
+ class="h-full flex justify-center items-center text-2xl"
|
|
|
+ >暂未上传可供预览的pdf文件</div
|
|
|
+ >
|
|
|
+ </section>
|
|
|
</div>
|
|
|
</section>
|
|
|
- <footer>
|
|
|
- <p class="m-0 p-0 text-right text-light-blue-50"
|
|
|
+ <footer class="relative">
|
|
|
+ <p class="m-0 p-0 text-right text-light-blue-50 footer-content"
|
|
|
>主办单位:广东省交通运输工程造价事务中心<span class="px-2">|</span
|
|
|
>技术支持:珠海纵横创新软件有限公司</p
|
|
|
>
|
|
|
</footer>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <!-- <div class="border-b-1 border-gray-400 flex justify-between pb-2">
|
|
|
- <span class="text-lg font-black">设计数量表管理平台</span>
|
|
|
- <AButton size="small" @click="$router.push('/login')">登录</AButton>
|
|
|
- </div>
|
|
|
- <div class="flex py-5 container w-full">
|
|
|
- <div class="w-1/4 border-gray-300 border-1 border overflow-y-scroll overflow-x-hidden">
|
|
|
- <Tree
|
|
|
- v-if="treeData && treeData.length"
|
|
|
- :tree-data="treeData"
|
|
|
- :replace-fields="replaceFields"
|
|
|
- :default-expand-all="true"
|
|
|
- @select="onSelect"
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div class="w-3/4 border-gray-300 border-1 border ml-10">
|
|
|
- <iframe v-if="showPdf" :src="pdfUrl" frameborder="0" width="100%" height="100%"></iframe>
|
|
|
- <div class="w-full h-full flex items-center justify-center">
|
|
|
- <AButton v-show="showExcel" type="primary" size="small" class="mr-4" @click="uploadExecl"
|
|
|
- >下载Excel
|
|
|
- </AButton>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div> -->
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -99,7 +97,12 @@
|
|
|
createTime: '',
|
|
|
showUpload: false
|
|
|
})
|
|
|
- const detail = ref({ name: '', content: '', filepath: '', filename: '', ext: '', fid: '' })
|
|
|
+ const detail = ref({
|
|
|
+ name: '',
|
|
|
+ code2: '',
|
|
|
+ pdfData: { content: '', filepath: '', filename: '', ext: '', fid: '' },
|
|
|
+ excelData: { content: '', filepath: '', filename: '', ext: '', fid: '' }
|
|
|
+ })
|
|
|
async function initData() {
|
|
|
const result = await sectionAllApi()
|
|
|
treeData.value = (result && result[0].children) || []
|
|
@@ -148,32 +151,25 @@
|
|
|
initSectionDetail(row.id)
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
- const showExcel = computed(() => {
|
|
|
- if (!detail.value.fid) {
|
|
|
- return false
|
|
|
- }
|
|
|
- return /.(excel)|(xls)|(xlsl)$/.test(detail.value.ext)
|
|
|
- })
|
|
|
-
|
|
|
+ const showExcelDownload = computed(() => detail.value.excelData.fid)
|
|
|
const showPdf = computed(() => {
|
|
|
- if (!detail.value.fid) {
|
|
|
- return false
|
|
|
- }
|
|
|
- const isPdf = /.(pdf)|(PDF)$/.test(detail.value.ext)
|
|
|
- if (!isPdf) {
|
|
|
+ if (!detail.value.pdfData.fid) {
|
|
|
return false
|
|
|
}
|
|
|
return true
|
|
|
})
|
|
|
-
|
|
|
- const pdfUrl = computed(() => 'http://localhost:7070' + detail.value.filepath)
|
|
|
-
|
|
|
const uploadExecl = () => {
|
|
|
downloadByUrl({
|
|
|
- url: 'http://localhost:7070' + detail.value.filepath
|
|
|
+ url: 'http://sj.6jlzf.cn/api/upload/file?id=' + detail.value.excelData.fid
|
|
|
+ // url: 'http://localhost:7070/api/upload/file?id=' + detail.value.excelData.fid
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+ const pdfUrl = computed(
|
|
|
+ // () => 'http://sj.6jlzf.cn/api/upload/file?id=' + detail.value.pdfData.fid
|
|
|
+ () => 'http://sj.6jlzf.cn/static' + detail.value.pdfData.filepath
|
|
|
+ )
|
|
|
+
|
|
|
const { prefixCls } = useDesign('preview')
|
|
|
const replaceFields = { children: 'children', title: 'name', key: 'id' }
|
|
|
return {
|
|
@@ -185,7 +181,7 @@
|
|
|
pdfUrl,
|
|
|
uploadExecl,
|
|
|
title: computed(() => globSetting?.title ?? ''),
|
|
|
- showExcel,
|
|
|
+ showExcelDownload,
|
|
|
detail
|
|
|
}
|
|
|
}
|
|
@@ -210,8 +206,16 @@
|
|
|
flex: 0 0 75%;
|
|
|
max-width: 75%;
|
|
|
margin-left: 15px;
|
|
|
+ .pdf-content {
|
|
|
+ height: calc(100% - 2rem - 33px);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ .footer-content {
|
|
|
+ position: absolute;
|
|
|
+ right: 0;
|
|
|
+ bottom: -2rem;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</style>
|