Commit 5b638eb2 authored by tanjunxin's avatar tanjunxin

fix: 解决生产工单-补单工单工艺计算bug

parent 045e75fa
...@@ -132,7 +132,7 @@ ...@@ -132,7 +132,7 @@
placeholder="请输入生产数量" placeholder="请输入生产数量"
type="number" type="number"
min="1" min="1"
@blur="handleChangeQuantity" @change="handleChangeQuantity"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -404,6 +404,7 @@ export default { ...@@ -404,6 +404,7 @@ export default {
optType: undefined, optType: undefined,
workorderId: null, workorderId: null,
bomList: [], bomList: [],
processList: [],
// 表单参数 // 表单参数
form: { form: {
workorderId: null, workorderId: null,
...@@ -529,12 +530,14 @@ export default { ...@@ -529,12 +530,14 @@ export default {
methods: { methods: {
handleChangeQuantity() { handleChangeQuantity() {
// console.log(quantity);
// 计算补单的时候 数量变更修改 // 计算补单的时候 数量变更修改
if (this.mode === 'make') { if (this.mode === 'make') {
// this.form.quantity // this.form.quantity
this.bomList = [] this.bomList = []
this.processList = []
const bomList = this.currentData.bomList.map((item,index) => { const bomList = this.currentData.bomList.map((item,index) => {
// console.log(item, 'items') // console.log(item.quantity, 'items')
let quantity = parseInt(this.form.quantity*item.quantity*100/this.currentData.quantity) let quantity = parseInt(this.form.quantity*item.quantity*100/this.currentData.quantity)
// console.log(quantity, 'quantity') // console.log(quantity, 'quantity')
return { return {
...@@ -542,8 +545,23 @@ export default { ...@@ -542,8 +545,23 @@ export default {
quantity: quantity/100 quantity: quantity/100
} }
}) })
const processList = this.currentData.processList.map((ele) => {
return {
...ele,
processItemList: ele.processItemList.map((item) => {
// console.log(item.quantity, 'items2')
let quantity = parseInt(this.form.quantity*item.quantity*100/this.currentData.quantity)
return {
...item,
quantity: quantity/100
}
})
}
})
this.bomList = bomList this.bomList = bomList
this.processList = processList
this.$refs["ProogingBomRef"].tableData = bomList this.$refs["ProogingBomRef"].tableData = bomList
this.$refs["ProogingProcessRef"].tableData = processList
} }
}, },
/** 查询生产工单下拉树结构 */ /** 查询生产工单下拉树结构 */
...@@ -650,10 +668,10 @@ export default { ...@@ -650,10 +668,10 @@ export default {
this.gCode(); this.gCode();
} }
this.bomList = data.bomList; this.bomList = data.bomList;
this.processList = data.processList;
// 设置组件数据 // 设置组件数据
this.$refs["ProogingBomRef"].tableData = data.bomList; this.$refs["ProogingBomRef"].tableData = data.bomList;
console.log('生产工单', data.processList) console.log('生产工单', data.processList)
this.$refs["ProogingProcessRef"].tableData = data.processList; this.$refs["ProogingProcessRef"].tableData = data.processList;
this.$refs["WorkOrderSaleRef"].tableData = data.saleDirectiveList; this.$refs["WorkOrderSaleRef"].tableData = data.saleDirectiveList;
this.$refs["WorkOrderSizeRef"].tableData = data.sizeList; this.$refs["WorkOrderSizeRef"].tableData = data.sizeList;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment