fix:日志输出物料编辑后只更新当前行
This commit is contained in:
parent
7abdfc7fc1
commit
24104ca69c
|
@ -134,13 +134,13 @@
|
||||||
<el-button
|
<el-button
|
||||||
v-if="!scope.row.isEdit"
|
v-if="!scope.row.isEdit"
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="formTableEdit(scope.row)"
|
@click="formTableEdit(scope.$index)"
|
||||||
>编辑</el-button>
|
>编辑</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="scope.row.isEdit&&!scope.row.id"
|
v-if="scope.row.isEdit&&!scope.row.id"
|
||||||
type="danger"
|
type="danger"
|
||||||
style="margin-left: 5px;"
|
style="margin-left: 5px;"
|
||||||
@click="formTableDelet(scope.row)"
|
@click="formTableDelet(scope.row,scope.$index)"
|
||||||
>删除</el-button>
|
>删除</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="!scope.row.isEdit"
|
v-if="!scope.row.isEdit"
|
||||||
|
@ -451,7 +451,7 @@ export default {
|
||||||
that.tableHeight = document.getElementById('mlogbwMain').clientHeight-20;
|
that.tableHeight = document.getElementById('mlogbwMain').clientHeight-20;
|
||||||
},500)
|
},500)
|
||||||
that.route_code = that.$route.path.split("/")[2];
|
that.route_code = that.$route.path.split("/")[2];
|
||||||
that.hideAdd = that.isSubmit;
|
// that.hideAdd = that.isSubmit;
|
||||||
that.currentDate = that.$TOOL.dateFormat2(new Date());
|
that.currentDate = that.$TOOL.dateFormat2(new Date());
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -599,6 +599,12 @@ export default {
|
||||||
//添加
|
//添加
|
||||||
formTableSave(row) {
|
formTableSave(row) {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
let editIndex = 0;
|
||||||
|
that.mlogbwlist.forEach((item,index) => {
|
||||||
|
if(item.id==row.id){
|
||||||
|
editIndex = index;
|
||||||
|
}
|
||||||
|
})
|
||||||
let obj = {};
|
let obj = {};
|
||||||
obj.number = row.number;
|
obj.number = row.number;
|
||||||
obj.mlogb = row.mlogb;
|
obj.mlogb = row.mlogb;
|
||||||
|
@ -646,7 +652,8 @@ export default {
|
||||||
obj.id = row.id;
|
obj.id = row.id;
|
||||||
that.$API.wpm.mlogbw.update.req(row.id,obj).then((res) => {
|
that.$API.wpm.mlogbw.update.req(row.id,obj).then((res) => {
|
||||||
that.$message.success("保存成功");
|
that.$message.success("保存成功");
|
||||||
that.getList();
|
that.mlogbwlist[editIndex].isEdit = false;
|
||||||
|
// that.getList();
|
||||||
return res;
|
return res;
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
return err;
|
return err;
|
||||||
|
@ -654,7 +661,8 @@ export default {
|
||||||
}else{
|
}else{
|
||||||
that.$API.wpm.mlogbw.create.req(obj).then((res) => {
|
that.$API.wpm.mlogbw.create.req(obj).then((res) => {
|
||||||
that.$message.success("添加成功");
|
that.$message.success("添加成功");
|
||||||
that.getList();
|
that.mlogbwlist[editIndex].isEdit = false;
|
||||||
|
// that.getList();
|
||||||
return res;
|
return res;
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
return err;
|
return err;
|
||||||
|
@ -668,13 +676,8 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
formTableEdit(row) {
|
formTableEdit(index) {
|
||||||
let that = this;
|
let that = this;
|
||||||
// if(that.route_code=='niuzhuan'&&that.optionsEq.length==0){
|
|
||||||
// that.getEquipment4();
|
|
||||||
// }
|
|
||||||
that.mlogbwlist.forEach((item, index) => {
|
|
||||||
if (item.id == row.id) {
|
|
||||||
that.mlogbwlist[index].isEdit = true;
|
that.mlogbwlist[index].isEdit = true;
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
if(that.mlogbwlist[index].work_start_time==''||that.mlogbwlist[index].work_start_time==null){
|
if(that.mlogbwlist[index].work_start_time==''||that.mlogbwlist[index].work_start_time==null){
|
||||||
|
@ -683,20 +686,19 @@ export default {
|
||||||
if(that.setForm.cd_req_addr!==null&&that.setForm.cd_req_addr!==""&&that.setForm.cd_req_addr!==undefined){
|
if(that.setForm.cd_req_addr!==null&&that.setForm.cd_req_addr!==""&&that.setForm.cd_req_addr!==undefined){
|
||||||
that.getEqData(index);
|
that.getEqData(index);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
formTableDelet(row){
|
formTableDelet(row){
|
||||||
this.mlogbwlist.pop();
|
this.mlogbwlist.pop();
|
||||||
},
|
},
|
||||||
//删除
|
//删除
|
||||||
formTableDel(id) {
|
formTableDel(id,index) {
|
||||||
let that = this;
|
let that = this;
|
||||||
that.$confirm(`确定删除吗?`, "提示", {
|
that.$confirm(`确定删除吗?`, "提示", {
|
||||||
type: "warning",
|
type: "warning",
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
that.$API.wpm.mlogbw.delete.req(id).then((res) => {
|
that.$API.wpm.mlogbw.delete.req(id).then((res) => {
|
||||||
that.getList();
|
that.getList();
|
||||||
|
that.mlogbwlist.splice(index,1);
|
||||||
that.$message.success("删除成功");
|
that.$message.success("删除成功");
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
return err;
|
return err;
|
||||||
|
|
Loading…
Reference in New Issue