From baf3e227f548ce658b1d9b4a856ace9b4446dec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=8A=B2=E6=9D=BE?= Date: Sat, 21 Nov 2020 18:39:44 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20panel=E6=80=A7=E8=83=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E3=80=81account=E5=A2=9E=E5=8A=A0notification?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/charts/line-chart-block.vue | 55 ++++++++++++++----- .../components/common/rightBox/accountBox.vue | 40 +++++++++----- .../src/components/page/config/account.vue | 14 ++--- 3 files changed, 75 insertions(+), 34 deletions(-) diff --git a/nezha-fronted/src/components/charts/line-chart-block.vue b/nezha-fronted/src/components/charts/line-chart-block.vue index c75299e33..7a1c05713 100644 --- a/nezha-fronted/src/components/charts/line-chart-block.vue +++ b/nezha-fronted/src/components/charts/line-chart-block.vue @@ -222,14 +222,14 @@ return { data: {}, // 该图表信息,chartItem noData:false, - seriesItem: [], // 保存信息 + /*seriesItem: [], // 保存信息 seriesItemArr:[],// 初次加载的数据 seriesLength:20, seriesItemScreen:[], - seriesItemArrScreen:[], - legendListMore:[], + seriesItemArrScreen:[],*/ + /*legendListMore:[], screenLegendListMore:[], - chartInfo:{}, + chartInfo:{},*/ images: '', isStackArea:false, isError:false, @@ -244,9 +244,9 @@ chartName: '', firstLoad: false, // 是否第一次加载 divFirstShow:false, - highchartStore: null, // 保存图表数据 + /*highchartStore: null, // 保存图表数据 echartStore:null,// 保存图表数据 - echartModalStore: null, // 全屏查看时数据 + echartModalStore: null, // 全屏查看时数据*/ chartType: 'line', // 图表类型 screenModal: false, // 查询数据使用 @@ -256,19 +256,19 @@ from: "" }, stableFilter: {}, // 保存数据使用,初始化起止时间,单图or多图等 - legend:[], + /*legend:[], legendList:[], - screenLegendList:[], + screenLegendList:[],*/ isGrey:[], isGreyScreen:[], - bgColorList: ['#7bbfea', '#b3424a', '#f05b72', '#596032', '#bd6758', + /*bgColorList: ['#7bbfea', '#b3424a', '#f05b72', '#596032', '#bd6758', '#cd9a5b', '#918597', '#70a19f', '#005344', '#FF00FF', '#f7acbc', '#5f5d46', '#66ffff', '#ccFF66', '#f47920', '#769149', '#1d953f', '#abc88b', '#7f7522', '#9b95c9', '#f3715c', '#ea66a6', '#d1c7b7', '#9d9087', '#77787b', '#f58220', '#c37e00', '#00ae9d', '#f26522', '#76becc', '#76624c', '#d71345', '#2468a2', '#ca8687', '#1b315e', - ], + ],*/ stackTotalColor:null, firstShow: false, // 默认不显示操作按钮, caretShow:false, @@ -278,8 +278,8 @@ oldSearchTime:[], screenTitleHeight:58, hasLegendOptions:false, - legendOptions:[], - screenLegendOptions:[], + /*legendOptions:[], + screenLegendOptions:[],*/ }; }, watch: {}, @@ -1021,7 +1021,8 @@ }); }); } - maxValueCopies=null; + maxValueCopies = null; + setTimeout(() => {option = null}, 1000); }, handleLineFeed(str,chartWidth){ let rlt=''; @@ -1714,6 +1715,34 @@ getChart(this.chartIndex).resize(); } }, + created() { + this.legendListMore = []; + this.screenLegendListMore = []; + this.chartInfo = {}; + this.seriesItem = []; // 保存信息 + this.seriesItemArr = [];// 初次加载的数据 + this.seriesLength = 20; + this.seriesItemScreen = []; + this.seriesItemArrScreen = []; + this.legend = []; + this.legendList = []; + this.screenLegendList = []; + this.legendOptions = []; + this.screenLegendOptions = []; + + this.highchartStore = null, // 保存图表数据 + this.echartStore = null,// 保存图表数据 + this.echartModalStore = null, // 全屏查看时数据 + + this.bgColorList = ['#7bbfea', '#b3424a', '#f05b72', '#596032', '#bd6758', + '#cd9a5b', '#918597', '#70a19f', '#005344', '#FF00FF', + '#f7acbc', '#5f5d46', '#66ffff', '#ccFF66', '#f47920', + '#769149', '#1d953f', '#abc88b', '#7f7522', '#9b95c9', + '#f3715c', '#ea66a6', '#d1c7b7', '#9d9087', '#77787b', + '#f58220', '#c37e00', '#00ae9d', '#f26522', '#76becc', + '#76624c', '#d71345', '#2468a2', '#ca8687', '#1b315e', + ]; + }, mounted() { this.firstLoad = false; if(!document.onmousemove){// 添加鼠标移动事件监听 diff --git a/nezha-fronted/src/components/common/rightBox/accountBox.vue b/nezha-fronted/src/components/common/rightBox/accountBox.vue index 4428aa023..40fe8dfd4 100644 --- a/nezha-fronted/src/components/common/rightBox/accountBox.vue +++ b/nezha-fronted/src/components/common/rightBox/accountBox.vue @@ -86,7 +86,9 @@ } }, addDisabled() { - let enabled = this.selectableScripts.filter(item => {return !item.disabled}); + let enabled = this.selectableScripts.filter(item => { + return !item.disabled + }); return enabled.length === 0; } }, @@ -180,24 +182,37 @@ }, getSelectableScripts() { - this.selectableScripts = this.scripts.map(item => { - let exist = this.editUser.notifications.some(n => { - return item.id === n.scriptId; + let userNotifications = this.editUser.notifications; + if (userNotifications) { + 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; }); - if (exist) { - this.$set(item, "disabled", true); - } else { + } else { + this.selectableScripts = this.scripts.map(item => { this.$set(item, "disabled", false); - } - return item; - }); + return item; + }); + } }, addNotification() { let scripts = this.selectableScripts.find(item => { return item.disabled === false; }); - scripts && this.editUser.notifications.push({scriptId: scripts.id, account: ""}); + if (scripts) { + if (!this.editUser.notifications) { + this.editUser.notifications = []; + } + this.editUser.notifications.push({scriptId: scripts.id, account: ""}); + } }, removeNotification(index) { @@ -246,9 +261,6 @@ .el-select { width: 100px; - .el-input__inner { - vertical-align: top; - } } } diff --git a/nezha-fronted/src/components/page/config/account.vue b/nezha-fronted/src/components/page/config/account.vue index e2921472d..bb5dbdf2b 100644 --- a/nezha-fronted/src/components/page/config/account.vue +++ b/nezha-fronted/src/components/page/config/account.vue @@ -93,7 +93,7 @@ {{utcTimeToTimezoneStr(scope.row[item.prop])}} {{scope.row[item.prop]}} @@ -371,7 +371,7 @@ }, plmouseleave(el,self){ self.tools.tableHover = false; - } + }, resetTableTitle:function(){ let title = this.tools.customTableTitle; @@ -401,16 +401,15 @@ {id: 5, name: "DST:X"}, ];*/ }, - filterTags(scriptId, scope) { - this.$nextTick(() => { + filterTags(head, scope) { + if (scope.row.notifications) { let notification = scope.row.notifications.find(item => { - return scriptId === item.scriptId; + return head.scriptId === item.scriptId; }); if (notification) { return notification.account; } - }) - + } } }, computed: { @@ -446,6 +445,7 @@ : this.tableTitle; this.tableTitleReset(this.tableTitle,this.tools.customTableTitle); + this.resetTableTitle(); this.getTableData(); this.$nextTick(() => { //绑定滚动条事件,控制top按钮