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

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 { try {
const data = await postOperateAPI(params); const data = await postOperateAPI(params);
console.log(data)
console.log('ai')
} catch (error) { } catch (error) {
console.log(error) console.log('meijinlai ')
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
duration: 3000, duration: 3000,
title: error.data.msg, title: error.data.msg,
}) })
} finally { } finally {
console.log('jie')
await getDetailData(detailInfo.value.id) await getDetailData(detailInfo.value.id)
await getData() await getData()
const obj = historyList.value[0] const obj = historyList.value[0]
@ -189,10 +192,15 @@ const handleOk = async (active) => {
workTime: workTime.value, workTime: workTime.value,
} }
const data = await postOperateAPI(params) const data = await postOperateAPI(params)
const url = `/pages/productionReport/productionReport-detail?id=${detailInfo.value.id}` const pages = getCurrentPages(); //
uni.redirectTo({ const currentPage = pages[pages.length - 1]; //
url, 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 () => { const handleStart = async () => {
@ -201,10 +209,15 @@ const handleStart = async () => {
active: 'START', active: 'START',
} }
const data = await postOperateAPI(params) const data = await postOperateAPI(params)
const url = `/pages/productionReport/productionReport-detail?id=${detailInfo.value.id}` const pages = getCurrentPages(); //
uni.redirectTo({ const currentPage = pages[pages.length - 1]; //
url, 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 () => { const handleStop = async () => {
@ -212,8 +225,15 @@ const handleStop = async () => {
id: detailInfo.value?.id, id: detailInfo.value?.id,
active: 'END', active: 'END',
} }
const data = await postOperateAPI(params) const data = await postOperateAPI(params)
await getDetailData(detailInfo.value.id)
await getData() 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}` // const url = `/pages/productionReport/productionReport-detail?id=${detailInfo.value.id}`
// uni.redirectTo({ // uni.redirectTo({
// url, // url,
@ -228,10 +248,12 @@ const handleStop = async () => {
<view class="module"> <view class="module">
<view class="module-info"> <view class="module-info">
<view class="product-item">项目{{ detailInfo.projectCode }} {{ detailInfo.projectName }}</view> <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']">{{ <view :class="[detailInfo.procedureStatus == 2 ? 'had' : 'unhad', 'product-status']">{{
detailInfo.procedureStatus == 2 ? '已完成' : '未完成' }}</view> detailInfo.procedureStatus == 2 ? '已完成' : '未完成' }}</view>
<view class="product-item">子项目{{ detailInfo.projectSubCode || '' }} {{ ' ' + detailInfo.projectSubName }} <view class="product-item">子项目{{ detailInfo.projectSubCode || '' }}
{{ ' ' + detailInfo.projectSubName }}
</view> </view>
<view class="product-item">派工工序{{ detailInfo.procedureName }}</view> <view class="product-item">派工工序{{ detailInfo.procedureName }}</view>
<view class="product-row"> <view class="product-row">
@ -255,9 +277,11 @@ const handleStop = async () => {
</view> </view>
</view> </view>
<view class="product-item">预计生产日期{{ detailInfo.startTime }} {{ detailInfo.endTime }}</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"> @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>
</view> </view>
@ -283,7 +307,8 @@ const handleStop = async () => {
</view> </view>
</view> </view>
<view class="tip-index"> <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> </image>
<view class="text">{{ historyList.length - index }}</view> <view class="text">{{ historyList.length - index }}</view>
</view> </view>
@ -314,12 +339,14 @@ const handleStop = async () => {
</view> </view>
<view class="item"> <view class="item">
<view class="label"><span class="star">*</span>本次报工工时</view> <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 class="unit"></view>
</view> </view>
<view class="item"> <view class="item">
<view class="label"><span class="star">*</span>本次报工数量</view> <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 class="unit"> {{ detailInfo.unit }}</view>
</view> </view>
</view> </view>
@ -409,6 +436,7 @@ const handleStop = async () => {
} }
} }
.finish { .finish {
position: absolute; position: absolute;
right: 40rpx; right: 40rpx;