xwt
12 小时以前 4a239fc4c69be2a8824fa78e29e8f50504bfed72
首检穴模数
已修改2个文件
215 ■■■■■ 文件已修改
pages/QC/SJ/detail.vue 211 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
store/index.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/QC/SJ/detail.vue
@@ -52,6 +52,14 @@
              <view class="info-label">上限</view>
              <view class="info-value">{{ formData.maxValue }}</view>
            </view>
            <view class="info-item" v-if="formData.mnum">
              <view class="info-label">开穴总数</view>
              <view class="info-value">{{ formData.mnum }}</view>
            </view>
            <view class="info-item" v-if="formData.dnum">
              <view class="info-label">堵穴号</view>
              <view class="info-value">{{ formData.dnum }}</view>
            </view>
            <view class="info-item" v-if="formData.updater">
              <view class="info-label">更新人</view>
              <view class="info-value">{{ formData.updater }}</view>
@@ -114,13 +122,13 @@
                不合格描述
              </button>
              
              <input v-if="tableData.length < formData.levelNum"
              <input v-if="!isAllCompleted"
                v-model="formData.fcheckResu"
                type="text"
                class="result-input"
                placeholder="没有最大值和最小值时填写0(未通过检验)或1(通过检验)"
                placeholder-class="placeholder" />
              <button v-if="(tableData.length < formData.levelNum)"
              <button v-if="!isAllCompleted"
                style="margin: 0px;background-color: #3498db;color:#ffffff ;" class="btn primary-btn"
                @tap="submit">保存结果</button>
            </view>
@@ -129,28 +137,36 @@
      </view>
      <!-- 结果表格 -->
      <view v-if="tableData.length > 0" class="table-container">
      <view v-if="formData.levelNum > 0" class="table-container">
        <view class="table-header">
          <view class="th">编号</view>
          <view class="th">穴号</view>
          <view class="th">记录值</view>
          <view class="th">检验结果<i style="color: rgb(0 212 68);"
              v-if="!(tableData.length < formData.levelNum)">(输入已完成)</i></view>
              v-if="isAllCompleted">(输入已完成)</i></view>
          <view class="th">操作</view>
        </view>
        <view v-for="(item, index) in tableData" :key="index" class="table-row">
        <view v-for="(item, index) in displayTableData" :key="index" class="table-row">
          <view class="td">{{ index + 1 }}</view>
          <view class="td">{{ getHoleNumber(index) }}</view>
          <view class="td">
            <view :class="['result-badge', getResultClass(item.fcheckResu, item.fstand)]">
              {{ item.fcheckResu }}
            <view class="record-value">{{ getRecordValue(item, index) }}</view>
          </view>
          <view class="td">
            <view :class="['result-badge', getResultClass(item.fcheckResu, item.fstand, index)]">
              {{ getResultText(item.fcheckResu, item.fstand, index) }}
            </view>
          </view>
          <view class="td">
            <button v-if="!isNumber" class="btn danger-btn" @tap="numberEdit(item)">
            <button v-if="!isHoleBlocked(index) && item.fcheckResu && !isNumber" class="btn danger-btn" @tap="numberEdit(item)">
              {{ editResult(item.fcheckResu) }}
            </button>
            <button v-if="isNumber" class="btn danger-btn" @tap="toDetail(item)">
            <button v-if="!isHoleBlocked(index) && item.fcheckResu && isNumber" class="btn danger-btn" @tap="toDetail(item)">
              修改
            </button>
            <span v-if="isHoleBlocked(index)" class="blocked-text">已堵穴</span>
            <span v-else-if="!item.fcheckResu" class="no-data-text">待填写</span>
          </view>
        </view>
      </view>
@@ -228,8 +244,86 @@
      tabs: []
    }
  },
  computed: {
    // 根据穴号信息生成完整的显示数据
    displayTableData() {
      const result = [];
      // 如果有穴号信息,使用穴号信息生成数据
      if (this.formData.holeNumbers && this.formData.holeNumbers.length > 0) {
        this.formData.holeNumbers.forEach((holeInfo, index) => {
          // 查找是否有对应的实际数据
          const actualData = this.tableData.find(item => {
            return this.tableData.indexOf(item) === index;
          });
          if (actualData) {
            // 如果有实际数据,使用实际数据
            result.push({
              ...actualData,
              index: index,
              holeInfo: holeInfo
            });
          } else {
            // 如果没有实际数据,创建空记录
            result.push({
              id: null,
              fcheckResu: holeInfo.isBlocked ? "/" : null,
              fstand: holeInfo.isBlocked ? "/" : null,
              index: index,
              pid: this.id,
              gid: this.gid,
              holeInfo: holeInfo
            });
          }
        });
      } else {
        // 如果没有穴号信息,使用原来的逻辑
        const levelNum = this.formData.levelNum || 0;
        for (let i = 0; i < levelNum; i++) {
          const actualData = this.tableData.find(item => {
            return this.tableData.indexOf(item) === i;
          });
          if (actualData) {
            result.push({
              ...actualData,
              index: i
            });
          } else {
            result.push({
              id: null,
              fcheckResu: null,
              fstand: null,
              index: i,
              pid: this.id,
              gid: this.gid
            });
          }
        }
      }
      return result;
    },
    // 判断是否所有检验都已完成
    isAllCompleted() {
      return this.displayTableData.every(item => item.fcheckResu !== null && item.fcheckResu !== undefined);
    }
  },
  methods: {
    getResultClass(fcheckResu, fstand) {
    getResultClass(fcheckResu, fstand, index) {
      // 检查是否被堵穴
      if (this.isHoleBlocked(index)) {
        return 'BLOCKED';
      }
      // 如果没有记录值,显示未检验样式
      if (!fcheckResu) {
        return 'PENDING';
      }
      // 根据检验结果和判定标识确定样式类
      if (fstand === '√' || fcheckResu === 'OK') {
        return 'OK';
@@ -241,12 +335,75 @@
      }
    },
    
    getResultText(fcheckResu, fstand, index) {
      // 检查是否被堵穴
      if (this.isHoleBlocked(index)) {
        return '/';
      }
      // 如果没有记录值,显示未检验
      if (!fcheckResu) {
        return '未检验';
      }
      // 根据记录值判断检验结果是否OK
      if (fstand === '√') {
        return 'OK';
      } else if (fstand === '×') {
        return 'NG';
      } else {
        // 如果没有fstand,根据fcheckResu的值判断
        if (fcheckResu === '1' || fcheckResu === 1) {
          return 'OK';
        } else if (fcheckResu === '0' || fcheckResu === 0) {
          return 'NG';
        } else {
          // 对于有上下限的数值检验,根据fcheckResu是否在范围内判断
          if (this.formData.maxValue && this.formData.minValue) {
            const value = parseFloat(fcheckResu);
            if (!isNaN(value)) {
              if (value >= this.formData.minValue && value <= this.formData.maxValue) {
                return 'OK';
              } else {
                return 'NG';
              }
            }
          }
          return fcheckResu || '未检测';
        }
      }
    },
    // ===== 新增标签切换方法 =====
    switchTab(index, id) {
      this.currentTab = index;
      // 如果需要切换检验项目,可以在这里添加逻辑
      // this.gid = id;
      // this.refreshResult();
    },
    // ===== 穴号相关方法 =====
    getHoleNumber(index) {
      const item = this.displayTableData[index];
      if (item && item.holeInfo) {
        return item.holeInfo.holeNumber;
      }
      return index + 1;
    },
    getRecordValue(item, index) {
      if (this.isHoleBlocked(index)) {
        return '/';
      }
      return item.fcheckResu || '无';
    },
    isHoleBlocked(index) {
      const item = this.displayTableData[index];
      if (item && item.holeInfo) {
        return item.holeInfo.isBlocked;
      }
      return false;
    },
    previewImage() {
@@ -292,7 +449,7 @@
          this.$showMessage("无标准值时,检验结果只能为0或1!");
          return;
        }
        count = count - this.tableData.length;
        count = 1; // 每次只填写一个记录
      }
      this.formData.updater = this.$loginInfo.account;
@@ -645,6 +802,38 @@
    background-color: rgba($danger-color, 0.1);
    color: $danger-color;
  }
  &.PENDING {
    background-color: rgba(#E6A23C, 0.1);
    color: #E6A23C;
  }
  &.BLOCKED {
    background-color: rgba(#909399, 0.1);
    color: #909399;
  }
}
.record-value {
  font-family: 'Courier New', monospace;
  font-weight: 500;
  color: #333;
  padding: 2px 4px;
  background-color: #f8f9fa;
  border-radius: 3px;
  border: 1px solid #e9ecef;
}
.no-data-text {
  color: #E6A23C;
  font-size: 12px;
  font-style: italic;
}
.blocked-text {
  color: #909399;
  font-size: 12px;
  font-style: italic;
}
.spec-text {
store/index.js
@@ -10,9 +10,9 @@
            networkFlag:'内网', 
            serverURLInt:'http://192.168.11.251:10055',//服务器体检 10.0.1.104:10054
            serverURL:'http://localhost:10055',//本地调试地址
            //serverAPI:'http://localhost:5184/api',//当前正在使用的服务器,默认为外网  localhost
            serverAPI:'http://localhost:5184/api',//当前正在使用的服务器,默认为外网  localhost
            //serverAPI:'http://192.168.1.22:10054/api',//内网 
            serverAPI:'http://36.26.21.214:10055/api',
            //serverAPI:'http://36.26.21.214:10054/api',
            ftpServer:'ftp://36.26.21.214',//FTP服务器地址
        }
    },