haoxuan
2024-04-12 72a98a10c368a32140a9848a48f69690e59ac583
src/views/productManage/productRegisterForm/components/addProductDialog.vue
@@ -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" 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: { 
@@ -224,30 +225,9 @@
  created() {
  },
  watch:{
    "form": {
    "editDialogVisible": {
      handler() {
        this.getInfo()
      },
      deep: true,
      immediate:true,
    },
    "form.carNumber": {
      handler() {
        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,
@@ -258,17 +238,13 @@
  },
  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.workshopId=this.form.workshopId
        this.proForm.spec=this.form.spec
        this.proForm.marketId=this.form.marketId
        if(!this.proForm.carNumber){
          this.proForm.carNumber=this.form.carNumber
        }
        this.$forceUpdate();
    },
@@ -286,18 +262,35 @@
              }
            }
          });
          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.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;