spring
2025-11-19 c13c2bb15b501c74fe4270b0ae763e5c9422ee39
fix: 重构绞线报工功能
已添加1个文件
已修改11个文件
532 ■■■■ 文件已修改
src/api/product/twist.ts 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/product_card/index.vue 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/production/components/Statistics.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/production/detail/twistDetail.vue 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/production/detail/wireDetail.vue 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/production/index.vue 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/production/list/index.vue 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/production/twist/components/TwistReportCard.vue 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/production/twist/report/form.vue 184 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/production/twist/report/index.vue 203 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/production/wire/attachment/index.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/cache.ts 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/product/twist.ts
@@ -87,6 +87,16 @@
      method: "DELETE",
    });
  },
  // åˆ é™¤ç»žçº¿æŠ¥å·¥
  deleteWireOutput(params: { id: number }) {
    // å°†å‚数拼接到 URL ä½œä¸º query å‚æ•°
    const queryString = `?id=${params.id}`;
    return request<BaseResult<any>>({
      url: `/strandedWire/deleteWireOutput${queryString}`,
      method: "DELETE",
    });
  },
};
export default TwistApi;
src/components/product_card/index.vue
@@ -8,6 +8,19 @@
        </wd-tag>
      </view>
    </template>
    <wd-row class="my-2" v-if="data[map.systemNo]">
      <wd-col :span="24">
        <view class="flex">
          <view class="icon_box">
            <wd-icon name="folder" color="#0D867F"></wd-icon>
          </view>
          <text class="text-[#646874] mx-2">
            è´¨é‡è¿½æº¯å·:
            <text class="text-[#252525]">{{ data[map.systemNo] }}</text>
          </text>
        </view>
      </wd-col>
    </wd-row>
    <wd-row class="my-2">
      <wd-col :span="12">
        <view class="flex">
src/pages/production/components/Statistics.vue
@@ -1,6 +1,6 @@
<template>
  <view class="statistics_box">
    <wd-row>
    <!-- <wd-row>
      <wd-col :span="12">
        <view class="h_48 px-4 flex items-center">
          <view class="icon_box">
@@ -19,7 +19,7 @@
          <text class="text-lg text-[#339599] ml-2 font-semibold">87%</text>
        </view>
      </wd-col>
    </wd-row>
    </wd-row> -->
  </view>
</template>
<style scoped lang="scss">
src/pages/production/detail/twistDetail.vue
@@ -5,6 +5,7 @@
      :map="{
        deviceModel: 'deviceModel',
        model: 'model',
        systemNo: 'systemNo',
        totalAmount: 'totalAmount',
        amount: 'amount',
        unAmount: 'unAmount',
@@ -50,6 +51,7 @@
const cardData = reactive({
  deviceModel: undefined,
  model: undefined,
  systemNo: undefined,
  totalAmount: undefined,
  amount: undefined,
  unAmount: undefined,
@@ -61,6 +63,7 @@
  });
  cardData.deviceModel = data.deviceModel;
  cardData.model = data.model;
  cardData.systemNo = data.systemNo;
  cardData.totalAmount = data.totalLength;
  cardData.amount = data.length;
  cardData.unAmount = data.unLength;
src/pages/production/detail/wireDetail.vue
@@ -5,6 +5,7 @@
      :map="{
        deviceModel: 'deviceModel',
        model: 'model',
        systemNo: 'systemNo',
        totalAmount: 'totalAmount',
        amount: 'amount',
        unAmount: 'unAmount',
@@ -50,6 +51,7 @@
const cardData = reactive({
  deviceModel: undefined,
  model: undefined,
  systemNo: undefined,
  totalAmount: undefined,
  amount: undefined,
  unAmount: undefined,
@@ -62,6 +64,7 @@
  });
  cardData.deviceModel = data.deviceModel;
  cardData.model = data.model;
  cardData.systemNo = data.systemNo;
  cardData.totalAmount = data.totalAmount;
  cardData.amount = data.amount;
  cardData.unAmount = data.unAmount;
src/pages/production/index.vue
@@ -2,7 +2,14 @@
  <view>
    <wd-row>
      <wd-col :span="21">
        <wd-search placeholder-left hide-cancel></wd-search>
        <wd-search
          v-model="searchKeyword"
          placeholder="请输入规格型号"
          placeholder-left
          hide-cancel
          @search="handleSearch"
          @clear="handleClear"
        ></wd-search>
      </wd-col>
      <wd-col :span="3">
        <view class="scan_box" @click="openScan">
@@ -14,16 +21,30 @@
      <wd-tab :title="`待生产(${total.wait})`" class="tab_bg">
        <ProductList
          ref="waitRef"
          :key="`wait-${searchKey}`"
          :api="ManageApi.getProductList"
          state="待完成"
          :model="searchKeyword"
          @ok="changeWait"
        />
      </wd-tab>
      <wd-tab :title="`部分完成(${total.partial})`" class="tab_bg">
        <ProductList
          ref="partialRef"
          :key="`partial-${searchKey}`"
          :api="ManageApi.getProductList"
          state="部分完成"
          :model="searchKeyword"
          @ok="changePartial"
        />
      </wd-tab>
      <wd-tab :title="`已生产(${total.already})`" class="tab_bg">
        <ProductList
          ref="alreadyRef"
          :key="`already-${searchKey}`"
          :api="ManageApi.getProductList"
          state="已完成"
          :model="searchKeyword"
          @ok="changeAlready"
        />
      </wd-tab>
@@ -48,10 +69,14 @@
const toast = useToast();
const waitRef = ref();
const partialRef = ref();
const alreadyRef = ref();
const tab = ref<number>(0);
const searchKeyword = ref("");
const searchKey = ref(0);
const total = reactive({
  wait: 0,
  partial: 0,
  already: 0,
});
@@ -59,10 +84,23 @@
  total.wait = num;
};
const changePartial = (num: number) => {
  total.partial = num;
};
const changeAlready = (num: number) => {
  total.already = num;
};
const handleSearch = () => {
  searchKey.value++;
};
const handleClear = () => {
  searchKeyword.value = "";
  handleSearch();
};
const openScan = () => {
  scanRef.value.triggerScan();
};
src/pages/production/list/index.vue
@@ -36,6 +36,7 @@
const map = reactive({
  deviceModel: "deviceModel",
  model: "model",
  systemNo: "systemNo",
  totalAmount: "totalAmount",
  amount: "amount",
  unAmount: "unAmount",
@@ -50,13 +51,17 @@
    type: String,
    default: "",
  },
  model: {
    type: String,
    default: "",
  },
});
const emits = defineEmits(["ok"]);
const list = ref<any[]>([]);
const toDetail = (id: number, type: string) => {
  toast.show("点击卡片");
  // toast.show("点击卡片");
  if (type == "拉丝") {
    uni.navigateTo({
      url: `/pages/production/detail/wireDetail?id=${id}`,
@@ -69,22 +74,28 @@
};
const getList = async (pageNo: number, pageSize: number) => {
  const { code, data } = await props.api({
  const params: any = {
    userName: userInfo.value.userName,
    state: props.state,
    current: pageNo,
    size: pageSize,
  });
  };
  if (props.model) {
    params.model = props.model;
  }
  const { code, data } = await props.api(params);
  if (code == 200) {
    if (data.type == "绞线") {
      map.deviceModel = "deviceModel";
      map.model = "model";
      map.systemNo = "systemNo";
      map.totalAmount = "totalLength";
      map.amount = "length";
      map.unAmount = "unLength";
    } else if (data.type == "拉丝") {
      map.deviceModel = "deviceModel";
      map.model = "model";
      map.systemNo = "systemNo";
      map.totalAmount = "totalAmount";
      map.amount = "amount";
      map.unAmount = "unAmount";
src/pages/production/twist/components/TwistReportCard.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,37 @@
<template>
  <wd-row>
    <wd-col v-for="(item, index) in data" :key="index" :span="item.span || 24" class="my-1">
      <view class="flex w-full h-[20px]">
        <view class="text-[#646874] pl-1 mr-3">{{ item.label }}</view>
        <view class="font-medium pr-1" :style="{ color: item.color ?? color }">
          {{ value[item.prop] }} {{ value[item.unitProp] }} {{ item.unit }}
        </view>
      </view>
    </wd-col>
  </wd-row>
</template>
<script lang="ts" setup>
defineProps({
  data: {
    type: Array as any,
    default: () => {
      return [];
    },
  },
  value: {
    type: Object,
    default: () => {
      return {};
    },
  },
  color: {
    type: String,
    default: "#333333",
  },
  unit: {
    type: String,
    default: "",
  },
});
</script>
src/pages/production/twist/report/form.vue
@@ -2,103 +2,139 @@
  <wd-form ref="form" :model="model" class="relative form_box">
    <wd-cell-group :border="true">
      <wd-input
        v-model="model.contractNo"
        label="领用杆号"
        label-width="100px"
        prop="contractNo"
        clearable
        placeholder="请输入领用杆号"
      />
      <wd-input
        v-model="model.status"
        label="杆重(kg)"
        label-width="100px"
        prop="status"
        clearable
        placeholder="请输入杆重"
      />
      <wd-input
        v-model="model.clientName"
        label="单丝盘号"
        label-width="100px"
        prop="clientName"
        clearable
        placeholder="请输入单丝盘号"
      />
      <wd-input
        v-model="model.workbench"
        label="实际重量(kg)"
        label-width="100px"
        prop="workbench"
        clearable
        placeholder="请输入实际重量"
      />
      <wd-input
        v-model="model.quality"
        label="盘长(m)"
        label-width="100px"
        prop="quality"
        clearable
        placeholder="请输入盘长"
      />
      <wd-input
        v-model="model.specification"
        label="理论重量(kg)"
        label-width="100px"
        prop="specification"
        clearable
        placeholder="请输入理论重量"
      />
      <wd-input
        v-model="model.disc"
        label="规格型号"
        label-width="100px"
        prop="disc"
        clearable
        placeholder="请输入规格型号"
      />
      <wd-input
        v-model="model.actuallyLength"
        label="实际盘长(m)"
        label="生产长度(m)"
        label-width="100px"
        prop="actuallyLength"
        clearable
        placeholder="请输入实际盘长"
      />
        placeholder="请输入生产长度"
        type="digit"
      >
        <template #label>
          <span style="color: #f56c6c">生产长度(m)</span>
        </template>
      </wd-input>
      <wd-input
        v-model="model.tare"
        label="盘具皮重(kg)"
        label-width="100px"
        prop="tare"
        :disabled="!isFirstReport"
        :clearable="isFirstReport"
        :placeholder="isFirstReport ? '请输入盘具皮重' : '盘具皮重自动带出'"
        type="digit"
      >
        <template #label>
          <span style="color: #f56c6c">盘具皮重(kg)</span>
        </template>
      </wd-input>
    </wd-cell-group>
  </wd-form>
</template>
<script lang="ts" setup>
import { computed, watch } from "vue";
import useFormData from "@/hooks/useFormData";
import { useToast } from "wot-design-uni";
import { useToast, dayjs } from "wot-design-uni";
import TwistApi from "@/api/product/twist";
// å®šä¹‰ props
const props = defineProps<{
  firstTareValue?: number;
  teamId?: string | number | null;
  isFirstReport?: boolean; // æ˜¯å¦æ˜¯ç¬¬ä¸€æ¡æŠ¥å·¥
}>();
// è®¡ç®—是否是第一条报工
const isFirstReport = computed(() => props.isFirstReport ?? true);
const paramsId = ref();
const toast = useToast();
const { form: model } = useFormData({
  poleNumber: undefined, // é¢†ç”¨æ†å·
  poleWeight: undefined, // æ†é‡(kg)
  monofilamentNumber: undefined, // å•丝盘号
  actuallyWeight: undefined, // å®žé™…重量(kg)
  oneLength: undefined, // ç›˜é•¿(m)
  theoryWeight: undefined, // ç†è®ºé‡é‡(kg)
  model: undefined, // è§„格型号
  actuallyLength: undefined, // å®žé™…盘长(m)
const { form: model, resetForm } = useFormData({
  actuallyLength: undefined, // ç”Ÿäº§é•¿åº¦(m)
  tare: undefined, // ç›˜å…·çš®é‡(kg)
});
// ä¸»è¡¨æ•°æ®ï¼ˆä»Žçˆ¶ç»„件传入)
const mainTableData = ref<any>({});
// è®¾ç½®ä¸»è¡¨æ•°æ®
const setMainTableData = (data: any) => {
  mainTableData.value = data;
};
// ç›‘听 firstTareValue å˜åŒ–,如果不是第一条,自动填充
watch(
  () => props.firstTareValue,
  (newVal) => {
    if (!isFirstReport.value && newVal !== undefined) {
      model.tare = newVal;
    }
  },
  { immediate: true }
);
const submit = async () => {
  const { code } = await TwistApi.addTwistOutput({
    wireId: paramsId.value,
    ...model,
  // èŽ·å–ç¬¬ä¸€æ¡æ•°æ®çš„çš®é‡å€¼ï¼Œç”¨äºŽåŽç»­æ–°å¢žçš„æŠ¥å·¥
  const firstTareValue = props.firstTareValue;
  // å¦‚果主表数据未获取,尝试重新获取
  if (!mainTableData.value.model) {
    try {
      const { data } = await TwistApi.getTwistDetailById({
        id: paramsId.value,
  });
      mainTableData.value = {
        model: data.model,
        totalLength: data.totalLength,
        systemNo: data.systemNo,
      };
    } catch (error) {
      console.error("获取主表数据失败:", error);
      toast.error("获取规格型号数据失败,请重试");
      return false;
    }
  }
  // å†æ¬¡æ£€æŸ¥ä¸»è¡¨æ•°æ®
  if (!mainTableData.value.model) {
    toast.error("规格型号数据未获取,请重试");
    return false;
  }
  const submitData = {
    teamId: props.teamId || null,
    wireId: paramsId.value,
    type: "绞线",
    actuallyLength: model.actuallyLength,
    tare: model.tare || firstTareValue,
    // ä»Žä¸»è¡¨èŽ·å–çš„å­—æ®µ
    model: mainTableData.value.model, // è§„格型号
    oneLength: mainTableData.value.totalLength,
    systemNo: mainTableData.value.systemNo,
    monofilamentNumber: undefined, // æ‰¹æ¬¡å·ï¼ˆåŽç«¯è‡ªåŠ¨ç”Ÿæˆï¼‰
    // ç”Ÿäº§æ—¥æœŸè‡ªåŠ¨è®¾ç½®ä¸ºå½“å‰æ—¶é—´
    productTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
  };
  // è°ƒè¯•日志
  console.log("提交数据:", submitData);
  console.log("主表数据:", mainTableData.value);
  const { code } = await TwistApi.addTwistOutput(submitData);
  if (code == 200) {
    toast.success("提交成功");
    resetForm();
    return true;
  } else {
    toast.error("提交失败");
    return false;
  }
};
// èŽ·å–è¡¨å•æ•°æ®
const getFormData = () => {
  return { ...model };
};
onLoad((options: any) => {
@@ -107,12 +143,12 @@
defineExpose({
  submit,
  getFormData,
  setMainTableData,
});
</script>
<style lang="scss" scoped>
.form_box {
}
.submit_btn {
  position: absolute;
  bottom: 0;
src/pages/production/twist/report/index.vue
@@ -12,15 +12,23 @@
              <text class="text-[#0D867F] ml-2 font-medium">生产人</text>
              <text class="text-[#333333] ml-2">{{ item.productUser }}</text>
            </view>
            <view class="text-[#A8A8A8]" @click="toEdit">编辑</view>
            <!-- <view class="text-[#A8A8A8]" @click="toEdit">编辑</view> -->
          </view>
        </template>
        <ProductionCard :data="cardAttr" :value="item" />
        <TwistReportCard :data="cardAttr" :value="item" />
        <template #footer>
          <wd-button size="small" plain style="margin-right: 10px" @click="toAttachment(item)">
            é™„ä»¶
          </wd-button>
          <wd-button size="small" plain @click="handleSelfCheck(item.id)">自检</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>
      </wd-card>
    </z-paging>
@@ -30,7 +38,12 @@
        <wd-button type="text" @click="cancel">取消</wd-button>
        <wd-button type="text" @click="submit">确定</wd-button>
      </view>
      <TwistForm ref="twistFormRef" />
      <TwistForm
        ref="twistFormRef"
        :first-tare-value="twistReportList.length > 0 ? twistReportList[0].tare : undefined"
        :team-id="teamId"
        :is-first-report="twistReportList.length === 0"
      />
    </wd-popup>
    <wd-popup v-model="drawFormRef.visible" position="bottom" custom-class="yl-popup">
      <Draw
@@ -47,13 +60,15 @@
<script setup lang="ts">
import CardTitle from "@/components/card-title/index.vue";
import TwistForm from "./form.vue";
import { useToast } from "wot-design-uni";
import ProductionCard from "../../components/ProductionCard.vue";
import { useToast, dayjs } from "wot-design-uni";
import TwistReportCard from "../components/TwistReportCard.vue";
import { onLoad } from "@dcloudio/uni-app";
import { ref, reactive } from "vue";
import { ref, reactive, nextTick } from "vue";
import ManageApi from "@/api/product/manage";
import TwistApi from "@/api/product/twist";
import Draw from "./draw.vue";
import HomeApi from "@/api/home";
import { setTeamId, getTeamId } from "@/utils/cache";
const drawFormRef = reactive({
  visible: false,
@@ -95,36 +110,65 @@
const cardAttr = ref<any[]>([
  {
    label: "领用杆号",
    prop: "poleNumber",
  },
  {
    label: "杆重(kg)",
    prop: "poleWeight",
  },
  {
    label: "单丝盘号",
    label: "批次号",
    prop: "monofilamentNumber",
    span: 24,
  },
  {
    label: "实际重量(kg)",
    prop: "actuallyWeight",
    label: "质量追溯号",
    prop: "systemNo",
    span: 24,
  },
  {
    label: "盘长(m)",
    prop: "oneLength",
  },
  {
    label: "理论重量(kg)",
    prop: "theoryWeight",
  },
  {
    label: "规格型号",
    prop: "model",
  },
  {
    label: "生产长度(m)",
    prop: "actuallyLength",
  },
  {
    label: "盘具皮重(kg)",
    prop: "tare",
  },
  {
    label: "生产日期",
    prop: "productTime",
    span: 24,
  },
  {
    label: "加工时间(h)",
    prop: "processHour",
  },
]);
const twistReportList = ref<any[]>([]);
const teamId = ref<string | number | null>(null);
// èŽ·å–å¹¶ç¼“å­˜ç­ç»„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);
    }
  } catch (error) {
    console.error("获取班组ID失败:", error);
  }
};
const toEdit = () => {
  uni.navigateTo({
@@ -132,23 +176,83 @@
  });
};
// ä¸»è¡¨æ•°æ®
const mainTableData = ref<any>({});
// èŽ·å–ä¸»è¡¨æ•°æ®
const getMainTableData = async () => {
  try {
    const { data } = await TwistApi.getTwistDetailById({
      id: paramsId.value,
    });
    mainTableData.value = {
      model: data.model,
      totalLength: data.totalLength,
      systemNo: data.systemNo,
    };
    // è®¾ç½®ä¸»è¡¨æ•°æ®åˆ°è¡¨å•组件
    if (twistFormRef.value) {
      twistFormRef.value.setMainTableData(mainTableData.value);
    }
  } catch (error) {
    console.error("获取主表数据失败:", error);
  }
};
const addReport = async () => {
  // æ£€æŸ¥æ˜¯å¦æ‰€æœ‰æ•°æ®éƒ½å·²ä¿å­˜ï¼ˆéƒ½æœ‰id)
  if (twistReportList.value.length > 0 && twistReportList.value.every((item) => item.id)) {
    // ç¡®ä¿ä¸»è¡¨æ•°æ®å·²èŽ·å–
    if (!mainTableData.value.model) {
      await getMainTableData();
    }
  dialog.visible = true;
  // æ‰“开新增弹窗时自动执行
  // await showDrawPopup();
    // ç­‰å¾…弹窗打开后设置数据
    await nextTick();
    if (twistFormRef.value) {
      twistFormRef.value.setMainTableData(mainTableData.value);
    }
  } else if (twistReportList.value.length === 0) {
    // ç¡®ä¿ä¸»è¡¨æ•°æ®å·²èŽ·å–
    if (!mainTableData.value.model) {
      await getMainTableData();
    }
    dialog.visible = true;
    // ç­‰å¾…弹窗打开后设置数据
    await nextTick();
    if (twistFormRef.value) {
      twistFormRef.value.setMainTableData(mainTableData.value);
    }
  } else {
    toast.warning("请先保存本条数据,再新增");
  }
};
const submit = async () => {
  // éªŒè¯å¿…填字段 - æ ¹æ®å‚考代码,需要检查生产长度和盘具皮重
  const formData = twistFormRef.value?.getFormData?.() || {};
  const firstTareValue =
    twistReportList.value.length > 0 ? twistReportList.value[0].tare : undefined;
  if (!formData.actuallyLength) {
    toast.warning("请输入生产长度后再提交");
    return;
  }
  if (!formData.tare && !firstTareValue) {
    toast.warning("请输入盘具皮重后再提交");
    return;
  }
  const isSuccess = await twistFormRef.value.submit();
  dialog.visible = !isSuccess; // å¦‚果提交成功,关闭弹窗
  if (isSuccess) {
    // æäº¤æˆåŠŸåŽæ‰§è¡Œ
    // showDrawPopup();
    dialog.visible = false;
    // æäº¤æˆåŠŸåŽåˆ·æ–°åˆ—è¡¨
    pagingRef.value?.reload();
  }
};
const cancel = () => {
  toast.show("取消");
  dialog.visible = false;
};
@@ -197,6 +301,35 @@
  });
};
// åˆ é™¤æŠ¥å·¥è®°å½•
const handleDelete = (item: any) => {
  uni.showModal({
    title: "提示",
    content: "确定删除吗?",
    success: async (res) => {
      if (res.confirm) {
        try {
          if (item.id) {
            const { code } = await TwistApi.deleteWireOutput({ id: item.id });
            if (code == 200) {
              toast.success("删除成功");
              // åˆ·æ–°åˆ—表
              pagingRef.value?.reload();
            } else {
              toast.error("删除失败");
            }
          } else {
            toast.warning("该记录尚未保存,无法删除");
          }
        } catch (error) {
          console.error("删除失败:", error);
          toast.error("删除失败,请重试");
        }
      }
    },
  });
};
// ä¿ç•™åŽŸæœ‰çš„confirm函数,用于其他地方调用
// const confirm = async () => {
//   await showDrawPopup();
@@ -208,11 +341,23 @@
    wireId: paramsId.value,
    type: "绞线",
  });
  // æ ¼å¼åŒ–生产日期
  if (Array.isArray(data)) {
    data.forEach((item: any) => {
      if (item.productTime) {
        item.productTime = dayjs(item.productTime).format("YYYY-MM-DD HH:mm:ss");
      }
    });
  }
  pagingRef.value.complete(data);
};
onLoad((options: any) => {
onLoad(async (options: any) => {
  paramsId.value = options.id;
  // èŽ·å–å¹¶ç¼“å­˜ç­ç»„ID
  await initTeamId();
  // èŽ·å–ä¸»è¡¨æ•°æ®
  await getMainTableData();
  showDrawPopup();
});
</script>
src/pages/production/wire/attachment/index.vue
@@ -526,3 +526,4 @@
src/utils/cache.ts
@@ -1,6 +1,7 @@
const TOKEN_KEY = "app-token";
const USER_INFO_KEY = "user-info";
const DICT_KEY = "dict";
const TEAM_ID_KEY = "team-id";
import { type DictData } from "@/api/system/dict";
// è®¾ç½® token
@@ -48,9 +49,25 @@
  uni.removeStorageSync(DICT_KEY);
}
// è®¾ç½®ç­ç»„ID
export function setTeamId(teamId: string | number) {
  uni.setStorageSync(TEAM_ID_KEY, teamId);
}
// èŽ·å–ç­ç»„ID
export function getTeamId(): string | number | null {
  return uni.getStorageSync(TEAM_ID_KEY) || null;
}
// æ¸…除班组ID
export function clearTeamId() {
  uni.removeStorageSync(TEAM_ID_KEY);
}
// æ¸…除所有缓存信息
export function clearAll() {
  clearToken();
  clearUserInfo();
  clearDictCache();
  clearTeamId();
}