src/pages/equipmentManagement/repair/index.vue
@@ -37,10 +37,8 @@
              <text class="item-id">设备名称:{{ item.deviceName }}</text>
            </view>
            <view class="status-tag">
              <u-tag v-if="item.status === 1"
                     type="success">完结</u-tag>
              <u-tag v-if="item.status === 0"
                     type="error">待维修</u-tag>
              <u-tag :type="getStatusTagType(item.status)"
                     size="small">{{ getStatusText(item.status) }}</u-tag>
            </view>
          </view>
          <up-divider></up-divider>
@@ -55,15 +53,20 @@
            </view>
            <view class="detail-row">
              <text class="detail-label">报修人</text>
              <text class="detail-value">{{ item.repairName || '-' }}</text>
              <text class="detail-value">{{ item.maintenanceName || item.repairName || '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">验收人</text>
              <text class="detail-value">{{ item.acceptanceName || '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">故障现象</text>
              <text class="detail-value">{{ item.remark || '-' }}</text>
            </view>
            <view class="detail-row">
            <view class="detail-row"
                  v-if="Number(item.status) !== 0">
              <text class="detail-label">维修人</text>
              <text class="detail-value">{{ item.maintenanceName || '-' }}</text>
              <text class="detail-value">{{ item.maintenancePerson || item.maintenanceName || '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">维修结果</text>
@@ -76,19 +79,33 @@
          </view>
          <!-- 按钮区域 -->
          <view class="action-buttons">
            <u-button type="info"
                      size="small"
                      plain
                      class="action-btn"
                      @click="goDetail(item.id)">
              详情
            </u-button>
            <u-button type="primary"
                      size="small"
                      class="action-btn"
                      :disabled="item.status === 1"
                      :disabled="Number(item.status) !== 0"
                      @click="edit(item.id)">
              编辑
            </u-button>
            <u-button type="warning"
                      size="small"
                      class="action-btn"
                      :disabled="item.status === 1"
                      :disabled="Number(item.status) !== 0"
                      @click="addMaintain(item.id)">
              新增维修
            </u-button>
            <u-button type="success"
                      size="small"
                      class="action-btn"
                      :disabled="!canAccept(item)"
                      @click="goAcceptance(item.id)">
              验收
            </u-button>
            <u-button type="error"
                      size="small"
@@ -130,6 +147,30 @@
  };
  const userStore = useUserStore();
  const STATUS_MAP = {
    0: "待维修",
    3: "待验收",
    1: "完成",
    2: "维修失败",
  };
  const getStatusText = status => STATUS_MAP[Number(status)] || "-";
  const getStatusTagType = status => {
    const map = { 0: "error", 3: "warning", 1: "success", 2: "error" };
    return map[Number(status)] || "info";
  };
  const getCurrentUserName = () =>
    (userStore.nickName || userStore.name || "").trim();
  const canAccept = item => {
    if (Number(item?.status) !== 3) return false;
    const current = getCurrentUserName();
    const target = (item?.acceptanceName || "").trim();
    return Boolean(current && target && current === target);
  };
  // 搜索关键词
  const searchKeyword = ref("");
@@ -205,6 +246,24 @@
    });
  };
  const goDetail = id => {
    if (!id) return;
    uni.navigateTo({
      url: `/pages/equipmentManagement/repair/detail?id=${id}`,
    });
  };
  const goAcceptance = id => {
    if (!id) {
      showToast("参数错误");
      return;
    }
    uni.setStorageSync("repairId", id);
    uni.navigateTo({
      url: `/pages/equipmentManagement/repair/acceptance?id=${id}`,
    });
  };
  // 编辑 - 跳转到add页面,通过id区分新增还是编辑
  const edit = id => {
    if (!id) return;
@@ -262,6 +321,7 @@
  }
  .action-buttons {
    gap: 8px; // 与公共样式中的 12px 不同
    flex-wrap: wrap;
    gap: 8px;
  }
</style>