From a52f13d719ee9cd53f129f4c59dcad783977fce9 Mon Sep 17 00:00:00 2001
From: Mr.Zhang <710666463@qq.com>
Date: 星期五, 01 九月 2023 11:36:34 +0800
Subject: [PATCH] 小程序接口api 添加
---
screen_standard/src/views/process.vue | 116 +++++++++++++++++++++++++++++++++------------------------
1 files changed, 67 insertions(+), 49 deletions(-)
diff --git a/screen_standard/src/views/process.vue b/screen_standard/src/views/process.vue
index 3ac67d4..d81206d 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,14 @@
scrollDom = planContainer.value
} else {
// 濡傛灉鍒楄〃鏁伴噺杩囧皯涓嶈繘琛屾粴鍔�
- if (scrollDom.children.length < 10) {
- clearTimeout(planTimer.value)
+ if (scrollDom.children.length < 11) {
+ data.planScroll = 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]
// 鍒犻櫎鑺傜偣
@@ -267,15 +265,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
// 鍒よ缁勪欢鏄惁娓叉煋瀹屾垚
@@ -284,13 +277,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]
// 鍒犻櫎鑺傜偣
@@ -322,6 +315,10 @@
fontSize: 12
}
},
+ grid: {
+ top: 40,
+ bottom: 40
+ },
xAxis: {
type: 'category',
boundaryGap: false,
@@ -329,6 +326,15 @@
lineStyle: {
width: 0.5,
color: ['#fff']
+ }
+ },
+ axisLine: {
+ show: true,
+ onZero: true,
+ lineStyle: {
+ width: 1,
+ color: '#fff',
+ opacity: .5
}
},
axisLabel: {
@@ -345,6 +351,15 @@
lineStyle: {
width: 0.5,
color: ['#fff']
+ }
+ },
+ axisLine: {
+ show: true,
+ onZero: true,
+ lineStyle: {
+ width: 1,
+ color: '#fff',
+ opacity: .5
}
},
axisLabel: {
@@ -397,6 +412,7 @@
*/
function setTypeChart() {
let dayChartDom = document.getElementById('type-distribution');
+ console.log(dayChartDom);
let myChart = echarts.init(dayChartDom);
let legendData = []
let seriesData = []
@@ -495,13 +511,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 +618,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