质检计算等问题

This commit is contained in:
Ledo 2025-07-11 17:31:41 +08:00
parent 1a5e45fb4d
commit fb84e7b6af
4 changed files with 94 additions and 68 deletions

View File

@ -328,16 +328,16 @@
// //
// //
var lastIndex = historyList.value.length - 1; // var lastIndex = historyList.value.length - 1;
var lastItem = historyList.value[lastIndex]; var lastItem = historyList.value[0];
console.log(historyList.value) var www = new Date();
workTime.value = Math.floor(Math.abs(lastItem.createTime - Date.now()) / (1000 * 60 * 60)).toString(); workTime.value = Math.floor(Math.abs(lastItem.createTime - www.getTime()) / (1000 * 60 * 60)).toString();
// //
if (historyList.value.length == 1) { if (historyList.value.length == 1) {
amount.value = detailInfo.value.amount; amount.value = detailInfo.value.amount;
} else { } else {
var beforeAmount = 0; var beforeAmount = 0;
for (var i = 0; i < historyList.value.length - 1; i++) { for (var i = 1; i < historyList.value.length ; i++) {
beforeAmount += historyList.value[i].amount beforeAmount += historyList.value[i].amount
} }
var finalamount = detailInfo.value.amount - beforeAmount var finalamount = detailInfo.value.amount - beforeAmount

View File

@ -281,7 +281,7 @@
@click="handleComplate"> @click="handleComplate">
<image class="complate-img" src="/static/images/productionReport-detail-complate.png" <image class="complate-img" src="/static/images/productionReport-detail-complate.png"
mode="scaleToFill" /> mode="scaleToFill" />
质检结束 生产结束
</view> </view>
</view> </view>
</view> </view>

View File

@ -3,7 +3,7 @@
import { formatDate } from '@/utils/index' import { formatDate } from '@/utils/index'
import { onLoad, onShow } from '@dcloudio/uni-app' import { onLoad, onShow } from '@dcloudio/uni-app'
import { useLoginStore } from '@/stores/modules/login' import { useLoginStore } from '@/stores/modules/login'
import { getNotificationDetailAPI,operateWx } from '@/services/unqualifiedNotification' import { getNotificationDetailAPI, operateWx } from '@/services/unqualifiedNotification'
import { serviceDomain } from '@/services/constants' import { serviceDomain } from '@/services/constants'
const popup = ref<UniHelper.UniPopupInstance>() const popup = ref<UniHelper.UniPopupInstance>()
const userStore = useLoginStore() const userStore = useLoginStore()
@ -144,15 +144,15 @@
} }
} }
const range = [ const range = [
{ value: 1, text: "返修" }, { value: 1, text: "返修" },
{ value: 2, text: "让步接收" }, { value: 2, text: "让步接收" },
{ value: 3, text: "报废" }, { value: 3, text: "报废" },
] ]
// //
const handleOk = async() =>{ const handleOk = async () => {
if(detailInfo.value.auditOpinion){ if (detailInfo.value.auditOpinion) {
await submitForm(detailInfo.value.auditOpinion); await submitForm(detailInfo.value.auditOpinion);
}else{ } else {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
duration: 3000, duration: 3000,
@ -170,11 +170,11 @@
auditOpinion: active, auditOpinion: active,
auditor: userId, auditor: userId,
projectId: 0, projectId: 0,
projectSubId:0, projectSubId: 0,
status: 1, status: 1,
notificationStatus:3 notificationStatus: 3
} }
await operateWx(params); await operateWx(params);
} catch (error) { } catch (error) {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
@ -183,7 +183,7 @@
}) })
} finally { } finally {
isLoading.value = false; isLoading.value = false;
// const url = `/pages/pgMaster/pgMaster-detail?id=${detailInfo.value.id}` // const url = `/pages/unqualifiedNotification/unqualifiedNotification`
// uni.redirectTo({ // uni.redirectTo({
// url, // url,
// }) // })
@ -204,10 +204,23 @@
await getDetailData(idValue.value, typeName.value) await getDetailData(idValue.value, typeName.value)
} }
const audit = ()=>{ const audit = () => {
popup.value.open() popup.value.open()
} }
const cancel = () => {
uni.navigateBack({
delta: 1 // 1
});
}
const getSuger = (val) => {
if (val == 1) {
return '返修'
} else if (val == 2) {
return '让步接收'
} else if (val == 3) {
return '报废'
}
}
const detailId = ref() const detailId = ref()
</script> </script>
<template> <template>
@ -225,14 +238,18 @@
<view class="product-item">子项目{{ detailInfo.projectSubCode || '' }} <view class="product-item">子项目{{ detailInfo.projectSubCode || '' }}
{{' ' + detailInfo.projectSubName }} {{' ' + detailInfo.projectSubName }}
</view> </view>
<view class="product-item">通知日期{{detailInfo.createTime}}</view> <view class="product-item">通知日期{{formatDate(detailInfo.createTime, 'YYYY-MM-DD HH:mm')}}</view>
<view class="product-item" v-if="detailInfo.notificationStatus === 3">
审核日期{{formatDate(detailInfo.auditTime, 'YYYY-MM-DD HH:mm')}}</view>
<view class="product-item" v-if="detailInfo.notificationStatus === 3">
审核意见{{getSuger(detailInfo.auditOpinion)}}</view>
<view class="product-row" v-if="detailInfo.typeName == '过程检'"> <view class="product-row" v-if="detailInfo.typeName == '过程检'">
<view class="row-item"> <view class="row-item">
<view class="label">零件名称<text class="blue">{{ detailInfo.materialName }}</text></view> <view class="label">零件名称<text class="blue">{{ detailInfo.materialName }}</text></view>
</view> </view>
<view class="row-item"> <view class="row-item">
<view class="label">工序<text class="blue">{{ detailInfo.procedureName }}</text></view> <view class="label">工序<text class="blue">{{ detailInfo.procedureName }}</text></view>
</view> </view>
</view> </view>
<view class="product-row"> <view class="product-row">
<view class="row-item"> <view class="row-item">
@ -268,7 +285,11 @@
<view class="product-row"> <view class="product-row">
<view class="row-item"> <view class="row-item">
<view class="label">是否复检</view> <view class="label">是否复检</view>
<view class="val high-color">{{ detailInfo.isRepre == 0 ?'否':'是' }}</view> <view class="val high-color">{{ detailInfo.isRepre == 1 ?'否':'是' }}</view>
</view>
<view class="row-item">
<view class="label">是否合格</view>
<view class="val high-color">{{ detailInfo.isQua == 0?'合格':'不合格' }}</view>
</view> </view>
</view> </view>
@ -287,12 +308,12 @@
</view> </view>
</view> </view>
<view class="action" v-if="detailInfo.notificationStatus !== 3"> <view class="action" v-if="detailInfo.notificationStatus !== 3">
<!-- <view class="action-item info" v-if="detailInfo.notificationStatus !== 3" @click="submitForm(3)">报废</view> <!-- <view class="action-item info" v-if="detailInfo.notificationStatus !== 3" @click="submitForm(3)">报废</view>
<view class="action-item start" v-if="detailInfo.notificationStatus !== 3" @click="submitForm(1)">返修</view> <view class="action-item start" v-if="detailInfo.notificationStatus !== 3" @click="submitForm(1)">返修</view>
<view class="action-item stop" v-if="detailInfo.notificationStatus !== 3" @click="submitForm(2)">让步接收</view> --> <view class="action-item stop" v-if="detailInfo.notificationStatus !== 3" @click="submitForm(2)">让步接收</view> -->
<view class="action-item info" v-if="detailInfo.notificationStatus !== 3" @click="cancel()">取消</view> <view class="action-item info" v-if="detailInfo.notificationStatus !== 3" @click="cancel()">取消</view>
<view class="action-item start" v-if="detailInfo.notificationStatus !== 3" @click="audit()">审核</view> <view class="action-item start" v-if="detailInfo.notificationStatus !== 3" @click="audit()">审核</view>
<!-- <view class="action-item stop" v-if="detailInfo.notificationStatus !== 3" @click="submitForm(2)">让步接收</view> --> <!-- <view class="action-item stop" v-if="detailInfo.notificationStatus !== 3" @click="submitForm(2)">让步接收</view> -->
</view> </view>
<uni-popup class="popup" ref="popup" :mask-click="false" type="bottom" background-color="#fff"> <uni-popup class="popup" ref="popup" :mask-click="false" type="bottom" background-color="#fff">
@ -300,21 +321,14 @@
<view class="text">审核信息</view> <view class="text">审核信息</view>
<!-- <view class="close" @click="handleClose">X</view> --> <!-- <view class="close" @click="handleClose">X</view> -->
</view> </view>
<scroll-view scroll-y="true" style="height: 100%;"> <view class="formHeight">
<uni-forms ref="formRef" :label-width="100">
<uni-forms-item class="auditSelect" label="审核意见" required name="type">
<uni-data-select style="width: 60%;" v-model="detailInfo.auditOpinion" :localdata="range"></uni-data-select>
</uni-forms-item>
</uni-forms>
</view>
<view class="cont">
<view class="item">
<view class="label"><span class="star">*</span>审核意见</view>
<uni-data-select
v-model="detailInfo.auditOpinion"
:localdata="range"
></uni-data-select>
</view>
</view>
</scroll-view>
<view class="ok" @click="handleOk">确定</view> <view class="ok" @click="handleOk">确定</view>
</uni-popup> </uni-popup>
</template> </template>
@ -322,24 +336,33 @@
</view> </view>
</template> </template>
<style lang="scss"> <style lang="scss">
.auditSelect{
margin-top: 10%;
margin-left: 10%;
}
.formHeight{
height: 600rpx;
}
// //
.data-detail { .data-detail {
border-radius: 10rpx; border-radius: 10rpx;
padding-bottom: 200rpx; padding-bottom: 200rpx;
.statusLabelzf {
font-size: 24rpx;
position: absolute;
right: 30rpx;
top: 15rpx;
border-radius: 10rpx;
font-size: 24rpx;
padding: 10rpx 30rpx;
border-radius: 10rpx;
font-size: 24rpx;
background: linear-gradient(149deg, #ffff00 4%, #cfcf00 98%);
color: #fff;
} .statusLabelzf {
font-size: 24rpx;
position: absolute;
right: 30rpx;
top: 15rpx;
border-radius: 10rpx;
font-size: 24rpx;
padding: 10rpx 30rpx;
border-radius: 10rpx;
font-size: 24rpx;
background: linear-gradient(149deg, #ffff00 4%, #cfcf00 98%);
color: #fff;
}
.module { .module {
background: linear-gradient(178deg, #356899 7%, #356899 57%, #F4F6F9 94%); background: linear-gradient(178deg, #356899 7%, #356899 57%, #F4F6F9 94%);
padding: 20rpx; padding: 20rpx;
@ -565,9 +588,11 @@
width: 272rpx; width: 272rpx;
height: 86rpx; height: 86rpx;
border-radius: 24rpx; border-radius: 24rpx;
&.info {
&.info {
background: linear-gradient(157deg, #A9A9A9 -3%, #A9A9A9 90%); background: linear-gradient(157deg, #A9A9A9 -3%, #A9A9A9 90%);
} }
&.start { &.start {
background: linear-gradient(157deg, #2EACE6 -3%, #356899 90%); background: linear-gradient(157deg, #2EACE6 -3%, #356899 90%);
} }
@ -575,9 +600,11 @@
&.stop { &.stop {
background: linear-gradient(167deg, #FEA97B -2%, #F75E40 87%); background: linear-gradient(167deg, #FEA97B -2%, #F75E40 87%);
} }
&.danger { &.danger {
background: linear-gradient(167deg, #C00000 -2%,#E80000 87%); background: linear-gradient(167deg, #C00000 -2%, #E80000 87%);
} }
&.finish { &.finish {
background: linear-gradient(142deg, #FEB34A 14%, #FE9B12 83%); background: linear-gradient(142deg, #FEB34A 14%, #FE9B12 83%);
} }

View File

@ -304,15 +304,14 @@
const handleStop = async () => { const handleStop = async () => {
// var lastIndex = historyList.value.length-1; // var lastIndex = historyList.value.length-1;
var lastItem = historyList.value[0]; var lastItem = historyList.value[0];
console.log(historyList.value) var nowDate = new Date();
workTime.value = Math.floor(Math.abs(lastItem.createTime - Date.now()) / (1000 * 60 * 60)).toString(); workTime.value = Math.floor(Math.abs(lastItem.createTime - nowDate.getTime()) / (1000 * 60 * 60)).toString();
// //
if (historyList.value.length == 1) { if (historyList.value.length == 1) {
amount.value = detailInfo.value.amount; amount.value = detailInfo.value.amount;
} else { } else {
var beforeAmount = 0; var beforeAmount = 0;
for (var i = historyList.value.length - 1; i > 0; i--) { for (var i = 1; i < historyList.value.length ; i++) {
console.log(historyList.value[i])
beforeAmount += historyList.value[i].amount beforeAmount += historyList.value[i].amount
} }
var finalamount = detailInfo.value.amount - beforeAmount var finalamount = detailInfo.value.amount - beforeAmount
@ -397,7 +396,7 @@
icon: 'none', // iconnone icon: 'none', // iconnone
duration: 2000 duration: 2000
}); });
await initPage() // await initPage()
const pages = getCurrentPages(); // const pages = getCurrentPages(); //
const currentPage = pages[pages.length - 1]; // const currentPage = pages[pages.length - 1]; //
const url = `/${currentPage.route}?${Object.entries(currentPage.options).map(([key, val]) => `${key}=${val}`).join('&')}`; const url = `/${currentPage.route}?${Object.entries(currentPage.options).map(([key, val]) => `${key}=${val}`).join('&')}`;