| | |
| | | |
| | | <script> |
| | | import { currentGET } from "api/modules"; |
| | | import { ProductionRanking } from "@/api/http.js"; |
| | | import { Floorfault } from "@/api/http.js"; |
| | | import * as echarts from 'echarts'; |
| | | let style = { |
| | | fontSize: 24, |
| | |
| | | init() { |
| | | // import echarts from 'echarts' |
| | | var charts = { // 按顺序排列从大到小 |
| | | cityList: ['38号点(1)', '38号点(2)', '15号点', '16号点', '24号点'], |
| | | cityList: ['8线)', '6线', '5线','7线'], |
| | | cityData: [7500, 6200, 5700, 4200, 3500] |
| | | } |
| | | var top10CityList = charts.cityList |
| | |
| | | // this.$Message.warning(res.msg); |
| | | // } |
| | | // }); |
| | | var rep = await ProductionRanking(); |
| | | var cityLists= rep.map((item,index) => { |
| | | return '#'+(index+1)+' 产品'+item.pCode; |
| | | }); |
| | | var cityDatas= rep.map((item,index) => { |
| | | return item.qtys; |
| | | }); |
| | | var rep1 = await Floorfault(); |
| | | const rep = rep1.filter(it =>it.roadway.includes("CW")); |
| | | |
| | | // 按 productionLine 字段分组,并转换为对象数组 |
| | | const groupedArray = Object.entries( |
| | | rep.reduce((acc, item) => { |
| | | const key = item.productionLine; |
| | | if (!acc[key]) { |
| | | acc[key] = []; |
| | | } |
| | | acc[key].push(item); |
| | | return acc; |
| | | }, {}) |
| | | ).map(([productionLine, items]) => ({ |
| | | productionLine, |
| | | items |
| | | })); |
| | | |
| | | // 从 groupedArray 中提取所有 productionLine 的值 |
| | | const cityLists = groupedArray.map(item => item.productionLine); |
| | | // 获取每组的长度数组 |
| | | const cityDatas = groupedArray.map(group => group.items.length); |
| | | |
| | | // 输出对象数组格式的分组结果 |
| | | |
| | | var charts = { // 按顺序排列从大到小 |
| | | cityList: cityLists, |
| | | cityData: cityDatas |
| | |
| | | fontFamily: 'PingFangSC-Regular' |
| | | }, |
| | | formatter: function (val) { |
| | | return `${val}PCS` |
| | | return `${val}托` |
| | | } |
| | | }, |
| | | splitArea: { |