wukai пре 2 година
родитељ
комит
3a501fd4dc

+ 5 - 1
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/config/EsConfig.java

@@ -9,7 +9,11 @@ import org.springframework.stereotype.Component;
  */
 @Component(value = "esConfig")
 public class EsConfig {
-    public static String indexName;
+    private String indexName;
+
+    public void setIndexName(String indexName) {
+        this.indexName = indexName;
+    }
 
     public String getIndexName() {
         return indexName;

+ 29 - 12
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/controller/ElasticSearchController.java

@@ -1,11 +1,14 @@
 package com.jjt.doc.controller;
 
 import com.alibaba.fastjson2.JSON;
+import com.jjt.common.security.utils.SecurityUtils;
 import com.jjt.doc.config.EsConfig;
 import com.jjt.doc.domain.DocInfo;
 import com.jjt.doc.domain.EsDocInfo;
 import com.jjt.doc.domain.HelloEntity;
+import com.jjt.doc.enums.DocOfType;
 import com.jjt.doc.service.IDocInfoService;
+import com.jjt.doc.service.IElasticSearchService;
 import com.jjt.doc.service.IEsDocInfoService;
 import com.jjt.doc.service.HelloDao;
 import org.elasticsearch.index.query.MatchQueryBuilder;
@@ -40,17 +43,20 @@ public class ElasticSearchController {
     private IEsDocInfoService esDocInfoService;
     @Resource
     private IDocInfoService infoService;
+    @Resource
+    private IElasticSearchService elasticSearchService;
+    @Resource
+    private EsConfig esConfig;
 
 
     /**
-     * 创建索引 hello
+     * 创建索引,并创建Mapping
      *
      * @return
      */
     @GetMapping("/createIndex")
-    public String create() {
-        System.err.println(elasticsearchRestTemplate.indexOps(HelloEntity.class).getMapping());
-        boolean b = elasticsearchRestTemplate.indexOps(HelloEntity.class).create();
+    public String createIndex(@RequestParam(value = "name") String name) {
+        boolean b = elasticSearchService.createIndex(name);
         if (b) {
             return "success";
         }
@@ -58,14 +64,13 @@ public class ElasticSearchController {
     }
 
     /**
-     * 创建索引 hello,并创建mapping
+     * 查询索引是否存在
      *
      * @return
      */
-    @GetMapping("/createIndexWithMapping")
-    public String createMapping() {
-        EsConfig.indexName = "doc_123";
-        boolean b = elasticsearchRestTemplate.indexOps(EsDocInfo.class).createWithMapping();
+    @GetMapping("/exists")
+    public String isExists(@RequestParam(value = "name") String name) {
+        boolean b = elasticSearchService.isExists(name);
         if (b) {
             return "success";
         }
@@ -119,6 +124,7 @@ public class ElasticSearchController {
      */
     @GetMapping("/{id}")
     public String get(@PathVariable(value = "id") Long id) {
+        esConfig.setIndexName("docs");
         Optional<EsDocInfo> byId = esDocInfoService.findById(id);
         boolean present = byId.isPresent();
         if (present) {
@@ -137,7 +143,7 @@ public class ElasticSearchController {
     @GetMapping("/getAll")
     public String getAll(@RequestParam(value = "page") int page, @RequestParam(value = "size") int size) {
         PageRequest pageable = PageRequest.of(page, size);
-        EsConfig.indexName = "doc_123";
+        esConfig.setIndexName("docs_public");
         Page<EsDocInfo> all = esDocInfoService.findAll(pageable);
         return JSON.toJSONString(all);
     }
@@ -195,8 +201,19 @@ public class ElasticSearchController {
      * @return
      */
     @GetMapping("/query")
-    public String query(@RequestParam(value = "content", required = true) String content, @RequestParam(value = "page") int page, @RequestParam(value = "size") int size) {
-        EsConfig.indexName = "docs";
+    public String query(@RequestParam(value = "type", required = true) String type, @RequestParam(value = "content", required = true) String content, @RequestParam(value = "page") int page, @RequestParam(value = "size") int size) {
+        String indexName = "";
+        if (type.equals(DocOfType.PUBLIC.getValue())) {
+            indexName = "docs_public";
+        } else if (type.equals(DocOfType.DEPT.getValue())) {
+            indexName = "docs_dept_" + SecurityUtils.getLoginUser().getSysUser().getDeptId();
+        } else if (type.equals(DocOfType.PERSONAL.getValue())) {
+            indexName = "docs_personal_" + SecurityUtils.getUserId();
+//        } else if (type.equals(DocOfType.GROUP.getValue())) {
+//            indexName = "docs_group_" + space.getOwner();
+//            分组暂时没想好怎么做
+        }
+        esConfig.setIndexName(indexName);
         List<SearchHit<EsDocInfo>> all = esDocInfoService.findByContent(content, PageRequest.of(page, size));
         for (SearchHit<EsDocInfo> re : all) {
             EsDocInfo esDocInfo = re.getContent();

+ 0 - 38
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/controller/OcrController.java

@@ -1,38 +0,0 @@
-package com.jjt.doc.controller;
-
-import cn.hutool.http.HttpUtil;
-import com.jjt.common.core.utils.poi.ExcelUtil;
-import com.jjt.common.core.web.controller.BaseController;
-import com.jjt.common.core.web.domain.AjaxResult;
-import com.jjt.common.core.web.page.TableDataInfo;
-import com.jjt.common.log.annotation.Log;
-import com.jjt.common.log.enums.BusinessType;
-import com.jjt.common.security.annotation.RequiresPermissions;
-import com.jjt.common.security.utils.SecurityUtils;
-import com.jjt.doc.domain.DocTag;
-import com.jjt.doc.service.IDocTagService;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletResponse;
-import java.util.List;
-
-/**
- * 文档标签Controller
- *
- * @author wukai
- * @date 2023-04-24
- */
-@RestController
-@RequestMapping("/ocr")
-public class OcrController extends BaseController {
-
-    /**
-     * 查询文档标签列表
-     */
-    @GetMapping("/upload")
-    public TableDataInfo list(@RequestParam("file") MultipartFile multipartFile) {
-        return null;
-    }
-}

+ 56 - 0
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/domain/DocShare.java

@@ -74,6 +74,62 @@ public class DocShare extends BaseEntity {
      */
     private List<DocTag> tagList;
 
+    /**
+     * 文档大小
+     */
+    @TableField(exist = false)
+    private Long docSize;
+
+    /**
+     * 文档描述
+     */
+    @TableField(exist = false)
+    private String docDesc;
+
+    /**
+     * 文档级别
+     */
+    @TableField(exist = false)
+    private Long docLevel;
+
+    /**
+     * 文档归属;公共文档存储个人ID,部门文档存储部门ID,个人文档存储用户ID,分组文档存储分组ID
+     */
+    private Long owner;
+
+
+    public Long getDocSize() {
+        return docSize;
+    }
+
+    public void setDocSize(Long docSize) {
+        this.docSize = docSize;
+    }
+
+    public String getDocDesc() {
+        return docDesc;
+    }
+
+    public void setDocDesc(String docDesc) {
+        this.docDesc = docDesc;
+    }
+
+    public Long getDocLevel() {
+        return docLevel;
+    }
+
+    public void setDocLevel(Long docLevel) {
+        this.docLevel = docLevel;
+    }
+
+    public Long getOwner() {
+        return owner;
+    }
+
+    public void setOwner(Long owner) {
+        this.owner = owner;
+    }
+
     public List<DocTag> getTagList() {
         return tagList;
     }

+ 8 - 0
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/mapper/DocSpaceMapper.java

@@ -2,6 +2,7 @@ package com.jjt.doc.mapper;
 
 import java.util.List;
 import com.jjt.doc.domain.DocSpace;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 存储空间Mapper接口
@@ -65,4 +66,11 @@ public interface DocSpaceMapper
      * @return 结果
      */
     public int deleteDocSpace(DocSpace docSpace);
+    /**
+     * 通过目录ID查询空间信息
+     *
+     * @param dirId 目录ID
+     * @return 存储空间
+     */
+    DocSpace selectDocSpaceByDirId(@Param("dirId") Long dirId);
 }

+ 8 - 0
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/service/IDocSpaceService.java

@@ -20,6 +20,14 @@ public interface IDocSpaceService {
     public DocSpace selectDocSpaceBySpaceId(Long spaceId);
 
     /**
+     * 通过目录ID查询空间信息
+     *
+     * @param dirId 目录ID
+     * @return 存储空间
+     */
+    public DocSpace selectDocSpaceByDirId(Long dirId);
+
+    /**
      * 查询存储空间列表
      *
      * @param docSpace 存储空间

+ 32 - 0
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/service/IElasticSearchService.java

@@ -0,0 +1,32 @@
+package com.jjt.doc.service;
+
+import com.jjt.doc.domain.EsDocInfo;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.elasticsearch.annotations.Highlight;
+import org.springframework.data.elasticsearch.annotations.HighlightField;
+import org.springframework.data.elasticsearch.core.SearchHit;
+import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
+
+import java.util.List;
+
+
+/**
+ * @author wukai
+ */
+public interface IElasticSearchService {
+    /**
+     * 创建索引
+     *
+     * @param indexName
+     * @return
+     */
+    public boolean createIndex(String indexName);
+
+    /**
+     * 查询索引是否存在
+     *
+     * @param indexName
+     * @return
+     */
+    public boolean isExists(String indexName);
+}

+ 36 - 4
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/service/impl/DocInfoServiceImpl.java

@@ -3,12 +3,14 @@ package com.jjt.doc.service.impl;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.InputStream;
+import java.math.BigDecimal;
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.util.*;
 import java.util.function.Function;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.jjt.common.core.constant.Constants;
 import com.jjt.common.core.utils.DateUtils;
 import com.jjt.common.core.utils.FileContentUtils;
 import com.jjt.common.core.utils.StringUtils;
@@ -17,6 +19,7 @@ import com.jjt.common.core.utils.uuid.Seq;
 import com.jjt.common.security.utils.SecurityUtils;
 import com.jjt.doc.config.EsConfig;
 import com.jjt.doc.domain.*;
+import com.jjt.doc.enums.DocOfType;
 import com.jjt.doc.mapper.DocTagMapper;
 import com.jjt.doc.mapper.DocTagRelaMapper;
 import com.jjt.doc.service.*;
@@ -49,6 +52,10 @@ public class DocInfoServiceImpl implements IDocInfoService {
     private DocTagMapper tagMapper;
     @Resource
     private DocTagRelaMapper tagRelaMapper;
+    @Resource
+    private EsConfig esConfig;
+    @Resource
+    private IDocSpaceService docSpaceService;
 
     /**
      * 查询文档基本信息
@@ -109,6 +116,9 @@ public class DocInfoServiceImpl implements IDocInfoService {
             infoDir.setDocId(docInfo.getDocId());
             infoDir.setDocYear(docInfo.getCreateYear());
             infoDirService.insertDocInfoDir(infoDir);
+            //获取空间信息
+
+            DocSpace space = docSpaceService.selectDocSpaceByDirId(docInfo.getDirId());
 
             //读取文件内容存储至ES数据库 START
             String localFilePath = remoteFileService.localFilePath4RemoteFilePath(docInfo.getDocPath()).getData();
@@ -116,11 +126,16 @@ public class DocInfoServiceImpl implements IDocInfoService {
             //获取文件扩展名
             int dot = localFilePath.lastIndexOf(".");
             String ext = localFilePath.substring(dot + 1);
-            insertEs(file, ext, docInfo.getDocId(), docInfo.getCreateYear());
+            insertEs(file, ext, docInfo.getDocId(), docInfo.getCreateYear(), space);
             //读取文件内容存储至ES数据库 END
 
             //文件大小,以KB保存
             docInfo.setDocSize(file.length() / 1024);
+            BigDecimal usedCap = space.getUsedCap();
+            //转换成GB
+            BigDecimal docSize = new BigDecimal(docInfo.getDocSize()).divide(BigDecimal.valueOf(1024*1024));
+            space.setUsedCap(usedCap.add(docSize));
+            docSpaceService.updateDocSpace(space);
             //文件类型
             docInfo.setDocType(ext);
 
@@ -137,7 +152,19 @@ public class DocInfoServiceImpl implements IDocInfoService {
     /**
      * 文件内容入es库
      */
-    private void insertEs(File file, String ext, Long docId, Long year) {
+    private void insertEs(File file, String ext, Long docId, Long year, DocSpace space) {
+
+        //组装ES索引名
+        String indexName = "docs";
+        if (space.getSpaceType().equals(DocOfType.PUBLIC.getValue())) {
+            indexName = "docs_public";
+        } else if (space.getSpaceType().equals(DocOfType.DEPT.getValue())) {
+            indexName = "docs_dept_" + space.getOwner();
+        } else if (space.getSpaceType().equals(DocOfType.PERSONAL.getValue())) {
+            indexName = "docs_personal_" + space.getOwner();
+        } else if (space.getSpaceType().equals(DocOfType.GROUP.getValue())) {
+            indexName = "docs_group_" + space.getOwner();
+        }
 
         Map<String, Function<File, String>> handlerMap = new HashMap<>(16);
         handlerMap.put("docx", FileContentUtils::getContentDocx);
@@ -153,7 +180,7 @@ public class DocInfoServiceImpl implements IDocInfoService {
             esDocInfo.setId(docId);
             esDocInfo.setYear(year);
             esDocInfo.setContent(content);
-            EsConfig.indexName = "doc_123";
+            esConfig.setIndexName(indexName);
             esDocInfoService.save(esDocInfo);
         }
         System.err.println(file.length());
@@ -241,6 +268,11 @@ public class DocInfoServiceImpl implements IDocInfoService {
             docInfo.setDocId(id);
             docInfo.setCreateYear(year);
             docInfo = docInfoMapper.selectDocInfoByDocInfo(docInfo);
+
+            //获取空间信息
+
+            DocSpace space = docSpaceService.selectDocSpaceByDirId(docInfo.getDirId());
+
             String docPath = docInfo.getDocPath();
             //保存历史版本记录--start
             DocVersion version = new DocVersion();
@@ -285,7 +317,7 @@ public class DocInfoServiceImpl implements IDocInfoService {
             docInfo.setUpdateTime(DateUtils.getNowDate());
 
             File file = new File(path + "/" + fileName);
-            insertEs(file, ext, docInfo.getDocId(), docInfo.getCreateYear());
+            insertEs(file, ext, docInfo.getDocId(), docInfo.getCreateYear(), space);
             docInfoMapper.updateDocInfo(docInfo);
 
         } catch (Exception ex) {

+ 11 - 0
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/service/impl/DocSpaceServiceImpl.java

@@ -35,6 +35,17 @@ public class DocSpaceServiceImpl implements IDocSpaceService {
     }
 
     /**
+     * 通过目录ID查询空间信息
+     *
+     * @param dirId 目录ID
+     * @return 存储空间
+     */
+    @Override
+    public DocSpace selectDocSpaceByDirId(Long dirId) {
+        return docSpaceMapper.selectDocSpaceByDirId(dirId);
+    }
+
+    /**
      * 查询存储空间列表
      *
      * @param docSpace 存储空间

+ 71 - 0
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/service/impl/ElasticSearchServiceImpl.java

@@ -0,0 +1,71 @@
+package com.jjt.doc.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.jjt.common.core.utils.DateUtils;
+import com.jjt.common.core.utils.FileContentUtils;
+import com.jjt.common.core.utils.StringUtils;
+import com.jjt.common.core.utils.uuid.Seq;
+import com.jjt.doc.config.EsConfig;
+import com.jjt.doc.domain.*;
+import com.jjt.doc.mapper.DocInfoMapper;
+import com.jjt.doc.mapper.DocTagMapper;
+import com.jjt.doc.mapper.DocTagRelaMapper;
+import com.jjt.doc.service.*;
+import com.jjt.system.api.RemoteFileService;
+import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
+import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
+import org.springframework.stereotype.Indexed;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
+
+/**
+ * 文档基本信息Service业务层处理
+ *
+ * @author wukai
+ * @date 2023-03-27
+ */
+@Service
+public class ElasticSearchServiceImpl implements IElasticSearchService {
+    @Resource
+    private ElasticsearchRestTemplate elasticsearchRestTemplate;
+    @Resource
+    private EsConfig esConfig;
+
+    /**
+     * 创建索引
+     *
+     * @param indexName
+     * @return
+     */
+    @Override
+    public boolean createIndex(String indexName) {
+        esConfig.setIndexName(indexName);
+        boolean flag = true;
+        if (!isExists(indexName)) {
+            flag = elasticsearchRestTemplate.indexOps(EsDocInfo.class).createWithMapping();
+        }
+        return flag;
+    }
+
+    /**
+     * 查询索引是否存在
+     *
+     * @param indexName
+     * @return
+     */
+    @Override
+    public boolean isExists(String indexName) {
+        IndexCoordinates of = IndexCoordinates.of(indexName);
+        return elasticsearchRestTemplate.indexOps(of).exists();
+    }
+}

+ 15 - 2
lzga-modules/lzga-doc/src/main/resources/mapper/doc/DocShareMapper.xml

@@ -53,7 +53,14 @@
     </select>
 
     <select id="selectDocShareSend" resultType="com.jjt.doc.domain.DocShare">
-        select a.*, b.doc_name, b.doc_type, b.doc_path
+        select a.*,
+               b.doc_name,
+               b.doc_type,
+               b.doc_path,
+               b.doc_size,
+               b.doc_desc,
+               b.doc_level,
+               b.owner
         from doc_share a,
              doc_info b
         where a.doc_id = b.doc_id
@@ -61,7 +68,13 @@
         order by a.update_time desc
     </select>
     <select id="selectDocShareReceive" parameterType="DocShare" resultType="com.jjt.doc.domain.DocShare">
-        select a.*, b.doc_name, b.doc_type, b.doc_path, b.create_by user
+        select a.*, b.doc_name,
+        b.doc_type,
+        b.doc_path,
+        b.doc_size,
+        b.doc_desc,
+        b.doc_level,
+        b.owner, b.create_by user
         from (select t.*
         from doc_share t,
         doc_share_accepter t1

+ 15 - 0
lzga-modules/lzga-doc/src/main/resources/mapper/doc/DocSpaceMapper.xml

@@ -65,6 +65,21 @@
         <include refid="selectDocSpaceVo"/>
         where SPACE_ID = #{spaceId}
     </select>
+    <select id="selectDocSpaceByDirId" parameterType="Long"  resultType="com.jjt.doc.domain.DocSpace">
+        select A.SPACE_ID,
+               A.SPACE_NAME,
+               A.SPACE_CAP,
+               A.USED_CAP,
+               A.AVL_CAP,
+               A.FILE_NUM,
+               A.DEFAULT_LEVEL,
+               A.SPACE_TYPE,
+               A.OWNER
+        from doc_space a,
+             doc_dir b
+        where a.space_id = b.space_id
+          and b.dir_id = #{dirId}
+    </select>
 
     <insert id="insertDocSpace" parameterType="DocSpace" useGeneratedKeys="true" keyProperty="spaceId">
         insert into doc_space

+ 0 - 2
lzga-ui/.env.development

@@ -6,8 +6,6 @@ ENV = 'development'
 
 # 档案管理系统/开发环境
 VUE_APP_BASE_API = '/dev-api'
-# 目录跳转地址
-VUE_APP_BASE_TARGE='http://localhost:8080'
 
 # 路由懒加载
 VUE_CLI_BABEL_TRANSPILE_MODULES = true

+ 236 - 231
lzga-ui/src/views1/Retrieval/RetrievalView.vue

@@ -4,17 +4,15 @@
       <img src="../../assets/img/Group 467.png" alt="" />
     </div>
     <div class="search">
-      <el-input
-        type="text"
-        placeholder="请输入文档信息"
-        v-model="input"
-        @keyup.enter.native="searchPre"
-      ></el-input>
+      <el-select v-model="type">
+        <el-option value="1">公共文档</el-option>
+        <el-option value="2">部门文档</el-option>
+        <el-option value="3">个人文档</el-option>
+      </el-select>
+      <el-input auto-complete="on" type="text" name="content" placeholder="请输入查询关键字" v-model="input"
+        @keyup.enter.native="searchPre"></el-input>
       <span class="cen—top-span" @click="searchPre">快速搜索</span>
-      <img
-        src="../../assets/img/ri:search-2-line@2x.png"
-        class="cen—top-img"
-      />
+      <img src="../../assets/img/ri:search-2-line@2x.png" class="cen—top-img" />
     </div>
     <div class="mains" @scroll="handleScroll" v-if="mains_data2">
       <div v-for="item in count" :key="item.id" class="main-main">
@@ -31,13 +29,8 @@
             {{ item.content.info.createTime }}
           </div>
         </div>
-        <div
-          class="three"
-          v-for="highlightFieldsContentItem in item.highlightFields.content"
-          :key="highlightFieldsContentItem.id"
-          v-html="highlightFieldsContentItem"
-          style="white-space: normal"
-        ></div>
+        <div class="three" v-for="highlightFieldsContentItem in item.highlightFields.content"
+          :key="highlightFieldsContentItem.id" v-html="highlightFieldsContentItem" style="white-space: normal"></div>
         <ul class="four">
           <li v-for="tagName in item.content.info.tagList" :key="tagName.id">
             {{ tagName.tagName }}
@@ -57,258 +50,270 @@
 </template>
 
 <script>
-import { ret } from "@/api/doc/share1.js";
+  import {
+    ret
+  } from "@/api/doc/share1.js";
 
-export default {
-  data() {
-    return {
-      //搜索框绑定
-      input: "",
-      //搜索出来的数据
-      count: [],
-      page: 0,
-      size: 3,
-      mains_data: false,
-      mains_data2: false,
-    };
-  },
-  created() {
-    this.input = this.$route.query.datas;
-    if (this.input) {
-      this.searchs();
-    }
-  },
-  watch: {
-    $route: {
-      handler(val, oldval) {
-        this.input = this.$route.query.datas;
-        this.count = [];
-        if (this.input!="") {
-          this.searchs();
-        } else {
-          this.mains_data = true;
-          this.mains_data2 = false;
-        }
-      },
-      // 深度观察监听
-      deep: true,
-    },
-  },
-  mounted() {
-    //添加滚动条事件
-    window.addEventListener("scroll", this.handleScroll, true);
-  },
-  methods: {
-    // 点击搜索调用的方法
-    searchPre() {
-      this.$router.push("/home/retrieval?datas=" + this.input);
+  export default {
+    data() {
+      return {
+        //搜索框绑定
+        input: "",
+        type: "",
+        //搜索出来的数据
+        count: [],
+        page: 0,
+        size: 3,
+        mains_data: false,
+        mains_data2: false,
+      };
     },
-    handleScroll() {
-      const container = document.querySelector(".mains");
-      const { scrollTop, scrollHeight, clientHeight } = container;
-      // console.log('scrollHeight',scrollHeight);
-      // console.log('clientHeight',clientHeight);
-      // console.log(scrollTop);
-      // 是否达到页面底部
-      if (scrollTop + clientHeight >= scrollHeight) {
-        // console.log('滚动到底部了!')
-        this.page += 1;
-        // 执行加载
+    created() {
+      this.input = this.$route.query.datas;
+      if (this.input) {
         this.searchs();
       }
     },
-
-    //查找返回的数据
-    searchs() {
-      ret({
-        content: this.input,
-        page: this.page,
-        size: this.size,
-      }).then((item) => {
-        // console.log('item=',item)
-        if (item.length > 0) {
-          this.count.push(...item);
-          this.mains_data = false;
-          this.mains_data2 = true;
-        } else {
-          this.input = "";
-          this.mains_data = true;
-          this.mains_data2 = false;
-        }
-      });
+    watch: {
+      $route: {
+        handler(val, oldval) {
+          this.input = this.$route.query.datas;
+          this.count = [];
+          if (this.input != "") {
+            this.searchs();
+          } else {
+            this.mains_data = true;
+            this.mains_data2 = false;
+          }
+        },
+        // 深度观察监听
+        deep: true,
+      },
+    },
+    mounted() {
+      //添加滚动条事件
+      window.addEventListener("scroll", this.handleScroll, true);
     },
-    //预览界面
-    docName(curentDocId, value) {
-      this.$tab.openPage(
-        // window.open("/individual/Pre/user/" + curentDocId, "_blank"),
-        window.open(
-          "/individual/Pre/user/" +
+    methods: {
+      // 点击搜索调用的方法
+      searchPre() {
+        this.$router.push("/home/retrieval?datas=" + this.input);
+      },
+      handleScroll() {
+        const container = document.querySelector(".mains");
+        const {
+          scrollTop,
+          scrollHeight,
+          clientHeight
+        } = container;
+        // console.log('scrollHeight',scrollHeight);
+        // console.log('clientHeight',clientHeight);
+        // console.log(scrollTop);
+        // 是否达到页面底部
+        if (scrollTop + clientHeight >= scrollHeight) {
+          // console.log('滚动到底部了!')
+          this.page += 1;
+          // 执行加载
+          this.searchs();
+        }
+      },
+
+      //查找返回的数据
+      searchs() {
+        ret({
+          content: this.input,
+          type: this.type,
+          page: this.page,
+          size: this.size,
+        }).then((item) => {
+          // console.log('item=',item)
+          if (item.length > 0) {
+            this.count.push(...item);
+            this.mains_data = false;
+            this.mains_data2 = true;
+          } else {
+            this.input = "";
+            this.mains_data = true;
+            this.mains_data2 = false;
+          }
+        });
+      },
+      //预览界面
+      docName(curentDocId, value) {
+        this.$tab.openPage(
+          // window.open("/individual/Pre/user/" + curentDocId, "_blank"),
+          window.open(
+            "/individual/Pre/user/" +
             curentDocId +
             "?value=" +
             JSON.stringify(value),
-          "_blank"
-        )
-      );
+            "_blank"
+          )
+        );
+      },
     },
-  },
-};
+  };
 </script>
 <style lang='scss'>
-.three {
-  margin-bottom: calc(100vw * (10 / 1920));
+  .three {
+    margin-bottom: calc(100vw * (10 / 1920));
 
-  em {
-    color: #f00 !important;
+    em {
+      color: #f00 !important;
+    }
   }
-}
 </style>
 <style scoped lang='scss'>
-.containe {
-  color: #7ea4c8;
-  font-size: 0.14rem;
-  font-family: PingFang SC-Medium, PingFang SC;
-  font-weight: 500;
-}
+  .containe {
+    color: #7ea4c8;
+    font-size: 0.14rem;
+    font-family: PingFang SC-Medium, PingFang SC;
+    font-weight: 500;
+  }
 
-.picture {
-  width: calc(100vw * (220 / 1920));
-  height: calc(100vh * (57 / 1080));
-  margin-left: calc(100vw * (860 / 1920));
-  margin-top: calc(100vh * (100 / 1080));
-  margin-bottom: calc(100vh * (40 / 1080));
+  .picture {
+    width: calc(100vw * (220 / 1920));
+    height: calc(100vh * (57 / 1080));
+    margin-left: calc(100vw * (860 / 1920));
+    margin-top: calc(100vh * (100 / 1080));
+    margin-bottom: calc(100vh * (40 / 1080));
 
-  img {
-    width: 100%;
-    height: 100%;
-    display: block;
+    img {
+      width: 100%;
+      height: 100%;
+      display: block;
+    }
+  }
+
+  .search {
+    width: calc(100vw * (864 / 1920));
+    height: calc(100vh * (50 / 1080));
+    margin-left: calc(100vw * (528 / 1920));
+    margin-bottom: calc(100vh * (50 / 1080));
+    position: relative;
   }
-}
 
-.search {
-  width: calc(100vw * (864 / 1920));
-  height: calc(100vh * (50 / 1080));
-  margin-left: calc(100vw * (528 / 1920));
-  margin-bottom: calc(100vh * (50 / 1080));
-  position: relative;
-}
+  .cen—top-img {
+    width: calc(100vw * (24 / 1920));
+    height: calc(100vh * (24 / 1080));
+    position: absolute;
+    left: calc(100vw * (15 / 1920));
+    top: calc(100vh * (15 / 1080));
+  }
 
-.cen—top-img {
-  width: calc(100vw * (24 / 1920));
-  height: calc(100vh * (24 / 1080));
-  position: absolute;
-  left: calc(100vw * (15 / 1920));
-  top: calc(100vh * (15 / 1080));
-}
+  .el-input {
+    width: calc(100vw * (750 / 1920));
+    height: calc(100vh * (50 / 1080));
+    margin-right: calc(100vw * (14 / 1920));
+  }
 
-.el-input {
-  width: calc(100vw * (750 / 1920));
-  height: calc(100vh * (50 / 1080));
-  margin-right: calc(100vw * (14 / 1920));
-}
+  .cen—top-span {
+    display: inline-block;
+    width: calc(100vw * (100 / 1920));
+    height: calc(100vh * (50 / 1080));
+    background: #2e8aecff;
+    color: #ffffffcc;
+    text-align: center;
+    line-height: calc(100vh * (50 / 1080));
 
-.cen—top-span {
-  display: inline-block;
-  width: calc(100vw * (100 / 1920));
-  height: calc(100vh * (50 / 1080));
-  background: #2e8aecff;
-  color: #ffffffcc;
-  text-align: center;
-  line-height: calc(100vh * (50 / 1080));
+    &:hover {
+      cursor: pointer;
+    }
+  }
 
-  &:hover {
-    cursor: pointer;
+  .mains {
+    width: calc(100vw * (1450 / 1920));
+    height: calc(100vh * (600 / 1080));
+    // background: seagreen;
+    margin-left: calc(100vw * (230 / 1920));
+    overflow: auto;
   }
-}
 
-.mains {
-  width: calc(100vw * (1450 / 1920));
-  height: calc(100vh * (600 / 1080));
-  // background: seagreen;
-  margin-left: calc(100vw * (230 / 1920));
-  overflow: auto;
-}
-.mains_prompt {
-  display: flex;
-  align-items: center;
-  margin-left: calc(100vw * (850 / 1920));
-  margin-top: calc(100vh * (20 / 1080));
-}
-.empty {
-  width: 100%;
-  display: flex;
-  flex-direction: column;
-  justify-content: center;
-  align-items: center;
-  img {
-    width: calc(100vw * (160 / 1920));
-    height: calc(100vh * (160 / 1080));
-    margin-top: calc(100vh * (150 / 1080));
+  .mains_prompt {
+    display: flex;
+    align-items: center;
+    margin-left: calc(100vw * (850 / 1920));
+    margin-top: calc(100vh * (20 / 1080));
   }
-}
-.main-main {
-  width: calc(100vw * (1430 / 1920));
-  // height: calc(100vh * (220 / 1080));
-  padding: calc(100vh * (20 / 1080));
-  border-bottom: 1px dashed #083b61ff;
-}
 
-.one {
-  margin-bottom: calc(100vw * (10 / 1920));
-  color: #2e8aecff;
-  font-size: 14px;
-  text-decoration: underline;
-}
+  .empty {
+    width: 100%;
+    display: flex;
+    flex-direction: column;
+    justify-content: center;
+    align-items: center;
 
-.two {
-  margin-bottom: calc(100vh * (10 / 1080));
-  display: flex;
+    img {
+      width: calc(100vw * (160 / 1920));
+      height: calc(100vh * (160 / 1080));
+      margin-top: calc(100vh * (150 / 1080));
+    }
+  }
 
-  .two1 {
-    margin-right: calc(100vw * (30 / 1920));
+  .main-main {
+    width: calc(100vw * (1430 / 1920));
+    // height: calc(100vh * (220 / 1080));
+    padding: calc(100vh * (20 / 1080));
+    border-bottom: 1px dashed #083b61ff;
   }
 
-  img {
-    vertical-align: middle;
+  .one {
+    margin-bottom: calc(100vw * (10 / 1920));
+    color: #2e8aecff;
+    font-size: 14px;
+    text-decoration: underline;
   }
-}
 
-.four {
-  display: flex;
-  list-style: none;
-  padding: 0;
+  .two {
+    margin-bottom: calc(100vh * (10 / 1080));
+    display: flex;
 
-  li {
-    //  width: calc(100vw * (62 / 1920));
-    //  height: calc(100vh * (24 / 1080));
-    border: 1px solid #ff9839ff;
-    background: #bba99240;
-    padding: 0 5px;
-    margin-right: calc(100vw * (5 / 1920));
+    .two1 {
+      margin-right: calc(100vw * (30 / 1920));
+    }
+
+    img {
+      vertical-align: middle;
+    }
   }
-}
 
-//滚动条样式
-::-webkit-scrollbar {
-  width: 3.5px;
-}
+  .four {
+    display: flex;
+    list-style: none;
+    padding: 0;
 
-::-webkit-scrollbar-track {
-  background-color: rgba(0, 0, 0, 0);
-}
+    li {
+      //  width: calc(100vw * (62 / 1920));
+      //  height: calc(100vh * (24 / 1080));
+      border: 1px solid #ff9839ff;
+      background: #bba99240;
+      padding: 0 5px;
+      margin-right: calc(100vw * (5 / 1920));
+    }
+  }
 
-::-webkit-scrollbar-thumb {
-  background: #2e8aec;
-  border-radius: 3px;
-}
+  //滚动条样式
+  ::-webkit-scrollbar {
+    width: 3.5px;
+  }
 
-::-webkit-scrollbar-thumb:hover {
-  background: #2e8aec;
-}
+  ::-webkit-scrollbar-track {
+    background-color: rgba(0, 0, 0, 0);
+  }
 
-::v-deep .el-input--medium .el-input__inner {
-  padding-left: calc(100vw * (50 / 1920));
-  background: #14265e80;
-  border: 1px solid #01d1ffff;
-  color: #7ea4c8ff;
-}
-</style>
+  ::-webkit-scrollbar-thumb {
+    background: #2e8aec;
+    border-radius: 3px;
+  }
+
+  ::-webkit-scrollbar-thumb:hover {
+    background: #2e8aec;
+  }
+
+  ::v-deep .el-input--medium .el-input__inner {
+    padding-left: calc(100vw * (50 / 1920));
+    background: #14265e80;
+    border: 1px solid #01d1ffff;
+    color: #7ea4c8ff;
+  }
+</style>

+ 1 - 1
lzga-ui/vue.config.js

@@ -36,7 +36,7 @@ module.exports = {
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
         // target: `http://192.168.188.99:8080`,
-        target: process.env.VUE_APP_BASE_TARGE,
+        target: 'http://localhost:8080',
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''