From dd4a1597a35e19078aa580f596418902df0f8c5f Mon Sep 17 00:00:00 2001
From: zuozhengqing <a13193816592@163.com>
Date: 星期四, 11 四月 2024 19:22:48 +0800
Subject: [PATCH] Merge branch 'master' of ssh://192.168.5.5:29418/silk/silk-web

---
 src/common/untils/dialog.js                                                 |    5 
 src/views/productManage/silkRegisterForm/addPage.vue                        |  117 ++++++---
 src/api/productManage/productRegisterForm.js                                |   14 +
 src/views/productManage/productRegisterForm/components/addProductDialog.vue |   60 ++--
 src/views/productManage/productRegisterForm/addProductRegisterPage.vue      |  443 ++++++++++++++++++++++++++++++++++++---
 5 files changed, 525 insertions(+), 114 deletions(-)

diff --git a/src/api/productManage/productRegisterForm.js b/src/api/productManage/productRegisterForm.js
index b112837..2bf95cb 100644
--- a/src/api/productManage/productRegisterForm.js
+++ b/src/api/productManage/productRegisterForm.js
@@ -31,10 +31,18 @@
     data
   })
 }
-// 鑾峰彇杞﹁締缂栧彿
+// 鍒囨崲浜у搧鐧昏琛�
+export function changeYieldRegister(data) {
+  return request({
+    url: "/api-jl/v1/fineness/changeYieldRegister",
+    method: "post",
+    data
+  })
+}
+// 鑾峰彇杞﹁締缂栧彿 鍜岀瓑绾�
 export function getWorkshopManageCar(data) {
   return request({
-    url: "/api-jl/v1/system/getWorkshopManageCar",
+    url: "/api-jl/v1/system/getCarAndLevel",
     method: "post",
     data
   })
@@ -46,4 +54,4 @@
     method: "get",
     data
   })
-}
\ No newline at end of file
+}
diff --git a/src/common/untils/dialog.js b/src/common/untils/dialog.js
index e0e29fe..ca17192 100644
--- a/src/common/untils/dialog.js
+++ b/src/common/untils/dialog.js
@@ -40,9 +40,8 @@
         // 灏嗘鏃剁殑浣嶇疆浼犲嚭鍘�
         // binding.value({x:e.pageX,y:e.pageY})
       }
-
-      document.onmouseup = function (e) {
-        console.log(e)
+      // e
+      document.onmouseup = function () {
         document.onmousemove = null
         document.onmouseup = null
       }
diff --git a/src/views/productManage/productRegisterForm/addProductRegisterPage.vue b/src/views/productManage/productRegisterForm/addProductRegisterPage.vue
index 10b98b7..b205f13 100644
--- a/src/views/productManage/productRegisterForm/addProductRegisterPage.vue
+++ b/src/views/productManage/productRegisterForm/addProductRegisterPage.vue
@@ -72,6 +72,7 @@
                     v-model="ruleForm.marketId"
                     placeholder="璇烽�夋嫨"
                     class="select-width"
+                    @change='getGroupNumber'
                   >
                     <el-option
                       v-for="item in marketList"
@@ -356,6 +357,7 @@
           style="width: 100%"
           border
           :height="'calc(100% - 0px)'"
+          :cell-style='cellStyle'
         >
           <el-table-column
             prop="carNumber"
@@ -371,6 +373,7 @@
               width="60"
               align="center"
             >
+
             </el-table-column>
             <el-table-column
               prop="pieceNumber12"
@@ -455,6 +458,9 @@
             </el-table-column>
           </el-table-column>
           <el-table-column prop="oneYield" label="鍙颁骇閲�" align="center">
+            <template slot-scope="scope">
+               {{getOneYield(scope.row)}}
+            </template>
           </el-table-column>
           <el-table-column
             prop="peopleYield"
@@ -462,13 +468,19 @@
             width="60"
             align="center"
           >
+          <template slot-scope="scope">
+               {{scope.row.peopleYield!=0?scope.row.peopleYield:''}}
+            </template>
           </el-table-column>
-          <el-table-column
+          <el-table-column  
             prop="hourYield"
             label="鍙版椂浜ч噺"
             width="60"
             align="center"
           >
+            <template slot-scope="scope">
+              {{(ruleForm.record&&scope.row.oneYield)?(scope.row.oneYield/ruleForm.record).toFixed(2):''}}
+            </template>
           </el-table-column>
           <el-table-column
             prop="personReelingdiscount"
@@ -483,6 +495,9 @@
             width="60"
             align="center"
           >
+            <template slot-scope="scope">
+               {{getallYield(scope.row,1)}}
+            </template>
           </el-table-column>
           <el-table-column
             prop="oneYield1"
@@ -490,6 +505,9 @@
             width="60"
             align="center"
           >
+            <template slot-scope="scope">
+                 {{(ruleForm.record&&scope.row.allYield1)?(scope.row.allYield1/ruleForm.record).toFixed(2):''}}
+            </template>
           </el-table-column>
           <el-table-column
             prop="reelingdiscount1"
@@ -504,6 +522,9 @@
             width="60"
             align="center"
           >
+          <template slot-scope="scope">
+               {{getallYield(scope.row,2)}} 
+            </template>
           </el-table-column>
           <el-table-column
             prop="oneYield2"
@@ -511,6 +532,9 @@
             width="60"
             align="center"
           >
+          <template slot-scope="scope">
+               {{(ruleForm.record&&scope.row.allYield2)?(scope.row.allYield2/ruleForm.record).toFixed(2):''}}
+            </template>
           </el-table-column>
           <el-table-column
             prop="reelingdiscount2"
@@ -525,6 +549,9 @@
             width="60"
             align="center"
           >
+          <template slot-scope="scope">
+               {{getallYield(scope.row,3)}} 
+            </template>
           </el-table-column>
           <el-table-column
             prop="oneYield3"
@@ -532,6 +559,9 @@
             width="60"
             align="center"
           >
+          <template slot-scope="scope">
+            {{(ruleForm.record&&scope.row.allYield3)?(scope.row.allYield3/ruleForm.record).toFixed(2):''}} 
+            </template>
           </el-table-column>
           <el-table-column
             prop="reelingdiscount3"
@@ -542,22 +572,24 @@
           </el-table-column>
         </el-table>
       </div>
+       
     </div>
     <!-- 浠櫒杩炴帴姝e父寮圭獥 -->
     <addProductDialog ref="addProductDialog" 
-    :marketList='marketList' 
-    :nameList='nameList'  
-    :form='ruleForm'
-    :specList='specList'
-    @changeForm='changeForm'
-    @changeTableInput='changeTableInput' />
-  </div>
+      :marketList='marketList' 
+      :nameList='nameList'  
+      :form='ruleForm'
+      :specList='specList'
+      @changeForm='changeForm'
+      @changeTableInput='changeTableInput' />
+    </div>
+   
 </template>
 
 <script>
 import addProductDialog from "./components/addProductDialog";
 import {
-  // getYieldRegisterInfo,
+  getYieldRegisterInfo,
   saveYieldRegister,
   getWorkshopManageCar,
   getWorkshopManageGroup,
@@ -632,6 +664,8 @@
       isAddloading: false,
       productRegisterId:null,
       productRegisterNumber:null,
+      tableDataItems:[],
+      tableDataCircles:[],
     };
   },
   mounted() {
@@ -641,40 +675,240 @@
       this.productRegisterNumber = query.number ? query.number : "";
     }
     this.getSelectDataList();
+    this.getDetailsData()
   },
   methods: {
-    changeForm(form,val){
-      if(val){
-        this.ruleForm.createTime=form.createTime
-        this.ruleForm.groupNumber=form.groupNumber
-        this.ruleForm.spec=form.spec
-        this.ruleForm.marketId=form.marketId
-        this.getGroupNumber()
+    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='';
+      if(row.pieceNumber11||row.pieceNumber12||row.pieceNumber13||row.pieceNumber14||row.pieceNumber21||row.pieceNumber22||row.pieceNumber23||row.pieceNumber24||row.pieceNumber31||row.pieceNumber32||row.pieceNumber33||row.pieceNumber34){
+        if(row.pieceNumber11){
+          string=Number(row.pieceNumber11)
+        }
+        if(row.pieceNumber12){
+          string=Number(string)+Number(row.pieceNumber12)
+        }
+        if(row.pieceNumber13){
+          string=Number(string)+Number(row.pieceNumber13)
+        }
+        if(row.pieceNumber14){
+          string=Number(string)+Number(row.pieceNumber14)
+        }
+        if(row.pieceNumber21){
+          string=Number(string)+Number(row.pieceNumber21)
+        }
+        if(row.pieceNumber22){
+          string=Number(string)+Number(row.pieceNumber22)
+        }
+        if(row.pieceNumber23){
+          string=Number(string)+Number(row.pieceNumber23)
+        }
+        if(row.pieceNumber24){
+          string=Number(string)+Number(row.pieceNumber24)
+        }
+        if(row.pieceNumber31){
+          string=Number(string)+Number(row.pieceNumber31)
+        }
+        if(row.pieceNumber32){
+          string=Number(string)+Number(row.pieceNumber32)
+        }
+        if(row.pieceNumber33){
+          string=Number(string)+Number(row.pieceNumber33)
+        }
+        if(row.pieceNumber34){
+          string=Number(string)+Number(row.pieceNumber34)
+        }
+      }
+      this.getPeopleYield(row)
+      row.oneYield=Number(string);
+      return string;
+    },
+    getPeopleYield(row){
+      let string=0
+      if(row.perList){
+        if(row.perList.length>0){
+          let carNumber=row.perList[row.perList.length-1]
+          for(let i in this.tableData){
+            for(let j in row.perList){
+              if(row.perList[j]==this.tableData[i].carNumber){
+                string=string+this.tableData[i].oneYield
+              }
+            }
+          }
+          for(let k in this.tableData){
+            if(this.tableData[k].carNumber==carNumber){
+              this.$set(this.tableData[k],'peopleYield',string)
+              break;
+            }
+          }
+        }
+      }
+    },
+    getallYield(row,val){
+      let string='';
+      if(row['pieceNumber'+val+'1']||row['pieceNumber'+val+'2']||row['pieceNumber'+val+'3']||row['pieceNumber'+val+'4']){
+        if(row['pieceNumber'+val+'1']){
+          string=Number(row['pieceNumber'+val+'1'])
+        }
+        if(row['pieceNumber'+val+'2']){
+          string=Number(string)+Number(row['pieceNumber'+val+'2'])
+        }
+        if(row['pieceNumber'+val+'3']){
+          string=Number(string)+Number(row['pieceNumber'+val+'3'])
+        }
+        if(row['pieceNumber'+val+'4']){
+          string=Number(string)+Number(row['pieceNumber'+val+'4'])
+        }
+      }
+      row['allYield'+val]=Number(string);
+      return string;
+    },
+    changeForm(form,val,data){
+      if(val){
+        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}){
+      let cellStyle;
+      if(row.isBlue){
+        let pieceNumber=this.$refs.addProductDialog.proForm.pieceNumber||1
+        let pieces=this.$refs.addProductDialog.proForm.pieces||1
+        let number=(Number(pieceNumber)-1)*4+Number(pieces)
+        if(columnIndex==number){
+          cellStyle='borderColor:#2a78fb;borderTop:1px solid #2a78fb;borderLeft:1px solid #2a78fb;'
+        }
+      }else{
+        cellStyle='borderColor:#EBEEF5;borderTop:0;borderLeft:0'
+      }
+      return cellStyle;
     },
     changeTableInput(form){
       let string=''
       for(let i in this.tableData){
         if(this.tableData[i].carNumber==form.carNumber){
           string=i
-          if(Number(form.pieceNumber)>0&&Number(form.pieces)<5){
+           if(Number(form.pieceNumber)>0&&Number(form.pieces)<5){
+            this.tableData.map((item) => {
+              item.isBlue=false
+            })
+            this.$set(this.tableData[i],'isBlue',true)
             this.$set(this.tableData[i],'pieceNumber'+form.pieceNumber+form.pieces,form.netWeight)
             break;
           }
         }
       }
-      if(form.pieceNumber==3&&form.pieces==4){
-        this.$refs.addProductDialog.proForm.carNumber=this.tableData[Number(string)+1].carNumber
-      }else{
-        if(form.pieces==4){
-          this.$refs.addProductDialog.proForm.pieceNumber=Number(form.pieceNumber)+1
+      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
         }else{
-          this.$refs.addProductDialog.proForm.pieces=Number(form.pieces)+1
+          if(form.pieces==4){
+            this.$refs.addProductDialog.proForm.pieceNumber=Number(form.pieceNumber)+1
+            this.$refs.addProductDialog.proForm.pieces=1
+          }else{
+            this.$refs.addProductDialog.proForm.pieces=Number(form.pieces)+1
+          }
         }
+        this.$refs.addProductDialog.proForm.netWeight=''
+        this.$forceUpdate();
       }
-      this.$refs.addProductDialog.proForm.netWeight=''
-      this.$forceUpdate();
     },
     getSelectDataList() {
       //杞﹂棿
@@ -702,7 +936,7 @@
         }
       });
     },
-    getGroupNumber(){
+    getGroupNumber(val){
       if(this.ruleForm.workshopId){
         //缁勫埆
         getWorkshopManageGroup({number:this.ruleForm.workshopId}).then((res) => {
@@ -716,22 +950,44 @@
               }
             }
           });
-          if(this.ruleForm.groupNumber){
+          if(this.ruleForm.groupNumber&&this.ruleForm.marketId){
+            let workshopName=''
+            for(let i in this.nameList){
+              if( this.nameList[i].number==this.ruleForm.workshopId){
+                workshopName= this.nameList[i].name
+                break;
+              }
+            }
+            let marketName=''
+            for(let i in this.marketList){
+              if( this.marketList[i].ID==this.ruleForm.marketId){
+                marketName= this.marketList[i].name
+                break;
+              }
+            }
             getWorkshopManageCar({
-              workshopNumber:this.ruleForm.workshopId+'',
+              workshopName:workshopName,
+              marketName:marketName,
               groupNumber:this.ruleForm.groupNumber,
             }).then((res) => {
               if (res.code == 200) {
                 this.tableData=[]
-                let data = JSON.parse(JSON.stringify(res.data)) || {};
+                this.ruleForm.level=res.data.level||''
+                let data = JSON.parse(JSON.stringify(res.data.car)) || [];
                if(Object.keys(data).length>0){
                 for(let i in data){
                   for(let j in data[i]){
-                    this.tableData.push({carNumber:data[i][j],perList:data[i]})
+                    this.tableData.push({carNumber:data[i][j],perList:data[i],isBlue:false})
                   }
                 }
+                this.tableData[0].isBlue=true
+               }
+              //  缂栬緫
+               if(val){
+                this.getTableEdit()
                }
                this.ruleForm.carNumber=this.tableData.length>0?this.tableData[0].carNumber:''
+               
               }
             });
           }
@@ -748,8 +1004,8 @@
     // 浠櫒杩炴帴寮圭獥
     deviceConnectClick() {
       if (this.isDeviceConnectStatus) {
-        this.$refs.addProductDialog.proForm.pieceNumber=1
-        this.$refs.addProductDialog.proForm.pieces=1
+        this.$refs.addProductDialog.proForm.pieceNumber= this.$refs.addProductDialog.proForm.pieceNumber||1
+        this.$refs.addProductDialog.proForm.pieces= this.$refs.addProductDialog.proForm.pieces||1
         this.$forceUpdate();
         this.$refs.addProductDialog.editDialogVisible = true;
       }
@@ -803,14 +1059,119 @@
           // params.workshopGroup=Number(params.workshopGroup)
           this.isAddloading = true;
           delete form.circleTwo;
-          let finenessList = JSON.parse(
-            JSON.stringify(this.tableList.tableData)
+          let circles=[]
+          let items=[]
+          let tableData = JSON.parse(
+            JSON.stringify(this.tableData)
           );
-          for (let i in finenessList) {
-            delete finenessList[i].productId;
+          form.bucketCocoonNumber=Number(form.bucketCocoonNumber)
+          form.circle=Number(form.circle)
+          form.fallingSilkBucketOne=Number(form.fallingSilkBucketOne)
+          form.fallingSilkBucketThree=Number(form.fallingSilkBucketThree)
+          form.fallingSilkBucketTwo=Number(form.fallingSilkBucketTwo)
+          form.fallingSilkCocoonNumber=Number(form.fallingSilkCocoonNumber)
+          form.groupNumber=Number(form.groupNumber)
+          form.hourYield=Number(form.hourYield)
+          form.marketId=Number(form.marketId)
+          form.record=Number(form.record)
+          form.theorySilkAmount=Number(form.theorySilkAmount)
+          form.total=Number(form.total)
+          form.vehicleSpeed=Number(form.vehicleSpeed)
+          form.workshopId	=Number(form.workshopId)
+          delete form.isfallingSilkBucketOne
+          delete form.isfallingSilkBucketThree
+          delete form.isfallingSilkBucketTwo
+          for(let i in tableData){
+            circles.push({
+              allYield:Number(tableData[i].allYield1)||0, //浜ч噺
+              carNumber:tableData[i].carNumber,
+              circle:1,//鍥炴暟
+              oneYield:Number(tableData[i].oneYield1)||0,//	鍙颁骇
+              pieceNumber:[
+                {
+                  pieceNumber:1,
+                  value:Number(tableData[i].pieceNumber11)||0
+                },
+                {
+                  pieceNumber:2,
+                  value:Number(tableData[i].pieceNumber12)||0
+                },
+                {
+                  pieceNumber:3,
+                  value:Number(tableData[i].pieceNumber13)||0
+                },
+                {
+                  pieceNumber:4,
+                  value:Number(tableData[i].pieceNumber14)||0
+                },
+              ],
+              reelingdiscount:tableData[i].reelingdiscount1||'', //缂姌
+              // yieldRegisterId:''
+            })
+            circles.push({
+              allYield:Number(tableData[i].allYield2)||0, //浜ч噺
+              carNumber:tableData[i].carNumber,
+              circle:2,//鍥炴暟
+              pieceNumber:[
+                {
+                  pieceNumber:1,
+                  value:Number(tableData[i].pieceNumber21)||0
+                },
+                {
+                  pieceNumber:2,
+                  value:Number(tableData[i].pieceNumber22)||0
+                },
+                {
+                  pieceNumber:3,
+                  value:Number(tableData[i].pieceNumber23)||0
+                },
+                {
+                  pieceNumber:4,
+                  value:Number(tableData[i].pieceNumber24)||0
+                },
+              ],
+              oneYield:Number(tableData[i].oneYield2)||0,//	鍙颁骇
+              reelingdiscount:tableData[i].reelingdiscount2||'', //缂姌
+              // yieldRegisterId:''
+            })
+            circles.push({
+              allYield:Number(tableData[i].allYield3)||0, //浜ч噺
+              carNumber:tableData[i].carNumber,
+              circle:3,//鍥炴暟
+              oneYield:Number(tableData[i].oneYield3)||0,//	鍙颁骇
+              pieceNumber:[
+                {
+                  pieceNumber:1,
+                  value:Number(tableData[i].pieceNumber31)||0
+                },
+                {
+                  pieceNumber:2,
+                  value:Number(tableData[i].pieceNumber32)||0
+                },
+                {
+                  pieceNumber:3,
+                  value:Number(tableData[i].pieceNumber33)||0
+                },
+                {
+                  pieceNumber:4,
+                  value:Number(tableData[i].pieceNumber34)||0
+                },
+              ],
+              reelingdiscount:tableData[i].reelingdiscount3||'', //缂姌
+              // yieldRegisterId:''
+            })
+            items.push({
+              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:''
+            })
           }
           let params = {
-            finenessList: finenessList,
+            circles: circles,
+            items:items,
             ...form,
           };
           // 缂栬緫
@@ -826,7 +1187,7 @@
                   type: "success",
                 });
                 this.$router.push({
-                  path: "/productManage/silkRegisterForm",
+                  path: "/productManage/productRegisterForm",
                 });
               }
               this.isAddloading = false;
@@ -851,6 +1212,12 @@
 <style lang="scss" scoped>
 .add-product-page {
   height: 100%;
+  position:relative;
+  ::v-deep .el-table .el-table__cell {
+    padding: 6px 0 !important;
+    height: 35px;
+    text-align: center;
+  }
   .top-view {
     margin: 20px 30px;
     height: 52px;
diff --git a/src/views/productManage/productRegisterForm/components/addProductDialog.vue b/src/views/productManage/productRegisterForm/components/addProductDialog.vue
index 832504d..79b65f1 100644
--- a/src/views/productManage/productRegisterForm/components/addProductDialog.vue
+++ b/src/views/productManage/productRegisterForm/components/addProductDialog.vue
@@ -4,7 +4,6 @@
     :close-on-click-modal="false"
     :visible.sync="editDialogVisible"
     width="533px"
-    append-to-body
     custom-class="add-event-dialog"
     @close="handleClose"
   >
@@ -119,7 +118,7 @@
               <span slot="label">
                 <span class="formLabel">鍑�閲�</span>
               </span>
-              <el-input v-model="proForm.netWeight"    @blur="changeTableInput" size="small"></el-input>
+              <el-input v-model="proForm.netWeight" @blur="changeTableInput" size="small"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="20">
@@ -149,15 +148,16 @@
         </el-row>
       </el-form>
     </div>
-    <div slot="footer" class="dialog-footer">
+    <!-- <div slot="footer" class="dialog-footer"> -->
       <!-- <el-button @click="handleClose" size="mini">鍙栨秷</el-button>
       <el-button type="primary" @click="onSubmit('form')" size="mini">纭畾</el-button> -->
-    </div>
+    <!-- </div> -->
   </el-dialog>
 </template>
 <script>
 import {
   getWorkshopManageGroup,
+  changeYieldRegister,
 } from "@/api/productManage/productRegisterForm.js";
 export default {
   props: { 
@@ -232,28 +232,6 @@
       deep: true,
       immediate:true,
     },
-    "form.carNumber": {
-      handler() {
-        debugger
-        this.$set(this.proForm,'carNumber',this.form.carNumber)
-      },
-      deep: true,
-      immediate:true,
-    },
-    "form.pieceNumber": {
-      handler() {
-        this.$set(this.proForm,'pieceNumber',this.form.pieceNumber)
-      },
-      deep: true,
-      immediate:true,
-    },
-    "form.pieces": {
-      handler() {
-        this.$set(this.proForm,'pieces',this.form.pieces)
-      },
-      deep: true,
-      immediate:true,
-    },
     'form.workshopId': function () {
       this.getGroupNumber()
     }
@@ -296,10 +274,30 @@
       }
     },
     changeForm(val){
-      this.$emit('changeForm',this.proForm,val)
+      if(this.proForm.createTime&&this.proForm.groupNumber&&this.proForm.marketId&&this.proForm.spec&&this.proForm.workshopId){
+        changeYieldRegister({
+          createTime: this.proForm.createTime,
+          groupNumber: this.proForm.groupNumber,
+          marketId: this.proForm.marketId,
+          spec: this.proForm.spec,
+          workshopId: this.proForm.workshopId,
+        }).then((res) => {
+          if (res.code == 200) {
+            if(res.data){
+              if(Object.keys(res.data).length>0){
+                this.$emit('changeForm',this.proForm,val,res.data)
+              }
+            }
+          }
+        });
+      }else{
+        this.$emit('changeForm',this.proForm,val,{})
+      }
     },
     changeTableInput(){
-      this.$emit('changeTableInput',this.proForm)
+      if(this.proForm.pieces&&this.proForm.carNumber&&this.proForm.pieceNumber){
+        this.$emit('changeTableInput',this.proForm)
+      }
     },
     handleClose() {
       this.editDialogVisible = false;
@@ -312,6 +310,7 @@
 };
 </script>
 <style lang="scss" scoped>
+
 .add-event-dialog {
   .formLabel {
     font-size: 18px;
@@ -320,6 +319,9 @@
   }
   .dialog-footer {
     background-color: #fff;
+  }
+  .dialog-content-box{
+    margin-top:30px;
   }
 }
 ::v-deep {
@@ -334,7 +336,7 @@
     color: #333;
     // font-weight: 700;
   }
-  .add-event-dialog .el-dialog {
+  .add-event-dialog.el-dialog {
     position: absolute;
     right: 40px;
     top: 40px;
diff --git a/src/views/productManage/silkRegisterForm/addPage.vue b/src/views/productManage/silkRegisterForm/addPage.vue
index 16d2de0..f93ce75 100644
--- a/src/views/productManage/silkRegisterForm/addPage.vue
+++ b/src/views/productManage/silkRegisterForm/addPage.vue
@@ -80,6 +80,7 @@
                 v-model="form.name"
                 placeholder="璇烽�夋嫨"
                 class="select-width"
+                @change="getGroupNumber"
               >
                 <el-option
                   v-for="item in nameList"
@@ -110,14 +111,15 @@
             <el-form-item label="缁勫埆" prop="workshopGroup" class="form-item">
               <el-select
                 v-model="form.workshopGroup"
-                placeholder="璇烽�夋嫨"
+                placeholder="璇峰厛閫夋嫨杞﹂棿"
+                no-data-text="璇峰厛閫夋嫨杞﹂棿"
                 class="select-width"
               >
                 <el-option
                   v-for="item in workshopGroupList"
-                  :key="item.ID"
-                  :label="item.name"
-                  :value="item.ID"
+                  :key="item"
+                  :label="item"
+                  :value="item"
                 >
                 </el-option>
               </el-select>
@@ -319,9 +321,17 @@
               </el-table-column>
               <el-table-column prop="finenessGradeye" label="閲庣氦" width="120">
               </el-table-column>
-              <el-table-column prop="finenessGradebig" label="澶ч噹" show-overflow-tooltip>
+              <el-table-column
+                prop="finenessGradebig"
+                label="澶ч噹"
+                show-overflow-tooltip
+              >
               </el-table-column>
-              <el-table-column prop="finenessGradeSpecial" label="鐗归噹" width="120">
+              <el-table-column
+                prop="finenessGradeSpecial"
+                label="鐗归噹"
+                width="120"
+              >
               </el-table-column>
               <el-table-column
                 prop="finenessGrade"
@@ -414,10 +424,10 @@
 </template>
 
 <script>
+// getWorkshopManageList,
 import {
   saveRegister,
   getDictList,
-  getWorkshopManageList,
   getRegisterDetails,
 } from "@/api/productManage/silkRegisterForm.js";
 import {
@@ -426,6 +436,7 @@
 } from "@/api/productManage/silkInspectForm.js";
 import pageMixin from "@/components/makepager/pager/mixin/pageMixin";
 import CommonFormTableView from "@/components/makepager/CommonFormTableView";
+import { getWorkshopManageGroup } from "@/api/productManage/productRegisterForm.js";
 export default {
   name: "silkRegisterAddPage",
   props: {},
@@ -574,10 +585,11 @@
                   JSON.stringify(response.data ? response.data : {})
                 );
                 this.form = config;
+                this.getGroupNumber()
                 this.tableList.tableData = config.finenessList
                   ? config.finenessList
                   : [];
-                  this.tableData=this.tableList.tableData
+                this.tableData = this.tableList.tableData;
               }
             }
           );
@@ -615,27 +627,25 @@
               this.form.finishDate = config.finenessRegister.finishDate;
               this.form.circle = config.finenessRegister.circle;
               this.getTableHeader();
-              let arr= response.data.items
-                ? response.data.items
-                : [];
-                for(let i in arr){
-                    let round=arr[i].finenessRoundingItems
-                    if(arr[i].finenessGrade){
-                        if(arr[i].finenessGrade.indexOf('閲庣氦')>-1){
-                            arr[i].finenessGradeye=arr[i].finenessGrade
-                        }else if(arr[i].finenessGrade.indexOf('澶ч噹')>-1){
-                            arr[i].finenessGradebig=arr[i].finenessGrade
-                        }else if(arr[i].finenessGrade.indexOf('鐗归噹')>-1){
-                            arr[i].finenessGradeSpecial=arr[i].finenessGrade
-                        }
-                    }
-                    if(round){
-                        for(let j in round){
-                            arr[i][round[j].fineness]=round[j].quantity
-                        }
-                    }
+              let arr = response.data.items ? response.data.items : [];
+              for (let i in arr) {
+                let round = arr[i].finenessRoundingItems;
+                if (arr[i].finenessGrade) {
+                  if (arr[i].finenessGrade.indexOf("閲庣氦") > -1) {
+                    arr[i].finenessGradeye = arr[i].finenessGrade;
+                  } else if (arr[i].finenessGrade.indexOf("澶ч噹") > -1) {
+                    arr[i].finenessGradebig = arr[i].finenessGrade;
+                  } else if (arr[i].finenessGrade.indexOf("鐗归噹") > -1) {
+                    arr[i].finenessGradeSpecial = arr[i].finenessGrade;
+                  }
                 }
-              this.tableTwoList.tableInfomation =arr;
+                if (round) {
+                  for (let j in round) {
+                    arr[i][round[j].fineness] = round[j].quantity;
+                  }
+                }
+              }
+              this.tableTwoList.tableInfomation = arr;
             }
           });
         }
@@ -711,11 +721,11 @@
         }
       });
       //缁勫埆
-      getWorkshopManageList().then((res) => {
-        if (res.code == 200) {
-          this.workshopGroupList = res.data || [];
-        }
-      });
+      // getWorkshopManageList().then((res) => {
+      //   if (res.code == 200) {
+      //     this.workshopGroupList = res.data || [];
+      //   }
+      // });
       //搴勫彛
       getDictList({
         dictType: 0,
@@ -724,6 +734,31 @@
           this.marketList = res.data || [];
         }
       });
+    },
+    getGroupNumber() {
+      if (this.form.name) {
+        //缁勫埆
+        let number = "";
+        for (let i in this.nameList) {
+          if (this.nameList[i].name == this.form.name) {
+            number = this.nameList[i].number;
+            break;
+          }
+        }
+        getWorkshopManageGroup({ number: number }).then((res) => {
+          if (res.code == 200) {
+            this.workshopGroupList = [];
+            let workshopGroupList = res.data || {};
+            if (Object.keys(workshopGroupList).length > 0) {
+              for (let i in workshopGroupList) {
+                this.workshopGroupList.push(workshopGroupList[i]);
+              }
+            }
+          }
+        });
+      } else {
+        this.workshopGroupList = [];
+      }
     },
     inputStart() {
       this.form.circleTwo = this.form.circle + "-" + this.form.totalCircle;
@@ -800,13 +835,13 @@
             sum: "",
           },
         ];
-      }else{
-        this.form.measureFineness=''
-        this.form.twiceChange=''
-        this.form.cleanliness=''
-        this.form.purity=''
-        this.form.marketProcessOrderNumber=''
-        this.form.inspector=''
+      } else {
+        this.form.measureFineness = "";
+        this.form.twiceChange = "";
+        this.form.cleanliness = "";
+        this.form.purity = "";
+        this.form.marketProcessOrderNumber = "";
+        this.form.inspector = "";
       }
     },
     // 淇濆瓨
@@ -868,7 +903,7 @@
                     message: "淇濆瓨鎴愬姛锛�",
                     type: "success",
                   });
-                  this.getDetailsData()
+                  this.getDetailsData();
                 }
                 this.isAddloading = false;
               })

--
Gitblit v1.8.0