|
@@ -1,14 +1,27 @@
|
|
|
<template>
|
|
|
- <div class="container" v-if="!showPreview">
|
|
|
+<div class="container">
|
|
|
<div class="logo">
|
|
|
<img src="@/assets/images/Frame_427319127.png" alt="" />
|
|
|
<div class="font">聚合智慧文档管理系统</div>
|
|
|
</div>
|
|
|
<div class="search_box">
|
|
|
- <el-select v-model="selectValue" class="m-2" popper-class="typeSelect" placeholder="Select" size="large">
|
|
|
- <el-option v-for="item in selectOptions" :key="item.value" :label="item.label" :value="item.value">
|
|
|
+ <el-select
|
|
|
+ v-model="selectValue"
|
|
|
+ class="m-2"
|
|
|
+ popper-class="typeSelect"
|
|
|
+ placeholder="Select"
|
|
|
+ size="large"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in selectOptions"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ >
|
|
|
<span style="float: left">{{ item.label }}</span>
|
|
|
- <div v-if="item.value === selectValue" style="
|
|
|
+ <div
|
|
|
+ v-if="item.value === selectValue"
|
|
|
+ style="
|
|
|
position: relative;
|
|
|
right: -13px;
|
|
|
color: #000;
|
|
@@ -16,21 +29,32 @@
|
|
|
font-size: 13px;
|
|
|
text-align: right;
|
|
|
box-sizing: border-box;
|
|
|
- ">
|
|
|
+ "
|
|
|
+ >
|
|
|
✓
|
|
|
</div>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
<div class="line">|</div>
|
|
|
- <el-input class="search_ipt" v-model="searchText" maxlength="32" @keydown.enter="doSearch"
|
|
|
- placeholder="请输入要查询的内容" />
|
|
|
- <div class="search_btn" @click="doSearch" style="cursor: pointer;">搜索</div>
|
|
|
+ <el-input
|
|
|
+ class="search_ipt"
|
|
|
+ v-model="searchText"
|
|
|
+ maxlength="32"
|
|
|
+ @keydown.enter="doSearch"
|
|
|
+ placeholder="请输入要查询的内容"
|
|
|
+ />
|
|
|
+ <div class="search_btn" @click="doSearch" style="cursor: pointer">搜索</div>
|
|
|
</div>
|
|
|
<div class="result_box">
|
|
|
<div class="left_box" v-if="listData.length">
|
|
|
<div class="dataNum">共查询到{{ total }}个相关结果</div>
|
|
|
</div>
|
|
|
- <div class="content_box" v-infinite-scroll="setScroll" infinite-scroll-distance="30" v-if="listData.length">
|
|
|
+ <div
|
|
|
+ class="content_box"
|
|
|
+ v-infinite-scroll="setScroll"
|
|
|
+ infinite-scroll-distance="30"
|
|
|
+ v-if="listData.length"
|
|
|
+ >
|
|
|
<!-- <el-scrollbar height="200px" ref="scrollRef" id="scrollRef"> -->
|
|
|
<div class="oneBox" v-for="item in listData" :key="item.id">
|
|
|
<span class="fileName" @click="toPreview(item)">{{
|
|
@@ -40,7 +64,12 @@
|
|
|
<img src="@/assets/images/bx:bx-time-five.png" alt="" />
|
|
|
<span>{{ item.content.docInfo.createTime }}</span>
|
|
|
</div>
|
|
|
- <div class="flieContent" v-for="par in item.highlightFields.content" :key="par" v-html="par"></div>
|
|
|
+ <div
|
|
|
+ class="flieContent"
|
|
|
+ v-for="par in item.highlightFields.content"
|
|
|
+ :key="par"
|
|
|
+ v-html="par"
|
|
|
+ ></div>
|
|
|
</div>
|
|
|
<div class="showAll" v-if="beEnd">已经到达底部~</div>
|
|
|
<!-- </el-scrollbar> -->
|
|
@@ -51,10 +80,13 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div v-else class="preview">
|
|
|
- <FileEdit :docId="clickRowId" :copyRow="copyRow" :historyPrew="historyPrew" :historycopyRow="historycopyRow"
|
|
|
- :onlyView="onlyView"></FileEdit>
|
|
|
- </div>
|
|
|
+ <ImgPreview
|
|
|
+ :previewData="previewData"
|
|
|
+ :copyFileType="copyFileType"
|
|
|
+ :showPreview="showPreview"
|
|
|
+ @closeImgPreview="closeImgPreview"
|
|
|
+ ></ImgPreview>
|
|
|
+ <div v-loading.fullscreen="loadingPreview" v-if="loadingPreview" class="lodingBox"></div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
@@ -62,6 +94,8 @@ import { onMounted, ref, inject } from "vue";
|
|
|
import { search } from "@/api/search/search.js";
|
|
|
import FileEdit from "@/views/myfile/components/FileEdit.vue";
|
|
|
import iFrame from "@/components/iFrame/index.vue";
|
|
|
+import ImgPreview from "@/components/ImgPreview/ImgPreview.vue";
|
|
|
+import { preview } from "@/api/common/common.js";
|
|
|
// import IdentifyFont from "@/components/IdentifyFont/IdentifyFont.vue";
|
|
|
const searchText = ref(""); //搜索ipt的值
|
|
|
const selectValue = ref(1); //文档空间类型
|
|
@@ -78,7 +112,11 @@ const historyPrew = ref();
|
|
|
const historycopyRow = ref(false);
|
|
|
const onlyView = ref(false);
|
|
|
const showPreview = ref(false);
|
|
|
+const loadingPreview = ref(false)
|
|
|
+const previewData = ref(); //需要预览的文件的数据
|
|
|
+const copyFileType = ref()
|
|
|
const addFileTab = inject("addFileTab");
|
|
|
+const imgTypeArr = [".png", ".jpg", ".jpeg", ".JPG", ".PNG"];
|
|
|
const selectOptions = [
|
|
|
{ label: "公共文档", value: 1 },
|
|
|
{ label: "部门文档", value: 2 },
|
|
@@ -89,7 +127,7 @@ const selectOptions = [
|
|
|
const openFile = ref(true);
|
|
|
// ----------------------------
|
|
|
|
|
|
-onMounted(async () => { });
|
|
|
+onMounted(async () => {});
|
|
|
|
|
|
const doSearch = async () => {
|
|
|
if (!searchText.value) {
|
|
@@ -153,13 +191,23 @@ const setScroll = async () => {
|
|
|
};
|
|
|
const addTab = inject("addTab");
|
|
|
// 预览事件
|
|
|
-const toPreview = (item) => {
|
|
|
- addFileTab(item.content.docInfo);
|
|
|
+const toPreview = async (item) => {
|
|
|
console.log("item", item);
|
|
|
- // clickRowId.value = item.content.docInfo.docId;
|
|
|
- // copyRow.value = item.content.docInfo;
|
|
|
- // showPreview.value = true;
|
|
|
+ loadingPreview.value = true
|
|
|
+ if (imgTypeArr.some((par) => par == item.content.docInfo.fileType)) {
|
|
|
+ const res = await preview(item.content.docInfo.docId);
|
|
|
+ showPreview.value = true;
|
|
|
+ previewData.value = URL.createObjectURL(res);
|
|
|
+ copyFileType.value = item.content.docInfo.fileType
|
|
|
+ loadingPreview.value = false
|
|
|
+ }
|
|
|
+ // addFileTab(item.content.docInfo);
|
|
|
};
|
|
|
+//关闭图片预览事件
|
|
|
+const closeImgPreview = () => {
|
|
|
+ // console.log('close');
|
|
|
+ showPreview.value = false
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
@@ -362,7 +410,6 @@ const toPreview = (item) => {
|
|
|
<style lang="scss">
|
|
|
//鼠标移动上去的选中色
|
|
|
.typeSelect {
|
|
|
-
|
|
|
.el-select-dropdown__item.hover,
|
|
|
.el-select-dropdown__item:hover {
|
|
|
background: #f5f7f9 !important;
|