From c3f8c61e76958e0f0cdb331e215ec83351fc2122 Mon Sep 17 00:00:00 2001 From: chenjinsong <523037378@qq.com> Date: Mon, 20 Jan 2020 17:32:03 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E8=B0=83=E6=95=B4panel=E5=BC=B9?= =?UTF-8?q?=E6=A1=86=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/assets/stylus/main.scss | 19 ++-- .../src/components/common/language/en.js | 2 +- .../components/common/rightBox/panelBox.vue | 99 ++++++++----------- .../components/page/asset/assetAddUnit.vue | 2 +- .../components/page/asset/assetEditUnit.vue | 2 +- .../components/page/dashboard/chartBox.vue | 66 ++++--------- .../src/components/page/dashboard/panel.vue | 4 +- 7 files changed, 73 insertions(+), 121 deletions(-) diff --git a/nezha-fronted/src/assets/stylus/main.scss b/nezha-fronted/src/assets/stylus/main.scss index 6d820e1cd..9a8ee3f18 100644 --- a/nezha-fronted/src/assets/stylus/main.scss +++ b/nezha-fronted/src/assets/stylus/main.scss @@ -244,14 +244,10 @@ li{ .el-textarea__inner { padding: 5px 60px 5px 15px; } -.nz-input-group-prepend { - border-radius: 4px 0 0 4px; -} -.nz-input-group-middle, .nz-input-group-middle .el-input__inner { - border-radius: 0; -} -.nz-input-group-append { - border-radius: 0 4px 4px 0; +.nz-input-append { + position: absolute; + right: 5px; + color: #666; } /* end--el-input扩展 */ @@ -538,7 +534,7 @@ li{ .right-box-account, .right-box-prom, .right-box-alert-config, .right-box-project, .right-box-module, .right-box-edit-endpoint, .right-box-panel { width: 520px; } -.right-box-add-asset { +.right-box-add-asset, .right-box-add-chart { width: 550px; } .right-box-add-endpoint { @@ -893,10 +889,6 @@ li{ } /* end--自定义可编辑的el-select下拉框样式*/ -.right-box-add-chart { - width: 520px; - height: calc(100% - 100px); -} /*子菜单选中样式*/ .nz-submenu .el-menu--popup .el-menu-item .menu-item-active{ color:$global-text-color-active !important; @@ -905,3 +897,4 @@ li{ content: "\E6CA"; color: #BA3939; } + diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index 0938f6ca8..fc2cdc68e 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -61,7 +61,7 @@ const en = { } }, width:"Width", - high:"High", + high:"Height", metric:"Metric", addMetric:"Add Metric", }, diff --git a/nezha-fronted/src/components/common/rightBox/panelBox.vue b/nezha-fronted/src/components/common/rightBox/panelBox.vue index 5d305647d..2f4eca80a 100644 --- a/nezha-fronted/src/components/common/rightBox/panelBox.vue +++ b/nezha-fronted/src/components/common/rightBox/panelBox.vue @@ -3,35 +3,10 @@
- - - -
@@ -40,22 +15,24 @@ -
-
-
{{$t('dashboard.panel.panelForm.panelName')}}
-
- -
-
-
+ + + + + + + -
@@ -101,27 +78,33 @@ }); }, save: function() { - if (this.panel.id) { - this.$put('panel', this.panel).then(response => { - if (response.code === 200) { - this.esc(); - this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")}); - this.$emit("reload"); + this.$refs.panelForm.validate((valid) => { + if (valid) { + if (this.panel.id) { + this.$put('panel', this.panel).then(response => { + if (response.code === 200) { + this.esc(); + this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")}); + this.$emit("reload"); + } else { + this.$message.error(response.msg); + } + }); } else { - this.$message.error(response.msg); + this.$post('panel', this.panel).then(response => { + if (response.code === 200) { + this.esc(); + this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")}); + this.$emit("reload"); + } else { + this.$message.error(response.msg); + } + }); } - }); - } else { - this.$post('panel', this.panel).then(response => { - if (response.code === 200) { - this.esc(); - this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")}); - this.$emit("reload"); - } else { - this.$message.error(response.msg); - } - }); - } + } else { + return false; + } + }); }, esc: function() { this.rightBox.show = false; diff --git a/nezha-fronted/src/components/page/asset/assetAddUnit.vue b/nezha-fronted/src/components/page/asset/assetAddUnit.vue index f12527c44..e2f9e93b7 100644 --- a/nezha-fronted/src/components/page/asset/assetAddUnit.vue +++ b/nezha-fronted/src/components/page/asset/assetAddUnit.vue @@ -349,7 +349,7 @@ {{$t('overall.cancel')}} diff --git a/nezha-fronted/src/components/page/asset/assetEditUnit.vue b/nezha-fronted/src/components/page/asset/assetEditUnit.vue index 11dcad1dc..c04de8263 100644 --- a/nezha-fronted/src/components/page/asset/assetEditUnit.vue +++ b/nezha-fronted/src/components/page/asset/assetEditUnit.vue @@ -391,7 +391,7 @@ {{$t('overall.cancel')}} diff --git a/nezha-fronted/src/components/page/dashboard/chartBox.vue b/nezha-fronted/src/components/page/dashboard/chartBox.vue index 67ea5f2af..f75cd8e06 100644 --- a/nezha-fronted/src/components/page/dashboard/chartBox.vue +++ b/nezha-fronted/src/components/page/dashboard/chartBox.vue @@ -55,14 +55,9 @@
- - -
@@ -79,13 +74,13 @@ - +
{{$t('dashboard.panel.chartForm.type')}}
- +
- + {{item.name}} @@ -93,13 +88,13 @@
- +
{{$t('dashboard.panel.chartForm.width')}}
- + span-{{item}} @@ -107,13 +102,13 @@
- +
{{$t('dashboard.panel.chartForm.high')}}
-
- +
- - px + + + px
@@ -152,36 +147,15 @@ - - - - -
-
{{$t('overall.cancel')}}
{{$t('overall.create')}}
+ +
- --> - -
diff --git a/nezha-fronted/src/components/page/dashboard/panel.vue b/nezha-fronted/src/components/page/dashboard/panel.vue index bc82f6525..55b29f426 100644 --- a/nezha-fronted/src/components/page/dashboard/panel.vue +++ b/nezha-fronted/src/components/page/dashboard/panel.vue @@ -45,7 +45,9 @@
- +
  • {{i.name}}