From 5330eb812cdcc02cace0648b008092b24c6e2236 Mon Sep 17 00:00:00 2001 From: zhuzhuanzhuan Date: 星期三, 06 十二月 2023 17:44:50 +0800 Subject: [PATCH] 1、利用率走势分析和利用率分段分析页面优化表格数据加载方式,实现滚动条触底加载,解决数据量较大时网页请求速度慢问题 2、报警分析页面调整图表样式,更换表格组件为ant-design表格 3、登录页面登录后若用户密码为初始密码或密码已过期则出现修改密码弹窗 --- src/views/mdc/base/modules/openRateFractionAnalysis/openRateFractionAnalysisMain.vue | 67 ++++++++++++++++++++++++++++++--- 1 files changed, 61 insertions(+), 6 deletions(-) diff --git a/src/views/mdc/base/modules/openRateFractionAnalysis/openRateFractionAnalysisMain.vue b/src/views/mdc/base/modules/openRateFractionAnalysis/openRateFractionAnalysisMain.vue index c8900d9..4c809b1 100644 --- a/src/views/mdc/base/modules/openRateFractionAnalysis/openRateFractionAnalysisMain.vue +++ b/src/views/mdc/base/modules/openRateFractionAnalysis/openRateFractionAnalysisMain.vue @@ -115,7 +115,10 @@ }, tableHeads: [], XData: [0], - YData: [0] + YData: [0], + isLazyRequest: '',// 鏄惁寮�鍚噿鍔犺浇 + requestAlldataSize: 8,// 鎬诲叡璇锋眰鐨勫垪琛ㄩ」鏁扮洰 + everyRequestDataSize: 15// 姣忔璇锋眰鐨勫垪琛ㄩ」鏁扮洰 } }, props: { nodeTree: '', Type: '', nodePeople: '' }, @@ -131,6 +134,12 @@ this.queryParam.typeTree = '1' this.loadData1() + }, + mounted() { + this.tableScroll = document.querySelector('.table2') + }, + beforeDestroy() { + this.tableScroll.removeEventListener('scroll', this.tableScrollX) }, watch: { Type(valmath) { @@ -213,9 +222,12 @@ dateParamChange(v1, v2) { this.queryParam.startDate = v2[0] this.queryParam.endDate = v2[1] + this.dates = [v1[0], v1[1]] }, searchQuery() { - if (this.queryParam.startTime && this.queryParam.endTime && this.dates && this.dates.length > 0) { + this.queryParam.startDate = moment(this.dates[0]).format('YYYYMMDD') + this.queryParam.endDate = moment(this.dates[1]).format('YYYYMMDD') + if (this.queryParam.startTime && this.queryParam.endTime && this.dates[0] && this.dates[1]) { if (this.queryParam.typeTree == '1') { this.queryParam.parentId = this.queryParamEquip.parentId this.queryParam.equipmentId = this.queryParamEquip.equipmentId @@ -223,6 +235,7 @@ this.queryParam.parentId = this.queryParamPeople.parentId this.queryParam.equipmentId = '' } + this.requestAlldataSize = moment.duration(moment(this.queryParam.endDate) - moment(this.queryParam.startDate), 'millisecond').asDays() + 1 this.loadData1() } else { this.$notification.warning({ @@ -303,9 +316,16 @@ // } // } loadData1() { - this.loading=true + this.loading = true this.tableHeads = [] this.dataList = [] + // 鑻ユ棩鏈熼�夋嫨鍣ㄨ缃殑鏌ヨ璇锋眰鏁伴噺瓒呰繃15鏉″垯寮�鍚噿鍔犺浇 + if (this.requestAlldataSize > 15) { + // 寮�鍚噿鍔犺浇鍚庡皢缁撴潫鏃ユ湡璁剧疆涓哄紑濮嬫棩鏈熶箣鍚庣殑14澶╋紝鍗冲厛鏌ヨ15澶╁唴鐨勬暟鎹� + this.queryParam.endDate = moment(this.queryParam.startDate).add(this.everyRequestDataSize - 1, 'days').format('YYYYMMDD') + this.isLazyRequest = true + this.tableScroll.removeEventListener('scroll', this.tableScrollX) // 涓洪伩鍏嶆粴鍔ㄦ潯鏈夋粴鍔ㄨ窛绂诲悗鍚庣偣鍑绘煡璇㈡寜閽Е鍙戞粴鍔ㄤ簨浠讹紝鍥犳鍦ㄨЕ鍙戜簨浠跺墠绉婚櫎浜嬩欢 + } getAction(this.url.efficiencyList, this.queryParam).then(res => { if (res.success) { this.tableHeads = res.result.dates @@ -316,10 +336,10 @@ // this.checkSameData2(this.dataList) // this.combineCell(); // this.initDeviceType(this.dataList) - + this.tableScroll.addEventListener('scroll', this.tableScrollX) } - }).finally(()=>{ - this.loading=false + }).finally(() => { + this.loading = false }) }, draw() { @@ -379,6 +399,41 @@ ] } openRateTrendAnalysisChart.setOption(openRateTrendChartOptions, true) + }, + + /** + * 婊氬姩鏉¤Е搴曞埛鏂拌〃鏍兼暟鎹� + */ + tableScrollX() { + // 褰撴粴鍔ㄦ潯瑙﹀簳涓旀噿鍔犺浇寮�鍚椂瑙﹀彂婊氬姩鏉¤Е搴曞埛鏂� + if (Math.ceil(this.tableScroll.scrollLeft + this.tableScroll.clientWidth) + 1 >= this.tableScroll.scrollWidth && this.isLazyRequest) { + this.loading = true + this.queryParam.startDate = moment(this.queryParam.endDate).add(1, 'days').format('YYYYMMDD') + // 鍒ゆ柇璁剧疆鎳掑姞杞藉悗鐨勭粨鏉熸椂闂存槸鍚﹁秴杩囨椂闂撮�夋嫨鍣ㄤ腑璁剧疆鐨勭粨鏉熸椂闂� + if (moment(this.queryParam.endDate).add(this.everyRequestDataSize - 1, 'days').format('YYYYMMDD') - moment(this.dates[1]).format('YYYYMMDD') < 0) { + //鍐嶆鏌ヨ鍚�15澶╁唴鐨勬暟鎹� + this.queryParam.endDate = moment(this.queryParam.endDate).add(this.everyRequestDataSize, 'days').format('YYYYMMDD') + } else { + // 濡傛灉涓嶅皬浜庢椂闂撮�夋嫨鍣ㄤ腑璁剧疆鐨勬椂闂村垯璁剧疆璇锋眰缁撴潫鏃ユ湡涓烘椂闂撮�夋嫨鍣ㄤ腑璁剧疆鐨勭粨鏉熸椂闂村苟涓斿叧闂噿鍔犺浇锛堟剰鍛崇潃鏈�鍚庝竴娆¤Е搴曞埛鏂帮級 + this.queryParam.endDate = moment(this.dates[1]).format('YYYYMMDD') + this.isLazyRequest = false + } + getAction(this.url.efficiencyList, this.queryParam).then(res => { + if (res.success) { + this.tableHeads = [...this.tableHeads, ...res.result.dates] + this.dataList.forEach(item1 => { + res.result.mdcEfficiencyList.forEach(item2 => { + if (item1.equipmentId === item2.equipmentId) { + item1.dataList = [...item1.dataList, ...item2.dataList] + } + }) + }) + this.draw() + } + }).finally(() => { + this.loading = false + }) + } } } } -- Gitblit v1.9.3