生产任务派工单自动带出结束日期

This commit is contained in:
z 2025-05-15 17:17:40 +08:00
parent df4bc39ad9
commit 6f82360744
2 changed files with 50 additions and 20 deletions

View File

@ -203,7 +203,7 @@ class="!w-260px" v-model="formData.createTime" type="date" value-format="x"
v-loading="subFormLoading" label-width="0">
<el-table :data="formData.taskDispatchDetails" height="250" >
<el-table-column fixed label="是否外协" align="center" width="100">
<el-table-column fixed label="外协" align="center" width="100">
<template #default="{ row }">
<el-checkbox v-model="row.isOutsourcing" @change="handleOutsourcingChange(row)" :disabled="detailDisabled||row.beginProduce != 0 || row.procedureStatus != 0"/>
</template>
@ -489,7 +489,7 @@ import {
} from '@/utils/dict'
import {
dateFormatter,
formatDate
formatDate, formatDate1
} from "@/utils/formatTime";
import {
ref,
@ -1199,11 +1199,11 @@ const queryData = async (id?: number) => {
formData.value.taskDispatchDetails = await TaskDispatchApi.getTaskDispatchDetailListByDispatchId(id)
checkList.value = [];
if(formData.value.taskDispatchDetails!=null){
formData.value.taskDispatchDetails.forEach(item=>{
if ("Y"==item.isOutsourcing){
item.isOutsourcing=true
}else{
item.isOutsourcing=false
formData.value.taskDispatchDetails.forEach(item=> {
if ("Y" == item.isOutsourcing) {
item.isOutsourcing = true
} else {
item.isOutsourcing = false
}
procedureList.value.forEach(items =>{
if(items.id == item.procedureId){
@ -1278,7 +1278,27 @@ const submitForm = async (operate) => {
message.error('派工明细不能为空')
return
}
for(var i = 0 ; i < formData.value.taskDispatchDetails.length ; i++){
const d1 = new Date(formData.value.taskDispatchDetails[i].endTime);
const d2 = new Date(formData.value.requiredCompletedDate);
d1.setHours(0, 0, 0, 0);
d2.setHours(0, 0, 0, 0);
if( d1>d2){
let name;
procedureList.value.forEach(items =>{
if (items.id==formData.value.taskDispatchDetails[i].procedureId){
name=items.name
}
})
await message.confirm('工序('+name+")预计结束日期超过生产计划日期"+formatDate1(d2)+"是否继续 '")
}
}
var ownerIsNull = false;
if(operate == 'SUBMIT'){
for(var i = 0 ; i < formData.value.taskDispatchDetails.length ; i++){
if( formData.value.taskDispatchDetails[i].startTime == undefined || formData.value.taskDispatchDetails[i].startTime == null ||formData.value.taskDispatchDetails[i].startTime == ''){
message.error("第"+(i+1)+'行预计开始日期为空,请确认')
@ -1307,8 +1327,9 @@ const submitForm = async (operate) => {
break;
}
}
}
}
if(ownerIsNull){
return;
}
@ -1407,6 +1428,7 @@ const onAddItem = () => {
if(add){
row.amount = formData.value.amount
row.dispatchId = formData.value.id
row.endTime = formData.value.requiredCompletedDate
list.push(row)
row.sort = i;
i++;

View File

@ -71,15 +71,19 @@ const getData = async () => {
formObj.value = data.list[0]
const endTime= new Date(formObj.value.endTimeStr);
const startTime = new Date(formObj.value.startTimeStr);
//
const timeDifferenceInMs = endTime - startTime;
//
const timeDifferenceInHours = timeDifferenceInMs / (3600 * 1000);
const roundedTimeDifference = parseFloat(timeDifferenceInHours.toFixed(2));
if ("Y"==detailInfo.value.isOutsourcing){
}else {
workTime.value = roundedTimeDifference;
}
}
historyList.value = data.list
if(historyList.value!=null&&historyList.value.length>0){
var totalAmount = detailInfo.value.amount;
@ -111,6 +115,7 @@ const getDetailData = async (id) => {
//
const lineObj = unitDictData.find((q) => q.value == data.unit) || {}
data.unit = lineObj.label
detailInfo.value = data || {}
isLoading.value = false
}
@ -160,6 +165,7 @@ const handleStart = async () => {
ownerId:userId
}
productionTitle.value = '生产中';
console.log(detailInfo.value)
const data = await postOperateAPI(params)
const url = `/pages/productionReport/productionReport-detail?id=${detailInfo.value.id}`
uni.redirectTo({
@ -173,7 +179,9 @@ const handleStop = async () => {
id: detailInfo.value?.id,
active: 'END',
}
console.log(detailInfo.value)
const data = await postOperateAPI(params)
const url = `/pages/productionReport/productionReport-detail?id=${detailInfo.value.id}`
uni.redirectTo({
url,
@ -283,7 +291,7 @@ const handleStop = async () => {
<view class="item">
<view class="label"><span class="star">*</span>本次报工工时</view>
<uni-easyinput class="val" type="digit" v-model="workTime" placeholder="请输入本次报工工时"></uni-easyinput>
<view class="unit">小时</view>
<view class="unit">{{ detailInfo.isOutsourcing=='Y'?"元":"小时" }}</view>
</view>
<view class="item">
<view class="label"><span class="star">*</span>本次报工数量</view>