Browse Source

:zap: 优化顶部菜单配置接口

smallchill 5 years ago
parent
commit
1d5c83e7e8
2 changed files with 10 additions and 3 deletions
  1. 1 1
      src/api/system/topmenu.js
  2. 9 2
      src/views/system/topmenu.vue

+ 1 - 1
src/api/system/topmenu.js

@@ -69,7 +69,7 @@ export const grant = (topMenuIds, menuIds) => {
   return request({
     url: '/api/blade-system/topmenu/grant',
     method: 'post',
-    params: {
+    data: {
       topMenuIds,
       menuIds,
     }

+ 9 - 2
src/views/system/topmenu.vue

@@ -168,12 +168,19 @@
           ids.push(ele.id);
         });
         return ids.join(",");
+      },
+      idsArray() {
+        let ids = [];
+        this.selectionList.forEach(ele => {
+          ids.push(ele.id);
+        });
+        return ids;
       }
     },
     methods: {
       submit() {
-        const menuList = this.$refs.treeMenu.getCheckedKeys().join(",");
-        grant(this.ids, menuList).then(() => {
+        const menuList = this.$refs.treeMenu.getCheckedKeys();
+        grant(this.idsArray, menuList).then(() => {
           this.box = false;
           this.$message({
             type: "success",