From c409aed5f6bcb45930d39be2b0e62969777606f2 Mon Sep 17 00:00:00 2001 From: shijing Date: Thu, 21 Mar 2024 15:43:45 +0800 Subject: [PATCH] #142 --- src/views/qm/productCheck.vue | 22 +-- src/views/statistics/product_check.vue | 122 ++++++++++++----- src/views/statistics/product_check2.vue | 174 ++++++++++++------------ 3 files changed, 188 insertions(+), 130 deletions(-) diff --git a/src/views/qm/productCheck.vue b/src/views/qm/productCheck.vue index 31a859e9..e03456c1 100644 --- a/src/views/qm/productCheck.vue +++ b/src/views/qm/productCheck.vue @@ -15,10 +15,10 @@ - + @@ -60,10 +60,10 @@ - + @@ -98,7 +98,7 @@ @@ -233,17 +233,21 @@ export default { }, saveCheck(row) { console.log(row); + let index = this.formTableData.findIndex(item => item.id == row.id); + if (row.id && row.id !== '') { this.$API.qm.ftest.update.req(row.id, row).then((res) => { + this.formTableData[index].isEdit = false; this.$message.success("操作成功"); - this.$refs.table.refresh(); + this.$refs.formTable.refresh(); }).catch((err) => { return err; }); } else { this.$API.qm.ftest.create.req(row).then((res) => { + this.formTableData[index].isEdit = false; this.$message.success("操作成功"); - this.$refs.table.refresh(); + this.$refs.formTable.refresh(); }).catch((err) => { return err; }); diff --git a/src/views/statistics/product_check.vue b/src/views/statistics/product_check.vue index 99fbc09d..4dc846d2 100644 --- a/src/views/statistics/product_check.vue +++ b/src/views/statistics/product_check.vue @@ -2,7 +2,7 @@
- + @@ -264,9 +264,10 @@ export default { let year = date.getFullYear(); let month = date.getMonth() + 1; let days = new Date(year, month, 0).getDate(); - console.log(year, month, days) this.currentYear = year; this.currentMonth = month; + month = month < 10 ? '0' + month : month; + this.queryDate = year + '-' + month; this.start_date = year + '-' + month + '-01'; this.end_date = year + '-' + month + '-' + new Date(year, month, 0).getDate(); this.getData(); @@ -283,24 +284,46 @@ export default { that.tableData8 = []; let exec = that.queryType == '月' ? 'lineMonth' : 'lineYear'; let obj = { - query: { start_date: this.start_date, end_date: this.end_date, dept_name: "8车间" }, + query: { + start_date: this.start_date, end_date: this.end_date, dept_name: "8车间", + mgroup_name: "退火",group_bys_mgroup: ", mgroup.name", + select_cols_mgroup: ", mgroup.name AS 工段", + }, }; that.$API.bi.dataset.exec.req(exec, obj).then((res) => { console.log('退火车间统计:', res); - let data = res.data2.ds0; - if (data.length > 0) { + if (res2.data2.ds0) { + let data = res.data2.ds0; that.tableData8 = data; - that.option1.series.data[0].value = data[0].合格数; - that.option1.series.data[1].value = data[0].弯曲; - that.option1.series.data[2].value = data[0].条纹; - that.option1.series.data[3].value = data[0].断裂; - that.option1.series.data[4].value = data[0].偏壁; - that.option1.series.data[5].value = data[0].大小头; - that.option1.series.data[6].value = data[0].结石; - that.option1.series.data[7].value = data[0].气线; - that.option1.series.data[8].value = data[0].箱中破; + } else { + that.tableData8 = []; + } + }); + //获取echarts数据 + let obj2 = { + query: { + start_date: this.start_date, end_date: this.end_date, dept_name: "8车间", + group_bys_material: "", order_bys_material: "", select_cols_material: "", + mgroup_name: "退火",group_bys_mgroup: ", mgroup.name", + select_cols_mgroup: ", mgroup.name AS 工段", + }, + }; + that.$API.bi.dataset.exec.req(exec, obj2).then((res2) => { + console.log('退火车间统计:', res2); + if (res2.data2.ds0) { + let data = res2.data2.ds0; + if (data.length > 0) { + that.option3.series.data[0].value = data[0].合格数; + that.option3.series.data[1].value = data[0].弯曲; + that.option3.series.data[2].value = data[0].条纹; + that.option3.series.data[3].value = data[0].断裂; + that.option3.series.data[4].value = data[0].偏壁; + that.option3.series.data[5].value = data[0].大小头; + that.option3.series.data[6].value = data[0].结石; + that.option3.series.data[7].value = data[0].气线; + that.option3.series.data[8].value = data[0].箱中破; + } } - // debugger; }); }, getData7() { @@ -312,15 +335,32 @@ export default { let exec = that.queryType == '月' ? 'lineMonth' : 'lineYear'; that.$API.bi.dataset.exec.req(exec, obj).then((res) => { console.log('7生产车间统计:', res); - let data = res.data2.ds0; - if (data.length > 0) { + if (res2.data2.ds0) { + let data = res.data2.ds0; that.tableData7 = data; - that.option1.series.data[0].value = data[0].合格数; - that.option1.series.data[1].value = data[0].炸纹; - that.option1.series.data[2].value = data[0].条纹; - that.option1.series.data[3].value = data[0].气泡; - that.option1.series.data[4].value = data[0].弯曲; - that.option1.series.data[5].value = data[0].其他; + } else { + that.tableData7 = []; + } + }); + //获取echarts数据 + let obj2 = { + query: { + start_date: this.start_date, end_date: this.end_date, dept_name: "7车间", + group_bys_material: "",order_bys_material: "",select_cols_material: "" + }, + }; + that.$API.bi.dataset.exec.req(exec, obj2).then((res2) => { + console.log('7生产车间统计:', res2); + if (res2.data2.ds0) { + let data = res2.data2.ds0; + if (data.length > 0) { + that.option1.series.data[0].value = data[0].合格数; + that.option1.series.data[1].value = data[0].炸纹; + that.option1.series.data[2].value = data[0].条纹; + that.option1.series.data[3].value = data[0].气泡; + that.option1.series.data[4].value = data[0].弯曲; + that.option1.series.data[5].value = data[0].其他; + } } }); }, @@ -333,18 +373,36 @@ export default { let exec = that.queryType == '月' ? 'lineMonth' : 'lineYear'; that.$API.bi.dataset.exec.req(exec, obj).then((res) => { console.log('10生产车间统计:', res); - let data = res.data2.ds0; - if (data.length > 0) { + if (res2.data2.ds0) { + let data = res.data2.ds0; that.tableData10 = data; - that.option2.series.data[0].value = data[0].合格数; - that.option2.series.data[1].value = data[0].断裂; - that.option2.series.data[2].value = data[0].条纹; - that.option2.series.data[3].value = data[0].偏壁; - that.option2.series.data[4].value = data[0].大小头; - that.option2.series.data[5].value = data[0].结石; - that.option2.series.data[6].value = data[0].气线; + } else { + that.tableData10 = []; } }); + //获取echarts数据 + let obj2 = { + query: { + start_date: this.start_date, end_date: this.end_date, dept_name: "10车间", + group_bys_material: "",order_bys_material: "",select_cols_material: "" + }, + }; + that.$API.bi.dataset.exec.req(exec, obj2).then((res2) => { + console.log('10生产车间统计:', res2); + if (res2.data2.ds0) { + let data = res2.data2.ds0; + if (data.length > 0) { + that.option2.series.data[0].value = data[0].合格数; + that.option2.series.data[1].value = data[0].断裂; + that.option2.series.data[2].value = data[0].条纹; + that.option2.series.data[3].value = data[0].偏壁; + that.option2.series.data[4].value = data[0].大小头; + that.option2.series.data[5].value = data[0].结石; + that.option2.series.data[6].value = data[0].气线; + } + } + + }); }, handleQuery() { let that = this; diff --git a/src/views/statistics/product_check2.vue b/src/views/statistics/product_check2.vue index ef5e1382..e348bd7c 100644 --- a/src/views/statistics/product_check2.vue +++ b/src/views/statistics/product_check2.vue @@ -2,7 +2,7 @@
- + - + 导出 - + + - + - + - + - - - - - - -
-

成品检验

- - - - -
-
- - - - - - 导出 - - - - - - - - - + + + + + + + + + + + + @@ -125,29 +108,9 @@ }, series: [ { - name: '访问来源', + name: '工序检验', type: 'pie', - radius: ['40%', '70%'], - center: ['50%', '60%'], - label: false, - data: [ - {value: 1048, name: '合格数'}, - {value: 735, name: '不合格一'}, - {value: 580, name: '不合格二'}, - {value: 484, name: '不合格三'} - ] - } - ] - }, - option2: { - tooltip: { - trigger: 'item' - }, - series: [ - { - name: '访问来源', - type: 'pie', - radius: ['40%', '70%'], + radius: ['40%', '60%'], center: ['50%', '60%'], label: false, data: [ @@ -160,9 +123,9 @@ ] }, process:'', + processName:'', processOption:[], - product:'', - productOption:[], + tableData:[], } }, mounted(){ @@ -170,15 +133,16 @@ let year = date.getFullYear(); let month = date.getMonth()+1; let days = new Date(year, month, 0).getDate(); + month = month<10?'0'+month:month; console.log(year,month,days) this.currentYear = year; this.currentMonth = month; - this.start_date =year+'-'+month+'-01'; - this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate(); + this.queryDate = year + '-' + month; + // this.start_date =year+'-'+month+'-01'; + // this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate(); + this.start_date ='2023-01-01'; + this.end_date = '2023-12-31'; this.getProcess(); - this.getProduct(); - this.getData(); - this.getProductData(); }, methods:{ queryTypeChange(value){ @@ -188,35 +152,68 @@ getProcess(){ this.$API.mtm.process.list.req({cate:'粗加工',page:0}).then((res) => { this.processOption = res; + this.process = res[0].id; + this.processName = res[0].name; + this.getData(); }); }, - processChange(){}, - getProduct(){ - this.$API.wpm.wmaterial.list.req({count__gte:1,material__type:10,page:0}).then((res) => { - this.productOption = res; - }); + processChange() { + this.processName = this.processOption.find(item => item.id === this.process).name; + this.getData(); }, - productChange(){}, getData(){ let that = this; - let exec = that.queryType=='月'?'lineWeek':'lineMonth'; + let exec = that.queryType=='月'?'lineMonth':'lineYear'; let obj = { - query: { start_date: this.start_date, end_date: this.end_date, dept_name: "6车间" }, + query: { + end_date: that.end_date,dept_name: "6车间", + is_hidden: -1,start_date: that.start_date, + mgroup_name: that.processName,group_bys_mgroup: ", mgroup.name", + group_bys_material: "",order_bys_material: "", + select_cols_mgroup: ", mgroup.name AS 工段", + select_cols_material: "" + }, }; - that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => { - console.log('退火车间统计:',doInRes); - debugger; + //获取echarts数据 + that.$API.bi.dataset.exec.req(exec, obj).then((res) => { + console.log('获取echarts数据:', res); + if (res.data2.ds0) { + let data = res.data2.ds0; + let seriesData = [ + {value: 0, name: '合格数'}, + {value: 0, name: '条纹'}, + {value: 0, name: '气泡'}, + {value: 0, name: '断裂' }, + {value: 0, name: '气线' }, + {value: 0, name: '炸纹'}, + {value: 0, name: '结石'}, + {value: 0, name: '弯曲' }, + {value: 0, name: '偏壁'}, + {value: 0, name: '大小头'}, + {value: 0, name: '其他'}, + ]; + if (data.length > 0) { + data.forEach((item) => { + seriesData.forEach((item2) => { + item2.value += item[item2.name]; + }) + }) + } + console.log('seriesData:', seriesData); + that.option1.series[0].data = seriesData; + } }); - }, - getProductData(){ - let that = this; - let obj = { - query: { start_date: this.start_date, end_date: this.end_date, dept_name: "7车间" }, + let obj2 = { + query: { + start_date: that.start_date, end_date: that.end_date, dept_name: "6车间", + is_hidden: -1,mgroup_name: that.processName,group_bys_mgroup: ", mgroup.name", + select_cols_mgroup: ", mgroup.name AS 工段", + }, }; - let exec = that.queryType=='月'?'lineWeek':'lineMonth'; - that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => { - console.log('7生产车间统计:',doInRes); - debugger; + //获取table数据 + that.$API.bi.dataset.exec.req(exec, obj2).then((res2) => { + console.log('获取table数据:', res2.data2.ds0); + that.tableData = res2.data2.ds0; }); }, handleQuery(){ @@ -239,7 +236,6 @@ } } this.getData(); - this.getProductData(); }, handleExport(val) { this.exportLoading = true;