From aa59eac0cd169f5fcf7e16ab4d5c34c2baa1bd84 Mon Sep 17 00:00:00 2001 From: haoxuan <haoxuan> Date: 星期四, 11 四月 2024 18:55:21 +0800 Subject: [PATCH] 循环回数对应的片数组合成对应的字段赋值到单元格 --- src/views/productManage/productRegisterForm/addProductRegisterPage.vue | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 106 insertions(+), 9 deletions(-) diff --git a/src/views/productManage/productRegisterForm/addProductRegisterPage.vue b/src/views/productManage/productRegisterForm/addProductRegisterPage.vue index b1d310b..b205f13 100644 --- a/src/views/productManage/productRegisterForm/addProductRegisterPage.vue +++ b/src/views/productManage/productRegisterForm/addProductRegisterPage.vue @@ -469,7 +469,7 @@ align="center" > <template slot-scope="scope"> - {{scope.row.peopleYield}} + {{scope.row.peopleYield!=0?scope.row.peopleYield:''}} </template> </el-table-column> <el-table-column @@ -589,7 +589,7 @@ <script> import addProductDialog from "./components/addProductDialog"; import { - // getYieldRegisterInfo, + getYieldRegisterInfo, saveYieldRegister, getWorkshopManageCar, getWorkshopManageGroup, @@ -664,6 +664,8 @@ isAddloading: false, productRegisterId:null, productRegisterNumber:null, + tableDataItems:[], + tableDataCircles:[], }; }, mounted() { @@ -673,8 +675,84 @@ this.productRegisterNumber = query.number ? query.number : ""; } this.getSelectDataList(); + this.getDetailsData() }, methods: { + getDetailsData(){ + this.ruleForm = { + number: "", + record: "", + createTime: "", + circle: "", + marketId: "", + fallingSilkCocoonNumber: "", + workshopId: "", + bucketCocoonNumber: "", + groupNumber: "", + vehicleSpeed: "", + spec: "", + timeYi: "", + jieZhuang: "", + timeJia: "", + level: "", + groupReelingdiscount: "", + fallingSilkBucket: "", + fallingSilkBucketOne: "", + isfallingSilkBucketOne: "", + fallingSilkBucketTwo: "", + isfallingSilkBucketTwo: "", + fallingSilkBucketThree: "", + isfallingSilkBucketThree: "", + back: "", + oneBack: "", + twoBack: "", + threeBack: "", + theorySilkAmount: "", + total: "", + hourYield: "", + }; + if (this.productRegisterNumber) { + getYieldRegisterInfo({ number:this.productRegisterNumber }).then( + (response) => { + if (response.code === 200) { + let config = JSON.parse( + JSON.stringify(response.data ? response.data : {}) + ); + this.ruleForm = config; + this.tableDataItems=config.items + ? config.items + : []; + this.tableDataCircles=config.circles + ? config.circles + : []; + this.getGroupNumber(true) + } + } + ); + } + }, + getTableEdit(){ + this.tableData=this.tableDataItems + 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||[] + 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] + if(pieceNumberList.length>0){ + for(let k in pieceNumberList){ + this.tableData[i]['pieceNumber'+circle+pieceNumberList[k].pieceNumber] + } + } + this.tableData[i] + } + } + } + } + }, // 琛ㄦ牸鐨勮绠楅棶棰� getOneYield(row){ let string=''; @@ -760,13 +838,28 @@ row['allYield'+val]=Number(string); return string; }, - changeForm(form,val){ + changeForm(form,val,data){ if(val){ - this.ruleForm.createTime=form.createTime - this.ruleForm.groupNumber=form.groupNumber - this.ruleForm.spec=form.spec - this.ruleForm.marketId=form.marketId - this.getGroupNumber() + if(Object.keys(data).length>0){ + let config = JSON.parse( + JSON.stringify(data ? data : {}) + ); + this.ruleForm = config; + this.tableDataItems=config.items + ? config.items + : []; + this.tableDataCircles=config.circles + ? config.circles + : []; + this.$router.push({ + name:'addProductRegisterPage', + query:{ + id:data.id, + number:data.number, + } + }); + this.getGroupNumber(true) + } } }, cellStyle({row,columnIndex}){ @@ -843,7 +936,7 @@ } }); }, - getGroupNumber(){ + getGroupNumber(val){ if(this.ruleForm.workshopId){ //缁勫埆 getWorkshopManageGroup({number:this.ruleForm.workshopId}).then((res) => { @@ -889,6 +982,10 @@ } this.tableData[0].isBlue=true } + // 缂栬緫 + if(val){ + this.getTableEdit() + } this.ruleForm.carNumber=this.tableData.length>0?this.tableData[0].carNumber:'' } -- Gitblit v1.8.0