| | |
| | | <div class="header-title">近7天不良品分布</div> |
| | | <div class="bad-content"> |
| | | <div id="day-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> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { reactive, ref, toRefs, onMounted, onBeforeUnmount, onUnmounted, nextTick } from 'vue' |
| | | import { getProcedurePlanData, getTop, getProcedurePlansList, getRecordLogPage } from '@/utils/api.js' |
| | | 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' |
| | |
| | | top1: [], |
| | | top2: [], |
| | | baseNum: 0, |
| | | allBad: 0, |
| | | dayDistribution: [ |
| | | { date: '8/1', num: '20' }, |
| | | { date: '8/2', num: '10' }, |
| | |
| | | { date: '8/7', num: '20' }, |
| | | ], |
| | | typeDistribution: [ |
| | | { name: '外观不良', num: 15 }, |
| | | { name: '有毛刺', num: 12 }, |
| | | { name: '尺寸不良', num: 22 }, |
| | | { name: '有划痕', num: 5 }, |
| | | { name: '其他', num: 2 }, |
| | | { categoryName: '外观不良', unqualifiedNum: 15 }, |
| | | { categoryName: '有毛刺', unqualifiedNum: 12 }, |
| | | { categoryName: '尺寸不良', unqualifiedNum: 22 }, |
| | | { categoryName: '有划痕', unqualifiedNum: 5 }, |
| | | { categoryName: '其他', unqualifiedNum: 2 }, |
| | | ] |
| | | }) |
| | | |
| | | let { listData, top1, top2, baseNum } = toRefs(data) |
| | | let { listData, top1, top2, baseNum, allBad } = toRefs(data) |
| | | |
| | | // start() |
| | | onBeforeUnmount(() => { |
| | |
| | | }) |
| | | onMounted(() => { |
| | | initData() |
| | | nextTick(() => { |
| | | start() |
| | | reportStart() |
| | | setDayChart() |
| | | setTypeChart() |
| | | }) |
| | | }) |
| | | |
| | | |
| | |
| | | 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, 0) |
| | | setTypeChart() |
| | | }) |
| | | } |
| | | |
| | |
| | | let numList = [] |
| | | |
| | | data.dayDistribution.forEach(item => { |
| | | dateList.push(item.date) |
| | | numList.push(item.num) |
| | | dateList.push(item.createTime) |
| | | numList.push(item.unqualifiedNum) |
| | | }) |
| | | let option; |
| | | option = { |
| | |
| | | let legendData = [] |
| | | let seriesData = [] |
| | | data.typeDistribution.forEach(item => { |
| | | legendData.push(item.name) |
| | | seriesData.push({name:item.name, value:item.num}) |
| | | legendData.push(item.categoryName) |
| | | seriesData.push({ name: item.categoryName, value: item.unqualifiedNum }) |
| | | }) |
| | | let option = { |
| | | legend: { |
| | |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |