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