From f67b4c736c68cd3d1f75e5fc6b6e23189f12b979 Mon Sep 17 00:00:00 2001 From: Lius <Lius2225@163.com> Date: 星期二, 19 十二月 2023 11:34:57 +0800 Subject: [PATCH] 设备管理增加按车间筛选条件 --- src/views/mdc/base/modules/openRateFractionAnalysis/openRateFractionAnalysisMain.vue | 76 +++++++++++++++++++++++++++++++++----- 1 files changed, 66 insertions(+), 10 deletions(-) diff --git a/src/views/mdc/base/modules/openRateFractionAnalysis/openRateFractionAnalysisMain.vue b/src/views/mdc/base/modules/openRateFractionAnalysis/openRateFractionAnalysisMain.vue index 42a5bb9..db3e659 100644 --- a/src/views/mdc/base/modules/openRateFractionAnalysis/openRateFractionAnalysisMain.vue +++ b/src/views/mdc/base/modules/openRateFractionAnalysis/openRateFractionAnalysisMain.vue @@ -1,6 +1,6 @@ <template> <div class="efficiency_list" style="width: 100%;height: 100%;"> - <a-card :bordered="false"> + <div :bordered="false" style="height: 100%"> <!-- 鏌ヨ鍖哄煙 --> <div class="table-page-search-wrapper"> <a-form layout="inline" @keyup.enter.native="searchQuery"> @@ -11,7 +11,7 @@ v-model="dates"/> </a-form-item> </a-col> - <a-col :md="7" :sm="7" :xs="7"> + <a-col :md="6" :sm="6" :xs="6"> <a-form-item label="鏃堕棿娈�"> <a-time-picker :default-value="moment('00:00', 'HH:mm')" format="HH:mm" @change="onChangeStart"/> 鑷� @@ -64,7 +64,7 @@ </div> <div id="openRateTrendChart" style="width: 100%;height: 60%"></div> </div> - </a-card> + </div> </div> </template> @@ -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,17 +336,17 @@ // 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() { let openRateTrendAnalysisChart = this.$echarts.init(document.getElementById('openRateTrendChart'), 'macarons') let openRateTrendChartOptions = { title: { - text: '鍒╃敤鐜囪蛋鍔垮垎鏋�', + text: '鍒╃敤鐜囧垎娈靛垎鏋�', x: 'center', textStyle: { fontSize: 18, @@ -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 + }) + } } } } @@ -422,6 +477,7 @@ .dataContent .mathData td { padding: 10px; /*display: none;*/ + cursor: pointer; } .dataContent .mathData:hover td { -- Gitblit v1.9.3