Avoid full list re-search after save in v8-all

Backend now returns updated_trx (re_id, status, status_name) in
savefisik response. Frontend uses it to patch just the affected
item in the transaction list, removing the costly search+get_details
round-trip on every save.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
sas.fajri
2026-05-12 09:12:22 +07:00
parent 9818d6aa79
commit 70ca252c34
2 changed files with 10 additions and 14 deletions

View File

@@ -458,20 +458,6 @@ module.exports = {
this.$store.commit("sample/update_act", "new");
},
closeDialogSuccess() {
let arrtrx = this.$store.state.sample.transactions;
//var idx = _.findIndex(arrtrx, item => item.re_id === this.$store.state.sample.last_id)
// console.log(idx)
this.$store.dispatch("sample/search", {
startdate: this.xdatestart,
enddate: this.xdateend,
search: this.xnamelab,
companyid: this.selected_company.id,
switch_exclude: this.switch_exclude,
stationid: this.xselectedstation.id,
groupid: this.$store.state.sample.select_item_group.id,
subgroupid: this.$store.state.sample.select_item_subgroup.id,
lastid: this.$store.state.sample.last_id,
});
this.$store.commit("sample/update_dialog_success", false);
},
closeDialogInfo() {

View File

@@ -1357,6 +1357,16 @@ export default {
context.commit("update_dialog_action", false)
var msg = "Order " + prm.trx_numbering + " pemeriksaan <span class='red--text'>" + prm.trx.test_name + "</span> berhasil diupdate dong ..."
context.commit("update_msg_success", msg)
if (resp.data && resp.data.updated_trx) {
let updated = resp.data.updated_trx
let transactions = [...context.state.transactions]
let idx = _.findIndex(transactions, t => t.re_id === updated.re_id)
if (idx !== -1) {
transactions[idx] = { ...transactions[idx], ...updated }
context.commit("update_transactions", transactions)
}
context.commit("update_cantedit", updated.status_name !== 'BARU')
}
context.commit("update_dialog_success", true)
if (context.state.search_lab_no !== '') {
console.log(context.state.next_url)