diff --git a/src/views/statistics/hunliao.vue b/src/views/statistics/hunliao.vue index 5714cad8..07c7a730 100644 --- a/src/views/statistics/hunliao.vue +++ b/src/views/statistics/hunliao.vue @@ -28,15 +28,34 @@ 导出 - + - + - + - + - + @@ -105,6 +124,11 @@ export default { tableData10: [], firstWeekNum: 1, endWeekNum: 4, + nameFilters: [], + dateFilters:[], + specsFilters:[], + modelFilters:[], + monthFilters:[1,2,3,4,5,,6,7,8,9,10,11,12], monthList: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'] } }, @@ -164,6 +188,11 @@ export default { }, getDataHL() { let that = this; + let dateList = [],specsList=[],modelList=[]; + that.dateFilters = []; + that.nameFilters = []; + that.modelFilters = []; + that.specsFilters = []; let obj = { query: { start_date: that.start_date, end_date: that.end_date, mgroup_name: "混料", is_count_utask: -1 }, }; @@ -181,14 +210,40 @@ export default { if (nameList.indexOf(ite.物料名) > -1) { } else { nameList.push(ite.物料名); seriesData.push([0,0,0,0,0,0,0,0,0,0,0,0]) + let obj = {}; + obj.text = ite.物料名; + obj.value = ite.物料名; + that.nameFilters.push(obj); + } + if(modelList.indexOf(ite.型号)>-1){}else{ + modelList.push(ite.型号); + let obj2 = {}; + obj2.text = ite.型号; + obj2.value = ite.型号; + that.modelFilters.push(obj2); + } + if(specsList.indexOf(ite.规格)>-1){}else{ + specsList.push(ite.规格); + let obj3 = {}; + obj3.text = ite.规格; + obj3.value = ite.规格; + that.specsFilters.push(obj3); } }) dataList.forEach(item => { let indexX = 0, indexY = 0; if (that.queryType == '月') { indexX = nameList.indexOf(item.物料名); - indexY = item.周 - that.firstWeekNum; + indexY = item.周 - that.firstWeekNum; + if(dateList.indexOf(item.周)>-1){}else{ + dateList.push(item.周); + let obj = {}; + obj.text = item.周; + obj.value = item.周; + that.dateFilters.push(obj); + } } else { + that.dateFilters = [1,2,3,4,5,6,7,8,9,10,11,12]; indexX = nameList.indexOf(item.物料名); indexY = item.月 - 1; } @@ -209,54 +264,6 @@ export default { } }); }, - getDataHLXH() { - let that = this; - let option = deepCopy(that.basicOption); - option.xAxis.data = that.xAxisData; - option.title.text = '混料消耗统计'; - let obj = { - query: { start_date: that.start_date, end_date: that.end_date, mio_type: "do_in", material_type: 30, material_id: "" }, - }; - let exec = that.queryType == '月' ? 'saleOutWeek' : 'saleOutMonth'; - that.$API.bi.dataset.exec.req(exec, obj).then((res) => { - // console.log('10生产车间统计:',res); - let tableData10 = res.data2.ds0 ? res.data2.ds0 : []; - that.tableData10 = tableData10; - if (tableData10.length > 0) { - option.series = []; - let seriesData = [], nameList = []; - tableData10.forEach(ite => { - if (nameList.indexOf(ite.物料名) > -1) { } else { - nameList.push(ite.物料名); - seriesData.push([]) - } - }) - tableData10.forEach(item => { - let indexX = 0, indexY = 0; - if (that.queryType == '月') { - indexX = nameList.indexOf(item.物料名); - indexY = item.周 - that.firstWeekNum; - } else { - indexX = nameList.indexOf(item.物料名); - indexY = item.月 - 1; - } - seriesData[indexX][indexY] = item.合格数; - }); - for (let n = 0; n < seriesData.length; n++) { - let obj = {}; - obj.name = nameList[n]; - obj.stack = 'Ad'; - obj.type = 'bar'; - obj.barWidth = '15px'; - obj.data = seriesData[n]; - option.series.push(obj) - } - that.setChart("bachart2", option); - } else { - that.setChart("bachart2", option); - } - }); - }, handleQuery() { let that = this; if (that.queryType == '月') { @@ -321,6 +328,21 @@ export default { }); return sums; }, + filterName(value, row) { + return row.物料名 === value; + }, + filterMonth(value, row) { + return row.月 === value; + }, + filterWeek(value, row) { + return row.周 === value; + }, + filterSpecs(value, row) { + return row.规格 === value; + }, + filterModel(value, row) { + return row.型号 === value; + }, handleExport(val) { this.exportLoading = true; let id = '#exportDiv' + val; diff --git a/src/views/statistics/inm_statistics.vue b/src/views/statistics/inm_statistics.vue index 9ba3c151..ae22510c 100644 --- a/src/views/statistics/inm_statistics.vue +++ b/src/views/statistics/inm_statistics.vue @@ -99,13 +99,28 @@ > - - - + + + - + - + @@ -140,13 +155,28 @@ > - - - + + + - + - + @@ -215,6 +245,14 @@ export default { rightHeight: 0, tableData1: [], tableData2: [], + nameFilters: [], + dateFilters: [], + modelFilters: [], + specsFilters: [], + nameFilters2: [], + dateFilters2: [], + modelFilters2: [], + specsFilters2: [], firstWeekNum: 1, endWeekNum: 4, monthList: ["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"], @@ -295,6 +333,12 @@ export default { //交付物料 getSaleData() { let that = this; + that.tableData1 = []; + that.nameFilters = []; + that.dateFilters = []; + that.modelFilters = []; + that.specsFilters = []; + let nameList=[],dateList = [],specsList=[],modelList=[]; let exec = that.queryType == "月" ? "saleOutWeek" : "saleOutMonth"; let obj = { query: { @@ -306,8 +350,44 @@ export default { }; that.$API.bi.dataset.exec.req(exec, obj).then((res) => { if (res.data2.ds0&&res.data2.ds0.length>0) { - that.tableData1 = res.data2.ds0; - that.setChartData(res.data2.ds0); + let data = res.data2.ds0; + that.tableData1 = data; + data.forEach((ite) => { + if (nameList.indexOf(ite.物料名) > -1) { + } else { + nameList.push(ite.物料名); + let obj = {}; + obj.text = ite.物料名; + obj.value = ite.物料名; + that.nameFilters.push(obj); + } + if(modelList.indexOf(ite.型号)>-1){}else{ + modelList.push(ite.型号); + let obj2 = {}; + obj2.text = ite.型号; + obj2.value = ite.型号; + that.modelFilters.push(obj2); + } + if(specsList.indexOf(ite.规格)>-1){}else{ + specsList.push(ite.规格); + let obj3 = {}; + obj3.text = ite.规格; + obj3.value = ite.规格; + that.specsFilters.push(obj3); + } + if(that.queryType == "月"){ + if(dateList.indexOf(ite.周)>-1){}else{ + dateList.push(ite.周); + let obj4 = {}; + obj4.text = ite.周; + obj4.value = ite.周; + that.dateFilters.push(obj4); + } + }else{ + that.dateFilters = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; + } + }) + that.setChartData(data); }else{ let option = deepCopy(that.basicOption); option.xAxis.data = that.xAxisData; @@ -317,6 +397,15 @@ export default { }, getTable() { let that = this; + that.nameFilters = []; + that.dateFilters = []; + that.modelFilters = []; + that.specsFilters = []; + that.nameFilters2 = []; + that.dateFilters2 = []; + that.modelFilters2 = []; + that.specsFilters2 = []; + let nameList=[],dateList = [],specsList=[],modelList=[]; let obj = { query: { start_date: that.start_date, @@ -331,6 +420,47 @@ export default { let data = res.data2.ds0; that.tableData1 = data; that.tableData2 = data; + if(data.length>0){ + data.forEach((ite) => { + if (nameList.indexOf(ite.物料名) > -1) { + } else { + nameList.push(ite.物料名); + let obj = {}; + obj.text = ite.物料名; + obj.value = ite.物料名; + that.nameFilters.push(obj); + } + if(modelList.indexOf(ite.型号)>-1){}else{ + modelList.push(ite.型号); + let obj2 = {}; + obj2.text = ite.型号; + obj2.value = ite.型号; + that.modelFilters.push(obj2); + } + if(specsList.indexOf(ite.规格)>-1){}else{ + specsList.push(ite.规格); + let obj3 = {}; + obj3.text = ite.规格; + obj3.value = ite.规格; + that.specsFilters.push(obj3); + } + if(that.queryType == "月"){ + if(dateList.indexOf(ite.周)>-1){}else{ + dateList.push(ite.周); + let obj4 = {}; + obj4.text = ite.周; + obj4.value = ite.周; + that.dateFilters.push(obj4); + } + }else{ + that.dateFilters = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; + } + that.nameFilters2 = that.nameFilters; + that.modelFilters2 = that.modelFilters; + that.specsFilters2 = that.specsFilters; + that.dateFilters2 = that.dateFilters; + }) + } that.setChartData(data); } }); @@ -435,6 +565,38 @@ export default { option.series = seriesData; that.setChart("bachart1", option); }, + filterName(value, row) { + return row.物料名 === value; + }, + filterDate(value, row) { + if (this.queryType == "月") { + return row.周 === value; + }else{ + return row.月 === value; + } + }, + filterSpecs(value, row) { + return row.规格 === value; + }, + filterModel(value, row) { + return row.型号 === value; + }, + filterName2(value, row) { + return row.物料名 === value; + }, + filterDate2(value, row) { + if (this.queryType == "月") { + return row.周 === value; + }else{ + return row.月 === value; + } + }, + filterSpecs2(value, row) { + return row.规格 === value; + }, + filterModel2(value, row) { + return row.型号 === value; + }, handleExport(val) { this.exportLoading = true; let id = "#exportDiv" + val; diff --git a/src/views/statistics/material_statistics.vue b/src/views/statistics/material_statistics.vue index aeccecf4..45b56840 100644 --- a/src/views/statistics/material_statistics.vue +++ b/src/views/statistics/material_statistics.vue @@ -50,7 +50,6 @@ @change="materialInChange" > - @@ -78,13 +77,28 @@ > - - - + + + - + - + @@ -108,7 +122,6 @@ type="primary" >导出 - - - - + + + - + - + @@ -203,6 +231,14 @@ export default { outData: [], inmOption: [], outOption: [], + nameFilters: [], + dateFilters: [], + modelFilters: [], + specsFilters: [], + nameFilters2: [], + dateFilters2: [], + modelFilters2: [], + specsFilters2: [], monthList: ["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"], materialItem:{}, apiObjMaterial:this.$API.mtm.material.list, @@ -233,7 +269,6 @@ export default { that.rightHeight = height - 115; that.tableHeight = height - 140 - chartheight; that.setChart("bachart1", that.basicOption); - // that.getInmOption(); that.getTable(); }, methods: { @@ -266,12 +301,9 @@ export default { }, materialInChange(data) { let that = this; - console.log(that.materialItem); - console.log(that.materialItem.id); that.materialIn = that.materialItem.id; let option = deepCopy(that.basicOption); option.xAxis.data = that.xAxisData; - console.log(option); that.setChart("bachart1",option); this.getInmData(); }, @@ -289,6 +321,11 @@ export default { getInmData() { let that = this; that.tableData1 = []; + that.nameFilters = []; + that.dateFilters = []; + that.modelFilters = []; + that.specsFilters = []; + let nameList=[],dateList = [],specsList=[],modelList=[]; let exec = that.queryType == "月" ? "saleOutWeek" : "saleOutMonth"; let obj = { query: { @@ -300,8 +337,44 @@ export default { }; that.$API.bi.dataset.exec.req(exec, obj).then((res) => { if (res.data2.ds0&&res.data2.ds0.length>0) { - that.tableData1 = res.data2.ds0; - that.setChartData(res.data2.ds0); + let data = res.data2.ds0; + that.tableData1 = data; + data.forEach((ite) => { + if (nameList.indexOf(ite.物料名) > -1) { + } else { + nameList.push(ite.物料名); + let obj = {}; + obj.text = ite.物料名; + obj.value = ite.物料名; + that.nameFilters.push(obj); + } + if(modelList.indexOf(ite.型号)>-1){}else{ + modelList.push(ite.型号); + let obj2 = {}; + obj2.text = ite.型号; + obj2.value = ite.型号; + that.modelFilters.push(obj2); + } + if(specsList.indexOf(ite.规格)>-1){}else{ + specsList.push(ite.规格); + let obj3 = {}; + obj3.text = ite.规格; + obj3.value = ite.规格; + that.specsFilters.push(obj3); + } + if(that.queryType == "月"){ + if(dateList.indexOf(ite.周)>-1){}else{ + dateList.push(ite.周); + let obj4 = {}; + obj4.text = ite.周; + obj4.value = ite.周; + that.dateFilters.push(obj4); + } + }else{ + that.dateFilters = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; + } + }) + that.setChartData(data); }else{ let option = deepCopy(that.basicOption); option.xAxis.data = that.xAxisData; @@ -318,13 +391,64 @@ export default { mio_type: "pur_in", }, }; + that.nameFilters = []; + that.dateFilters = []; + that.modelFilters = []; + that.specsFilters = []; + that.nameFilters2 = []; + that.dateFilters2 = []; + that.modelFilters2 = []; + that.specsFilters2 = []; + let nameList=[],dateList = [],specsList=[],modelList=[]; let exec = that.queryType == "月" ? "saleOutWeek" : "saleOutMonth"; that.$API.bi.dataset.exec.req(exec, obj).then((res) => { that.tableData2 = []; + that.tableData1 = []; if (res.data2.ds0) { let data = res.data2.ds0; that.tableData1 = data; that.tableData2 = data; + if(data.length>0){ + data.forEach((ite) => { + if (nameList.indexOf(ite.物料名) > -1) { + } else { + nameList.push(ite.物料名); + let obj = {}; + obj.text = ite.物料名; + obj.value = ite.物料名; + that.nameFilters.push(obj); + } + if(modelList.indexOf(ite.型号)>-1){}else{ + modelList.push(ite.型号); + let obj2 = {}; + obj2.text = ite.型号; + obj2.value = ite.型号; + that.modelFilters.push(obj2); + } + if(specsList.indexOf(ite.规格)>-1){}else{ + specsList.push(ite.规格); + let obj3 = {}; + obj3.text = ite.规格; + obj3.value = ite.规格; + that.specsFilters.push(obj3); + } + if(that.queryType == "月"){ + if(dateList.indexOf(ite.周)>-1){}else{ + dateList.push(ite.周); + let obj4 = {}; + obj4.text = ite.周; + obj4.value = ite.周; + that.dateFilters.push(obj4); + } + }else{ + that.dateFilters = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; + } + that.nameFilters2 = that.nameFilters; + that.modelFilters2 = that.modelFilters; + that.specsFilters2 = that.specsFilters; + that.dateFilters2 = that.dateFilters; + }) + } that.setChartData(data); } }); @@ -429,6 +553,38 @@ export default { }); return sums; }, + filterName(value, row) { + return row.物料名 === value; + }, + filterDate(value, row) { + if (this.queryType == "月") { + return row.周 === value; + }else{ + return row.月 === value; + } + }, + filterSpecs(value, row) { + return row.规格 === value; + }, + filterModel(value, row) { + return row.型号 === value; + }, + filterName2(value, row) { + return row.物料名 === value; + }, + filterDate2(value, row) { + if (this.queryType == "月") { + return row.周 === value; + }else{ + return row.月 === value; + } + }, + filterSpecs2(value, row) { + return row.规格 === value; + }, + filterModel2(value, row) { + return row.型号 === value; + }, handleExport(val) { this.exportLoading = true; let id = "#exportDiv" + val; diff --git a/src/views/statistics/pass_num.vue b/src/views/statistics/pass_num.vue index b1e1202c..34c89c79 100644 --- a/src/views/statistics/pass_num.vue +++ b/src/views/statistics/pass_num.vue @@ -60,15 +60,30 @@ show-summary > - + - + - + - + - + @@ -111,15 +126,30 @@ show-summary > - + - + - + - + - + @@ -162,17 +192,35 @@ show-summary > - + - + - + - + - + - + @@ -250,7 +298,19 @@ export default { tableData6: [], tableData7: [], tableData10: [], - tableDataAVG: [], + nameFilters: [], + dateFilters: [], + modelFilters: [], + specsFilters: [], + nameFilters6: [], + xilieFilters6: [], + dateFilters6: [], + modelFilters6: [], + specsFilters6: [], + nameFilters7: [], + dateFilters7: [], + modelFilters7: [], + specsFilters7: [], firstWeekNum: 1, endWeekNum: 4, monthList: [ @@ -324,6 +384,12 @@ export default { }, getData6() { let that = this; + let dateList = [],specsList=[],modelList=[],xilieList=[]; + that.nameFilters6 = []; + that.dateFilters6 = []; + that.xilieFilters6 = []; + that.modelFilters6 = []; + that.specsFilters6 = []; let option = deepCopy(that.basicOption); option.xAxis.data = that.xAxisData; option.title.text = "6车间"; @@ -340,14 +406,38 @@ export default { that.tableData6 = tableData6; if (tableData6.length > 0) { option.series = []; - let seriesData = [], - nameList = []; + let seriesData = [],nameList = []; tableData6.forEach((ite) => { if (nameList.indexOf(ite.物料名) > -1) { - } else { + }else { nameList.push(ite.物料名); seriesData.push([]); + let obj = {}; + obj.text = ite.物料名; + obj.value = ite.物料名; + that.nameFilters6.push(obj); } + if(xilieList.indexOf(ite.物料系列)>-1){}else{ + xilieList.push(ite.物料系列); + let obj2 = {}; + obj2.text = ite.物料系列; + obj2.value = ite.物料系列; + that.xilieFilters6.push(obj2); + } + if(specsList.indexOf(ite.规格)>-1){}else{ + specsList.push(ite.规格); + let obj3 = {}; + obj3.text = ite.规格; + obj3.value = ite.规格; + that.specsFilters6.push(obj3); + } + if(modelList.indexOf(ite.型号)>-1){}else{ + modelList.push(ite.型号); + let obj4 = {}; + obj4.text = ite.型号; + obj4.value = ite.型号; + that.modelFilters6.push(obj4); + } }); if (that.queryType == "月") { tableData6.forEach((item) => { @@ -359,8 +449,16 @@ export default { seriesData[indexX][indexY] =0; seriesData[indexX][indexY] += item.合格数; } + if(dateList.indexOf(item.周)>-1){}else{ + dateList.push(item.周); + let obj = {}; + obj.text = item.周; + obj.value = item.周; + that.dateFilters6.push(obj); + } }); } else { + that.dateFilters6 = [1,2,3,4,5,6,7,8,9,10,11,12]; tableData6.forEach((item) => { let indexX = nameList.indexOf(item.物料名); let indexY = item.month - 1; @@ -389,6 +487,11 @@ export default { }, getData7() { let that = this; + let dateList = [],specsList=[],modelList=[]; + that.nameFilters7 = []; + that.dateFilters7 = []; + that.modelFilters7 = []; + that.specsFilters7 = []; let obj = { query: { start_date: that.start_date, @@ -404,9 +507,7 @@ export default { console.log("7生产车间统计:", res); let tableData7 = res.data2.ds0 ? res.data2.ds0 : []; that.tableData7 = tableData7; - debugger; if (tableData7.length > 0) { - debugger; option.series = []; let seriesData = [], nameList = []; @@ -415,7 +516,25 @@ export default { } else { nameList.push(ite.物料名); seriesData.push([]); + let obj = {}; + obj.text = ite.物料名; + obj.value = ite.物料名; + that.nameFilters7.push(obj); } + if(modelList.indexOf(ite.型号)>-1){}else{ + modelList.push(ite.型号); + let obj2 = {}; + obj2.text = ite.型号; + obj2.value = ite.型号; + that.modelFilters7.push(obj2); + } + if(specsList.indexOf(ite.规格)>-1){}else{ + specsList.push(ite.规格); + let obj3 = {}; + obj3.text = ite.规格; + obj3.value = ite.规格; + that.specsFilters7.push(obj3); + } }); tableData7.forEach((item) => { let indexX = 0, @@ -423,7 +542,15 @@ export default { if (that.queryType == "月") { indexX = nameList.indexOf(item.物料名); indexY = item.周 - that.firstWeekNum; + if(dateList.indexOf(item.周)>-1){}else{ + dateList.push(item.周); + let obj = {}; + obj.text = item.周; + obj.value = item.周; + that.dateFilters7.push(obj); + } } else { + that.dateFilters7 = [1,2,3,4,5,6,7,8,9,10,11,12]; indexX = nameList.indexOf(item.物料名); indexY = item.月 - 1; } @@ -451,6 +578,11 @@ export default { }, getData10() { let that = this; + let dateList = [],specsList=[],modelList=[]; + that.nameFilters = []; + that.dateFilters = []; + that.modelFilters = []; + that.specsFilters = []; let option = deepCopy(that.basicOption); option.xAxis.data = that.xAxisData; option.title.text = "预制管(10车间)"; @@ -463,7 +595,6 @@ export default { }; let exec = that.queryType == "月" ? "lineWeek" : "lineMonth"; that.$API.bi.dataset.exec.req(exec, obj).then((res) => { - // console.log('10生产车间统计:',res); let tableData10 = res.data2.ds0 ? res.data2.ds0 : []; that.tableData10 = tableData10; if (tableData10.length > 0) { @@ -475,7 +606,25 @@ export default { } else { nameList.push(ite.物料名); seriesData.push([]); + let obj = {}; + obj.text = ite.物料名; + obj.value = ite.物料名; + that.nameFilters.push(obj); } + if(modelList.indexOf(ite.型号)>-1){}else{ + modelList.push(ite.型号); + let obj2 = {}; + obj2.text = ite.型号; + obj2.value = ite.型号; + that.modelFilters.push(obj2); + } + if(specsList.indexOf(ite.规格)>-1){}else{ + specsList.push(ite.规格); + let obj3 = {}; + obj3.text = ite.规格; + obj3.value = ite.规格; + that.specsFilters.push(obj3); + } }); tableData10.forEach((item) => { let indexX = 0, @@ -483,7 +632,15 @@ export default { if (that.queryType == "月") { indexX = nameList.indexOf(item.物料名); indexY = item.周 - that.firstWeekNum; + if(dateList.indexOf(item.周)>-1){}else{ + dateList.push(item.周); + let obj = {}; + obj.text = item.周; + obj.value = item.周; + that.dateFilters.push(obj); + } } else { + that.dateFilters = [1,2,3,4,5,6,7,8,9,10,11,12]; indexX = nameList.indexOf(item.物料名); indexY = item.月 - 1; } @@ -604,6 +761,60 @@ export default { that.getData10(); // that.getDataDAVG(); }, + //6 + filterName6(value, row) { + return row.物料名 === value; + }, + filterXilie6(value, row) { + return row.物料系列 === value; + }, + filterDate6(value, row) { + if (this.queryType == "月") { + return row.周 === value; + }else{ + return row.月 === value; + } + }, + filterSpecs6(value, row) { + return row.规格 === value; + }, + filterModel6(value, row) { + return row.型号 === value; + }, + //7 + filterName7(value, row) { + return row.物料名 === value; + }, + filterDate7(value, row) { + if (this.queryType == "月") { + return row.周 === value; + }else{ + return row.月 === value; + } + }, + filterSpecs7(value, row) { + return row.规格 === value; + }, + filterModel7(value, row) { + return row.型号 === value; + }, + //10 + filterName(value, row) { + return row.物料名 === value; + }, + filterDate(value, row) { + if (this.queryType == "月") { + return row.周 === value; + }else{ + return row.月 === value; + } + }, + filterSpecs(value, row) { + return row.规格 === value; + }, + filterModel(value, row) { + return row.型号 === value; + }, handleExport(val) { this.exportLoading = true; let id = "#exportDiv" + val; diff --git a/src/views/statistics/ppass_num.vue b/src/views/statistics/ppass_num.vue index ca71a6cc..6771b5ed 100644 --- a/src/views/statistics/ppass_num.vue +++ b/src/views/statistics/ppass_num.vue @@ -59,9 +59,15 @@ show-summary > - + - + @@ -127,6 +133,8 @@ export default { }, series: [], }, + nameFilters: [], + mgroupFilters: [], processData: [], xAxisData: [], tableData: [], @@ -156,6 +164,8 @@ export default { }, getData6() { let that = this; + that.nameFilters = []; + that.mgroupFilters = []; let obj = { query: { start_date: this.start_date, @@ -186,9 +196,17 @@ export default { if (xAxisData.indexOf(item.工段) > -1) { } else { xAxisData.push(item.工段); + let obj = {}; + obj.text = item.工段; + obj.value = item.工段; + that.mgroupFilters.push(obj); } if (nameData.indexOf(item.物料名) > -1) { } else { + let obj0 = {}; + obj0.text = item.物料名; + obj0.value = item.物料名; + that.nameFilters.push(obj0); nameData.push(item.物料名); let obj = { name:'', @@ -205,8 +223,6 @@ export default { obj.name=item.物料名, seriesData.push(obj); } - console.log("xAxisData:", xAxisData); - console.log("nameData:", nameData); let index = xAxisData.indexOf(item.工段); let indexY = nameData.indexOf(item.物料名); seriesData[indexY].data[index] += item.合格数; @@ -275,6 +291,12 @@ export default { }); return sums; }, + filterName(value, row) { + return row.物料名 === value; + }, + filterMgroup(value, row) { + return row.工段 === value; + }, handleExport() { this.exportLoading = true; this.$XLSX("#exportDiv", "工序合格数"); diff --git a/src/views/statistics/product_check.vue b/src/views/statistics/product_check.vue index 03e8ebbb..e233ab6e 100644 --- a/src/views/statistics/product_check.vue +++ b/src/views/statistics/product_check.vue @@ -58,11 +58,20 @@ - + - + - + @@ -114,11 +123,20 @@ - + - + - + @@ -174,11 +192,20 @@ - + - + - + @@ -338,6 +365,15 @@ export default { tableData7: [], tableData10: [], tableData8: [], + nameFilters: [], + specsFilters:[], + modelFilters:[], + nameFilters7: [], + specsFilters7:[], + modelFilters7:[], + nameFilters10: [], + specsFilters10:[], + modelFilters10:[], }; }, mounted() { @@ -351,7 +387,7 @@ export default { this.queryDate = year + "-" + month; this.start_date = year + "-" + month + "-01"; this.end_date = - year + "-" + month + "-" + new Date(year, month, 0).getDate(); + year + "-" + month + "-" + days; this.getData(); this.getData7(); this.getData10(); @@ -364,6 +400,10 @@ export default { getData() { let that = this; that.tableData8 = []; + that.nameFilters = []; + that.modelFilters = []; + that.specsFilters = []; + let nameList=[],specsList=[],modelList=[]; let exec = that.queryType == "月" ? "lineMonth" : "lineYear"; let obj = { query: { @@ -374,10 +414,32 @@ export default { }, }; that.$API.bi.dataset.exec.req(exec, obj).then((res) => { - console.log("退火车间统计:", res); if (res.data2.ds0) { let data = res.data2.ds0; that.tableData8 = data; + data.forEach((item) => { + if(nameList.indexOf(item.物料名)>-1){}else{ + nameList.push(item.物料名); + let obj = {}; + obj.text = item.物料名; + obj.value = item.物料名; + that.nameFilters.push(obj); + } + if(modelList.indexOf(item.型号)>-1){}else{ + modelList.push(item.型号); + let obj2 = {}; + obj2.text = item.型号; + obj2.value = item.型号; + that.modelFilters.push(obj2); + } + if(specsList.indexOf(item.规格)>-1){}else{ + specsList.push(item.规格); + let obj3 = {}; + obj3.text = item.规格; + obj3.value = item.规格; + that.specsFilters.push(obj3); + } + }) } else { that.tableData8 = []; } @@ -426,6 +488,10 @@ export default { getData7() { let that = this; that.tableData7 = []; + that.nameFilters7 = []; + that.modelFilters7 = []; + that.specsFilters7 = []; + let nameList=[],specsList=[],modelList=[]; let obj = { query: { start_date: this.start_date, @@ -435,10 +501,32 @@ export default { }; let exec = that.queryType == "月" ? "lineMonth" : "lineYear"; that.$API.bi.dataset.exec.req(exec, obj).then((res) => { - console.log("7生产车间统计:", res); if (res.data2.ds0) { let data = res.data2.ds0; that.tableData7 = data; + data.forEach((item) => { + if(nameList.indexOf(item.物料名)>-1){}else{ + nameList.push(item.物料名); + let obj = {}; + obj.text = item.物料名; + obj.value = item.物料名; + that.nameFilters7.push(obj); + } + if(modelList.indexOf(item.型号)>-1){}else{ + modelList.push(item.型号); + let obj2 = {}; + obj2.text = item.型号; + obj2.value = item.型号; + that.modelFilters7.push(obj2); + } + if(specsList.indexOf(item.规格)>-1){}else{ + specsList.push(item.规格); + let obj3 = {}; + obj3.text = item.规格; + obj3.value = item.规格; + that.specsFilters7.push(obj3); + } + }) } else { that.tableData7 = []; } @@ -480,6 +568,10 @@ export default { getData10() { let that = this; that.tableData10 = []; + that.nameFilters10 = []; + that.modelFilters10 = []; + that.specsFilters10 = []; + let nameList=[],specsList=[],modelList=[]; let obj = { query: { start_date: this.start_date, @@ -489,10 +581,32 @@ export default { }; let exec = that.queryType == "月" ? "lineMonth" : "lineYear"; that.$API.bi.dataset.exec.req(exec, obj).then((res) => { - console.log("10生产车间统计:", res); if (res.data2.ds0) { let data = res.data2.ds0; that.tableData10 = data; + data.forEach((item) => { + if(nameList.indexOf(item.物料名)>-1){}else{ + nameList.push(item.物料名); + let obj = {}; + obj.text = item.物料名; + obj.value = item.物料名; + that.nameFilters10.push(obj); + } + if(modelList.indexOf(item.型号)>-1){}else{ + modelList.push(item.型号); + let obj2 = {}; + obj2.text = item.型号; + obj2.value = item.型号; + that.modelFilters10.push(obj2); + } + if(specsList.indexOf(item.规格)>-1){}else{ + specsList.push(item.规格); + let obj3 = {}; + obj3.text = item.规格; + obj3.value = item.规格; + that.specsFilters10.push(obj3); + } + }) } else { that.tableData10 = []; } @@ -509,7 +623,6 @@ export default { }, }; that.$API.bi.dataset.exec.req(exec, obj2).then((res2) => { - console.log("10生产车间统计:", res2); if (res2.data2.ds0) { let data = res2.data2.ds0; that.option2.series.data[0].value=0; @@ -598,6 +711,33 @@ export default { }); return sums; }, + filterName(value, row) { + return row.物料名 === value; + }, + filterSpecs(value, row) { + return row.规格 === value; + }, + filterModel(value, row) { + return row.型号 === value; + }, + filterName7(value, row) { + return row.物料名 === value; + }, + filterSpecs7(value, row) { + return row.规格 === value; + }, + filterModel7(value, row) { + return row.型号 === value; + }, + filterName10(value, row) { + return row.物料名 === value; + }, + filterSpecs10(value, row) { + return row.规格 === value; + }, + filterModel10(value, row) { + return row.型号 === value; + }, handleExport(val) { this.exportLoading = true; let id = "#exportDiv" + val; diff --git a/src/views/statistics/product_check2.vue b/src/views/statistics/product_check2.vue index 4bd45a05..875bd9c2 100644 --- a/src/views/statistics/product_check2.vue +++ b/src/views/statistics/product_check2.vue @@ -54,15 +54,24 @@ 导出 - + - + - + @@ -129,6 +138,9 @@ mgroupName:'', mgroupOption:[], tableData:[], + dateFilters:[], + specsFilters:[], + modelFilters:[], } }, mounted(){ @@ -164,6 +176,10 @@ }, getData(){ let that = this; + that.dateFilters = []; + that.modelFilters = []; + that.specsFilters = []; + let dateList=[],specsList=[],modelList=[]; let exec = that.queryType=='月'?'lineMonth':'lineYear'; let obj = { query: { @@ -213,8 +229,35 @@ }; //获取table数据 that.$API.bi.dataset.exec.req(exec, obj2).then((res2) => { - console.log('获取table数据:', res2.data2.ds0); that.tableData = res2.data2.ds0; + let data = res2.data2.ds0; + data.forEach((item) => { + let date =item.年; + if(that.queryType=='月'){ + date =item.年+'-'+item.月; + } + if(dateList.indexOf(date)>-1){}else{ + dateList.push(date); + let obj = {}; + obj.text = date; + obj.value = date; + that.dateFilters.push(obj); + } + if(modelList.indexOf(item.型号)>-1){}else{ + modelList.push(item.型号); + let obj2 = {}; + obj2.text = item.型号; + obj2.value = item.型号; + that.modelFilters.push(obj2); + } + if(specsList.indexOf(item.规格)>-1){}else{ + specsList.push(item.规格); + let obj3 = {}; + obj3.text = item.规格; + obj3.value = item.规格; + that.specsFilters.push(obj3); + } + }) }); }, handleQuery(){ @@ -266,6 +309,19 @@ }); return sums; }, + filterDate(value, row) { + let date = row.年; + if(this.queryType=='月'){ + date =row.年+'-'+row.月; + } + return date === value; + }, + filterSpecs(value, row) { + return row.规格 === value; + }, + filterModel(value, row) { + return row.型号 === value; + }, handleExport(val) { this.exportLoading = true; let id = '#exportDiv' + val; diff --git a/src/views/statistics/stock_statistics.vue b/src/views/statistics/stock_statistics.vue index 24794471..5b4ac93d 100644 --- a/src/views/statistics/stock_statistics.vue +++ b/src/views/statistics/stock_statistics.vue @@ -32,7 +32,7 @@ - - - - + + + + - - - + + +