fix:日志输出物料编辑后只更新当前行

This commit is contained in:
shijing 2025-09-17 10:18:46 +08:00
parent 7abdfc7fc1
commit 24104ca69c
1 changed files with 24 additions and 22 deletions

View File

@ -134,13 +134,13 @@
<el-button
v-if="!scope.row.isEdit"
type="primary"
@click="formTableEdit(scope.row)"
@click="formTableEdit(scope.$index)"
>编辑</el-button>
<el-button
v-if="scope.row.isEdit&&!scope.row.id"
type="danger"
style="margin-left: 5px;"
@click="formTableDelet(scope.row)"
@click="formTableDelet(scope.row,scope.$index)"
>删除</el-button>
<el-button
v-if="!scope.row.isEdit"
@ -451,7 +451,7 @@ export default {
that.tableHeight = document.getElementById('mlogbwMain').clientHeight-20;
},500)
that.route_code = that.$route.path.split("/")[2];
that.hideAdd = that.isSubmit;
// that.hideAdd = that.isSubmit;
that.currentDate = that.$TOOL.dateFormat2(new Date());
},
methods: {
@ -599,6 +599,12 @@ export default {
//
formTableSave(row) {
let that = this;
let editIndex = 0;
that.mlogbwlist.forEach((item,index) => {
if(item.id==row.id){
editIndex = index;
}
})
let obj = {};
obj.number = row.number;
obj.mlogb = row.mlogb;
@ -646,7 +652,8 @@ export default {
obj.id = row.id;
that.$API.wpm.mlogbw.update.req(row.id,obj).then((res) => {
that.$message.success("保存成功");
that.getList();
that.mlogbwlist[editIndex].isEdit = false;
// that.getList();
return res;
}).catch((err) => {
return err;
@ -654,7 +661,8 @@ export default {
}else{
that.$API.wpm.mlogbw.create.req(obj).then((res) => {
that.$message.success("添加成功");
that.getList();
that.mlogbwlist[editIndex].isEdit = false;
// that.getList();
return res;
}).catch((err) => {
return err;
@ -668,13 +676,8 @@ export default {
}
});
},
formTableEdit(row) {
formTableEdit(index) {
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;
let date = new Date();
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){
that.getEqData(index);
}
}
});
},
formTableDelet(row){
this.mlogbwlist.pop();
},
//
formTableDel(id) {
formTableDel(id,index) {
let that = this;
that.$confirm(`确定删除吗?`, "提示", {
type: "warning",
}).then(() => {
that.$API.wpm.mlogbw.delete.req(id).then((res) => {
that.getList();
that.mlogbwlist.splice(index,1);
that.$message.success("删除成功");
}).catch((err) => {
return err;