如洲 陈
2 天以前 900e4776223c2a42d8859fc8cd635c13ffcfb3b5
pages/QC/THJ/detail.vue
@@ -1,519 +1,505 @@
<template>
  <view class="page-container">
    <!-- 检验项目表单卡片 -->
    <view class="form-card">
      <view class="form-title">
        <view class="title-icon">📋</view>
        <span>销售退货检验详情</span>
      </view>
      <view class="form-container">
        <!-- 基本信息模块 -->
        <view class="form-section">
          <view class="section-title">基本信息</view>
          <view class="form-grid">
            <view class="form-group">
              <label class="form-label">检验单号:</label>
              <input v-model="formData.releaseNo" class="form-input" disabled="true" type="text"/>
            </view>
            <view class="form-group">
              <label class="form-label">退货单号:</label>
              <input v-model="formData.returnOrderNo" class="form-input" disabled="true" type="text"/>
            </view>
            <view class="form-group">
              <label class="form-label">物料编码:</label>
              <input v-model="formData.itemNo" class="form-input" disabled="true" type="text"/>
            </view>
            <view class="form-group">
              <label class="form-label">物料名称:</label>
              <input v-model="formData.itemName" class="form-input" disabled="true" type="text"/>
            </view>
            <view class="form-group">
              <label class="form-label">退货数量:</label>
              <input v-model="formData.returnQty" class="form-input" disabled="true" type="text"/>
            </view>
            <view class="form-group">
              <label class="form-label">退货原因:</label>
              <input v-model="formData.returnReason" class="form-input" disabled="true" type="text"/>
    <view class="page-container">
      <!-- 检验项目表单卡片 -->
      <view class="form-card">
        <view class="form-title">
          <view class="title-icon">📋</view>
          <span>销售退货检验详情</span>
        </view>
        <view class="form-container">
          <!-- 基本信息模块 -->
          <view class="form-section">
            <view class="section-title">基本信息</view>
            <view class="form-grid">
              <view class="form-group">
                <label class="form-label">检验单号:</label>
                <input v-model="formData.releaseNo" class="form-input" disabled="true" type="text"/>
              </view>
              <view class="form-group">
                <label class="form-label">退货单号:</label>
                <input v-model="formData.returnOrderNo" class="form-input" disabled="true" type="text"/>
              </view>
              <view class="form-group">
                <label class="form-label">物料编码:</label>
                <input v-model="formData.itemNo" class="form-input" disabled="true" type="text"/>
              </view>
              <view class="form-group">
                <label class="form-label">物料名称:</label>
                <input v-model="formData.itemName" class="form-input" disabled="true" type="text"/>
              </view>
              <view class="form-group">
                <label class="form-label">退货数量:</label>
                <input v-model="formData.returnQty" class="form-input" disabled="true" type="text"/>
              </view>
              <view class="form-group">
                <label class="form-label">退货原因:</label>
                <input v-model="formData.returnReason" class="form-input" disabled="true" type="text"/>
              </view>
            </view>
          </view>
        </view>
        <!-- 三个模块并列容器 -->
        <view class="three-modules-container">
          <!-- 检验参数模块 -->
          <view class="module-item">
            <view class="module-header">
              <text class="module-title">检验参数</text>
          <!-- 三个模块并列容器 -->
          <view class="three-modules-container">
            <!-- 检验参数模块 -->
            <view class="module-item">
              <view class="module-header">
                <text class="module-title">检验参数</text>
              </view>
              <view class="module-content">
                <view class="form-grid">
                  <view class="form-group">
                    <label class="form-label">检验项目:</label>
                    <input v-model="formData.projName" class="form-input" disabled="true" type="text"/>
                  </view>
                  <view class="form-group">
                    <label class="form-label">检验方法:</label>
                    <input v-model="formData.inspectionMethod" class="form-input" disabled="true" type="text"/>
                  </view>
                  <view class="form-group">
                    <label class="form-label">检验标准:</label>
                    <input v-model="formData.qualityStandard" class="form-input" disabled="true" type="text"/>
                  </view>
                  <view class="form-group">
                    <label class="form-label">检验数量:</label>
                    <input v-model="formData.levelNum" class="form-input" disabled="true" type="text"/>
                  </view>
                </view>
              </view>
            </view>
            <view class="module-content">
              <view class="form-grid">
                <view class="form-group">
                  <label class="form-label">检验项目:</label>
                  <input v-model="formData.projName" class="form-input" disabled="true" type="text"/>
            <!-- 数值标准模块 - 只在有标准值时显示 -->
            <view v-if="hasStandardValues" class="module-item">
              <view class="module-header">
                <text class="module-title">数值标准</text>
              </view>
              <view class="module-content">
                <view class="form-grid">
                  <view class="form-group">
                    <label class="form-label">下限:</label>
                    <input v-model="formData.minValue" class="form-input" disabled="true" type="text"/>
                  </view>
                  <view class="form-group">
                    <label class="form-label">标准值:</label>
                    <input v-model="formData.standardValue" class="form-input" disabled="true" type="text"/>
                  </view>
                  <view class="form-group">
                    <label class="form-label">上限:</label>
                    <input v-model="formData.maxValue" class="form-input" disabled="true" type="text"/>
                  </view>
                </view>
                <view class="form-group">
                  <label class="form-label">检验方法:</label>
                  <input v-model="formData.inspectionMethod" class="form-input" disabled="true" type="text"/>
                </view>
                <view class="form-group">
                  <label class="form-label">检验标准:</label>
                  <input v-model="formData.qualityStandard" class="form-input" disabled="true" type="text"/>
                </view>
                <view class="form-group">
                  <label class="form-label">检验数量:</label>
                  <input v-model="formData.levelNum" class="form-input" disabled="true" type="text"/>
              </view>
            </view>
            <!-- 判定标准模块 -->
            <view class="module-item">
              <view class="module-header">
                <text class="module-title">判定标准</text>
              </view>
              <view class="module-content">
                <view class="form-grid">
                  <view class="form-group">
                    <label class="form-label">检验状态:</label>
                    <input :value="getDisplayResult()" class="form-input" disabled="true" type="text"/>
                  </view>
                  <view class="form-group">
                    <label class="form-label">不合格描述:</label>
                    <input v-model="formData.remarks" class="form-input" disabled="true" type="text"/>
                  </view>
                </view>
              </view>
            </view>
          </view>
          <!-- 数值标准模块 - 只在有标准值时显示 -->
          <view v-if="hasStandardValues" class="module-item">
            <view class="module-header">
              <text class="module-title">数值标准</text>
            </view>
            <view class="module-content">
              <view class="form-grid">
                <view class="form-group">
                  <label class="form-label">下限:</label>
                  <input v-model="formData.minValue" class="form-input" disabled="true" type="text"/>
                </view>
                <view class="form-group">
                  <label class="form-label">标准值:</label>
                  <input v-model="formData.standardValue" class="form-input" disabled="true" type="text"/>
                </view>
                <view class="form-group">
                  <label class="form-label">上限:</label>
                  <input v-model="formData.maxValue" class="form-input" disabled="true" type="text"/>
                </view>
          <!-- 检测结果区域 - 只在有上下限时显示 -->
          <view v-if="Number(formData.maxValue) && Number(formData.minValue)" class="form-section">
            <view class="section-title">检测结果</view>
            <view class="form-grid">
              <view class="form-group">
                <label class="form-label">检测结果:</label>
                <input v-model="fcheckResuK" class="form-input" type="number"
                       placeholder="请输入检测值"/>
              </view>
            </view>
          </view>
          <!-- 判定标准模块 -->
          <view class="module-item">
            <view class="module-header">
              <text class="module-title">判定标准</text>
            </view>
            <view class="module-content">
              <view class="form-grid">
                <view class="form-group">
                  <label class="form-label">检验状态:</label>
                  <input :value="getDisplayResult()" class="form-input" disabled="true" type="text"/>
                </view>
                <view class="form-group">
                  <label class="form-label">不合格描述:</label>
                  <input v-model="formData.remarks" class="form-input" disabled="true" type="text"/>
                </view>
              </view>
            </view>
          </view>
          <!-- 有上下限时显示保存按钮,无上下限时自动保存 -->
          <button v-if="tableData.length < formData.levelNum && Number(formData.maxValue) && Number(formData.minValue)"
                  :class="['action-btn', 'btn-primary', { 'btn-loading': isLoading }]" :disabled="isLoading" @click="submit">
           {{ isLoading ? '保存中...' : '保存检验结果' }}
          </button>
        </view>
        <!-- 检测结果区域 - 只在有上下限时显示 -->
        <view v-if="Number(formData.maxValue) && Number(formData.minValue)" class="form-section">
          <view class="section-title">检测结果</view>
          <view class="form-grid">
      </view>
      <!-- 图片显示区域 -->
      <view v-if="isShowImg" class="image-container">
        <img :src="base64Image" class="preview-image" @click="previewImage"/>
      </view>
      <!-- 检验结果表格卡片 -->
      <view class="table-card">
        <view class="table-title">
          <view class="title-icon">📊</view>
          <span>检验结果列表</span>
        </view>
        <view class="list-container">
          <uni-table ref="table" border emptyText="暂无更多数据">
            <uni-tr>
              <uni-th align="center" class="th" width="80">编号</uni-th>
              <uni-th align="center" class="th" width="120">判定结果</uni-th>
              <uni-th v-if="Number(formData.maxValue) && Number(formData.minValue)" align="center" class="th" width="100">检验结果</uni-th>
              <uni-th align="center" class="th" width="120">操作</uni-th>
            </uni-tr>
            <uni-tr v-for="(item, index) in tableData" :key="index" :class="{ 'hover-effect': isHoveringRow === index }"
                    class="table-row" @mouseenter="isHoveringRow = index"
                    @mouseleave="isHoveringRow = -1">
              <uni-td align="center">
                {{ index + 1 }}
              </uni-td>
              <uni-td align="center">
                <span v-if="item.fstand === '√'" class="result-badge pass">合格</span>
                <span v-else-if="item.fstand === '×'" class="result-badge fail">不合格</span>
                <span v-else-if="hasStandardValues && (!item.fstand || item.fstand === '')" class="result-badge pending">未检验</span>
                <span v-else class="result-badge pending">{{ item.fstand || '未判定' }}</span>
              </uni-td>
              <uni-td v-if="Number(formData.maxValue) && Number(formData.minValue)" align="center">
                <view class="result-display">
                  <!-- 有上下限时显示实际数值 -->
                  <span v-if="item.fcheckResu" class="result-number">
                    {{ item.fcheckResu }}
                  </span>
                  <!-- 其他情况 -->
                  <span v-else class="result-badge pending">
                    未检验
                  </span>
                </view>
              </uni-td>
              <uni-td align="center">
                <view class="action-group">
                  <button v-if="isNumber"
                          :class="['action-btn', 'btn-sm', 'btn-warn', { 'btn-disabled': isLoading }]" :disabled="isLoading" @click="toDetail(item)">
                    {{ isLoading ? '处理中...' : '修改' }}
                  </button>
                  <button v-if="!isNumber"
                          :class="['action-btn', 'btn-sm', 'btn-warn', { 'btn-disabled': isLoading }]" :disabled="isLoading" @click="numberEdit(item)">
                    {{ isLoading ? '处理中...' : editResult(item.fcheckResu) }}
                  </button>
                </view>
              </uni-td>
            </uni-tr>
          </uni-table>
        </view>
      </view>
      <!-- 操作按钮 -->
      <view class="action-buttons">
        <view class="button-group">
          <button :class="['action-btn', 'btn-warn', { 'btn-disabled': isLoading }]" :disabled="isLoading"
                  @click="saveRemarks">
            {{ isLoading ? '处理中...' : '添加不合格描述' }}
          </button>
        </view>
      </view>
      <!-- 修改检验结果弹出层 -->
      <view v-if="showPopup" class="overlay active">
        <view :class="{ 'popup-scale': isPopupAnimated }" class="popup" @animationend="isPopupAnimated = false">
          <view class="popup-header">
            <h3 class="popup-title">修改检验结果</h3>
            <view class="close-btn" @click="showPopup = !showPopup">×</view>
          </view>
          <form :modelValue="editData">
            <view class="form-group">
              <label class="form-label">检测结果:</label>
              <input v-model="fcheckResuK" class="form-input" type="number"
                     placeholder="请输入检测值"/>
              <label class="form-label">检验结果:</label>
              <input v-model="editData.fcheckResu" class="form-input" type="text"/>
            </view>
          </view>
            <view class="button-group">
              <button :class="['action-btn', 'btn-warn', { 'btn-loading': isEditLoading }]" :disabled="isEditLoading"
                      @click="eidt">
                {{ isEditLoading ? '修改中...' : '保存修改' }}
              </button>
              <button @click="showPopup = !showPopup">
                取消
              </button>
            </view>
          </form>
        </view>
        <!-- 有上下限时显示保存按钮,无上下限时自动保存 -->
        <button v-if="tableData.length < formData.levelNum && Number(formData.maxValue) && Number(formData.minValue)"
                :class="['action-btn', 'btn-primary', { 'btn-loading': isLoading }]" :disabled="isLoading" @click="submit">
         {{ isLoading ? '保存中...' : '保存检验结果' }}
        </button>
      </view>
    </view>
    <!-- 图片显示区域 -->
    <view v-if="isShowImg" class="image-container">
      <img :src="base64Image" class="preview-image" @click="previewImage"/>
    </view>
    <!-- 检验结果表格卡片 -->
    <view class="table-card">
      <view class="table-title">
        <view class="title-icon">📊</view>
        <span>检验结果列表</span>
      </view>
      <view class="list-container">
        <uni-table ref="table" border emptyText="暂无更多数据">
          <uni-tr>
            <uni-th align="center" class="th" width="80">编号</uni-th>
            <uni-th align="center" class="th" width="120">判定结果</uni-th>
            <uni-th v-if="Number(formData.maxValue) && Number(formData.minValue)" align="center" class="th" width="100">检验结果</uni-th>
            <uni-th align="center" class="th" width="120">操作</uni-th>
          </uni-tr>
          <uni-tr v-for="(item, index) in tableData" :key="index" :class="{ 'hover-effect': isHoveringRow === index }"
                  class="table-row" @mouseenter="isHoveringRow = index"
                  @mouseleave="isHoveringRow = -1">
            <uni-td align="center">
              {{ index + 1 }}
            </uni-td>
            <uni-td align="center">
              <span v-if="item.fstand === '√'" class="result-badge pass">合格</span>
              <span v-else-if="item.fstand === '×'" class="result-badge fail">不合格</span>
              <span v-else-if="hasStandardValues && (!item.fstand || item.fstand === '')" class="result-badge pending">未检验</span>
              <span v-else class="result-badge pending">{{ item.fstand || '未判定' }}</span>
            </uni-td>
            <uni-td v-if="Number(formData.maxValue) && Number(formData.minValue)" align="center">
              <view class="result-display">
                <!-- 有上下限时显示实际数值 -->
                <span v-if="item.fcheckResu" class="result-number">
                  {{ item.fcheckResu }}
                </span>
                <!-- 其他情况 -->
                <span v-else class="result-badge pending">
                  未检验
                </span>
              </view>
            </uni-td>
            <uni-td align="center">
              <view class="action-group">
                <button v-if="isNumber"
                        :class="['action-btn', 'btn-sm', 'btn-warn', { 'btn-disabled': isLoading }]" :disabled="isLoading" @click="toDetail(item)">
                  {{ isLoading ? '处理中...' : '修改' }}
                </button>
                <button v-if="!isNumber"
                        :class="['action-btn', 'btn-sm', 'btn-warn', { 'btn-disabled': isLoading }]" :disabled="isLoading" @click="numberEdit(item)">
                  {{ isLoading ? '处理中...' : editResult(item.fcheckResu) }}
                </button>
              </view>
            </uni-td>
          </uni-tr>
        </uni-table>
      </view>
    </view>
    <!-- 操作按钮 -->
    <view class="action-buttons">
      <view class="button-group">
        <button :class="['action-btn', 'btn-warn', { 'btn-disabled': isLoading }]" :disabled="isLoading"
                @click="saveRemarks">
          {{ isLoading ? '处理中...' : '添加不合格描述' }}
        </button>
      </view>
    </view>
    <!-- 修改检验结果弹出层 -->
    <view v-if="showPopup" class="overlay active">
      <view :class="{ 'popup-scale': isPopupAnimated }" class="popup" @animationend="isPopupAnimated = false">
        <view class="popup-header">
          <h3 class="popup-title">修改检验结果</h3>
          <view class="close-btn" @click="showPopup = !showPopup">×</view>
      <!-- 修改不合格描述弹出层 -->
      <view v-if="remarksPopup" class="overlay active">
        <view :class="{ 'popup-scale': isPopupAnimated }" class="popup" @animationend="isPopupAnimated = false">
          <view class="popup-header">
            <h3 class="popup-title">修改不合格描述</h3>
            <view class="close-btn" @click="remarksPopup = !remarksPopup">×</view>
          </view>
          <form>
            <view class="form-group">
              <label class="form-label">不合格描述:</label>
              <input v-model="remarks" class="form-input" type="text"/>
            </view>
            <view class="button-group">
              <button :class="['action-btn', 'btn-warn', { 'btn-loading': isRemarksLoading }]"
                      :disabled="isRemarksLoading" @click="editRemarks">
                {{ isRemarksLoading ? '保存中...' : '修改' }}
              </button>
              <button @click="remarksPopup = !remarksPopup">
                取消
              </button>
            </view>
          </form>
        </view>
        <form :modelValue="editData">
          <view class="form-group">
            <label class="form-label">检验结果:</label>
            <input v-model="editData.fcheckResu" class="form-input" type="text"/>
          </view>
          <view class="button-group">
            <button :class="['action-btn', 'btn-warn', { 'btn-loading': isEditLoading }]" :disabled="isEditLoading"
                    @click="eidt">
              {{ isEditLoading ? '修改中...' : '保存修改' }}
            </button>
            <button @click="showPopup = !showPopup">
              取消
            </button>
          </view>
        </form>
      </view>
    </view>
    <!-- 修改不合格描述弹出层 -->
    <view v-if="remarksPopup" class="overlay active">
      <view :class="{ 'popup-scale': isPopupAnimated }" class="popup" @animationend="isPopupAnimated = false">
        <view class="popup-header">
          <h3 class="popup-title">修改不合格描述</h3>
          <view class="close-btn" @click="remarksPopup = !remarksPopup">×</view>
        </view>
        <form>
          <view class="form-group">
            <label class="form-label">不合格描述:</label>
            <input v-model="remarks" class="form-input" type="text"/>
          </view>
          <view class="button-group">
            <button :class="['action-btn', 'btn-warn', { 'btn-loading': isRemarksLoading }]"
                    :disabled="isRemarksLoading" @click="editRemarks">
              {{ isRemarksLoading ? '保存中...' : '修改' }}
            </button>
            <button @click="remarksPopup = !remarksPopup">
              取消
            </button>
          </view>
        </form>
      </view>
    </view>
  </view>
</template>
<script>
export default {
  data() {
    return {
      formData: {},
      isNumber: false,
      hasStandardValues: false,
      checkItem: "",
      id: 0,
      gid: 0,
      billNo: "",
      showPopup: false,
      editData: {},
      tableData: [],
      isShowImg: false,
      base64Image: "",
      remarks: "",
      remarksPopup: false,
      fcheckResuK: "",
      isLoading: false,
      isEditLoading: false,
      isRemarksLoading: false,
      isHoveringRow: -1,
      isPopupAnimated: false,
    }
  },
  methods: {
    getDisplayResult() {
      // 带标准值的项目,根据表格数据中的检验结果来显示状态
      if (this.hasStandardValues) {
        // 检查表格中是否有检验结果
        const hasResult = this.tableData.some(item => item.fcheckResu && item.fcheckResu !== '');
        if (hasResult) {
          // 有检验结果时,根据最新的检验结果显示状态
          const latestResult = this.tableData.find(item => item.fcheckResu && item.fcheckResu !== '');
          if (latestResult) {
            return latestResult.fstand === '√' ? '合格' : '不合格';
  </template>
  <script>
  export default {
    data() {
      return {
        formData: {},
        isNumber: false,
        hasStandardValues: false,
        checkItem: "",
        id: 0,
        gid: 0,
        billNo: "",
        showPopup: false,
        editData: {},
        tableData: [],
        isShowImg: false,
        base64Image: "",
        remarks: "",
        remarksPopup: false,
        fcheckResuK: "",
        isLoading: false,
        isEditLoading: false,
        isRemarksLoading: false,
        isHoveringRow: -1,
        isPopupAnimated: false,
      }
    },
    methods: {
      getDisplayResult() {
        // 带标准值的项目,根据表格数据中的检验结果来显示状态
        if (this.hasStandardValues) {
          // 检查表格中是否有检验结果
          const hasResult = this.tableData.some(item => item.fcheckResu && item.fcheckResu !== '');
          if (hasResult) {
            // 有检验结果时,根据最新的检验结果显示状态
            const latestResult = this.tableData.find(item => item.fcheckResu && item.fcheckResu !== '');
            if (latestResult) {
              return latestResult.fstand === '√' ? '合格' : '不合格';
            }
          }
          // 没有检验结果时显示为空
          return '';
        } else {
          // 无标准值的项目,直接显示formData.result
          return this.formData.result || '';
        }
      },
      notifyAddPage() {
        // 通知add页面数据已更新
        uni.$emit('inspectionDataUpdated', {
          id: this.gid,  // 使用gid作为检验单ID
          gid: this.gid,
          billNo: this.billNo
        });
      },
      previewImage() {
        uni.previewImage({
          urls: [this.base64Image],
        });
      },
      editResult(fcheckResu) {
        if (fcheckResu == '1') {
          return "改为不合格";
        } else {
          return "改为合格";
        }
      },
      autoGenerateDefaultResult() {
        // 非数值型项目:自动补齐至检验数量(默认合格),便于逐条调整
        if (!this.hasStandardValues) {
          const totalNeeded = Number(this.formData.levelNum) || 0;
          const currentCount = this.tableData.length || 0;
          const remaining = totalNeeded - currentCount;
          if (remaining > 0) {
            this.$post({
              url: "/THJ/SetQSItemDetail",
              data: {
                pid: this.id,
                gid: this.gid,
                fstand: "√",
                fcheckResu: "1",
                updateBy: this.$loginInfo.account,
                count: remaining
              }
            }).then(() => {
              // 刷新数据以显示新生成的记录
              this.refreshResult();
            }).catch(() => {
              this.$showMessage("自动生成默认记录失败");
            });
          }
        }
        // 没有检验结果时显示为空
        return '';
      } else {
        // 无标准值的项目,直接显示formData.result
        return this.formData.result || '';
      }
    },
    notifyAddPage() {
      // 通知add页面数据已更新
      uni.$emit('inspectionDataUpdated', {
        id: this.gid,  // 使用gid作为检验单ID
        gid: this.gid,
        billNo: this.billNo
      });
    },
    previewImage() {
      uni.previewImage({
        urls: [this.base64Image],
      });
    },
    editResult(fcheckResu) {
      if (fcheckResu == '1') {
        return "改为不合格";
      } else {
        return "改为合格";
      }
    },
    autoGenerateDefaultResult() {
      // 检查是否已经有检验结果记录
      if (this.tableData.length === 0) {
        // 只有没有标准值时才自动生成默认的合格记录
        if (!this.hasStandardValues) {
          this.$post({
            url: "/THJ/SetQSItemDetail",
            data: {
              pid: this.id,
              gid: this.gid,
              fstand: "√",  // 默认合格
              fcheckResu: "1",  // 默认合格
              updateBy: this.$loginInfo.account,
              count: 1
            }
          }).then(res => {
            // 刷新数据以显示新生成的记录
            this.refreshResult();
          }).catch(err => {
            this.$showMessage("自动生成默认记录失败");
          });
        }
      }
    },
    submit() {
      this.isLoading = true;
      let count = this.formData.levelNum;
      let fstand = "√";
      // 检查是否有上下限
      const hasLimits = Number(this.formData.maxValue) && Number(this.formData.minValue);
      if (hasLimits) {
        // 有上下限时,所有输入都按数值处理
        if (!this.fcheckResuK) {
          this.$showMessage("请输入检验值");
          this.isLoading = false;
          return;
        }
      },
      submit() {
        this.isLoading = true;
        let count = this.formData.levelNum;
        let fstand = "√";
        
        // 检查输入是否为有效数值
        const inputValue = Number(this.fcheckResuK);
        if (isNaN(inputValue)) {
          this.$showMessage("请输入有效的数值");
          this.isLoading = false;
          return;
        }
        // 检查是否有上下限
        const hasLimits = Number(this.formData.maxValue) && Number(this.formData.minValue);
        
        // 根据上下限判断合格/不合格
        if (inputValue >= Number(this.formData.minValue) && inputValue <= Number(this.formData.maxValue)) {
        if (hasLimits) {
          // 有上下限时,所有输入都按数值处理
          if (!this.fcheckResuK) {
            this.$showMessage("请输入检验值");
            this.isLoading = false;
            return;
          }
          // 检查输入是否为有效数值
          const inputValue = Number(this.fcheckResuK);
          if (isNaN(inputValue)) {
            this.$showMessage("请输入有效的数值");
            this.isLoading = false;
            return;
          }
          // 根据上下限判断合格/不合格
          if (inputValue >= Number(this.formData.minValue) && inputValue <= Number(this.formData.maxValue)) {
            fstand = "√";
          } else {
            fstand = "×";
          }
          count = 1;
        } else {
          // 无上下限时,默认设置为合格,不需要用户输入
          this.formData.isPass = 1;
          fstand = "√";
        } else {
          fstand = "×";
          this.fcheckResuK = "1"; // 自动设置为合格
          // 确保不会超过检验数
          count = Math.min(1, this.formData.levelNum - this.tableData.length);
          if (count <= 0) {
            this.$showMessage("检验已完成,无需继续保存");
            this.isLoading = false;
            return;
          }
        }
        count = 1;
      } else {
        // 无上下限时,默认设置为合格,不需要用户输入
        this.formData.isPass = 1;
        fstand = "√";
        this.fcheckResuK = "1"; // 自动设置为合格
        // 确保不会超过检验数
        count = Math.min(1, this.formData.levelNum - this.tableData.length);
        if (count <= 0) {
          this.$showMessage("检验已完成,无需继续保存");
        this.formData.updater = this.$loginInfo.account;
        this.$post({
          url: "/THJ/SetQSItemDetail",
          data: {
            pid: this.id,
            gid: this.gid,
            fstand: fstand,
            fcheckResu: this.fcheckResuK,
            updateBy: this.formData.updater,
            count: count
          }
        }).then(res => {
          this.$showMessage("保存成功");
          // 添加小延迟确保服务器处理完成
          setTimeout(() => {
            // 先刷新数据,确保显示最新结果
            this.refreshResult().then(() => {
              // 数据刷新完成后再清空输入框
              this.fcheckResuK = "";
              // 通知add页面数据已更新
              this.notifyAddPage();
            });
          }, 500);
          this.isLoading = false;
          return;
        }
      }
      this.formData.updater = this.$loginInfo.account;
      this.$post({
        url: "/THJ/SetQSItemDetail",
        data: {
          pid: this.id,
          gid: this.gid,
          fstand: fstand,
          fcheckResu: this.fcheckResuK,
          updateBy: this.formData.updater,
          count: count
        }
      }).then(res => {
        this.$showMessage("保存成功");
        // 添加小延迟确保服务器处理完成
        setTimeout(() => {
          // 先刷新数据,确保显示最新结果
          this.refreshResult().then(() => {
            // 数据刷新完成后再清空输入框
            this.fcheckResuK = "";
            // 通知add页面数据已更新
            this.notifyAddPage();
          });
        }, 500);
        this.isLoading = false;
      }).catch(() => {
        this.$showMessage("保存失败,请重试");
        this.isLoading = false;
      });
    },
    refreshResult() {
      this.isLoading = true;
      return this.$post({
        url: "/THJ/getThjDetail02ById",
        data: {
          id: this.id
        }
      }).then(res => {
        }).catch(() => {
          this.$showMessage("保存失败,请重试");
          this.isLoading = false;
        });
      },
      refreshResult() {
        this.isLoading = true;
        return this.$post({
          url: "/THJ/getThjDetail02ById",
          data: {
            id: this.id
          }
        }).then(res => {
          this.formData = res.data.tbBillList.itemThj01;
          this.tableData = res.data.tbBillList.itemThj02s;
          if (this.formData.imageData) {
            this.isShowImg = true;
            this.base64Image = 'data:image/jpeg;base64,' + this.formData.imageData;
          }
          // 检查是否有标准值
          this.hasStandardValues = !!(this.formData.maxValue && this.formData.minValue && this.formData.standardValue);
          if (this.hasStandardValues) {
            this.isNumber = true;
            // 带标准值的项目,保持原始数据,由getDisplayResult方法处理显示
          } else {
            this.isNumber = false;
            // 没有标准值时,自动生成默认的合格记录
            this.autoGenerateDefaultResult();
          }
          this.isLoading = false;
          return res;
        }).catch(() => {
          this.$showMessage("获取数据失败");
          this.isLoading = false;
          throw new Error("获取数据失败");
        });
      },
      toDetail(item) {
        this.showPopup = !this.showPopup;
        this.editData = item;
      },
      eidt() {
        this.isEditLoading = true;
        
        this.formData = res.data.tbBillList.itemThj01;
        this.tableData = res.data.tbBillList.itemThj02s;
        if (this.formData.imageData) {
          this.isShowImg = true;
          this.base64Image = 'data:image/jpeg;base64,' + this.formData.imageData;
        }
        // 检查是否有标准值
        this.hasStandardValues = !!(this.formData.maxValue && this.formData.minValue && this.formData.standardValue);
        if (this.hasStandardValues) {
          this.isNumber = true;
          // 带标准值的项目,保持原始数据,由getDisplayResult方法处理显示
        } else {
          this.isNumber = false;
          // 没有标准值时,自动生成默认的合格记录
          this.autoGenerateDefaultResult();
        }
        this.isLoading = false;
        return res;
      }).catch(() => {
        this.$showMessage("获取数据失败");
        this.isLoading = false;
        throw new Error("获取数据失败");
      });
    },
    toDetail(item) {
      this.showPopup = !this.showPopup;
      this.editData = item;
    },
    eidt() {
      this.isEditLoading = true;
      if (!this.editData.fcheckResu) {
        this.$showMessage("请输入检验结果");
        this.isEditLoading = false;
        return;
      }
      if (this.formData.fcheckResu == this.editData.fcheckResu) {
        this.$showMessage("修改成功");
        this.showPopup = false;
        this.isEditLoading = false;
        return;
      }
      let fstand = "√";
      // 检查是否有上下限
      const hasLimits = this.formData.maxValue && this.formData.minValue;
      if (hasLimits) {
        // 有上下限时,所有输入都按数值处理
        if (!this.editData.fcheckResu) {
          this.$showMessage("请输入检验值");
          this.isEditLoading = false;
          return;
        }
        // 检查输入是否为有效数值
        const inputValue = Number(this.editData.fcheckResu);
        if (isNaN(inputValue)) {
          this.$showMessage("请输入有效的数值");
          this.isEditLoading = false;
          return;
        }
        // 根据上下限判断合格/不合格
        if (inputValue >= Number(this.formData.minValue) && inputValue <= Number(this.formData.maxValue)) {
          this.editData.isPass = 1;
          fstand = "√";
        } else {
          this.editData.isPass = 0;
          fstand = "×";
        }
      } else {
        // 无上下限时,只能输入0或1
        if (!this.editData.fcheckResu) {
          this.$showMessage("请输入检验结果");
          this.isEditLoading = false;
          return;
        }
        if (this.formData.fcheckResu == this.editData.fcheckResu) {
          this.$showMessage("修改成功");
          this.showPopup = false;
          this.isEditLoading = false;
          return;
        }
        let fstand = "√";
        
        if (this.editData.fcheckResu == 0 || this.editData.fcheckResu == 1) {
          if (this.editData.fcheckResu == 1) {
        // 检查是否有上下限
        const hasLimits = this.formData.maxValue && this.formData.minValue;
        if (hasLimits) {
          // 有上下限时,所有输入都按数值处理
          if (!this.editData.fcheckResu) {
            this.$showMessage("请输入检验值");
            this.isEditLoading = false;
            return;
          }
          // 检查输入是否为有效数值
          const inputValue = Number(this.editData.fcheckResu);
          if (isNaN(inputValue)) {
            this.$showMessage("请输入有效的数值");
            this.isEditLoading = false;
            return;
          }
          // 根据上下限判断合格/不合格
          if (inputValue >= Number(this.formData.minValue) && inputValue <= Number(this.formData.maxValue)) {
            this.editData.isPass = 1;
            fstand = "√";
          } else {
@@ -521,621 +507,637 @@
            fstand = "×";
          }
        } else {
          this.$showMessage("无标准值时,检验结果只能为0(不合格)或1(合格)!");
          this.isEditLoading = false;
          return;
          // 无上下限时,只能输入0或1
          if (!this.editData.fcheckResu) {
            this.$showMessage("请输入检验结果");
            this.isEditLoading = false;
            return;
          }
          if (this.editData.fcheckResu == 0 || this.editData.fcheckResu == 1) {
            if (this.editData.fcheckResu == 1) {
              this.editData.isPass = 1;
              fstand = "√";
            } else {
              this.editData.isPass = 0;
              fstand = "×";
            }
          } else {
            this.$showMessage("无标准值时,检验结果只能为0(不合格)或1(合格)!");
            this.isEditLoading = false;
            return;
          }
        }
      }
      this.editData.updater = this.$loginInfo.account;
      this.$post({
        url: "/THJ/UpdateQSItemDetail",
        data: {
          id: this.editData.id,
          pid: this.id,
          gid: this.gid,
          fstand: fstand,
          fcheckResu: this.editData.fcheckResu,
          updateBy: this.editData.updater,
        }
      }).then(res => {
        this.showPopup = false;
        this.$showMessage("修改成功");
        // 添加小延迟确保服务器处理完成
        setTimeout(() => {
          this.refreshResult().then(() => {
            // 通知add页面数据已更新
            this.notifyAddPage();
          });
        }, 500);
        this.isEditLoading = false;
      }).catch(() => {
        this.$showMessage("修改失败,请重试");
        this.isEditLoading = false;
      });
    },
    numberEdit(item) {
      this.isLoading = true;
      let fstand = "√";
      let fcheckResu = "1";
      // 根据当前状态切换合格/不合格
      if (item.fcheckResu === "1" || item.fcheckResu === "OK") {
        // 当前是合格,改为不合格
        fstand = "×";
        fcheckResu = "0";
      } else {
        // 当前是不合格,改为合格
        fstand = "√";
        fcheckResu = "1";
      }
      this.$post({
        url: "/THJ/UpdateQSItemDetail",
        data: {
          id: item.id,
          pid: item.pid,
          gid: item.gid,
          fstand: fstand,
          fcheckResu: fcheckResu,
          updateBy: this.$loginInfo.account,
        }
      }).then(res => {
        this.$showMessage("修改成功");
        // 添加小延迟确保服务器处理完成
        setTimeout(() => {
          this.refreshResult().then(() => {
            // 通知add页面数据已更新
            this.notifyAddPage();
          });
        }, 500);
        this.isLoading = false;
      }).catch(() => {
        this.$showMessage("修改失败,请重试");
        this.isLoading = false;
      });
    },
    saveRemarks() {
      this.remarksPopup = !this.remarksPopup;
      this.remarks = this.formData.remarks;
    },
    editRemarks() {
      this.isRemarksLoading = true;
      if (this.remarks) {
        this.editData.updater = this.$loginInfo.account;
        this.$post({
          url: "/THJ/saveRemarksPid",
          url: "/THJ/UpdateQSItemDetail",
          data: {
            pid: this.formData.id,
            remarks: this.remarks
            id: this.editData.id,
            pid: this.id,
            gid: this.gid,
            fstand: fstand,
            fcheckResu: this.editData.fcheckResu,
            updateBy: this.editData.updater,
          }
        }).then(res => {
          if (res.data.tbBillList > 0) {
            this.formData.remarks = this.remarks;
            this.remarksPopup = false;
            this.$showMessage("保存成功");
          } else {
            this.$showMessage("保存失败");
          }
          this.isRemarksLoading = false;
          this.showPopup = false;
          this.$showMessage("修改成功");
          // 添加小延迟确保服务器处理完成
          setTimeout(() => {
            this.refreshResult().then(() => {
              // 通知add页面数据已更新
              this.notifyAddPage();
            });
          }, 500);
          this.isEditLoading = false;
        }).catch(() => {
          this.$showMessage("保存失败,请重试");
          this.isRemarksLoading = false;
          this.$showMessage("修改失败,请重试");
          this.isEditLoading = false;
        });
      } else {
        this.$showMessage("请输入不合格描述");
        this.isRemarksLoading = false;
      },
      numberEdit(item) {
        this.isLoading = true;
        let fstand = "√";
        let fcheckResu = "1";
        // 根据当前状态切换合格/不合格
        if (item.fcheckResu === "1" || item.fcheckResu === "OK") {
          // 当前是合格,改为不合格
          fstand = "×";
          fcheckResu = "0";
        } else {
          // 当前是不合格,改为合格
          fstand = "√";
          fcheckResu = "1";
        }
        this.$post({
          url: "/THJ/UpdateQSItemDetail",
          data: {
            id: item.id,
            pid: item.pid,
            gid: item.gid,
            fstand: fstand,
            fcheckResu: fcheckResu,
            updateBy: this.$loginInfo.account,
          }
        }).then(res => {
          this.$showMessage("修改成功");
          // 添加小延迟确保服务器处理完成
          setTimeout(() => {
            this.refreshResult().then(() => {
              // 通知add页面数据已更新
              this.notifyAddPage();
            });
          }, 500);
          this.isLoading = false;
        }).catch(() => {
          this.$showMessage("修改失败,请重试");
          this.isLoading = false;
        });
      },
      saveRemarks() {
        this.remarksPopup = !this.remarksPopup;
        this.remarks = this.formData.remarks;
      },
      editRemarks() {
        this.isRemarksLoading = true;
        if (this.remarks) {
          this.$post({
            url: "/THJ/saveRemarksPid",
            data: {
              pid: this.formData.id,
              remarks: this.remarks
            }
          }).then(res => {
            if (res.data.tbBillList > 0) {
              this.formData.remarks = this.remarks;
              this.remarksPopup = false;
              this.$showMessage("保存成功");
            } else {
              this.$showMessage("保存失败");
            }
            this.isRemarksLoading = false;
          }).catch(() => {
            this.$showMessage("保存失败,请重试");
            this.isRemarksLoading = false;
          });
        } else {
          this.$showMessage("请输入不合格描述");
          this.isRemarksLoading = false;
        }
      }
    },
    onLoad(options) {
      //options中包含了url附带的参数
      let params = options;
      this.id = params["id"];
      this.billNo = params["billNo"];
      this.gid = params["gid"];
      this.refreshResult();
    },
    onUnload() {
      // 页面卸载时,通知父页面数据可能已更新
      // 通过事件总线通知Add.vue页面刷新数据
      uni.$emit('inspectionDataUpdated', {
        id: this.id,
        gid: this.gid
      });
    }
  },
  onLoad(options) {
    //options中包含了url附带的参数
    let params = options;
    this.id = params["id"];
    this.billNo = params["billNo"];
    this.gid = params["gid"];
    this.refreshResult();
  },
  onUnload() {
    // 页面卸载时,通知父页面数据可能已更新
    // 通过事件总线通知Add.vue页面刷新数据
    uni.$emit('inspectionDataUpdated', {
      id: this.id,
      gid: this.gid
    });
  }
}
</script>
<style>
/* 页面容器 */
.page-container {
  padding: 20px;
  background-color: #f5f5f5;
  min-height: 100vh;
}
/* 表单卡片 */
.form-card {
  background-color: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
/* 表单标题 */
.form-title {
  display: flex;
  align-items: center;
  font-size: 18px;
  color: #333;
  margin-bottom: 15px;
}
.title-icon {
  font-size: 22px;
  margin-right: 10px;
}
/* 表单容器 */
.form-container {
  padding-top: 10px;
}
/* 表单模块标题 */
.form-section {
  margin-bottom: 20px;
}
.section-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 10px;
}
/* 表格布局 */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}
/* 表单项 */
.form-group {
  display: flex;
  align-items: center;
}
.form-label {
  width: 130px;
  color: #333;
  font-size: 14px;
  font-weight: 500;
}
.form-input {
  flex: 1;
  height: 40px;
  padding: 0 10px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background-color: #f8f8f8;
  color: #666;
  font-size: 14px;
}
.form-input:disabled {
  background-color: #e9e9e9;
}
.form-input:focus {
  border-color: #007AFF;
  outline: none;
}
/* 检验结果区域 */
.tip-group {
  margin-top: 15px;
}
.tip-box {
  display: flex;
  align-items: center;
  background-color: #fff5d1;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #f0e0a7;
}
.tip-icon {
  font-size: 20px;
  color: #f39c12;
  margin-right: 10px;
}
.tip-text {
  font-size: 14px;
  color: #333;
}
.highlight {
  color: #007AFF;
  font-weight: 600;
}
/* 按钮样式 */
.action-btn {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: none;
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.3s ease;
}
.btn-primary {
  background-color: #007AFF;
}
.btn-primary:hover {
  background-color: #0056CC;
}
.btn-warn {
  background-color: #f1b344;
}
.btn-warn:hover {
  background-color: #e6a135;
}
.btn-disabled {
  background-color: #c0c0c0;
  cursor: not-allowed;
}
/* 弹出层样式 */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.overlay.active {
  opacity: 1;
}
.popup {
  background-color: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  padding: 20px;
  transform: scale(0.8);
  transition: transform 0.3s ease;
}
.popup-scale {
  transform: scale(1);
}
.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.popup-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}
.close-btn {
  font-size: 20px;
  color: #333;
  cursor: pointer;
}
/* 操作按钮组 */
.button-group {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}
.button-group button {
  width: 48%;
  padding: 10px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
/* 检验结果表格卡片 */
.table-card {
  background-color: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
/* 表格标题 */
.table-title {
  display: flex;
  align-items: center;
  font-size: 16px;
  color: #333;
  font-weight: 600;
  margin-bottom: 15px;
}
/* 表格样式 */
.uni-table {
  width: 100%;
  border-collapse: collapse;
}
.uni-th,
.uni-td {
  padding: 12px;
  text-align: center;
}
.uni-th {
  background-color: #f5f5f5;
  font-size: 14px;
  color: #666;
  font-weight: 500;
}
.table-row {
  background-color: #fff;
  border-bottom: 1px solid #e0e0e0;
}
.table-row:hover {
  background-color: #f9f9f9;
}
.result-badge {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 10px;
  color: #fff;
  display: inline-block;
}
.pass {
  background-color: #28a745;
}
.fail {
  background-color: #dc3545;
}
.pending {
  background-color: #f1b344;
}
.action-group {
  display: flex;
  gap: 10px;
}
.action-btn.btn-sm {
  width: auto;
  padding: 6px 12px;
  font-size: 12px;
}
/* 提示信息 */
.hover-effect:hover {
  background-color: #f9f9f9;
}
.btn-sm {
  font-size: 14px;
}
.btn-loading {
  background-color: #c0c0c0;
  cursor: not-allowed;
}
/* 三个模块并列容器样式 */
.three-modules-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 20px;
}
/* 模块项样式 */
.module-item {
  background-color: #f8f9fa;
  border-radius: 8px;
  padding: 15px;
  border: 1px solid #e0e0e0;
}
.module-header {
  border-bottom: 1px solid #d0d0d0;
  padding-bottom: 8px;
  margin-bottom: 12px;
}
.module-title {
  font-size: 15px;
  font-weight: 600;
  color: #333;
}
/* 检验结果显示样式 */
.result-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.result-number {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  background-color: #f8f9fa;
  padding: 8px 12px;
  border-radius: 8px;
  border: 2px solid #e0e0e0;
  display: inline-block;
  min-width: 40px;
  text-align: center;
}
/* 图片容器 */
.image-container {
  background-color: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.preview-image {
  width: 100%;
  border-radius: 8px;
  cursor: pointer;
}
/* 操作按钮区域 */
.action-buttons {
  background-color: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
/* 手机屏幕优化 */
@media (max-width: 768px) {
  </script>
  <style>
  /* 页面容器 */
  .page-container {
    padding: 10px;
    padding: 20px;
    background-color: #f5f5f5;
    min-height: 100vh;
  }
  .form-card, .table-card, .action-buttons, .image-container {
    padding: 15px;
    border-radius: 8px;
  /* 表单卡片 */
  .form-card {
    background-color: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
  /* 表单标题 */
  .form-title {
    display: flex;
    align-items: center;
    font-size: 18px;
    color: #333;
    margin-bottom: 15px;
  }
  .title-icon {
    font-size: 22px;
    margin-right: 10px;
  }
  /* 表单容器 */
  .form-container {
    padding-top: 10px;
  }
  /* 表单模块标题 */
  .form-section {
    margin-bottom: 20px;
  }
  .section-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
  }
  /* 表格布局 */
  .form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
  }
  /* 表单项 */
  .form-group {
    flex-direction: column;
    align-items: flex-start;
    display: flex;
    align-items: center;
  }
  .form-label {
    width: auto;
    margin-bottom: 5px;
    font-size: 13px;
    width: 130px;
    color: #333;
    font-size: 14px;
    font-weight: 500;
  }
  .form-input {
    width: 100%;
    height: 36px;
    font-size: 13px;
  }
  .three-modules-container {
    gap: 12px;
  }
  .module-item {
    padding: 12px;
  }
  .module-title {
    flex: 1;
    height: 40px;
    padding: 0 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #f8f8f8;
    color: #666;
    font-size: 14px;
  }
  .form-input:disabled {
    background-color: #e9e9e9;
  }
  .form-input:focus {
    border-color: #007AFF;
    outline: none;
  }
  /* 检验结果区域 */
  .tip-group {
    margin-top: 15px;
  }
  .tip-box {
    padding: 8px;
  }
  .tip-text {
    font-size: 13px;
  }
  .result-number {
    font-size: 14px;
    padding: 6px 10px;
    min-width: 35px;
  }
  .result-badge {
    font-size: 11px;
    padding: 4px 10px;
  }
}
/* 超小屏幕优化 */
@media (max-width: 480px) {
  .page-container {
    padding: 8px;
  }
  .form-card, .table-card, .action-buttons, .image-container {
    padding: 12px;
  }
  .form-input {
    height: 34px;
    font-size: 12px;
  }
  .form-label {
    font-size: 12px;
  }
  .action-btn {
    display: flex;
    align-items: center;
    background-color: #fff5d1;
    padding: 10px;
    font-size: 14px;
    border-radius: 8px;
    border: 1px solid #f0e0a7;
  }
  
  .result-number {
    font-size: 12px;
    padding: 4px 8px;
    min-width: 30px;
  .tip-icon {
    font-size: 20px;
    color: #f39c12;
    margin-right: 10px;
  }
  .tip-text {
    font-size: 14px;
    color: #333;
  }
  .highlight {
    color: #007AFF;
    font-weight: 600;
  }
  /* 按钮样式 */
  .action-btn {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: none;
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
  }
  .btn-primary {
    background-color: #007AFF;
  }
  .btn-primary:hover {
    background-color: #0056CC;
  }
  .btn-warn {
    background-color: #f1b344;
  }
  .btn-warn:hover {
    background-color: #e6a135;
  }
  .btn-disabled {
    background-color: #c0c0c0;
    cursor: not-allowed;
  }
  /* 弹出层样式 */
  .overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  .overlay.active {
    opacity: 1;
  }
  .popup {
    background-color: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    padding: 20px;
    transform: scale(0.8);
    transition: transform 0.3s ease;
  }
  .popup-scale {
    transform: scale(1);
  }
  .popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .popup-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
  }
  .close-btn {
    font-size: 20px;
    color: #333;
    cursor: pointer;
  }
  /* 操作按钮组 */
  .button-group {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
  }
  .button-group button {
    width: 48%;
    padding: 10px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
  }
  /* 检验结果表格卡片 */
  .table-card {
    background-color: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
  /* 表格标题 */
  .table-title {
    display: flex;
    align-items: center;
    font-size: 16px;
    color: #333;
    font-weight: 600;
    margin-bottom: 15px;
  }
  /* 表格样式 */
  .uni-table {
    width: 100%;
    border-collapse: collapse;
  }
  .uni-th,
  .uni-td {
    padding: 12px;
    text-align: center;
  }
  .uni-th {
    background-color: #f5f5f5;
    font-size: 14px;
    color: #666;
    font-weight: 500;
  }
  .table-row {
    background-color: #fff;
    border-bottom: 1px solid #e0e0e0;
  }
  .table-row:hover {
    background-color: #f9f9f9;
  }
  
  .result-badge {
    font-size: 10px;
    padding: 3px 8px;
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 10px;
    color: #fff;
    display: inline-block;
  }
}
</style>
  .pass {
    background-color: #28a745;
  }
  .fail {
    background-color: #dc3545;
  }
  .pending {
    background-color: #f1b344;
  }
  .action-group {
    display: flex;
    gap: 10px;
  }
  .action-btn.btn-sm {
    width: auto;
    padding: 6px 12px;
    font-size: 12px;
  }
  /* 提示信息 */
  .hover-effect:hover {
    background-color: #f9f9f9;
  }
  .btn-sm {
    font-size: 14px;
  }
  .btn-loading {
    background-color: #c0c0c0;
    cursor: not-allowed;
  }
  /* 三个模块并列容器样式 */
  .three-modules-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
  }
  /* 模块项样式 */
  .module-item {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #e0e0e0;
  }
  .module-header {
    border-bottom: 1px solid #d0d0d0;
    padding-bottom: 8px;
    margin-bottom: 12px;
  }
  .module-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
  }
  /* 检验结果显示样式 */
  .result-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
  }
  .result-number {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    background-color: #f8f9fa;
    padding: 8px 12px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    display: inline-block;
    min-width: 40px;
    text-align: center;
  }
  /* 图片容器 */
  .image-container {
    background-color: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
  .preview-image {
    width: 100%;
    border-radius: 8px;
    cursor: pointer;
  }
  /* 操作按钮区域 */
  .action-buttons {
    background-color: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
  /* 手机屏幕优化 */
  @media (max-width: 768px) {
    .page-container {
      padding: 10px;
    }
    .form-card, .table-card, .action-buttons, .image-container {
      padding: 15px;
      border-radius: 8px;
    }
    .form-grid {
      grid-template-columns: 1fr;
      gap: 12px;
    }
    .form-group {
      flex-direction: column;
      align-items: flex-start;
    }
    .form-label {
      width: auto;
      margin-bottom: 5px;
      font-size: 13px;
    }
    .form-input {
      width: 100%;
      height: 36px;
      font-size: 13px;
    }
    .three-modules-container {
      gap: 12px;
    }
    .module-item {
      padding: 12px;
    }
    .module-title {
      font-size: 14px;
    }
    .tip-box {
      padding: 8px;
    }
    .tip-text {
      font-size: 13px;
    }
    .result-number {
      font-size: 14px;
      padding: 6px 10px;
      min-width: 35px;
    }
    .result-badge {
      font-size: 11px;
      padding: 4px 10px;
    }
  }
  /* 超小屏幕优化 */
  @media (max-width: 480px) {
    .page-container {
      padding: 8px;
    }
    .form-card, .table-card, .action-buttons, .image-container {
      padding: 12px;
    }
    .form-input {
      height: 34px;
      font-size: 12px;
    }
    .form-label {
      font-size: 12px;
    }
    .action-btn {
      padding: 10px;
      font-size: 14px;
    }
    .result-number {
      font-size: 12px;
      padding: 4px 8px;
      min-width: 30px;
    }
    .result-badge {
      font-size: 10px;
      padding: 3px 8px;
    }
  }
  </style>