From 9ed610802c69c741e806a064ee975e604cc455ee Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Thu, 29 Apr 2021 15:38:03 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=95=B0=E6=8D=AE=E6=BA=90=E5=BC=B9?= =?UTF-8?q?=E6=A1=86=E6=94=B9=E4=B8=BA=E9=9A=90=E8=97=8F=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/DatasourceController.java | 2 +- frontend/src/layout/components/Topbar.vue | 10 +- frontend/src/views/system/datasource/form.vue | 135 ++++++++++++++++++ .../src/views/system/datasource/index.vue | 20 ++- 4 files changed, 158 insertions(+), 9 deletions(-) create mode 100644 frontend/src/views/system/datasource/form.vue diff --git a/backend/src/main/java/io/dataease/datasource/controller/DatasourceController.java b/backend/src/main/java/io/dataease/datasource/controller/DatasourceController.java index c04b3fc470..a234522869 100644 --- a/backend/src/main/java/io/dataease/datasource/controller/DatasourceController.java +++ b/backend/src/main/java/io/dataease/datasource/controller/DatasourceController.java @@ -41,7 +41,7 @@ public class DatasourceController { return PageUtils.setPageInfo(page, datasourceService.gridQuery(request)); } - @GetMapping("/delete/{datasourceID}") + @PostMapping("/delete/{datasourceID}") public void deleteDatasource(@PathVariable(value = "datasourceID") String datasourceID) { datasourceService.deleteDatasource(datasourceID); } diff --git a/frontend/src/layout/components/Topbar.vue b/frontend/src/layout/components/Topbar.vue index 0a5f5ddeab..e827dbefcf 100644 --- a/frontend/src/layout/components/Topbar.vue +++ b/frontend/src/layout/components/Topbar.vue @@ -187,12 +187,20 @@ export default { }, // 设置侧边栏的显示和隐藏 setSidebarHide(route) { - if (!route.children || route.children.length === 1) { + // if (!route.children || route.children.length === 1) { + if (!route.children || this.showChildLength(route) === 1) { this.$store.dispatch('app/toggleSideBarHide', true) } else { this.$store.dispatch('app/toggleSideBarHide', false) } }, + // 获取非隐藏子路由的个数 + showChildLength(route) { + if (!route || !route.children) { + return 0 + } + return route.children.filter(kid => !kid.hidden).length + }, async logout() { await this.$store.dispatch('user/logout') this.$router.push(`/login?redirect=${this.$route.fullPath}`) diff --git a/frontend/src/views/system/datasource/form.vue b/frontend/src/views/system/datasource/form.vue new file mode 100644 index 0000000000..151babff7b --- /dev/null +++ b/frontend/src/views/system/datasource/form.vue @@ -0,0 +1,135 @@ + + + diff --git a/frontend/src/views/system/datasource/index.vue b/frontend/src/views/system/datasource/index.vue index f6f63e7702..6ae8bed3b2 100644 --- a/frontend/src/views/system/datasource/index.vue +++ b/frontend/src/views/system/datasource/index.vue @@ -125,7 +125,7 @@ export default { label: this.$t('commons.edit'), icon: 'el-icon-edit', click: this.edit, show: checkPermission(['datasource:edit']) }, { - label: this.$t('commons.delete'), icon: 'el-icon-delete', type: 'danger', click: this.del, + label: this.$t('commons.delete'), icon: 'el-icon-delete', type: 'danger', click: this._handleDelete, show: checkPermission(['datasource:del']) } ], @@ -161,16 +161,22 @@ export default { select(selection) { console.log(selection) }, + // create() { + // this.formType = 'add' + // this.dialogVisible = true + // }, create() { - this.formType = 'add' - this.dialogVisible = true + this.$router.push({ name: '数据源表单' }) }, + // edit(row) { + // this.formType = 'modify' + // this.dialogVisible = true + // this.form = Object.assign({}, row) + // this.form.configuration = JSON.parse(this.form.configuration) + // }, edit(row) { - this.formType = 'modify' - this.dialogVisible = true - this.form = Object.assign({}, row) - this.form.configuration = JSON.parse(this.form.configuration) + this.$router.push({ name: '数据源表单', params: row }) }, _handleDelete(datasource) {