diff --git a/src/views/statistics/pass_num_gx.vue b/src/views/statistics/pass_num_gx.vue index c8aa0265..61daef0a 100644 --- a/src/views/statistics/pass_num_gx.vue +++ b/src/views/statistics/pass_num_gx.vue @@ -2,7 +2,7 @@
- - + --> + -
+
导出 - + - - - - - + + @@ -71,10 +63,7 @@ - + @@ -116,11 +811,11 @@ export default { queryDate:'', currentYear: "", currentMonth: "", - xAxisData: [], + nameList: [], basicOption: { backgroundColor: "transparent", title: { - text: "", + text: "合格数统计", }, grid: { top: "80px", @@ -136,16 +831,24 @@ export default { type: "value", }, lenged: [], - series: [ - { - data: [], - stack: "Ad", - type: "bar", - barWidth: "15px", - }, - ], + series: [], }, - tableData: [], + tableData0: [], + tableData1: [], + tableData2: [], + tableData3: [], + tableData4: [], + tableData5: [], + tableData6: [], + tableData7: [], + tableData8: [], + tableData9: [], + tableData10: [], + tableData11: [], + tableData12: [], + tableData13: [], + tableData14: [], + tableData15: [], options:[], }; }, @@ -153,7 +856,7 @@ export default { let that = this; let nowDate = new Date(); that.getMgroup(); - that.getWeekDate(nowDate); + // that.getWeekDate(nowDate); }, methods: { getWeekDate(dates){ @@ -180,7 +883,10 @@ export default { console.log('dateArr',dateArr); that.query.start_date =first.getFullYear() +"-" +(first.getMonth() + 1) +"-" +first.getDate(); that.query.end_date =last.getFullYear() +"-" +(last.getMonth() + 1) +"-" +last.getDate(); - that.getData(); + that.options.forEach((item,index)=>{ + that.getData(item,index); + }) + }, setChart(name, option = null) { // 根据name 渲染数据, option需填写,否则option为模拟数据 @@ -208,50 +914,62 @@ export default { }) that.query.mgroup_name = arr[0]; that.options = arr; + let nowDate = new Date(); + that.getWeekDate(nowDate); }); }, - getData() { + getData(mgroup_name,mgroup_index) { let that = this; let option = deepCopy(that.basicOption); + let query = deepCopy(that.query); + query.mgroup_name = mgroup_name; let obj = {}; - obj.query = that.query; + obj.query = query; that.$API.bi.dataset.exec.req('lineDay_m', obj).then((res) => { let tableData = res.data2.ds0 ? res.data2.ds0 : []; - that.tableData = tableData; + let names = 'tableData'+mgroup_index; + that[names] = tableData; if (tableData.length > 0) { - let dataList = [], - nameList = [], - datas = []; + let dataList = [],nameList = [],datas = []; tableData.forEach((ite) => { if (nameList.indexOf(ite.物料名) > -1) {} else { nameList.push(ite.物料名); + + dataList.push([]) datas.push([0,0,0,0,0,0,0]); + let obj = { + name:ite.物料名, + data: [], + stack: "Ad", + type: "bar", + barWidth: "15px", + }; + option.series.push(obj) } }); - that.xAxisData = nameList; + console.log('nameList',nameList); + that.nameList = nameList; tableData.forEach((item) => { let indexX = nameList.indexOf(item.物料名); dataList[indexX].push(item); }); + console.log('dataList',dataList) for(let i = 0;i { - let obj = { - data: datas[index], - stack: "Ad", - type: "bar", - barWidth: "15px", - }; - ption.series[index].data = serisData; - }); - that.setChart("bachart1", option); + console.log('datas',datas); + for(let n=0;n