|  |  |  | 
|---|
|  |  |  | <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 class="scroll_item_row">{{ (item.unqualifiedRate||0).toFixed(2) }}%</div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | 
|---|
|  |  |  | <span>{{ item.userName }}</span> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="content_left_item1_content_row_line"> | 
|---|
|  |  |  | <el-progress :show-text="false" :percentage="item.doneNum / baseNum * 100"> | 
|---|
|  |  |  | <el-progress :show-text="false" :percentage="(item.doneNum||0) / baseNum * 100"> | 
|---|
|  |  |  | </el-progress> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="content_left_item1_content_row_num">{{ item.doneNum }}</div> | 
|---|
|  |  |  | <div class="content_left_item1_content_row_num">{{ item.doneNum||0 }}</div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </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">{{ dateToSub(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 class="scroll_item_row">{{ (item.unqualifiedRate||0).toFixed(2) }}%</div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | 
|---|
|  |  |  | </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' | 
|---|
|  |  |  | import { dateToSub } from '@/utils' | 
|---|
|  |  |  | import * as echarts from 'echarts' | 
|---|
|  |  |  | const route = useRoute() | 
|---|
|  |  |  | const enterprise = useCounterStore() | 
|---|
|  |  |  | let planTimer = ref(null) | 
|---|
|  |  |  | let reportTimer = ref(null) | 
|---|
|  |  |  | let mainTimer = ref(null) | 
|---|
|  |  |  | let scrollTimer = ref(null) | 
|---|
|  |  |  | let planContainer = ref(null) | 
|---|
|  |  |  | let reportLogContainer = ref(null) | 
|---|
|  |  |  | const data = reactive({ | 
|---|
|  |  |  | 
|---|
|  |  |  | { categoryName: '尺寸不良', unqualifiedNum: 22 }, | 
|---|
|  |  |  | { categoryName: '有划痕', unqualifiedNum: 5 }, | 
|---|
|  |  |  | { categoryName: '其他', unqualifiedNum: 2 }, | 
|---|
|  |  |  | ] | 
|---|
|  |  |  | ], | 
|---|
|  |  |  | planScroll: false, | 
|---|
|  |  |  | reportScroll: false, | 
|---|
|  |  |  | }) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | let { listData, top1, top2, baseNum, allBad } = toRefs(data) | 
|---|
|  |  |  | let { listData, top1, top2, baseNum, allBad, reportListData } = toRefs(data) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // start() | 
|---|
|  |  |  | onBeforeUnmount(() => { | 
|---|
|  |  |  | clearTimeout(planTimer.value) | 
|---|
|  |  |  | clearTimeout(reportTimer.value) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | onMounted(() => { | 
|---|
|  |  |  | window.addEventListener('resize', () => { | 
|---|
|  |  |  | console.log('resize'); | 
|---|
|  |  |  | nextTick(() => { | 
|---|
|  |  |  | setDayChart() | 
|---|
|  |  |  | setTypeChart() | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | initData() | 
|---|
|  |  |  | scrollTimer.value = setInterval(() => { | 
|---|
|  |  |  | ListScroll() | 
|---|
|  |  |  | reportScroll() | 
|---|
|  |  |  | }, 100) | 
|---|
|  |  |  | mainTimer.value = setInterval(() => { | 
|---|
|  |  |  | initData() | 
|---|
|  |  |  | }, 60000) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | onUnmounted(() => { | 
|---|
|  |  |  | clearTimeout(planTimer.value) | 
|---|
|  |  |  | clearTimeout(reportTimer.value) | 
|---|
|  |  |  | clearTimeout(scrollTimer.value) | 
|---|
|  |  |  | clearTimeout(mainTimer.value) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function initData() { | 
|---|
|  |  |  | 
|---|
|  |  |  | getTop(enterprise.companyId, enterprise.departId, { procedureId: route.query.procedureId }) | 
|---|
|  |  |  | .then(res => { | 
|---|
|  |  |  | if (res.length) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | data.baseNum = res[0].doneNum | 
|---|
|  |  |  | data.top1 = [] | 
|---|
|  |  |  | data.top2 = [] | 
|---|
|  |  |  | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | // 判读组件是否渲染完成 | 
|---|
|  |  |  | if (scrollDom.offsetHeight == 0) { | 
|---|
|  |  |  | scrollDom = planContainer.value | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | // 如果列表数量过少不进行滚动 | 
|---|
|  |  |  | if (scrollDom.children.length <= 10) { | 
|---|
|  |  |  | clearTimeout(planTimer.value) | 
|---|
|  |  |  | if (scrollDom.children.length < 11) { | 
|---|
|  |  |  | data.planScroll = false | 
|---|
|  |  |  | return | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // scrollTop指的是“元素中的内容”超出“元素上边界”的那部分的高度 | 
|---|
|  |  |  | // scrollHeight指整个元素的高度,与元素本身有关,是元素本身的高度与你所设置的style属性相加的结果,但与overflow: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] | 
|---|
|  |  |  | // 删除节点 | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 报工日志 | 
|---|
|  |  |  | * 报工日志滚动方法 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | // 判读组件是否渲染完成 | 
|---|
|  |  |  | if (scrollDom.offsetHeight == 0) { | 
|---|
|  |  |  | scrollDom = reportLogContainer.value | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | // 如果列表数量过少不进行滚动 | 
|---|
|  |  |  | if (scrollDom.children.length <= 10) { | 
|---|
|  |  |  | clearTimeout(reportTimer.value) | 
|---|
|  |  |  | 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] | 
|---|
|  |  |  | // 删除节点 | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | data.dayDistribution.forEach(item => { | 
|---|
|  |  |  | dateList.push(item.createTime) | 
|---|
|  |  |  | numList.push(item.unqualifiedNum) | 
|---|
|  |  |  | numList.push(item.unqualifiedNum || 0) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | let option; | 
|---|
|  |  |  | option = { | 
|---|
|  |  |  | title: { | 
|---|
|  |  |  | text: '         近七日不良品总数:67', | 
|---|
|  |  |  | text: `        近七日不良品总数:${data.allBad}`, | 
|---|
|  |  |  | textStyle: { | 
|---|
|  |  |  | color: '#fff', | 
|---|
|  |  |  | fontSize: 12 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | grid: { | 
|---|
|  |  |  | top: 40, | 
|---|
|  |  |  | bottom: 40 | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | xAxis: { | 
|---|
|  |  |  | type: 'category', | 
|---|
|  |  |  | 
|---|
|  |  |  | lineStyle: { | 
|---|
|  |  |  | width: 0.5, | 
|---|
|  |  |  | color: ['#fff'] | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | axisLine: { | 
|---|
|  |  |  | show: true, | 
|---|
|  |  |  | onZero: true, | 
|---|
|  |  |  | lineStyle: { | 
|---|
|  |  |  | width: 1, | 
|---|
|  |  |  | color: '#fff', | 
|---|
|  |  |  | opacity: .5 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | axisLabel: { | 
|---|
|  |  |  | 
|---|
|  |  |  | lineStyle: { | 
|---|
|  |  |  | width: 0.5, | 
|---|
|  |  |  | color: ['#fff'] | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | axisLine: { | 
|---|
|  |  |  | show: true, | 
|---|
|  |  |  | onZero: true, | 
|---|
|  |  |  | lineStyle: { | 
|---|
|  |  |  | width: 1, | 
|---|
|  |  |  | color: '#fff', | 
|---|
|  |  |  | opacity: .5 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | axisLabel: { | 
|---|
|  |  |  | 
|---|
|  |  |  | show: false | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | label: { | 
|---|
|  |  |  | formatter: '{dot| } {title|{b} {c}}\n\n{per|{d}%}', | 
|---|
|  |  |  | formatter: '{dot| } {title|{b} {c}}\n{per|{d}%}', | 
|---|
|  |  |  | rich: { | 
|---|
|  |  |  | title: { | 
|---|
|  |  |  | color: '#fff' | 
|---|
|  |  |  | color: '#fff', | 
|---|
|  |  |  | lineHeight: 13, | 
|---|
|  |  |  | fontSize: 10 | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | per: { | 
|---|
|  |  |  | color: '#01D9FE' | 
|---|
|  |  |  | color: '#01D9FE', | 
|---|
|  |  |  | fontSize: 10 | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | dot: { | 
|---|
|  |  |  | backgroundColor: 'inherit', | 
|---|
|  |  |  | 
|---|
|  |  |  | <style lang="scss" scoped> | 
|---|
|  |  |  | .proccess-content { | 
|---|
|  |  |  | display: flex; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | flex: 1; | 
|---|
|  |  |  | .header-title { | 
|---|
|  |  |  | background-image: url('@/assets/img/gongxu_title@2x.png'); | 
|---|
|  |  |  | height: 28px; | 
|---|
|  |  |  | 
|---|
|  |  |  | .process-left { | 
|---|
|  |  |  | flex: 1; | 
|---|
|  |  |  | margin-right: 20px; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | .proccess-plan { | 
|---|
|  |  |  | height: 460px; | 
|---|
|  |  |  | 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 { | 
|---|
|  |  |  | 
|---|
|  |  |  | flex: 1; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | .report-log { | 
|---|
|  |  |  | height: 460px; | 
|---|
|  |  |  | 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 { | 
|---|
|  |  |  | 
|---|
|  |  |  | display: flex; | 
|---|
|  |  |  | align-items: center; | 
|---|
|  |  |  | justify-content: center; | 
|---|
|  |  |  | font-size: 13px; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|