haoxuan
2024-04-11 aa59eac0cd169f5fcf7e16ab4d5c34c2baa1bd84
循环回数对应的片数组合成对应的字段赋值到单元格
1个文件已修改
115 ■■■■■ 已修改文件
src/views/productManage/productRegisterForm/addProductRegisterPage.vue 115 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productManage/productRegisterForm/addProductRegisterPage.vue
@@ -469,7 +469,7 @@
            align="center"
          >
          <template slot-scope="scope">
               {{scope.row.peopleYield}}
               {{scope.row.peopleYield!=0?scope.row.peopleYield:''}}
            </template>
          </el-table-column>
          <el-table-column  
@@ -589,7 +589,7 @@
<script>
import addProductDialog from "./components/addProductDialog";
import {
  // getYieldRegisterInfo,
  getYieldRegisterInfo,
  saveYieldRegister,
  getWorkshopManageCar,
  getWorkshopManageGroup,
@@ -664,6 +664,8 @@
      isAddloading: false,
      productRegisterId:null,
      productRegisterNumber:null,
      tableDataItems:[],
      tableDataCircles:[],
    };
  },
  mounted() {
@@ -673,8 +675,84 @@
      this.productRegisterNumber = query.number ? query.number : "";
    }
    this.getSelectDataList();
    this.getDetailsData()
  },
  methods: {
    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='';
@@ -760,13 +838,28 @@
      row['allYield'+val]=Number(string);
      return string;
    },
    changeForm(form,val){
    changeForm(form,val,data){
      if(val){
        this.ruleForm.createTime=form.createTime
        this.ruleForm.groupNumber=form.groupNumber
        this.ruleForm.spec=form.spec
        this.ruleForm.marketId=form.marketId
        this.getGroupNumber()
        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}){
@@ -843,7 +936,7 @@
        }
      });
    },
    getGroupNumber(){
    getGroupNumber(val){
      if(this.ruleForm.workshopId){
        //组别
        getWorkshopManageGroup({number:this.ruleForm.workshopId}).then((res) => {
@@ -889,6 +982,10 @@
                }
                this.tableData[0].isBlue=true
               }
              //  编辑
               if(val){
                this.getTableEdit()
               }
               this.ruleForm.carNumber=this.tableData.length>0?this.tableData[0].carNumber:''
               
              }