小程序需重进页面才提示错误问题

This commit is contained in:
Ledo 2025-07-07 14:54:48 +08:00
parent 391818d086
commit 4194f5e9ee

View File

@ -158,14 +158,17 @@ const handleComplate = async () => {
}
try {
const data = await postOperateAPI(params);
console.log(data)
console.log('ai')
} catch (error) {
console.log(error)
console.log('meijinlai ')
uni.showToast({
icon: 'none',
duration: 3000,
title: error.data.msg,
})
} finally {
console.log('jie')
await getDetailData(detailInfo.value.id)
await getData()
const obj = historyList.value[0]
@ -189,10 +192,15 @@ const handleOk = async (active) => {
workTime: workTime.value,
}
const data = await postOperateAPI(params)
const url = `/pages/productionReport/productionReport-detail?id=${detailInfo.value.id}`
uni.redirectTo({
url,
})
const pages = getCurrentPages(); //
const currentPage = pages[pages.length - 1]; //
const url = `/${currentPage.route}?${Object.entries(currentPage.options).map(([key, val]) => `${key}=${val}`).join('&')}`;
uni.reLaunch({ url }); //
// const url = `/pages/productionReport/productionReport-detail?id=${detailInfo.value.id}`
// uni.redirectTo({
// url,
// })
}
//
const handleStart = async () => {
@ -201,10 +209,15 @@ const handleStart = async () => {
active: 'START',
}
const data = await postOperateAPI(params)
const url = `/pages/productionReport/productionReport-detail?id=${detailInfo.value.id}`
uni.redirectTo({
url,
})
const pages = getCurrentPages(); //
const currentPage = pages[pages.length - 1]; //
const url = `/${currentPage.route}?${Object.entries(currentPage.options).map(([key, val]) => `${key}=${val}`).join('&')}`;
uni.reLaunch({ url }); //
// const url = `/pages/productionReport/productionReport-detail?id=${detailInfo.value.id}`
// uni.redirectTo({
// url,
// })
}
//
const handleStop = async () => {
@ -212,8 +225,15 @@ const handleStop = async () => {
id: detailInfo.value?.id,
active: 'END',
}
const data = await postOperateAPI(params)
await getDetailData(detailInfo.value.id)
await getData()
const obj = historyList.value[0]
//
if (obj && obj?.workTime == null && obj.endTime) {
popupShow.value = true
}
// const url = `/pages/productionReport/productionReport-detail?id=${detailInfo.value.id}`
// uni.redirectTo({
// url,
@ -228,10 +248,12 @@ const handleStop = async () => {
<view class="module">
<view class="module-info">
<view class="product-item">项目{{ detailInfo.projectCode }} {{ detailInfo.projectName }}</view>
<image src="/static/images/productionReport-page.png" class="product-img" mode="scaleToFill"></image>
<image src="/static/images/productionReport-page.png" class="product-img" mode="scaleToFill">
</image>
<view :class="[detailInfo.procedureStatus == 2 ? 'had' : 'unhad', 'product-status']">{{
detailInfo.procedureStatus == 2 ? '已完成' : '未完成' }}</view>
<view class="product-item">子项目{{ detailInfo.projectSubCode || '' }} {{ ' ' + detailInfo.projectSubName }}
<view class="product-item">子项目{{ detailInfo.projectSubCode || '' }}
{{ ' ' + detailInfo.projectSubName }}
</view>
<view class="product-item">派工工序{{ detailInfo.procedureName }}</view>
<view class="product-row">
@ -255,9 +277,11 @@ const handleStop = async () => {
</view>
</view>
<view class="product-item">预计生产日期{{ detailInfo.startTime }} {{ detailInfo.endTime }}</view>
<view class="finish" v-if="isShowStart && detailInfo.procedureStatus !== 2 && detailInfo.totalWorkTime"
<view class="finish"
v-if="isShowStart && detailInfo.procedureStatus !== 2 && detailInfo.totalWorkTime"
@click="handleComplate">
<image class="complate-img" src="/static/images/productionReport-detail-complate.png" mode="scaleToFill" />
<image class="complate-img" src="/static/images/productionReport-detail-complate.png"
mode="scaleToFill" />
生产完成
</view>
</view>
@ -283,7 +307,8 @@ const handleStop = async () => {
</view>
</view>
<view class="tip-index">
<image src="/static/images/productionReport-detail-index.png" class="icon-status" mode="scaleToFit">
<image src="/static/images/productionReport-detail-index.png" class="icon-status"
mode="scaleToFit">
</image>
<view class="text">{{ historyList.length - index }}</view>
</view>
@ -314,12 +339,14 @@ const handleStop = async () => {
</view>
<view class="item">
<view class="label"><span class="star">*</span>本次报工工时</view>
<uni-easyinput class="val" type="digit" v-model="workTime" placeholder="请输入本次报工工时"></uni-easyinput>
<uni-easyinput class="val" type="digit" v-model="workTime"
placeholder="请输入本次报工工时"></uni-easyinput>
<view class="unit"></view>
</view>
<view class="item">
<view class="label"><span class="star">*</span>本次报工数量</view>
<uni-easyinput class="val" type="number" v-model="amount" placeholder="请输入本次报工数量"></uni-easyinput>
<uni-easyinput class="val" type="number" v-model="amount"
placeholder="请输入本次报工数量"></uni-easyinput>
<view class="unit"> {{ detailInfo.unit }}</view>
</view>
</view>
@ -409,6 +436,7 @@ const handleStop = async () => {
}
}
.finish {
position: absolute;
right: 40rpx;