Browse Source

分页bug

zhongzewei 6 years ago
parent
commit
fe3a2bed17
1 changed files with 6 additions and 3 deletions
  1. 6 3
      modules/complementary_glj_lib/models/gljModel.js

+ 6 - 3
modules/complementary_glj_lib/models/gljModel.js

@@ -48,7 +48,8 @@ class GljDao {
 
     async getQueryByType ({userID, compilationId, gljLibId, type, replace, location, classList, search}) {
         let model = null,
-            query = {};
+            query = {},
+            matchLocation = false;
         if (type === libType.stdGLJ) {
             model = stdGljModel;
             query.repositoryId = gljLibId;
@@ -68,6 +69,7 @@ class GljDao {
             const replaceData = await model.findOne(replaceQuery);
             if (replaceData) {
                 query.gljClass = replaceData.gljClass;
+                matchLocation = true;
             }
         }
         // 替换过滤类型
@@ -82,7 +84,8 @@ class GljDao {
         }
         return {
             model,
-            query
+            query,
+            matchLocation
         };
     }
 
@@ -90,7 +93,7 @@ class GljDao {
         const queryData = await this.getQueryByType(condition);
         // 定位(替换初始化)
         // 替换触发的人材机选择界面,只有在初始化时才定位,其他操作下是正常的分页
-        if (condition.location) {
+        if (queryData.matchLocation) {
             // 返回的数据,为编码小于等于替换的编码,再加附加条数
             const limitQuery = _.cloneDeep(queryData.query);
             limitQuery.code = {$lte: condition.replace.code};