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

关联明细表

parent d863d867
<template>
<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'
:config="config">
<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' :config="config">
<template #dialog="ctx">
<!-- 嵌入默认页面额外弹框的插槽 ctx.pagePage来操作默认页面 -->
</template>
......@@ -39,10 +39,10 @@
},
mixins:[wlsx,wlphsx],
mixins: [wlsx, wlphsx],
data() {
return {
detailList:{
detailList: {
},
power: {
......@@ -115,8 +115,7 @@
},
editTableConfig: {
editTableTitle:[
{
editTableTitle: [{
label: '仓库',
prop: 'ckid',
width: 130,
......@@ -149,32 +148,32 @@
type: 'inputNumber',
blur: toFixed(null),
change: (row) => {
row.jhsl=parseInt(row.jhsl)
row.jhsl = parseInt(row.jhsl)
/*row.oldJhsl
row.kcsl
*/
if(row.jhsl<0){
if (row.jhsl < 0) {
this.$warning('数量无效')
row.jhsl=row.oldJhsl
row.jhsl = row.oldJhsl
return
}
if(row.jhsl>row.oldKcsl){
if (row.jhsl > row.oldKcsl) {
this.$warning('数量不能大于原库存数量')
row.jhsl=row.oldJhsl
row.jhsl = row.oldJhsl
return
}
/* 数量为合理数量时*/
let jhsl=parseInt(row.jhsl)
let oldJhsl=parseInt(row.oldJhsl)
let slc=jhsl-oldJhsl
row.kcsl=row.kcsl-slc
this.$refs.basePage.$refs.TablePager.tableData.forEach(item=>{
if(item.id==this.$id){
item.jhsl=item.jhsl+slc
let jhsl = parseInt(row.jhsl)
let oldJhsl = parseInt(row.oldJhsl)
let slc = jhsl - oldJhsl
row.kcsl = row.kcsl - slc
this.$refs.basePage.$refs.TablePager.tableData.forEach(item => {
if (item.id == this.$id) {
item.jhsl = item.jhsl + slc
}
})
/* 记录当前的拣货数量*/
row.oldJhsl=row.jhsl
row.oldJhsl = row.jhsl
}
},
......@@ -186,58 +185,59 @@
},
methods: {
pageQueryFinally(list){
pageQueryFinally(list) {
console.log('清空明细list')
this.detailList={}
this.editTableConfig.editTableData=[]
list.forEach((item)=>{
this.detailList = {}
this.editTableConfig.editTableData = []
list.forEach((item) => {
/* 剩余拣货数量==yfsl*/
let alljhsl=item.yfsl
this.$post('lxyl/rkgl/jhtz/queryAndCalcPkjhtz',{
let alljhsl = item.yfsl
this.$post('lxyl/rkgl/jhtz/queryAndCalcPkjhtz', {
"cktzId": this.$refs.basePage.queryParams.mid,
"wlid": item.wlid,
"wlph": item.wlph,
"zlh": item.zlh
}).then(res=>{
this.detailList[item.id]=res.data.records||[]
let kcList=this.detailList[item.id]
}).then(res => {
this.detailList[item.id] = res.data.records || []
let kcList = this.detailList[item.id]
/* 开始扣除库存 kcsl*/
kcList.forEach(kcitem=>{
kcitem.oldKcsl=kcitem.kcsl
kcitem.jhsl=0
kcitem.oldJhsl=0
if(alljhsl==0){
kcList.forEach(kcitem => {
kcitem.cktzmxid=item.id
kcitem.oldKcsl = kcitem.kcsl
kcitem.jhsl = 0
kcitem.oldJhsl = 0
if (alljhsl == 0) {
console.log('应发数量分配完毕')
}else if(kcitem.kcsl>=alljhsl){
} else if (kcitem.kcsl >= alljhsl) {
/* 当kc数量大于剩余分配数量*/
console.log('kc数量大于剩余分配数量,分配结束')
kcitem.kcsl=kcitem.kcsl-alljhsl
kcitem.jhsl=alljhsl
kcitem.oldJhsl= kcitem.jhsl
alljhsl=0
}else if(kcitem.kcsl<alljhsl){
kcitem.kcsl = kcitem.kcsl - alljhsl
kcitem.jhsl = alljhsl
kcitem.oldJhsl = kcitem.jhsl
alljhsl = 0
} else if (kcitem.kcsl < alljhsl) {
console.log('kc数量小于剩余分配数量,全部分配继续下个数据')
alljhsl=alljhsl- kcitem.kcsl
alljhsl = alljhsl - kcitem.kcsl
kcitem.jhsl = kcitem.kcsl
kcitem.oldJhsl=kcitem.jhsl
kcitem.kcsl=0
kcitem.oldJhsl = kcitem.jhsl
kcitem.kcsl = 0
}
})
item.jhsl=item.yfsl-alljhsl
item.jhsl = item.yfsl - alljhsl
})
})
},
getRow(val){
this.$emit('getRow',val)
this.$id=val.id
this.editTableConfig.editTableData=this.detailList[this.$id]
getRow(val) {
this.$emit('getRow', val)
this.$id = val.id
this.editTableConfig.editTableData = this.detailList[this.$id]
},
demo(ctx){
if(ctx.singleItem&&ctx.singleItem.id){
demo(ctx) {
if (ctx.singleItem && ctx.singleItem.id) {
console.log(ctx.singleItem)
}else{
} else {
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