|
|
@ -1,13 +1,22 @@ |
|
|
|
<template> |
|
|
|
<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> |
|
|
|
</view> |
|
|
|
<view v-else class="page-wraper"> |
|
|
|
<view class="page-main"> |
|
|
|
<comIssueRequestCreator ref="issueRequest" :dataContent="detailSource"> |
|
|
|
</comIssueRequestCreator> |
|
|
|
<button class="btn_add" @click="goScan(false)">+去添加</button> |
|
|
|
<scroll-view scroll-y="true" class=""> |
|
|
|
<view v-for="(toLocation, index) in detailSource"> |
|
|
|
<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> |
|
|
|
|
|
|
|
<div class="btn_bottom"> |
|
|
@ -17,16 +26,17 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</div> |
|
|
|
<comMessage ref="comMessage"></comMessage> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<comMessage ref="comMessage"></comMessage> |
|
|
|
<com-issue-request-popup ref="comIssueRequestPopup" @confirm='requestConfirm'></com-issue-request-popup> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { |
|
|
|
issueRequestSubmit, |
|
|
|
issueRecordSubmit |
|
|
|
issueRecordSubmit, |
|
|
|
getBalanceByBatchOffShelf |
|
|
|
} from '@/api/request2.js'; |
|
|
|
|
|
|
|
import { |
|
|
@ -45,6 +55,8 @@ |
|
|
|
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' |
|
|
|
import comMessage from '@/mycomponents/common/comMessage.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 { |
|
|
|
name: 'issueRequestSubmit', |
|
|
@ -53,18 +65,18 @@ |
|
|
|
comIssueRequestPopup, |
|
|
|
jobDetailPopup, |
|
|
|
comMessage, |
|
|
|
comIssueRequestCreator |
|
|
|
comIssueRequestCreator, |
|
|
|
comIssueRequestInfo, |
|
|
|
comIssueDetailCard |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
subList: [], //接口返回的任务subList |
|
|
|
detailSource: { |
|
|
|
subList: [] |
|
|
|
}, //绑定在页面上的数据源 |
|
|
|
detailSource: [], //绑定在页面上的数据源 |
|
|
|
detailOptions: [], |
|
|
|
scanOptions: [], |
|
|
|
fromType:"" |
|
|
|
|
|
|
|
fromType: "", |
|
|
|
workShopCode: "" |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted() { |
|
|
@ -80,68 +92,112 @@ |
|
|
|
|
|
|
|
}, |
|
|
|
methods: { |
|
|
|
resizeCollapse() { |
|
|
|
this.$nextTick(r => { |
|
|
|
this.$refs.comIssueDetailCard.forEach(r => { |
|
|
|
r.resizeCollapse(); |
|
|
|
}) |
|
|
|
}); |
|
|
|
}, |
|
|
|
goScan(editPosition) { |
|
|
|
this.$refs.comIssueRequestPopup.openRequestPopup(editPosition); |
|
|
|
}, |
|
|
|
|
|
|
|
//确定需求信息 |
|
|
|
requestConfirm(action, item) { |
|
|
|
|
|
|
|
if (this.detailSource.subList.length == 0) { |
|
|
|
this.detailSource = { |
|
|
|
workshopCode: item.workshopCode, |
|
|
|
workShopName: item.workShopName, |
|
|
|
|
|
|
|
totalQty: 0, |
|
|
|
subList: [] |
|
|
|
} |
|
|
|
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 (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 { |
|
|
|
var result = this.detailSource.subList.filter(res => { |
|
|
|
if (res.itemCode == item.itemCode&& |
|
|
|
res.productionLineCode==item.productionLineCode&& |
|
|
|
res.workStationCode==item.workStationCode) { |
|
|
|
return res |
|
|
|
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 (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 { |
|
|
|
//有了更新数据 |
|
|
|
result[0].qty += item.qty |
|
|
|
// totalQty: 0, |
|
|
|
// subList: [] |
|
|
|
// } |
|
|
|
// 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 |
|
|
|
// } |
|
|
|
// }) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
this.caclcQty(); |
|
|
|
if (this.$refs.issueRequest != undefined) { |
|
|
|
this.$refs.issueRequest.update() |
|
|
|
} |
|
|
|
// //没有添加数据 |
|
|
|
// 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) |
|
|
|
|
|
|
|
// } else { |
|
|
|
// //有了更新数据 |
|
|
|
// result[0].qty += item.qty |
|
|
|
|
|
|
|
// } |
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// this.caclcQty(); |
|
|
|
// if (this.$refs.issueRequest != undefined) { |
|
|
|
// this.$refs.issueRequest.update() |
|
|
|
// } |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
caclcQty() { |
|
|
|
var totalQty = 0; |
|
|
|
this.detailSource.subList.forEach(res => { |
|
|
@ -200,6 +256,13 @@ |
|
|
|
|
|
|
|
}) |
|
|
|
}, |
|
|
|
showMessage(message) { |
|
|
|
this.$refs.comMessage.showMessage(message, res => { |
|
|
|
if (res) { |
|
|
|
this.afterCloseMessage() |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
showErrorMessage(message) { |
|
|
|
this.$refs.comMessage.showErrorMessage(message, res => { |
|
|
|
if (res) {} |
|
|
|