From ed91fd20ce987f27020fa5bc04dbfa8f69af02d0 Mon Sep 17 00:00:00 2001
From: chenjinsong <523037378@qq.com>
Date: Wed, 15 Jul 2020 20:43:19 +0800
Subject: [PATCH] =?UTF-8?q?perf:=20promserver=E9=87=8D=E6=9E=84=E3=80=81?=
=?UTF-8?q?=E5=BC=80=E5=A7=8B=E6=8A=BD=E5=8F=96=E5=B8=B8=E9=87=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/components/common/js/constants.js | 11 +
.../src/{ => components/common/js}/tools.js | 0
.../components/common/rightBox/accountBox.vue | 2 +-
.../common/rightBox/promServerBox.vue | 176 ++++++++
.../src/components/page/config/account.vue | 56 +--
.../src/components/page/config/promServer.vue | 400 +++---------------
nezha-fronted/src/main.js | 4 +-
7 files changed, 257 insertions(+), 392 deletions(-)
create mode 100644 nezha-fronted/src/components/common/js/constants.js
rename nezha-fronted/src/{ => components/common/js}/tools.js (100%)
create mode 100644 nezha-fronted/src/components/common/rightBox/promServerBox.vue
diff --git a/nezha-fronted/src/components/common/js/constants.js b/nezha-fronted/src/components/common/js/constants.js
new file mode 100644
index 000000000..e6e54cebe
--- /dev/null
+++ b/nezha-fronted/src/components/common/js/constants.js
@@ -0,0 +1,11 @@
+export const promServer = {
+ typeOption: [
+ {
+ key: 1,
+ value: 'Global'
+ }, {
+ key: 2,
+ value: 'Per-Datacenter'
+ }
+ ],
+};
diff --git a/nezha-fronted/src/tools.js b/nezha-fronted/src/components/common/js/tools.js
similarity index 100%
rename from nezha-fronted/src/tools.js
rename to nezha-fronted/src/components/common/js/tools.js
diff --git a/nezha-fronted/src/components/common/rightBox/accountBox.vue b/nezha-fronted/src/components/common/rightBox/accountBox.vue
index 753b1a693..fd2fd2d17 100644
--- a/nezha-fronted/src/components/common/rightBox/accountBox.vue
+++ b/nezha-fronted/src/components/common/rightBox/accountBox.vue
@@ -99,7 +99,7 @@
/*保存*/
save() {
- this.$refs.accountForm.validate((valid) => {
+ this.$refs.accountForm.validate(valid => {
if (valid) {
if (this.editUser.userId) {
this.$put('sys/user/update', this.editUser).then(response => {
diff --git a/nezha-fronted/src/components/common/rightBox/promServerBox.vue b/nezha-fronted/src/components/common/rightBox/promServerBox.vue
new file mode 100644
index 000000000..3c2c4b819
--- /dev/null
+++ b/nezha-fronted/src/components/common/rightBox/promServerBox.vue
@@ -0,0 +1,176 @@
+
+
+
+
+
+
+
+
+
+
{{editPromServer.id ? ($t("config.promServer.editProm") + " ID:" + editPromServer.id) : $t("config.promServer.createProm")}}
+
+
+
+
+
+
+
+
+
+
+ {{item.name}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/nezha-fronted/src/components/page/config/account.vue b/nezha-fronted/src/components/page/config/account.vue
index 6f45bc9d4..f6fbd5479 100644
--- a/nezha-fronted/src/components/page/config/account.vue
+++ b/nezha-fronted/src/components/page/config/account.vue
@@ -42,7 +42,7 @@
-
@@ -163,7 +163,7 @@
rightBox: { //弹出框相关
show: false,
},
- blankUser: {
+ blankUser: { //空白对象
userId: '',
username: '',
email: '',
@@ -321,42 +321,20 @@
}
})
},
- toAdd() {
+ add() {
this.cleanUser();
this.rightBox.show = true;
},
- save() {
- this.$refs.accountForm.validate((valid) => {
- if (valid) {
- if (this.user.userId) {
- this.$put('sys/user/update', this.user).then(response => {
- if (response.code === 200) {
- this.rightBox.show = false;
- this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
- } else {
- this.$message.error(response.msg);
- }
- this.getTableData();
- });
- } else {
- this.$post('sys/user/save', this.user).then(response => {
- if (response.code === 200) {
- this.rightBox.show = false;
- this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
- this.getTableData();
- } else {
- this.$message.error(response.msg);
- }
- });
- }
- } else {
- return false;
- }
- })
- },
statusChange(user) {
- this.user = user;
- this.save();
+ this.$put('sys/user/update', user).then(response => {
+ if (response.code === 200) {
+ this.rightBox.show = false;
+ this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
+ } else {
+ this.$message.error(response.msg);
+ }
+ this.getTableData();
+ });
},
jumpTo(data, id) {
this.$router.push({
@@ -370,15 +348,7 @@
this.rightBox.show = false;
},
cleanUser() {
- this.user = {
- userId: '',
- username: '',
- email: '',
- status: '1',
- createTime: '',
- receiver: [],
- lang: 'en'
- }
+ this.user = JSON.parse(JSON.stringify(this.blankUser));
},
pageNo(val) {
this.pageObj.pageNo = val;
diff --git a/nezha-fronted/src/components/page/config/promServer.vue b/nezha-fronted/src/components/page/config/promServer.vue
index b96fcd066..925b0b9f4 100644
--- a/nezha-fronted/src/components/page/config/promServer.vue
+++ b/nezha-fronted/src/components/page/config/promServer.vue
@@ -40,7 +40,7 @@
-
@@ -68,7 +68,7 @@
-
+
@@ -96,85 +96,7 @@
-
-
-
-
-
-
-
-
-
-
{{rightBox.title}}
-
-
-
-
-
-
-
-
-
-
- {{item.name}}
-
-
-
{{promServer.idc.name}}
-
-
-
-
-
-
-
- {{promServer.host}}
-
-
-
-
- {{promServer.port}}
-
-
-
-
-
-
- {{item.value}}
-
-
-
-
-
-
-
-
-
-
-
-
+