Commit 371b7af9 authored by 李苏's avatar 李苏 💬

调整

parent c6fc5899
......@@ -22,8 +22,8 @@
<template slot="tabCustom2">
<el-table-column label="操作" width="90" header-align="center" fixed="right">
<template slot-scope="scope">
<el-button style="text-align: center;color: cornflowerblue;width: 100%;" @click.native.prevent="cz(scope.$index,scope,scope.row)"
type="text" size="small">
<el-button style="text-align: center;color: cornflowerblue;width: 100%;"
@click.native.prevent="cz(scope.$index,scope,scope.row)" type="text" size="small">
<i class="el-icon-edit"></i>操作
</el-button>
......@@ -107,14 +107,13 @@
},
data() {
return {
original:[],
original: [],
/* 数量记录*/
sljl: {
},
editTableConfig: {
editTableTitle: [
{
editTableTitle: [{
label: '拣货数量',
prop: 'jhsl',
allowEdit: true,
......@@ -215,7 +214,7 @@
field: "packCode",
width: 140
},
{
title: "维护人",
field: "whr"
......@@ -237,57 +236,57 @@
}
},
methods: {
save(){
save() {
/* 源数据*/
let originalMap={}
let originalList=this.original.map(item=>{
originalMap[item.packid]=item.jhsl
return item.packid
})
/* 现有数据*/
let nowList=this.editTableConfig.editTableData.map(item=>item.packid)
/* 遍历删除的数据*/
let delArr=this.original.filter(item=>{
if(!nowList.includes(item.packid)){
item.flag='D'
return true
let originalMap = {}
let originalList = this.original.map(item => {
originalMap[item.packid] = item.jhsl
return item.packid
})
/* 现有数据*/
let nowList = this.editTableConfig.editTableData.map(item => item.packid)
/* 遍历删除的数据*/
let delArr = this.original.filter(item => {
if (!nowList.includes(item.packid)) {
item.flag = 'D'
return true
/* 存在*/
}else{
return false
}
})
/* 新增的数据*/
let addArr=[]
/* 修改的数据*/
let editArr=[]
/* 未修改的数据*/
let noeditArr=[]
this.editTableConfig.editTableData.forEach(item=>{
if( originalList.includes(item.packid)){
/* 如果新数据在源数据也有*/
if(item.jhsl==originalMap[item.packid]){
noeditArr.push(item)
}else{
item.flag='U'
editArr.push(item)
} else {
return false
}
}else{
/* 如果没有那么就是新增数据*/
item.flag='I'
addArr.push(item)
}
})
let finList=[...delArr,...editArr,...addArr,...noeditArr]
/* 开始保存*/
this.$post('wms/ckgl/jhtz/jhtzqd/save',{
id:this.app.singleItem.$id,
datas:finList
}).then(res=>{
if(res.success){
this.$success('操作成功')
this.app.showDialog=false
}
})
})
/* 新增的数据*/
let addArr = []
/* 修改的数据*/
let editArr = []
/* 未修改的数据*/
let noeditArr = []
this.editTableConfig.editTableData.forEach(item => {
if (originalList.includes(item.packid)) {
/* 如果新数据在源数据也有*/
if (item.jhsl == originalMap[item.packid]) {
noeditArr.push(item)
} else {
item.flag = 'U'
editArr.push(item)
}
} else {
/* 如果没有那么就是新增数据*/
item.flag = 'I'
addArr.push(item)
}
})
let finList = [...delArr, ...editArr, ...addArr, ...noeditArr]
/* 开始保存*/
this.$post('wms/ckgl/jhtz/jhtzqd/save', {
id: this.app.singleItem.$id,
datas: finList
}).then(res => {
if (res.success) {
this.$success('操作成功')
this.app.showDialog = false
}
})
},
/* 计算保存
n为新值
......@@ -332,7 +331,7 @@
this.$warning('已存在该数据')
} else {
this.editTableConfig.editTableData.push(_.cloneDeep({
zlh:row.zlh,
zlh: row.zlh,
packid: row.packid,
packCode: row.packCode,
wlph: row.wlph,
......@@ -341,8 +340,8 @@
wlxxName: row.wlxxName,
kwid: row.kwid,
kwName: row.kwName,
rqCode:row.rqCode,
rqid:row.rqid,
rqCode: row.rqCode,
rqid: row.rqid,
jhsl: 0
}))
this.sljl[row.packid] = 0
......@@ -369,4 +368,4 @@
padding-left: 5px;
padding-right: 5px;
}
</style>
</style>
\ No newline at end of file
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