From 47e18c4dd34d7d8b0dc60e8e1177cc7dff36f4e6 Mon Sep 17 00:00:00 2001
From: Mr.Shi <1878285526@qq.com>
Date: 星期二, 22 八月 2023 18:33:40 +0800
Subject: [PATCH] 大屏
---
screen_standard/src/views/process.vue | 256 +++++++++++++++++++++++++++++++++-----------------
1 files changed, 169 insertions(+), 87 deletions(-)
diff --git a/screen_standard/src/views/process.vue b/screen_standard/src/views/process.vue
index 378946b..80b656a 100644
--- a/screen_standard/src/views/process.vue
+++ b/screen_standard/src/views/process.vue
@@ -17,13 +17,13 @@
<div ref="planContainer" class="scroll_container">
<div v-for="(item, index) in listData" :key="item.id" class="scroll_item"
:class="index % 2 == 0 ? 'scroll_item scroll_item_bg1' : 'scroll_item scroll_item_bg2'">
- <div class="scroll_item_row">{{ item.name }}</div>
- <div class="scroll_item_row">1</div>
- <div class="scroll_item_row">2</div>
- <div class="scroll_item_row">3</div>
- <div class="scroll_item_row">4</div>
- <div class="scroll_item_row">4</div>
- <div class="scroll_item_row">4</div>
+ <div class="scroll_item_row">{{ item.materialName }}</div>
+ <div class="scroll_item_row">{{ item.materialCode }}</div>
+ <div class="scroll_item_row">{{ item.num }}</div>
+ <div class="scroll_item_row">{{ item.qualifiedNum }}</div>
+ <div class="scroll_item_row">{{ item.unqualifiedNum }}</div>
+ <div class="scroll_item_row">{{ item.undoneNum }}</div>
+ <div class="scroll_item_row">{{ item.unqualifiedRate }}%</div>
</div>
</div>
</div>
@@ -34,31 +34,31 @@
<div class="yield-content">
<div class="yield-content-left">
<div class="content_left_item1_content">
- <div class="content_left_item1_content_row" v-for="(item, index) in 5" :key="index">
+ <div class="content_left_item1_content_row" v-for="(item, index) in top1" :key="index">
<div class="content_left_item1_content_row_name">
<div :class="index > 2 ? 'num bg1' : 'num bg2'">{{ index + 1 }}</div>
- <span>璧电珛{{ index }}</span>
+ <span>{{ item.userName }}</span>
</div>
<div class="content_left_item1_content_row_line">
- <el-progress :show-text="false" :percentage="50">
+ <el-progress :show-text="false" :percentage="item.doneNum / baseNum * 100">
</el-progress>
</div>
- <div class="content_left_item1_content_row_num">342</div>
+ <div class="content_left_item1_content_row_num">{{ item.doneNum }}</div>
</div>
</div>
</div>
<div class="yield-content-left">
<div class="content_left_item1_content">
- <div class="content_left_item1_content_row" v-for="(item, index) in 5" :key="index">
+ <div class="content_left_item1_content_row" v-for="(item, index) in top2" :key="index">
<div class="content_left_item1_content_row_name">
<div class="num bg1">{{ index + 6 }}</div>
- <span>璧电珛{{ index }}</span>
+ <span>{{ item.userName }}</span>
</div>
<div class="content_left_item1_content_row_line">
- <el-progress :show-text="false" :percentage="50">
+ <el-progress :show-text="false" :percentage="item.doneNum / baseNum * 100">
</el-progress>
</div>
- <div class="content_left_item1_content_row_num">342</div>
+ <div class="content_left_item1_content_row_num">{{ item.doneNum }}</div>
</div>
</div>
</div>
@@ -81,15 +81,15 @@
</div>
<div @mouseenter="handleMouseEnterReport" @mouseleave="handleMouseLeaveReport" class="tablel_container">
<div ref="reportLogContainer" class="scroll_container">
- <div v-for="(item, index) in listData" :key="item.id" class="scroll_item"
+ <div v-for="(item, index) in reportListData" :key="item.id" class="scroll_item"
:class="index % 2 == 0 ? 'scroll_item scroll_item_bg1' : 'scroll_item scroll_item_bg2'">
- <div class="scroll_item_row">{{ item.name }}</div>
- <div class="scroll_item_row">1</div>
- <div class="scroll_item_row">2</div>
- <div class="scroll_item_row">3</div>
- <div class="scroll_item_row">4</div>
- <div class="scroll_item_row">4</div>
- <div class="scroll_item_row">4</div>
+ <div class="scroll_item_row">{{ item.userName }}</div>
+ <div class="scroll_item_row">{{ item.materialName }}</div>
+ <div class="scroll_item_row">{{ item.materialCode }}</div>
+ <div class="scroll_item_row">{{ item.createTime }}</div>
+ <div class="scroll_item_row">{{ item.qualifiedNum }}</div>
+ <div class="scroll_item_row">{{ item.unqualifiedNum }}</div>
+ <div class="scroll_item_row">{{ item.unqualifiedRate }}%</div>
</div>
</div>
</div>
@@ -99,7 +99,13 @@
<div class="header-title">杩�7澶╀笉鑹搧鍒嗗竷</div>
<div class="bad-content">
<div id="day-distribution"></div>
- <div id="type-distribution"></div>
+ <div class="pie">
+ <div class="content_right_top_nr_bottom_yuan">
+ <span>{{ allBad }}</span>
+ <span>涓嶈壇椤瑰垎甯�</span>
+ </div>
+ <div id="type-distribution"></div>
+ </div>
</div>
</div>
</div>
@@ -107,67 +113,108 @@
</template>
<script setup>
-import { reactive, ref, onMounted, onBeforeUnmount, onUnmounted, nextTick } from 'vue'
+import { reactive, ref, toRefs, onMounted, onBeforeUnmount, 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'
import * as echarts from 'echarts'
+const route = useRoute()
+const enterprise = useCounterStore()
+let mainTimer = ref(null)
let planTimer = ref(null)
let reportTimer = ref(null)
let planContainer = ref(null)
let reportLogContainer = ref(null)
-let listData = reactive([
- { name: 'dom绗竴涓�' },
- { name: 'dom绗簩涓�' },
- { name: 'dom绗笁涓�' },
- { name: 'dom绗洓涓�' },
- { name: 'dom绗簲涓�' },
- { name: 'dom绗叚涓�' },
- { name: 'dom绗竷涓�' },
- { name: 'dom绗叓涓�' },
- { name: 'dom绗節涓�' },
- { name: 'dom绗崄涓�' },
- { name: 'dom绗崄涓�' },
- { name: 'dom绗崄涓�' },
- { name: 'dom绗崄涓�' },
- { name: 'dom绗崄涓�' },
- { name: 'dom绗崄涓�' },
- { name: 'dom绗崄涓�' },
- { name: 'dom绗崄涓�' },
-])
-let dayDistribution = reactive([
- { date: '8/1', num: '20' },
- { date: '8/2', num: '10' },
- { date: '8/3', num: '20' },
- { date: '8/4', num: '40' },
- { date: '8/5', num: '30' },
- { date: '8/6', num: '10' },
- { date: '8/7', num: '20' },
-])
-let typeDistribution = reactive([
- { name: '澶栬涓嶈壇', num: 15 },
- { name: '鏈夋瘺鍒�', num: 12 },
- { name: '灏哄涓嶈壇', num: 22 },
- { name: '鏈夊垝鐥�', num: 5 },
- { name: '鍏朵粬', num: 2 },
+const data = reactive({
+ listData: [],
+ reportListData: [],
+ top1: [],
+ top2: [],
+ baseNum: 0,
+ allBad: 0,
+ dayDistribution: [],
+ typeDistribution: [
+ { categoryName: '澶栬涓嶈壇', unqualifiedNum: 15 },
+ { categoryName: '鏈夋瘺鍒�', unqualifiedNum: 12 },
+ { categoryName: '灏哄涓嶈壇', unqualifiedNum: 22 },
+ { categoryName: '鏈夊垝鐥�', unqualifiedNum: 5 },
+ { categoryName: '鍏朵粬', unqualifiedNum: 2 },
+ ]
+})
-])
+let { listData, top1, top2, baseNum, allBad } = toRefs(data)
+
// start()
onBeforeUnmount(() => {
clearTimeout(planTimer.value)
clearTimeout(reportTimer.value)
+ clearTimeout(mainTimer.value)
})
onMounted(() => {
- nextTick(() => {
- start()
- reportStart()
- setDayChart()
- setTypeChart()
- })
+ initData()
+ mainTimer.value = setInterval(() => {
+ initData()
+ }, 6000)
})
onUnmounted(() => {
clearTimeout(planTimer.value)
clearTimeout(reportTimer.value)
+ clearTimeout(mainTimer.value)
})
+
+function initData() {
+ // 璁″垝鏁�
+ getProcedurePlanData(enterprise.companyId, enterprise.departId, { procedureId: route.query.procedureId })
+ .then(res => {
+ enterprise.setNum(res)
+ })
+ // top10
+ getTop(enterprise.companyId, enterprise.departId, { procedureId: route.query.procedureId })
+ .then(res => {
+ if (res.length) {
+
+ data.baseNum = res[0].doneNum
+ data.top1 = []
+ data.top2 = []
+ if (res.length <= 5) {
+ data.top1 = res
+ } else {
+ res.forEach((item, index) => {
+ if (index < 5) {
+ data.top1.push(item)
+ } else {
+ data.top2.push(item)
+ }
+ })
+ }
+ }
+ })
+ // 宸ュ簭璁″垝杩涘害鏌ヨ
+ getProcedurePlansList(enterprise.companyId, enterprise.departId, { procedureId: route.query.procedureId })
+ .then(res => {
+ data.listData = res
+ start()
+ })
+ // 鎶ュ伐鏃ュ織鍒嗛〉鏌ヨ
+ getRecordLogPage(enterprise.companyId, enterprise.departId, { capacity: 9999, page: 1, model: { procedureId: route.query.procedureId } })
+ .then(res => {
+ data.reportListData = res.records
+ reportStart()
+ })
+ getUnqualified7DayData(enterprise.companyId, enterprise.departId, route.query.procedureId)
+ .then(res => {
+ data.dayDistribution = res
+ 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)
@@ -200,12 +247,12 @@
scrollDom = planContainer.value
} else {
// 濡傛灉鍒楄〃鏁伴噺杩囧皯涓嶈繘琛屾粴鍔�
- if (scrollDom.children.length < 4) {
+ if (scrollDom.children.length <= 10) {
clearTimeout(planTimer.value)
return
}
// 缁勪欢杩涜婊氬姩
- scrollDom.scrollTop += 2
+ scrollDom.scrollTop += 1.5
// 鍒ゆ柇鏄惁婊氬姩鍒板簳閮�
if (scrollDom.scrollTop >= (scrollDom.scrollHeight - scrollDom.clientHeight)) {
// 鑾峰彇缁勪欢绗竴涓妭鐐�
@@ -233,12 +280,12 @@
scrollDom = reportLogContainer.value
} else {
// 濡傛灉鍒楄〃鏁伴噺杩囧皯涓嶈繘琛屾粴鍔�
- if (scrollDom.children.length < 4) {
+ if (scrollDom.children.length <= 10) {
clearTimeout(reportTimer.value)
return
}
// 缁勪欢杩涜婊氬姩
- scrollDom.scrollTop += 2
+ scrollDom.scrollTop += 1.5
// 鍒ゆ柇鏄惁婊氬姩鍒板簳閮�
if (scrollDom.scrollTop >= (scrollDom.scrollHeight - scrollDom.clientHeight)) {
// 鑾峰彇缁勪欢绗竴涓妭鐐�
@@ -259,9 +306,9 @@
let dateList = []
let numList = []
- dayDistribution.forEach(item => {
- dateList.push(item.date)
- numList.push(item.num)
+ data.dayDistribution.forEach(item => {
+ dateList.push(item.createTime)
+ numList.push(item.unqualifiedNum)
})
let option;
option = {
@@ -350,20 +397,11 @@
let myChart = echarts.init(dayChartDom);
let legendData = []
let seriesData = []
- typeDistribution.forEach(item => {
- legendData.push(item.name)
- seriesData.push({name:item.name, value:item.num})
+ data.typeDistribution.forEach(item => {
+ legendData.push(item.categoryName)
+ seriesData.push({ name: item.categoryName, value: item.unqualifiedNum })
})
let option = {
- // title: {
- // text: '鍚屽悕鏁伴噺缁熻',
- // subtext: '绾睘铏氭瀯',
- // left: 'center'
- // },
- // tooltip: {
- // trigger: 'item',
- // formatter: '{a} <br/>{b} : {c} ({d}%)'
- // },
legend: {
show: false,
type: 'scroll',
@@ -390,7 +428,7 @@
show: false
},
label: {
- formatter:'{dot| } {title|{b} {c}}\n\n{per|{d}%}',
+ formatter: '{dot| } {title|{b} {c}}\n\n{per|{d}%}',
rich: {
title: {
color: '#fff'
@@ -494,6 +532,11 @@
font-weight: 400;
color: #D2E0FF;
margin-left: 9px;
+ width: 50px;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ -webkit-text-overflow: ellipsis;
+ overflow: hidden;
}
.num {
@@ -573,9 +616,47 @@
height: 190px;
}
- #type-distribution {
+ .pie {
flex: 0.4;
+ position: relative;
+ #type-distribution {
+ width: 100%;
+ height: 100%;
+ }
+ .content_right_top_nr_bottom_yuan {
+ position: absolute;
+ top: calc(50% - 50px);
+ left: calc(50% - 50px);;
+ z-index: 999;
+ width: 100px;
+ height: 100px;
+ border-radius: 50%;
+ border: 2px dashed #01D9FE;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+
+ span {
+ &:first-child {
+ font-size: 26px;
+ font-family: SourceHanSansSC-Medium, SourceHanSansSC;
+ font-weight: 500;
+ color: #FFFFFF;
+ }
+
+ &:last-child {
+ font-size: 13px;
+ font-family: SourceHanSansSC-Regular, SourceHanSansSC;
+ font-weight: 400;
+ color: rgba(255, 255, 255, 0.8);
+ }
+ }
+ }
+
+
}
+
}
}
}
@@ -644,6 +725,7 @@
display: flex;
align-items: center;
justify-content: center;
+ font-size: 13px;
}
}
}
--
Gitblit v1.9.3