From f092181b840c3d8bce25b2787f86d7aa802479e6 Mon Sep 17 00:00:00 2001 From: ibuler Date: Tue, 9 Jun 2020 15:05:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E7=BD=91=E5=85=B3?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=92=8C=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ListTable/formatters/ActionsFormatter.vue | 2 +- src/i18n/langs/cn.json | 10 +-- src/i18n/langs/en.json | 2 + .../GenericCreateUpdateForm/index.vue | 16 ++++- src/router/assets.js | 4 +- .../DomainDetail/GatewayCreateUpdate.vue | 48 +++++++++---- .../Domain/DomainDetail/GatewayList.vue | 70 ++++--------------- src/views/assets/Domain/DomainList.vue | 48 +++---------- 8 files changed, 81 insertions(+), 119 deletions(-) diff --git a/src/components/ListTable/formatters/ActionsFormatter.vue b/src/components/ListTable/formatters/ActionsFormatter.vue index 616345917..290a9e75b 100644 --- a/src/components/ListTable/formatters/ActionsFormatter.vue +++ b/src/components/ListTable/formatters/ActionsFormatter.vue @@ -92,7 +92,7 @@ export default { colActions: colActions, defaultActions: defaultActions, extraActions: colActions.extraActions, - moreActionsTitle: colActions.moreActionsTitle + moreActionsTitle: colActions.moreActionsTitle || this.$t('common.More') } }, computed: { diff --git a/src/i18n/langs/cn.json b/src/i18n/langs/cn.json index ef57ced7e..9edbaae4e 100644 --- a/src/i18n/langs/cn.json +++ b/src/i18n/langs/cn.json @@ -29,6 +29,8 @@ "": "" }, "assets": { + "PasswordWithoutSpecialCharHelpText": "不能包含特殊字符", + "GatewayProtocolHelpText": "SSH网关,支持代理SSH,RDP和VNC", "FullName": "全称", "Key": "键", "NodeInformation": "节点信息", @@ -416,10 +418,10 @@ "DatabaseAppPermissionDetail": "数据库授权详情", "DatabaseAppPermissionUpdate": "更新数据库授权规则", "DatabaseAppUpdate": "", - "DomainCreate": "创建网关", - "DomainDetail": "域名详情", - "DomainList": "网关列表", - "DomainUpdate": "更新网关", + "DomainCreate": "创建网域", + "DomainDetail": "网域详情", + "DomainList": "网域列表", + "DomainUpdate": "更新网域", "FileManager": "文件管理", "FtpLog": "FTP日志", "GatewayCreate": "创建网关", diff --git a/src/i18n/langs/en.json b/src/i18n/langs/en.json index 926765a9a..f6b919efb 100644 --- a/src/i18n/langs/en.json +++ b/src/i18n/langs/en.json @@ -29,6 +29,8 @@ "": "" }, "assets": { + "PasswordWithoutSpecialCharHelpText": "Password can't has special chars ", + "GatewayProtocolHelpText": "SSH protocol gateway, support proxy SSH, RDP, VNC", "FullName": "Full name", "Key": "Key", "NodeInformation": "Node information", diff --git a/src/layout/components/GenericCreateUpdateForm/index.vue b/src/layout/components/GenericCreateUpdateForm/index.vue index 992437205..a64a02cf7 100644 --- a/src/layout/components/GenericCreateUpdateForm/index.vue +++ b/src/layout/components/GenericCreateUpdateForm/index.vue @@ -87,6 +87,12 @@ export default { } } }, + getNextRoute: { + type: Function, + default(res, method) { + return method === 'post' ? this.createSuccessNextRoute : this.updateSuccessNextRoute + } + }, getUrl: { type: Function, default: function() { @@ -136,12 +142,16 @@ export default { defaultOnSubmit(validValues) { const performSubmit = this.performSubmit || this.defaultPerformSubmit const msg = this.method === 'post' ? this.createSuccessMsg : this.updateSuccessMsg - const route = this.method === 'post' ? this.createSuccessNextRoute : this.updateSuccessNextRoute + const event = this.method === 'post' ? 'createSuccess' : 'updateSuccess' this.isSubmitting = true - performSubmit(validValues).then(() => { + performSubmit(validValues).then((res) => { + const route = this.getNextRoute(res, this.method) + this.$emit(event, res) + this.$emit('submitSuccess', res) this.$message.success(msg) - this.$router.push(route) + setTimeout(() => this.$router.push(route), 100) }).catch(error => { + this.$emit('submitError', error) const response = error.response const data = response.data if (response.status === 400) { diff --git a/src/router/assets.js b/src/router/assets.js index 6f684da10..124fcea1a 100644 --- a/src/router/assets.js +++ b/src/router/assets.js @@ -55,14 +55,14 @@ export default [ hidden: true }, { - path: 'domains/:domainid/gateway/create', + path: 'gateways/create', name: 'GatewayCreate', component: () => import('@/views/assets/Domain/DomainDetail/GatewayCreateUpdate.vue'), meta: { title: i18n.t('route.GatewayCreate'), activeMenu: '/assets/domains' }, hidden: true }, { - path: 'domains/gateway/:id/create', + path: 'gateways/:id/update', name: 'GatewayUpdate', component: () => import('@/views/assets/Domain/DomainDetail/GatewayCreateUpdate.vue'), meta: { title: i18n.t('route.GatewayUpdate'), activeMenu: '/assets/domains' }, diff --git a/src/views/assets/Domain/DomainDetail/GatewayCreateUpdate.vue b/src/views/assets/Domain/DomainDetail/GatewayCreateUpdate.vue index b405af42b..d0feed735 100644 --- a/src/views/assets/Domain/DomainDetail/GatewayCreateUpdate.vue +++ b/src/views/assets/Domain/DomainDetail/GatewayCreateUpdate.vue @@ -4,14 +4,14 @@ :initial="initial" :fields-meta="fieldsMeta" :url="url" - :create-success-next-route="createSuccessNextRoute" - :update-success-next-route="updateSuccessNextRoute" + :get-next-route="getNextRoute" /> diff --git a/src/views/assets/Domain/DomainDetail/GatewayList.vue b/src/views/assets/Domain/DomainDetail/GatewayList.vue index 2d2a45171..73d272df4 100644 --- a/src/views/assets/Domain/DomainDetail/GatewayList.vue +++ b/src/views/assets/Domain/DomainDetail/GatewayList.vue @@ -3,7 +3,6 @@