zouyu
2023-12-29 617d2ad422a2ae5badc0572b06f33c2791cb95ad
src/views/quality/rawMaterial/rawMaterial-form.vue
@@ -7,7 +7,7 @@
        <h2 v-else>编辑-原材料检验</h2>
      </div>
      <div class="btn-group header-right">
        <el-button @click="save()" v-if="this.dataForm.id==null">保存</el-button>
        <el-button @click="save()" type="primary" v-if="dataForm.id==null">保存</el-button>
      </div>
    </div>
    <div class="page-main">
@@ -28,24 +28,25 @@
            </el-col>
              <el-col :span="6">
                <el-form-item label="零件号" prop="code">
                <el-input v-model="dataForm.code" :disabled="resultVal!=null && dataForm.id!=null">
                  <!-- <el-button
                <el-input v-model="dataForm.code">
                  <el-button
                    slot="append"
                    icon="el-icon-search"
                    :disabled="resultVal!=null && dataForm.id!=null"
                    @click="queryCode()"></el-button> -->
                    :disabled="resultVal!=null"
                    @click="queryCode"></el-button>
                    <el-button
                    slot="append"
                    icon="el-icon-full-screen"
                    :disabled="resultVal!=null && dataForm.id!=null"
                    :disabled="resultVal!=null"
                    @click="Turnonthecamera"></el-button>
                </el-input>
                </el-form-item>
            </el-col>
            <el-col :span="6">
                <el-form-item prop="name" label="原材料名称">
                <el-input v-model="dataForm.name" disabled >
                </el-input>
                  <el-tooltip class="item" effect="dark" :content="dataForm.name">
                  <el-input v-model="dataForm.name" disabled ></el-input>
                </el-tooltip>
                </el-form-item>
            </el-col>
            <el-col :span="6">
@@ -63,7 +64,9 @@
            <el-row>
              <el-col :span="6">
                <el-form-item label="规格型号" prop="specs">
                <el-input v-model="dataForm.specs" disabled></el-input>
                  <el-tooltip class="item" effect="dark" :content="dataForm.specs">
                    <el-input v-model="dataForm.specs" disabled></el-input>
                  </el-tooltip>
                </el-form-item>
              </el-col>
                <el-col :span="6">
@@ -76,7 +79,9 @@
                </el-col>
                <el-col :span="6">
                    <el-form-item label="供应商名称" prop="supplier">
                      <el-tooltip class="item" effect="dark" :content="dataForm.supplier" >
                        <el-input v-model="dataForm.supplier" disabled />
                      </el-tooltip>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
@@ -106,120 +111,205 @@
            </el-row>
        </el-form>
      </div>
      <div>
        <el-tabs class="rawMaterial-detail" @tab-click="tabsClick">
          <el-tab-pane label="检验项目">
            <el-row style="width:100%;z-index: 10;height:50px;" v-if="resultVal==null">
                <el-col :sm="15" :lg="18"></el-col>
                <el-col :sm="3" :lg="2" style="text-align: right;">
                  <el-button v-if="dataForm.id==null" size="small" @click="clickAddLine()">添加检验项目</el-button>
                </el-col>
                <el-col :sm="3" :lg="2" style="text-align: right;">
                  <el-button class="pad-addcol-btn" v-if="resultVal==null || dataForm.id==null" size="small" @click="addTeatValueColumn()">添加检测值列</el-button>
                </el-col>
                <el-col :sm="3" :lg="2" style="text-align: right;">
                  <el-button v-if="resultVal==null || dataForm.id==null" size="small" @click="delTeatValueColumn()">删除检测值列</el-button>
                </el-col>
            </el-row>
            <el-row style="width:100%;">
                <el-col :span="24">
                    <el-table
                    :header-cell-style="{textAlign:'center',color:'black',backgroundColor:'#fafafa'}"
                    :cell-style="{textAlign:'center'}"
                    ref="table"
                    :data="list"
                    border
                    style="width: 100%;"
                    height="400"
                    row-key="iid"
                    default-expand-all
                    :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
                      <el-table-column type="index" label="序号" width="60">
                      </el-table-column>
                      <el-table-column prop="father" label="检验项目" width="160">
                        <template slot-scope="scope">
                          <el-input v-if="scope.row.children" style="width:90%" :disabled="dataForm.id!=null" v-model="scope.row.father" placeholder="请输入检验项目"></el-input>
                        </template>
                      </el-table-column>
                      <el-table-column prop="name" label="项目" width="160">
                        <template slot-scope="scope">
                        <div v-if="!scope.row.children">
                          <el-input class="inline-input" :disabled="dataForm.id!=null" v-model="scope.row.name"
                            placeholder="请输入项目名称"></el-input>
                      </div>
                          </template>
                      </el-table-column>
                      <el-table-column prop="unit" label="单位" width="160">
                        <template slot-scope="scope">
                        <div v-if="!scope.row.children">
                          <el-input :disabled="dataForm.id != null" v-model="scope.row.unit" placeholder="请输入单位"></el-input>
                        </div>
                        </template>
                      </el-table-column>
                      <el-table-column prop="required" label="标准值" width="160">
                        <template slot-scope="scope">
                          <div v-if="!scope.row.children">
                          <el-input :disabled="dataForm.id != null" v-model="scope.row.required"
                            placeholder="请输入标准值"></el-input>
                          </div>
                        </template>
                      </el-table-column>
                      <el-table-column prop="testValue" label="检测值" min-width="160" v-for="(item,index) in empiricalValueAdd" :key="index">
                        <template slot-scope="scope">
                          <div v-if="!scope.row.children">
                          <el-tooltip :disabled="scope.row.deviceId != null" class="item" effect="dark" content="请先选择设备!" placement="top-start">
                              <el-select style="width:100%" allow-create filterable default-first-option
                              :disabled="scope.row.deviceId == null ||  (dataForm.id!=null&&resultVal!=null)"
                              v-model="scope.row.testValueList[index]"
                              placeholder="请输入或选择检测值"
                              @change="changeState(scope.row,scope.$index)">
                                <el-option label="是" value="是"/>
                                <el-option label="否" value="否"/>
                              </el-select>
                            </el-tooltip>
                          </div>
                        </template>
                      </el-table-column>
                      <el-table-column prop="deviceName" label="试验设备" min-width="200">
                        <template slot-scope="scope">
                          <div v-if="!scope.row.children">
                            <el-select ref="" :disabled="dataForm!=null && resultVal!=null" style="width:60%"
                            v-model="scope.row.deviceId" filterable @change="updateDevice(scope.row,scope.$index)">
                                <el-option v-for="(item,index) in deviceList"
                                :key="index" :value="item.id" :label="item.code +'-'+ item.name"></el-option>
                            </el-select>
                            <el-button
                            size="small"
                            slot="append"
                            icon="el-icon-full-screen"
                            :disabled="dataForm!=null && resultVal!=null"
                            @click="codeDevice(scope.row,scope.$index)"></el-button>
                          </div>
                        </template>
                      </el-table-column>
                      <el-table-column prop="note" label="检验描述" width="160" >
                        <template slot-scope="scope">
                          <div v-if="!scope.row.children">
                            <el-input @blur="changeState(scope.row, scope.$index)" :disabled="scope.row.deviceId == null ||  (dataForm.id!=null&&resultVal!=null)" v-model="scope.row.note" placeholder="检验描述"></el-input>
                          </div>
                        </template>
                      </el-table-column>
                      <el-table-column fixed="right" v-if="dataForm.id != null" prop="testState" label="结论" min-width="150">
                        <template slot-scope="scope">
                          <div v-if="!scope.row.children">
                            <span v-if="scope.row.testState == 0" style="color:#F56C6C">不合格</span>
                            <span v-else-if="scope.row.testState == 1" style="color:#67C23A">合格</span>
                            <span v-else>暂无结论</span>
                          </div>
                        </template>
                      </el-table-column>
                      <el-table-column fixed="right" style="background-color: white;" v-if="dataForm.id == null" label="操作" width="150">
                        <template slot-scope="scope">
                          <div v-if="scope.row.fId!=null">
                              <el-button type="text"  @click="addChildren(scope.row)">添加项目</el-button>
                              <el-button type="text" @click="delChildren(scope.row,scope.$index,true)">删除行</el-button>
                          </div>
                          <el-button v-else type="text" @click="delChildren(scope.row,scope.$index,false)">取消</el-button>
                        </template>
                      </el-table-column>
                    </el-table>
                </el-col>
            </el-row>
          </el-tab-pane>
          <el-tab-pane label="附件上传" type="card">
            <div style="display: flex;justify-content:flex-end;">
              <div></div>
            </div>
            <div
              v-loading="progrecessFileLoading"
              element-loading-text="请稍等,文件上传中"
            >
              <el-upload
                :disabled="dataForm.rawInsNo==null || resultVal!=null"
                drag
                ref="upload"
                action="/mes/rawInsProduct/upload"
                :auto-upload="true"
                :headers="headers"
                :before-upload="submitUpload"
                :on-success="uploadSuccess"
                :data="paramData"
                :with-credentials="true"
                :show-file-list="false"
              >
                <i class="el-icon-upload"></i>
                <div class="el-upload__text">
                  将文件拖到此处,或<em>点击上传</em>
                </div>
              </el-upload>
            </div>
      <div class="rawMaterial-detail">
        <el-row style="width:100%;z-index: 10;height:50px;">
            <el-col :span="18">检验项目</el-col>
            <el-col :span="2">
              <el-button style="width:90%" v-if="dataForm.id==null" size="small" @click="clickAddLine()">添加检验项目</el-button>
            </el-col>
            <el-col :span="2">
              <el-button style="width:90%" v-if="resultVal==null || dataForm.id==null" size="small" @click="addTeatValueColumn()">添加检测值列</el-button>
            </el-col>
            <el-col :span="2">
              <el-button style="width:90%" v-if="resultVal==null || dataForm.id==null" size="small" @click="delTeatValueColumn()">删除检测值列</el-button>
            </el-col>
        </el-row>
        <el-row style="width:100%;">
            <el-col :span="24">
                <el-table
                :header-cell-style="{textAlign:'center',color:'black',backgroundColor:'#fafafa'}"
                :cell-style="{textAlign:'center'}"
                 ref="table"
                :data="list"
                border
                style="width: 100%;"
                 height="400"
                  row-key="iid"
                  default-expand-all
                  :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
                  <el-table-column type="index" label="序号" width="60">
                  </el-table-column>
                  <el-table-column prop="father" label="检验项目" width="260">
                    <template slot-scope="scope">
                      <el-input v-if="scope.row.children" style="width:90%" :disabled="dataForm.id!=null" v-model="scope.row.father" placeholder="请输入检验项目"></el-input>
                    </template>
                  </el-table-column>
                  <el-table-column prop="name" label="项目" width="260">
                    <template slot-scope="scope">
                    <div v-if="!scope.row.children">
                      <el-input class="inline-input" :disabled="dataForm.id!=null" v-model="scope.row.name"
                        placeholder="请输入项目名称"></el-input>
                  </div>
                      </template>
                  </el-table-column>
                  <el-table-column prop="unit" label="单位" width="260">
                    <template slot-scope="scope">
                    <div v-if="!scope.row.children">
                      <el-input :disabled="dataForm.id != null" v-model="scope.row.unit" placeholder="请输入单位"></el-input>
                    </div>
                    </template>
                  </el-table-column>
                  <el-table-column prop="required" label="标准值" width="260">
                    <template slot-scope="scope">
                      <div v-if="!scope.row.children">
                      <el-input :disabled="dataForm.id != null" v-model="scope.row.required"
                        placeholder="请输入标准值"></el-input>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column prop="testValue" label="检测值" min-width="260" v-for="(item,index) in empiricalValueAdd" :key="index">
                    <template slot-scope="scope">
                      <div v-if="!scope.row.children">
                      <el-tooltip :disabled="scope.row.deviceId != null" class="item" effect="dark" content="请先选择设备!" placement="top-start">
                          <el-select @blur="changeState(scope.row, index)" style="width:100%" allow-create filterable default-first-option
                          :disabled="scope.row.deviceId == null ||  (dataForm.id!=null&&resultVal!=null)"
                          v-model="scope.row.testValueList[index]"
                          placeholder="请输入或选择检测值" @change="updateTestValue(scope.row,scope.$index)">
                            <el-option label="是" value="是"/>
                            <el-option label="否" value="否"/>
                          </el-select>
                        </el-tooltip>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column prop="deviceName" label="试验设备" min-width="260">
                    <template slot-scope="scope">
                      <div v-if="!scope.row.children">
                        <el-select :disabled="dataForm!=null && resultVal!=null" style="width:100%"
                        v-model="scope.row.deviceId" filterable @change="updateDevice(scope.row,scope.$index)">
                            <el-option v-for="(item,index) in deviceList"
                            :key="index" :value="item.id" :label="item.code +'-'+ item.name"></el-option>
                        </el-select>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column prop="note" label="检验描述" width="260" >
                    <template slot-scope="scope">
                      <div v-if="!scope.row.children">
                        <el-input @blur="changeState(scope.row, scope.$index)" :disabled="scope.row.deviceId == null ||  (dataForm.id!=null&&resultVal!=null)" v-model="scope.row.note" placeholder="检验描述"></el-input>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column fixed="right" v-if="dataForm.id != null" prop="testState" label="结论" min-width="150">
                    <template slot-scope="scope">
                      <div v-if="!scope.row.children">
                        <span v-if="scope.row.testState == 0" style="color:#F56C6C">不合格</span>
                        <span v-else-if="scope.row.testState == 1" style="color:#67C23A">合格</span>
                        <span v-else>暂无结论</span>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column fixed="right" style="background-color: white;" v-if="dataForm.id == null" label="操作" width="150">
                    <template slot-scope="scope">
                      <div v-if="scope.row.fId!=null">
                          <el-button type="text"  @click="addChildren(scope.row)">添加项目</el-button>
                          <el-button type="text" @click="delChildren(scope.row,scope.$index,true)">删除行</el-button>
                      </div>
                      <el-button v-else type="text" @click="delChildren(scope.row,scope.$index,false)">取消</el-button>
                    </template>
                  </el-table-column>
                </el-table>
            </el-col>
        </el-row>
            <el-table :data="processConfigFileTableData" height="260px">
              <el-table-column
                prop="rawInsNo"
                align="center"
                width="120"
                label="原材料检验编号"
                show-overflow-tooltip
              ></el-table-column>
              <el-table-column
                prop="originalFileName"
                align="center"
                label="原文件名"
                width="200"
              ></el-table-column>
              <el-table-column prop="fileName" align="center" label="文件后缀"></el-table-column>
              <el-table-column prop="createUser" align="center" label="上传人"></el-table-column>
              <el-table-column
                prop="createTime"
                align="center"
                label="上传时间"
                show-overflow-tooltip
              ></el-table-column>
              <el-table-column prop="updateUser" align="center" label="更新人">
              </el-table-column>
              <el-table-column
                prop="updateTime"
                align="center"
                label="更新时间"
                show-overflow-tooltip
              ></el-table-column>
              <el-table-column align="center" label="操作">
                <template slot-scope="scope">
                  <el-button
                    @click="delProcessConfigFile(scope.row)"
                    type="text"
                    size="small"
                    :disabled="resultVal!=null"
                    >删除</el-button
                  >
                  <el-button
                    @click="downloadProcessConfigFile(scope.row)"
                    type="text"
                    size="small"
                    >下载</el-button
                  >
                </template>
              </el-table-column>
            </el-table>
          </el-tab-pane>
        </el-tabs>
      </div>
      <div class="rawMaterial-result">
        <el-row>
@@ -230,8 +320,8 @@
            <el-table border height="90" :data="conclusionTable" ref="conclusion" v-model="conclusion"
            :header-cell-style="{textAlign:'center',color:'black',backgroundColor:'#fafafa'}"
            :cell-style="{textAlign:'center'}">
                <el-table-column prop="code" label="物料编号"></el-table-column>
                <el-table-column prop="name" label="物料名称"></el-table-column>
                <el-table-column prop="code" width="150" show-overflow-tooltip label="物料编号"></el-table-column>
                <el-table-column prop="name" width="150" show-overflow-tooltip label="物料名称"></el-table-column>
                <el-table-column prop="userName" label="检验员"></el-table-column>
                <el-table-column prop="judgeState" label="检验结论">
                  <template slot-scope="scope">
@@ -265,18 +355,30 @@
        <el-button type="primary" @click="submitSave()">确 定</el-button>
      </span>
    </el-dialog>
  <el-dialog
  title="扫描"
  :visible.sync="qrcode"
  width="60%">
  <div style="height: 100vh;width: 100%;">
    <qr-code-app ref="codeCompont" @cancelCodeDialog="cancelCodeDialog"></qr-code-app>
  </div>
  <span slot="footer" class="dialog-footer">
    <el-button @click="qrcode = false">取 消</el-button>
    <el-button type="primary" @click="qrcode = false">确 定</el-button>
  </span>
</el-dialog>
    <el-dialog
    title="扫描"
    :visible.sync="qrcode"
    width="60%">
    <div style="height: 100vh;width: 100%;">
      <qr-code-app ref="codeCompont" @ok="getResultInfo" @cancelCodeDialog="cancelCodeDialog"></qr-code-app>
    </div>
    <span slot="footer" class="dialog-footer">
      <el-button @click="qrcode = false">取 消</el-button>
      <el-button type="primary" @click="qrcode = false">确 定</el-button>
    </span>
    </el-dialog>
    <el-dialog
      title="设备扫描"
      :visible.sync="deviceCode"
      width="60%">
      <div style="height: 100vh;width: 100%;">
        <qr-code-app ref="codeDeviceCompont" @ok="getDeviceResultInfo" @cancelCodeDialog="cancelDeviceCodeDialog"></qr-code-app>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="deviceCode = false">取 消</el-button>
        <el-button type="primary" @click="deviceCode = false">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
@@ -287,9 +389,14 @@
  getObj,
  updateRawInsProduct,
  updateRawInspectsById,
  updateDeviceById, } from '@/api/quality/rawMaterial'
  getProcessConfigFiles,
  downloadProcessConfigFile,
  deleteProcessConfigFile,
  updateDeviceById, chooseIFS} from '@/api/quality/rawMaterial'
  import rawMaterialPartDialog from '@/views/common/rawMaterial-part'
  import { getStore } from '@/util/store'
  import qrCodeApp from '@/views/common/qrCodeApp'
  import transformImage from '@/util/fileTransform'
  export default {
  components:{
    rawMaterialPartDialog,
@@ -298,6 +405,19 @@
    computed:{},
    data(){
        return{
            progrecessFileLoading: false,
            processConfigFileTableData: [],
            fileList: [],
            headers: {
              Authorization: 'Bearer ' + getStore({ name: 'access_token' })
            },
            paramData: {
              rawInsNo: '',
              lineNumber: ''
            },
            row: null,
            proIndex: 0,
            deviceCode: false,
            qrcode: false,
            userdata:[],
            currentRow:[],
@@ -320,7 +440,7 @@
                formTime: '',
                message: '',
                name: '',
                code: '88.118.1/A0498220',
                code: '',
                specs: '',
                unit: '',
                number: '',
@@ -344,7 +464,9 @@
              userName: '',
              testState: ''
            }],
            dataRule: {},
            dataRule: {
              code:[{ required: true, message: '请扫描选择零件', trigger: 'blur' }]
            },
            deviceList: [],
        }
    },
@@ -371,77 +493,105 @@
      },
    },
    methods:{
      tabsClick(tab,even){
        if(tab.index == 1){
          if(this.dataForm.rawInsNo==null){
            this.$message.error("请先保存原材料检验信息")
            return
          }
            this.getConfigFiles();
        }
      },
      getConfigFiles() {
        const param = {
          rawInsNo: this.dataForm.rawInsNo,
          lineNumber: this.dataForm.id
        }
        getProcessConfigFiles(param).then((res) => {
          this.processConfigFileTableData = res.data.data
        })
      },
      downloadProcessConfigFile(row) {
        downloadProcessConfigFile({
            bucket: row.bucketName,
            fileName: row.fileName,
            originalFileName: row.originalFileName
        })
      },
      delProcessConfigFile(row) {
          this.$confirm('是否删除该附件', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning',
            closeOnClickModal: false
          }).then(function() {
            return deleteProcessConfigFile(row.id)
          }).then((data) => {
            this.getConfigFiles()
          })
      },
      submitUpload() {
        this.paramData.rawInsNo = this.dataForm.rawInsNo
        this.paramData.lineNumber = this.dataForm.id
        this.progrecessFileLoading = true
      },
      uploadSuccess() {
        this.progrecessFileLoading = false
        this.getConfigFiles()
      },
      cancelDeviceCodeDialog(){
        this.deviceCode = false
      },
      getDeviceResultInfo(val){
        let id=val.split("id@")[1]
        if(id!=undefined&&id!=''&&id!=null){
          let filterData=this.deviceList.filter(item=>{
          return item.id==id
        })[0]
        console.log(filterData);
        this.row.deviceId=Number(id)
        this.updateDevice(this.row,this.proIndex)
        }else{
          this.$message({
          message: '未识别出二位码计量器具信息!',
          type: 'warning'
        });
        }
      },
      codeDevice(row,index){
        this.row=row
        console.log("row",row);
        this.deviceCode =true
        this.$refs.codeDeviceCompont.openCamera()
        this.proIndex=index
      },
      getResultInfo(data){
        if(!data.includes("part_no")){
          this.$message({
          message: '未识别出二维码零件信息!',
          type: 'warning'
        });
        }
        let obj=JSON.parse(data)
        let info={"code":obj["part_no"]}
        if(info.code!=undefined&&info.code!=''){
          this.paramObj = info
          this.showPart = true
        }else{
          this.$message({
          message: '未识别出二维码零件信息!',
          type: 'warning'
        });
        }
      },
      cancelCodeDialog(){
        this.qrcode = false
      },
       // 打开相机
      Turnonthecamera() {
        console.log("执行");
        this.qrcode = true
        this.$refs.codeCompont.openCamera()
      // this.camera = 'rear'
    },
    // 扫码结果回调
    // onDecode(result) {
    //   console.log(result)
    //   this.turnCameraOff()
    // },
    // 相机反转
    // switchCamera() {
    //   switch (this.camera) {
    //     case 'front':
    //       this.camera = 'rear'
    //       break
    //     case 'rear':
    //       this.camera = 'front'
    //       break
    //     default:
    //       this.$toast('错误')
    //   }
    // },
    // 关闭相机
    // turnCameraOff() {
    //   this.camera = 'off'
    //   this.qrcode = false
    // },
    // 打开手电筒
    // ClickFlash() {
    //   switch (this.torchActive) {
    //     case true:
    //       this.torchActive = false
    //       break
    //     case false:
    //       this.torchActive = true
    //       break
    //     default:
    //       this.$toast('错误')
    //   }
    // },
    // 检查是否调用摄像头
    // async onInit(promise) {
    //   try {
    //     await promise
    //   } catch (error) {
    //     if (error.name === 'StreamApiNotSupportedError') {
    //     } else if (error.name === 'NotAllowedError') {
    //       this.errorMessage = 'Hey! I need access to your camera'
    //     } else if (error.name === 'NotFoundError') {
    //       this.errorMessage = 'Do you even have a camera on your device?'
    //     } else if (error.name === 'NotSupportedError') {
    //       this.errorMessage =
    //         'Seems like this page is served in non-secure context (HTTPS, localhost or file://)'
    //     } else if (error.name === 'NotReadableError') {
    //       this.errorMessage =
    //         "Couldn't access your camera. Is it already in use?"
    //     } else if (error.name === 'OverconstrainedError') {
    //       this.errorMessage =
    //         "Constraints don't match any installed camera. Did you asked for the front camera although there is none?"
    //     } else {
    //       this.errorMessage = 'UNKNOWN ERROR: ' + error.message
    //     }
    //   }
    // },
          this.qrcode = true
          this.$refs.codeCompont.openCamera()
      },
      // 确认回调
      selectPart(param, nodePart, index) {
        if (typeof param !== 'undefined') {
@@ -514,6 +664,7 @@
        let data = {
          id: this.dataForm.id,
          number: this.unqualifiedNum,
          result: this.conclusionTable[0].testState
        }
        updateRawInspectsById(data).then(res => {
          if(res.data.code == 0 && (res.data.data=='1'|| res.data.data=='0')){
@@ -569,7 +720,7 @@
              required: null,
              rpId: null,
              name: null,
              unit: null,
              unit: 'mm',
              userName: null,
              testValue: '',
              testValueList: [],
@@ -580,37 +731,45 @@
        }
      },
      changeRowResult(){
          if(this.list){
              this.list.forEach(e=>{
                  if(e.children){
                      e.children.forEach(i=>{
                          if(i.testValueList.length>1){
                              let arr = i.testValue.split(",")
                              arr.splice((arr.length-1),1)
                              let obj = {
                                deviceId: i.deviceId,
                                rpId: i.rpId,
                                testValue: arr.join(","),
                                note: i.note
                              }
                              updateRawInsProduct(obj).then(res=>{
                                if(res.data.code === 0){
                                  this.init()
                                }
                              })
                          }
                      })
                  }
              })
          }
      },
      delTeatValueColumn(){
        if (this.empiricalValueAdd - 1 > 0) {
          if (this.empiricalValueAddMaxNumber != this.empiricalValueAdd - 1) {
            this.empiricalValueAdd = this.empiricalValueAdd - 1;
            this.changeRowResult()
            this.list.forEach(i => {
              i.testValueList.splice(this.empiricalValueAdd, 1);
              if(i.children){
                i.children.forEach(ele=>{
                  ele.testValueList.splice(this.empiricalValueAdd, 1);
                })
              }
            });
          }
        }
      },
      updateTestValue(row,index){
        if(row.rpId == null){
          return
        }
        let val = row.testValueList.join(",");
        let obj = {
          deviceId: row.deviceId,
          rpId: row.rpId,
          testValue: val,
          note: row.note
        }
        updateRawInsProduct(obj).then(res=>{
          if(res.data.code === 0){
            this.$message.success("更新成功")
            this.init()
          }else{
            this.$message.success("更新失败")
          }
        }).catch(error=>{
          this.$message.error(error)
        })
      },
      init(){
        if(this.dataForm.id){
@@ -669,11 +828,27 @@
                    this.list.push(ele)
                }}
            })
            let rVal = ''
            let passNum = 0
            let unPassNum = 0
            this.list.forEach(item=>{
                if(item.children){
                  item.children.forEach(ele=>{
                    if(ele.testState == 0){
                      unPassNum += 1
                    }
                    if(ele.testState == 1){
                      passNum+=1
                    }
                  })
                }
            })
            rVal = (passNum+unPassNum)>0 ? unPassNum>0 ? '0' :'1' : ''
            this.conclusionTable = [{
              code: data.code,
              name: data.name,
              userName: Array.from(new Set(userNameList)).join(','),
              testState: this.resultVal==null?null:this.resultVal
              testState: this.resultVal==null?rVal:this.resultVal
            }]
          }).catch(error=>{
            this.$message.error("获取失败",error)
@@ -683,6 +858,21 @@
        }
      },
      changeState(row, index) {
          if(row){
            let isTrue = true
            for(var i=0;i<row.testValueList.length;i++){
              let val = row.testValueList[i]
              let reg = /(^-?[0-9]{1,6}$)|(^-?[0-9]{1,6}[\.]{1}[0-9]{1,3}$)/
              if(!reg.test(val) && !['是','否'].includes(val)){
                this.$message.error("请输入数字或选择是否")
                row.testValueList[i] = null
                isTrue = false
              }
            }
            if(!isTrue){
              return
            }
          }
          if (row.rpId != null && row.rpId != '') {
            let val = row.testValueList.join(",")
            if (val === undefined || val === '' || val === null) {
@@ -730,7 +920,7 @@
          required: null,
          rpId: null,
          name: null,
          unit: null,
          unit: 'mm',
          userName: null,
          testValue: null,
          testValueList: [],
@@ -766,14 +956,14 @@
<style>
.rawMaterial-detail {
  width: 100%;
  height: 470px;
  height: 530px;
  padding: 10px 20px;
  display: flex;
  border: 1px solid #ddd;
  background-color: #fff;
  margin-top: 10px;
  box-sizing: border-box;
  flex-wrap: wrap;
  /* display: flex;
  flex-wrap: wrap; */
}
.rawMaterial-result {
@@ -790,7 +980,7 @@
.rawMaterial-basic {
  background-color: #fff;
  height: 155px;
  height: 170px;
  display: flex;
  flex-wrap: wrap;
  padding: 10px 20px;
@@ -963,4 +1153,9 @@
  border: 1px solid #e4e7ed;
  border-bottom: none;
}
@media (max-width: 767px) {
  .pad-addcol-btn{
    font-size:12px;
  }
}
</style>