From 082b572b91abd0d5ae8e409714553130448aa6d1 Mon Sep 17 00:00:00 2001
From: 张涛 <“2538313560@qq.com”>
Date: 星期五, 30 八月 2024 17:25:44 +0800
Subject: [PATCH] fix:薪资调整

---
 src/views/productManage/productRegisterForm/components/addProductDialog.vue |   64 +++++++++++++++++++------------
 1 files changed, 39 insertions(+), 25 deletions(-)

diff --git a/src/views/productManage/productRegisterForm/components/addProductDialog.vue b/src/views/productManage/productRegisterForm/components/addProductDialog.vue
index c74465d..3bc3d68 100644
--- a/src/views/productManage/productRegisterForm/components/addProductDialog.vue
+++ b/src/views/productManage/productRegisterForm/components/addProductDialog.vue
@@ -48,9 +48,9 @@
             </el-form-item>
           </el-col>
           <el-col :span="11">
-            <el-form-item label="杞﹂棿" prop="workshopId">
+            <el-form-item label="杞﹂棿" prop="workshopNumber">
               <el-select
-                v-model="proForm.workshopId"
+                v-model="proForm.workshopNumber"
                 placeholder="璇烽�夋嫨"
                 class="select-width"
                 @change="getGroupNumber"
@@ -118,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" @keypress.enter.native="changeTableInput" size="small"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="20">
@@ -157,6 +157,7 @@
 <script>
 import {
   getWorkshopManageGroup,
+  changeYieldRegister,
 } from "@/api/productManage/productRegisterForm.js";
 export default {
   props: { 
@@ -193,7 +194,7 @@
       proForm: {
         createTime: "",
         groupNumber: "",
-        workshopId: "",
+        workshopNumber: "",
         spec: "",
         marketId: "",
         tareWeight: "",
@@ -209,7 +210,7 @@
         marketId:  [
           { required: true, message: "璇烽�夋嫨", trigger:  ["change", "blur"] },
         ],
-        workshopId:  [
+        workshopNumber:  [
           { required: true, message: "璇烽�夋嫨", trigger:  ["change", "blur"] },
         ],
         groupNumber:  [
@@ -224,40 +225,38 @@
   created() {
   },
   watch:{
-    "form": {
+    "editDialogVisible": {
       handler() {
         this.getInfo()
       },
       deep: true,
       immediate:true,
     },
-    'form.workshopId': function () {
+    'form.workshopNumber': function () {
       this.getGroupNumber()
     }
   },
   methods: {
     getInfo(){
-      this.proForm={
-          createTime: this.form.createTime,
-          groupNumber: this.form.groupNumber,
-          workshopId: this.form.workshopId,
-          spec: this.form.spec,
-          marketId: this.form.marketId,
-          tareWeight: "",
-          netWeight: "",
-          carNumber: this.form.carNumber,
-          pieceNumber: this.form.pieceNumber,
-          pieces: this.form.pieces,
+        this.proForm.createTime=this.form.createTime
+        this.proForm.groupNumber=this.form.groupNumber
+        this.proForm.workshopNumber=this.form.workshopNumber
+        this.proForm.spec=this.form.spec
+        this.proForm.marketId=this.form.marketId
+        if(!this.proForm.carNumber){
+          this.proForm.carNumber=this.form.carNumber
         }
         this.$forceUpdate();
     },
     getGroupNumber(){
-      if(this.proForm.workshopId){
+      if(this.proForm.workshopNumber){
         //缁勫埆
-        getWorkshopManageGroup({number:this.proForm.workshopId}).then((res) => {
+        getWorkshopManageGroup({number:this.proForm.workshopNumber}).then((res) => {
            if (res.code == 200) {
               this.workshopGroupList=[]
               let workshopGroupList = res.data || {};
+              this.workshopGroupList=[]
+              //this.ruleForm.groupNumber=''
               if(Object.keys(workshopGroupList).length>0){
                 for(let i in workshopGroupList){
                   this.workshopGroupList.push(workshopGroupList[i])
@@ -265,18 +264,33 @@
               }
             }
           });
-          if(this.proForm.groupNumber){
-            this.changeForm()
-          }
       }else{
         this.workshopGroupList =[]
       }
     },
     changeForm(val){
-      this.$emit('changeForm',this.proForm,val)
+      if(this.editDialogVisible&&this.proForm.createTime&&this.proForm.groupNumber&&this.proForm.marketId&&this.proForm.spec&&this.proForm.workshopNumber){
+        changeYieldRegister({
+          createTime: this.proForm.createTime,
+          groupNumber: this.proForm.groupNumber,
+          marketId: this.proForm.marketId,
+          spec: this.proForm.spec,
+          workshopNumber: this.proForm.workshopNumber,
+        }).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(){
-      if(this.proForm.netWeight&&this.proForm.pieces&&this.proForm.carNumber&&this.proForm.pieceNumber){
+      if(this.proForm.pieces&&this.proForm.carNumber&&this.proForm.pieceNumber){
         this.$emit('changeTableInput',this.proForm)
       }
     },

--
Gitblit v1.8.0