Fixiaobai
2023-09-04 0b9a9b4aa3051565b213b9efcb5e02ecbda0e791
src/views/inspectionManagement/reportForInspection/index.vue
@@ -8,7 +8,7 @@
                  </el-input>
               </el-form-item>
               <el-form-item label="材料名称:" class="sermargin">
                  <el-input v-model="searchData.name" class="input-form" placeholder="请输入">
                  <el-input v-model="searchData.name" class="input-form" placeholder="请输入材料名称">
                  </el-input>
               </el-form-item>
               <el-form-item label="状态:" class="sermargin">
@@ -18,8 +18,8 @@
                  </el-select>
               </el-form-item>
               <el-form-item label="来料日期:" style="margin-right: 20px;">
                  <el-input v-model="searchData.date" class="input-form" placeholder="请输入">
                  </el-input>
                  <el-date-picker value-format="yyyy-MM-dd" v-model="searchData.date" class="input-form" placeholder="请选择来料日期">
                  </el-date-picker>
               </el-form-item>
               <el-form-item>
                  <el-button type="primary" @click="search">查询</el-button>
@@ -54,7 +54,7 @@
                  <el-input type="text" v-model="insertData.unit" />
               </el-form-item>
               <el-form-item label="数量:" prop="num">
                  <el-input type="number" v-model="insertData.num"/>
                  <el-input type="number" min="0" v-model="insertData.num"/>
               </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
@@ -70,8 +70,8 @@
               </div>
            </div>
            <div class="table-box">
               <el-table ref="inspectionTable" :max-height="600" :cell-style="{textAlign: 'center'}"
                  :header-cell-style="{border:'0px',background:'#f5f7fa',color:'#606266',boxShadow: 'inset 0 1px 0 #ebeef5',textAlign: 'center'}"
               <el-table ref="inspectionTable" :max-height="450" :cell-style="{textAlign: 'left'}"
                  :header-cell-style="{border:'0px',background:'#f5f7fa',color:'#606266',boxShadow: 'inset 0 1px 0 #ebeef5',textAlign: 'left'}"
                  :data="inspectionTable" style="width: 100%" @selection-change="handleSelectionChange">
                  <el-table-column type="selection" :selectable="checkSelect" min-width="5%"></el-table-column>
                  <el-table-column type="index" label="序号" min-width="8%" />
@@ -276,6 +276,13 @@
      mounted() {
         this.getMaterielName();
      },
      watch:{
         addReportDialog(newVal){
            if(newVal === false){
               this.resetForm("addInspectionForm");
            }
         }
      },
      methods: {
         handleChange() {
@@ -313,10 +320,13 @@
         },
         handleSelectionChange(val) {
        if (val.length > 1) {
               let data = val.pop();
               this.$refs.inspectionTable.clearSelection();
               this.$refs.inspectionTable.toggleRowSelection(val.pop())
            }
               this.$refs.inspectionTable.toggleRowSelection(data);
               this.checkData = new Array(data);
            }else{
            this.checkData = val;
            }
         },
         //生成报检单按钮
         addReportBtn() {
@@ -328,8 +338,8 @@
               } else {
            let mcode = this.checkData[0].materialCoding;
            let name = this.checkData[0].materialName;
            let specifications = this.checkData[0].specificationsModels;
            this.getChooseVersionFun(mcode,name,specifications);
                     let speId = this.checkData[0].specificationsId;
                     this.getChooseVersionFun(mcode,name,speId);
                  this.addReportDialog = true;
               }
            }
@@ -350,7 +360,11 @@
              specifications : specifications,
              version: version
          }).then((res)=>{
            vm.standardLibraryData = res.data;
               var arr = res.data;
               for(var i=0;i<arr.length;i++){
                  arr[i].id = "0" + i;
               }
               vm.standardLibraryData = arr;
          })
          
      },
@@ -389,23 +403,28 @@
              "name": val.materialName,
              "num": val.quantity,
              "specifications": val.specificationsModels,
               "specificationsId": val.specificationsId,
              "startTime": dateArr[0],
              "supplier": val.supplierName,
              "type": val.type,
              "unit": val.unit,
              "version": this.addInspectionForm.version
            }
            this.createReport(obj);
               // this.createReport(obj);
               console.log("obj---",obj);
            this.addReportDialog = false;
          }
        }));
         },
         //生成报检单
         async createReport(param) {
            let res = await addInspect(param);
            if(res.data==null)return
            await addInspect(param).then(res =>{
               this.search();
            this.$message.success('报检成功')
            this.$router.push(`/experiment/Viewdetails/${res.data}`)
            }).catch(error =>{
               this.$message.error('报检失败')
            });
         },
         // 获取分页列表数据
         async getRawMaterialList() {