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 |  267 ++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 212 insertions(+), 55 deletions(-)

diff --git a/src/views/productManage/productRegisterForm/components/addProductDialog.vue b/src/views/productManage/productRegisterForm/components/addProductDialog.vue
index 9bed2ef..3bc3d68 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"
   >
@@ -19,49 +18,91 @@
       >
         <el-row>
           <el-col :span="11">
-            <el-form-item label="鏃ユ湡" prop="date">
+            <el-form-item label="鏃ユ湡" prop="createTime">
               <el-date-picker
                 type="date"
                 placeholder="骞�/鏈�/鏃�"
-                v-model="proForm.date"
+                v-model="proForm.createTime"
                 size="small"
                 style="width: 100%"
               ></el-date-picker>
             </el-form-item>
           </el-col>
           <el-col :span="9">
-            <el-form-item label="缁勫埆" prop="group">
-              <el-select v-model="proForm.group" placeholder="璇烽�夋嫨缁勫埆" size="small">
-                <el-option v-for="item in groupOptions" :key="item.id" :label="item.value" :value="item.id"></el-option>
+            <el-form-item label="缁勫埆" prop="groupNumber">
+              <el-select
+                v-model="proForm.groupNumber"
+                placeholder="璇峰厛閫夋嫨杞﹂棿"
+                no-data-text="璇峰厛閫夋嫨杞﹂棿"
+                class="select-width"
+                @change="getGroupNumber"
+              >
+                <el-option
+                  v-for="item in workshopGroupList"
+                  :key="item"
+                  :label="item"
+                  :value="item"
+                >
+                </el-option>
               </el-select>
             </el-form-item>
           </el-col>
           <el-col :span="11">
-            <el-form-item label="杞﹂棿" prop="workshop">
-              <el-select v-model="proForm.workshop" placeholder="璇烽�夋嫨杞﹂棿" size="small">
-                <el-option label="杞﹂棿涓�" value="杞﹂棿涓�"></el-option>
-                <el-option label="杞﹂棿浜�" value="杞﹂棿浜�"></el-option>
-                <el-option label="杞﹂棿涓�" value="杞﹂棿涓�"></el-option>
-                <el-option label="杞﹂棿鍥�" value="杞﹂棿鍥�"></el-option>
+            <el-form-item label="杞﹂棿" prop="workshopNumber">
+              <el-select
+                v-model="proForm.workshopNumber"
+                placeholder="璇烽�夋嫨"
+                class="select-width"
+                @change="getGroupNumber"
+              >
+                <el-option
+                  v-for="item in nameList"
+                  :key="item.number"
+                  :label="item.name"
+                  :value="item.number"
+                >
+                </el-option>
               </el-select>
             </el-form-item>
           </el-col>
           <el-col :span="9">
             <el-form-item label="瑙勬牸" prop="spec">
-              <el-input v-model="proForm.spec" size="small"></el-input>
+              <el-select
+                v-model="proForm.spec"
+                placeholder="璇烽�夋嫨"
+                class="select-width"
+              >
+                <el-option
+                  v-for="item in specList"
+                  :key="item.ID"
+                  :label="item.name"
+                  :value="item.name"
+                >
+                </el-option>
+              </el-select>
             </el-form-item>
           </el-col>
           <el-col :span="20">
-            <el-form-item label="搴勫彛" prop="lots">
-              <el-select v-model="proForm.lots" placeholder="璇烽�夋嫨搴勫彛" size="small" style="width: 100%">
-                <el-option label="搴勫彛涓�" value="搴勫彛涓�"></el-option>
-                <el-option label="搴勫彛浜�" value="搴勫彛浜�"></el-option>
+            <el-form-item label="搴勫彛" prop="marketId">
+              <el-select
+                v-model="proForm.marketId"
+                placeholder="璇烽�夋嫨搴勫彛"
+                size="small"
+                style="width: 100%"
+              >
+                <el-option
+                  v-for="item in marketList"
+                  :key="item.ID"
+                  :label="item.name"
+                  :value="item.ID"
+                >
+                </el-option>
               </el-select>
             </el-form-item>
           </el-col>
           <el-col :span="4">
             <el-form-item label="" label-width="20px">
-              <el-button type="primary" size="small">鍒囨崲</el-button>
+              <el-button type="primary" @click='changeForm(true)' size="small">鍒囨崲</el-button>
             </el-form-item>
           </el-col>
           <el-col :span="20">
@@ -77,23 +118,23 @@
               <span slot="label">
                 <span class="formLabel">鍑�閲�</span>
               </span>
-              <el-input v-model="proForm.netWeight" 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">
-            <el-form-item prop="carNum" label-width="80px">
+            <el-form-item prop="carNumber" label-width="80px">
               <span slot="label">
                 <span class="formLabel">杞﹀彿</span>
               </span>
-              <el-input v-model="proForm.carNum" size="small"></el-input>
+              <el-input v-model="proForm.carNumber"  @blur="changeTableInput" size="small"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="20">
-            <el-form-item prop="numTimes" label-width="80px">
+            <el-form-item prop="pieceNumber" label-width="80px">
               <span slot="label">
                 <span class="formLabel">鍥炴暟</span>
               </span>
-              <el-input v-model="proForm.numTimes" size="small"></el-input>
+              <el-input v-model.number="proForm.pieceNumber"  @blur="changeTableInput" size="small"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="20">
@@ -101,65 +142,181 @@
               <span slot="label">
                 <span class="formLabel">鐗囨暟</span>
               </span>
-              <el-input v-model="proForm.pieces" size="small"></el-input>
+              <el-input v-model.number="proForm.pieces"  @blur="changeTableInput" size="small"></el-input>
             </el-form-item>
           </el-col>
         </el-row>
       </el-form>
     </div>
-    <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 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> -->
   </el-dialog>
 </template>
 <script>
+import {
+  getWorkshopManageGroup,
+  changeYieldRegister,
+} from "@/api/productManage/productRegisterForm.js";
 export default {
-  props: {},
+  props: { 
+    nameList: {
+      type: Array,
+      default: () => {
+        return [];
+      },
+    },
+    marketList: {
+      type: Array,
+      default: () => {
+        return [];
+      },
+    },
+    specList: {
+      type: Array,
+      default: () => {
+        return [];
+      },
+    },
+    form: {
+      type: Object,
+      default: () => {
+        return {};
+      },
+    },
+  },
   components: {},
   data() {
     return {
       editDialogVisible: false,
-      proForm: {},
-      rules: {
-        date: [{ required: true, message: "璇烽�夋嫨鏃ユ湡", trigger: "change" }],
-        number: [{ required: true, message: "璇疯緭鍏ョ紪鍙�", trigger: "blur" }],
-        workshop: [{ type: "date", required: true, message: "璇烽�夋嫨杞﹂棿", trigger: "change" }]
+      workshopGroupList:[],
+      proForm: {
+        createTime: "",
+        groupNumber: "",
+        workshopNumber: "",
+        spec: "",
+        marketId: "",
+        tareWeight: "",
+        netWeight: "",
+        carNumber: "",
+        pieceNumber: "",
+        pieces: "",
       },
-      groupOptions: [
-        { id: 1, value: 1 },
-        { id: 2, value: 2 },
-        { id: 3, value: 3 },
-        { id: 4, value: 4 },
-        { id: 5, value: 5 },
-        { id: 6, value: 6 },
-        { id: 7, value: 7 },
-        { id: 8, value: 8 },
-        { id: 9, value: 9 }
-      ]
+      rules: {
+        createTime: [
+          { required: true, message: "璇烽�夋嫨鐢熶骇鏃ユ湡", trigger:  ["change", "blur"] },
+        ],
+        marketId:  [
+          { required: true, message: "璇烽�夋嫨", trigger:  ["change", "blur"] },
+        ],
+        workshopNumber:  [
+          { required: true, message: "璇烽�夋嫨", trigger:  ["change", "blur"] },
+        ],
+        groupNumber:  [
+          { required: true, message: "璇烽�夋嫨", trigger:  ["change", "blur"] },
+        ],
+        spec:  [
+          { required: true, message: "璇烽�夋嫨", trigger:  ["change", "blur"] },
+        ],
+      },
+    };
+  },
+  created() {
+  },
+  watch:{
+    "editDialogVisible": {
+      handler() {
+        this.getInfo()
+      },
+      deep: true,
+      immediate:true,
+    },
+    'form.workshopNumber': function () {
+      this.getGroupNumber()
     }
   },
-  created() {},
   methods: {
+    getInfo(){
+        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.workshopNumber){
+        //缁勫埆
+        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])
+                }
+              }
+            }
+          });
+      }else{
+        this.workshopGroupList =[]
+      }
+    },
+    changeForm(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.pieces&&this.proForm.carNumber&&this.proForm.pieceNumber){
+        this.$emit('changeTableInput',this.proForm)
+      }
+    },
     handleClose() {
-      this.editDialogVisible = false
+      this.editDialogVisible = false;
     },
     // 纭畾
     onSubmit(form) {
-      console.log(form)
-    }
-  }
-}
+      console.log(form);
+    },
+  },
+};
 </script>
 <style lang="scss" scoped>
+
 .add-event-dialog {
   .formLabel {
-    font-size: 20px;
-    font-weight: 700;
+    font-size: 18px;
+    // font-weight: 600;
     color: #333;
   }
   .dialog-footer {
     background-color: #fff;
+  }
+  .dialog-content-box{
+    margin-top:30px;
   }
 }
 ::v-deep {
@@ -172,9 +329,9 @@
   .el-form-item__label {
     font-size: 16px;
     color: #333;
-    font-weight: 700;
+    // font-weight: 700;
   }
-  .add-event-dialog .el-dialog {
+  .add-event-dialog.el-dialog {
     position: absolute;
     right: 40px;
     top: 40px;

--
Gitblit v1.8.0