{"remainingRequest":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\thread-loader\\dist\\cjs.js!D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\babel-loader\\lib\\index.js!D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\eslint-loader\\index.js??ref--13-0!D:\\jenkins\\workspace\\xq-web-bpm\\src\\components\\bizComponents\\eipControl\\bus\\SubPagination.js","dependencies":[{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\src\\components\\bizComponents\\eipControl\\bus\\SubPagination.js","mtime":1675071991522},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\eslint-loader\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es6.string.iterator\";\nimport \"core-js/modules/es6.map\";\nimport Vue from \"vue\";\nimport util from \"@/hotent-ui-util.js\";\nvar SubPagination = {\n  // 全局对象，存放不同子表路径对应的数据\n  _map: new Map(),\n  set: function set(path, obj) {\n    SubPagination._map.set(path, obj);\n\n    if (obj.rows) {\n      // 分页信息变化时需要触发子表调用filter\n      SubPagination._digest(obj.rows);\n    }\n  },\n  // 销毁path对象的数据\n  clear: function clear(path) {\n    SubPagination._map.delete(path);\n\n    SubPagination._map.delete(SubPagination._vueComponentKey(path));\n  },\n  // 消化子表数据变化，触发视图层渲染\n  _digest: function _digest(rows) {\n    if (rows && rows.length > 0) {\n      var firstItem = rows[0];\n      Vue.set(rows, 0, firstItem);\n    }\n  },\n  _vueComponentKey: function _vueComponentKey(path) {\n    return \"\".concat(path, \":VueComponent\");\n  },\n  // 导入数据\n  importData: function importData(path, importRows, mode, mergeMethod) {\n    return new Promise(function (resolve, reject) {\n      if (SubPagination._map.has(path)) {\n        var instKey = SubPagination._vueComponentKey(path);\n\n        if (!SubPagination._map.has(instKey)) {\n          reject(\"\\u672A\\u627E\\u5230\".concat(path, \"\\u6240\\u5BF9\\u5E94\\u7684\\u6570\\u636E\\u5B9E\\u4F8B\\uFF0C\\u65E0\\u6CD5\\u5BFC\\u5165\\u6570\\u636E\\u3002\"));\n        }\n\n        var obj = SubPagination._map.get(path),\n            inst = SubPagination._map.get(instKey),\n            array = obj.rows;\n\n        switch (mode) {\n          case \"override\":\n            // 覆盖\n            util.setValueByPath(inst, path, importRows);\n            break;\n\n          case \"append\":\n            // 追加\n            var newAry = array.concat(importRows);\n            util.setValueByPath(inst, path, newAry);\n            break;\n\n          case \"merge\":\n            if (!mergeMethod && mergeMethod.constructor != Function) {\n              reject(\"\\u5408\\u5E76\\u5BFC\\u5165\\u5FC5\\u987B\\u63D0\\u4F9B\\u5408\\u5E76\\u5BFC\\u5165\\u7684\\u65B9\\u6CD5\\uFF1A\".concat(mergeMethod));\n            }\n\n            var newRows = mergeMethod(array, importRows);\n            util.setValueByPath(inst, path, newRows);\n            break;\n        }\n\n        obj.rows = util.getValueByPath(inst, path);\n\n        SubPagination._digest(obj.rows);\n\n        resolve();\n      } else {\n        reject(\"\\u672A\\u627E\\u5230\".concat(path, \"\\u6240\\u5BF9\\u5E94\\u7684\\u5B50\\u8868\\u6570\\u636E\"));\n      }\n    });\n  },\n  // 导出数据\n  exportData: function exportData(path, type) {\n    return new Promise(function (resolve, reject) {\n      if (SubPagination._map.has(path)) {\n        if (type == 'current') {\n          resolve(SubPagination.pagingByPath(path));\n        } else if (type == 'all') {\n          var obj = SubPagination._map.get(path);\n\n          resolve(obj.rows);\n        } else {\n          reject(\"\\u672A\\u77E5\\u7684\\u5BFC\\u51FA\\u7C7B\\u578B\\uFF1A\".concat(type));\n        }\n      } else {\n        reject(\"\\u672A\\u627E\\u5230\".concat(path, \"\\u6240\\u5BF9\\u5E94\\u7684\\u5B50\\u8868\\u6570\\u636E\"));\n      }\n    });\n  },\n  pagingByPath: function pagingByPath(path, inst) {\n    var instKey = SubPagination._vueComponentKey(path);\n\n    if (!SubPagination._map.has(instKey) && inst) {\n      // 将子表数据所属的VueComponent对象实例存储（用于数据导入）\n      SubPagination._map.set(instKey, inst);\n    } // 如果有该子表路径的对象，则进行前端分页\n\n\n    if (SubPagination._map.has(path)) {\n      var obj = SubPagination._map.get(path),\n          array = obj.rows,\n          pageSize = obj.pageSize,\n          offset = (obj.currentPage - 1) * pageSize;\n\n      return offset + pageSize >= array.length ? array.slice(offset, array.length) : array.slice(offset, offset + pageSize);\n    } else {\n      // 没有子表路径的对象时，直接返回空集合\n      return [];\n    }\n  }\n};\nexport default SubPagination;",null]}