spring
2025-11-19 8cc901ed214f3885b34a07d0520fbcfd50063439
src/pages/production/twist/report/index.vue
@@ -2,7 +2,29 @@
  <view class="list">
    <z-paging ref="pagingRef" v-model="twistReportList" :fixed="false" @query="getTwistReportList">
      <template #top>
        <CardTitle title="报工信息" :hideAction="true" :full="false" @action="addReport" />
        <CardTitle title="报工信息" :hideAction="false" :full="false">
          <template #action>
            <wd-button
              icon="chart"
              :round="false"
              size="small"
              plain
              style="margin-right: 10px"
              @click="handleSelfCheck"
            >
              自检
            </wd-button>
            <wd-button
              icon="file-add"
              :round="false"
              size="small"
              custom-class="add_btn"
              @click="addReport"
            >
              新增
            </wd-button>
          </template>
        </CardTitle>
      </template>
      <wd-card v-for="item in twistReportList" :key="item.id" type="rectangle" custom-class="round">
        <template #title>
@@ -19,14 +41,6 @@
        <template #footer>
          <wd-button size="small" plain style="margin-right: 10px" @click="toAttachment(item)">
            附件
          </wd-button>
          <wd-button
            size="small"
            plain
            style="margin-right: 10px"
            @click="handleSelfCheck(item.id)"
          >
            自检
          </wd-button>
          <wd-button size="small" plain type="error" @click="handleDelete(item)">删除</wd-button>
        </template>
@@ -68,7 +82,7 @@
import TwistApi from "@/api/product/twist";
import Draw from "./draw.vue";
import HomeApi from "@/api/home";
import { setTeamId, getTeamId } from "@/utils/cache";
import { setTeamId, getTeamId, setPrepareId } from "@/utils/cache";
const drawFormRef = reactive({
  visible: false,
@@ -149,24 +163,30 @@
const twistReportList = ref<any[]>([]);
const teamId = ref<string | number | null>(null);
// 获取并缓存班组ID
// 获取并缓存班组ID和生产准备ID
const initTeamId = async () => {
  // 先尝试从缓存获取
  const cachedTeamId = getTeamId();
  if (cachedTeamId) {
    teamId.value = cachedTeamId;
    return;
  }
  // 如果缓存中没有,则调用接口获取
  // 调用接口获取最新数据
  try {
    const { data } = await HomeApi.getIndex();
    if (data && data.team) {
      teamId.value = data.team;
      setTeamId(data.team);
    if (data) {
      // 存储班组ID
      if (data.team) {
        teamId.value = data.team;
        setTeamId(data.team);
      }
      // 存储生产准备ID
      if (data.prepareId) {
        setPrepareId(data.prepareId);
      }
    }
  } catch (error) {
    console.error("获取班组ID失败:", error);
    console.error("获取数据失败:", error);
  }
};
@@ -293,11 +313,10 @@
  }
};
const handleSelfCheck = (id: string) => {
  console.log("执行自检操作,ID:", id);
  uni.showToast({
    title: "自检功能开发中",
    icon: "none",
const handleSelfCheck = () => {
  // 跳转到自检页面,传递 wireId
  uni.navigateTo({
    url: `/pages/production/twist/selfInspect/index?id=${paramsId.value}`,
  });
};