Commit 65e252f0 authored by 李苏's avatar 李苏 💬

关联明细表

parent d863d867
<template> <template>
<div class="min_full" style="height: 100%;border: 0px;" > <div class="min_full" style="height: 100%;border: 0px;">
<BasePage @pageQueryFinally='pageQueryFinally' @getRow='getRow' ref="basePage" :power='power' :toolButton='false' class="min_full" style="height: 50%;" :showPagination='false' :autoQuery='false' <BasePage @pageQueryFinally='pageQueryFinally' @getRow='getRow' ref="basePage" :power='power' :toolButton='false'
:config="config"> class="min_full" style="height: 50%;" :showPagination='false' :autoQuery='false' :config="config">
<template #dialog="ctx"> <template #dialog="ctx">
<!-- 嵌入默认页面额外弹框的插槽 ctx.pagePage来操作默认页面 --> <!-- 嵌入默认页面额外弹框的插槽 ctx.pagePage来操作默认页面 -->
</template> </template>
...@@ -39,10 +39,10 @@ ...@@ -39,10 +39,10 @@
}, },
mixins:[wlsx,wlphsx], mixins: [wlsx, wlphsx],
data() { data() {
return { return {
detailList:{ detailList: {
}, },
power: { power: {
...@@ -71,40 +71,40 @@ ...@@ -71,40 +71,40 @@
width: 140 width: 140
}, },
{ {
title: "物料名称", title: "物料名称",
field: "wlxxName", field: "wlxxName",
width: 140 width: 140
}, },
{
title: "物料规格",
field: "wlxxGg",
width: 140
},
{
title: "物料批号",
field: "wlph",
width: 180
},
{
title: "计量单位",
field: "jldwName",
width: 100,
},
{
title: "应发数量",
field: "yfsl",
width: 100,
},
{ {
title: "物料规格", title: "拣货数量",
field: "wlxxGg", field: "jhsl",
width: 140 width: 100,
}, },
{ {
title: "物料批号", title: "制令号",
field: "wlph", field: "zlh",
width: 180 width: 180,
}, },
{
title: "计量单位",
field: "jldwName",
width: 100,
},
{
title: "应发数量",
field: "yfsl",
width: 100,
},
{
title: "拣货数量",
field: "jhsl",
width: 100,
},
{
title: "制令号",
field: "zlh",
width: 180,
},
{ {
title: "备注", title: "备注",
field: "bz", field: "bz",
...@@ -115,8 +115,7 @@ ...@@ -115,8 +115,7 @@
}, },
editTableConfig: { editTableConfig: {
editTableTitle:[ editTableTitle: [{
{
label: '仓库', label: '仓库',
prop: 'ckid', prop: 'ckid',
width: 130, width: 130,
...@@ -149,32 +148,32 @@ ...@@ -149,32 +148,32 @@
type: 'inputNumber', type: 'inputNumber',
blur: toFixed(null), blur: toFixed(null),
change: (row) => { change: (row) => {
row.jhsl=parseInt(row.jhsl) row.jhsl = parseInt(row.jhsl)
/*row.oldJhsl /*row.oldJhsl
row.kcsl row.kcsl
*/ */
if(row.jhsl<0){ if (row.jhsl < 0) {
this.$warning('数量无效') this.$warning('数量无效')
row.jhsl=row.oldJhsl row.jhsl = row.oldJhsl
return return
} }
if(row.jhsl>row.oldKcsl){ if (row.jhsl > row.oldKcsl) {
this.$warning('数量不能大于原库存数量') this.$warning('数量不能大于原库存数量')
row.jhsl=row.oldJhsl row.jhsl = row.oldJhsl
return return
} }
/* 数量为合理数量时*/ /* 数量为合理数量时*/
let jhsl=parseInt(row.jhsl) let jhsl = parseInt(row.jhsl)
let oldJhsl=parseInt(row.oldJhsl) let oldJhsl = parseInt(row.oldJhsl)
let slc=jhsl-oldJhsl let slc = jhsl - oldJhsl
row.kcsl=row.kcsl-slc row.kcsl = row.kcsl - slc
this.$refs.basePage.$refs.TablePager.tableData.forEach(item=>{ this.$refs.basePage.$refs.TablePager.tableData.forEach(item => {
if(item.id==this.$id){ if (item.id == this.$id) {
item.jhsl=item.jhsl+slc item.jhsl = item.jhsl + slc
} }
}) })
/* 记录当前的拣货数量*/ /* 记录当前的拣货数量*/
row.oldJhsl=row.jhsl row.oldJhsl = row.jhsl
} }
}, },
...@@ -186,58 +185,59 @@ ...@@ -186,58 +185,59 @@
}, },
methods: { methods: {
pageQueryFinally(list){ pageQueryFinally(list) {
console.log('清空明细list') console.log('清空明细list')
this.detailList={} this.detailList = {}
this.editTableConfig.editTableData=[] this.editTableConfig.editTableData = []
list.forEach((item)=>{ list.forEach((item) => {
/* 剩余拣货数量==yfsl*/ /* 剩余拣货数量==yfsl*/
let alljhsl=item.yfsl let alljhsl = item.yfsl
this.$post('lxyl/rkgl/jhtz/queryAndCalcPkjhtz',{ this.$post('lxyl/rkgl/jhtz/queryAndCalcPkjhtz', {
"cktzId": this.$refs.basePage.queryParams.mid, "cktzId": this.$refs.basePage.queryParams.mid,
"wlid": item.wlid, "wlid": item.wlid,
"wlph": item.wlph, "wlph": item.wlph,
"zlh": item.zlh "zlh": item.zlh
}).then(res=>{ }).then(res => {
this.detailList[item.id]=res.data.records||[] this.detailList[item.id] = res.data.records || []
let kcList=this.detailList[item.id] let kcList = this.detailList[item.id]
/* 开始扣除库存 kcsl*/ /* 开始扣除库存 kcsl*/
kcList.forEach(kcitem=>{ kcList.forEach(kcitem => {
kcitem.oldKcsl=kcitem.kcsl kcitem.cktzmxid=item.id
kcitem.jhsl=0 kcitem.oldKcsl = kcitem.kcsl
kcitem.oldJhsl=0 kcitem.jhsl = 0
if(alljhsl==0){ kcitem.oldJhsl = 0
console.log('应发数量分配完毕') if (alljhsl == 0) {
}else if(kcitem.kcsl>=alljhsl){ console.log('应发数量分配完毕')
/* 当kc数量大于剩余分配数量*/ } else if (kcitem.kcsl >= alljhsl) {
console.log('kc数量大于剩余分配数量,分配结束') /* 当kc数量大于剩余分配数量*/
kcitem.kcsl=kcitem.kcsl-alljhsl console.log('kc数量大于剩余分配数量,分配结束')
kcitem.jhsl=alljhsl kcitem.kcsl = kcitem.kcsl - alljhsl
kcitem.oldJhsl= kcitem.jhsl kcitem.jhsl = alljhsl
alljhsl=0 kcitem.oldJhsl = kcitem.jhsl
}else if(kcitem.kcsl<alljhsl){ alljhsl = 0
console.log('kc数量小于剩余分配数量,全部分配继续下个数据') } else if (kcitem.kcsl < alljhsl) {
alljhsl=alljhsl- kcitem.kcsl console.log('kc数量小于剩余分配数量,全部分配继续下个数据')
kcitem.jhsl = kcitem.kcsl alljhsl = alljhsl - kcitem.kcsl
kcitem.oldJhsl=kcitem.jhsl kcitem.jhsl = kcitem.kcsl
kcitem.kcsl=0 kcitem.oldJhsl = kcitem.jhsl
} kcitem.kcsl = 0
}
}) })
item.jhsl=item.yfsl-alljhsl item.jhsl = item.yfsl - alljhsl
}) })
}) })
}, },
getRow(val){ getRow(val) {
this.$emit('getRow',val) this.$emit('getRow', val)
this.$id=val.id this.$id = val.id
this.editTableConfig.editTableData=this.detailList[this.$id] this.editTableConfig.editTableData = this.detailList[this.$id]
}, },
demo(ctx){ demo(ctx) {
if(ctx.singleItem&&ctx.singleItem.id){ if (ctx.singleItem && ctx.singleItem.id) {
console.log(ctx.singleItem) console.log(ctx.singleItem)
}else{ } else {
this.$warning('请选中一条数据') this.$warning('请选中一条数据')
} }
} }
......
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