| | |
| | | /> |
| | | <view class="mx-3"> |
| | | <wd-grid class="rounded-lg" clickable> |
| | | <wd-grid-item |
| | | icon="computer" |
| | | link-type="navigateTo" |
| | | :url="`/pages/production/twist/report/index?id=${paramsId}`" |
| | | text="报工" |
| | | /> |
| | | <wd-grid-item icon="computer" @click="handleReportClick" text="报工" /> |
| | | <!-- <wd-grid-item |
| | | icon="chart" |
| | | text="自检" |
| | |
| | | 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 HomeApi from "@/api/home"; |
| | | |
| | | const paramsId = ref(); |
| | | const cardData = reactive({ |
| | |
| | | cardData.unAmount = data.unLength; |
| | | }; |
| | | |
| | | onLoad((options: any) => { |
| | | // 获取并缓存生产准备ID |
| | | const initPrepareId = async () => { |
| | | try { |
| | | const { data } = await HomeApi.getIndex(); |
| | | if (data && data.prepareId) { |
| | | setPrepareId(data.prepareId); |
| | | } |
| | | } catch (error) { |
| | | console.error("获取生产准备ID失败:", error); |
| | | } |
| | | }; |
| | | |
| | | // 处理报工点击 |
| | | const handleReportClick = () => { |
| | | const prepareId = getPrepareId(); |
| | | console.log("绞线表格报工检查 - prepareId值:", prepareId); |
| | | |
| | | // 如果prepareId为空或未定义,说明生产准备未完成 |
| | | if (!prepareId) { |
| | | console.log("绞线表格报工阻止 - 生产准备未完成"); |
| | | uni.showModal({ |
| | | title: "提示", |
| | | content: "请在电脑端完成生产准备确认,再进行报工操作", |
| | | showCancel: false, |
| | | confirmText: "确定", |
| | | success: () => { |
| | | // 用户点击确定后,不做任何操作 |
| | | }, |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | // 如果有 prepareId,正常跳转 |
| | | uni.navigateTo({ |
| | | url: `/pages/production/twist/report/index?id=${paramsId.value}`, |
| | | }); |
| | | }; |
| | | |
| | | onLoad(async (options: any) => { |
| | | paramsId.value = options.id; |
| | | getDetailData(options.id); |
| | | await getDetailData(options.id); |
| | | // 获取并缓存生产准备ID |
| | | await initPrepareId(); |
| | | }); |
| | | </script> |
| | | |