|
@@ -3,13 +3,13 @@
|
|
<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">批次号:</text>
|
|
<text class="label code"> {{ item['lotCode'] }}</text>
|
|
<text class="label code"> {{ item['lotCode'] }}</text>
|
|
</view>
|
|
</view>
|
|
<view class="right-info " style="flex: 3;margin-right: -30rpx;">
|
|
<view class="right-info " style="flex: 3;margin-right: -30rpx;">
|
|
- <view class="right-info uni-row" > <text class="label">工时</text>
|
|
|
|
- <text class="label time" >{{ item['taskTime'] }}h</text>
|
|
|
|
|
|
+ <view class="right-info uni-row"> <text class="label">工时</text>
|
|
|
|
+ <text class="label time">{{ item['taskTime'] }}h</text>
|
|
</view>
|
|
</view>
|
|
<view class="right-info uni-row"> <text class="label">合格数</text>
|
|
<view class="right-info uni-row"> <text class="label">合格数</text>
|
|
<text class="label number ">{{ item['qualifiedNum'] }}</text>
|
|
<text class="label number ">{{ item['qualifiedNum'] }}</text>
|
|
@@ -37,16 +37,18 @@
|
|
<text class="label right">{{ (item['reason'] != "")?item['reason']:'-'}}</text>
|
|
<text class="label right">{{ (item['reason'] != "")?item['reason']:'-'}}</text>
|
|
</view>
|
|
</view>
|
|
|
|
|
|
- <!-- <view v-if="item['userId'] == userInfo['userId'] ? item['status'] == 0 : false" 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>
|
|
<button class="finished-turnover-tag" size="mini">开始加工</button>
|
|
</view> -->
|
|
</view> -->
|
|
- <view v-if="item['userId'] == userInfo['userId'] ? item['status'] == 1 : false" class="status-btn uni-row ">
|
|
|
|
|
|
+ <view v-if="item['userId'] == userInfo['userId'] ? item['status'] == 1 : 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>
|
|
- <view v-if="item['userId'] == userInfo['userId'] ? item['status'] == 0 : false" 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="handleStartFirstItem(item)">开始报工</button>
|
|
|
|
|
|
+ @click.stop="handleStartProcessing(item)">开始报工</button>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</scroll-view>
|
|
</scroll-view>
|
|
@@ -81,16 +83,16 @@
|
|
timestampToTime
|
|
timestampToTime
|
|
} from '@/utils/common.js'
|
|
} from '@/utils/common.js'
|
|
|
|
|
|
- const listData = ref([]) // 回显
|
|
|
|
- const curSubDetails = ref({}) // 接收生产计划单信息
|
|
|
|
- const dayWorkInfo = ref({}) // 接收daywork信息
|
|
|
|
- const equipmentList = ref([]) // 设备列表
|
|
|
|
|
|
+ const listData = ref([]) // 回显
|
|
|
|
+ const curSubDetails = ref({}) // 接收生产计划单信息
|
|
|
|
+ const dayWorkInfo = ref({}) // 接收daywork信息
|
|
|
|
+ const equipmentList = ref([]) // 设备列表
|
|
const endWorkDialog = ref(null) // 组件
|
|
const endWorkDialog = ref(null) // 组件
|
|
- const selectEquipment = ref(null)// 组件
|
|
|
|
- const dayWorkItem = ref({}) // 添加传输对象
|
|
|
|
- const reqParam = ref([]) // 请求参数
|
|
|
|
- const userInfo = ref(null) // 登录员工信息
|
|
|
|
-
|
|
|
|
|
|
+ const selectEquipment = ref(null) // 组件
|
|
|
|
+ const dayWorkItem = ref({}) // 添加传输对象
|
|
|
|
+ const reqParam = ref([]) // 请求参数
|
|
|
|
+ const userInfo = ref(null) // 登录员工信息
|
|
|
|
+
|
|
onLoad(() => {
|
|
onLoad(() => {
|
|
curSubDetails.value = store.planSubDetails;
|
|
curSubDetails.value = store.planSubDetails;
|
|
dayWorkInfo.value = store.dayworkInfo;
|
|
dayWorkInfo.value = store.dayworkInfo;
|
|
@@ -111,8 +113,8 @@
|
|
// 时间戳转工时
|
|
// 时间戳转工时
|
|
for (var i = 0; i < listData.value.length; i++) {
|
|
for (var i = 0; i < listData.value.length; i++) {
|
|
let timeStamp = Date.parse(listData.value[i].endTime) - Date.parse(listData.value[i].startTime);
|
|
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)
|
|
|
|
|
|
+ listData.value[i].taskTime = (timeStamp / 3600000).toFixed(2) === 'NaN' ? 0 : (timeStamp / 3600000)
|
|
|
|
+ .toFixed(2);
|
|
}
|
|
}
|
|
uni.hideLoading()
|
|
uni.hideLoading()
|
|
})
|
|
})
|
|
@@ -138,11 +140,15 @@
|
|
equipmentList.value = data;
|
|
equipmentList.value = data;
|
|
}
|
|
}
|
|
|
|
|
|
- function handleStartProcessing() {
|
|
|
|
- selectEquipment.value.open();
|
|
|
|
|
|
+ function handleStartProcessing(item) {
|
|
|
|
+ selectEquipment.value.open(item);
|
|
}
|
|
}
|
|
-
|
|
|
|
- function handleStartFirstItem(item){
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 新批次默认item去报工(执行方法)
|
|
|
|
+ * @param {Object} item
|
|
|
|
+ */
|
|
|
|
+ function handleStartFirstItem(item) {
|
|
let reqParam = item;
|
|
let reqParam = item;
|
|
reqParam.status = 1;
|
|
reqParam.status = 1;
|
|
reqParam.startTime = timestampToTime(new Date());
|
|
reqParam.startTime = timestampToTime(new Date());
|
|
@@ -151,10 +157,10 @@
|
|
uni.showToast({
|
|
uni.showToast({
|
|
icon: "success",
|
|
icon: "success",
|
|
title: "报工成功",
|
|
title: "报工成功",
|
|
- duration:2000
|
|
|
|
|
|
+ duration: 2000
|
|
})
|
|
})
|
|
init();
|
|
init();
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
uni.showToast({
|
|
uni.showToast({
|
|
icon: "fail",
|
|
icon: "fail",
|
|
title: "报工失败,请联系管理员",
|
|
title: "报工失败,请联系管理员",
|
|
@@ -165,24 +171,28 @@
|
|
}
|
|
}
|
|
|
|
|
|
function handleAddDayWorkItem(data) {
|
|
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,
|
|
|
|
- technologicalProcessId: store.dayworkInfo.technologicalProcessId,
|
|
|
|
- status: 1,
|
|
|
|
- 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(data)
|
|
|
|
+ if (data[0].nickName) { // data里面任意一对象除了设备相关的字段存在,直接给reqParam赋值
|
|
|
|
+ reqParam.value = data;
|
|
|
|
+ } else {
|
|
|
|
+ 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,
|
|
|
|
+ technologicalProcessId: store.dayworkInfo.technologicalProcessId,
|
|
|
|
+ status: 1,
|
|
|
|
+ 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)
|
|
console.log(reqParam.value)
|
|
saveDayWorkItemBatch(reqParam.value).then(res => {
|
|
saveDayWorkItemBatch(reqParam.value).then(res => {
|
|
@@ -236,15 +246,18 @@
|
|
justify-content: space-between;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
align-items: center;
|
|
margin-top: 8rpx;
|
|
margin-top: 8rpx;
|
|
- width: 100%;
|
|
|
|
|
|
+ width: 100%;
|
|
|
|
+
|
|
.title {
|
|
.title {
|
|
height: 48rpx;
|
|
height: 48rpx;
|
|
align-items: center;
|
|
align-items: center;
|
|
flex: 7;
|
|
flex: 7;
|
|
|
|
+
|
|
.label {
|
|
.label {
|
|
font-size: 32rpx;
|
|
font-size: 32rpx;
|
|
font-weight: bold;
|
|
font-weight: bold;
|
|
}
|
|
}
|
|
|
|
+
|
|
.code {
|
|
.code {
|
|
margin-left: 8rpx;
|
|
margin-left: 8rpx;
|
|
}
|
|
}
|
|
@@ -267,21 +280,24 @@
|
|
}
|
|
}
|
|
|
|
|
|
.right-info {
|
|
.right-info {
|
|
|
|
+
|
|
// justify-content: flex-end;
|
|
// justify-content: flex-end;
|
|
// width:45%;
|
|
// width:45%;
|
|
// margin-top: 5rpx;
|
|
// margin-top: 5rpx;
|
|
.label {
|
|
.label {
|
|
font-size: 28rpx;
|
|
font-size: 28rpx;
|
|
}
|
|
}
|
|
|
|
+
|
|
.time {
|
|
.time {
|
|
margin-left: 8rpx;
|
|
margin-left: 8rpx;
|
|
color: #1684fc;
|
|
color: #1684fc;
|
|
}
|
|
}
|
|
|
|
+
|
|
.number {
|
|
.number {
|
|
margin-left: 8rpx;
|
|
margin-left: 8rpx;
|
|
- color: #1684fc;
|
|
|
|
|
|
+ color: #1684fc;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|