haoxuan
2024-05-07 1cd64a26daed3e0eb7b4ccf74e50267d79eaef09
src/views/productManage/productRegisterForm/addProductRegisterPage.vue
@@ -91,9 +91,9 @@
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item label="车间" prop="workshopId">
                <el-form-item label="车间" prop="workshopNumber">
                  <el-select
                    v-model="ruleForm.workshopId"
                    v-model="ruleForm.workshopNumber"
                    placeholder="请选择"
                    class="select-width"
                    @change='getGroupNumber'
@@ -124,7 +124,7 @@
                    placeholder="请先选择车间"
                    no-data-text='请先选择车间'
                    class="select-width"
                    @change='getGroupNumber'
                    @change="getGroupNumber(false,'groupNumber')"
                  >
                    <el-option
                      v-for="item in workshopGroupList"
@@ -217,7 +217,7 @@
                        prop="fallingSilkBucketOne"
                        :rules="[
                          {
                            required: ruleForm.isfallingSilkBucketOne,
                            required: ruleForm.selectOne,
                            message: '请填写',
                            trigger: 'change',
                          },
@@ -230,7 +230,7 @@
                        ></el-input>
                      </el-form-item>
                      <el-checkbox
                        v-model="ruleForm.isfallingSilkBucketOne"
                        v-model="ruleForm.selectOne"
                      ></el-checkbox>
                    </div>
                    <div class="select-width">
@@ -240,7 +240,7 @@
                        label-width="0"
                        :rules="[
                          {
                            required: ruleForm.isfallingSilkBucketTwo,
                            required: ruleForm.selectTwo,
                            message: '请填写',
                            trigger: 'change',
                          },
@@ -255,7 +255,7 @@
                        ></el-input>
                      </el-form-item>
                      <el-checkbox
                        v-model="ruleForm.isfallingSilkBucketTwo"
                        v-model="ruleForm.selectTwo"
                      ></el-checkbox>
                    </div>
                    <div class="select-width">
@@ -265,7 +265,7 @@
                        label-width=""
                        :rules="[
                          {
                            required: ruleForm.isfallingSilkBucketThree,
                            required: ruleForm.selectThree,
                            message: '请填写',
                            trigger: 'change',
                          },
@@ -280,7 +280,7 @@
                        ></el-input>
                      </el-form-item>
                      <el-checkbox
                        v-model="ruleForm.isfallingSilkBucketThree"
                        v-model="ruleForm.selectThree"
                      ></el-checkbox>
                    </div>
                  </div>
@@ -491,7 +491,7 @@
            align="center"
          >
          <template slot-scope="scope">
               {{scope.row.peopleYield!=0?scope.row.peopleYield:''}}
               {{scope.row.peopleYield!=0?scope.row.peopleYield.toFixed(2):''}}
            </template>
          </el-table-column>
          <el-table-column  
@@ -639,7 +639,7 @@
        circle: "",
        marketId: "",
        fallingSilkCocoonNumber: "",
        workshopId: "",
        workshopNumber: "",
        bucketCocoonNumber: "",
        groupNumber: "",
        vehicleSpeed: "",
@@ -651,11 +651,11 @@
        groupReelingdiscount: "",
        fallingSilkBucket: "",
        fallingSilkBucketOne: "",
        isfallingSilkBucketOne: "",
        selectOne: false,
        fallingSilkBucketTwo: "",
        isfallingSilkBucketTwo: "",
        selectTwo: false,
        fallingSilkBucketThree: "",
        isfallingSilkBucketThree: "",
        selectThree: false,
        back: "",
        oneBack: "",
        twoBack: "",
@@ -672,7 +672,7 @@
        marketId:  [
          { required: true, message: "请选择", trigger:  ["change", "blur"] },
        ],
        workshopId:  [
        workshopNumber:  [
          { required: true, message: "请选择", trigger:  ["change", "blur"] },
        ],
        groupNumber:  [
@@ -710,7 +710,7 @@
        circle: "",
        marketId: "",
        fallingSilkCocoonNumber: "",
        workshopId: "",
        workshopNumber: "",
        bucketCocoonNumber: "",
        groupNumber: "",
        vehicleSpeed: "",
@@ -722,11 +722,11 @@
        groupReelingdiscount: "",
        fallingSilkBucket: "",
        fallingSilkBucketOne: "",
        isfallingSilkBucketOne: "",
        selectOne: false,
        fallingSilkBucketTwo: "",
        isfallingSilkBucketTwo: "",
        selectTwo: false,
        fallingSilkBucketThree: "",
        isfallingSilkBucketThree: "",
        selectThree: false,
        back: "",
        oneBack: "",
        twoBack: "",
@@ -743,7 +743,7 @@
                  JSON.stringify(response.data ? response.data : {})
                );
                this.ruleForm = config;
                this.$set(this.ruleForm,'workshopId',this.ruleForm.workshopId+'')
                this.$set(this.ruleForm,'workshopNumber',this.ruleForm.workshopNumber+'')
                this.tableDataItems=config.items
                  ? config.items
                  : [];
@@ -792,7 +792,6 @@
          }
        }
      }
      console.log(this.tableData,'==this.tableData')
      this.ruleForm.carNumber=this.tableData.length>0?this.tableData[0].carNumber:''
    },
    // 表格的计算问题
@@ -838,7 +837,7 @@
      }
      this.getPeopleYield(row)
      row.oneYield=Number(string);
      return string;
      return string.toFixed(2);
    },
    getPeopleYield(row){
      let string=0
@@ -878,7 +877,7 @@
        }
      }
      row['allYield'+val]=Number(string);
      return string;
      return string.toFixed(2);
    },
    changeForm(form,val,data){
      if(val){
@@ -887,7 +886,7 @@
                  JSON.stringify(data ? data : {})
                );
                this.ruleForm = config;
                this.$set(this.ruleForm,'workshopId',this.ruleForm.workshopId+'')
                this.$set(this.ruleForm,'workshopNumber',this.ruleForm.workshopNumber+'')
                this.tableDataItems=config.items
                  ? config.items
                  : [];
@@ -971,7 +970,7 @@
      }).then((res) => {
        if (res.code == 200) {
          this.nameList = res.data || [];
          this.$set(this.ruleForm,'workshopId',this.ruleForm.workshopId+'')
          this.$set(this.ruleForm,'workshopNumber',this.ruleForm.workshopNumber+'')
        }
      });
      //规格
@@ -991,25 +990,36 @@
        }
      });
    },
    getGroupNumber(val){
      if(this.ruleForm.workshopId){
    getGroupNumber(val,prop){
      if(this.ruleForm.workshopNumber){
        //组别
        getWorkshopManageGroup({number:this.ruleForm.workshopId}).then((res) => {
        getWorkshopManageGroup({number:this.ruleForm.workshopNumber}).then((res) => {
           if (res.code == 200) {
              this.workshopGroupList=[]
              let workshopGroupList = res.data || {};
              this.workshopGroupList=[]
              if(Object.keys(workshopGroupList).length>0){
                for(let i in workshopGroupList){
                  this.workshopGroupList.push(workshopGroupList[i])
                }
               this.$set(this.ruleForm,'groupNumber',this.ruleForm.groupNumber)
                if(prop&&prop!='groupNumber'){
                  this.ruleForm.groupNumber=''
                }
                // 编辑
                if(val){
                  setTimeout(()=>{
                    this.$set(this.ruleForm,'groupNumber',this.ruleForm.groupNumber)
                  },200)
                }
              }
            }else{
              this.workshopGroupList=[]
              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){
              if( this.nameList[i].number==this.ruleForm.workshopNumber){
                workshopName= this.nameList[i].name
                break;
              }
@@ -1044,6 +1054,10 @@
               if(val){
                this.getTableEdit()
               }
              }else{
                this.tableData=[]
                this.ruleForm.level=''
                this.ruleForm.carNumber=''
              }
            });
          }
@@ -1079,7 +1093,7 @@
        circle: "",
        marketId: "",
        fallingSilkCocoonNumber: "",
        workshopId: "",
        workshopNumber: "",
        bucketCocoonNumber: "",
        groupNumber: "",
        vehicleSpeed: "",
@@ -1091,11 +1105,11 @@
        groupReelingdiscount: "",
        fallingSilkBucket: "",
        fallingSilkBucketOne: "",
        isfallingSilkBucketOne: "",
        selectOne: false,
        fallingSilkBucketTwo: "",
        isfallingSilkBucketTwo: "",
        selectTwo: false,
        fallingSilkBucketThree: "",
        isfallingSilkBucketThree: "",
        selectThree:false,
        back: "",
        oneBack: "",
        twoBack: "",
@@ -1133,11 +1147,6 @@
          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
          debugger
          for(let i in tableData){
            let listItems1={
              allYield:Number(tableData[i].allYield1)||0, //产量