spring
2 天以前 9ced1289954c75ae3c8f55b6a1da16d9518853ae
fix: 生产详细接口对接90%
已修改1个文件
77 ■■■■ 文件已修改
src/views/productionManagement/productionOrder/Detail/index.vue 77 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/productionOrder/Detail/index.vue
@@ -50,7 +50,13 @@
                    }"
                    @click="selectProcess(idx)"
                  >
                    <span v-if="idx === active" class="step-current-badge">生产中</span>
                    <span
                      v-if="p?.status"
                      class="step-status-badge"
                      :class="`step-status-badge-${p.status}`"
                    >
                      {{ statusTagText(p.status) }}
                    </span>
                    <div v-if="p.status !== 'wait'" class="current-progress">
                      <div class="current-progress-head">
                        <span class="current-progress-title">工序进度</span>
@@ -120,7 +126,7 @@
                <el-table-column label="产出数量" prop="outputQty" min-width="110" />
                <el-table-column label="合格数量" prop="qualifiedQty" min-width="110" />
                <el-table-column label="不良数量" prop="badQty" min-width="110" />
                <el-table-column label="不合格处理" prop="remark" min-width="160" show-overflow-tooltip />
                <el-table-column label="不合格处理" prop="dealResult" min-width="160" show-overflow-tooltip />
                <el-table-column label="操作" width="150" fixed="right">
                  <template #default="{ row }">
                    <el-button type="primary" link @click="viewReportRecord(row)">
@@ -173,14 +179,13 @@
const normalizeStatus = (statusText, completionStatus, inputQty, outputQty) => {
  const s = statusText === null || statusText === undefined ? "" : String(statusText).trim();
  const lower = s.toLowerCase();
  // 常见中文状态兜底:进行中/已完成/等待
  if (s.includes("进行") || lower.includes("process") || lower.includes("doing") || lower.includes("running")) return "process";
  if (s.includes("完成") || s.includes("已完") || lower.includes("success") || lower.includes("done") || lower.includes("completed")) return "success";
  if (s.includes("待") || s.includes("未开始") || lower.includes("wait") || lower.includes("pending") || lower.includes("not_start")) return "wait";
  // 按接口实际三种状态:已生成 / 生产中 / 待生产
  if (s.includes("生产中")) return "process";
  if (s.includes("待生产")) return "wait";
  if (s.includes("已生产")) return "success";
  // 用 completionStatus 做兜底(一般为 0~100)
  // 兜底:仍按 completionStatus 做 0~100 判断
  const cs = Number(completionStatus);
  if (Number.isFinite(cs)) {
    if (cs >= 100) return "success";
@@ -188,7 +193,7 @@
    return "wait";
  }
  // 最后再用数量兜底
  // 再兜底:用数量判断
  if (Number.isFinite(inputQty) && inputQty > 0 && Number.isFinite(outputQty) && outputQty >= inputQty) return "success";
  if (Number.isFinite(outputQty) && outputQty > 0) return "process";
  return "wait";
@@ -278,7 +283,7 @@
    outputQty: Number.isFinite(outputQty) ? outputQty : 0,
    qualifiedQty: Math.max(0, Number.isFinite(qualifiedQty) ? qualifiedQty : 0),
    badQty: Number.isFinite(badQty) ? Math.max(0, badQty) : 0,
    remark: item?.remark ?? item?.remarkText ?? item?.description ?? "",
    dealResult: item?.dealResult ?? item?.dealResultText ?? item?.description ?? "",
  };
};
@@ -334,11 +339,26 @@
  return Math.round(n);
};
const statusTagText = (status) => {
  if (status === "success") return "已生产";
  if (status === "process") return "生产中";
  if (status === "wait") return "待生产";
  return String(status ?? "");
};
// el-steps: active 为当前进行中的步骤下标(模拟)
const active = computed(() => {
  const list = processes.value || [];
  const idx = list.findIndex((p) => p.status === "process");
  return idx >= 0 ? idx : 0;
  // 激活状态为“待生产”的上一条
  const firstWaitIdx = list.findIndex((p) => p?.status === "wait");
  if (firstWaitIdx > 0) return firstWaitIdx - 1;
  // 如果没有待生产:
  // - 且最后一条是生产中:激活最后一条
  // - 否则:没有激活样式
  const lastIdx = list.length - 1;
  if (lastIdx >= 0 && list[lastIdx]?.status === "process") return lastIdx;
  return null;
});
// 工序进度:用产出/投入估算(UI 先跑通,后续按真实规则替换)
@@ -563,6 +583,39 @@
    pointer-events: none;
  }
  .step-status-badge {
    position: absolute;
    top: 8px;
    right: 10px;
    z-index: 1;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    padding: 2px 8px;
    line-height: 1.2;
    pointer-events: none;
    white-space: nowrap;
    border: 1px solid transparent;
  }
  .step-status-badge-success {
    color: #67c23a;
    background: rgba(103, 194, 58, 0.14);
    border-color: rgba(103, 194, 58, 0.35);
  }
  .step-status-badge-process {
    color: #b88230;
    background: rgba(230, 162, 60, 0.18);
    border-color: rgba(230, 162, 60, 0.45);
  }
  .step-status-badge-wait {
    color: #909399;
    background: rgba(144, 147, 153, 0.12);
    border-color: rgba(144, 147, 153, 0.35);
  }
  .right-panel {
    border: 1px solid #ebeef5;
    border-radius: 10px;