fcx
4 天以前 6ca81c89d606b5be26c8b8526b191ae8e773167b
pages/QC/SJ/detail.vue
@@ -40,15 +40,16 @@
              <view class="info-label">检验数</view>
              <view class="info-value">{{ formData.levelNum }}</view>
            </view>
            <view v-if="formData.minValue" class="info-item">
            <!-- 修复:使用更准确的判断条件,避免0被误判为falsy -->
            <view v-if="formData.minValue != null" class="info-item">
              <view class="info-label">下限</view>
              <view class="info-value">{{ formData.minValue }}</view>
            </view>
            <view v-if="formData.standardValue" class="info-item">
            <view v-if="formData.standardValue != null" class="info-item">
              <view class="info-label">标准值</view>
              <view class="info-value">{{ formData.standardValue }}</view>
            </view>
            <view v-if="formData.maxValue" class="info-item">
            <view v-if="formData.maxValue != null" class="info-item">
              <view class="info-label">上限</view>
              <view class="info-value">{{ formData.maxValue }}</view>
            </view>
@@ -69,11 +70,11 @@
        <view class="section-header">检验结果</view>
        <view class="section-body">
          <view class="info-grid">
            <view v-if="formData.result" class="info-item">
            <view v-if="formData.result != null" class="info-item">
              <view class="info-label">预览结果</view>
              <view class="info-value">{{ formData.result }}</view>
            </view>
            <view v-if="formData.remarks" class="info-item">
            <view v-if="formData.remarks != null" class="info-item">
              <view class="info-label">备注</view>
              <view class="info-value danger">{{ formData.remarks }}</view>
            </view>
@@ -85,7 +86,8 @@
      <view class="section">
        <view class="section-header">检验结果录入</view>
        <view class="section-body">
          <view v-if="!formData.maxValue && !formData.minValue" class="info-item edit">
          <!-- 修复:使用更准确的判断条件,避免0被误判为falsy -->
          <view v-if="formData.maxValue == null && formData.minValue == null" class="info-item edit">
            <view class="info-label" style="color: #F56C6C">提示</view>
            <view class="info-value" style="color: #F56C6C">没有最大值和最小值时填写0(未通过检验)或1(通过检验)</view>
          </view>
@@ -102,7 +104,7 @@
              </button>
              <input v-if="(tableData.length < formData.levelNum)" v-model="formData.fcheckResu" class="result-input"
                     placeholder="请输入检验结果..." type="number"/>
              <button v-if="(tableData.length < formData.levelNum)" class="btn primary-btn" @click="submit">保存结果
              <button v-if="(tableData.length < formData.levelNum)" class="btn primary-btn" @click="submit" style="margin: 0px;">保存结果
              </button>
            </view>
          </view>
@@ -110,20 +112,21 @@
          <!-- 响应式设计的第二个输入组 -->
          <view class="input-group input2">
            <view class="input-wrapper">
              <button class="btn upload-btn" @click="chooseImage">
              <button class="btn upload-btn" @click="chooseImage ">
                <uni-icons type="upload" size="16" color="#fff"></uni-icons>
                上传/查看图片
              </button>
              <button v-if="current" class="btn upload-btn" @click="saveRemarks">
              <button v-if="current" class="btn upload-btn" @click="saveRemarks  ">
                <uni-icons type="compose" size="16" color="#fff"></uni-icons>
                备注
              </button>
            </view>
            <view class="input-wrapper" style="margin-top: 15px;">
              <input v-if="(tableData.length < formData.levelNum)" v-model="formData.fcheckResu" class="result-input"
              <input v-if="(tableData.length < formData.levelNum)" v-model="formData.fcheckResu" class="result-input"
                     placeholder="请输入检验结果..." type="number"/>
              <button v-if="(tableData.length < formData.levelNum) && current" class="btn primary-btn" @click="submit">保存结果
              </button>
              <button v-if="tableData.length < formData.levelNum" class="btn primary-btn" @click="submit" style="margin: 0px;" >保存结果
           </button>
            </view>
          </view>
        </view>
@@ -242,6 +245,13 @@
              return 0;
            }
          });
          // 排序后自动跳转到第一个标签
          this.currentTab = 0;
          if (this.tabs.length > 0) {
            this.id = this.tabs[0].id;
            this.refreshResult();
          }
        } else {
          // 没有项目时至少添加当前项目到标签
          this.tabs = [{id: this.id, projName: this.formData.projName || '当前项目'}];
@@ -266,8 +276,8 @@
      let count = this.formData.levelNum;
      let fstand = "√";
      //有最大值和最小值就根据是否符合标准值更新判定结果,没有最大值和最小值就根据是否通过检验判定结果
      if (this.formData.maxValue && this.formData.minValue) {
      // 修复:使用更准确的判断条件,避免0被误判为falsy
      if (this.formData.maxValue != null && this.formData.minValue != null) {
        if (!this.formData.fcheckResu) {
          this.$showMessage("请输入检验值");
@@ -338,7 +348,8 @@
          this.isShowImg = true;
          this.base64Image = 'data:image/jpeg;base64,' + this.formData.imageData;
        }
        if (this.formData.maxValue && this.formData.minValue && this.formData.standardValue) {
        // 修复:使用更准确的判断条件,避免0被误判为falsy
        if (this.formData.maxValue != null && this.formData.minValue != null && this.formData.standardValue != null) {
          this.isNumber = true;
        }
      })
@@ -370,7 +381,8 @@
      let fstand = "√";
      if (this.formData.maxValue && this.formData.minValue) {
      // 修复:使用更准确的判断条件,避免0被误判为falsy
      if (this.formData.maxValue != null && this.formData.minValue != null) {
        if (!this.editData.fcheckResu) {
          this.$showMessage("请输入检验值");
@@ -398,9 +410,13 @@
          this.editData.fcheckResu = 1
        }
        // 改进后的逻辑:根据检验结果值来判断合格与否
        if (this.editData.fcheckResu == 0 || this.editData.fcheckResu == 1) {
          // 0表示不合格,1表示合格
          if (this.editData.fcheckResu == 0) {
            fstand = "×";
          } else {
            fstand = "√";
          }
        } else {
          this.$showMessage("无标准值时,检验结果只能为0或1!");
@@ -487,14 +503,16 @@
    },
    // 判断数字是否在范围内
    isInRange(value) {
      if (!this.formData.maxValue || !this.formData.minValue) return true;
      // 修复:使用更准确的判断条件,避免0被误判为falsy
      if (this.formData.maxValue == null || this.formData.minValue == null) return true;
      const numValue = parseFloat(value);
      return numValue >= parseFloat(this.formData.minValue) &&
          numValue <= parseFloat(this.formData.maxValue);
    },
    // 获取数字结果的样式类
    getNumberResultClass(value) {
      if (!this.formData.maxValue || !this.formData.minValue) return 'number-normal';
      // 修复:使用更准确的判断条件,避免0被误判为falsy
      if (this.formData.maxValue == null || this.formData.minValue == null) return 'number-normal';
      return this.isInRange(value) ? 'number-pass' : 'number-fail';
    },
    // 获取状态结果的样式类
@@ -653,6 +671,15 @@
      border: none;
      border-radius: 4px;
    }
    .primary-btn {
      height: 45px;
      display: flex;
      align-items: center;
      justify-content: center;
      border: none;
      border-radius: 4px;
    }
  }
}
@@ -721,6 +748,13 @@
    &.primary-btn {
      background-color: $primary-color;
      color: #fff;
      height: 45px;
      display: flex;
      align-items: center;
      justify-content: center;
      border: none;
      border-radius: 4px;
      padding: 0 20px;
    }
    &.cancel-btn {