{"remainingRequest":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\thread-loader\\dist\\cjs.js!D:\\jenkins\\workspace\\artfess-module\\node_modules\\babel-loader\\lib\\index.js!D:\\jenkins\\workspace\\artfess-module\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!D:\\jenkins\\workspace\\artfess-module\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\artfess-module\\src\\components\\common\\DemensionSelector.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\artfess-module\\src\\components\\common\\DemensionSelector.vue","mtime":1675232038590},{"path":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import \"core-js/modules/es7.object.get-own-property-descriptors\";\nimport \"core-js/modules/es6.object.keys\";\nimport \"core-js/modules/web.dom.iterable\";\nimport _toConsumableArray from \"D:/jenkins/workspace/artfess-module/node_modules/@babel/runtime/helpers/esm/toConsumableArray\";\nimport _defineProperty from \"D:/jenkins/workspace/artfess-module/node_modules/@babel/runtime/helpers/esm/defineProperty\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nimport utils from \"@/utils.js\";\nimport { setTimeout } from \"timers\";\nexport default {\n  name: \"demension-selector\",\n  props: {\n    value: {\n      type: Array,\n      default: function _default() {\n        return [];\n      }\n    },\n    data: Array,\n    single: {\n      type: Boolean,\n      default: false\n    },\n    //服务端分页\n    pagination: {\n      type: Object,\n      default: function _default() {\n        return {\n          page: 1,\n          pageSize: 50,\n          total: 31214\n        };\n      }\n    }\n  },\n  data: function data() {\n    return {\n      loading: false,\n      searchWord: null,\n      //客户端分页\n      paging: {\n        page: 1,\n        pageSize: 50\n      },\n      selectedId: null,\n      selects: []\n    };\n  },\n  watch: {\n    data: function data(newVal) {\n      if (newVal && newVal.length > 0) {\n        this.syncCheckedStatus();\n      }\n    }\n  },\n  created: function created() {\n    // 组件初始化时，复制一份分页信息\n    this.oldPaging = _objectSpread({}, this.paging);\n  },\n  methods: {\n    // 同步已选行到已选数据中去\n    syncSelection2selects: function syncSelection2selects() {\n      // 复制一份当前已选数据\n      var tmpSelects = _toConsumableArray(this.selects); // 先将当前页中的数据从已选数据中移除\n\n\n      this.data.forEach(function (m) {\n        tmpSelects.remove(m);\n      }); // 将剩余的已选数据与当前页选中的数据合并\n\n      tmpSelects = [].concat(_toConsumableArray(tmpSelects), _toConsumableArray(this.$refs.demTable.selection)); // 数组去重\n\n      this.selects = tmpSelects.unique(\"id\");\n    },\n    // 同步已选数据在Table中的选中状态\n    syncCheckedStatus: function syncCheckedStatus() {\n      var _this = this;\n\n      this.selectedId = null;\n\n      if (this.single) {\n        this.selects.length === 1 && (this.selectedId = this.selects[0].id);\n      } else {\n        if (!this.$refs.demTable || !this.$refs.demTable.selection) {\n          throw \"未获取到维度列表，无法选择维度。\";\n        }\n\n        this.$refs.demTable.clearSelection();\n        this.selects.length > 0 && setTimeout(function () {\n          _this.selects.forEach(function (m) {\n            if (_this.data.some(function (n) {\n              return utils.objectEquals(m, n);\n            })) {\n              _this.$refs.demTable.toggleRowSelection(m);\n            }\n          });\n        });\n      }\n    },\n    onShow: function onShow() {\n      // 每一次显示选择器时，重置当前选中数据为外部的v-model对象\n      this.selects = _toConsumableArray(this.value);\n      this.reset();\n    },\n    onHide: function onHide(sure) {\n      // 在隐藏选择器时，如果点击的是确定按钮，则将当前选中数据更新到外部的v-model对象上\n      if (sure) {\n        this.$emit(\"input\", this.selects);\n      }\n    },\n    // 加载数据，根据当前的搜索关键词及分页条件\n    load: function load() {\n      var _this2 = this;\n\n      this.loading = true;\n      this.$emit(\"load\", {\n        searchWord: this.searchWord,\n        paging: this.paging\n      }, function () {\n        _this2.loading = false;\n      });\n    },\n    // 搜索事件\n    search: function search() {\n      if (!this.searchWord || this.loading) {\n        return;\n      }\n\n      this.paging = this.oldPaging;\n      this.load();\n    },\n    // 重置事件\n    reset: function reset() {\n      this.searchWord = null;\n      this.paging = this.oldPaging;\n      this.load();\n    },\n    handleRowClick: function handleRowClick(row, column, event) {\n      var _this3 = this;\n\n      if (this.single) {\n        this.selects = [row];\n        this.selectedId = row.id;\n      } else {\n        if (!this.$refs.demTable || !this.$refs.demTable.selection) {\n          throw \"未获取到维度列表，无法选择维度。\";\n        }\n\n        var _tag = true;\n        this.$refs.demTable.selection.forEach(function (m) {\n          if (m === row) {\n            // 已选中该行时，取消选中状态\n            _this3.$refs.demTable.toggleRowSelection(row, false);\n\n            _tag = false;\n          }\n        }); // 非取消选中情况下，将当前行设置为选中状态\n\n        _tag && this.$refs.demTable.toggleRowSelection(row);\n        this.syncSelection2selects();\n      }\n    },\n    handleTableSelect: function handleTableSelect() {\n      this.syncSelection2selects();\n    },\n    handleSizeChange: function handleSizeChange(size) {\n      this.paging.pageSize = size;\n      this.load();\n    },\n    handleCurrentChange: function handleCurrentChange(currentPage) {\n      this.paging.page = currentPage;\n      this.load();\n    },\n    move: function move(direct) {\n      var _this4 = this;\n\n      var selectedAry = this.$refs.selectTree.getCheckedNodes(); // 将调整顺序之后的数组赋值给Tree\n\n      this.selects = utils.arrayMove(this.selects, selectedAry, direct);\n      setTimeout(function () {\n        // 调整顺序后恢复勾选状态\n        _this4.$refs.selectTree.setCheckedNodes(selectedAry);\n      });\n    },\n    removeSelected: function removeSelected() {\n      var _this5 = this;\n\n      var selectedAry = this.$refs.selectTree.getCheckedNodes();\n      selectedAry.forEach(function (item) {\n        _this5.selects.remove(item);\n      });\n      this.syncCheckedStatus();\n    },\n    clearAllSelects: function clearAllSelects() {\n      this.selects = [];\n      this.syncCheckedStatus();\n    }\n  }\n};",null]}