fcx
5 天以前 dbfb045ad92072e880104e13fddb4dc7574499a1
pages/QC/XJ/detail.vue
@@ -76,7 +76,7 @@
              <view class="info-value">{{ formData.result }}</view>
            </view>
            <view v-if="formData.remarks" class="info-item">
              <view class="info-label">不合格描述</view>
              <view class="info-label">备注</view>
              <view class="info-value danger">{{ formData.remarks }}</view>
            </view>
          </view>
@@ -94,9 +94,14 @@
          <view class="input-group input1">
            <view class="input-wrapper">
              <button class="btn upload-btn" @click="chooseImage">
                <uni-icons type="upload" size="16" color="#fff"></uni-icons>
                上传/查看图片
              </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: 0;">保存结果
              </button>
              <button v-if="isShowImg" class="btn upload-btn" @click="previewImage">
                <uni-icons color="#fff" size="16" type="image"></uni-icons>
@@ -104,7 +109,7 @@
              </button>
              <button class="btn upload-btn" @click="saveRemarks">
                <uni-icons color="#fff" size="16" type="compose"></uni-icons>
                不合格描述
                备注
              </button>
            </view>
          </view>
@@ -112,13 +117,17 @@
          <!-- 响应式设计的第二个输入组 -->
          <view class="input-group input2">
            <view class="input-wrapper">
              <button class="btn upload-btn" @click="chooseImage">
                <uni-icons type="upload" size="16" color="#fff"></uni-icons>
                上传/查看图片
              </button>
              <button v-if="isShowImg" class="btn upload-btn" @click="previewImage">
                <uni-icons color="#fff" size="16" type="image"></uni-icons>
                查看图片
              </button>
              <button class="btn upload-btn" @click="saveRemarks">
                <uni-icons color="#fff" size="16" type="compose"></uni-icons>
                不合格描述
                备注
              </button>
            </view>
            <view class="input-wrapper" style="margin-top: 15px;">
@@ -156,9 +165,9 @@
              <view v-if="isNumber && !isNaN(parseFloat(item.fcheckResu))" class="simple-number-result">
                <view class="result-value">{{ item.fcheckResu }}</view>
                <view v-if="formData.unitName" class="result-unit">{{ formData.unitName }}</view>
                <view :class="{'pass': isInRange(item.fcheckResu), 'fail': !isInRange(item.fcheckResu)}"
                <view :class="{'pass': item.fstand === '√' || item.isPass === 1, 'fail': item.fstand === '×' || item.isPass === 0}"
                      class="result-status">
                  {{ isInRange(item.fcheckResu) ? '合格' : '不合格' }}
                  {{ (item.fstand === '√' || item.isPass === 1) ? '合格' : '不合格' }}
                </view>
              </view>
@@ -170,25 +179,26 @@
              </view>
            </view>
            <view class="simple-data-cell simple-action">
              <button v-if="!isNumber" class="simple-btn" @click="numberEdit(item)">
              <button v-if="!isNumber && current" class="simple-btn" @click="numberEdit(item)">
                {{ editResult(item.fcheckResu) }}
              </button>
              <button v-if="isNumber" class="simple-btn" @click="toDetail(item)">
              <button v-if="isNumber && current" class="simple-btn" @click="toDetail(item)">
                修改
              </button>
              <view v-if="!current" class="simple-disabled">已提交</view>
            </view>
          </view>
        </view>
      </view>
      <!-- 弹出层 - 不合格描述 -->
      <!-- 弹出层 - 备注 -->
      <view v-if="remarksPopup" class="overlay">
        <view class="popup">
          <h3>修改不合格描述</h3>
          <h3>修改备注</h3>
          <form>
            <view class="form-group">
              <label class="form-label">不合格描述:</label>
              <input v-model="remarks" class="form-input" placeholder="请输入不合格描述" type="text"/>
              <label class="form-label">备注:</label>
              <input v-model="remarks" class="form-input" placeholder="请输入备注" type="text"/>
            </view>
            <view class="popup-buttons">
              <button class="btn primary-btn" type="warn" @click="editRemarks">修改</button>
@@ -236,7 +246,8 @@
      remarks: "",
      remarksPopup: false,
      currentTab: 0,
      tabs: []
      tabs: [],
      current: true, // 添加current状态,A=true(未提交),B=false(已提交)
    }
  },
  methods: {
@@ -292,15 +303,23 @@
      let fstand = "√";
      //有最大值和最小值就根据是否符合标准值更新判定结果,没有最大值和最小值就根据是否通过检验判定结果
      if (this.formData.maxValue && this.formData.minValue) {
      if (this.formData.maxValue != null && this.formData.minValue != null) {
        if (!this.formData.fcheckResu) {
          this.$showMessage("请输入检验值");
          return;
        }
        if (this.formData.fcheckResu >= this.formData.minValue && this.formData.fcheckResu <= this.formData
            .maxValue) {
        let checkValue = Number(this.formData.fcheckResu);
        let minValue = Number(this.formData.minValue);
        let maxValue = Number(this.formData.maxValue);
        if (isNaN(checkValue) || isNaN(minValue) || isNaN(maxValue)) {
          this.$showMessage("检验值或范围值格式不正确,请检查输入");
          return;
        }
        if (checkValue >= minValue && checkValue <= maxValue) {
          fstand = "√"
        } else {
          fstand = "×";
@@ -348,6 +367,10 @@
        }
      }).then(res => {
        this.formData = res.data.tbBillList.itemXj01;
        // 确保formData包含id属性,用于图片上传功能
        if (!this.formData.id && this.id) {
          this.formData.id = this.id;
        }
        this.tableData = res.data.tbBillList.itemXj02s;
@@ -356,7 +379,7 @@
          this.base64Image = 'data:image/jpeg;base64,' + this.formData.imageData;
        }
        if (this.formData.maxValue && this.formData.minValue && this.formData.standardValue) {
        if (this.formData.maxValue != null && this.formData.minValue != null && this.formData.standardValue != null) {
          this.isNumber = true;
        }
      })
@@ -378,15 +401,23 @@
      let fstand = "√";
      if (this.formData.maxValue && this.formData.minValue) {
      if (this.formData.maxValue != null && this.formData.minValue != null) {
        if (!this.editData.fcheckResu) {
          this.$showMessage("请输入检验值");
          return;
        }
        if (this.editData.fcheckResu >= this.formData.minValue && this.editData.fcheckResu <= this.formData
            .maxValue) {
        let checkValue = Number(this.editData.fcheckResu);
        let minValue = Number(this.formData.minValue);
        let maxValue = Number(this.formData.maxValue);
        if (isNaN(checkValue) || isNaN(minValue) || isNaN(maxValue)) {
          this.$showMessage("检验值或范围值格式不正确,请检查输入");
          return;
        }
        if (checkValue >= minValue && checkValue <= maxValue) {
          this.editData.isPass = 1
        } else {
          this.editData.isPass = 0
@@ -427,7 +458,6 @@
      })
    },
    numberEdit(item) {
      let fstand = "√";
      let fcheckResu = 1;
@@ -451,12 +481,19 @@
        this.refreshResult(); //刷新页面
      })
    },
    // 上传图片
    chooseImage() {
      uni.navigateTo({
        url: 'ImageItem?id=666' + this.formData.id + '&gid=' + this.gid
      });
    },
    saveRemarks() {
      this.remarksPopup = !this.remarksPopup;
      this.remarks = this.formData.remarks;
    },
    editRemarks() {
      if (this.remarks) {
      // 允许保存空字符串或空格,只检查是否为null或undefined
      if (this.remarks !== null && this.remarks !== undefined) {
        //saveRemarksGid
        this.$post({
          url: "/XJ/saveRemarksPid",
@@ -498,6 +535,13 @@
    this.billNo = params["billNo"];
    this.gid = params["gid"];
    this.currentTab = parseInt(params["index"] || 0);
    // 读取current参数,判断是否已提交
    if (params["current"] === 'A') {
      this.current = true;  // 未提交,可以修改
    } else if (params["current"] === 'B') {
      this.current = false; // 已提交,禁止修改
    }
    this.refreshResult();
    this.loadTabItems();
@@ -645,6 +689,12 @@
      color: #fff;
      padding: 0 10px;
      margin: 0;
      height: 45px;
      display: flex;
      align-items: center;
      justify-content: center;
      border: none;
      border-radius: 4px;
    }
  }
}
@@ -955,6 +1005,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;
  }
  &.danger-btn {