From c2cb2d125cd892a823ff402a71a351c07a433e5e Mon Sep 17 00:00:00 2001 From: junjie Date: Wed, 19 May 2021 18:21:07 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=A7=86=E5=9B=BE):=E7=BB=B4=E5=BA=A6?= =?UTF-8?q?=E3=80=81=E6=8C=87=E6=A0=87=20=E6=98=BE=E7=A4=BA=E5=90=8D?= =?UTF-8?q?=EF=BC=8C=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/chart/view/ChartEdit.vue | 23 ++++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index 16415975ba..a025bd13d5 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -363,7 +363,8 @@ export default { }, itemFormRules: { name: [ - { required: true, message: this.$t('commons.input_content'), trigger: 'change' } + { required: true, message: this.$t('commons.input_content'), trigger: 'change' }, + { max: 50, message: this.$t('commons.char_can_not_more_50'), trigger: 'change' } ] }, tabStatus: false, @@ -772,13 +773,19 @@ export default { this.renameItem = true }, saveRename() { - if (this.itemForm.renameType === 'quota') { - this.view.yaxis[this.itemForm.index].name = this.itemForm.name - } else if (this.itemForm.renameType === 'dimension') { - this.view.xaxis[this.itemForm.index].name = this.itemForm.name - } - this.save(true) - this.closeRename() + this.$refs['itemForm'].validate((valid) => { + if (valid) { + if (this.itemForm.renameType === 'quota') { + this.view.yaxis[this.itemForm.index].name = this.itemForm.name + } else if (this.itemForm.renameType === 'dimension') { + this.view.xaxis[this.itemForm.index].name = this.itemForm.name + } + this.save(true) + this.closeRename() + } else { + return false + } + }) }, closeRename() { this.renameItem = false