From c2d538f5328008aca780ea1f30f925c34ec43853 Mon Sep 17 00:00:00 2001 From: Ledo Date: Sat, 17 May 2025 15:44:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=EF=BC=9A=201.?= =?UTF-8?q?=E8=A6=81=E6=B1=82=E5=BC=80=E5=A7=8B=E7=94=9F=E4=BA=A7=E9=80=80?= =?UTF-8?q?=E5=87=BA=E5=90=8E=EF=BC=8C=E5=9C=A8=E8=BF=9B=E5=85=A5=E4=B8=8D?= =?UTF-8?q?=E5=BC=B9=E6=A1=86=202.=E6=97=B6=E9=97=B4=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=BA=A0=E6=AD=A3=203.=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=BA=A0=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assembleReport/assembleReport-detail.vue | 144 +- .../productionReport-detail.vue | 1171 +++++++++-------- 2 files changed, 685 insertions(+), 630 deletions(-) diff --git a/mes-ui/mini-app/src/pages/assembleReport/assembleReport-detail.vue b/mes-ui/mini-app/src/pages/assembleReport/assembleReport-detail.vue index 3c3f6e4..9b39284 100644 --- a/mes-ui/mini-app/src/pages/assembleReport/assembleReport-detail.vue +++ b/mes-ui/mini-app/src/pages/assembleReport/assembleReport-detail.vue @@ -11,28 +11,30 @@ const dictInfo = userStore?.dictInfo || [] const unitDictData = dictInfo.filter(e => e.dictType == 'heli_material_unit') || [] const userId = userStore.userInfo.userId -const isShowStart = computed(() => { - let flag = true - if (historyList.value.length) { - const obj = historyList.value[0] - if (!obj?.endTime) { - flag = false - } - } - return flag -}) -const isShowEnd = computed(() => { - let flag = true - if (historyList.value.length) { - const obj = historyList.value[0] - if (obj?.endTime) { - flag = false - } - } else { - flag = false - } - return flag -}) +const isShowStart = ref(false) +const isShowEnd = ref(false) +// const isShowStart = computed(() => { +// let flag = true +// if (historyList.value.length) { +// const obj = historyList.value[0] +// if (!obj?.endTime) { +// flag = false +// } +// } +// return flag +// }) +// const isShowEnd = computed(() => { +// let flag = true +// if (historyList.value.length) { +// const obj = historyList.value[0] +// if (obj?.endTime) { +// flag = false +// } +// } else { +// flag = false +// } +// return flag +// }) const amount = ref(null) const workTime = ref(null) // 详情数据 @@ -56,28 +58,42 @@ const getData = async () => { e.endTimeStr = e.endTime && formatDate(e.endTime, 'YYYY-MM-DD HH:mm') // e.endTimeStr = '2025-01-13 00:00' }) - // if (data.list[0]) { - // formObj.value = data.list[0] - // const time = formObj.value.endTime - formObj.value.startTime //时间差秒 - // console.log(time) - // const leave1 = time % (24 * 3600 * 1000) //计算天数后剩余的毫秒数 - // workTime.value = Math.floor(leave1 / (3600 * 1000)) - // } - // if (data.list[0]) { - // // 将字符串转换为Date对象 - // 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)); - // workTime.value = roundedTimeDifference; - // } + if (data.list[0]) { + // 将字符串转换为Date对象 + 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 + isShowEnd.value = true; + isShowStart.value = true + if (historyList.value.length) { + const obj = historyList.value[0] + console.log('s') + if (!obj?.amount) { + isShowStart.value= false + } + } + if (historyList.value.length) { + const obj = historyList.value[0] + if (obj?.amount) { + isShowEnd.value = false + } + } else { + isShowEnd.value = false + } if(historyList.value!=null&&historyList.value.length>0){ var totalAmount = detailInfo.value.amount; var beforeAmount = detailInfo.value.totalReportAmount @@ -88,6 +104,7 @@ const getData = async () => { } } + isLoading.value = false } @@ -107,27 +124,28 @@ const getDetailData = async (id) => { data.startTime = formatDate(data.startTime, 'YYYY-MM-DD HH:mm'); data.endTime = formatDate(data.endTime, 'YYYY-MM-DD HH:mm'); // 去掉了末尾的空格 - const endTime = new Date(data.endTime); - const startTime = new Date(data.startTime); - // // 计算两个日期之间的毫秒差 - const timeDifferenceInMs = endTime - startTime; - // // 将毫秒差转换为小时 - const timeDifferenceInHours = timeDifferenceInMs / (3600 * 1000); - const roundedTimeDifference = parseFloat(timeDifferenceInHours.toFixed(2)); - workTime.value = roundedTimeDifference; + // const endTime = new Date(data.endTime); + // const startTime = new Date(data.startTime); + // // // 计算两个日期之间的毫秒差 + // const timeDifferenceInMs = endTime - startTime; + // // // 将毫秒差转换为小时 + // const timeDifferenceInHours = timeDifferenceInMs / (3600 * 1000); + // const roundedTimeDifference = parseFloat(timeDifferenceInHours.toFixed(2)); + // workTime.value = roundedTimeDifference; // 单位枚举 const lineObj = unitDictData.find((q) => q.value == data.unit) || {} data.unit = lineObj.label detailInfo.value = data || {} isLoading.value = false } +const popupShow = ref(false) onLoad(async (options: any) => { await getDetailData(options.id) await getData() const obj = historyList.value[0] // 最新的报工是否完成 if (obj && obj?.workTime == null && obj.endTime) { - popup.value?.open() + popupShow.value = true } }) @@ -151,6 +169,7 @@ const handleComplate = async () => { } // 提交报工 const handleOk = async (active) => { +console.log(amount.value) const params = { id: detailInfo.value?.id, active: 'SUBMIT', @@ -182,10 +201,11 @@ const handleStop = async () => { active: 'END', } const data = await postOperateAPI(params) - const url = `/pages/productionReport/productionReport-detail?id=${detailInfo.value.id}` - uni.redirectTo({ - url, - }) + await getData() + // const url = `/pages/productionReport/productionReport-detail?id=${detailInfo.value.id}` + // uni.redirectTo({ + // url, + // }) popup.value?.open() } @@ -260,8 +280,8 @@ const handleStop = async () => { - 开始生产 - 结束生产 + 开始生产 + 结束生产 @@ -274,20 +294,20 @@ const handleStop = async () => { 开始生产时间: - {{ detailInfo.startTime }} + {{ formObj.startTimeStr }} 结束生产时间: - {{ detailInfo.endTime }} + {{ formObj.endTimeStr }} *本次报工工时: - + *本次报工数量: - + {{ detailInfo.unit }} diff --git a/mes-ui/mini-app/src/pages/productionReport/productionReport-detail.vue b/mes-ui/mini-app/src/pages/productionReport/productionReport-detail.vue index 39446d6..0eb4c6f 100644 --- a/mes-ui/mini-app/src/pages/productionReport/productionReport-detail.vue +++ b/mes-ui/mini-app/src/pages/productionReport/productionReport-detail.vue @@ -1,622 +1,657 @@ + .action-item { + width: 272rpx; + height: 86rpx; + display: flex; + justify-content: center; + align-items: center; + margin: 0 20rpx; + font-size: 40rpx; + color: #fff; + width: 272rpx; + height: 86rpx; + border-radius: 24rpx; + + &.start { + background: linear-gradient(157deg, #2EACE6 -3%, #356899 90%); + } + + &.stop { + background: linear-gradient(167deg, #FEA97B -2%, #F75E40 87%); + } + + &.finish { + background: linear-gradient(142deg, #FEB34A 14%, #FE9B12 83%); + } + } + } + + .loading-text { + text-align: center; + font-size: 28rpx; + color: #666; + padding: 20rpx 0; + } + + .popup { + .title { + line-height: 1; + padding: 40rpx; + font-size: 32rpx; + font-weight: normal; + border-bottom: 1rpx solid #ddd; + color: #444; + + .close { + position: absolute; + right: 24rpx; + top: 40rpx; + height: 60rpx; + width: 60rpx; + text-align: center; + } + } + + .cont { + display: flex; + flex-direction: column; + align-items: center; + margin: 40rpx; + height: 50vh; + + .item { + display: flex; + align-items: center; + margin: 20rpx 0; + color: #737D88; + width: 94%; + + .label { + font-size: 32rpx; + width: 260rpx; + + .star { + color: red + } + } + + .val { + flex: 1; + font-size: 32rpx; + } + + .unit { + width: 100rpx; + margin-left: 4rpx; + text-align: center; + } + } + } + + .ok { + font-size: 32rpx; + margin: 20rpx auto 80rpx; + text-align: center; + width: 200rpx; + border-radius: 10rpx; + padding: 8rpx 0; + background-color: #3C8AF7; + color: #fff; + } + } + } + \ No newline at end of file