value
2023-09-21 4f5549cd814eeaecd0ff04de62452d8d5fb4cbc5
src/components/view/rawInsDetail.vue
@@ -4,140 +4,74 @@
      <el-row>
        <el-col :span="12" style="line-height: 32px;">原材料检验</el-col>
        <el-col :span="12" style="text-align: right;">
          <el-button
            icon="el-icon-circle-plus-outline"
            v-show="detailId === null"
            @click="addNewRawInspect"
            style="background-color: #004ea2; color: #ffffff;"
            >提 交</el-button
          >
          <el-button
            icon="el-icon-back"
            @click="
               <el-button icon="el-icon-circle-plus-outline" v-show="detailId === null" @click="addNewRawInspect"
                  style="background-color: #004ea2; color: #ffffff;">提 交</el-button>
               <el-button icon="el-icon-back" @click="
              () => {
                goBack();
              }
            "
            >返 回</el-button
          >
            ">返 回</el-button>
        </el-col>
      </el-row>
    </div>
    <div
      class="raw-detail-info"
      :class="detailId === null ? 'raw-detail-info-edit' : ''"
    >
      <div class="raw-detail-info" :class="detailId === null ? 'raw-detail-info-edit' : ''">
      <el-form v-model="detailInfo" label-position="right" label-width="120px">
        <el-row>
          <el-col :span="7">
            <el-form-item label="来料日期:">
              <el-input
                v-if="detailId !== null"
                :disabled="detailId !== null"
                v-model="detailInfo.formTime"
              ></el-input>
              <el-date-picker
                v-else
                type="date"
                value-format="yyyy-MM-dd"
                v-model="detailInfo.formTime"
                placeholder="选择日期"
              >
                     <el-input v-if="detailId !== null" :disabled="detailId !== null" v-model="detailInfo.formTime"></el-input>
                     <el-date-picker v-else type="date" value-format="yyyy-MM-dd" v-model="detailInfo.formTime"
                        placeholder="选择日期">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="7">
            <el-form-item label="原材料名称:">
              <el-input
                v-if="detailId !== null"
                :disabled="detailId !== null"
                v-model="detailInfo.name"
              ></el-input>
              <el-input
                v-else
                v-model="detailInfo.name"
                placeholder="请输入原材料名称"
              ></el-input> </el-form-item
          ></el-col>
                     <el-input v-if="detailId !== null" :disabled="detailId !== null" v-model="detailInfo.name"></el-input>
                     <el-input v-else v-model="detailInfo.name" placeholder="请输入原材料名称"></el-input> </el-form-item></el-col>
          <el-col :span="7">
            <el-form-item label="原材料编码:">
              <el-input
                v-if="detailId !== null"
                :disabled="detailId !== null"
                v-model="detailInfo.code"
              ></el-input>
              <el-input
                v-else
                v-model="detailInfo.code"
                placeholder="请输入原材料编码"
              ></el-input>
                     <el-input v-if="detailId !== null" :disabled="detailId !== null" v-model="detailInfo.code"></el-input>
                     <el-input v-else v-model="detailInfo.code" placeholder="请输入原材料编码"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="7">
            <el-form-item label="规格型号:">
              <el-input
                v-if="detailId !== null"
                :disabled="detailId !== null"
                v-model="detailInfo.specifications"
              ></el-input>
              <el-input
                v-else
                v-model="detailInfo.specifications"
                placeholder="请输入规格型号"
              ></el-input>
                     <el-input v-if="detailId !== null" :disabled="detailId !== null"
                        v-model="detailInfo.specifications"></el-input>
                     <el-input v-else v-model="detailInfo.specifications" placeholder="请输入规格型号"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="7">
            <el-form-item label="单位:">
              <el-input
                v-if="detailId !== null"
                :disabled="detailId !== null"
                v-model="detailInfo.runit"
              ></el-input>
              <el-input
                v-else
                placeholder="请输入检验单位"
                :disabled="detailId !== null"
                v-model="detailInfo.unit"
              ></el-input>
                     <el-input v-if="detailId !== null" :disabled="detailId !== null" v-model="detailInfo.runit"></el-input>
                     <el-input v-else placeholder="请输入检验单位" :disabled="detailId !== null" v-model="detailInfo.unit"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="7">
            <el-form-item label="数量:">
              <el-input
                :placeholder="detailId !== null ? '' : '请输入检验数量'"
                :disabled="detailId !== null"
                v-model="detailInfo.number"
              ></el-input>
                     <el-input :placeholder="detailId !== null ? '' : '请输入检验数量'" :disabled="detailId !== null"
                        v-model="detailInfo.number"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="7">
            <el-form-item label="供应商名称:">
              <el-input
                :placeholder="detailId !== null ? '' : '请输入供应商名称'"
                :disabled="detailId !== null"
                v-model="detailInfo.supplier"
              ></el-input>
                     <el-input :placeholder="detailId !== null ? '' : '请输入供应商名称'" :disabled="detailId !== null"
                        v-model="detailInfo.supplier"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="7">
            <el-form-item v-show="detailId !== null" label="报检日期:">
              <el-input
                :disabled="detailId !== null"
                v-model="detailInfo.creatTime"
              ></el-input>
                     <el-input :disabled="detailId !== null" v-model="detailInfo.creatTime"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="7">
            <el-form-item v-show="detailId !== null" label="报检人:">
              <el-input
                :disabled="detailId !== null"
                v-model="detailInfo.userName"
              ></el-input>
                     <el-input :disabled="detailId !== null" v-model="detailInfo.userName"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
@@ -147,22 +81,10 @@
      <el-row>
        <el-col :span="12" style="line-height: 32px;">检验项目</el-col>
        <el-col :span="12" style="line-height: 32px; padding-top: 6px;">
          <el-button
            style="float: right;"
            @click="clickDeleteInspectionColumn()"
            >删除检验值列</el-button
          >
          <el-button
            style="float: right;margin-right: 30px;"
            @click="clickAddInspectionColumn()"
            >添加检验值列</el-button
          >
          <el-button
            v-if="detailId == null"
            style="float: right;margin-right: 30px;"
            @click="clickAddLine()"
            >添加检验行</el-button
          >
               <el-button style="float: right;" @click="clickDeleteInspectionColumn()">删除检验值列</el-button>
               <el-button style="float: right;margin-right: 30px;" @click="clickAddInspectionColumn()">添加检验值列</el-button>
               <el-button v-if="detailId == null" style="float: right;margin-right: 30px;"
                  @click="clickAddLine()">添加检验行</el-button>
        </el-col>
      </el-row>
    </div>
@@ -172,65 +94,35 @@
        </el-table-column>
        <el-table-column prop="rpName" label="项目" width="212">
          <template slot-scope="scope">
            <el-input
              v-if="detailId == null"
              v-model="scope.row.name"
              placeholder="请输入项目名称"
            ></el-input>
                  <el-input v-if="detailId == null" v-model="scope.row.name" placeholder="请输入项目名称"></el-input>
            <el-input v-else v-model="scope.row.rpName" disabled></el-input>
          </template>
        </el-table-column>
        <el-table-column prop="unit" label="单位" width="148">
          <template slot-scope="scope">
            <el-input
              v-if="detailId == null"
              v-model="scope.row.unit"
              placeholder="请输入单位"
            ></el-input>
                  <el-input v-if="detailId == null" v-model="scope.row.unit" placeholder="请输入单位"></el-input>
            <el-input v-else v-model="scope.row.rpUnit" disabled></el-input>
          </template>
        </el-table-column>
        <el-table-column prop="required" label="标准值" min-width="150">
          <template slot-scope="scope">
            <el-input
              :disabled="detailId != null"
              @blur="assertTest(scope.row)"
              v-model="scope.row.required"
              placeholder="请输入标准值"
            ></el-input>
                  <el-input :disabled="detailId != null" @blur="assertTest(scope.row)" v-model="scope.row.required"
                     placeholder="请输入标准值"></el-input>
          </template>
        </el-table-column>
        <el-table-column prop="internal" label="内控值" min-width="150">
          <template slot-scope="scope">
            <el-input
              @blur="assertTest(scope.row)"
              :disabled="detailId != null"
              v-model="scope.row.internal"
              placeholder="请输入内控值"
            ></el-input>
                  <el-input @blur="assertTest(scope.row)" :disabled="detailId != null" v-model="scope.row.internal"
                     placeholder="请输入内控值"></el-input>
          </template>
        </el-table-column>
        <el-table-column
          prop="testValue"
          label="检测值"
          min-width="150"
          v-for="(item, index) in empiricalValueAdd"
          :key="index"
        >
            <el-table-column prop="testValue" label="检测值" min-width="150" v-for="(item, index) in empiricalValueAdd"
               :key="index">
          <template slot-scope="scope">
            <el-tooltip
              :disabled="scope.row.deviceId != null"
              class="item"
              effect="dark"
              content="请先选择设备!"
              placement="top-start"
            >
              <el-input
                :disabled="scope.row.deviceId == null"
                v-model="scope.row.testValueList[index]"
                @blur="changeState(scope.row, index)"
                placeholder="请输入检测值"
              ></el-input>
                  <el-tooltip :disabled="scope.row.deviceId != null" class="item" effect="dark" content="请先选择设备!"
                     placement="top-start">
                     <el-input :disabled="scope.row.deviceId == null" v-model="scope.row.testValueList[index]"
                        @blur="changeState(scope.row, index)" placeholder="请输入检测值"></el-input>
            </el-tooltip>
          </template>
        </el-table-column>
@@ -241,28 +133,17 @@
            }}</el-button>
          </template>
        </el-table-column>
        <el-table-column
          v-if="detailId !== null"
          prop="testState"
          label="结论"
          min-width="100"
        >
            <el-table-column v-if="detailId !== null" prop="testState" label="结论" min-width="100">
          <template slot-scope="scope">
            <span
              v-show="scope.row.testState != null"
              :style="{
                  <span v-show="scope.row.testState != null" :style="{
                color: scope.row.testState === 1 ? '#67C23A' : '#F56C6C'
              }"
              >{{ scope.row.testState === 1 ? "合格" : "不合格" }}</span
            >
              }">{{ scope.row.testState === 1 ? "合格" : "不合格" }}</span>
            <span v-show="scope.row.testState == null">暂未结论</span>
          </template>
        </el-table-column>
        <el-table-column v-if="detailId == null" label="操作" width="100">
          <template slot-scope="scope">
            <el-button type="text" @click="clickDeleteline(scope)"
              >删除</el-button
            >
                  <el-button type="text" @click="clickDeleteline(scope)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
@@ -278,68 +159,38 @@
        <el-table-column prop="name" label="物料名称"> </el-table-column>
        <el-table-column v-if="detailId != null" prop="uName" label="检验员">
          <template slot-scope="scope">
            <span
              v-for="item in scope.row.uName"
              :key="item && item.uName"
              :style="{ marginRight: '8px' }"
              >{{ item }}</span
            >
                  <span v-for="item in scope.row.uName" :key="item && item.uName"
                     :style="{ marginRight: '8px' }">{{ item }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="testState" label="检验结论">
          <template slot-scope="scope">
            <span
              v-show="scope.row.testState != null"
              :style="{
                  <span v-show="scope.row.testState != null" :style="{
                color: scope.row.testState === 1 ? '#67C23A' : '#F56C6C'
              }"
              >{{ scope.row.testState === 1 ? "合格" : "不合格" }}</span
            >
              }">{{ scope.row.testState === 1 ? "合格" : "不合格" }}</span>
            <span v-show="scope.row.testState == null">暂未结论</span>
          </template>
        </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.once="submitSave">上报</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <el-dialog
      title="请选择设备"
      :visible.sync="centerDialogVisible"
      width="20%"
    >
      <el-dialog title="请选择设备" :visible.sync="centerDialogVisible" width="20%">
      <div class="div_device_dialog">
        <el-input
          placeholder="输入关键字进行过滤"
          v-model="filterText"
          style="margin-bottom: 6px;"
        >
            <el-input placeholder="输入关键字进行过滤" v-model="filterText" style="margin-bottom: 6px;">
        </el-input>
        <el-tree
          class="filter-tree"
          :data="materialOptions"
          :props="defaultProps"
          default-expand-all
          highlight-current
          @node-click="nodeClick"
          :filter-node-method="filterNode"
          ref="tree"
        >
            <el-tree class="filter-tree" :data="materialOptions" :props="defaultProps" default-expand-all highlight-current
               @node-click="nodeClick" :filter-node-method="filterNode" ref="tree">
          <div class="custom-tree-node" slot-scope="{ data }">
            <span
              ><i
                :class="
                  <span><i :class="
                  `node_i ${
                    data.children ? 'el-icon-folder-opened' : 'el-icon-tickets'
                  }`
                "
              ></i>
              {{ data.name }}</span
            >
                "></i>
                     {{ data.name }}</span>
          </div>
        </el-tree>
      </div>
@@ -352,10 +203,14 @@
</template>
<script>
import { triggerRef } from "vue";
   import {
      triggerRef
   } from "vue";
import RawIns from "./raw-ins.vue";
export default {
  components: { RawIns },
      components: {
         RawIns
      },
  props: ["goBack", "detailId"],
  created() {
    // 清空
@@ -455,7 +310,9 @@
    async getDetailInfo() {
      await this.$axios
        .get(this.$api.url.selectRawInspectsListById + `${this.detailId}`, {
          params: { id: this.detailId }
                  params: {
                     id: this.detailId
                  }
        })
        .then(res => {
          console.log(res);
@@ -499,9 +356,13 @@
      });
      this.detailInfo.rawInsProducts = this.projectTable;
      this.$axios.post(
        this.$api.url.addRawInspects,
        { ...this.detailInfo },
        { headers: { "Content-Type": "application/json" } }
               this.$api.url.addRawInspects, {
                  ...this.detailInfo
               }, {
                  headers: {
                     "Content-Type": "application/json"
                  }
               }
      ).then(res=>{
        console.log(res);
        if(res.code=="201"){
@@ -538,7 +399,7 @@
        this.$message.success("提交成功");
        this.getDetailInfo();
        this.goBack()
      });
            });
    },
    // 获取设备树内容
    getOptions() {
@@ -599,8 +460,7 @@
    },
    // 删除检验值列
    clickDeleteInspectionColumn() {
      if (this.empiricalValueAdd - 1 === 0) {
      } else {
            if (this.empiricalValueAdd - 1 === 0) {} else {
        if (this.empiricalValueAddMaxNumber != this.empiricalValueAdd - 1) {
          this.empiricalValueAdd = this.empiricalValueAdd - 1;
          this.projectTable.forEach(i => {
@@ -621,10 +481,12 @@
.node_i {
  color: orange;
}
.div_device_dialog {
  min-height: 400px;
  overflow: auto;
}
.rawInsBox {
  height: 100%;
  width: 100%;
@@ -632,24 +494,29 @@
  display: flex;
  flex-direction: column;
}
.el-table__fixed-body-wrapper {
  top: 48px;
}
.rawInsBox .title .el-button {
  height: 32px;
  border: 1px solid rgba(190, 190, 190, 0.44);
  box-shadow: 0px 2px 4px rgba(220, 220, 220, 0.41);
  padding: 0 12px;
}
.rawInsBox .title {
  margin-bottom: 10px;
  padding: 0 20px;
}
/* 检验详情 */
.raw-detail-info {
  background: #fff;
  padding: 26px 0px 11px 80px;
}
.raw-detail-info >>> .el-form-item__label {
  color: rgb(51, 51, 51);
  font-family: 微软雅黑;
@@ -657,12 +524,15 @@
  font-weight: 400;
  letter-spacing: 0px;
}
.raw-detail-info .el-input {
  width: auto;
}
.raw-detail-info.raw-detail-info-edit >>> .el-input__inner {
  background: #fff;
}
.raw-detail-info >>> .el-input__inner {
  width: 224px;
  height: 32px;
@@ -671,9 +541,11 @@
  border: 1px solid rgb(221, 221, 221);
  border-radius: 4px;
}
.raw-detail-info .el-form-item {
  margin-bottom: 24px;
}
.raw-detail-info .el-form-item .el-button {
  height: 32px;
  border: 1px solid rgba(190, 190, 190, 0.44);
@@ -689,6 +561,7 @@
  /* max-height: 360px; */
  /* overflow-y: hidden; */
}
/* 检验结论 */
.raw-conclusion-table {
  padding: 9px 14px;