王震
2023-09-24 941fff624eddc4b9f369f1b91f65fdb50309851d
src/components/view/rawInsDetail.vue
@@ -102,7 +102,8 @@
               <template slot-scope="scope">
                  <!-- <el-input v-if="detailId == null" v-model="scope.row.name" placeholder="请输入项目名称"></el-input> -->
                  <el-autocomplete v-if="detailId == null" class="inline-input" v-model="scope.row.name"
                     :fetch-suggestions="querySearch" placeholder="请输入项目名称" @select="handleSelect(scope.row)" @blur="handleSelect(scope.row)"></el-autocomplete>
                     :fetch-suggestions="querySearch" placeholder="请输入项目名称" @select="handleSelect(scope.row)"
                     @blur="handleSelect(scope.row)"></el-autocomplete>
                  <el-input v-else v-model="scope.row.rpName" disabled></el-input>
               </template>
            </el-table-column>
@@ -181,7 +182,7 @@
            </el-table-column>
            <el-table-column v-if="detailId !== null" label="操作" width="120">
               <template>
                  <el-button type="text" size="small" @click.once="submitSave">上报</el-button>
                  <el-button type="text" size="small" @click="submitSave">上报</el-button>
               </template>
            </el-table-column>
         </el-table>
@@ -301,10 +302,10 @@
            this.detailInfo.number = this.ifsInfo.number
            this.detailInfo.specifications = this.ifsInfo.specifications
            this.restaurants = JSON.parse(JSON.stringify(this.ifsInfo.rawInsProducts))
            this.restaurants.forEach(item=>{
               this.$set(item,"value",item.name)
            this.restaurants.forEach(item => {
               this.$set(item, "value", item.name)
            })
            console.log("restaurants",this.restaurants);
            console.log("restaurants", this.restaurants);
         })
      },
      querySearch(queryString, cb) {
@@ -319,13 +320,13 @@
         };
      },
      handleSelect(row) {
         let select=this.restaurants.filter(item=>{
            return item.name===row.name
         let select = this.restaurants.filter(item => {
            return item.name === row.name
         })[0]
         if(select!=undefined){
            this.$set(row,"internal",select.internal)
            this.$set(row,"required",select.required)
            this.$set(row,"unit",select.unit)
         if (select != undefined) {
            this.$set(row, "internal", select.internal)
            this.$set(row, "required", select.required)
            this.$set(row, "unit", select.unit)
            //检验值
         }
      },
@@ -438,14 +439,39 @@
            this.getDetailInfo(); //重新刷新信息数据
         }
      },
      async submitSave() {
         const res = await this.$axios.post(
       submitSave() {
         let pro = this.projectTable.filter(item => {
            return item.testState === 0;
         })
         if (pro.length > 0) {
            this.$prompt('请输入不合格数量', '不合格数量', {
               confirmButtonText: '确定',
               cancelButtonText: '取消',
               inputPattern: /^\d+$/,
               inputErrorMessage: '请输入正确数字格式'
            }).then(({ value }) => {
               this.$axios.post(
                  this.$api.url.updateRawInspectsById+`${this.detailId}`, {"number": value }
               ).then(res => {
                  this.$message.success("提交成功");
                  this.getDetailInfo();
                  this.goBack()
               });
            }).catch(() => {
               this.$message({
                  type: 'info',
                  message: '取消输入'
               });
            });
         }else{
          this.$axios.post(
            this.$api.url.updateRawInspectsById + `${this.detailId}`
         ).then(res => {
            this.$message.success("提交成功");
            this.getDetailInfo();
            this.goBack()
         });
         }
      },
      // 获取设备树内容
      getOptions() {