|
|
@ -110,7 +110,7 @@ |
|
|
|
<scroll-view scroll-y="true" class="scroll-detail"> |
|
|
|
<view class="" |
|
|
|
style="font-size: 35rpx;display: flex;flex-direction: row;align-items: center;width: 100%;" |
|
|
|
v-for="(item, index) in subList" :key="item.id"> |
|
|
|
v-for="(item, index) in detailList" :key="item.id"> |
|
|
|
<text style="font-size: 35rpx;margin-right: 20rpx;">{{index+1}}.</text> |
|
|
|
|
|
|
|
<view class=""> |
|
|
@ -134,17 +134,21 @@ |
|
|
|
|
|
|
|
|
|
|
|
<view class="bottom" style="padding-bottom: 20rpx;"> |
|
|
|
<button :disabled="submitting" type="primary" class="save-button" @click="submit">提交</button> |
|
|
|
<button :disabled="submitting" type="primary" class="save-button" @click="commit">提交</button> |
|
|
|
</view> |
|
|
|
<comMessage ref="comMessage"></comMessage> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import comMessage from '@/mycomponents/common/comMessage.vue' |
|
|
|
import { |
|
|
|
getInspectJobDetail, |
|
|
|
takeInspectJob, |
|
|
|
cancleTakeInspectJob, |
|
|
|
inspectJobSubmit |
|
|
|
} from '@/api/request2.js'; |
|
|
|
import comMessage from '@/mycomponents/common/comMessage.vue' |
|
|
|
|
|
|
|
import { |
|
|
|
getInspectFailedReasonList, |
|
|
|
getNextActionList, |
|
|
@ -170,7 +174,7 @@ |
|
|
|
locations: [], |
|
|
|
value: ['0'], |
|
|
|
jobContent: {}, //任务内容 |
|
|
|
subList: [], //接口返回的任务details |
|
|
|
detailList: [], //接口返回的任务details |
|
|
|
detailSource: [], //绑定在页面上的数据源 |
|
|
|
nextActionList: [], |
|
|
|
nextAction: null, |
|
|
@ -184,19 +188,51 @@ |
|
|
|
|
|
|
|
if (this.id != undefined) { |
|
|
|
// //新建的任务自动接收 |
|
|
|
// if (option.status == "JOB_PENDING") { |
|
|
|
// this.receive((callback => { |
|
|
|
// this.received = true; |
|
|
|
// this.getDetail(); |
|
|
|
// })); |
|
|
|
// } else { |
|
|
|
// this.getDetail(); |
|
|
|
// } |
|
|
|
this.getDetail(); |
|
|
|
if (option.status == "1") { |
|
|
|
this.receive((callback => { |
|
|
|
this.received = true; |
|
|
|
this.getDetail(); |
|
|
|
})); |
|
|
|
} else { |
|
|
|
this.getDetail(); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
onBackPress(e) { |
|
|
|
//已经接收但是没提交任务 |
|
|
|
if (e.from == 'backbutton') { |
|
|
|
if (this.received) { |
|
|
|
//取消承接任务 |
|
|
|
cancleTakeInspectJob(this.id).then(res => { |
|
|
|
uni.navigateBack(); |
|
|
|
}).catch(error => { |
|
|
|
uni.navigateBack(); |
|
|
|
}) |
|
|
|
} else { |
|
|
|
uni.navigateBack(); |
|
|
|
} |
|
|
|
|
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
methods: { |
|
|
|
//接收 |
|
|
|
receive(callback) { |
|
|
|
uni.showLoading({ |
|
|
|
title: "加载中....", |
|
|
|
mask: true |
|
|
|
}); |
|
|
|
if (this.id != null) { |
|
|
|
takeInspectJob(this.id).then(res => { |
|
|
|
uni.hideLoading(); |
|
|
|
callback(); |
|
|
|
}).catch(error => { |
|
|
|
uni.hideLoading(); |
|
|
|
this.showErrorMessage(error) |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
getDetail() { |
|
|
|
var that = this; |
|
|
|
uni.showLoading({ |
|
|
@ -211,7 +247,7 @@ |
|
|
|
} else { |
|
|
|
if (res.data.subList.length > 0) { |
|
|
|
that.jobContent = res.data; |
|
|
|
that.subList = res.data.subList; |
|
|
|
that.detailList = res.data.subList; |
|
|
|
that.inspectType =that.jobContent.inspectType; |
|
|
|
that.jobContent.goodQty = null, //合格数量 |
|
|
|
that.jobContent.failedQty = null,//不合格数量 |
|
|
@ -280,7 +316,9 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
submit() { |
|
|
|
|
|
|
|
|
|
|
|
commit() { |
|
|
|
|
|
|
|
if (this.jobContent.failedQty == null) { |
|
|
|
this.showMessage("请输入不合格数量") |
|
|
@ -306,18 +344,19 @@ |
|
|
|
if (failedQty == 0) { |
|
|
|
//直接提交 |
|
|
|
this.jobContent.subList.forEach(res=>{ |
|
|
|
res.handleQty = res.qty |
|
|
|
res.failedQty = 0; |
|
|
|
res.notPassedQty = 0; |
|
|
|
res.crackQty = 0; |
|
|
|
res.goodQty = this.jobContent.receiveQty; |
|
|
|
res.fromInventory_status = res.inventoryStatus |
|
|
|
res.toInventoryStatus = res.inventoryStatus |
|
|
|
res.failedReason =""; |
|
|
|
res.photos = "" |
|
|
|
res.inspectResult ="" |
|
|
|
res.inspectUser =this.$store.state.user.id |
|
|
|
}) |
|
|
|
var tttt = JSON.stringify(this.jobContent); |
|
|
|
console.log("提交参数", tttt) |
|
|
|
this.submitJob(this.jobContent) |
|
|
|
|
|
|
|
} else { |
|
|
|
//不合格数量>0 |
|
|
|
//下一步动作 |
|
|
@ -329,18 +368,18 @@ |
|
|
|
if (this.nextAction == "ALL_NOK") { |
|
|
|
//提交 |
|
|
|
this.jobContent.subList.forEach(res=>{ |
|
|
|
res.handleQty = res.qty |
|
|
|
res.failedQty = this.jobContent.receiveQty; |
|
|
|
res.notPassedQty = this.jobContent.receiveQty; |
|
|
|
res.crackQty = 0; |
|
|
|
res.goodQty = 0; |
|
|
|
res.from_inventory_status = res.inventoryStatus |
|
|
|
res.toInventoryStatus = "NOK" |
|
|
|
res.failedReason =""; |
|
|
|
res.photos = "" |
|
|
|
res.inspectResult ="" |
|
|
|
re.inspectUser =this.$store.state.user.id |
|
|
|
}) |
|
|
|
var tttt = JSON.stringify(this.jobContent); |
|
|
|
console.log("提交参数", tttt) |
|
|
|
this.submitJob(this.jobContent) |
|
|
|
//部分合格 |
|
|
|
} else if (this.nextAction == "PARTIAL_OK") { |
|
|
|
//进入下一页面 |
|
|
@ -351,23 +390,48 @@ |
|
|
|
} else if (this.nextAction == "FULL_INSPECT") { |
|
|
|
//提交 |
|
|
|
this.jobContent.subList.forEach(res=>{ |
|
|
|
res.failedQty =0; |
|
|
|
res.handleQty = res.qty |
|
|
|
res.failedQty = 0; |
|
|
|
res.notPassedQty = 0; |
|
|
|
res.crackQty = 0; |
|
|
|
res.goodQty =this.jobContent.receiveQty; |
|
|
|
res.fromInventory_status = res.inventoryStatus |
|
|
|
res.goodQty = this.jobContent.receiveQty; |
|
|
|
res.toInventoryStatus = res.inventoryStatus |
|
|
|
res.failedReason =""; |
|
|
|
res.photos = "" |
|
|
|
res.inspectResult ="" |
|
|
|
res.inspectUser =this.$store.state.user.id |
|
|
|
}) |
|
|
|
var tttt = JSON.stringify(this.jobContent); |
|
|
|
console.log("提交参数", tttt) |
|
|
|
this.submitJob(this.jobContent) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
submitJob(params){ |
|
|
|
uni.showLoading({ |
|
|
|
title: "提交中....", |
|
|
|
mask: true |
|
|
|
}); |
|
|
|
console.log("提交参数", JSON.stringify(params)); |
|
|
|
inspectJobSubmit(params).then(res=>{ |
|
|
|
if (res.data) { |
|
|
|
this.showCommitSuccessMessage("提交成功<br>生成到货检验记录" + res.data, ) |
|
|
|
} else { |
|
|
|
this.showErrorMessage("提交失败"+res.msg) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
}).catch(error=>{ |
|
|
|
uni.hideLoading() |
|
|
|
this.showErrorMessage(error) |
|
|
|
}) |
|
|
|
}, |
|
|
|
showCommitSuccessMessage(hint) { |
|
|
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
|
|
|
setTimeout(() => { |
|
|
|
uni.navigateTo({ |
|
|
|
url: './inspectJob' |
|
|
|
}) |
|
|
|
}, 3000) |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|