zouyu
2024-01-22 3b02a02e6f615f167b06ca4d62d094cda777d862
src/views/quality/rawMaterial/rawMaterial-form.vue
@@ -3,11 +3,11 @@
    <div class="page-header">
      <div class="header-left">
        <a @click="$router.go(-1)"><i class="icon-btn-back"></i></a>
        <h2 v-if="resultVal!=null && dataForm.id!=null">查看-原材料检验</h2>
        <h2 v-if="(resultVal!=null || resultVal!='') && dataForm.id!=null">查看-原材料检验</h2>
        <h2 v-else>编辑-原材料检验</h2>
      </div>
      <div class="btn-group header-right">
        <el-button @click="save()" type="primary" 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,11 +28,16 @@
            </el-col>
              <el-col :span="6">
                <el-form-item label="零件号" prop="code">
                <el-input v-model="dataForm.code" disabled>
                <el-input v-model="dataForm.code">
                  <el-button
                    slot="append"
                    icon="el-icon-search"
                    :disabled="(resultVal!=null || resultVal!='')"
                    @click="queryCode"></el-button>
                    <el-button
                    slot="append"
                    icon="el-icon-full-screen"
                    :disabled="resultVal!=null && dataForm.id!=null"
                    :disabled="(resultVal!=null || resultVal!='')"
                    @click="Turnonthecamera"></el-button>
                </el-input>
                </el-form-item>
@@ -81,7 +86,7 @@
                </el-col>
                <el-col :span="6">
                  <el-form-item label="数量" prop="number">
                      <el-input v-model="dataForm.number" :disabled="resultVal!=null" />
                      <el-input v-model="dataForm.number" :disabled="(resultVal!=null || resultVal!='')" />
                  </el-form-item>
                </el-col>
            </el-row>
@@ -106,127 +111,220 @@
            </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 :span="12"></el-col>
                <el-col :span="12" style="text-align: right;">
                  <el-button v-if="dataForm.id==null" size="small" @click="clickAddLine()">添加检验项目</el-button>
                  <el-button class="pad-addcol-btn" v-if="resultVal==null || dataForm.id==null" size="small" @click="addTeatValueColumn()">添加检测值列</el-button>
                  <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" prop="parentIndex" label="序号" width="60">
                        <template scope="scope">
                            <span v-if="scope.row.isIndex">{{scope.row.parentIndex}}</span>
                        </template>
                      </el-table-column>
                      <el-table-column prop="father" label="检验项目" width="160">
                        <template slot-scope="scope">
                          <el-input v-if="scope.row.children" style="width:80%" :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-autocomplete clearable
                            :disabled="scope.row.deviceId == null ||  (dataForm.id!=null&&(resultVal!=null || resultVal!=''))"
                            @input="changeState(scope.row,scope.$index)"
                            v-model="scope.row.testValueList[index]"
                            :fetch-suggestions="querySearch"
                            placeholder="请输入或选择检测值" >
                            <i style="line-height: normal;padding: 10px 7px;" class="el-icon-arrow-down" slot="suffix"></i>
                            <template slot-scope="{ item }">
                                <div>{{ item.value }}</div>
                            </template>
                            </el-autocomplete>
                              <!-- <el-select style="width:100%" filterable
                              :disabled="scope.row.deviceId == null ||  (dataForm.id!=null&&(resultVal!=null || resultVal!=''))"
                              v-model="scope.row.testValueList[index]"
                              placeholder="请输入或选择检测值"
                              allow-create
                              default-first-option
                              @change="changeState(scope.row,scope.$index)"
                              @blur="selectBlur"
                              >
                                <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 || resultVal!='')" 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 || resultVal!='')"
                            @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 || resultVal!=''))" 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 || resultVal!='')"
                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 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="260">
                    <template slot-scope="scope">
                      <div v-if="!scope.row.children">
                        <el-select ref="" :disabled="dataForm!=null && resultVal!=null" style="width:80%"
                        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="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 || resultVal!='')"
                    >删除</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>
@@ -237,8 +335,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">
@@ -248,7 +346,7 @@
                </el-table-column>
                <el-table-column  label="操作">
                    <template>
                        <el-button type="text" :disabled="resultVal!=null && dataForm.id!=null" @click="showDialog()" size="small">上报</el-button>
                        <el-button type="text" :disabled="(resultVal!=null || resultVal!='') && dataForm.id!=null" @click="showDialog()" size="small">上报</el-button>
                    </template>
                </el-table-column>
            </el-table>
@@ -272,30 +370,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" @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>
    <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>
@@ -306,9 +404,14 @@
  getObj,
  updateRawInsProduct,
  updateRawInspectsById,
  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,
@@ -317,6 +420,16 @@
    computed:{},
    data(){
        return{
            progrecessFileLoading: false,
            processConfigFileTableData: [],
            fileList: [],
            headers: {
              Authorization: 'Bearer ' + getStore({ name: 'access_token' })
            },
            paramData: {
              rawInsNo: '',
              lineNumber: ''
            },
            row: null,
            proIndex: 0,
            deviceCode: false,
@@ -384,7 +497,7 @@
        let val = sessionStorage.getItem("raw-resultVal-"+this.dataForm.id)
        val == undefined ? null : this.resultVal=val
      }
      this.init()
      this.init(this.dataForm.id)
      this.getDeviceList()
    },
    watch:{
@@ -395,11 +508,60 @@
      },
    },
    methods:{
      querySearch(queryString, cb){
        // 调用 callback 返回建议列表的数据
        cb([{value:'是'},{value:'否'}]);
      },
      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){
        console.log("扫描后数据",val);
        let id=val.split("id@")[1]
        if(id!=undefined&&id!=''&&id!=null){
          let filterData=this.deviceList.filter(item=>{
@@ -410,35 +572,33 @@
        this.updateDevice(this.row,this.proIndex)
        }else{
          this.$message({
          message: '未识别出二位码计量器具信息!',
          message: '二维码未识别出计量器具信息!',
          type: 'warning'
        });
        }
      },
      codeDevice(row,index){
        this.row=row
        this.row=row
        console.log("row",row);
        this.deviceCode =true
        this.$refs.codeDeviceCompont.openCamera()
        this.proIndex=index
      },
      getResultInfo(data){
        console.log("扫描后执行",data);
        if(!data.includes("part_no")){
          this.$message({
          message: '未识别出二位码零件信息!',
          message: '二维码未识别出零件信息!',
          type: 'warning'
        });
        }
        let obj=JSON.parse(data)
        let info={"code":obj["part_no"]}
        console.log("值",info);
        if(info.code!=undefined&&info.code!=''){
          this.paramObj = info
          this.showPart = true
        }else{
          this.$message({
          message: '未识别出二位码零件信息!',
          message: '二维码未识别出零件信息!',
          type: 'warning'
        });
        }
@@ -448,9 +608,9 @@
      },
       // 打开相机
      Turnonthecamera() {
        this.qrcode = true
        this.$refs.codeCompont.openCamera()
    },
          this.qrcode = true
          this.$refs.codeCompont.openCamera()
      },
      // 确认回调
      selectPart(param, nodePart, index) {
        if (typeof param !== 'undefined') {
@@ -465,8 +625,8 @@
          this.dataForm.message = param.message
          this.dataForm.projectName = param.projectName
          this.projectList = param.rawInsProducts == null ? [] : param.rawInsProducts
          param.rawInsProducts.forEach(o=>{
            this.clickAddLine(o)
          param.rawInsProducts.forEach((o,index)=>{
            this.clickAddLine(o,index)
          })
        }
@@ -540,7 +700,7 @@
        this.empiricalValueAdd = this.empiricalValueAdd + 1;
      },
      // 添加行
      clickAddLine(row) {
      clickAddLine(row,index) {
        let ele = {
            fId: Math.random(),
            father: null,
@@ -548,6 +708,8 @@
            children:[]
        }
        if(row){
          ele.isIndex = true;
          ele.parentIndex = index + 1;
          ele.father = row.father?row.father:null
          row.children.forEach(item => {
              ele.children.push({
@@ -572,6 +734,8 @@
            })
            this.list.push(ele)
        }else{
          ele.isIndex = true;
          ele.parentIndex = this.list.length + 1;
          ele.children.push({
              deviceId: null,
              deviceName: null,
@@ -579,7 +743,7 @@
              required: null,
              rpId: null,
              name: null,
              unit: null,
              unit: 'mm',
              userName: null,
              testValue: '',
              testValueList: [],
@@ -606,7 +770,7 @@
                              }
                              updateRawInsProduct(obj).then(res=>{
                                if(res.data.code === 0){
                                  this.init()
                                  this.init(this.dataForm.id)
                                }
                              })
                          }
@@ -630,9 +794,9 @@
          }
        }
      },
      init(){
        if(this.dataForm.id){
          getObj(this.dataForm.id).then(res=>{
      init(id){
        if(id){
          getObj(id).then(res=>{
            let data = res.data.data
            this.dataForm.rawInsNo = data.rawInsNo
            this.dataForm.name = data.name
@@ -647,17 +811,19 @@
            this.dataForm.createUser = data.createUser
            let userNameList = []
            this.list = []
            data.children.forEach(item => {
            data.children.forEach((item,index) => {
              if (item.children) {
                    let ele = {
                      iid: null,
                      father: null,
                      children: []
                    }
                    ele.isIndex = true;
                    ele.parentIndex = index + 1;
                    ele.iid = Math.random()
                    ele.father = item.rpFather
                    if (item.children != undefined) {
                    item.children.forEach(obj => {
                    item.children.forEach((obj) => {
                      let arr= []
                      if(obj.userName){
                        userNameList.push(obj.userName)
@@ -687,16 +853,22 @@
                    this.list.push(ele)
                }}
            })
            let rVal = '1'
            let rVal = ''
            let passNum = 0
            let unPassNum = 0
            this.list.forEach(item=>{
                if(item.children){
                  item.children.forEach(ele=>{
                    if(ele.testState == 0){
                      rVal = '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,
@@ -710,42 +882,46 @@
          this.conclusionTable = []
        }
      },
      selectBlur(e){
        console.log(e,e.target.tabIndex);
        console.log(e.target.value);
      },
      changeState(row, index) {
          if(row){
        if(row){
            let isTrue = true
            for(var i=0;i<row.testValueList.length;i++){
              let val = row.testValueList[i]
              let reg = /^[0-9]*[1-9][0-9]*$/
              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
                  row.testValueList[i] = null
                  this.$message.error("请输入6位数字或选择是否")
                  isTrue = false
              }
            }
            if(!isTrue){
              return
            }
        }
        if (row.rpId != null && row.rpId != '') {
          let val = row.testValueList.join(",")
          if (val === undefined || val === '' || val === null) {
              return
          }
          if (row.rpId != null && row.rpId != '') {
            let val = row.testValueList.join(",")
            if (val === undefined || val === '' || val === null) {
                return
            }
            let obj = {
          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("更新成功")
                } else {
                    this.$message.error("更新失败")
                }
                this.init()
            })
          }
          updateRawInsProduct(obj).then(res => {
              if (res.data.code == 0) {
                  this.$message.success("更新成功")
              } else {
                  this.$message.error("更新失败")
              }
              this.init(this.dataForm.id)
          })
        }
      },
      // 删除子项目
      delChildren(row,index,isParent) {
@@ -761,7 +937,11 @@
          let childrenIndex = this.list[i].children.findIndex(el =>{
            return el.iid == row.iid
          })
          this.list[i].children.splice(childrenIndex,1)
          if(this.list[i].children.length<2){
            this.list.splice(i,1)
          }else{
              this.list[i].children.splice(childrenIndex,1)
          }
        }
      },
      //添加子项目
@@ -773,7 +953,7 @@
          required: null,
          rpId: null,
          name: null,
          unit: null,
          unit: 'mm',
          userName: null,
          testValue: null,
          testValueList: [],
@@ -783,6 +963,7 @@
        row.children.push(obj)
      },
      save(){
        const _than = this
        let data = this.dataForm
        this.list.forEach(item=>{
          item.children.forEach(c=>{
@@ -792,9 +973,12 @@
        data.rawInsProducts = this.list
        addRawInspects(data).then(res=>{
            this.$message.success("保存成功")
            this.$router.go(-1)
            // this.$router.go(-1)
        }).catch(error=>{
          this.$message.error(error)
        })
        _than.$nextTick(()=>{
            _than.init(Number(res.data.msg))
        })
      },
      getDeviceList(){
@@ -809,14 +993,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 {
@@ -833,7 +1017,7 @@
.rawMaterial-basic {
  background-color: #fff;
  height: 155px;
  height: 170px;
  display: flex;
  flex-wrap: wrap;
  padding: 10px 20px;
@@ -1006,4 +1190,9 @@
  border: 1px solid #e4e7ed;
  border-bottom: none;
}
@media (max-width: 767px) {
  .pad-addcol-btn{
    font-size:12px;
  }
}
</style>