|
@ -1,13 +1,22 @@ |
|
|
<template> |
|
|
<template> |
|
|
<view class="page-wraper"> |
|
|
<view class="page-wraper"> |
|
|
<view class="" v-if='detailSource.subList.length==0'> |
|
|
<view class="" v-if='detailSource.length==0'> |
|
|
<com-blank-view @goScan='goScan(true)'></com-blank-view> |
|
|
<com-blank-view @goScan='goScan(true)'></com-blank-view> |
|
|
</view> |
|
|
</view> |
|
|
<view v-else class="page-wraper"> |
|
|
<view v-else class="page-wraper"> |
|
|
<view class="page-main"> |
|
|
<view class="page-main"> |
|
|
<comIssueRequestCreator ref="issueRequest" :dataContent="detailSource"> |
|
|
<scroll-view scroll-y="true" class=""> |
|
|
</comIssueRequestCreator> |
|
|
<view v-for="(toLocation, index) in detailSource"> |
|
|
<button class="btn_add" @click="goScan(false)">+去添加</button> |
|
|
<com-issue-request-info :workShopCode="workShopCode" :dataContent="toLocation"> |
|
|
|
|
|
</com-issue-request-info> |
|
|
|
|
|
<com-issue-detail-card ref='comIssueDetailCard' :dataContent="toLocation" |
|
|
|
|
|
@updateData='updateData'> |
|
|
|
|
|
</com-issue-detail-card> |
|
|
|
|
|
</view> |
|
|
|
|
|
</scroll-view> |
|
|
|
|
|
<!-- <comIssueRequestCreator ref="issueRequest" :dataContent="detailSource"> |
|
|
|
|
|
</comIssueRequestCreator> --> |
|
|
|
|
|
<!-- <button class="btn_add" @click="goScan(false)">+去添加</button> --> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
<div class="btn_bottom"> |
|
|
<div class="btn_bottom"> |
|
@ -17,16 +26,17 @@ |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</div> |
|
|
</div> |
|
|
<comMessage ref="comMessage"></comMessage> |
|
|
|
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
<comMessage ref="comMessage"></comMessage> |
|
|
<com-issue-request-popup ref="comIssueRequestPopup" @confirm='requestConfirm'></com-issue-request-popup> |
|
|
<com-issue-request-popup ref="comIssueRequestPopup" @confirm='requestConfirm'></com-issue-request-popup> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import { |
|
|
import { |
|
|
issueRequestSubmit, |
|
|
issueRequestSubmit, |
|
|
issueRecordSubmit |
|
|
issueRecordSubmit, |
|
|
|
|
|
getBalanceByBatchOffShelf |
|
|
} from '@/api/request2.js'; |
|
|
} from '@/api/request2.js'; |
|
|
|
|
|
|
|
|
import { |
|
|
import { |
|
@ -45,6 +55,8 @@ |
|
|
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' |
|
|
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' |
|
|
import comMessage from '@/mycomponents/common/comMessage.vue' |
|
|
import comMessage from '@/mycomponents/common/comMessage.vue' |
|
|
import comIssueRequestCreator from '@/pages/issue/coms/comIssueRequestCreator.vue' |
|
|
import comIssueRequestCreator from '@/pages/issue/coms/comIssueRequestCreator.vue' |
|
|
|
|
|
import comIssueRequestInfo from '@/pages/issue/coms/comIssueRequestInfo.vue' |
|
|
|
|
|
import comIssueDetailCard from '@/pages/issue/coms/comIssueDetailCard.vue' |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
name: 'issueRequestSubmit', |
|
|
name: 'issueRequestSubmit', |
|
@ -53,18 +65,18 @@ |
|
|
comIssueRequestPopup, |
|
|
comIssueRequestPopup, |
|
|
jobDetailPopup, |
|
|
jobDetailPopup, |
|
|
comMessage, |
|
|
comMessage, |
|
|
comIssueRequestCreator |
|
|
comIssueRequestCreator, |
|
|
|
|
|
comIssueRequestInfo, |
|
|
|
|
|
comIssueDetailCard |
|
|
}, |
|
|
}, |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
subList: [], //接口返回的任务subList |
|
|
subList: [], //接口返回的任务subList |
|
|
detailSource: { |
|
|
detailSource: [], //绑定在页面上的数据源 |
|
|
subList: [] |
|
|
|
|
|
}, //绑定在页面上的数据源 |
|
|
|
|
|
detailOptions: [], |
|
|
detailOptions: [], |
|
|
scanOptions: [], |
|
|
scanOptions: [], |
|
|
fromType:"" |
|
|
fromType: "", |
|
|
|
|
|
workShopCode: "" |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
mounted() { |
|
|
mounted() { |
|
@ -72,76 +84,120 @@ |
|
|
}, |
|
|
}, |
|
|
onLoad(option) { |
|
|
onLoad(option) { |
|
|
this.fromType = option.fromType |
|
|
this.fromType = option.fromType |
|
|
if(this.fromType=="requestType"){ |
|
|
if (this.fromType == "requestType") { |
|
|
updateTitle("发料申请") |
|
|
updateTitle("发料申请") |
|
|
}else { |
|
|
} else { |
|
|
updateTitle("发料记录") |
|
|
updateTitle("发料记录") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
|
|
|
resizeCollapse() { |
|
|
|
|
|
this.$nextTick(r => { |
|
|
|
|
|
this.$refs.comIssueDetailCard.forEach(r => { |
|
|
|
|
|
r.resizeCollapse(); |
|
|
|
|
|
}) |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
goScan(editPosition) { |
|
|
goScan(editPosition) { |
|
|
this.$refs.comIssueRequestPopup.openRequestPopup(editPosition); |
|
|
this.$refs.comIssueRequestPopup.openRequestPopup(editPosition); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
//确定需求信息 |
|
|
//确定需求信息 |
|
|
requestConfirm(action, item) { |
|
|
requestConfirm(action, item) { |
|
|
|
|
|
if (item.itemCode == '' || item.itemCode == null) return; |
|
|
|
|
|
let that = this; |
|
|
|
|
|
uni.showLoading({ |
|
|
|
|
|
title: '加载中...', |
|
|
|
|
|
mask: true |
|
|
|
|
|
}) |
|
|
|
|
|
getBalanceByBatchOffShelf(item.itemCode, item.qty).then(res => { |
|
|
|
|
|
if (res.data == null) { |
|
|
|
|
|
that.showMessage('未获取到推荐信息'); |
|
|
|
|
|
} else { |
|
|
|
|
|
if (res.data.length > 0) { |
|
|
|
|
|
this.workShopCode = item.workshopCode; |
|
|
|
|
|
res.data.forEach(r => { |
|
|
|
|
|
r.toLocationCode = item.rawLocationCode; |
|
|
|
|
|
r.productionLineCode = item.productionLineCode; |
|
|
|
|
|
r.workStationCode = item.workStationCode; |
|
|
|
|
|
r.itemCode = item.itemCode; |
|
|
|
|
|
r.uom = item.uom; |
|
|
|
|
|
that.subList.push(r); |
|
|
|
|
|
}) |
|
|
|
|
|
that.detailSource = getDataSource(that.detailSource, that.subList) |
|
|
|
|
|
that.resizeCollapse(); |
|
|
|
|
|
} else { |
|
|
|
|
|
that.showMessage('列表数据为0'); |
|
|
|
|
|
} |
|
|
|
|
|
uni.hideLoading(); |
|
|
|
|
|
} |
|
|
|
|
|
}).catch(error => { |
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
this.showErrorMessage(error) |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
if (this.detailSource.subList.length == 0) { |
|
|
|
|
|
this.detailSource = { |
|
|
|
|
|
workshopCode: item.workshopCode, |
|
|
|
|
|
workShopName: item.workShopName, |
|
|
|
|
|
|
|
|
|
|
|
totalQty: 0, |
|
|
// if (this.detailSource.subList.length == 0) { |
|
|
subList: [] |
|
|
// this.detailSource = { |
|
|
} |
|
|
// workshopCode: item.workshopCode, |
|
|
var subItem = { |
|
|
// workShopName: item.workShopName, |
|
|
productionLineCode: item.productionLineCode, |
|
|
|
|
|
productionLineName: item.productionLineName, |
|
|
|
|
|
workStationCode: item.workStationCode, |
|
|
|
|
|
workStationName: item.workStationName, //工位 |
|
|
|
|
|
itemCode: item.itemCode, |
|
|
|
|
|
itemName: item.itemName, |
|
|
|
|
|
qty: item.qty, |
|
|
|
|
|
uom: item.uom |
|
|
|
|
|
} |
|
|
|
|
|
this.detailSource.subList.push(subItem) |
|
|
|
|
|
} else { |
|
|
|
|
|
var result = this.detailSource.subList.filter(res => { |
|
|
|
|
|
if (res.itemCode == item.itemCode&& |
|
|
|
|
|
res.productionLineCode==item.productionLineCode&& |
|
|
|
|
|
res.workStationCode==item.workStationCode) { |
|
|
|
|
|
return res |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
//没有添加数据 |
|
|
// totalQty: 0, |
|
|
if (result.length == 0) { |
|
|
// subList: [] |
|
|
var subItem = { |
|
|
// } |
|
|
productionLineCode: item.productionLineCode, |
|
|
// var subItem = { |
|
|
productionLineName: item.productionLineName, |
|
|
// productionLineCode: item.productionLineCode, |
|
|
workStationCode: item.workStationCode, |
|
|
// productionLineName: item.productionLineName, |
|
|
workStationName: item.workStationName, //工位 |
|
|
// workStationCode: item.workStationCode, |
|
|
itemCode: item.itemCode, |
|
|
// workStationName: item.workStationName, //工位 |
|
|
itemName: item.itemName, |
|
|
// itemCode: item.itemCode, |
|
|
qty: item.qty, |
|
|
// itemName: item.itemName, |
|
|
uom: item.uom |
|
|
// qty: item.qty, |
|
|
} |
|
|
// uom: item.uom |
|
|
|
|
|
// } |
|
|
|
|
|
// this.detailSource.subList.push(subItem) |
|
|
|
|
|
// } else { |
|
|
|
|
|
// var result = this.detailSource.subList.filter(res => { |
|
|
|
|
|
// if (res.itemCode == item.itemCode && |
|
|
|
|
|
// res.productionLineCode == item.productionLineCode && |
|
|
|
|
|
// res.workStationCode == item.workStationCode) { |
|
|
|
|
|
// return res |
|
|
|
|
|
// } |
|
|
|
|
|
// }) |
|
|
|
|
|
|
|
|
this.detailSource.subList.push(subItem) |
|
|
// //没有添加数据 |
|
|
|
|
|
// if (result.length == 0) { |
|
|
|
|
|
// var subItem = { |
|
|
|
|
|
// productionLineCode: item.productionLineCode, |
|
|
|
|
|
// productionLineName: item.productionLineName, |
|
|
|
|
|
// workStationCode: item.workStationCode, |
|
|
|
|
|
// workStationName: item.workStationName, //工位 |
|
|
|
|
|
// itemCode: item.itemCode, |
|
|
|
|
|
// itemName: item.itemName, |
|
|
|
|
|
// qty: item.qty, |
|
|
|
|
|
// uom: item.uom |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
} else { |
|
|
// this.detailSource.subList.push(subItem) |
|
|
//有了更新数据 |
|
|
|
|
|
result[0].qty += item.qty |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
// } else { |
|
|
} |
|
|
// //有了更新数据 |
|
|
this.caclcQty(); |
|
|
// result[0].qty += item.qty |
|
|
if (this.$refs.issueRequest != undefined) { |
|
|
|
|
|
this.$refs.issueRequest.update() |
|
|
// } |
|
|
} |
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// this.caclcQty(); |
|
|
|
|
|
// if (this.$refs.issueRequest != undefined) { |
|
|
|
|
|
// this.$refs.issueRequest.update() |
|
|
|
|
|
// } |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
caclcQty() { |
|
|
caclcQty() { |
|
|
var totalQty = 0; |
|
|
var totalQty = 0; |
|
|
this.detailSource.subList.forEach(res => { |
|
|
this.detailSource.subList.forEach(res => { |
|
@ -159,7 +215,7 @@ |
|
|
title: "提交中....", |
|
|
title: "提交中....", |
|
|
mask: true |
|
|
mask: true |
|
|
}); |
|
|
}); |
|
|
if(this.fromType =="requestType"){ |
|
|
if (this.fromType == "requestType") { |
|
|
var params = this.setParams() |
|
|
var params = this.setParams() |
|
|
console.log("提交参数", JSON.stringify(params)); |
|
|
console.log("提交参数", JSON.stringify(params)); |
|
|
issueRequestSubmit(params).then(res => { |
|
|
issueRequestSubmit(params).then(res => { |
|
@ -173,7 +229,7 @@ |
|
|
uni.hideLoading() |
|
|
uni.hideLoading() |
|
|
this.showErrorMessage(error) |
|
|
this.showErrorMessage(error) |
|
|
}) |
|
|
}) |
|
|
}else { |
|
|
} else { |
|
|
var params = this.setParams() |
|
|
var params = this.setParams() |
|
|
console.log("提交参数", JSON.stringify(params)); |
|
|
console.log("提交参数", JSON.stringify(params)); |
|
|
issueRecordSubmit(params).then(res => { |
|
|
issueRecordSubmit(params).then(res => { |
|
@ -192,7 +248,7 @@ |
|
|
}, |
|
|
}, |
|
|
showCommitSuccessMessage(hint) { |
|
|
showCommitSuccessMessage(hint) { |
|
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
|
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
|
|
if(this.fromType =="requestType"){ |
|
|
if (this.fromType == "requestType") { |
|
|
uni.navigateTo({ |
|
|
uni.navigateTo({ |
|
|
url: './issueRequest' |
|
|
url: './issueRequest' |
|
|
}) |
|
|
}) |
|
@ -200,6 +256,13 @@ |
|
|
|
|
|
|
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
showMessage(message) { |
|
|
|
|
|
this.$refs.comMessage.showMessage(message, res => { |
|
|
|
|
|
if (res) { |
|
|
|
|
|
this.afterCloseMessage() |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
showErrorMessage(message) { |
|
|
showErrorMessage(message) { |
|
|
this.$refs.comMessage.showErrorMessage(message, res => { |
|
|
this.$refs.comMessage.showErrorMessage(message, res => { |
|
|
if (res) {} |
|
|
if (res) {} |
|
|