From 221d9dfd1634d5fab98a686b0b8a83f6f1e088b5 Mon Sep 17 00:00:00 2001 From: Mr.Zhang <710666463@qq.com> Date: 星期四, 24 八月 2023 10:56:56 +0800 Subject: [PATCH] 大屏 08.24 --- screen_standard/src/views/process.vue | 78 +++++++++++++++++---------------------- 1 files changed, 34 insertions(+), 44 deletions(-) diff --git a/screen_standard/src/views/process.vue b/screen_standard/src/views/process.vue index 542c8f5..c44e935 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 } 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,23 @@ { 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', () => { + setDayChart() + setTypeChart() + }) initData() + scrollTimer.value = setInterval(() => { + ListScroll() + reportScroll() + }, 100) mainTimer.value = setInterval(() => { initData() }, 60000) @@ -160,13 +163,11 @@ onUnmounted(() => { - clearTimeout(planTimer.value) - clearTimeout(reportTimer.value) + clearTimeout(scrollTimer.value) clearTimeout(mainTimer.value) }) function initData() { - console.log(enterprise.departId); // 璁″垝鏁� getProcedurePlanData(enterprise.companyId, enterprise.departId, { procedureId: route.query.procedureId }) .then(res => { @@ -176,7 +177,6 @@ getTop(enterprise.companyId, enterprise.departId, { procedureId: route.query.procedureId }) .then(res => { if (res.length) { - data.baseNum = res[0].doneNum data.top1 = [] data.top2 = [] @@ -197,52 +197,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: 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 // 鍒よ缁勪欢鏄惁娓叉煋瀹屾垚 @@ -251,7 +245,7 @@ } else { // 濡傛灉鍒楄〃鏁伴噺杩囧皯涓嶈繘琛屾粴鍔� if (scrollDom.children.length < 11) { - clearTimeout(planTimer.value) + data.planScroll = false return } // 缁勪欢杩涜婊氬姩 @@ -268,15 +262,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 // 鍒よ缁勪欢鏄惁娓叉煋瀹屾垚 @@ -285,13 +274,13 @@ } else { // 濡傛灉鍒楄〃鏁伴噺杩囧皯涓嶈繘琛屾粴鍔� if (scrollDom.children.length < 10) { - clearTimeout(reportTimer.value) + data.reportScroll = false return } // 缁勪欢杩涜婊氬姩 - scrollDom.scrollTop += 1.5 + scrollDom.scrollTop += 2 // 鍒ゆ柇鏄惁婊氬姩鍒板簳閮� - if (scrollDom.scrollTop >= (scrollDom.scrollHeight - scrollDom.clientHeight)) { + if (scrollDom.scrollTop >= (scrollDom.scrollHeight - scrollDom.clientHeight - 2)) { // 鑾峰彇缁勪欢绗竴涓妭鐐� let first = scrollDom.children[0] // 鍒犻櫎鑺傜偣 @@ -314,6 +303,7 @@ dateList.push(item.createTime) numList.push(item.unqualifiedNum || 0) }) + console.log(data.allBad); let option; option = { title: { @@ -502,7 +492,7 @@ } .today-yield { - height: calc(100vh - 690px); + height: calc(100vh - 725px); min-height: 226px; background: linear-gradient(180deg, rgba(52, 88, 159, 0) 0%, rgba(0, 86, 255, 0.4) 100%); @@ -609,7 +599,7 @@ } .bad-diagram { - height:calc(100vh - 690px);; + height:calc(100vh - 725px);; min-height: 226px; background: linear-gradient(180deg, rgba(52, 88, 159, 0) 0%, rgba(0, 86, 255, 0.4) 100%); -- Gitblit v1.9.3