|
@@ -1,19 +1,18 @@
|
|
<template>
|
|
<template>
|
|
- <view class="uni-column container" >
|
|
|
|
|
|
+ <view class="uni-column container">
|
|
<scroll-view class="scroll-container" scroll-y>
|
|
<scroll-view class="scroll-container" scroll-y>
|
|
- <view v-for="(item, index) in listData" :key="index"
|
|
|
|
- class="list-item">
|
|
|
|
|
|
+ <view v-for="(item, index) in listData" :key="index" class="list-item">
|
|
<view class="title-container uni-row">
|
|
<view class="title-container uni-row">
|
|
<view class="title uni-row">
|
|
<view class="title uni-row">
|
|
- <text class="label">批次号:</text>
|
|
|
|
- <text class="label code">{{ curSubDetails['lotCode'] }}</text>
|
|
|
|
|
|
+ <text class="label">批次号:</text>
|
|
|
|
+ <text class="label code"> {{ item['lotCode'] }}</text>
|
|
</view>
|
|
</view>
|
|
<view class="right-info uni-row">
|
|
<view class="right-info uni-row">
|
|
<view class="right-info uni-row"> <text class="label ">工时</text>
|
|
<view class="right-info uni-row"> <text class="label ">工时</text>
|
|
<text class="label time">{{ item['taskTime'] }}h</text>
|
|
<text class="label time">{{ item['taskTime'] }}h</text>
|
|
</view>
|
|
</view>
|
|
<view class="right-info uni-row" style="margin-left:32px;"> <text class="label">合格数</text>
|
|
<view class="right-info uni-row" style="margin-left:32px;"> <text class="label">合格数</text>
|
|
- <text class="label number ">{{ item['qualifiedQuantity'] }}</text>
|
|
|
|
|
|
+ <text class="label number ">{{ item['qualifiedNum'] }}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
@@ -35,10 +34,10 @@
|
|
</view>
|
|
</view>
|
|
<view class="item-info uni-row">
|
|
<view class="item-info uni-row">
|
|
<text class="label">废品原因</text>
|
|
<text class="label">废品原因</text>
|
|
- <text class="label right">{{ (item['remark'] != "")?item['remark']:'-'}}</text>
|
|
|
|
|
|
+ <text class="label right">{{ (item['reason'] != "")?item['reason']:'-'}}</text>
|
|
</view>
|
|
</view>
|
|
|
|
|
|
- <view v-if="item['status'] == 0" class="status-btn uni-row ">
|
|
|
|
|
|
+ <view v-if="item['userId'] == userInfo['userId'] ? item['status'] == 0 : false" class="status-btn uni-row ">
|
|
<button class="finished-turnover-tag" size="mini"
|
|
<button class="finished-turnover-tag" size="mini"
|
|
@click.stop="handleShowEndWorkDialog(item)">结束报工</button>
|
|
@click.stop="handleShowEndWorkDialog(item)">结束报工</button>
|
|
</view>
|
|
</view>
|
|
@@ -46,99 +45,140 @@
|
|
</scroll-view>
|
|
</scroll-view>
|
|
<view class="bottom uni-row">
|
|
<view class="bottom uni-row">
|
|
<button class="bottom-btn left-btn" @click="HandleChangevehicle"><text class="label">更换载具</text></button>
|
|
<button class="bottom-btn left-btn" @click="HandleChangevehicle"><text class="label">更换载具</text></button>
|
|
- <button class="bottom-btn right-btn" @click="handleStartProcessing"><text class="label">开始加工</text></button>
|
|
|
|
|
|
+ <button class="bottom-btn right-btn" type="primary" @click="handleStartProcessing"><text
|
|
|
|
+ class="label">开始加工</text></button>
|
|
</view>
|
|
</view>
|
|
- <dialog-end-work ref="endWorkDialog" @sendEquipment='getEquipment' @reset="reset"/>
|
|
|
|
- <dialog-selectEquipment ref='selectEquipment' @refportingForWorkRefresh='reset'></dialog-selectEquipment>
|
|
|
|
|
|
+ <dialog-end-work ref="endWorkDialog" @sendEquipment='getEquipment' @reset="reset" />
|
|
|
|
+ <dialog-selectEquipment ref='selectEquipment'
|
|
|
|
+ @handleAddDayWorkItem='handleAddDayWorkItem'></dialog-selectEquipment>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
- import {
|
|
|
|
|
|
+ import {
|
|
ref
|
|
ref
|
|
} from 'vue'
|
|
} from 'vue'
|
|
import {
|
|
import {
|
|
onLoad,
|
|
onLoad,
|
|
onReady
|
|
onReady
|
|
} from '@dcloudio/uni-app'
|
|
} from '@dcloudio/uni-app'
|
|
- import { getDayWorkItemList,saveDayWorkItem } from "@/api/business/dayWorkItem.js"
|
|
|
|
- import { store } from '@/store/index.js'
|
|
|
|
-
|
|
|
|
- const listData = ref([])
|
|
|
|
- const curSubDetails = ref({})
|
|
|
|
- const dayWorkInfo = ref({})
|
|
|
|
- const endWorkDialog = ref(null)
|
|
|
|
- const selectEquipment = ref(null)
|
|
|
|
- const equipmentList = ref([])
|
|
|
|
|
|
+ import {
|
|
|
|
+ getDayWorkItemList,
|
|
|
|
+ saveDayWorkItemBatch
|
|
|
|
+ } from "@/api/business/dayWorkItem.js"
|
|
|
|
+ import {
|
|
|
|
+ store
|
|
|
|
+ } from '@/store/index.js'
|
|
|
|
+ import {
|
|
|
|
+ timestampToTime
|
|
|
|
+ } from '@/utils/common.js'
|
|
|
|
+
|
|
|
|
+ const listData = ref([]) // 回显
|
|
|
|
+ const curSubDetails = ref({}) // 接收生产计划单信息
|
|
|
|
+ const dayWorkInfo = ref({}) // 接收daywork信息
|
|
|
|
+ const equipmentList = ref([]) // 设备列表
|
|
|
|
+ const endWorkDialog = ref(null) // 组件
|
|
|
|
+ const selectEquipment = ref(null)// 组件
|
|
|
|
+ const dayWorkItem = ref({}) // 添加传输对象
|
|
|
|
+ const reqParam = ref([]) // 请求参数
|
|
|
|
+ const userInfo = ref(null) // 登录员工信息
|
|
|
|
|
|
onLoad(() => {
|
|
onLoad(() => {
|
|
- let encodeData = encodeURIComponent(store.planSubDetails);
|
|
|
|
- curSubDetails.value = JSON.parse(decodeURIComponent(encodeData));
|
|
|
|
- console.log(curSubDetails.value)
|
|
|
|
- encodeData = encodeURIComponent(store.dayworkInfo);
|
|
|
|
- dayWorkInfo.value = JSON.parse(decodeURIComponent(encodeData));
|
|
|
|
- console.log(dayWorkInfo.value);
|
|
|
|
|
|
+ curSubDetails.value = store.planSubDetails;
|
|
|
|
+ dayWorkInfo.value = store.dayworkInfo;
|
|
|
|
+ console.log(dayWorkInfo.value)
|
|
init();
|
|
init();
|
|
})
|
|
})
|
|
-
|
|
|
|
- function init(){
|
|
|
|
- getDayWorkItemList().then(res => {
|
|
|
|
- listData.value = res.rows;
|
|
|
|
|
|
+
|
|
|
|
+ function init() {
|
|
|
|
+ userInfo.value = store.userInfo;
|
|
|
|
+ uni.showLoading({
|
|
|
|
+ title: '加载中'
|
|
|
|
+ });
|
|
|
|
+ getDayWorkItemList({
|
|
|
|
+ dayworkId: dayWorkInfo.value.id
|
|
|
|
+ }).then(res => {
|
|
|
|
+ listData.value = res.rows || [];
|
|
console.log(listData)
|
|
console.log(listData)
|
|
|
|
+ // 时间戳转工时
|
|
|
|
+ for (var i = 0; i < listData.value.length; i++) {
|
|
|
|
+ let timeStamp = Date.parse(listData.value[i].endTime) - Date.parse(listData.value[i].startTime);
|
|
|
|
+ listData.value[i].taskTime = (timeStamp / 3600000).toFixed(2) === 'NaN' ? 0 : (timeStamp / 3600000).toFixed(2);
|
|
|
|
+ console.log(typeof(listData.value[i].taskTime),listData.value[i].taskTime)
|
|
|
|
+ }
|
|
|
|
+ uni.hideLoading()
|
|
})
|
|
})
|
|
}
|
|
}
|
|
-
|
|
|
|
- function reset(){
|
|
|
|
|
|
+
|
|
|
|
+ function reset() {
|
|
init();
|
|
init();
|
|
}
|
|
}
|
|
|
|
|
|
- function handleShowEndWorkDialog(data){
|
|
|
|
|
|
+ function handleShowEndWorkDialog(data) {
|
|
// 调用子组件中的方法
|
|
// 调用子组件中的方法
|
|
endWorkDialog.value.open(data)
|
|
endWorkDialog.value.open(data)
|
|
}
|
|
}
|
|
-
|
|
|
|
- function HandleChangevehicle(){
|
|
|
|
- uni.navigateTo({
|
|
|
|
- url:"/pages/changeBox/index"
|
|
|
|
|
|
+
|
|
|
|
+ function HandleChangevehicle() {
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url: "/pages/changeBox/index"
|
|
})
|
|
})
|
|
}
|
|
}
|
|
-
|
|
|
|
- function getEquipment(data){
|
|
|
|
|
|
+
|
|
|
|
+ function getEquipment(data) {
|
|
console.log(data);
|
|
console.log(data);
|
|
equipmentList.value = data;
|
|
equipmentList.value = data;
|
|
}
|
|
}
|
|
-
|
|
|
|
- function handleStartProcessing(){
|
|
|
|
|
|
+
|
|
|
|
+ function handleStartProcessing() {
|
|
selectEquipment.value.open();
|
|
selectEquipment.value.open();
|
|
- let date = new Date()
|
|
|
|
- // saveDayWorkItem({
|
|
|
|
- // dayworkId: '1',
|
|
|
|
- // startTime: date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate()
|
|
|
|
- // }).then(res => {
|
|
|
|
- // if(res.code === 200){
|
|
|
|
- // uni.showToast({
|
|
|
|
- // icon: 'success',
|
|
|
|
- // title: '操作成功',
|
|
|
|
- // duration: 2000
|
|
|
|
- // });
|
|
|
|
- // init();
|
|
|
|
- // }else{
|
|
|
|
- // uni.showToast({
|
|
|
|
- // icon: 'error',
|
|
|
|
- // title: '操作失败',
|
|
|
|
- // duration: 2000
|
|
|
|
- // });
|
|
|
|
- // }
|
|
|
|
- // })
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function handleAddDayWorkItem(data) {
|
|
|
|
+ equipmentList.value = data;
|
|
|
|
+ dayWorkItem.value = {
|
|
|
|
+ dayworkId: dayWorkInfo.value.id,
|
|
|
|
+ lotId: dayWorkInfo.value.lotId,
|
|
|
|
+ productionPlanId: curSubDetails.value.productionPlanId,
|
|
|
|
+ productionPlanDetailId: curSubDetails.value.productionPlanDetailId,
|
|
|
|
+ productionPlanDetailSubDetailId: curSubDetails.value.id,
|
|
|
|
+ processId: store.dayworkInfo.currentProcess.id,
|
|
|
|
+ startTime: timestampToTime(new Date())
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (var i = 0; i < equipmentList.value.length; i++) {
|
|
|
|
+ reqParam.value.push(dayWorkItem.value);
|
|
|
|
+ reqParam.value[i].equipmentDetailId = equipmentList.value[i].equipmentId;
|
|
|
|
+ reqParam.value[i].equipmentDetailCode = equipmentList.value[i].equipmentCode;
|
|
|
|
+ console.log(reqParam.value[i])
|
|
|
|
+ }
|
|
|
|
+ console.log(reqParam.value)
|
|
|
|
+ saveDayWorkItemBatch(reqParam.value).then(res => {
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ icon: 'success',
|
|
|
|
+ title: '操作成功',
|
|
|
|
+ duration: 2000
|
|
|
|
+ });
|
|
|
|
+ init();
|
|
|
|
+ } else {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ icon: 'error',
|
|
|
|
+ title: '操作失败',
|
|
|
|
+ duration: 2000
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
<style lang="scss">
|
|
.container {
|
|
.container {
|
|
- height: 2000rpx;
|
|
|
|
|
|
+ height: 2000rpx;
|
|
background-color: #f5f5f5;
|
|
background-color: #f5f5f5;
|
|
overflow: auto;
|
|
overflow: auto;
|
|
}
|
|
}
|
|
|
|
+
|
|
.scroll-container {
|
|
.scroll-container {
|
|
position: absolute;
|
|
position: absolute;
|
|
top: 24rpx;
|
|
top: 24rpx;
|
|
@@ -172,10 +212,9 @@
|
|
.label {
|
|
.label {
|
|
font-size: 32rpx;
|
|
font-size: 32rpx;
|
|
font-weight: bold;
|
|
font-weight: bold;
|
|
-
|
|
|
|
- &.code {
|
|
|
|
- margin-left: 8rpx;
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ .code {
|
|
|
|
+ margin-left: 8rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -197,25 +236,20 @@
|
|
|
|
|
|
.right-info {
|
|
.right-info {
|
|
justify-content: flex-end;
|
|
justify-content: flex-end;
|
|
|
|
+ width: 45%;
|
|
margin-top: 5rpx;
|
|
margin-top: 5rpx;
|
|
-
|
|
|
|
.label {
|
|
.label {
|
|
font-size: 28rpx;
|
|
font-size: 28rpx;
|
|
-
|
|
|
|
- color: #000000;
|
|
|
|
-
|
|
|
|
- &.time {
|
|
|
|
- margin-left: 8rpx;
|
|
|
|
- color: #1684fc;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- &.number {
|
|
|
|
- margin-left: 8rpx;
|
|
|
|
- color: rgba(0, 226, 166, 1);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
+ .time {
|
|
|
|
+ margin-left: 8rpx;
|
|
|
|
+ color: #1684fc;
|
|
|
|
+ }
|
|
|
|
+ .number {
|
|
|
|
+ margin-left: 8rpx;
|
|
|
|
+ color: #1684fc;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -236,13 +270,11 @@
|
|
color: #FFFFFF;
|
|
color: #FFFFFF;
|
|
|
|
|
|
&.left-btn {
|
|
&.left-btn {
|
|
- background-color: #1684fc;
|
|
|
|
|
|
+ background-color: rgba(0, 226, 166, 1);
|
|
}
|
|
}
|
|
|
|
|
|
&.right-btn {
|
|
&.right-btn {
|
|
- background-color: rgb(255, 121, 1);
|
|
|
|
margin-left: 24rpx;
|
|
margin-left: 24rpx;
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -253,12 +285,10 @@
|
|
|
|
|
|
.finished-turnover-tag {
|
|
.finished-turnover-tag {
|
|
margin: unset;
|
|
margin: unset;
|
|
-
|
|
|
|
border-radius: 8rpx;
|
|
border-radius: 8rpx;
|
|
background-color: rgb(255, 85, 85);
|
|
background-color: rgb(255, 85, 85);
|
|
font-size: 28rpx;
|
|
font-size: 28rpx;
|
|
color: #FFFFFF;
|
|
color: #FFFFFF;
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|