diff --git a/nezha-fronted/src/components/common/language/cn.js b/nezha-fronted/src/components/common/language/cn.js
index 8d5e0585d..a033644e6 100644
--- a/nezha-fronted/src/components/common/language/cn.js
+++ b/nezha-fronted/src/components/common/language/cn.js
@@ -570,7 +570,8 @@ const cn = {
inputConfirmPwd: "请再次输入密码",
invalidPwd: "无效的密码,最少6个字符",
confirmPwdErr: "两次密码输入不一致",
- reinputPwd: "请再次输入密码"
+ reinputPwd: "请再次输入密码",
+ notification: "通知"
},
promServer: {
promServerList: "Prometheus服务",
diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js
index d6e261116..b4468c59e 100644
--- a/nezha-fronted/src/components/common/language/en.js
+++ b/nezha-fronted/src/components/common/language/en.js
@@ -574,7 +574,8 @@ const en = {
inputConfirmPwd:'Please input confirm password',
invalidPwd:'invalide password,the length at least 6',
confirmPwdErr:'The two passwords are inconsistent',
- reinputPwd:'Enter password again'
+ reinputPwd:'Enter password again',
+ notification: 'Notification'
},
promServer: {
promServerList: 'Prometheus server',//"Prometheus Server"
diff --git a/nezha-fronted/src/components/common/rightBox/accountBox.vue b/nezha-fronted/src/components/common/rightBox/accountBox.vue
index 18ddb578f..4428aa023 100644
--- a/nezha-fronted/src/components/common/rightBox/accountBox.vue
+++ b/nezha-fronted/src/components/common/rightBox/accountBox.vue
@@ -41,6 +41,22 @@
{{editUser.createTime}}
+
+
{{$t('config.account.notification')}}
+
+
+
+
+
+
+
+
+
+
+
+
@@ -68,10 +84,15 @@
return function(username) {
return localStorage.getItem('nz-username') == username;
}
+ },
+ addDisabled() {
+ let enabled = this.selectableScripts.filter(item => {return !item.disabled});
+ return enabled.length === 0;
}
},
data() {
return {
+ scriptIds: [],
rules: { //表单校验规则
username: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
@@ -84,7 +105,9 @@
{type: 'email', message: this.$t('validate.email')}
]
},
- editUser: {}
+ editUser: {},
+ scripts: [],
+ selectableScripts: []
}
},
methods: {
@@ -140,6 +163,49 @@
});
});
},
+
+ getScripts() {
+ this.$get("/alert/script?pageNo=1&pageSize=-1").then(response => {
+ this.scripts = response.data.list;
+ this.getSelectableScripts();
+ });
+ /*this.scripts = [
+ {id: 1, name: "DOLBY"},
+ {id: 2, name: "IMAX"},
+ {id: 3, name: "CGS"},
+ {id: 4, name: "LUXE"},
+ {id: 5, name: "DST:X"},
+ ];
+ this.getSelectableScripts();*/
+ },
+
+ getSelectableScripts() {
+ this.selectableScripts = this.scripts.map(item => {
+ let exist = this.editUser.notifications.some(n => {
+ return item.id === n.scriptId;
+ });
+ if (exist) {
+ this.$set(item, "disabled", true);
+ } else {
+ this.$set(item, "disabled", false);
+ }
+ return item;
+ });
+ },
+
+ addNotification() {
+ let scripts = this.selectableScripts.find(item => {
+ return item.disabled === false;
+ });
+ scripts && this.editUser.notifications.push({scriptId: scripts.id, account: ""});
+ },
+
+ removeNotification(index) {
+ this.editUser.notifications.splice(index, 1);
+ }
+ },
+ mounted() {
+ this.getScripts();
},
watch: {
//将prop里的user转为组件内部对象
@@ -149,7 +215,40 @@
handler(n) {
this.editUser = JSON.parse(JSON.stringify(n));
}
+ },
+ "editUser.notifications": {
+ deep: true,
+ immediate: true,
+ handler(n) {
+ this.getSelectableScripts();
+ }
}
},
}
+
diff --git a/nezha-fronted/src/components/page/config/account.vue b/nezha-fronted/src/components/page/config/account.vue
index 75a873b18..e2921472d 100644
--- a/nezha-fronted/src/components/page/config/account.vue
+++ b/nezha-fronted/src/components/page/config/account.vue
@@ -57,10 +57,15 @@
v-for="(item, index) in tools.customTableTitle"
v-if="item.show"
:key="`col-${index}`"
+ :fixed="item.fixed"
:label="item.label"
:prop="item.prop"
:sort-orders="['ascending', 'descending']"
>
+
+
+ {{item.label}}
+