Browse Source

看板

master
zhang_li 12 months ago
parent
commit
cd70635b65
  1. 157
      src/views/board/Index.vue

157
src/views/board/Index.vue

@ -1,11 +1,11 @@
<template> <template>
<div class="contain"> <div class="contain" v-loading="loading">
<div class="title"> <div class="title">
<div>SPC质量品质数据看板</div> <div>SPC质量品质数据看板</div>
</div> </div>
<div class="height"></div> <div class="height"></div>
<div class="bod"> <div class="bod">
<div class="time">2023年11月11日 - 2023年11月11日</div> <div class="time">{{date}}</div>
<div class="pl-2vw pr-2vw"> <div class="pl-2vw pr-2vw">
<el-row :gutter="14" justify="space-between"> <el-row :gutter="14" justify="space-between">
<el-col :xl="12" :lg="12" :md="12" :sm="24" :xs="24"> <el-col :xl="12" :lg="12" :md="12" :sm="24" :xs="24">
@ -82,21 +82,24 @@
</div> </div>
</el-col> </el-col>
<el-col :xl="12" :lg="12" :md="12" :sm="24" :xs="24"> <el-col :xl="12" :lg="12" :md="12" :sm="24" :xs="24">
<div class="right">
<div class="samll-title">合格数据</div> <div class="samll-title">合格数据</div>
<div class="mt-10px qualified-list"> <div class="mt-10px qualified-list" style="height:calc(50% - 44px);">
<dv-scroll-board <dv-scroll-board
ref="scrollBoard" ref="scrollBoard"
:config="standardData" :config="standardData"
style="width: 100%; height: 33vh" style="width: 100%; height:100%"
/></div> />
</div>
<div class="samll-title mt-10px">不合格数据</div> <div class="samll-title mt-10px">不合格数据</div>
<div class="mt-10px no-qualified-list"> <div class="mt-10px no-qualified-list" style="height:calc(50% - 44px);">
<dv-scroll-board <dv-scroll-board
ref="noStandardDataScrollBoard" ref="noStandardDataScrollBoard"
:config="noStandardData" :config="noStandardData"
style="width: 100%; height: 33vh" style="width: 100%; height:100%"
/> />
</div> </div>
</div>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
@ -108,6 +111,7 @@ import { set } from 'lodash-es'
import { EChartsOption } from 'echarts' import { EChartsOption } from 'echarts'
import * as boardAPI from '@/api/board/index' import * as boardAPI from '@/api/board/index'
import { pieOptions, lineOptions } from '@/views/Home/echarts-data' import { pieOptions, lineOptions } from '@/views/Home/echarts-data'
import type { ScrollBoard } from '@kjgl77/datav-vue3/index'
const pieOptionsData = reactive<EChartsOption>(pieOptions) as EChartsOption const pieOptionsData = reactive<EChartsOption>(pieOptions) as EChartsOption
const lineOptionsData = reactive<EChartsOption>(lineOptions) as EChartsOption const lineOptionsData = reactive<EChartsOption>(lineOptions) as EChartsOption
@ -119,40 +123,50 @@ const tableData = ref({
performance: {}, performance: {},
sum: {} sum: {}
}) })
const loading = ref(true)
// //
const standardDataTotal = ref(0) const standardDataTotal = ref(0)
const standardDataTime = ref() const standardDataTime = ref()
const standardData = ref({ const standardData = ref({
columnWidth: [170, 170, 170, 170, 170, 170, 170], columnWidth: [230, 230, 140, 170, 170, 170, 110],
header: ['零件号', '零件名称', '检测类型', '检测项', '检测日期', '标准', '实测值'], header: ['零件号', '零件名称', '检测类型', '检测项', '检测日期', '标准', '实测值'],
indexHeader: '序号', indexHeader: '序号',
index: true, index: false,
data: [], data: [],
align: 'center', align: ['center','center','center','center','center','center','center'],
headerBGC: '#e3e8eb', headerBGC: '#e3e8eb',
oddRowBGC: '#f7f7f7', oddRowBGC: '#f7f7f7',
evenRowBGC: '#eeeff1', evenRowBGC: '#eeeff1',
waitTime: 3000, waitTime: 3000,
headerHeight: 40, headerHeight: 40,
rowNum: 9 rowNum: 10
})
const standardDataParams = ref({
pageSize: 20,
pageNo: 1
}) })
// //
const noStandardDataTotal = ref(0) const noStandardDataTotal = ref(0)
const noStandardDataTime = ref() const noStandardDataTime = ref()
const noStandardData = ref({ const noStandardData = ref({
columnWidth: [170, 170, 170, 170, 170, 170, 170], columnWidth: [230, 230, 140, 170, 170, 170, 110],
header: ['零件号', '零件名称', '检测类型', '检测项', '检测日期', '标准', '实测值'], header: ['零件号', '零件名称', '检测类型', '检测项', '检测日期', '标准', '实测值'],
indexHeader: '序号', indexHeader: '序号',
index: true, index: false,
data: [], data: [],
align: 'center', align: ['center','center','center','center','center','center','center'],
headerBGC: '#e3e8eb', headerBGC: '#e3e8eb',
oddRowBGC: '#f7f7f7', oddRowBGC: '#f7f7f7',
evenRowBGC: '#eeeff1', evenRowBGC: '#eeeff1',
waitTime: 3000, waitTime: 3000,
headerHeight: 40, headerHeight: 40,
rowNum: 9 rowNum: 10
})
const noStandardDataParams = ref({
pageSize: 20,
pageNo: 1
}) })
const pieData = ref() const pieData = ref()
// //
@ -189,14 +203,6 @@ const getpieData = async () => {
}) })
} }
const standardDataParams = ref({
pageSize: 10,
pageNo: 1
})
const noStandardDataParams = ref({
pageSize: 10,
pageNo: 1
})
// 线 // 线
const lineDataTotal = ref(0) const lineDataTotal = ref(0)
const lineTime = ref() const lineTime = ref()
@ -210,11 +216,9 @@ const getLinePage = async () => {
if (res?.length > 0) { if (res?.length > 0) {
lineData.value = res[0] lineData.value = res[0]
} }
console.log(lineData.value)
let index = 1 let index = 1
lineTime.value = setInterval(() => { lineTime.value = setInterval(() => {
if (index == res.length - 1) { if (index == res.length) {
index = 1 index = 1
} }
lineData.value = res[index] lineData.value = res[index]
@ -265,17 +269,16 @@ const getLineData = async () => {
]) ])
} }
// //
let first = 1 //12 let first = 1 //12
const scrollBoard = ref(null) const scrollBoard = ref<InstanceType<typeof ScrollBoard>>(null)
function getStandardData() { let standardData2 = []
const getStandardData = () => {
boardAPI boardAPI
.getStandardData(standardDataParams.value) .getStandardData(standardDataParams.value)
.then((res) => { .then((res) => {
standardDataTotal.value = res.total standardDataTotal.value = res.total
let data2 = [] res.list.forEach((item) => {
res.list.forEach(item, (index) => {
let data1 = [] let data1 = []
data1.push(item.itemCode) data1.push(item.itemCode)
data1.push(item.itemName) data1.push(item.itemName)
@ -284,30 +287,33 @@ function getStandardData() {
data1.push(item.times) data1.push(item.times)
data1.push(item.valueRange) data1.push(item.valueRange)
data1.push(item.detectValue) data1.push(item.detectValue)
data2.push(data1) standardData2.push(data1)
}) })
// //
standardData.value.index = true // standardData.value.index = true
if (first == 1) { if (first == 1) {
standardData.value.data = data2 standardData.value.data = standardData2
first = 2 first = 2
} else { } else {
if (scrollBoard.value) { if (scrollBoard.value) {
scrollBoard.value.updateRows(data2) scrollBoard.value.updateRows(standardData2)
} }
} }
loading.value = false
})
.catch(() => {
loading.value = false
}) })
.catch(() => {})
} }
// //
let first1 = 1 //12 let first1 = 1 //12
const noStandardDataScrollBoard = ref(null) const noStandardDataScrollBoard = ref<InstanceType<typeof ScrollBoard>>(null)
function getNoStandardData() { let noStandardData2 = []
const getNoStandardData = () => {
boardAPI boardAPI
.getNoStandardData(noStandardDataParams.value) .getNoStandardData(noStandardDataParams.value)
.then((res) => { .then((res) => {
noStandardDataTotal.value = res.total noStandardDataTotal.value = res.total
let data2 = []
res.list.forEach((item) => { res.list.forEach((item) => {
let data1 = [] let data1 = []
data1.push(item.itemCode) data1.push(item.itemCode)
@ -317,46 +323,68 @@ function getNoStandardData() {
data1.push(item.times) data1.push(item.times)
data1.push(item.valueRange) data1.push(item.valueRange)
data1.push(item.detectValue) data1.push(item.detectValue)
data2.push(data1) noStandardData2.push(data1)
}) })
// //
noStandardData.value.index = true // noStandardData.value.index = true
console.log(first1)
if (first1 == 1) { if (first1 == 1) {
noStandardData.value.data = data2 noStandardData.value.data = noStandardData2
first1 = 2 first1 = 2
} else { } else {
if (noStandardDataScrollBoard.value) { if (noStandardDataScrollBoard.value) {
noStandardDataScrollBoard.value.updateRows(data2) noStandardDataScrollBoard.value.updateRows(noStandardData2)
} }
} }
console.log(noStandardData.value)
}) })
.catch(() => {}) .catch(() => {})
} }
// getPreviousDate便
function getPreviousDate(numOfDays) {
var date = new Date()
date.setDate(date.getDate() - numOfDays)
var year = date.getFullYear()
var month = date.getMonth() + 1
var day = date.getDate()
return year + '年' + month + '月' + day+ '日'
}
const date = ref()
onMounted(async () => { onMounted(async () => {
date.value = getPreviousDate(7) + ' - ' + getPreviousDate(1)
await getNumberStatistics() await getNumberStatistics()
getpieData() getpieData()
await getLinePage() await getLinePage()
getLineData() getLineData()
getStandardData() getStandardData()
getNoStandardData() getNoStandardData()
// const noStandardDataTime = ref()
standardDataTime.value = await setInterval(() => { standardDataTime.value = await setInterval(() => {
// const ys = noStandardDataTotal.value % 10 == 0 ? noStandardDataTotal.value / 10 : noStandardDataTotal.value / 10 + 1 if (standardDataParams.value.pageNo * 10 > standardDataTotal.value) {
console.log('pageNo',noStandardDataParams.value.pageNo * 10)
console.log('noStandardDataTotal',noStandardDataTotal.value)
if (noStandardDataParams.value.pageNo * 10 > noStandardDataTotal.value) {
console.log(noStandardData.value)
clearInterval(standardDataTime.value) clearInterval(standardDataTime.value)
} else {
standardDataParams.value.pageNo++
getStandardData()
}
}, 15000)
noStandardDataTime.value = await setInterval(() => {
if (noStandardDataParams.value.pageNo * 10 > noStandardDataTotal.value) {
clearInterval(noStandardDataTime.value)
} else { } else {
noStandardDataParams.value.pageNo++ noStandardDataParams.value.pageNo++
console.log('noStandardDataParams',noStandardDataParams.value)
getNoStandardData() getNoStandardData()
} }
}, 1000) }, 15000)
})
onUnmounted(() => {
if (standardDataTime.value) {
clearInterval(standardDataTime.value)
}
if (noStandardDataTime.value) {
clearInterval(noStandardDataTime.value)
}
if (lineTime.value) {
clearInterval(lineTime.value)
}
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -396,22 +424,6 @@ onMounted(async () => {
line-height: 8vh; line-height: 8vh;
font-size: 18px; font-size: 18px;
} }
// ::v-deep(.el-table tr),
// ::v-deep(.el-table th.el-table__cell),
// ::v-deep(.el-table) {
// background: none !important;
// }
// ::v-deep(.el-table th.el-table__cell) {
// border-bottom: 1px solid #8f9fae !important;
// border-top: 1px solid #8f9fae !important;
// background: #e3e8eb !important;
// }
// ::v-deep(.el-table--default .el-table__cell) {
// border-bottom: 1px solid #8f9fae !important;
// }
// ::v-deep(.el-table__inner-wrapper::before) {
// background: #8f9fae;
// }
.line-header { .line-header {
background: #e3e8eb !important; background: #e3e8eb !important;
display: flex; display: flex;
@ -493,6 +505,9 @@ onMounted(async () => {
flex-direction: column; flex-direction: column;
height: 77vh; height: 77vh;
} }
.right {
height: 77vh;
}
.table { .table {
ul { ul {
display: flex; display: flex;

Loading…
Cancel
Save