From 1b191df7834405219cdc7c285bd2f0cd1ece0d2a Mon Sep 17 00:00:00 2001 From: shijing Date: Mon, 18 Dec 2023 12:36:18 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=A9=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/statistics/user_statistics.vue | 159 ++++++++++------------- 1 file changed, 66 insertions(+), 93 deletions(-) diff --git a/src/views/statistics/user_statistics.vue b/src/views/statistics/user_statistics.vue index 14ecad63..e6361c5e 100644 --- a/src/views/statistics/user_statistics.vue +++ b/src/views/statistics/user_statistics.vue @@ -2,30 +2,23 @@
- - + + - - @@ -40,18 +33,22 @@ - - - - - - - - - - - - + + + + + + + + + + {{ queryBelongDept }} + + + + @@ -68,13 +65,14 @@ }, data() { return { - queryType:'月', + queryBelongDept:'', queryDate:'', start_date:'', end_date:'', currentYear:'', currentMonth:'', - typeOptions:['月','年'], + deptData:[], + tableData:[], option: { title: { text: '人员统计', @@ -95,10 +93,10 @@ }, yAxis: { type: 'category', - data: ['张良', '钱勇', '赵丽丽', '王军', '孙聪', '李超', '周年宋'] + data: [] }, series: { - data: [300, 290, 320, 350, 310, 350, 290], + data: [], type: 'bar', barWidth: '15px', } @@ -115,82 +113,57 @@ this.start_date =year+'-'+month+'-01'; this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate(); this.queryDate = year+'-'+month; - this.getData6(); - this.getData7(); - this.getData10(); + this.getData(); + this.getDept(); }, methods:{ + getDept() { + this.$API.system.dept.list.req({ page: 0,type:'dept'}).then(res=>{ + let data = []; + res.forEach(item => { + if(item.parent=='3423856735881117696'){ + data.push(item) + } + }); + this.deptData = data; + this.queryBelongDept = data[0].name; + }); + }, queryTypeChange(value){ - console.log(value) this.queryDate = ''; - if(value=='月'){ - this.xAxisData = ['第一周','第二周','第三周','第四周']; - }else{ - this.xAxisData = ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月'] - } - this.option.xAxis.data = this.xAxisData; - this.option2.xAxis.data = this.xAxisData; - this.option3.xAxis.data = this.xAxisData; - this.option4.xAxis.data = this.xAxisData; }, - getData6(){ - let that = this; - let exec = that.queryType=='月'?'lineWeek':'lineMonth'; - let obj = { - query: { start_date: this.start_date, end_date: this.end_date, dept_name: "6车间" }, - }; - that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => { - console.log('6生产车间统计:',doInRes); - debugger; - }); - }, - getData7(){ + getData(){ let that = this; let obj = { - query: { start_date: this.start_date, end_date: this.end_date, dept_name: "7车间" }, + query: { start_date: this.start_date, end_date: this.end_date, dept_name:this.queryBelongDept }, }; - let exec = that.queryType=='月'?'lineWeek':'lineMonth'; - that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => { - console.log('7生产车间统计:',doInRes); - debugger; - }); - }, - getData10(){ - let that = this; - let obj = { - query: { start_date: this.start_date, end_date: this.end_date, dept_name: "10·车间" }, - }; - let exec = that.queryType=='月'?'lineWeek':'lineMonth'; - that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => { - console.log('10生产车间统计:',doInRes); - debugger; + that.$API.bi.dataset.exec.req('performance', obj).then((res) => { + console.log('绩效统计:',res); + let data = res.data2.ds0; + let seriesData = [],yAxisData=[]; + data.forEach(item=>{ + seriesData.push(item.合格数); + yAxisData.push(item.操作人); + }) + console.log(yAxisData) + console.log(seriesData) + console.log(data) + that.tableData = data; + that.option.yAxis.data = yAxisData; + that.option.series.data = seriesData; }); }, handleQuery(){ if(this.queryDate!==''){ - if(this.queryType=='月'){ - - this.start_date =this.queryDate+'-01'; + this.start_date =this.queryDate+'-01'; let arr = this.queryDate.split('-'); this.end_date = this.queryDate+'-'+new Date(arr[0], arr[1], 0).getDate(); - }else{ - this.start_date = this.queryDate+'-01-01'; - this.end_date = this.queryDate+'-12-31'; - } }else{ - if(this.queryType=='月'){ - this.start_date =this.currentYear+'-'+this.currentMonth+'-01'; - this.end_date = this.currentYear+'-'+this.currentMonth+'-'+new Date(this.currentYear, this.currentMonth, 0).getDate(); - }else{ - this.start_date = this.currentYear+'-01-01'; - this.end_date = this.currentYear+'-12-31'; - } + this.start_date =this.currentYear+'-'+this.currentMonth+'-01'; + this.end_date = this.currentYear+'-'+this.currentMonth+'-'+new Date(this.currentYear, this.currentMonth, 0).getDate(); } - debugger; - console.log(this.query) - this.getData6(); - this.getData7(); - this.getData10(); + console.log('查询query',this.start_date,this.end_date) + this.getData(); }, }, }