{"remainingRequest":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\thread-loader\\dist\\cjs.js!D:\\jenkins\\workspace\\xypm-web\\node_modules\\babel-loader\\lib\\index.js!D:\\jenkins\\workspace\\xypm-web\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!D:\\jenkins\\workspace\\xypm-web\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\xypm-web\\src\\components\\appCenter\\AppCenter.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xypm-web\\src\\components\\appCenter\\AppCenter.vue","mtime":1675214576370},{"path":"D:\\jenkins\\workspace\\xypm-web\\babel.config.js","mtime":1675214572901},{"path":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\babel-loader\\lib\\index.js","mtime":456789000000},{"path":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import \"core-js/modules/es6.object.keys\";\nimport \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es6.regexp.split\";\nimport \"core-js/modules/es7.array.includes\";\nimport \"core-js/modules/es6.string.includes\";\nimport \"core-js/modules/es6.function.name\";\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//\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 portal from \"@/api/portal.js\";\nimport appMain from \"@/components/appCenter/AppMain.vue\";\nimport { mapState } from \"vuex\";\nimport req from \"@/request.js\";\nexport default {\n  name: \"app-center\",\n  components: {\n    appMain: appMain\n  },\n  data: function data() {\n    return {\n      apps: [],\n      pageResult: {\n        page: 1,\n        pageSize: 24,\n        total: 0\n      },\n      menus: [],\n      activeMenuIndex: \"\",\n      activeTab: \"\",\n      tabs: [],\n      tagTypes: [],\n      selectAllStatus: {},\n      tagMap: {},\n      tagStatus: {},\n      currentMenuId: \"\",\n      searchWord: \"\",\n      searchDialogVisible: false,\n      searchResultApps: []\n    };\n  },\n  computed: mapState({\n    currentMenu: function currentMenu(state) {\n      return state.menu.currentMenu;\n    }\n  }),\n  mounted: function mounted() {\n    var _this = this;\n    portal.getSubMenus(\"app_menu\", function (resp) {\n      _this.menus = resp.data.value;\n      _this.selectFirstOne();\n    });\n    this.loadTags();\n  },\n  methods: {\n    //加载应用数据\n    loadData: function loadData(menuId) {\n      var _this2 = this;\n      var param = {\n        menuId: menuId\n      };\n      portal.getSysAppList(param).then(function (data) {\n        _this2.apps = data;\n        _this2.currentMenuId = menuId;\n      });\n    },\n    handleSelect: function handleSelect(data) {\n      this.$set(this, \"tabs\", data.children);\n      if (this.tabs.length <= 0) {\n        this.loadData(data.id);\n        return;\n      }\n      this.loadData(this.tabs[0].id);\n      this.activeTab = this.tabs[0].id;\n    },\n    tabClick: function tabClick(tab) {\n      this.loadData(tab.name);\n    },\n    getFirstMenu: function getFirstMenu(menus, index) {\n      if (menus[0].children && menus[0].children.length > 0 && index < 2) {\n        index++;\n        return this.getFirstMenu(menus[0].children);\n      } else {\n        return menus[0];\n      }\n    },\n    getFirstValidMenu: function getFirstValidMenu(menus, menuIds) {\n      if (menus) {\n        for (var i = 0; i < menus.length; i++) {\n          if (menuIds.includes(menus[i].id) && menus[i].path.split(\".\").length > 4) {\n            return menus[i];\n          }\n        }\n        for (var j = 0; j < menus.length; j++) {\n          var menu = this.getFirstValidMenu(menus[j].children, menuIds);\n          if (menu) {\n            return menu;\n          }\n        }\n      }\n    },\n    selectFirstOne: function selectFirstOne() {\n      var _this3 = this;\n      //获取有存在应用的菜单\n      req.get(\"${portal}/portal/sysApp/v1/validMenu\").then(function (resp) {\n        if (resp && resp.data && resp.data.length > 0) {\n          var menu = _this3.getFirstValidMenu(_this3.menus, resp.data);\n          if (!menu) {\n            menu = _this3.getFirstMenu(_this3.menus, 1);\n          }\n          _this3.activeMenuIndex = menu.id;\n          _this3.handleSelect(menu);\n        } else {\n          if (_this3.menus && _this3.menus.length > 0) {\n            var _menu = _this3.getFirstMenu(_this3.menus, 1);\n            _this3.activeMenuIndex = _menu.id;\n            _this3.handleSelect(_menu);\n          }\n        }\n      });\n    },\n    //加载标签\n    loadTags: function loadTags() {\n      var _this4 = this;\n      portal.getAppTagTypes().then(function (resp) {\n        _this4.tagTypes = resp.data;\n        resp.data.forEach(function (item) {\n          _this4.selectAllStatus[item.id] = false;\n          _this4.tagMap[item.id] = [];\n          var querys = [{\n            property: \"type_id_\",\n            value: item.id,\n            group: \"main\",\n            operation: \"EQUAL\",\n            relation: \"AND\"\n          }];\n          var filter = {\n            querys: querys\n          };\n          req.post(window.context.portal + \"/portal/sysTag/v1/query\", filter).then(function (resp) {\n            _this4.tagMap[item.id] = resp.data.rows;\n            resp.data.rows.forEach(function (tag) {\n              _this4.tagStatus[tag.id] = false;\n            });\n            _this4.$forceUpdate();\n          });\n        });\n      });\n    },\n    selectAll: function selectAll(typeId) {\n      this.selectAllStatus[typeId] = !this.selectAllStatus[typeId];\n      var tags = this.tagMap[typeId];\n      var allToSelect = false; //全选\n      for (var i = 0; i < tags.length; i++) {\n        if (this.tagStatus[tags[i].id] != true) {\n          allToSelect = true;\n        }\n      }\n      if (allToSelect) {\n        //全选\n        for (var _i = 0; _i < tags.length; _i++) {\n          this.tagStatus[tags[_i].id] = true;\n        }\n      } else {\n        //全不选\n        for (var _i2 = 0; _i2 < tags.length; _i2++) {\n          this.tagStatus[tags[_i2].id] = false;\n        }\n      }\n      this.reloadData();\n      this.$forceUpdate();\n    },\n    tagClick: function tagClick(tagId, typeId) {\n      this.tagStatus[tagId] = !this.tagStatus[tagId];\n      //全部选中时，设置全选按钮\n      var tags = this.tagMap[typeId];\n      var isSelectAll = true;\n      for (var i = 0; i < tags.length; i++) {\n        if (!this.tagStatus[tags[i].id]) {\n          isSelectAll = false;\n          break;\n        }\n      }\n      this.selectAllStatus[typeId] = isSelectAll;\n      this.reloadData();\n      this.$forceUpdate();\n    },\n    ////重新加载数据\n    reloadData: function reloadData() {\n      var _this5 = this;\n      var param = [];\n      this.tagTypes.forEach(function (type) {\n        var selectTagIds = [];\n        var tagList = _this5.tagMap[type.id];\n        for (var i = 0; i < tagList.length; i++) {\n          if (_this5.tagStatus[tagList[i].id]) {\n            selectTagIds.push(tagList[i].id);\n          }\n        }\n        //querys.push({properties:\"TAG_ID_\",value:selectTagIds.join(\",\"),group:group,operation:\"IN\",relation:\"AND\"});\n        if (selectTagIds.length != 0) {\n          param.push({\n            typeId: type.id,\n            tagIds: selectTagIds.join(\",\")\n          });\n        }\n      });\n      req.post(\"${portal}/portal/sysApp/v1/queryByTagIds/\" + this.currentMenuId, param).then(function (resp) {\n        _this5.apps = resp.data;\n        _this5.searchWord = \"\";\n        _this5.$forceUpdate();\n      });\n    },\n    search: function search() {\n      var _this6 = this;\n      if (!this.searchWord) {\n        this.$message({\n          type: \"warning\",\n          message: \"请输入关键词\"\n        });\n        return;\n      }\n      var querys = [{\n        property: \"name\",\n        value: this.searchWord,\n        group: \"search\",\n        operation: \"LIKE\",\n        relation: \"AND\"\n      }];\n      var queryFilter = {\n        querys: querys\n      };\n      this.$loading();\n      req.post(\"${portal}/portal/sysApp/v1/queryByFilter\", queryFilter).then(function (resp) {\n        _this6.apps.splice(0);\n        Object.keys(_this6.selectAllStatus).forEach(function (key) {\n          _this6.$set(_this6.selectAllStatus, key, false);\n        });\n        Object.keys(_this6.tagStatus).forEach(function (key) {\n          _this6.$set(_this6.tagStatus, key, false);\n        });\n        if (resp.data && resp.data.length > 0) {\n          resp.data.forEach(function (item) {\n            _this6.apps.push(item);\n          });\n          //this.searchDialogVisible = true;\n        } else {\n          _this6.$message({\n            type: \"warning\",\n            message: \"未查询到结果\"\n          });\n        }\n        _this6.$loading().close();\n      });\n    },\n    searchDialogClose: function searchDialogClose() {\n      this.searchResultApps.splice(0);\n    }\n  }\n};",null]}