|
@@ -26,22 +26,23 @@ export default {
|
|
|
watch: {
|
|
|
$route(val) {
|
|
|
this.system = JSON.parse(sessionStorage.getItem("module_info"));
|
|
|
- this.system
|
|
|
- ? this.system.forEach((sys) => {
|
|
|
- sys.modules.forEach((md) => {
|
|
|
- md.apps.forEach((app) => {
|
|
|
- if (val.name == app.name) {
|
|
|
- sessionStorage.setItem("active_modules", JSON.stringify(md));
|
|
|
- this.$store.dispatch("setActiveApp", {
|
|
|
- app: app,
|
|
|
- val: this.searchValue,
|
|
|
- });
|
|
|
- this.$store.dispatch("setSSystemModules", sys.modules);
|
|
|
- }
|
|
|
- });
|
|
|
+ if (this.system) {
|
|
|
+ // 假设 this.system 是一个数组,每个元素有 modules 属性,每个 module 有 apps 属性
|
|
|
+ this.system.forEach(sys => {
|
|
|
+ const md = sys.modules.find(module =>
|
|
|
+ module.apps.some(app => app.name === val.name)
|
|
|
+ );
|
|
|
+
|
|
|
+ if (md) {
|
|
|
+ sessionStorage.setItem("active_modules", JSON.stringify(md));
|
|
|
+ this.$store.dispatch("setActiveApp", {
|
|
|
+ app: md.apps.find(app => app.name === val.name),
|
|
|
+ val: this.searchValue,
|
|
|
});
|
|
|
- })
|
|
|
- : "";
|
|
|
+ this.$store.dispatch("setSSystemModules", sys.modules);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
},
|
|
|
};
|