diff --git a/src/views/inm/mioitem.vue b/src/views/inm/mioitem.vue index aaf8f267..1b154da3 100644 --- a/src/views/inm/mioitem.vue +++ b/src/views/inm/mioitem.vue @@ -44,13 +44,14 @@ diff --git a/src/views/statistics/material_statistics.vue b/src/views/statistics/material_statistics.vue index 95f0236c..d6343ed4 100644 --- a/src/views/statistics/material_statistics.vue +++ b/src/views/statistics/material_statistics.vue @@ -38,10 +38,10 @@

采购统计

- + @@ -54,13 +54,18 @@ - + + - + - + @@ -72,10 +77,10 @@

消耗统计

- - + @@ -88,13 +93,18 @@ - + + - + - + @@ -149,19 +159,16 @@ type: 'value' }, lenged:[], - series: [{ + series: { data: [0, 0, 0, 0, 0, 0, 0], stack: 'Ad', type: 'bar', barWidth: '15px', - }] + } }, - tableData:[ - {id:1,date:'2023-12-11',name:'ZJ2-1',count:200}, - {id:1,date:'2023-12-11',name:'ZJ2-2',count:200}, - {id:1,date:'2023-12-11',name:'ZJ2-3',count:200}, - {id:1,date:'2023-12-11',name:'ZJ2-4',count:200}, - ], + tableData1:[], + tableData2:[], + materialIn:'', firstWeekNum:1, endWeekNum:1, product:'', @@ -193,13 +200,6 @@ } that.xAxisData = that.xAxisOrigin; this.getInmOption(); - // this.getOutOption(); - let option = deepCopy(that.basicOption); - option.xAxis.data = that.xAxisData; - that.setChart("bachart1", option); - let option2 = deepCopy(that.basicOption); - option2.xAxis.data = that.xAxisData; - that.setChart("bachart2", option2); }, methods:{ setChart(name, option = null) { @@ -229,60 +229,99 @@ console.log(value) this.queryDate = ''; }, - materialChange(){}, + materialInChange(){ + this.getInmData(); + }, + materialOutChange(){ + this.getOutData(); + }, //采购物料选项 getInmOption(){ let that = this; let obj = {}; obj.page=0; + console.log('000000') obj.type__in = '30,40,50,60,70'; that.$API.mtm.material.list.req( obj).then((res) => { that.inmOption = res; - console.log('inmOption',res) - that.materialIn = res[0].id; + that.materialIn = res[1].id; + let arr = []; + res.forEach(item=>{ + if(item.type==30){ + arr.push(item) + } + }); + that.outOption = arr; + that.materialOut = arr[1].id; that.getInmData(); + that.getOutData(); }) }, //采购物料 getInmData(){ let that = this; + let option = deepCopy(that.basicOption); + option.xAxis.data = that.xAxisData; let exec = that.queryType=='月'?'saleOutWeek':'saleOutMonth'; let obj = { query: { start_date: that.start_date, end_date: that.end_date, mio_type: "pur_in",material_id:that.materialIn }, }; that.$API.bi.dataset.exec.req(exec, obj).then((res) => { - debugger; console.log('getInmData',res); - res.forEach(item => { - - }); - }) - }, - //消耗暂定 - getOutOption(){ - let that = this; - let obj = {}; - obj.page=0; - that.$API.inm.mioitem.list.req( obj).then((res) => { - that.inmOption = res; - console.log('inmOption',res) - that.materialOut = res[0].id; - that.getOutData(); + let data = res.data2.ds0; + that.tableData1 = data; + if(data.length>0){ + option.series.data = []; + let seriesData = []; + data.forEach(item=>{ + if(that.queryType=='月'){ + let index = item.周-that.firstWeekNum; + seriesData[index]=item.数量; + }else{ + let index = item.月-1; + seriesData[index]=item.数量; + } + }) + debugger; + console.log('seriesData',seriesData) + option.series.data = seriesData; + that.setChart("bachart1", option); + }else{ + that.setChart("bachart1", option); + } }) }, //消耗暂定 getOutData(){ let that = this; + let option = deepCopy(that.basicOption); + option.xAxis.data = that.xAxisData; let exec = that.queryType=='月'?'saleOutWeek':'saleOutMonth'; let obj = { - query: { start_date: that.start_date, end_date: that.end_date, mio_type: "sale_out",material_id:that.materialOut }, + query: { start_date: that.start_date, end_date: that.end_date, mio_type: "do_out",material_id:that.materialOut }, }; that.$API.bi.dataset.exec.req(exec, obj).then((res) => { debugger; - console.log('getInmData',res); - res.forEach(item => { - - }); + console.log('getOutData',res); + let data = res.data2.ds0; + that.tableData2 = data; + if(data.length>0){ + option.series.data = []; + let seriesData = []; + data.forEach(item=>{ + if(that.queryType=='月'){ + let index = item.周-that.firstWeekNum; + seriesData[index]=item.数量; + }else{ + let index = item.月-1; + seriesData[index]=item.数量; + } + }) + option.series.data = seriesData; + that.setChart("bachart2", option); + }else{ + that.setChart("bachart2", option); + } }) }, handleQuery(){