src/pages/qualityManagement/materialInspection/index.vue
@@ -60,8 +60,7 @@
          v-if="inspectionList.length > 0">
      <view v-for="(item, index) in inspectionList"
            :key="index">
        <view class="inspection-item"
              @click="viewDetail(item)">
        <view class="inspection-item">
          <view class="item-header">
            <view class="item-left">
              <!-- <view class="material-icon"
@@ -76,10 +75,11 @@
              </view>
            </view>
            <view class="status-tags">
              <u-tag :type="getTagType(item.checkResult)"
              <u-tag :type="getPassRateTagType(item.passRate)"
                     v-if="item.passRate != null && item.passRate !== ''"
                     size="mini"
                     class="status-tag">
                {{ item.checkResult }}
                {{ formatPassRate(item.passRate) }}
              </u-tag>
              <u-tag :type="getStateTagType(item.inspectState)"
                     size="mini"
@@ -107,8 +107,16 @@
              <text class="detail-value">{{ item.checkName || '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">数量</text>
              <text class="detail-label">总数量</text>
              <text class="detail-value">{{ item.quantity || 0 }} {{ item.unit || '' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">合格数量</text>
              <text class="detail-value">{{ item.qualifiedQuantity ?? '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">不合格数量</text>
              <text class="detail-value">{{ item.unqualifiedQuantity ?? '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">检测单位</text>
@@ -117,29 +125,29 @@
          </view>
          <!-- 操作按钮 -->
          <view class="action-buttons">
            <!-- <u-button type="primary"
            <u-button type="primary"
                      size="small"
                      class="action-btn"
                      :disabled="item.inspectState"
                      @click.stop="startInspection(item)">
              编辑
            </u-button> -->
            </u-button>
            <u-button type="info"
                      size="small"
                      class="action-btn"
                      @click.stop="viewDetail(item)">
              详情
            </u-button>
            <!-- <u-button type="success"
            <u-button type="success"
                      size="small"
                      class="action-btn"
                      :disabled="item.inspectState"
                      @click.stop="submitInspection(item)">
              提交
            </u-button> -->
            </u-button>
          </view>
          <view class="action-buttons">
            <!-- <u-button type="info"
            <u-button type="info"
                      size="small"
                      class="action-btn"
                      @click.stop="viewFileList(item)">
@@ -151,7 +159,7 @@
                      :disabled="item.inspectState || item.checkName !== ''"
                      @click.stop="assignInspector(item)">
              分配检验员
            </u-button> -->
            </u-button>
          </view>
        </view>
      </view>
@@ -163,12 +171,12 @@
    </view>
    <!-- 分页组件 -->
    <!-- 浮动新增按钮 -->
    <!-- <view class="fab-button"
    <view class="fab-button"
          @click="addInspection">
      <up-icon name="plus"
               size="24"
               color="#ffffff"></up-icon>
    </view> -->
    </view>
    <!-- 日期选择器 -->
    <up-popup v-model:show="showDate"
              mode="date"
@@ -315,11 +323,31 @@
    return inspectState ? "checkmark-circle" : "time";
  };
  // 获取标签类型
  const getTagType = checkResult => {
    if (checkResult === "合格") return "success";
    if (checkResult === "不合格") return "error";
    return "default";
  const formatPassRate = val => {
    if (val === null || val === undefined || val === "") return "-";
    const n = Number(val);
    if (Number.isNaN(n)) return String(val);
    if (n > 0 && n <= 1) return `${(n * 100).toFixed(1)}%`;
    return `${Number.isInteger(n) ? n : Number(n.toFixed(1))}%`;
  };
  const getPassRateTagType = val => {
    if (val === null || val === undefined || val === "") return "default";
    let n = Number(val);
    if (Number.isNaN(n)) return "default";
    if (n > 0 && n <= 1) n *= 100;
    if (n >= 100) return "success";
    if (n >= 60) return "warning";
    return "error";
  };
  const isFullPassByPassRate = item => {
    const v = item.passRate;
    if (v === null || v === undefined || v === "") return false;
    const n = Number(v);
    if (Number.isNaN(n)) return false;
    if (n > 0 && n <= 1) return n >= 1;
    return n >= 100;
  };
  // 获取状态标签类型
@@ -383,7 +411,7 @@
          item => !item.inspectState
        ).length;
        qualifiedCount.value = inspectionList.value.filter(
          item => item.checkResult === "合格"
          isFullPassByPassRate
        ).length;
      })
      .catch(err => {
@@ -422,6 +450,7 @@
  // 新增检验
  const addInspection = () => {
    console.log("新增检验");
    uni.navigateTo({
      url: "/pages/qualityManagement/materialInspection/add",
    });