step 1 : download 10.9.9.2 one-process-resultentry-v106
This commit is contained in:
501
ui/10.9.9.2/one-process-resultentry-v106/modules/re_px.js
Normal file
501
ui/10.9.9.2/one-process-resultentry-v106/modules/re_px.js
Normal file
@@ -0,0 +1,501 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/re_px.js"
|
||||
window.api = api
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
order_id: 0,
|
||||
|
||||
search_status: 0,
|
||||
search_error_message: '',
|
||||
search_dialog_is_active: false,
|
||||
|
||||
// PX
|
||||
total_px: 0,
|
||||
pxs: [],
|
||||
selected_px: {},
|
||||
selected_px_idx: 0,
|
||||
|
||||
// template
|
||||
dialog_template_new: false,
|
||||
template_new_value: "",
|
||||
dup_template_error: { status: false, messages: '' },
|
||||
|
||||
groups: [{ group_id: '1', group_name: 'DUMMY - KIMIA' }, { group_id: '2', group_name: 'DUMMY - HEMATOLOGI' }],
|
||||
selected_group: {},
|
||||
|
||||
reruns: [{ date: '2019-07-10 08:00', instrument: 'COBAS', result: '56' }, { date: '2019-07-10 08:20', instrument: 'COBAS', result: '68' }],
|
||||
selected_rerun: {},
|
||||
dialog_rerun: false,
|
||||
snackbar: false,
|
||||
fpp: '',
|
||||
dialog_fpp: false,
|
||||
dialog_barcode_list: false,
|
||||
dialog_upload_file: false,
|
||||
photo_64: '',
|
||||
photo_64_lab: '',
|
||||
show_progrees_upload: false,
|
||||
save_status: 0,
|
||||
save_error_message_lampiran: '',
|
||||
snackbar_interface: { value: false, color: 'success', text: '' },
|
||||
|
||||
// attachment
|
||||
dialog_attachment: false,
|
||||
obj_attachment: {},
|
||||
|
||||
// result note row
|
||||
dialog_result_note_row: false,
|
||||
result_note_rows: [],
|
||||
},
|
||||
mutations: {
|
||||
// result note row
|
||||
update_dialog_result_note_row(state, value) {
|
||||
state.dialog_result_note_row = value
|
||||
},
|
||||
|
||||
update_result_note_rows(state, result_note_rows) {
|
||||
state.result_note_rows = result_note_rows.records
|
||||
},
|
||||
|
||||
// ATTACHMENT START
|
||||
update_dialog_attachment(state, value) {
|
||||
state.dialog_attachment = value
|
||||
},
|
||||
update_obj_attachment(state, value) {
|
||||
state.obj_attachment = value
|
||||
},
|
||||
// ATTACHMENT END
|
||||
|
||||
update_save_error_message_lampiran(state, status) {
|
||||
state.save_error_message_lampiran = status
|
||||
},
|
||||
update_save_status(state, value) {
|
||||
state.save_status = value
|
||||
},
|
||||
// update foto state
|
||||
update_show_progrees_upload(state, value) {
|
||||
state.show_progrees_upload = value
|
||||
},
|
||||
|
||||
update_photo_64(state, data) {
|
||||
state.photo_64 = data
|
||||
},
|
||||
|
||||
update_photo_64_lab(state, data) {
|
||||
state.photo_64_lab = data
|
||||
},
|
||||
|
||||
// upload file dialog
|
||||
update_dialog_upload_file(state, value) {
|
||||
state.dialog_upload_file = value
|
||||
},
|
||||
|
||||
// barcode list
|
||||
update_dialog_barcode_list(state, value) {
|
||||
state.dialog_barcode_list = value
|
||||
},
|
||||
update_snackbar_interface(state, v) {
|
||||
state.snackbar_interface = v
|
||||
},
|
||||
// end barcode list
|
||||
update_dialog_fpp(state, value) {
|
||||
state.dialog_fpp = value
|
||||
},
|
||||
update_fpp(state, value) {
|
||||
state.fpp = value
|
||||
},
|
||||
update_search_dialog_is_active(state, status) {
|
||||
state.search_dialog_is_active = status
|
||||
},
|
||||
update_search_error_message(state, status) {
|
||||
state.search_error_message = status
|
||||
},
|
||||
|
||||
update_search_status(state, status) {
|
||||
state.search_status = status
|
||||
},
|
||||
|
||||
update_id(state, id) {
|
||||
state.order_id = id
|
||||
},
|
||||
|
||||
update_pxs(state, pxs) {
|
||||
state.pxs = pxs.records
|
||||
},
|
||||
|
||||
update_selected_px(state, px) {
|
||||
state.selected_px = px
|
||||
},
|
||||
|
||||
update_selected_px_idx(state, idx) {
|
||||
state.selected_px_idx = idx
|
||||
},
|
||||
|
||||
update_selected_group(state, group) {
|
||||
state.selected_group = group
|
||||
},
|
||||
|
||||
update_dialog_rerun(state, v) {
|
||||
state.dialog_rerun = v
|
||||
},
|
||||
|
||||
update_reruns(state, reruns) {
|
||||
state.reruns = reruns.records
|
||||
},
|
||||
|
||||
update_selected_rerun(state, rerun) {
|
||||
state.selected_rerun = rerun
|
||||
},
|
||||
|
||||
update_snackbar(state, v) {
|
||||
state.snackbar = v
|
||||
},
|
||||
|
||||
update_dialog_template_new(state, v) {
|
||||
state.dialog_template_new = v
|
||||
},
|
||||
|
||||
update_template_new_value(state, v) {
|
||||
state.template_new_value = v
|
||||
},
|
||||
|
||||
update_dup_template_error(state, v) {
|
||||
state.dup_template_error = v
|
||||
},
|
||||
|
||||
update_groups(state, v) {
|
||||
state.groups = v.records
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
// update result_note_row
|
||||
async save_result_note_row(context, prm) {
|
||||
try {
|
||||
let ptn = context.rootState.re_patient
|
||||
let resp = await api.save_result_note_row(prm)
|
||||
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
|
||||
context.dispatch("search")
|
||||
context.commit("update_snackbar", true)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
}
|
||||
},
|
||||
|
||||
// get_result_note_by_nat_test_id
|
||||
async get_result_note_by_nat_test_id(context, prm) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
//prm.id = context.state.selected_fna.id
|
||||
// prm.token = one_token()
|
||||
let resp = await api.get_result_note_by_nat_test_id(prm)
|
||||
if (resp.status != "OK") {
|
||||
console.log("respon server ", resp.message);
|
||||
context.commit("update_show_progrees_upload", false)
|
||||
context.commit("update_search_status", 3)
|
||||
// context.commit("update_save_error_message_lampiran", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status", 2)
|
||||
// context.commit("update_save_error_message_lampiran", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
// context.commit("update_show_progrees_upload", false)
|
||||
|
||||
// context.dispatch("search")
|
||||
context.commit("update_result_note_rows", data)
|
||||
context.commit("update_dialog_result_note_row", true)
|
||||
// context.commit("update_snackbar", true)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_dialog_result_note_row", false)
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_save_error_message_lampiran", e.message)
|
||||
}
|
||||
},
|
||||
|
||||
// upload file
|
||||
async uploadimage_lampiran(context, prm) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
//prm.id = context.state.selected_fna.id
|
||||
// prm.token = one_token()
|
||||
let resp = await api.uploadimage_lampiran(prm)
|
||||
if (resp.status != "OK") {
|
||||
console.log("respon server ", resp.message);
|
||||
context.commit("update_show_progrees_upload", false)
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_save_error_message_lampiran", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status", 2)
|
||||
context.commit("update_save_error_message_lampiran", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_show_progrees_upload", false)
|
||||
|
||||
context.dispatch("search")
|
||||
context.commit("update_dialog_upload_file", false)
|
||||
context.commit("update_snackbar", true)
|
||||
|
||||
// if (data.records[0].type === 'PRE')
|
||||
// context.commit("update_pre_image", data.records[0])
|
||||
// else
|
||||
// context.commit("update_post_image", data.records[0])
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_show_progrees_upload", false)
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_save_error_message_lampiran", e.message)
|
||||
}
|
||||
},
|
||||
|
||||
// import interface
|
||||
async importInterface(context, prm) {
|
||||
var itfNoReg = prm.ItfNoReg;
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
var prm = {};
|
||||
prm.token = one_token()
|
||||
let resp = await api.importInterface(prm, itfNoReg)
|
||||
console.log(resp);
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_snackbar_interface", { value: true, color: "error", text: resp.message })
|
||||
} else {
|
||||
context.commit("update_search_status", 2)
|
||||
context.commit("update_snackbar_interface", { value: true, color: "success", text: "Import Succes" })
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_status", 3)
|
||||
}
|
||||
},
|
||||
async search(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
let g_id = 0
|
||||
if (context.state.selected_group)
|
||||
g_id = context.state.selected_group.group_id
|
||||
let resp = await api.search(one_token(), context.state.order_id,
|
||||
context.rootState.re_patient.lang_id,
|
||||
context.rootState.re_patient.lang_si,
|
||||
g_id)
|
||||
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
// attachment obj
|
||||
let objAttachment = resp.data.attachment;
|
||||
// console.log("DARI SERVER ATTACHMENT RE_PX ",resp.data.attachment)
|
||||
// update object attachment
|
||||
context.commit("update_obj_attachment", objAttachment)
|
||||
|
||||
context.commit("update_pxs", data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
}
|
||||
},
|
||||
|
||||
async save(context) {
|
||||
let data = []
|
||||
let x = context.state.pxs
|
||||
let rerun = context.state.selected_rerun
|
||||
for (let i in x) {
|
||||
let y = x[i]
|
||||
if ((y.result != null && y.result != y.result_old) || (y.note != y.note_old) || (y.T_OrderDetailInternalNote != y.T_OrderDetailInternalNote_old)) {
|
||||
let resultInstrumentID = 0
|
||||
if (y.hasOwnProperty('resultInstrumentID')) {
|
||||
resultInstrumentID = y.resultInstrumentID
|
||||
}
|
||||
data.push({
|
||||
id: y.id, result: y.result, note: y.note, T_OrderDetailInternalNote: y.T_OrderDetailInternalNote, test_id: y.t_testid, test_name: y.t_testname,
|
||||
resultInstrumentID,
|
||||
order_id: context.state.order_id
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// console.log("DATA KE BE : ",JSON.stringify(data));
|
||||
// return;
|
||||
|
||||
if (data.length < 1) {
|
||||
alert('Tidak ada data yang perlu disimpan !')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
// console.log("DATA KE BE : ",JSON.stringify(data));
|
||||
|
||||
let ptn = context.rootState.re_patient
|
||||
let resp = await api.save(one_token(), ptn.lang_id, ptn.lang_si, JSON.stringify(data))
|
||||
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
|
||||
context.dispatch("search")
|
||||
context.commit("update_snackbar", true)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
}
|
||||
},
|
||||
|
||||
async save_template(context) {
|
||||
|
||||
try {
|
||||
let resp = await api.save_template(one_token(), context.state.selected_px.t_testid, context.state.template_new_value)
|
||||
|
||||
if (resp.status != "OK") {
|
||||
context.commit('update_dup_template_error', { status: true, messages: 'Value tersebut sudah ada !' })
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
|
||||
context.commit("update_dialog_template_new", false)
|
||||
|
||||
let pxs = context.state.pxs
|
||||
for (let i in pxs) {
|
||||
if (pxs[i].t_testid == context.state.selected_px.t_testid)
|
||||
pxs[i].template = resp.data
|
||||
}
|
||||
|
||||
context.commit('update_dup_template_error', { status: false, messages: '' })
|
||||
context.commit('update_pxs', { records: pxs, total: context.state.total_px })
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
}
|
||||
},
|
||||
|
||||
async lang_export(context) {
|
||||
|
||||
try {
|
||||
let sp = context.rootState.re_patient
|
||||
let resp = await api.lang_export(one_token(), sp.selected_patient.T_OrderHeaderID,
|
||||
sp.lang_id, sp.lang_si)
|
||||
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
|
||||
context.dispatch("search")
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
}
|
||||
},
|
||||
|
||||
async search_group(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
|
||||
let resp = await api.search_group()
|
||||
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
context.commit("update_groups", data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
}
|
||||
},
|
||||
|
||||
async search_rerun(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
|
||||
let resp = await api.search_rerun(context.state.selected_px.id)
|
||||
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
|
||||
context.commit("update_reruns", resp.data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async get_fpp(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
|
||||
let resp = await api.get_fpp(one_token(), context.state.order_id)
|
||||
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
|
||||
context.commit("update_fpp", resp.data.data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user