spring
2025-12-04 f7f25f593a731ea71e307257f5cec3ba562dacda
src/pages/production/detail/twistDetail.vue
@@ -9,6 +9,7 @@
        totalAmount: 'totalAmount',
        amount: 'amount',
        unAmount: 'unAmount',
        segmentLengthNote: 'segmentLengthNote',
      }"
    />
    <view class="mx-3">
@@ -41,7 +42,7 @@
import { onLoad } from "@dcloudio/uni-app";
import ProductCard from "@/components/product_card/index.vue";
import TwistApi from "@/api/product/twist";
import { getPrepareId, setPrepareId } from "@/utils/cache";
import { getPrepareId, setPrepareId, clearPrepareId } from "@/utils/cache";
import HomeApi from "@/api/home";
const paramsId = ref();
@@ -52,18 +53,22 @@
  totalAmount: undefined,
  amount: undefined,
  unAmount: undefined,
  segmentLengthNote: undefined,
});
const detailData = ref<any>({});
const getDetailData = async (id: string) => {
  const { data } = await TwistApi.getTwistDetailById({
    id: id,
  });
  detailData.value = data;
  cardData.deviceModel = data.deviceModel;
  cardData.model = data.model;
  cardData.systemNo = data.systemNo;
  cardData.totalAmount = data.totalLength;
  cardData.amount = data.length;
  cardData.unAmount = data.unLength;
  cardData.segmentLengthNote = data.segmentLengthNote;
};
// 获取并缓存生产准备ID
@@ -72,14 +77,30 @@
    const { data } = await HomeApi.getIndex();
    if (data && data.prepareId) {
      setPrepareId(data.prepareId);
    } else {
      // 如果没有 prepareId,清空缓存
      clearPrepareId();
    }
  } catch (error) {
    console.error("获取生产准备ID失败:", error);
    // 获取失败时也清空缓存
    clearPrepareId();
  }
};
// 处理报工点击
const handleReportClick = () => {
const handleReportClick = async () => {
  // 先请求验证变更接口
  try {
    const { code } = await TwistApi.verifyChanges({ projectId: detailData.value.projectId });
    if (code !== 200) {
      return;
    }
  } catch (error) {
    console.error("验证变更失败:", error);
    return;
  }
  const prepareId = getPrepareId();
  console.log("绞线表格报工检查 - prepareId值:", prepareId);