From 9df83c42ffb45c4d5f51343e5fc97836cd850a77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B0=B4=E8=90=BD=28YangLei=29?= Date: Sun, 27 Jun 2021 21:11:05 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E5=96=84=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/menu.js | 4 ++ src/components/menu_tree/index.vue | 49 ++++++++++++++++++ src/components/popconfirm_delete/index.vue | 13 +++-- src/components/table/index.vue | 4 +- src/pages/system/view/menu/MenuManagement.vue | 13 ++--- src/pages/system/view/menu/form.vue | 32 +++--------- src/pages/system/view/role/RoleManagement.vue | 44 +++++++++++++++- src/pages/system/view/role/form.vue | 51 +++++++++++++++++++ 8 files changed, 166 insertions(+), 44 deletions(-) create mode 100644 src/components/menu_tree/index.vue create mode 100644 src/pages/system/view/role/form.vue diff --git a/src/api/menu.js b/src/api/menu.js index 2fbd36c..9b64f2d 100644 --- a/src/api/menu.js +++ b/src/api/menu.js @@ -11,3 +11,7 @@ export function getMenuDataApi() { export function addMenuApi(data) { return postReq('/api/v1/menus', data); } + +export function addRoleApi(data) { + return postReq('/api/v1/roles', data); +} diff --git a/src/components/menu_tree/index.vue b/src/components/menu_tree/index.vue new file mode 100644 index 0000000..269625f --- /dev/null +++ b/src/components/menu_tree/index.vue @@ -0,0 +1,49 @@ + + + diff --git a/src/components/popconfirm_delete/index.vue b/src/components/popconfirm_delete/index.vue index 0704f53..13da48a 100644 --- a/src/components/popconfirm_delete/index.vue +++ b/src/components/popconfirm_delete/index.vue @@ -1,19 +1,26 @@ diff --git a/src/components/table/index.vue b/src/components/table/index.vue index 13d0db7..f1dcb3b 100644 --- a/src/components/table/index.vue +++ b/src/components/table/index.vue @@ -124,6 +124,7 @@ export default { this.submitLoading = true; try { await this.addBtn?.onOk(); + this.getData(); } catch (error) { // todo } @@ -133,9 +134,6 @@ export default { showAdd() { this.addVisible = true; }, - refresh() { - this.getData(); - }, }, }; diff --git a/src/pages/system/view/menu/MenuManagement.vue b/src/pages/system/view/menu/MenuManagement.vue index ee18afc..e123280 100644 --- a/src/pages/system/view/menu/MenuManagement.vue +++ b/src/pages/system/view/menu/MenuManagement.vue @@ -7,12 +7,6 @@ noPage ref="table" > - - @@ -44,9 +38,8 @@ export default { text: '新建', title: '菜单配置', width: 400, - async onOk() { - await vm.$refs['addForm']?.submit(); - vm.refreshTable(); + onOk() { + return vm.$refs['addForm']?.submit(); }, }, sortOrder: 'ascend', @@ -57,7 +50,7 @@ export default { methods: { formatData: convertListToTree, refreshTable() { - this.$refs['table'].refresh(); + this.$refs['table'].getData(); }, async delMenu(id) { await delMenuApi(id); diff --git a/src/pages/system/view/menu/form.vue b/src/pages/system/view/menu/form.vue index bd41841..414341e 100644 --- a/src/pages/system/view/menu/form.vue +++ b/src/pages/system/view/menu/form.vue @@ -1,17 +1,7 @@ diff --git a/src/pages/system/view/role/form.vue b/src/pages/system/view/role/form.vue new file mode 100644 index 0000000..41b3a61 --- /dev/null +++ b/src/pages/system/view/role/form.vue @@ -0,0 +1,51 @@ + + + -- GitLab