|
@ -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; |
|
|
if (this.detailSource.subList.length == 0) { |
|
|
let that = this; |
|
|
this.detailSource = { |
|
|
uni.showLoading({ |
|
|
workshopCode: item.workshopCode, |
|
|
title: '加载中...', |
|
|
workShopName: item.workShopName, |
|
|
mask: true |
|
|
|
|
|
}) |
|
|
totalQty: 0, |
|
|
getBalanceByBatchOffShelf(item.itemCode, item.qty).then(res => { |
|
|
subList: [] |
|
|
if (res.data == null) { |
|
|
} |
|
|
that.showMessage('未获取到推荐信息'); |
|
|
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 |
|
|
|
|
|
} |
|
|
|
|
|
this.detailSource.subList.push(subItem) |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
var result = this.detailSource.subList.filter(res => { |
|
|
if (res.data.length > 0) { |
|
|
if (res.itemCode == item.itemCode&& |
|
|
this.workShopCode = item.workshopCode; |
|
|
res.productionLineCode==item.productionLineCode&& |
|
|
res.data.forEach(r => { |
|
|
res.workStationCode==item.workStationCode) { |
|
|
r.toLocationCode = item.rawLocationCode; |
|
|
return res |
|
|
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 (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 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.detailSource.subList.push(subItem) |
|
|
// if (this.detailSource.subList.length == 0) { |
|
|
|
|
|
// this.detailSource = { |
|
|
|
|
|
// workshopCode: item.workshopCode, |
|
|
|
|
|
// workShopName: item.workShopName, |
|
|
|
|
|
|
|
|
} else { |
|
|
// totalQty: 0, |
|
|
//有了更新数据 |
|
|
// subList: [] |
|
|
result[0].qty += item.qty |
|
|
// } |
|
|
|
|
|
// 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 |
|
|
|
|
|
// } |
|
|
|
|
|
// 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 |
|
|
|
|
|
// } |
|
|
|
|
|
// }) |
|
|
|
|
|
|
|
|
} |
|
|
// //没有添加数据 |
|
|
} |
|
|
// if (result.length == 0) { |
|
|
this.caclcQty(); |
|
|
// var subItem = { |
|
|
if (this.$refs.issueRequest != undefined) { |
|
|
// productionLineCode: item.productionLineCode, |
|
|
this.$refs.issueRequest.update() |
|
|
// 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 { |
|
|
|
|
|
// //有了更新数据 |
|
|
|
|
|
// result[0].qty += item.qty |
|
|
|
|
|
|
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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) {} |
|
|