{"remainingRequest":"E:\\hz-zhhq-web\\node_modules\\thread-loader\\dist\\cjs.js!E:\\hz-zhhq-web\\node_modules\\babel-loader\\lib\\index.js!E:\\hz-zhhq-web\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!E:\\hz-zhhq-web\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!E:\\hz-zhhq-web\\src\\layout\\components\\TagsView\\index.vue?vue&type=script&lang=js","dependencies":[{"path":"E:\\hz-zhhq-web\\src\\layout\\components\\TagsView\\index.vue","mtime":1737610069393},{"path":"E:\\hz-zhhq-web\\babel.config.js","mtime":1737610069371},{"path":"E:\\hz-zhhq-web\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"E:\\hz-zhhq-web\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"E:\\hz-zhhq-web\\node_modules\\babel-loader\\lib\\index.js","mtime":456789000000},{"path":"E:\\hz-zhhq-web\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"E:\\hz-zhhq-web\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import \"core-js/modules/es6.regexp.replace\";\nimport _createForOfIteratorHelper from \"E:/hz-zhhq-web/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js\";\nimport _toConsumableArray from \"E:/hz-zhhq-web/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js\";\nimport _objectSpread from \"E:/hz-zhhq-web/node_modules/@babel/runtime/helpers/esm/objectSpread2.js\";\nimport \"core-js/modules/es6.function.name\";\nimport \"core-js/modules/web.dom.iterable\";\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 ScrollPane from \"./ScrollPane\";\nimport { generateTitle } from '@/utils/i18n';\nimport path from 'path';\nexport default {\n components: {\n ScrollPane: ScrollPane\n },\n data: function data() {\n return {\n visible: false,\n top: 0,\n left: 0,\n selectedTag: {},\n affixTags: []\n };\n },\n computed: {\n visitedViews: function visitedViews() {\n return this.$store.state.tagsView.visitedViews;\n },\n routes: function routes() {\n return this.$store.state.permission.routes;\n }\n },\n watch: {\n $route: function $route() {\n this.addTags();\n this.moveToCurrentTag();\n },\n visible: function visible(value) {\n if (value) {\n document.body.addEventListener('click', this.closeMenu);\n } else {\n document.body.removeEventListener('click', this.closeMenu);\n }\n }\n },\n mounted: function mounted() {\n this.initTags();\n this.addTags();\n },\n methods: {\n generateTitle: generateTitle,\n // generateTitle by vue-i18n\n isActive: function isActive(route) {\n return route.path === this.$route.path;\n },\n filterAffixTags: function filterAffixTags(routes) {\n var _this = this;\n var basePath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '/';\n var tags = [];\n routes.forEach(function (route) {\n if (route.meta && route.meta.affix) {\n var tagPath = path.resolve(basePath, route.path);\n tags.push({\n fullPath: tagPath,\n path: tagPath,\n name: route.name,\n meta: _objectSpread({}, route.meta)\n });\n }\n if (route.children) {\n var tempTags = _this.filterAffixTags(route.children, route.path);\n if (tempTags.length >= 1) {\n tags = [].concat(_toConsumableArray(tags), _toConsumableArray(tempTags));\n }\n }\n });\n return tags;\n },\n initTags: function initTags() {\n var affixTags = this.affixTags = this.filterAffixTags(this.routes);\n var _iterator = _createForOfIteratorHelper(affixTags),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var tag = _step.value;\n // Must have tag name\n if (tag.name) {\n this.$store.dispatch('tagsView/addVisitedView', tag);\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n },\n addTags: function addTags() {\n var name = this.$route.name;\n if (name) {\n this.$store.dispatch('tagsView/addView', this.$route);\n }\n return false;\n },\n moveToCurrentTag: function moveToCurrentTag() {\n var _this2 = this;\n var tags = this.$refs.tag;\n this.$nextTick(function () {\n var _iterator2 = _createForOfIteratorHelper(tags),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var tag = _step2.value;\n if (tag.to.path === _this2.$route.path) {\n _this2.$refs.scrollPane.moveToTarget(tag);\n // when query is different then update\n if (tag.to.fullPath !== _this2.$route.fullPath) {\n _this2.$store.dispatch('tagsView/updateVisitedView', _this2.$route);\n }\n break;\n }\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n });\n },\n refreshSelectedTag: function refreshSelectedTag(view) {\n var _this3 = this;\n this.$store.dispatch('tagsView/delCachedView', view).then(function () {\n var fullPath = view.fullPath;\n _this3.$nextTick(function () {\n _this3.$router.replace({\n path: '/redirect' + fullPath\n });\n });\n });\n },\n closeSelectedTag: function closeSelectedTag(view) {\n var _this4 = this;\n this.$store.dispatch('tagsView/delView', view).then(function (_ref) {\n var visitedViews = _ref.visitedViews;\n if (_this4.isActive(view)) {\n _this4.toLastView(visitedViews, view);\n }\n });\n },\n closeOthersTags: function closeOthersTags() {\n var _this5 = this;\n this.$router.push(this.selectedTag);\n this.$store.dispatch('tagsView/delOthersViews', this.selectedTag).then(function () {\n _this5.moveToCurrentTag();\n });\n },\n closeAllTags: function closeAllTags(view) {\n var _this6 = this;\n this.$store.dispatch('tagsView/delAllViews').then(function (_ref2) {\n var visitedViews = _ref2.visitedViews;\n if (_this6.affixTags.some(function (tag) {\n return tag.path === view.path;\n })) {\n return;\n }\n _this6.toLastView(visitedViews, view);\n });\n },\n toLastView: function toLastView(visitedViews, view) {\n var latestView = visitedViews.slice(-1)[0];\n if (latestView) {\n this.$router.push(latestView);\n } else {\n // now the default is to redirect to the home page if there is no tags-view,\n // you can adjust it according to your needs.\n if (view.name === 'Dashboard') {\n // to reload home page\n this.$router.replace({\n path: '/redirect' + view.fullPath\n });\n } else {\n this.$router.push('/');\n }\n }\n },\n openMenu: function openMenu(tag, e) {\n var menuMinWidth = 105;\n var offsetLeft = this.$el.getBoundingClientRect().left; // container margin left\n var offsetWidth = this.$el.offsetWidth; // container width\n var maxLeft = offsetWidth - menuMinWidth; // left boundary\n var left = e.clientX - offsetLeft + 15; // 15: margin right\n\n if (left > maxLeft) {\n this.left = maxLeft;\n } else {\n this.left = left;\n }\n this.top = e.clientY;\n this.visible = true;\n this.selectedTag = tag;\n },\n closeMenu: function closeMenu() {\n this.visible = false;\n }\n }\n};",null]}