From b075c9fff2a2daa0e94fed7f2bc332346354fc17 Mon Sep 17 00:00:00 2001 From: haoxuan <haoxuan> Date: 星期五, 12 四月 2024 15:35:27 +0800 Subject: [PATCH] 手动修改连接设备的回数和片数自动定位到对应单元格的逻辑处理+落丝桶数的3项勾选了则必填否则非必填 --- src/views/productManage/productRegisterForm/addProductRegisterPage.vue | 108 ++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 72 insertions(+), 36 deletions(-) diff --git a/src/views/productManage/productRegisterForm/addProductRegisterPage.vue b/src/views/productManage/productRegisterForm/addProductRegisterPage.vue index b205f13..ca339fe 100644 --- a/src/views/productManage/productRegisterForm/addProductRegisterPage.vue +++ b/src/views/productManage/productRegisterForm/addProductRegisterPage.vue @@ -356,6 +356,7 @@ :data="tableData" style="width: 100%" border + v-if='tableShow' :height="'calc(100% - 0px)'" :cell-style='cellStyle' > @@ -479,7 +480,7 @@ align="center" > <template slot-scope="scope"> - {{(ruleForm.record&&scope.row.oneYield)?(scope.row.oneYield/ruleForm.record).toFixed(2):''}} + {{(ruleForm.record&&ruleForm.record!=0&&scope.row.oneYield)?(scope.row.oneYield/ruleForm.record).toFixed(2):''}} </template> </el-table-column> <el-table-column @@ -506,7 +507,7 @@ align="center" > <template slot-scope="scope"> - {{(ruleForm.record&&scope.row.allYield1)?(scope.row.allYield1/ruleForm.record).toFixed(2):''}} + {{(ruleForm.record&&ruleForm.record!=0&&scope.row.allYield1)?(scope.row.allYield1/ruleForm.record).toFixed(2):''}} </template> </el-table-column> <el-table-column @@ -533,7 +534,7 @@ align="center" > <template slot-scope="scope"> - {{(ruleForm.record&&scope.row.allYield2)?(scope.row.allYield2/ruleForm.record).toFixed(2):''}} + {{(ruleForm.record&&ruleForm.record!=0&&scope.row.allYield2)?(scope.row.allYield2/ruleForm.record).toFixed(2):''}} </template> </el-table-column> <el-table-column @@ -560,7 +561,7 @@ align="center" > <template slot-scope="scope"> - {{(ruleForm.record&&scope.row.allYield3)?(scope.row.allYield3/ruleForm.record).toFixed(2):''}} + {{(ruleForm.record&&ruleForm.record!=0&&scope.row.allYield3)?(scope.row.allYield3/ruleForm.record).toFixed(2):''}} </template> </el-table-column> <el-table-column @@ -666,6 +667,8 @@ productRegisterNumber:null, tableDataItems:[], tableDataCircles:[], + yieldRegisterId:'', + tableShow:true, }; }, mounted() { @@ -678,7 +681,7 @@ this.getDetailsData() }, methods: { - getDetailsData(){ + async getDetailsData(){ this.ruleForm = { number: "", record: "", @@ -712,13 +715,14 @@ hourYield: "", }; if (this.productRegisterNumber) { - getYieldRegisterInfo({ number:this.productRegisterNumber }).then( + await getYieldRegisterInfo({ number:this.productRegisterNumber }).then( (response) => { if (response.code === 200) { let config = JSON.parse( JSON.stringify(response.data ? response.data : {}) ); this.ruleForm = config; + this.$set(this.ruleForm,'workshopId',this.ruleForm.workshopId+'') this.tableDataItems=config.items ? config.items : []; @@ -732,13 +736,29 @@ } }, getTableEdit(){ - this.tableData=this.tableDataItems - if( this.tableDataCircles.length>0){ + if(this.tableData.length>0){ + for(let i in this.tableData){ + if(this.tableDataItems.length>0){ + for(let j in this.tableDataItems){ + if(this.tableData[i].carNumber==this.tableDataItems[j].carNumber){ + this.tableData[i]={ + perList:this.tableData[i].perList, + isBlue:this.tableData[i].isBlue, + ...this.tableDataItems[j], + } + } + } + } + + } + } + this.yieldRegisterId=this.tableDataItems.length>0?this.tableDataItems[0].yieldRegisterId:"" + if(this.tableDataCircles.length>0){ for(let i in this.tableData){ for(let j in this.tableDataCircles){ if(this.tableDataCircles[j].carNumber==this.tableData[i].carNumber){ let circle=this.tableDataCircles[j].circle - let pieceNumberList=this.tableDataCircles[j].pieceNumber||[] + let pieceNumberList=this.tableDataCircles[j].pieceNumbers||[] this.tableData[i]['allYield'+circle]=this.tableDataCircles[j]['allYield'+circle] this.tableData[i]['oneYield'+circle]=this.tableDataCircles[j]['oneYield'+circle] this.tableData[i]['reelingdiscount'+circle]=this.tableDataCircles[j]['reelingdiscount'+circle] @@ -747,11 +767,11 @@ this.tableData[i]['pieceNumber'+circle+pieceNumberList[k].pieceNumber] } } - this.tableData[i] } } } } + this.ruleForm.carNumber=this.tableData.length>0?this.tableData[0].carNumber:'' }, // 琛ㄦ牸鐨勮绠楅棶棰� getOneYield(row){ @@ -845,6 +865,7 @@ JSON.stringify(data ? data : {}) ); this.ruleForm = config; + this.$set(this.ruleForm,'workshopId',this.ruleForm.workshopId+'') this.tableDataItems=config.items ? config.items : []; @@ -858,7 +879,6 @@ number:data.number, } }); - this.getGroupNumber(true) } } }, @@ -893,11 +913,18 @@ } if(form.netWeight){ if(form.pieceNumber==3&&form.pieces==4){ - this.$refs.addProductDialog.proForm.carNumber=this.tableData[Number(string)+1].carNumber - this.$set(this.tableData[Number(string)],'isBlue',false) - this.$set(this.tableData[Number(string+1)],'isBlue',true) - this.$refs.addProductDialog.proForm.pieceNumber=1 - this.$refs.addProductDialog.proForm.pieces=1 + if(Number(string)+1<=this.tableData.length){ + this.$refs.addProductDialog.proForm.carNumber=this.tableData[Number(string)+1].carNumber + this.$refs.addProductDialog.proForm.pieceNumber=1 + this.$refs.addProductDialog.proForm.pieces=1 + this.$set(this.tableData[Number(string)+1],'isBlue',true) + this.$set(this.tableData[Number(string)],'isBlue',false) + this.tableShow=false; + this.$nextTick(()=>{ + this.tableShow=true; + this.$forceUpdate(); + }) + } }else{ if(form.pieces==4){ this.$refs.addProductDialog.proForm.pieceNumber=Number(form.pieceNumber)+1 @@ -917,6 +944,7 @@ }).then((res) => { if (res.code == 200) { this.nameList = res.data || []; + this.$set(this.ruleForm,'workshopId',this.ruleForm.workshopId+'') } }); //瑙勬牸 @@ -947,6 +975,7 @@ for(let i in workshopGroupList){ this.workshopGroupList.push(workshopGroupList[i]) } + this.$set(this.ruleForm,'groupNumber',this.ruleForm.groupNumber) } } }); @@ -982,12 +1011,12 @@ } this.tableData[0].isBlue=true } + this.ruleForm.carNumber=this.tableData.length>0?this.tableData[0].carNumber:'' + // 缂栬緫 if(val){ this.getTableEdit() } - this.ruleForm.carNumber=this.tableData.length>0?this.tableData[0].carNumber:'' - } }); } @@ -1081,13 +1110,14 @@ delete form.isfallingSilkBucketOne delete form.isfallingSilkBucketThree delete form.isfallingSilkBucketTwo + debugger for(let i in tableData){ - circles.push({ + let listItems1={ allYield:Number(tableData[i].allYield1)||0, //浜ч噺 carNumber:tableData[i].carNumber, circle:1,//鍥炴暟 oneYield:Number(tableData[i].oneYield1)||0,// 鍙颁骇 - pieceNumber:[ + pieceNumbers:[ { pieceNumber:1, value:Number(tableData[i].pieceNumber11)||0 @@ -1106,13 +1136,12 @@ }, ], reelingdiscount:tableData[i].reelingdiscount1||'', //缂姌 - // yieldRegisterId:'' - }) - circles.push({ + } + let listItems2={ allYield:Number(tableData[i].allYield2)||0, //浜ч噺 carNumber:tableData[i].carNumber, circle:2,//鍥炴暟 - pieceNumber:[ + pieceNumbers:[ { pieceNumber:1, value:Number(tableData[i].pieceNumber21)||0 @@ -1132,14 +1161,13 @@ ], oneYield:Number(tableData[i].oneYield2)||0,// 鍙颁骇 reelingdiscount:tableData[i].reelingdiscount2||'', //缂姌 - // yieldRegisterId:'' - }) - circles.push({ + } + let listItems3={ allYield:Number(tableData[i].allYield3)||0, //浜ч噺 carNumber:tableData[i].carNumber, circle:3,//鍥炴暟 oneYield:Number(tableData[i].oneYield3)||0,// 鍙颁骇 - pieceNumber:[ + pieceNumbers:[ { pieceNumber:1, value:Number(tableData[i].pieceNumber31)||0 @@ -1159,25 +1187,33 @@ ], reelingdiscount:tableData[i].reelingdiscount3||'', //缂姌 // yieldRegisterId:'' - }) - items.push({ + } + let listItems4={ hourYield:Number(tableData[i].hourYield)||0, carNumber:tableData[i].carNumber, oneYield:Number(tableData[i].oneYield)||0, peopleYield:Number(tableData[i].peopleYield)||0, personReelingdiscount:tableData[i].personReelingdiscount||'', // yieldRegisterId:'' - }) + } + if(this.yieldRegisterId){ + listItems1.yieldRegisterId=this.yieldRegisterId + listItems2.yieldRegisterId=this.yieldRegisterId + listItems3.yieldRegisterId=this.yieldRegisterId + listItems4.yieldRegisterId=this.yieldRegisterId + } + circles.push(listItems1) + circles.push(listItems2) + circles.push(listItems3) + items.push(listItems4) } + console.log(circles,'circles') let params = { + ...form, circles: circles, items:items, - ...form, }; - // 缂栬緫 - if (this.productRegisterId) { - params.id = this.ruleForm.id ? this.ruleForm.id : Number(this.productRegisterId); - } + console.log(params,'===params111') saveYieldRegister(params) .then((res) => { if (res.code == 200) { -- Gitblit v1.8.0