Sfoglia il codice sorgente

高级搜索跳转预览

liuQiang 2 anni fa
parent
commit
ddad109ae6

+ 1 - 1
src/views/collect/index.vue

@@ -375,7 +375,7 @@ const delTabs = async () => {
 // TODO 按标签获取收藏数据,实现文件夹收藏功能,文件夹右键菜单和文件右键菜单样式统一
 //获取收藏数据
 const getCollectList = async () => {
-  const res = await listFavoriteById(17);
+  const res = await listFavorite();
   console.log("collectres = ", res);
   if (res.code === 200 && res.rows.length > 0) {
     tableData.value = res.rows;

+ 34 - 3
src/views/highSearch/HighSearch.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="container">
+  <div class="container" v-if="!showPreview">
     <div class="logo">
       <img src="@/assets/images/Frame_427319127.png" alt="" />
       <div class="font">聚合智慧文档管理系统</div>
@@ -40,6 +40,7 @@
         class="search_ipt"
         v-model="searchText"
         maxlength="32"
+        @keydown.enter="doSearch"
         placeholder="请输入要查询的内容"
       />
       <div class="search_btn" @click="doSearch">搜索</div>
@@ -56,7 +57,9 @@
       >
         <!-- <el-scrollbar height="200px"  ref="scrollRef" id="scrollRef"> -->
         <div class="oneBox" v-for="item in listData" :key="item.id">
-          <span class="fileName">{{ item.content.docInfo.fileName }}</span>
+          <span class="fileName" @click="toPreview(item)">{{
+            item.content.docInfo.fileName
+          }}</span>
           <div class="flieTime">
             <img src="@/assets/images/bx:bx-time-five.png" alt="" />
             <span>{{ item.content.docInfo.createTime }}</span>
@@ -76,13 +79,22 @@
         <span>没有关于“{{ noFound }}”的结果 </span>
       </div>
     </div>
-    <!-- <IdentifyFont :openFile="openFile"></IdentifyFont> -->
   </div>
+  <divv v-else class="preview">
+    <FileEdit
+      :docId="clickRowId"
+      :copyRow="copyRow"
+      :historyPrew="historyPrew"
+      :historycopyRow="historycopyRow"
+      :onlyView="onlyView"
+    ></FileEdit>
+  </divv>
 </template>
 
 <script setup>
 import { onMounted, ref } from "vue";
 import { search } from "@/api/search/search.js";
+import FileEdit from "@/views/myfile/components/FileEdit.vue";
 // import IdentifyFont from "@/components/IdentifyFont/IdentifyFont.vue";
 const searchText = ref(""); //搜索ipt的值
 const selectValue = ref(1); //文档空间类型
@@ -93,6 +105,12 @@ const noData = ref(false); //没有搜索出数据
 const beEnd = ref(false); //拉到最底部了
 const listData = ref([]);
 const noFound = ref(); //没有结果的text
+const clickRowId = ref();
+const copyRow = ref();
+const historyPrew = ref();
+const historycopyRow = ref(false);
+const onlyView = ref(false);
+const showPreview = ref(false);
 const selectOptions = [
   { label: "公共文档", value: 1 },
   { label: "部门文档", value: 2 },
@@ -165,9 +183,22 @@ const setScroll = async () => {
     beEnd.value = true;
   }
 };
+// 预览事件
+const toPreview = (item) => {
+  console.log("item", item);
+  clickRowId.value = item.content.docInfo.docId;
+  copyRow.value = item.content.docInfo;
+  showPreview.value = true;
+};
 </script>
 
 <style lang="scss" scoped>
+.preview {
+  width: 100%;
+  height: 100%;
+  background-color: #fff;
+  overflow: hidden;
+}
 .container {
   height: 100%;
   background-color: #fff;

+ 26 - 6
src/views/myfile/MyFile.vue

@@ -138,6 +138,10 @@
                                 <el-table-column label="名称" width="180">
                                     <template #default="scope">
                                         <span>
+                                            <el-icon v-if="scope.row.isFavorite == 'N'">
+                                                <Star />
+                                            </el-icon>
+                                            <img v-else src="../../assets/images/yellowstar.png" alt="">
                                             <img src="../../assets/images/fileBox.png" style="width: 20px;height: 24px;"
                                                 alt="">
                                             {{ scope.row.dirName }}
@@ -189,7 +193,7 @@
                                 <el-table-column label="名称" width="200">
                                     <template #default="scope">
                                         <span style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
-                                            <el-icon v-if="collectImg">
+                                            <el-icon v-if="scope.row.isFavorite == 'N'">
                                                 <Star />
                                             </el-icon>
                                             <img v-else src="../../assets/images/yellowstar.png" alt="">
@@ -291,7 +295,7 @@
             <!-- 文件收藏 -->
             <div>
                 <FileCollect v-if="collects" :collects="collects" @getCollects="getCollects" :copyFileName="copyFileName"
-                    :copyFileId="copyFileId" :isFolder="isFolder" :clickRow="clickRow"></FileCollect>
+                    :copyFileId="copyFileId" @refreshFile="refreshFile" :isFolder="isFolder" :clickRow="clickRow"></FileCollect>
             </div>
             <!-- 中栏重命名 -->
             <div>
@@ -920,8 +924,12 @@ export default {
         function folderClick(row, list) {
             // 上一级dirId就是下一级的parentId
             // 判断是点击打开还是右键菜单打开
-            row = row ? row : thisFolder.value
-            // console.log('row', toRaw(row));
+            if(row){
+                thisFolder.value = row;
+            }else{
+                row =thisFolder.value
+            }
+            console.log('row', toRaw(row));
             topPath.value = row.dirPath
             // console.log('topPath',toRaw(topPath.value));
             newDirId.value = row.dirId
@@ -1061,9 +1069,10 @@ export default {
         const collectFolder = ()=>{
             isFolder.value = 'Y'
             clickRow.value = thisFolder.value
+            // thisFolder.value = ''
             copyFileName.value = thisFolder.value.dirName
             collects.value = true
-            console.log('thisFolder',thisFolder.value);
+            // console.log('thisFolder',thisFolder.value);
         }
         // 左箭头事件
         const arrowLift = ()=>{
@@ -1104,6 +1113,16 @@ export default {
                 fileGrid.value = true
             }
         }
+        //点击收藏后刷新文件
+        const refreshFile = ()=>{
+            if(thisFolder.value){//如果点开了文件夹
+            // console.log(111);
+               folderClick()
+            }else{
+            // console.log(222);
+                getAllTop()
+            }
+        }
         onMounted(() => {
             getAllTop()
             getSpaceList()
@@ -1248,7 +1267,8 @@ export default {
             folderGrid,
             gridChange,
             collectFolder,
-            arrowLift
+            arrowLift,
+            refreshFile
         }
     },
     watch: {

+ 2 - 0
src/views/myfile/modalComponebts/FileCollect.vue

@@ -112,6 +112,7 @@ export default {
         }
         // 确认收藏
         function sureCollect() {
+            // console.log('clickRow',props.clickRow.value);
             let query = {}
             if(props.isFolder === "Y"){
                 query = {
@@ -136,6 +137,7 @@ export default {
             })
             fileCollect.value = false
             emit("getCollects", fileCollect.value)
+            emit("refreshFile")
         }
         function tobacks() {
             fileCollect.value = false