From 1f4e7d0f73a73e7350cf5a1df279d5f30904c5d5 Mon Sep 17 00:00:00 2001 From: jiangping <jp@doumee.com> Date: 星期三, 06 十二月 2023 08:41:32 +0800 Subject: [PATCH] bug --- screen_standard/src/views/process.vue | 122 ++++++++++++++++++++++++---------------- 1 files changed, 72 insertions(+), 50 deletions(-) diff --git a/screen_standard/src/views/process.vue b/screen_standard/src/views/process.vue index 3ac67d4..39e7975 100644 --- a/screen_standard/src/views/process.vue +++ b/screen_standard/src/views/process.vue @@ -113,7 +113,7 @@ </template> <script setup> -import { reactive, ref, toRefs, onMounted, onBeforeUnmount, onUnmounted } from 'vue' +import { reactive, ref, toRefs, onMounted, onUnmounted, nextTick } from 'vue' import { getProcedurePlanData, getTop, getProcedurePlansList, getRecordLogPage, getUnqualified7DayData, getUnqualifiedCateData } from '@/utils/api.js' import { useCounterStore } from '@/stores/counter.js' import { useRoute } from 'vue-router' @@ -122,8 +122,7 @@ const route = useRoute() const enterprise = useCounterStore() let mainTimer = ref(null) -let planTimer = ref(null) -let reportTimer = ref(null) +let scrollTimer = ref(null) let planContainer = ref(null) let reportLogContainer = ref(null) const data = reactive({ @@ -140,19 +139,26 @@ { categoryName: '灏哄涓嶈壇', unqualifiedNum: 22 }, { categoryName: '鏈夊垝鐥�', unqualifiedNum: 5 }, { categoryName: '鍏朵粬', unqualifiedNum: 2 }, - ] + ], + planScroll: false, + reportScroll: false, }) let { listData, top1, top2, baseNum, allBad, reportListData } = toRefs(data) -// start() -onBeforeUnmount(() => { - clearTimeout(planTimer.value) - clearTimeout(reportTimer.value) - clearTimeout(mainTimer.value) -}) onMounted(() => { + window.addEventListener('resize', () => { + console.log('resize'); + nextTick(() => { + setDayChart() + setTypeChart() + }) + }) initData() + scrollTimer.value = setInterval(() => { + ListScroll() + reportScroll() + }, 100) mainTimer.value = setInterval(() => { initData() }, 60000) @@ -160,8 +166,7 @@ onUnmounted(() => { - clearTimeout(planTimer.value) - clearTimeout(reportTimer.value) + clearTimeout(scrollTimer.value) clearTimeout(mainTimer.value) }) @@ -175,7 +180,6 @@ getTop(enterprise.companyId, enterprise.departId, { procedureId: route.query.procedureId }) .then(res => { if (res.length) { - data.baseNum = res[0].doneNum data.top1 = [] data.top2 = [] @@ -196,52 +200,46 @@ getProcedurePlansList(enterprise.companyId, enterprise.departId, { procedureId: route.query.procedureId }) .then(res => { data.listData = res - start() + data.planScroll = true }) // 鎶ュ伐鏃ュ織鍒嗛〉鏌ヨ - getRecordLogPage(enterprise.companyId, enterprise.departId, { capacity: 9999, page: 1, model: { procedureId: route.query.procedureId } }) + getRecordLogPage(enterprise.companyId, enterprise.departId, { capacity: 20, page: 1, model: { procedureId: route.query.procedureId } }) .then(res => { data.reportListData = res.records - reportStart() + data.reportScroll = true }) getUnqualified7DayData(enterprise.companyId, enterprise.departId, route.query.procedureId) .then(res => { data.dayDistribution = res + data.allBad = res.reduce((accumulator, currentValue) => accumulator + currentValue.unqualifiedNum, 0) setDayChart() }) getUnqualifiedCateData(enterprise.companyId, enterprise.departId, route.query.procedureId) .then(res => { data.typeDistribution = res - data.allBad = res.reduce((accumulator, currentValue) => accumulator + currentValue.unqualifiedNum, 0) setTypeChart() }) } - +// 榧犳爣绉诲叆 function handleMouseEnter() { - clearTimeout(planTimer.value) + data.planScroll = false } function handleMouseLeave() { - start() + data.planScroll = true } - +// 榧犳爣绉婚櫎 function handleMouseEnterReport() { - clearTimeout(reportTimer.value) + data.reportScroll = false } function handleMouseLeaveReport() { - reportStart() + data.reportScroll = true } /** - * 宸ュ簭璁″垝 + * 宸ュ簭璁″垝婊氬姩鏂规硶 */ -// 寮�鍚畾鏃跺櫒 -function start() { - clearTimeout(planTimer.value) - // 瀹氭椂鍣ㄨЕ鍙戝懆鏈� - // let speed = ref(100) - planTimer.value = setInterval(ListScroll, 100) -} function ListScroll() { + if (!data.planScroll) return let scrollDom = planContainer.value if (!scrollDom) return // 鍒よ缁勪欢鏄惁娓叉煋瀹屾垚 @@ -249,14 +247,18 @@ scrollDom = planContainer.value } else { // 濡傛灉鍒楄〃鏁伴噺杩囧皯涓嶈繘琛屾粴鍔� - if (scrollDom.children.length < 10) { - clearTimeout(planTimer.value) + if (scrollDom.children.length < 11) { + data.planScroll = false return } + // scrollTop鎸囩殑鏄�滃厓绱犱腑鐨勫唴瀹光�濊秴鍑衡�滃厓绱犱笂杈圭晫鈥濈殑閭i儴鍒嗙殑楂樺害 + // scrollHeight鎸囨暣涓厓绱犵殑楂樺害锛屼笌鍏冪礌鏈韩鏈夊叧锛屾槸鍏冪礌鏈韩鐨勯珮搴︿笌浣犳墍璁剧疆鐨剆tyle灞炴�х浉鍔犵殑缁撴灉锛屼絾涓巓verflow:hidden绛夊睘鎬ф棤鍏筹紝涓庢槸鍚﹀湪鍙鑼冨洿鍐呮棤鍏� + // clientHeight鍚箟锛氬厓绱犵殑鍍忕礌楂樺害锛屽寘鍚厓绱犵殑楂樺害+鍐呰竟璺濓紝涓嶅寘鍚按骞虫粴鍔ㄦ潯锛岃竟妗嗗拰澶栬竟璺� // 缁勪欢杩涜婊氬姩 - scrollDom.scrollTop += 1.5 + scrollDom.scrollTop += 2 + console.log(scrollDom.scrollTop); // 鍒ゆ柇鏄惁婊氬姩鍒板簳閮� - if (scrollDom.scrollTop >= (scrollDom.scrollHeight - scrollDom.clientHeight)) { + if (scrollDom.scrollTop >= (scrollDom.scrollHeight - scrollDom.clientHeight - 2)) { // 鑾峰彇缁勪欢绗竴涓妭鐐� let first = scrollDom.children[0] // 鍒犻櫎鑺傜偣 @@ -267,15 +269,10 @@ } } /** - * 鎶ュ伐鏃ュ織 + * 鎶ュ伐鏃ュ織婊氬姩鏂规硶 */ -function reportStart() { - clearTimeout(reportTimer.value) - // 瀹氭椂鍣ㄨЕ鍙戝懆鏈� - // let speed = ref(100) - reportTimer.value = setInterval(reportScroll, 100) -} function reportScroll() { + if (!data.reportScroll) return let scrollDom = reportLogContainer.value if (!scrollDom) return // 鍒よ缁勪欢鏄惁娓叉煋瀹屾垚 @@ -283,14 +280,15 @@ scrollDom = reportLogContainer.value } else { // 濡傛灉鍒楄〃鏁伴噺杩囧皯涓嶈繘琛屾粴鍔� - if (scrollDom.children.length < 10) { - clearTimeout(reportTimer.value) + if (scrollDom.children.length <= 10) { + data.reportScroll = false return } // 缁勪欢杩涜婊氬姩 - scrollDom.scrollTop += 1.5 + scrollDom.scrollTop += 1 + console.log(scrollDom.scrollTop); // 鍒ゆ柇鏄惁婊氬姩鍒板簳閮� - if (scrollDom.scrollTop >= (scrollDom.scrollHeight - scrollDom.clientHeight)) { + if (scrollDom.scrollTop && scrollDom.scrollTop >= (scrollDom.scrollHeight - scrollDom.clientHeight)) { // 鑾峰彇缁勪欢绗竴涓妭鐐� let first = scrollDom.children[0] // 鍒犻櫎鑺傜偣 @@ -322,6 +320,10 @@ fontSize: 12 } }, + grid: { + top: 40, + bottom: 40 + }, xAxis: { type: 'category', boundaryGap: false, @@ -329,6 +331,15 @@ lineStyle: { width: 0.5, color: ['#fff'] + } + }, + axisLine: { + show: true, + onZero: true, + lineStyle: { + width: 1, + color: '#fff', + opacity: .5 } }, axisLabel: { @@ -345,6 +356,15 @@ lineStyle: { width: 0.5, color: ['#fff'] + } + }, + axisLine: { + show: true, + onZero: true, + lineStyle: { + width: 1, + color: '#fff', + opacity: .5 } }, axisLabel: { @@ -495,13 +515,14 @@ flex: 1; margin-right: 20px; .proccess-plan { - height: 424px; + height: 464px; background: linear-gradient(180deg, rgba(52, 88, 159, 0) 0%, rgba(0, 86, 255, 0.4) 100%); margin-bottom: 20px; } .today-yield { - height: 222px; + height: calc(100vh - 725px); + min-height: 226px; background: linear-gradient(180deg, rgba(52, 88, 159, 0) 0%, rgba(0, 86, 255, 0.4) 100%); .yield-content { @@ -601,13 +622,14 @@ flex: 1; .report-log { - height: 424px; + height: 464px; background: linear-gradient(180deg, rgba(52, 88, 159, 0) 0%, rgba(0, 86, 255, 0.4) 100%); margin-bottom: 20px; } .bad-diagram { - height: 222px; + height:calc(100vh - 725px);; + min-height: 226px; background: linear-gradient(180deg, rgba(52, 88, 159, 0) 0%, rgba(0, 86, 255, 0.4) 100%); .bad-content { -- Gitblit v1.9.3