|
@ -1,18 +1,13 @@ |
|
|
<template> |
|
|
<template> |
|
|
<view class="page-wraper"> |
|
|
<view class="page-wraper"> |
|
|
<view class="" v-if='detailSource.length==0'> |
|
|
<view class="" v-if='detailSource.subList.length==0'> |
|
|
<com-blank-view @goScan='goScan()'></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"> |
|
|
<scroll-view scroll-y="true" class=""> |
|
|
<comIssueRequestCreator ref="issueRequest" :dataContent="detailSource"> |
|
|
<view v-for="(toLocation, index) in detailSource"> |
|
|
</comIssueRequestCreator> |
|
|
<com-issue-detail-card ref='comIssueDetailCard' :dataContent="toLocation" |
|
|
<button class="btn_add" @click="goScan(false)">+去添加</button> |
|
|
@updateData='updateData'> |
|
|
|
|
|
</com-issue-detail-card> |
|
|
|
|
|
</view> |
|
|
|
|
|
</scroll-view> |
|
|
|
|
|
<button class="btn_add" @click="goScan()">+去添加</button> |
|
|
|
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
<div class="btn_bottom"> |
|
|
<div class="btn_bottom"> |
|
@ -23,8 +18,7 @@ |
|
|
</view> |
|
|
</view> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<win-scan-button @goScan='openScanDetailPopup'></win-scan-button> |
|
|
<com-scan-issue-pack ref="comScanIssuePack"> |
|
|
<com-scan-issue-pack ref="comScanIssuePack" @closeScan='closeScanPopup' @updateData='updateData'> |
|
|
|
|
|
</com-scan-issue-pack> |
|
|
</com-scan-issue-pack> |
|
|
<comMessage ref="comMessage"></comMessage> |
|
|
<comMessage ref="comMessage"></comMessage> |
|
|
</view> |
|
|
</view> |
|
@ -33,18 +27,14 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
// import { |
|
|
|
|
|
// getIssueJobDetail, |
|
|
|
|
|
// } from '@/api/request.js'; |
|
|
|
|
|
|
|
|
|
|
|
import { |
|
|
import { |
|
|
// getIssueJobDetail, |
|
|
|
|
|
issueRequestSubmit, |
|
|
issueRequestSubmit, |
|
|
issueRecordSubmit |
|
|
issueRecordSubmit |
|
|
} from '@/api/request2.js'; |
|
|
} from '@/api/request2.js'; |
|
|
|
|
|
|
|
|
import { |
|
|
import { |
|
|
goHome, |
|
|
goHome, |
|
|
|
|
|
updateTitle, |
|
|
getRemoveOption, |
|
|
getRemoveOption, |
|
|
getISODateTime |
|
|
getISODateTime |
|
|
} from '@/common/basic.js'; |
|
|
} from '@/common/basic.js'; |
|
@ -56,126 +46,170 @@ |
|
|
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
|
|
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
|
|
import comIssueRequestPopup from '@/pages/issue/coms/comIssueRequestPopup.vue' |
|
|
import comIssueRequestPopup from '@/pages/issue/coms/comIssueRequestPopup.vue' |
|
|
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' |
|
|
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' |
|
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|
|
|
|
|
import comIssueDetailCard from '@/pages/issue/coms/comIssueDetailCard.vue' |
|
|
|
|
|
import comScanIssuePack from '@/pages/issue/coms/comScanIssuePack.vue' |
|
|
import comScanIssuePack from '@/pages/issue/coms/comScanIssuePack.vue' |
|
|
import comMessage from '@/mycomponents/common/comMessage.vue' |
|
|
import comMessage from '@/mycomponents/common/comMessage.vue' |
|
|
|
|
|
import comIssueRequestCreator from '@/pages/issue/coms/comIssueRequestCreator.vue' |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
name: 'issueDetail', |
|
|
name: 'issueRequestSubmit', |
|
|
components: { |
|
|
components: { |
|
|
comBlankView, |
|
|
comBlankView, |
|
|
comIssueRequestPopup, |
|
|
comIssueRequestPopup, |
|
|
jobDetailPopup, |
|
|
jobDetailPopup, |
|
|
winScanButton, |
|
|
|
|
|
comIssueDetailCard, |
|
|
|
|
|
comScanIssuePack, |
|
|
comScanIssuePack, |
|
|
comMessage |
|
|
comMessage, |
|
|
|
|
|
comIssueRequestCreator |
|
|
}, |
|
|
}, |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
id: '1689889453461090304', |
|
|
|
|
|
jobContent: {}, //任务内容 |
|
|
|
|
|
subList: [], //接口返回的任务subList |
|
|
subList: [], //接口返回的任务subList |
|
|
detailSource: [], //绑定在页面上的数据源 |
|
|
detailSource: { |
|
|
|
|
|
subList: [] |
|
|
|
|
|
}, //绑定在页面上的数据源 |
|
|
detailOptions: [], |
|
|
detailOptions: [], |
|
|
scanOptions: [], |
|
|
scanOptions: [], |
|
|
requestList: [] ,//需求信息 |
|
|
|
|
|
fromType:"" |
|
|
fromType:"" |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
mounted() { |
|
|
mounted() { |
|
|
this.goScan() |
|
|
this.goScan(true) |
|
|
}, |
|
|
}, |
|
|
onLoad(option) { |
|
|
onLoad(option) { |
|
|
this.fromType = option.fromType |
|
|
this.fromType = option.fromType |
|
|
if(this.fromType=="requestType"){
updateTitle("发料申请")
}else {
updateTitle("发料记录")
} |
|
|
if(this.fromType=="requestType"){ |
|
|
|
|
|
updateTitle("发料申请") |
|
|
|
|
|
}else { |
|
|
|
|
|
updateTitle("发料记录") |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
goScan() { |
|
|
goScan(editPosition) { |
|
|
this.$refs.comIssueRequestPopup.openRequestPopup(this.detailSource[0]); |
|
|
this.$refs.comIssueRequestPopup.openRequestPopup(editPosition); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
//确定需求信息 |
|
|
//确定需求信息 |
|
|
requestConfirm(action, item) { |
|
|
requestConfirm(action, item) { |
|
|
//调用接口查询推荐信息 |
|
|
|
|
|
this.getDetail(action, item); |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getDetail(action, item) { |
|
|
if (this.detailSource.subList.length == 0) { |
|
|
var that = this; |
|
|
this.detailSource = { |
|
|
uni.showLoading({ |
|
|
workshopCode: item.workshopCode, |
|
|
title: "加载中....", |
|
|
workShopName: item.workShopName, |
|
|
mask: true |
|
|
|
|
|
}); |
|
|
totalQty: 0, |
|
|
getIssueJobDetail(this.id).then(res => { |
|
|
subList: [] |
|
|
if (res.data[0].subList.length > 0) { |
|
|
|
|
|
that.subList = res.data[0].subList; |
|
|
|
|
|
if (action == 'update') //更新需求信息,将原来的零件节点删除 |
|
|
|
|
|
{ |
|
|
|
|
|
let index = that.detailSource[0].Items.findIndex(r => r.itemCode == item.itemCode); |
|
|
|
|
|
if (index >= 0) { |
|
|
|
|
|
that.detailSource[0].Items.splice(index, 1); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
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 |
|
|
} |
|
|
} |
|
|
that.detailSource = getDataSource(that.detailSource, that.subList) |
|
|
this.detailSource.subList.push(subItem) |
|
|
that.resizeCollapse(); |
|
|
} else { |
|
|
|
|
|
var result = this.detailSource.subList.filter(res => { |
|
|
|
|
|
if (res.itemCode == item.itemCode&& |
|
|
|
|
|
res.productionLineCode==item.productionLineCode&& |
|
|
|
|
|
res.workStationCode==item.workStationCode) { |
|
|
|
|
|
return res |
|
|
} |
|
|
} |
|
|
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 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
updateData(record) { |
|
|
this.detailSource.subList.push(subItem) |
|
|
let requestLocation = this.detailSource.find(r => r.toLocationCode == record.toLocationCode); |
|
|
|
|
|
let item = requestLocation.Items.find(r => r.itemCode == record.itemCode); |
|
|
|
|
|
let itemHandleQty = 0; |
|
|
|
|
|
if (item != undefined) { |
|
|
|
|
|
item.Locations.forEach(l => { |
|
|
|
|
|
let batch = l.Batchs.find(b => (b.packingNumber == record.packingNumber || b |
|
|
|
|
|
.packingNumber == '') && b.batch == |
|
|
|
|
|
record.batch); |
|
|
|
|
|
|
|
|
|
|
|
let handleQty = 0; |
|
|
} else { |
|
|
batch.Records.forEach(res => { |
|
|
//有了更新数据 |
|
|
handleQty += Number(res.qty) |
|
|
result[0].qty += item.qty |
|
|
}) |
|
|
|
|
|
batch.handleQty = handleQty; |
|
|
} |
|
|
itemHandleQty += handleQty; |
|
|
} |
|
|
}) |
|
|
this.caclcQty(); |
|
|
|
|
|
if (this.$refs.issueRequest != undefined) { |
|
|
|
|
|
this.$refs.issueRequest.update() |
|
|
} |
|
|
} |
|
|
// item.handleQty=itemHandleQty; |
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
openScanDetailPopup() { |
|
|
caclcQty() { |
|
|
var datacontent = {} |
|
|
var totalQty = 0; |
|
|
//克隆对象,深度克隆,防止双向绑定同一个变量 |
|
|
this.detailSource.subList.forEach(res => { |
|
|
// Object.assign(datacontent, this.detailSource); |
|
|
totalQty += res.qty |
|
|
this.$refs.comScanIssuePack.openScanPopup(this.detailSource, this.jobContent); |
|
|
}) |
|
|
|
|
|
this.detailSource.totalQty = totalQty; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
closeScanPopup() { |
|
|
|
|
|
this.resizeCollapse(); |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
resizeCollapse() { |
|
|
setParams() { |
|
|
this.$nextTick(r => { |
|
|
return this.detailSource |
|
|
this.$refs.comIssueDetailCard.forEach(r => { |
|
|
|
|
|
r.resizeCollapse(); |
|
|
|
|
|
}) |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
}, |
|
|
submit() { |
|
|
submit() { |
|
|
|
|
|
uni.showLoading({ |
|
|
|
|
|
title: "提交中....", |
|
|
|
|
|
mask: true |
|
|
|
|
|
}); |
|
|
if(this.fromType =="requestType"){ |
|
|
if(this.fromType =="requestType"){ |
|
|
|
|
|
var params = this.setParams() |
|
|
|
|
|
console.log("提交参数", JSON.stringify(params)); |
|
|
|
|
|
issueRequestSubmit(params).then(res => { |
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
if (res.data) { |
|
|
|
|
|
this.showCommitSuccessMessage("提交成功<br>生成发料申请" + res.data) |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
this.showErrorMessage("提交失败" + res.msg) |
|
|
|
|
|
} |
|
|
|
|
|
}).catch(error => { |
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
this.showErrorMessage(error) |
|
|
|
|
|
}) |
|
|
|
|
|
}else { |
|
|
|
|
|
var params = this.setParams() |
|
|
|
|
|
console.log("提交参数", JSON.stringify(params)); |
|
|
|
|
|
issueRecordSubmit(params).then(res => { |
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
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 => { |
|
|
|
|
|
if(this.fromType =="requestType"){ |
|
|
|
|
|
uni.navigateTo({ |
|
|
|
|
|
url: './issueRequest' |
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
showErrorMessage(message) { |
|
|
|
|
|
this.$refs.comMessage.showErrorMessage(message, res => { |
|
|
|
|
|
if (res) {} |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|