src/views/business/inspectionTask/components/InspectionWord.vue
@@ -48,13 +48,23 @@
                placeholder="请输入检测地点" size="small" style="width: 200px"
                @change="m => subOtherForm(m, 'detectionPlace')"></el-input>
            </el-form-item>
            <el-form-item v-if="isDirectTemplateOrder()" label="设备:">
            <el-form-item label="设备:">
              <el-select v-model="currentOtherForm.deviceIds" :disabled="state != 1" multiple filterable clearable
                size="small" placeholder="请选择设备" style="width: 360px"
                @change="m => subOtherForm(m, 'deviceIds')">
                <el-option v-for="device in deviceOptions" :key="device.id" :label="device.label"
                  :value="device.id" />
              </el-select>
            </el-form-item>
          </el-form>
          <el-form :inline="true" :model="currentOtherForm" class="form-inline template-panel__conclusion--divided"
            size="small" label-width="84px">
            <el-form-item label="检验结论:">
              <el-radio-group v-model="currentOtherForm.insResult" :disabled="state != 2"
                @change="m => subOtherForm(m, 'insResult')">
                <el-radio :label="1">合格</el-radio>
                <el-radio :label="0">不合格</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-form>
        </div>
@@ -105,9 +115,9 @@
                      </el-select>
                    </template>
                    <template v-else-if="n.v.ps != undefined && n.v.ps.value === '计算值' && state == 1"><span
                        :style="`font-family:${n.v.ff} !important;`">{{ toFixed(n.v.v, n.v.ct) }}</span></template>
                        :style="`font-family:${n.v.ff} !important;`">{{ n.v.v }}</span></template>
                    <template v-else-if="n.v.ps != undefined && n.v.ps.value === '最终值' && state == 1">
                      <span :style="`font-family:${n.v.ff} !important;`">{{ toFixed(n.v.v, n.v.ct) }}</span>
                      <span :style="`font-family:${n.v.ff} !important;`">{{ n.v.v }}</span>
                    </template>
                    <template v-else-if="n.v.ps != undefined && n.v.ps.value === '样品编号'">
                      <div :title="currentSample.sampleCode"
@@ -458,7 +468,8 @@
        humidity: null,
        detectionTime: null,
        detectionPlace: null,
        deviceIds: []
        deviceIds: [],
        insResult: null
      }
    }
  },
@@ -504,16 +515,15 @@
            humidity: item.humidity != null ? item.humidity : null,
            detectionTime: item.detectionTime != null ? item.detectionTime : null,
            detectionPlace: item.detectionPlace != null ? item.detectionPlace : null,
            deviceIds: Array.isArray(item.deviceIds) ? [...item.deviceIds] : []
            deviceIds: Array.isArray(item.deviceIds) ? [...item.deviceIds] : [],
            insResult: item.insResult != null ? item.insResult : null
          })
        })
        if (this.typeSource == '1') {
          this.retestTag = '1'
        }
        this.getEquipOptions(1)
        if (this.sonLaboratory === '新聚') {
          this.loadDeviceOptions()
        }
        this.loadDeviceOptions()
        // 获取当前样品的检验项
        let list = await this.getCurrentProduct(this.currentSample.id, 0)
        if (list === undefined) {
@@ -1232,13 +1242,6 @@
    getValue(v) {
      // 对页面展示数据进行处理,@,代表换行
      let str = v.v ? v.v : (v.v === 0 ? v.v : (v.ct && v.ct.s ? v.ct.s.length > 0 && v.ct.s[0].v.replace(new RegExp('\n', 'g'), '<br/>').replace(new RegExp('@', 'g'), '<br/>') : ''))
      // 对数据保留小数点进行处理
      if (v.ct && v.ct.fa && v.ct.fa.includes('.') && str) {
        let num = 0
        let str0 = v.ct.fa.split('.')[1]
        num = str0.length
        str = Number(str).toFixed(num)
      }
      if (v.v && typeof v.v == 'string' && v.v.includes('@')) {
        str = v.v.replace(new RegExp('@', 'g'), '<br/>')
      }
@@ -1345,11 +1348,6 @@
        })
      }
    },
    // 新聚直接绑定模板的单据,设备按模板选择
    isDirectTemplateOrder() {
      return this.sonLaboratory === '新聚' && this.currentSample &&
        (this.currentSample.insProduct || []).some(product => product.templateRowIndex != null)
    },
    loadDeviceOptions() {
      search({ status: 0 }).then(res => {
        this.deviceOptions = (res.data || []).map(device => ({
@@ -1369,13 +1367,23 @@
    upInsReview(e) {
      if (e == 1) {
        // 通过
        // 每个模板都要有结论;全部合格才算整单合格
        const insResults = this.tableLists.map(
          item => (this.otherForm[item.templateId] || {}).insResult
        )
        const missingIndex = insResults.findIndex(result => result !== 0 && result !== 1)
        if (missingIndex > -1) {
          this.$message.error(`请选择「${this.tableLists[missingIndex].templateName}」的检验结论`)
          return
        }
        this.reviewLoading = true;
        verifyPlan({
          orderId: this.orderId,
          type: 1,
          laboratory: this.sonLaboratory,
          tell: null,
          userId: this.checkUser
          userId: this.checkUser,
          insResult: insResults.every(result => result === 1) ? 1 : 0
        }).then(res => {
          if (res.code === 200) {
            this.$message.success("操作成功")
@@ -1423,7 +1431,8 @@
          humidity: null,
          detectionTime: null,
          detectionPlace: null,
          deviceIds: []
          deviceIds: [],
          insResult: null
        })
      }
    },
@@ -1456,7 +1465,7 @@
        if (!form.humidity) missing.push(`请填写「${m.templateName}」的湿度`)
        if (!form.detectionTime) missing.push(`请选择「${m.templateName}」的检测时间`)
        if (!form.detectionPlace) missing.push(`请填写「${m.templateName}」的检测地点`)
        if (this.isDirectTemplateOrder() && (!form.deviceIds || form.deviceIds.length === 0)) {
        if (!form.deviceIds || form.deviceIds.length === 0) {
          missing.push(`请选择「${m.templateName}」的设备`)
        }
      })
@@ -1723,26 +1732,6 @@
      }).catch(error => {
      })
    },
    /**
     * 将数值v保留ct.fa中'##'后的指定小数位数,并返回格式化后的字符串。
     *
     * @param v 要格式化的数值
     * @param ct 包含格式化配置的对象
     * @param ct.fa 格式化配置字符串,若包含'##'则按照其后的内容确定小数位数
     * @returns 格式化后的字符串或原始数值(若配置不符合要求)
     */
    toFixed(v, ct) {
      if (v && ct && ct.fa) {
        if (ct.fa.includes('.')) {
          let num = ct.fa.slice(4).length
          return Number(v).toFixed(num)
        } else {
          return v
        }
      } else {
        return v
      }
    }
  }
}
@@ -1817,6 +1806,11 @@
  color: #606266;
}
.template-panel__conclusion--divided {
  border-top: 1px dashed #e4e7ed;
  padding-top: 12px;
}
.center {
  width: calc(100% - 40px);
  /* max-height: 580px; */