| | |
| | | { 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 }, |
| | | |
| | | ]) |
| | | // start() |
| | | onBeforeUnmount(() => { |
| | | clearTimeout(planTimer.value) |
| | |
| | | }) |
| | | onMounted(() => { |
| | | nextTick(() => { |
| | | // start() |
| | | // reportStart() |
| | | start() |
| | | reportStart() |
| | | setDayChart() |
| | | setTypeChart() |
| | | }) |
| | | }) |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | /** */ |
| | | /** |
| | | * 七日折线图 |
| | | */ |
| | | function setDayChart() { |
| | | let dayChartDom = document.getElementById('day-distribution'); |
| | | let myChart = echarts.init(dayChartDom); |
| | | let dateList = [] |
| | | let numList = [] |
| | | |
| | | |
| | | dayDistribution.forEach(item => { |
| | | dateList.push(item.date) |
| | | numList.push(item.num) |
| | |
| | | }, |
| | | data: dateList |
| | | }, |
| | | |
| | | |
| | | yAxis: { |
| | | type: 'value', |
| | | splitLine: { |
| | |
| | | textStyle: { |
| | | color: '#fff' |
| | | } |
| | | }, |
| | | // xAxis: { |
| | | // type: 'category', |
| | | // boundaryGap: false, |
| | | // axisLabel: { |
| | | // textStyle: { |
| | | // color: '#fff' |
| | | // } |
| | | // }, |
| | | // axisLine: { |
| | | // lineStyle: { |
| | | // color: '#fff' |
| | | // } |
| | | // } |
| | | // }, |
| | | // yAxis: { |
| | | // type: 'value', |
| | | // boundaryGap: [0, '30%'], |
| | | // splitLine: { |
| | | // lineStyle: { |
| | | // width: 0.5, |
| | | // color: ['#fff'] |
| | | // } |
| | | // }, |
| | | // axisLabel: { |
| | | // textStyle: { |
| | | // color: '#fff' |
| | | // } |
| | | // } |
| | | // }, |
| | | // visualMap: { |
| | | // type: 'piecewise', |
| | | // show: false, |
| | | // dimension: 0, |
| | | // seriesIndex: 0, |
| | | |
| | | // }, |
| | | // series: [ |
| | | // { |
| | | // type: 'line', |
| | | // smooth: 0.6, |
| | | // symbol: 'none', |
| | | // lineStyle: { |
| | | // color: '#03D2B5', |
| | | // width: 1 |
| | | // }, |
| | | // areaStyle: { |
| | | // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ |
| | | // { |
| | | // offset: 0, |
| | | // color: 'rgba(3, 210, 181, .9)', |
| | | // }, |
| | | // { |
| | | // offset: 1, |
| | | // color: 'rgba(3, 210, 181, 0)', |
| | | // } |
| | | // ]) |
| | | // }, |
| | | // data: dateList |
| | | // } |
| | | // ] |
| | | } |
| | | } |
| | | |
| | | option && myChart.setOption(option); |
| | | } |
| | | /** |
| | | * 不良类型分布 |
| | | */ |
| | | function setTypeChart() { |
| | | let dayChartDom = document.getElementById('type-distribution'); |
| | | let myChart = echarts.init(dayChartDom); |
| | | let legendData = [] |
| | | let seriesData = [] |
| | | typeDistribution.forEach(item => { |
| | | legendData.push(item.name) |
| | | seriesData.push({name:item.name, value:item.num}) |
| | | }) |
| | | let option = { |
| | | // title: { |
| | | // text: '同名数量统计', |
| | | // subtext: '纯属虚构', |
| | | // left: 'center' |
| | | // }, |
| | | // tooltip: { |
| | | // trigger: 'item', |
| | | // formatter: '{a} <br/>{b} : {c} ({d}%)' |
| | | // }, |
| | | legend: { |
| | | show: false, |
| | | type: 'scroll', |
| | | orient: 'vertical', |
| | | right: 10, |
| | | top: 20, |
| | | bottom: 20, |
| | | data: legendData |
| | | }, |
| | | series: [ |
| | | { |
| | | // name: '姓名', |
| | | type: 'pie', |
| | | |
| | | radius: ['60%', '70%'], |
| | | // avoidLabelOverlap: false, |
| | | itemStyle: { |
| | | borderRadius: 4, |
| | | borderColor: 'rgba(52, 88, 159, 0.4)', |
| | | borderWidth: 4 |
| | | }, |
| | | center: ['50%', '50%'], |
| | | labelLine: { |
| | | show: false |
| | | }, |
| | | label: { |
| | | formatter:'{dot| } {title|{b} {c}}\n\n{per|{d}%}', |
| | | rich: { |
| | | title: { |
| | | color: '#fff' |
| | | }, |
| | | per: { |
| | | color: '#01D9FE' |
| | | }, |
| | | dot: { |
| | | backgroundColor: 'inherit', |
| | | width: 8, |
| | | height: 8, |
| | | borderRadius: 4 |
| | | } |
| | | } |
| | | }, |
| | | // labelLayout: { |
| | | // hideOverlap: true |
| | | // }, |
| | | endLabel: { |
| | | show: true, |
| | | distance: 5, |
| | | color: "red" |
| | | }, |
| | | data: seriesData, |
| | | emphasis: { |
| | | itemStyle: { |
| | | shadowBlur: 10, |
| | | shadowOffsetX: 0, |
| | | shadowColor: 'rgba(0, 0, 0, 1)' |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | option && myChart.setOption(option); |
| | | } |
| | | </script> |
| | |
| | | .bad-diagram { |
| | | height: 222px; |
| | | background: linear-gradient(180deg, rgba(52, 88, 159, 0) 0%, rgba(0, 86, 255, 0.4) 100%); |
| | | |
| | | .bad-content { |
| | | display: flex; |
| | | margin-top: 20px; |
| | | |
| | | #day-distribution { |
| | | // padding: 20px; |
| | | box-sizing: border-box; |
| | | flex: 0.5; |
| | | height: 190px; |
| | | } |
| | | |
| | | #type-distribution { |
| | | flex: 0.4; |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </style> |
| | | }</style> |