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 @@ + + 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}} -
-
-
-
- - - -
- - -
-
+