You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

219 lines
5.7 KiB

12 months ago
<template>
<view class="page-wraper">
<view class="" v-if='detailSource.subList.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" :isSwipe="false">
12 months ago
</comIssueRequestCreator>
<button class="btn_add" @click="goScan(false)">+去添加</button>
</view>
<view class="page-footer">
<view class="uni-flex u-col-center space-between padding_10"
style="background-color:ghostwhite; width: 100%; ">
12 months ago
<view class="">
</view>
<view class=" uni-flex uni-row">
<button class="btn_single_commit" hover-class="btn_commit_after" @click="submit()">提交</button>
12 months ago
</view>
</view>
</view>
12 months ago
12 months ago
<com-scan-issue-pack ref="comScanIssuePack">
12 months ago
</com-scan-issue-pack>
<comMessage ref="comMessage"></comMessage>
</view>
</view>
<com-issue-request-popup ref="comIssueRequestPopup" @confirm='requestConfirm' :itemCodeTypeList="itemCodeTypeList" ></com-issue-request-popup>
12 months ago
</template>
<script>
import {
issueRequestSubmit,
} from '@/api/request2.js';
import {
calc
} from '@/common/calc.js';
import {
getBusinessType,
} from '@/common/record.js';
12 months ago
import {
goHome,
updateTitle,
getRemoveOption,
navigateBack,
getCurrDateOneMonthsTimes
12 months ago
} from '@/common/basic.js';
import {
getDataSource
} from '@/pages/issue/js/issue.js';
import comBlankView from '@/mycomponents/common/comBlankView.vue'
import comIssueRequestPopup from '@/pages/issue/coms/comIssueRequestPopup.vue'
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue'
import comScanIssuePack from '@/pages/issue/coms/comScanIssuePack.vue'
import comMessage from '@/mycomponents/common/comMessage.vue'
import comIssueRequestCreator from '@/pages/issue/coms/comIssueRequestCreator.vue'
export default {
name: 'issueRequestSubmit',
components: {
comBlankView,
comIssueRequestPopup,
jobDetailPopup,
comScanIssuePack,
comMessage,
comIssueRequestCreator
},
data() {
return {
jobContent: {}, //任务内容
subList: [], //接口返回的任务subList
detailSource: {
subList: []
}, //绑定在页面上的数据源
detailOptions: [],
scanOptions: [],
requestList: [], //需求信息
itemCodeTypeList:[],
useOnTheWay:"FALSE"
12 months ago
}
},
mounted() {
},
onLoad(option) {
var typeCode = "Issue"
getBusinessType(typeCode, res => {
if (res.success) {
this.itemCodeTypeList = res.itemCodeTypeList;
this.tolocationTypeList = res.tolocationTypeList;
this.useOnTheWay = res.useOnTheWay;
this.fromInventoryStatuses = res.fromInventoryStatuses
this.toInventoryStatuses = res.toInventoryStatuses
this.goScan(true)
} else {
this.showErrorMessage(res.message)
}
});
12 months ago
},
methods: {
goScan(editPosition) {
this.$refs.comIssueRequestPopup.openRequestPopup(editPosition);
},
//确定需求信息
requestConfirm(action, item) {
if (this.detailSource.subList.length == 0) {
this.detailSource = {
workshopCode: item.workshopCode,
12 months ago
workShopName: item.workShopName,
12 months ago
productionLineCode: item.productionLineCode,
productionLineName: item.productionLineName,
workStationCode: item.workStationCode,
workStationName: item.workStationName, //工位
toLocationCode: item.rawLocationCode,
fromWarehouseCode:item.fromWarehouseCode,
useOnTheWay:this.useOnTheWay,
12 months ago
totalQty: 0,
12 months ago
subList: []
}
12 months ago
var subItem = {
productionLineCode: item.productionLineCode,
workStationCode: item.workStationCode,
itemCode: item.itemCode,
itemName: item.itemName,
toWarehouseCode:item.toWarehouseCode,
fromWarehouseCode:item.fromWarehouseCode,
12 months ago
qty: item.qty,
uom: item.uom
}
this.detailSource.subList.push(subItem)
} else {
var result = this.detailSource.subList.filter(res => {
if (res.itemCode == item.itemCode) {
return res
}
})
//没有添加数据
if (result.length == 0) {
var subItem = {
productionLineCode: item.productionLineCode,
workStationCode: item.workStationCode,
itemCode: item.itemCode,
itemName: item.itemName,
toWarehouseCode:item.toWarehouseCode,
fromWarehouseCode:item.fromWarehouseCode,
12 months ago
qty: item.qty,
uom: item.uom
}
this.detailSource.subList.push(subItem)
} else {
//有了更新数据
result[0].qty = calc.add(result[0].qty,item.qty)
12 months ago
}
12 months ago
}
this.caclcQty();
12 months ago
},
12 months ago
caclcQty() {
var totalQty = 0;
this.detailSource.subList.forEach(res => {
totalQty = calc.add(totalQty,res.qty)
12 months ago
})
this.detailSource.totalQty = totalQty;
},
12 months ago
setParams() {
this.detailSource.dueTime = getCurrDateOneMonthsTimes();
12 months ago
return this.detailSource
12 months ago
},
submit() {
uni.showLoading({
title: "提交中....",
mask: true
});
var params = this.setParams()
console.log("提交参数", JSON.stringify(params));
12 months ago
issueRequestSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
this.showCommitSuccessMessage("提交成功<br>生成发料申请" + res.data)
} else {
12 months ago
this.showErrorMessage("提交失败[" + res.msg + "]")
12 months ago
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
12 months ago
},
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
navigateBack(1)
12 months ago
})
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {}
});
},
}
}
</script>
<style>
</style>