Browse Source

fix: DynamicRouter

Sendya 3 years ago
parent
commit
c55b84479f
6 changed files with 820 additions and 854 deletions
  1. 3 3
      package.json
  2. 713 618
      src/mock/services/user.js
  3. 52 47
      src/router/generator-routers.js
  4. 5 11
      src/store/index.js
  5. 0 169
      src/views/role/RoleList.vue
  6. 47 6
      yarn.lock

+ 3 - 3
package.json

@@ -13,7 +13,7 @@
   "dependencies": {
     "@ant-design-vue/pro-layout": "^1.0.8",
     "@antv/data-set": "^0.10.2",
-    "ant-design-vue": "^1.7.5",
+    "ant-design-vue": "^1.7.6",
     "axios": "^0.19.0",
     "core-js": "^3.1.2",
     "enquire.js": "^2.1.6",
@@ -26,7 +26,7 @@
     "nprogress": "^0.2.0",
     "store": "^2.0.12",
     "viser-vue": "^2.4.6",
-    "vue": "^2.6.10",
+    "vue": "^2.6.14",
     "vue-clipboard2": "^0.2.1",
     "vue-cropper": "0.4.9",
     "vue-i18n": "^8.17.4",
@@ -56,7 +56,7 @@
     "less": "^3.0.4",
     "less-loader": "^5.0.0",
     "vue-svg-icon-loader": "^2.1.1",
-    "vue-template-compiler": "^2.6.10",
+    "vue-template-compiler": "^2.6.14",
     "webpack-theme-color-replacer": "^1.3.12"
   }
 }

+ 713 - 618
src/mock/services/user.js

@@ -1,754 +1,849 @@
 import Mock from 'mockjs2'
 import { builder } from '../util'
 
-const info = (options) => {
+const info = options => {
   console.log('options', options)
   const userInfo = {
-    'id': '4291d7da9005377ec9aec4a71ea837f',
-    'name': '天野远子',
-    'username': 'admin',
-    'password': '',
-    'avatar': '/avatar2.jpg',
-    'status': 1,
-    'telephone': '',
-    'lastLoginIp': '27.154.74.117',
-    'lastLoginTime': 1534837621348,
-    'creatorId': 'admin',
-    'createTime': 1497160610259,
-    'merchantCode': 'TLif2btpzg079h15bk',
-    'deleted': 0,
-    'roleId': 'admin',
-    'role': {}
+    id: '4291d7da9005377ec9aec4a71ea837f',
+    name: '天野远子',
+    username: 'admin',
+    password: '',
+    avatar: '/avatar2.jpg',
+    status: 1,
+    telephone: '',
+    lastLoginIp: '27.154.74.117',
+    lastLoginTime: 1534837621348,
+    creatorId: 'admin',
+    createTime: 1497160610259,
+    merchantCode: 'TLif2btpzg079h15bk',
+    deleted: 0,
+    roleId: 'admin',
+    role: {}
   }
   // role
   const roleObj = {
-    'id': 'admin',
-    'name': '管理员',
-    'describe': '拥有所有权限',
-    'status': 1,
-    'creatorId': 'system',
-    'createTime': 1497160610259,
-    'deleted': 0,
-    'permissions': [{
-      'roleId': 'admin',
-      'permissionId': 'dashboard',
-      'permissionName': '仪表盘',
-      'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
-      'actionEntitySet': [{
-        'action': 'add',
-        'describe': '新增',
-        'defaultCheck': false
-      }, {
-        'action': 'query',
-        'describe': '查询',
-        'defaultCheck': false
-      }, {
-        'action': 'get',
-        'describe': '详情',
-        'defaultCheck': false
-      }, {
-        'action': 'update',
-        'describe': '修改',
-        'defaultCheck': false
-      }, {
-        'action': 'delete',
-        'describe': '删除',
-        'defaultCheck': false
-      }],
-      'actionList': null,
-      'dataAccess': null
-    }, {
-      'roleId': 'admin',
-      'permissionId': 'exception',
-      'permissionName': '异常页面权限',
-      'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
-      'actionEntitySet': [{
-        'action': 'add',
-        'describe': '新增',
-        'defaultCheck': false
-      }, {
-        'action': 'query',
-        'describe': '查询',
-        'defaultCheck': false
-      }, {
-        'action': 'get',
-        'describe': '详情',
-        'defaultCheck': false
-      }, {
-        'action': 'update',
-        'describe': '修改',
-        'defaultCheck': false
-      }, {
-        'action': 'delete',
-        'describe': '删除',
-        'defaultCheck': false
-      }],
-      'actionList': null,
-      'dataAccess': null
-    }, {
-      'roleId': 'admin',
-      'permissionId': 'result',
-      'permissionName': '结果权限',
-      'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
-      'actionEntitySet': [{
-        'action': 'add',
-        'describe': '新增',
-        'defaultCheck': false
-      }, {
-        'action': 'query',
-        'describe': '查询',
-        'defaultCheck': false
-      }, {
-        'action': 'get',
-        'describe': '详情',
-        'defaultCheck': false
-      }, {
-        'action': 'update',
-        'describe': '修改',
-        'defaultCheck': false
-      }, {
-        'action': 'delete',
-        'describe': '删除',
-        'defaultCheck': false
-      }],
-      'actionList': null,
-      'dataAccess': null
-    }, {
-      'roleId': 'admin',
-      'permissionId': 'profile',
-      'permissionName': '详细页权限',
-      'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
-      'actionEntitySet': [{
-        'action': 'add',
-        'describe': '新增',
-        'defaultCheck': false
-      }, {
-        'action': 'query',
-        'describe': '查询',
-        'defaultCheck': false
-      }, {
-        'action': 'get',
-        'describe': '详情',
-        'defaultCheck': false
-      }, {
-        'action': 'update',
-        'describe': '修改',
-        'defaultCheck': false
-      }, {
-        'action': 'delete',
-        'describe': '删除',
-        'defaultCheck': false
-      }],
-      'actionList': null,
-      'dataAccess': null
-    }, {
-      'roleId': 'admin',
-      'permissionId': 'table',
-      'permissionName': '表格权限',
-      'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"import","defaultCheck":false,"describe":"导入"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"}]',
-      'actionEntitySet': [{
-        'action': 'add',
-        'describe': '新增',
-        'defaultCheck': false
-      }, {
-        'action': 'import',
-        'describe': '导入',
-        'defaultCheck': false
-      }, {
-        'action': 'get',
-        'describe': '详情',
-        'defaultCheck': false
-      }, {
-        'action': 'update',
-        'describe': '修改',
-        'defaultCheck': false
-      }],
-      'actionList': null,
-      'dataAccess': null
-    }, {
-      'roleId': 'admin',
-      'permissionId': 'form',
-      'permissionName': '表单权限',
-      'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
-      'actionEntitySet': [{
-        'action': 'add',
-        'describe': '新增',
-        'defaultCheck': false
-      }, {
-        'action': 'get',
-        'describe': '详情',
-        'defaultCheck': false
-      }, {
-        'action': 'query',
-        'describe': '查询',
-        'defaultCheck': false
-      }, {
-        'action': 'update',
-        'describe': '修改',
-        'defaultCheck': false
-      }, {
-        'action': 'delete',
-        'describe': '删除',
-        'defaultCheck': false
-      }],
-      'actionList': null,
-      'dataAccess': null
-    }, {
-      'roleId': 'admin',
-      'permissionId': 'order',
-      'permissionName': '订单管理',
-      'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
-      'actionEntitySet': [{
-        'action': 'add',
-        'describe': '新增',
-        'defaultCheck': false
-      }, {
-        'action': 'query',
-        'describe': '查询',
-        'defaultCheck': false
-      }, {
-        'action': 'get',
-        'describe': '详情',
-        'defaultCheck': false
-      }, {
-        'action': 'update',
-        'describe': '修改',
-        'defaultCheck': false
-      }, {
-        'action': 'delete',
-        'describe': '删除',
-        'defaultCheck': false
-      }],
-      'actionList': null,
-      'dataAccess': null
-    }, {
-      'roleId': 'admin',
-      'permissionId': 'permission',
-      'permissionName': '权限管理',
-      'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
-      'actionEntitySet': [{
-        'action': 'add',
-        'describe': '新增',
-        'defaultCheck': false
-      }, {
-        'action': 'get',
-        'describe': '详情',
-        'defaultCheck': false
-      }, {
-        'action': 'update',
-        'describe': '修改',
-        'defaultCheck': false
-      }, {
-        'action': 'delete',
-        'describe': '删除',
-        'defaultCheck': false
-      }],
-      'actionList': null,
-      'dataAccess': null
-    }, {
-      'roleId': 'admin',
-      'permissionId': 'role',
-      'permissionName': '角色管理',
-      'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
-      'actionEntitySet': [{
-        'action': 'add',
-        'describe': '新增',
-        'defaultCheck': false
-      }, {
-        'action': 'get',
-        'describe': '详情',
-        'defaultCheck': false
-      }, {
-        'action': 'update',
-        'describe': '修改',
-        'defaultCheck': false
-      }, {
-        'action': 'delete',
-        'describe': '删除',
-        'defaultCheck': false
-      }],
-      'actionList': null,
-      'dataAccess': null
-    }, {
-      'roleId': 'admin',
-      'permissionId': 'table',
-      'permissionName': '桌子管理',
-      'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
-      'actionEntitySet': [{
-        'action': 'add',
-        'describe': '新增',
-        'defaultCheck': false
-      }, {
-        'action': 'get',
-        'describe': '详情',
-        'defaultCheck': false
-      }, {
-        'action': 'query',
-        'describe': '查询',
-        'defaultCheck': false
-      }, {
-        'action': 'update',
-        'describe': '修改',
-        'defaultCheck': false
-      }, {
-        'action': 'delete',
-        'describe': '删除',
-        'defaultCheck': false
-      }],
-      'actionList': null,
-      'dataAccess': null
-    }, {
-      'roleId': 'admin',
-      'permissionId': 'user',
-      'permissionName': '用户管理',
-      'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"import","defaultCheck":false,"describe":"导入"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"},{"action":"export","defaultCheck":false,"describe":"导出"}]',
-      'actionEntitySet': [{
-        'action': 'add',
-        'describe': '新增',
-        'defaultCheck': false
-      }, {
-        'action': 'import',
-        'describe': '导入',
-        'defaultCheck': false
-      }, {
-        'action': 'get',
-        'describe': '详情',
-        'defaultCheck': false
-      }, {
-        'action': 'update',
-        'describe': '修改',
-        'defaultCheck': false
-      }, {
-        'action': 'delete',
-        'describe': '删除',
-        'defaultCheck': false
-      }, {
-        'action': 'export',
-        'describe': '导出',
-        'defaultCheck': false
-      }],
-      'actionList': null,
-      'dataAccess': null
-    }]
+    id: 'admin',
+    name: '管理员',
+    describe: '拥有所有权限',
+    status: 1,
+    creatorId: 'system',
+    createTime: 1497160610259,
+    deleted: 0,
+    permissions: [
+      {
+        roleId: 'admin',
+        permissionId: 'dashboard',
+        permissionName: '仪表盘',
+        actions:
+          '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
+        actionEntitySet: [
+          {
+            action: 'add',
+            describe: '新增',
+            defaultCheck: false
+          },
+          {
+            action: 'query',
+            describe: '查询',
+            defaultCheck: false
+          },
+          {
+            action: 'get',
+            describe: '详情',
+            defaultCheck: false
+          },
+          {
+            action: 'update',
+            describe: '修改',
+            defaultCheck: false
+          },
+          {
+            action: 'delete',
+            describe: '删除',
+            defaultCheck: false
+          }
+        ],
+        actionList: null,
+        dataAccess: null
+      },
+      {
+        roleId: 'admin',
+        permissionId: 'exception',
+        permissionName: '异常页面权限',
+        actions:
+          '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
+        actionEntitySet: [
+          {
+            action: 'add',
+            describe: '新增',
+            defaultCheck: false
+          },
+          {
+            action: 'query',
+            describe: '查询',
+            defaultCheck: false
+          },
+          {
+            action: 'get',
+            describe: '详情',
+            defaultCheck: false
+          },
+          {
+            action: 'update',
+            describe: '修改',
+            defaultCheck: false
+          },
+          {
+            action: 'delete',
+            describe: '删除',
+            defaultCheck: false
+          }
+        ],
+        actionList: null,
+        dataAccess: null
+      },
+      {
+        roleId: 'admin',
+        permissionId: 'result',
+        permissionName: '结果权限',
+        actions:
+          '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
+        actionEntitySet: [
+          {
+            action: 'add',
+            describe: '新增',
+            defaultCheck: false
+          },
+          {
+            action: 'query',
+            describe: '查询',
+            defaultCheck: false
+          },
+          {
+            action: 'get',
+            describe: '详情',
+            defaultCheck: false
+          },
+          {
+            action: 'update',
+            describe: '修改',
+            defaultCheck: false
+          },
+          {
+            action: 'delete',
+            describe: '删除',
+            defaultCheck: false
+          }
+        ],
+        actionList: null,
+        dataAccess: null
+      },
+      {
+        roleId: 'admin',
+        permissionId: 'profile',
+        permissionName: '详细页权限',
+        actions:
+          '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
+        actionEntitySet: [
+          {
+            action: 'add',
+            describe: '新增',
+            defaultCheck: false
+          },
+          {
+            action: 'query',
+            describe: '查询',
+            defaultCheck: false
+          },
+          {
+            action: 'get',
+            describe: '详情',
+            defaultCheck: false
+          },
+          {
+            action: 'update',
+            describe: '修改',
+            defaultCheck: false
+          },
+          {
+            action: 'delete',
+            describe: '删除',
+            defaultCheck: false
+          }
+        ],
+        actionList: null,
+        dataAccess: null
+      },
+      {
+        roleId: 'admin',
+        permissionId: 'table',
+        permissionName: '表格权限',
+        actions:
+          '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"import","defaultCheck":false,"describe":"导入"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"}]',
+        actionEntitySet: [
+          {
+            action: 'add',
+            describe: '新增',
+            defaultCheck: false
+          },
+          {
+            action: 'import',
+            describe: '导入',
+            defaultCheck: false
+          },
+          {
+            action: 'get',
+            describe: '详情',
+            defaultCheck: false
+          },
+          {
+            action: 'update',
+            describe: '修改',
+            defaultCheck: false
+          }
+        ],
+        actionList: null,
+        dataAccess: null
+      },
+      {
+        roleId: 'admin',
+        permissionId: 'form',
+        permissionName: '表单权限',
+        actions:
+          '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
+        actionEntitySet: [
+          {
+            action: 'add',
+            describe: '新增',
+            defaultCheck: false
+          },
+          {
+            action: 'get',
+            describe: '详情',
+            defaultCheck: false
+          },
+          {
+            action: 'query',
+            describe: '查询',
+            defaultCheck: false
+          },
+          {
+            action: 'update',
+            describe: '修改',
+            defaultCheck: false
+          },
+          {
+            action: 'delete',
+            describe: '删除',
+            defaultCheck: false
+          }
+        ],
+        actionList: null,
+        dataAccess: null
+      },
+      {
+        roleId: 'admin',
+        permissionId: 'order',
+        permissionName: '订单管理',
+        actions:
+          '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
+        actionEntitySet: [
+          {
+            action: 'add',
+            describe: '新增',
+            defaultCheck: false
+          },
+          {
+            action: 'query',
+            describe: '查询',
+            defaultCheck: false
+          },
+          {
+            action: 'get',
+            describe: '详情',
+            defaultCheck: false
+          },
+          {
+            action: 'update',
+            describe: '修改',
+            defaultCheck: false
+          },
+          {
+            action: 'delete',
+            describe: '删除',
+            defaultCheck: false
+          }
+        ],
+        actionList: null,
+        dataAccess: null
+      },
+      {
+        roleId: 'admin',
+        permissionId: 'permission',
+        permissionName: '权限管理',
+        actions:
+          '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
+        actionEntitySet: [
+          {
+            action: 'add',
+            describe: '新增',
+            defaultCheck: false
+          },
+          {
+            action: 'get',
+            describe: '详情',
+            defaultCheck: false
+          },
+          {
+            action: 'update',
+            describe: '修改',
+            defaultCheck: false
+          },
+          {
+            action: 'delete',
+            describe: '删除',
+            defaultCheck: false
+          }
+        ],
+        actionList: null,
+        dataAccess: null
+      },
+      {
+        roleId: 'admin',
+        permissionId: 'role',
+        permissionName: '角色管理',
+        actions:
+          '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
+        actionEntitySet: [
+          {
+            action: 'add',
+            describe: '新增',
+            defaultCheck: false
+          },
+          {
+            action: 'get',
+            describe: '详情',
+            defaultCheck: false
+          },
+          {
+            action: 'update',
+            describe: '修改',
+            defaultCheck: false
+          },
+          {
+            action: 'delete',
+            describe: '删除',
+            defaultCheck: false
+          }
+        ],
+        actionList: null,
+        dataAccess: null
+      },
+      {
+        roleId: 'admin',
+        permissionId: 'table',
+        permissionName: '桌子管理',
+        actions:
+          '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
+        actionEntitySet: [
+          {
+            action: 'add',
+            describe: '新增',
+            defaultCheck: false
+          },
+          {
+            action: 'get',
+            describe: '详情',
+            defaultCheck: false
+          },
+          {
+            action: 'query',
+            describe: '查询',
+            defaultCheck: false
+          },
+          {
+            action: 'update',
+            describe: '修改',
+            defaultCheck: false
+          },
+          {
+            action: 'delete',
+            describe: '删除',
+            defaultCheck: false
+          }
+        ],
+        actionList: null,
+        dataAccess: null
+      },
+      {
+        roleId: 'admin',
+        permissionId: 'user',
+        permissionName: '用户管理',
+        actions:
+          '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"import","defaultCheck":false,"describe":"导入"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"},{"action":"export","defaultCheck":false,"describe":"导出"}]',
+        actionEntitySet: [
+          {
+            action: 'add',
+            describe: '新增',
+            defaultCheck: false
+          },
+          {
+            action: 'import',
+            describe: '导入',
+            defaultCheck: false
+          },
+          {
+            action: 'get',
+            describe: '详情',
+            defaultCheck: false
+          },
+          {
+            action: 'update',
+            describe: '修改',
+            defaultCheck: false
+          },
+          {
+            action: 'delete',
+            describe: '删除',
+            defaultCheck: false
+          },
+          {
+            action: 'export',
+            describe: '导出',
+            defaultCheck: false
+          }
+        ],
+        actionList: null,
+        dataAccess: null
+      }
+    ]
   }
 
   roleObj.permissions.push({
-    'roleId': 'admin',
-    'permissionId': 'support',
-    'permissionName': '超级模块',
-    'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"import","defaultCheck":false,"describe":"导入"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"},{"action":"export","defaultCheck":false,"describe":"导出"}]',
-    'actionEntitySet': [{
-      'action': 'add',
-      'describe': '新增',
-      'defaultCheck': false
-    }, {
-      'action': 'import',
-      'describe': '导入',
-      'defaultCheck': false
-    }, {
-      'action': 'get',
-      'describe': '详情',
-      'defaultCheck': false
-    }, {
-      'action': 'update',
-      'describe': '修改',
-      'defaultCheck': false
-    }, {
-      'action': 'delete',
-      'describe': '删除',
-      'defaultCheck': false
-    }, {
-      'action': 'export',
-      'describe': '导出',
-      'defaultCheck': false
-    }],
-    'actionList': null,
-    'dataAccess': null
+    roleId: 'admin',
+    permissionId: 'support',
+    permissionName: '超级模块',
+    actions:
+      '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"import","defaultCheck":false,"describe":"导入"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"},{"action":"export","defaultCheck":false,"describe":"导出"}]',
+    actionEntitySet: [
+      {
+        action: 'add',
+        describe: '新增',
+        defaultCheck: false
+      },
+      {
+        action: 'import',
+        describe: '导入',
+        defaultCheck: false
+      },
+      {
+        action: 'get',
+        describe: '详情',
+        defaultCheck: false
+      },
+      {
+        action: 'update',
+        describe: '修改',
+        defaultCheck: false
+      },
+      {
+        action: 'delete',
+        describe: '删除',
+        defaultCheck: false
+      },
+      {
+        action: 'export',
+        describe: '导出',
+        defaultCheck: false
+      }
+    ],
+    actionList: null,
+    dataAccess: null
   })
 
   userInfo.role = roleObj
   return builder(userInfo)
 }
 
-const userNav = (options) => {
+const userNav = options => {
   const nav = [
     // dashboard
     {
-      'name': 'dashboard',
-      'parentId': 0,
-      'id': 1,
-      'meta': {
-        'icon': 'dashboard',
-        'title': '仪表盘',
-        'show': true
+      name: 'dashboard',
+      parentId: 0,
+      id: 1,
+      meta: {
+        icon: 'dashboard',
+        title: '仪表盘',
+        show: true
       },
-      'component': 'RouteView',
-      'redirect': '/dashboard/workplace'
+      component: 'RouteView',
+      redirect: '/dashboard/workplace'
     },
     {
-      'name': 'workplace',
-      'parentId': 1,
-      'id': 7,
-      'meta': {
-        'title': '工作台',
-        'show': true
+      name: 'workplace',
+      parentId: 1,
+      id: 7,
+      meta: {
+        title: '工作台',
+        show: true
       },
-      'component': 'Workplace'
+      component: 'Workplace'
     },
     {
-      'name': 'monitor',
-      'path': 'https://www.baidu.com/',
-      'parentId': 1,
-      'id': 3,
-      'meta': {
-        'title': '监控页(外部)',
-        'target': '_blank',
-        'show': true
+      name: 'monitor',
+      path: 'https://www.baidu.com/',
+      parentId: 1,
+      id: 3,
+      meta: {
+        title: '监控页(外部)',
+        target: '_blank',
+        show: true
       }
     },
     {
-      'name': 'Analysis',
-      'parentId': 1,
-      'id': 2,
-      'meta': {
-        'title': '分析页',
-        'show': true
+      name: 'Analysis',
+      parentId: 1,
+      id: 2,
+      meta: {
+        title: '分析页',
+        show: true
       },
-      'component': 'Analysis',
-      'path': '/dashboard/analysis'
+      component: 'Analysis',
+      path: '/dashboard/analysis'
     },
 
     // form
     {
-      'name': 'form',
-      'parentId': 0,
-      'id': 10,
-      'meta': {
-        'icon': 'form',
-        'title': '表单页'
+      name: 'form',
+      parentId: 0,
+      id: 10,
+      meta: {
+        icon: 'form',
+        title: '表单页'
       },
-      'redirect': '/form/base-form',
-      'component': 'PageView'
+      redirect: '/form/base-form',
+      component: 'PageView'
     },
     {
-      'name': 'basic-form',
-      'parentId': 10,
-      'id': 6,
-      'meta': {
-        'title': '基础表单'
+      name: 'basic-form',
+      parentId: 10,
+      id: 6,
+      meta: {
+        title: '基础表单'
       },
-      'component': 'BasicForm'
+      component: 'BasicForm'
     },
     {
-      'name': 'step-form',
-      'parentId': 10,
-      'id': 5,
-      'meta': {
-        'title': '分步表单'
+      name: 'step-form',
+      parentId: 10,
+      id: 5,
+      meta: {
+        title: '分步表单'
       },
-      'component': 'StepForm'
+      component: 'StepForm'
     },
     {
-      'name': 'advanced-form',
-      'parentId': 10,
-      'id': 4,
-      'meta': {
-        'title': '高级表单'
+      name: 'advanced-form',
+      parentId: 10,
+      id: 4,
+      meta: {
+        title: '高级表单'
       },
-      'component': 'AdvanceForm'
+      component: 'AdvanceForm'
     },
 
     // list
     {
-      'name': 'list',
-      'parentId': 0,
-      'id': 10010,
-      'meta': {
-        'icon': 'table',
-        'title': '列表页',
-        'show': true
+      name: 'list',
+      parentId: 0,
+      id: 10010,
+      meta: {
+        icon: 'table',
+        title: '列表页',
+        show: true
       },
-      'redirect': '/list/table-list',
-      'component': 'PageView'
+      redirect: '/list/table-list',
+      component: 'PageView'
     },
     {
-      'name': 'table-list',
-      'parentId': 10010,
-      'id': 10011,
-      'path': '/list/table-list/:pageNo([1-9]\\d*)?',
-      'meta': {
-        'title': '查询表格',
-        'show': true
+      name: 'table-list',
+      parentId: 10010,
+      id: 10011,
+      path: '/list/table-list/:pageNo([1-9]\\d*)?',
+      meta: {
+        title: '查询表格',
+        show: true
       },
-      'component': 'TableList'
+      component: 'TableList'
     },
     {
-      'name': 'basic-list',
-      'parentId': 10010,
-      'id': 10012,
-      'meta': {
-        'title': '标准列表',
-        'show': true
+      name: 'basic-list',
+      parentId: 10010,
+      id: 10012,
+      meta: {
+        title: '标准列表',
+        show: true
       },
-      'component': 'StandardList'
+      component: 'StandardList'
     },
     {
-      'name': 'card',
-      'parentId': 10010,
-      'id': 10013,
-      'meta': {
-        'title': '卡片列表',
-        'show': true
+      name: 'card',
+      parentId: 10010,
+      id: 10013,
+      meta: {
+        title: '卡片列表',
+        show: true
       },
-      'component': 'CardList'
+      component: 'CardList'
     },
     {
-      'name': 'search',
-      'parentId': 10010,
-      'id': 10014,
-      'meta': {
-        'title': '搜索列表',
-        'show': true
+      name: 'search',
+      parentId: 10010,
+      id: 10014,
+      meta: {
+        title: '搜索列表',
+        show: true
       },
-      'redirect': '/list/search/article',
-      'component': 'SearchLayout'
+      redirect: '/list/search/article',
+      component: 'SearchLayout'
     },
     {
-      'name': 'article',
-      'parentId': 10014,
-      'id': 10015,
-      'meta': {
-        'title': '搜索列表(文章)',
-        'show': true
+      name: 'article',
+      parentId: 10014,
+      id: 10015,
+      meta: {
+        title: '搜索列表(文章)',
+        show: true
       },
-      'component': 'SearchArticles'
+      component: 'SearchArticles'
     },
     {
-      'name': 'project',
-      'parentId': 10014,
-      'id': 10016,
-      'meta': {
-        'title': '搜索列表(项目)',
-        'show': true
+      name: 'project',
+      parentId: 10014,
+      id: 10016,
+      meta: {
+        title: '搜索列表(项目)',
+        show: true
       },
-      'component': 'SearchProjects'
+      component: 'SearchProjects'
     },
     {
-      'name': 'application',
-      'parentId': 10014,
-      'id': 10017,
-      'meta': {
-        'title': '搜索列表(应用)',
-        'show': true
+      name: 'application',
+      parentId: 10014,
+      id: 10017,
+      meta: {
+        title: '搜索列表(应用)',
+        show: true
       },
-      'component': 'SearchApplications'
+      component: 'SearchApplications'
     },
 
     // profile
     {
-      'name': 'profile',
-      'parentId': 0,
-      'id': 10018,
-      'meta': {
-        'title': '详情页',
-        'icon': 'profile',
-        'show': true
+      name: 'profile',
+      parentId: 0,
+      id: 10018,
+      meta: {
+        title: '详情页',
+        icon: 'profile',
+        show: true
       },
-      'redirect': '/profile/basic',
-      'component': 'RouteView'
+      redirect: '/profile/basic',
+      component: 'RouteView'
     },
     {
-      'name': 'basic',
-      'parentId': 10018,
-      'id': 10019,
-      'meta': {
-        'title': '基础详情页',
-        'show': true
+      name: 'basic',
+      parentId: 10018,
+      id: 10019,
+      meta: {
+        title: '基础详情页',
+        show: true
       },
-      'component': 'ProfileBasic'
+      component: 'ProfileBasic'
     },
     {
-      'name': 'advanced',
-      'parentId': 10018,
-      'id': 10020,
-      'meta': {
-        'title': '高级详情页',
-        'show': true
+      name: 'advanced',
+      parentId: 10018,
+      id: 10020,
+      meta: {
+        title: '高级详情页',
+        show: true
       },
-      'component': 'ProfileAdvanced'
+      component: 'ProfileAdvanced'
     },
 
     // result
     {
-      'name': 'result',
-      'parentId': 0,
-      'id': 10021,
-      'meta': {
-        'title': '结果页',
-        'icon': 'check-circle-o',
-        'show': true
+      name: 'result',
+      parentId: 0,
+      id: 10021,
+      meta: {
+        title: '结果页',
+        icon: 'check-circle-o',
+        show: true
       },
-      'redirect': '/result/success',
-      'component': 'PageView'
+      redirect: '/result/success',
+      component: 'PageView'
     },
     {
-      'name': 'success',
-      'parentId': 10021,
-      'id': 10022,
-      'meta': {
-        'title': '成功',
-        'hiddenHeaderContent': true,
-        'show': true
+      name: 'success',
+      parentId: 10021,
+      id: 10022,
+      meta: {
+        title: '成功',
+        hiddenHeaderContent: true,
+        show: true
       },
-      'component': 'ResultSuccess'
+      component: 'ResultSuccess'
     },
     {
-      'name': 'fail',
-      'parentId': 10021,
-      'id': 10023,
-      'meta': {
-        'title': '失败',
-        'hiddenHeaderContent': true,
-        'show': true
+      name: 'fail',
+      parentId: 10021,
+      id: 10023,
+      meta: {
+        title: '失败',
+        hiddenHeaderContent: true,
+        show: true
       },
-      'component': 'ResultFail'
+      component: 'ResultFail'
     },
 
     // Exception
     {
-      'name': 'exception',
-      'parentId': 0,
-      'id': 10024,
-      'meta': {
-        'title': '异常页',
-        'icon': 'warning',
-        'show': true
+      name: 'exception',
+      parentId: 0,
+      id: 10024,
+      meta: {
+        title: '异常页',
+        icon: 'warning',
+        show: true
       },
-      'redirect': '/exception/403',
-      'component': 'RouteView'
+      redirect: '/exception/403',
+      component: 'RouteView'
     },
     {
-      'name': '403',
-      'parentId': 10024,
-      'id': 10025,
-      'meta': {
-        'title': '403',
-        'show': true
+      name: '403',
+      parentId: 10024,
+      id: 10025,
+      meta: {
+        title: '403',
+        show: true
       },
-      'component': 'Exception403'
+      component: 'Exception403'
     },
     {
-      'name': '404',
-      'parentId': 10024,
-      'id': 10026,
-      'meta': {
-        'title': '404',
-        'show': true
+      name: '404',
+      parentId: 10024,
+      id: 10026,
+      meta: {
+        title: '404',
+        show: true
       },
-      'component': 'Exception404'
+      component: 'Exception404'
     },
     {
-      'name': '500',
-      'parentId': 10024,
-      'id': 10027,
-      'meta': {
-        'title': '500',
-        'show': true
+      name: '500',
+      parentId: 10024,
+      id: 10027,
+      meta: {
+        title: '500',
+        show: true
       },
-      'component': 'Exception500'
+      component: 'Exception500'
     },
 
     // account
     {
-      'name': 'account',
-      'parentId': 0,
-      'id': 10028,
-      'meta': {
-        'title': '个人页',
-        'icon': 'user',
-        'show': true
+      name: 'account',
+      parentId: 0,
+      id: 10028,
+      meta: {
+        title: '个人页',
+        icon: 'user',
+        show: true
       },
-      'redirect': '/account/center',
-      'component': 'RouteView'
+      redirect: '/account/center',
+      component: 'RouteView'
     },
     {
-      'name': 'center',
-      'parentId': 10028,
-      'id': 10029,
-      'meta': {
-        'title': '个人中心',
-        'show': true
+      name: 'center',
+      parentId: 10028,
+      id: 10029,
+      meta: {
+        title: '个人中心',
+        show: true
       },
-      'component': 'AccountCenter'
+      component: 'AccountCenter'
     },
     // 特殊三级菜单
     {
-      'name': 'settings',
-      'parentId': 10028,
-      'id': 10030,
-      'meta': {
-        'title': '个人设置',
-        'hideHeader': true,
-        'hideChildren': true,
-        'show': true
+      name: 'settings',
+      parentId: 10028,
+      id: 10030,
+      meta: {
+        title: '个人设置',
+        hideHeader: true,
+        hideChildren: true,
+        show: true
       },
-      'redirect': '/account/settings/base',
-      'component': 'AccountSettings'
+      redirect: '/account/settings/base',
+      component: 'AccountSettings'
     },
     {
-      'name': 'BaseSettings',
-      'path': '/account/settings/base',
-      'parentId': 10030,
-      'id': 10031,
-      'meta': {
-        'title': '基本设置',
-        'show': false
+      name: 'BasicSetting',
+      path: '/account/settings/base',
+      parentId: 10030,
+      id: 10031,
+      meta: {
+        title: '基本设置',
+        show: false
       },
-      'component': 'BaseSettings'
+      component: 'BasicSetting'
     },
     {
-      'name': 'SecuritySettings',
-      'path': '/account/settings/security',
-      'parentId': 10030,
-      'id': 10032,
-      'meta': {
-        'title': '安全设置',
-        'show': false
+      name: 'SecuritySettings',
+      path: '/account/settings/security',
+      parentId: 10030,
+      id: 10032,
+      meta: {
+        title: '安全设置',
+        show: false
       },
-      'component': 'SecuritySettings'
+      component: 'SecuritySettings'
     },
     {
-      'name': 'CustomSettings',
-      'path': '/account/settings/custom',
-      'parentId': 10030,
-      'id': 10033,
-      'meta': {
-        'title': '个性化设置',
-        'show': false
+      name: 'CustomSettings',
+      path: '/account/settings/custom',
+      parentId: 10030,
+      id: 10033,
+      meta: {
+        title: '个性化设置',
+        show: false
       },
-      'component': 'CustomSettings'
+      component: 'CustomSettings'
     },
     {
-      'name': 'BindingSettings',
-      'path': '/account/settings/binding',
-      'parentId': 10030,
-      'id': 10034,
-      'meta': {
-        'title': '账户绑定',
-        'show': false
+      name: 'BindingSettings',
+      path: '/account/settings/binding',
+      parentId: 10030,
+      id: 10034,
+      meta: {
+        title: '账户绑定',
+        show: false
       },
-      'component': 'BindingSettings'
+      component: 'BindingSetting'
     },
     {
-      'name': 'NotificationSettings',
-      'path': '/account/settings/notification',
-      'parentId': 10030,
-      'id': 10034,
-      'meta': {
-        'title': '新消息通知',
-        'show': false
+      name: 'NotificationSettings',
+      path: '/account/settings/notification',
+      parentId: 10030,
+      id: 10034,
+      meta: {
+        title: '新消息通知',
+        show: false
       },
-      'component': 'NotificationSettings'
+      component: 'NotificationSettings'
     }
   ]
   const json = builder(nav)

+ 52 - 47
src/router/generator-routers.js

@@ -15,49 +15,51 @@ const constantRouterComponents = {
   '500': () => import(/* webpackChunkName: "error" */ '@/views/exception/500'),
 
   // 你需要动态引入的页面组件
-  'Workplace': () => import('@/views/dashboard/Workplace'),
-  'Analysis': () => import('@/views/dashboard/Analysis'),
+  Workplace: () => import('@/views/dashboard/Workplace'),
+  Analysis: () => import('@/views/dashboard/Analysis'),
 
   // form
-  'BasicForm': () => import('@/views/form/basicForm'),
-  'StepForm': () => import('@/views/form/stepForm/StepForm'),
-  'AdvanceForm': () => import('@/views/form/advancedForm/AdvancedForm'),
+  BasicForm: () => import('@/views/form/basicForm'),
+  StepForm: () => import('@/views/form/stepForm/StepForm'),
+  AdvanceForm: () => import('@/views/form/advancedForm/AdvancedForm'),
 
   // list
-  'TableList': () => import('@/views/list/TableList'),
-  'StandardList': () => import('@/views/list/BasicList'),
-  'CardList': () => import('@/views/list/CardList'),
-  'SearchLayout': () => import('@/views/list/search/SearchLayout'),
-  'SearchArticles': () => import('@/views/list/search/Article'),
-  'SearchProjects': () => import('@/views/list/search/Projects'),
-  'SearchApplications': () => import('@/views/list/search/Applications'),
-  'ProfileBasic': () => import('@/views/profile/basic'),
-  'ProfileAdvanced': () => import('@/views/profile/advanced/Advanced'),
+  TableList: () => import('@/views/list/TableList'),
+  StandardList: () => import('@/views/list/BasicList'),
+  CardList: () => import('@/views/list/CardList'),
+  SearchLayout: () => import('@/views/list/search/SearchLayout'),
+  SearchArticles: () => import('@/views/list/search/Article'),
+  SearchProjects: () => import('@/views/list/search/Projects'),
+  SearchApplications: () => import('@/views/list/search/Applications'),
+  ProfileBasic: () => import('@/views/profile/basic'),
+  ProfileAdvanced: () => import('@/views/profile/advanced/Advanced'),
 
   // result
-  'ResultSuccess': () => import(/* webpackChunkName: "result" */ '@/views/result/Success'),
-  'ResultFail': () => import(/* webpackChunkName: "result" */ '@/views/result/Error'),
+  ResultSuccess: () => import(/* webpackChunkName: "result" */ '@/views/result/Success'),
+  ResultFail: () => import(/* webpackChunkName: "result" */ '@/views/result/Error'),
 
   // exception
-  'Exception403': () => import(/* webpackChunkName: "fail" */ '@/views/exception/403'),
-  'Exception404': () => import(/* webpackChunkName: "fail" */ '@/views/exception/404'),
-  'Exception500': () => import(/* webpackChunkName: "fail" */ '@/views/exception/500'),
+  Exception403: () => import(/* webpackChunkName: "fail" */ '@/views/exception/403'),
+  Exception404: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404'),
+  Exception500: () => import(/* webpackChunkName: "fail" */ '@/views/exception/500'),
 
   // account
-  'AccountCenter': () => import('@/views/account/center'),
-  'AccountSettings': () => import('@/views/account/settings/Index'),
-  'BaseSettings': () => import('@/views/account/settings/BaseSetting'),
-  'SecuritySettings': () => import('@/views/account/settings/Security'),
-  'CustomSettings': () => import('@/views/account/settings/Custom'),
-  'BindingSettings': () => import('@/views/account/settings/Binding'),
-  'NotificationSettings': () => import('@/views/account/settings/Notification')
+  AccountCenter: () => import('@/views/account/center'),
+  AccountSettings: () => import('@/views/account/settings/Index'),
+  BasicSetting: () => import('@/views/account/settings/BasicSetting'),
+  SecuritySettings: () => import('@/views/account/settings/Security'),
+  CustomSettings: () => import('@/views/account/settings/Custom'),
+  BindingSettings: () => import('@/views/account/settings/Binding'),
+  NotificationSettings: () => import('@/views/account/settings/Notification')
 
   // 'TestWork': () => import(/* webpackChunkName: "TestWork" */ '@/views/dashboard/TestWork')
 }
 
 // 前端未找到页面路由(固定不用改)
 const notFoundRouter = {
-  path: '*', redirect: '/404', hidden: true
+  path: '*',
+  redirect: '/404',
+  hidden: true
 }
 
 // 根级菜单
@@ -78,25 +80,28 @@ const rootRouter = {
  * @param token
  * @returns {Promise<Router>}
  */
-export const generatorDynamicRouter = (token) => {
+export const generatorDynamicRouter = token => {
   return new Promise((resolve, reject) => {
-    loginService.getCurrentUserNav(token).then(res => {
-      console.log('res', res)
-      const { result } = res
-      const menuNav = []
-      const childrenNav = []
-      //      后端数据, 根级树数组,  根级 PID
-      listToTree(result, childrenNav, 0)
-      rootRouter.children = childrenNav
-      menuNav.push(rootRouter)
-      console.log('menuNav', menuNav)
-      const routers = generator(menuNav)
-      routers.push(notFoundRouter)
-      console.log('routers', routers)
-      resolve(routers)
-    }).catch(err => {
-      reject(err)
-    })
+    loginService
+      .getCurrentUserNav(token)
+      .then(res => {
+        console.log('generatorDynamicRouter response:', res)
+        const { result } = res
+        const menuNav = []
+        const childrenNav = []
+        //      后端数据, 根级树数组,  根级 PID
+        listToTree(result, childrenNav, 0)
+        rootRouter.children = childrenNav
+        menuNav.push(rootRouter)
+        console.log('menuNav', menuNav)
+        const routers = generator(menuNav)
+        routers.push(notFoundRouter)
+        console.log('routers', routers)
+        resolve(routers)
+      })
+      .catch(err => {
+        reject(err)
+      })
   })
 }
 
@@ -112,13 +117,13 @@ export const generator = (routerMap, parent) => {
     const { title, show, hideChildren, hiddenHeaderContent, target, icon } = item.meta || {}
     const currentRouter = {
       // 如果路由设置了 path,则作为默认 path,否则 路由地址 动态拼接生成如 /dashboard/workplace
-      path: item.path || `${parent && parent.path || ''}/${item.key}`,
+      path: item.path || `${(parent && parent.path) || ''}/${item.key}`,
       // 路由名称,建议唯一
       name: item.name || item.key || '',
       // 该路由对应页面的 组件 :方案1
       // component: constantRouterComponents[item.component || item.key],
       // 该路由对应页面的 组件 :方案2 (动态加载)
-      component: (constantRouterComponents[item.component || item.key]) || (() => import(`@/views/${item.component}`)),
+      component: constantRouterComponents[item.component || item.key] || (() => import(`@/views/${item.component}`)),
 
       // meta: 页面标题, 菜单图标, 页面权限(供指令权限用,可去掉)
       meta: {

+ 5 - 11
src/store/index.js

@@ -5,10 +5,10 @@ import app from './modules/app'
 import user from './modules/user'
 
 // default router permission control
-import permission from './modules/permission'
+// import permission from './modules/permission'
 
 // dynamic router permission control (Experimental)
-// import permission from './modules/async-router'
+import permission from './modules/async-router'
 import getters from './getters'
 
 Vue.use(Vuex)
@@ -19,14 +19,8 @@ export default new Vuex.Store({
     user,
     permission
   },
-  state: {
-
-  },
-  mutations: {
-
-  },
-  actions: {
-
-  },
+  state: {},
+  mutations: {},
+  actions: {},
   getters
 })

+ 0 - 169
src/views/role/RoleList.vue

@@ -1,169 +0,0 @@
-<template>
-  <a-card :bordered="false" :style="{ height: '100%' }">
-    <a-row :gutter="24">
-      <a-col :md="4">
-        <a-list itemLayout="vertical" :dataSource="roles">
-          <a-list-item slot="renderItem" slot-scope="item, index" :key="index">
-            <a-list-item-meta :style="{ marginBottom: '0' }">
-              <span slot="description" style="text-align: center; display: block">{{ item.describe }}</span>
-              <a slot="title" style="text-align: center; display: block" @click="edit(item)">{{ item.name }}</a>
-            </a-list-item-meta>
-          </a-list-item>
-        </a-list>
-      </a-col>
-      <a-col :md="20">
-        <div style="max-width: 800px">
-          <a-divider v-if="isMobile()" />
-          <div v-if="mdl.id">
-            <h3>角色:{{ mdl.name }}</h3>
-          </div>
-          <a-form :form="form" :layout="isMobile() ? 'vertical' : 'horizontal'">
-            <a-form-item label="唯一键">
-              <a-input v-decorator="[ 'id', {rules: [{ required: true, message: 'Please input unique key!' }]} ]" placeholder="请填写唯一键" />
-            </a-form-item>
-
-            <a-form-item label="角色名称">
-              <a-input v-decorator="[ 'name', {rules: [{ required: true, message: 'Please input role name!' }]} ]" placeholder="请填写角色名称" />
-            </a-form-item>
-
-            <a-form-item label="状态">
-              <a-select v-decorator="[ 'status', {rules: []} ]">
-                <a-select-option :value="1">正常</a-select-option>
-                <a-select-option :value="2">禁用</a-select-option>
-              </a-select>
-            </a-form-item>
-
-            <a-form-item label="备注说明">
-              <a-textarea :row="3" v-decorator="[ 'describe', {rules: [{ required: true, message: 'Please input role name!' }]} ]" placeholder="请填写角色名称" />
-            </a-form-item>
-
-            <a-form-item label="拥有权限">
-              <a-row :gutter="16" v-for="(permission, index) in permissions" :key="index">
-                <a-col :xl="4" :lg="24">
-                  {{ permission.name }}:
-                </a-col>
-                <a-col :xl="20" :lg="24">
-                  <a-checkbox
-                    v-if="permission.actionsOptions.length > 0"
-                    :indeterminate="permission.indeterminate"
-                    :checked="permission.checkedAll"
-                    @change="onChangeCheckAll($event, permission)">
-                    全选
-                  </a-checkbox>
-                  <a-checkbox-group :options="permission.actionsOptions" v-model="permission.selected" @change="onChangeCheck(permission)" />
-                </a-col>
-              </a-row>
-            </a-form-item>
-
-          </a-form>
-        </div>
-      </a-col>
-    </a-row>
-  </a-card>
-</template>
-
-<script>
-import pick from 'lodash.pick'
-import { getRoleList, getPermissions } from '@/api/manage'
-import { actionToObject } from '@/utils/permissions'
-import { baseMixin } from '@/store/app-mixin'
-
-export default {
-  name: 'RoleList',
-  mixins: [baseMixin],
-  components: {},
-  data () {
-    return {
-      form: this.$form.createForm(this),
-      mdl: {},
-
-      roles: [],
-      permissions: []
-    }
-  },
-  created () {
-    getRoleList().then((res) => {
-      this.roles = res.result.data
-      this.roles.push({
-        id: '-1',
-        name: '新增角色',
-        describe: '新增一个角色'
-      })
-      console.log('this.roles', this.roles)
-    })
-    this.loadPermissions()
-  },
-  methods: {
-    callback (val) {
-      console.log(val)
-    },
-
-    add () {
-      this.edit({ id: 0 })
-    },
-
-    edit (record) {
-      this.mdl = Object.assign({}, record)
-      // 有权限表,处理勾选
-      if (this.mdl.permissions && this.permissions) {
-        // 先处理要勾选的权限结构
-        const permissionsAction = {}
-        this.mdl.permissions.forEach(permission => {
-          permissionsAction[permission.permissionId] = permission.actionEntitySet.map(entity => entity.action)
-        })
-
-        console.log('permissionsAction', permissionsAction)
-        // 把权限表遍历一遍,设定要勾选的权限 action
-        this.permissions.forEach(permission => {
-          const selected = permissionsAction[permission.id]
-          permission.selected = selected || []
-          this.onChangeCheck(permission)
-        })
-
-        console.log('this.permissions', this.permissions)
-      }
-
-      this.$nextTick(() => {
-        this.form.setFieldsValue(pick(this.mdl, 'id', 'name', 'status', 'describe'))
-      })
-      console.log('this.mdl', this.mdl)
-    },
-
-    onChangeCheck (permission) {
-      permission.indeterminate = !!permission.selected.length && (permission.selected.length < permission.actionsOptions.length)
-      permission.checkedAll = permission.selected.length === permission.actionsOptions.length
-    },
-    onChangeCheckAll (e, permission) {
-      console.log('permission:', permission)
-
-      Object.assign(permission, {
-        selected: e.target.checked ? permission.actionsOptions.map(obj => obj.value) : [],
-        indeterminate: false,
-        checkedAll: e.target.checked
-      })
-    },
-    loadPermissions () {
-      getPermissions().then(res => {
-        const result = res.result
-        this.permissions = result.map(permission => {
-          const options = actionToObject(permission.actionData)
-          permission.checkedAll = false
-          permission.selected = []
-          permission.indeterminate = false
-          permission.actionsOptions = options.map(option => {
-            return {
-              label: option.describe,
-              value: option.action
-            }
-          })
-          return permission
-        })
-      })
-    }
-  }
-}
-</script>
-
-<style scoped>
-
-</style>

+ 47 - 6
yarn.lock

@@ -2268,7 +2268,7 @@ ansi-styles@^4.0.0, ansi-styles@^4.1.0:
   dependencies:
     color-convert "^2.0.1"
 
-ant-design-vue@^1.6.2, ant-design-vue@^1.7.5:
+ant-design-vue@^1.6.2:
   version "1.7.5"
   resolved "https://registry.yarnpkg.com/ant-design-vue/-/ant-design-vue-1.7.5.tgz#e7ed04cb358adc56be02c7453d2db026d2c405e3"
   integrity sha512-QVrirCz6eetzui+Dv/ujMqUwIr8e/2H+pKr4VC3mpc+cHkw6L9cBRJK7DhfO7GTyK4EWKkEH3lfLWlD/XjUoQQ==
@@ -2304,6 +2304,42 @@ ant-design-vue@^1.6.2, ant-design-vue@^1.7.5:
     vue-ref "^2.0.0"
     warning "^4.0.0"
 
+ant-design-vue@^1.7.6:
+  version "1.7.6"
+  resolved "https://registry.npmjs.org/ant-design-vue/-/ant-design-vue-1.7.6.tgz#976a84ff037c2e5f0586dcd697eafb8cf7983b1e"
+  integrity sha512-EOS6g/deT53xHxZDMOxedyBehXSNMGnxdOeQtDksmiRvCBrZs+yoFYoVOe9pmQ8EJ7XQLn8TMReiYbXi78kppA==
+  dependencies:
+    "@ant-design/icons" "^2.1.1"
+    "@ant-design/icons-vue" "^2.0.0"
+    "@simonwep/pickr" "~1.7.0"
+    add-dom-event-listener "^1.0.2"
+    array-tree-filter "^2.1.0"
+    async-validator "^3.0.3"
+    babel-helper-vue-jsx-merge-props "^2.0.3"
+    babel-runtime "6.x"
+    classnames "^2.2.5"
+    component-classes "^1.2.6"
+    dom-align "^1.10.4"
+    dom-closest "^0.2.0"
+    dom-scroll-into-view "^2.0.0"
+    enquire.js "^2.1.6"
+    intersperse "^1.0.0"
+    is-mobile "^2.2.1"
+    is-negative-zero "^2.0.0"
+    ismobilejs "^1.0.0"
+    json2mq "^0.2.0"
+    lodash "^4.17.5"
+    moment "^2.21.0"
+    mutationobserver-shim "^0.3.2"
+    node-emoji "^1.10.0"
+    omit.js "^1.0.0"
+    raf "^3.4.0"
+    resize-observer-polyfill "^1.5.1"
+    shallow-equal "^1.0.0"
+    shallowequal "^1.0.2"
+    vue-ref "^2.0.0"
+    warning "^4.0.0"
+
 any-promise@^1.0.0:
   version "1.3.0"
   resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f"
@@ -11309,10 +11345,10 @@ vue-svg-icon-loader@^2.1.1:
     loader-utils "1.1.0"
     vue-svg-component-builder "2.0.3"
 
-vue-template-compiler@^2.6.10:
-  version "2.6.12"
-  resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.6.12.tgz#947ed7196744c8a5285ebe1233fe960437fcc57e"
-  integrity sha512-OzzZ52zS41YUbkCBfdXShQTe69j1gQDZ9HIX8miuC9C3rBCk9wIRjLiZZLrmX9V+Ftq/YEyv1JaVr5Y/hNtByg==
+vue-template-compiler@^2.6.14:
+  version "2.6.14"
+  resolved "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.6.14.tgz#a2f0e7d985670d42c9c9ee0d044fed7690f4f763"
+  integrity sha512-ODQS1SyMbjKoO1JBJZojSw6FE4qnh9rIpUZn2EUT86FKizx9uH5z6uXiIrm4/Nb/gwxTi/o17ZDEGWAXHvtC7g==
   dependencies:
     de-indent "^1.0.2"
     he "^1.1.0"
@@ -11322,7 +11358,7 @@ vue-template-es2015-compiler@^1.6.0, vue-template-es2015-compiler@^1.9.0:
   resolved "https://registry.yarnpkg.com/vue-template-es2015-compiler/-/vue-template-es2015-compiler-1.9.1.tgz#1ee3bc9a16ecbf5118be334bb15f9c46f82f5825"
   integrity sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==
 
-vue@^2.5.17, vue@^2.6.10:
+vue@^2.5.17:
   version "2.6.12"
   resolved "https://registry.yarnpkg.com/vue/-/vue-2.6.12.tgz#f5ebd4fa6bd2869403e29a896aed4904456c9123"
   integrity sha512-uhmLFETqPPNyuLLbsKz6ioJ4q7AZHzD8ZVFNATNyICSZouqP2Sz0rotWQC8UNBF6VGSCs5abnKJoStA6JbCbfg==
@@ -11332,6 +11368,11 @@ vue@^2.5.3:
   resolved "https://registry.npm.taobao.org/vue/download/vue-2.6.11.tgz#76594d877d4b12234406e84e35275c6d514125c5"
   integrity sha1-dllNh31LEiNEBuhONSdcbVFBJcU=
 
+vue@^2.6.14:
+  version "2.6.14"
+  resolved "https://registry.npmjs.org/vue/-/vue-2.6.14.tgz#e51aa5250250d569a3fbad3a8a5a687d6036e235"
+  integrity sha512-x2284lgYvjOMj3Za7kqzRcUSxBboHqtgRE2zlos1qWaOye5yUmHn42LB1250NJBLRwEcdrB0JRwyPTEPhfQjiQ==
+
 vuex@^3.1.1:
   version "3.6.2"
   resolved "https://registry.yarnpkg.com/vuex/-/vuex-3.6.2.tgz#236bc086a870c3ae79946f107f16de59d5895e71"