252 lines
5.8 KiB
Plaintext
252 lines
5.8 KiB
Plaintext
<script setup lang="ts">
|
||
import { getFootprintList } from "@/api/daikin/base";
|
||
import HomeHead from "@/views/home/components/HomeHead.vue";
|
||
import { useMessage } from 'naive-ui'
|
||
const message = useMessage()
|
||
const { push } = useRouter();
|
||
|
||
const route = useRoute()
|
||
|
||
|
||
const download = async (row)=>{
|
||
// console.log(row)
|
||
if(!row) return
|
||
if(row.isSelect===2){
|
||
message.error("没有访问权限")
|
||
return
|
||
}
|
||
let {filePath} = row
|
||
if(!filePath) {
|
||
message.info("没有可预览文件!")
|
||
return
|
||
}
|
||
srcType.value = getLastSubstring(filePath)
|
||
if(['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx','pdf'].includes(srcType.value)){
|
||
// src.value = filePath
|
||
// pdfShow.value = true
|
||
filePath='https://view.xdocin.com/view?src='+filePath
|
||
const screenWidth = window.screen.width;
|
||
const screenHeight = window.screen.height;
|
||
window.open(filePath, '', 'width=' + screenWidth + ',height=' + screenHeight + ',top=' + 0 + ',left=' + 0)
|
||
}
|
||
else{
|
||
message.error("文件格式不是 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx','pdf'!")
|
||
}
|
||
}
|
||
|
||
const pageInfo = reactive({
|
||
pageNum:1,
|
||
pageSize:15,
|
||
total:10
|
||
})
|
||
|
||
|
||
const tableData = ref()
|
||
const getZu=async ()=>{
|
||
const {pageNum, pageSize } = pageInfo;
|
||
const { rows,total } = await getFootprintList({ pageNum, pageSize, moduleId: "2"});
|
||
tableData.value = rows
|
||
pageInfo.total = total
|
||
|
||
}
|
||
|
||
onMounted(() => {
|
||
getZu()
|
||
});
|
||
const lazyState = computed(() => [pageInfo.pageNum])
|
||
watch(
|
||
() => unref(lazyState),
|
||
async (v) => {
|
||
getZu()
|
||
},
|
||
{ immediate: true, deep: true },
|
||
)
|
||
|
||
const handleSizeChange=(e)=>{
|
||
console.log(e)
|
||
}
|
||
|
||
const handleCurrentChange=(e)=>{
|
||
console.log(e)
|
||
}
|
||
|
||
const toDetail = (obj) => {
|
||
console.log(obj);
|
||
if (obj.isSelect === 2) {
|
||
message.info("没有访问权限");
|
||
return;
|
||
} else {
|
||
openUrl(obj.filePath[0].url);
|
||
}
|
||
};
|
||
const srcType = ref();
|
||
const openUrl = async (url) => {
|
||
if (!url) {
|
||
message.info("没有可预览文件!");
|
||
return;
|
||
}
|
||
srcType.value = getLastSubstring(url);
|
||
if (
|
||
["doc", "docx", "ppt", "pptx", "xls", "xlsx", "pdf"].includes(srcType.value)
|
||
) {
|
||
// src.value = filePath
|
||
// pdfShow.value = true
|
||
url = "https://view.xdocin.com/view?src=" + url;
|
||
const screenWidth = window.screen.width;
|
||
const screenHeight = window.screen.height;
|
||
window.open(
|
||
url,
|
||
"",
|
||
"width=" +
|
||
screenWidth +
|
||
",height=" +
|
||
screenHeight +
|
||
",top=" +
|
||
0 +
|
||
",left=" +
|
||
0
|
||
);
|
||
} else {
|
||
message.error(
|
||
"文件格式不是 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx','pdf'!"
|
||
);
|
||
}
|
||
};
|
||
function getLastSubstring(str: string): string {
|
||
const lastIndex = str.lastIndexOf(".");
|
||
if (lastIndex !== -1) {
|
||
return str.substring(lastIndex + 1);
|
||
} else {
|
||
return "";
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<template>
|
||
<HomeHead class="top"></HomeHead>
|
||
<div class="page w-full h-full flex bg-#fff rd-20px p30px">
|
||
|
||
<div class=" relative w-full h-910px">
|
||
<table
|
||
class="history w-full text-center text-16px border-spacing-0"
|
||
>
|
||
<thead
|
||
style="
|
||
background-color: #e7edff;
|
||
color: #0a0a0a;
|
||
height: 50px;
|
||
width: 220px;
|
||
border: 1px solid #417bef;
|
||
"
|
||
>
|
||
<tr class="text-20px leading-50px">
|
||
<th width="70%">
|
||
标题
|
||
</th>
|
||
<th width="30%">
|
||
时间
|
||
</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody >
|
||
<tr v-if="tableData" v-for="(it, index) in tableData" :key="index">
|
||
<td class="h50px"><span class="download text-#000 text-16px" @click="toDetail(it)">{{ it.title}}</span></td>
|
||
<td class="h50px"><span class="text-#000 text-16px" >{{ it.createTime}}</span></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
<div class="float-right absolute bottom-20px right-30px">
|
||
<el-pagination v-model:current-page="pageInfo.pageNum" v-model:page-size="pageInfo.pageSize"
|
||
layout="prev, pager, next, jumper" :total="pageInfo.total"
|
||
@size-change="handleSizeChange" @current-change="handleCurrentChange" />
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
</template>
|
||
|
||
<style scoped lang="less">
|
||
.download {
|
||
cursor: pointer;
|
||
}
|
||
.download:hover {
|
||
color: #00E4FF;
|
||
}
|
||
.top {
|
||
position: absolute;
|
||
right: 30px;
|
||
top: -92px;
|
||
}
|
||
.download {
|
||
cursor: pointer;
|
||
}
|
||
.download:hover {
|
||
color: #00E4FF;
|
||
}
|
||
.nav {
|
||
&::before {
|
||
top: -48px;
|
||
}
|
||
.child:hover {
|
||
text-decoration: underline;
|
||
}
|
||
.childs:hover {
|
||
text-decoration: underline;
|
||
}
|
||
|
||
&::after {
|
||
bottom: -49px;
|
||
transform: rotate(-90deg);
|
||
}
|
||
|
||
&.active {
|
||
color: #002fa7;
|
||
background-color: #e6ecff;
|
||
|
||
a {
|
||
color: #002fa7;
|
||
}
|
||
|
||
&::before,
|
||
&::after {
|
||
opacity: 1;
|
||
}
|
||
}
|
||
|
||
&.actives {
|
||
padding: 0px !important;
|
||
color: #002fa7;
|
||
background-color: #f5f8ff;
|
||
|
||
a {
|
||
color: #002fa7;
|
||
}
|
||
|
||
&::before,
|
||
&::after {
|
||
opacity: 1;
|
||
}
|
||
|
||
.onActive {
|
||
background-color: #e6ecff;
|
||
border-radius: 32px 0 0 32px;
|
||
|
||
padding: 24px 36px 24px 36px;
|
||
}
|
||
}
|
||
}
|
||
|
||
.main {
|
||
width: 100%;
|
||
height: 95%;
|
||
background-color: #4877fb;
|
||
}
|
||
|
||
&::-webkit-scrollbar {
|
||
display: none;
|
||
scrollbar-width: none;
|
||
}
|
||
</style>
|