No BE change needed — records already contains So_ResultEntryID and So_ResultEntryStatus. Map status to status_name on FE side. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1510 lines
63 KiB
JavaScript
1510 lines
63 KiB
JavaScript
// 1 => LOADING
|
|
// 2 => DONE
|
|
// 3 => ERROR
|
|
import * as api from "../api/sample.js"
|
|
|
|
export default {
|
|
namespaced: true,
|
|
state: {
|
|
last_id: -1,
|
|
last_saved_id: -1,
|
|
x_addr_id: 0,
|
|
act: 'new',
|
|
last_trx: {},
|
|
act_addr: 'new',
|
|
get_data_status: 0,
|
|
search_trx: 0,
|
|
search_status: 0,
|
|
search_error_message: '',
|
|
start_date: moment(new Date()).format('YYYY-MM-DD'),
|
|
end_date: moment(new Date()).format('YYYY-MM-DD'),
|
|
min_start_date: moment(new Date()).format('YYYY-MM-DD'),
|
|
max_start_date: moment(new Date()).add(24, 'days').format('YYYY-MM-DD'),
|
|
min_end_date: moment(new Date()).format('YYYY-MM-DD'),
|
|
max_end_date: moment(new Date()).add(24, 'days').format('YYYY-MM-DD'),
|
|
total_transaction: 0,
|
|
transactions: [],
|
|
details: [],
|
|
selected_detai: {},
|
|
stations: [{ id: "NEW", name: "BARU" }, { id: "VAL1", name: "VERIFIKASI" }, { id: "VAL2", name: "VALIDASI" }],
|
|
selected_station: { id: "NEW", name: "BARU" },
|
|
selected_transaction: {},
|
|
save_status: 0,
|
|
name_lab: '',
|
|
btn_save_seen: true,
|
|
pgrs_save: false,
|
|
save_error_message: '',
|
|
no_save: 0,
|
|
open_alert_confirmation: false,
|
|
alert_success: false,
|
|
msg_success: "",
|
|
dialog_success: false,
|
|
dialog_confirmation_delete: false,
|
|
msg_confirmation_delete: "",
|
|
autocomplete_status: 0,
|
|
dialog_form_address: false,
|
|
errors: [],
|
|
open_dialog_info: false,
|
|
msg_info: '',
|
|
dialog_action: false,
|
|
msg_action: '',
|
|
current_status: null,
|
|
uploaded_files: [],
|
|
uploaded_error: null,
|
|
photos: [],
|
|
selected_photo: {},
|
|
dialog_image: false,
|
|
dialog_doctor: false,
|
|
image: '',
|
|
doctors: [],
|
|
selected_doctor: {},
|
|
doctor_address: [],
|
|
selected_doctor_address: {},
|
|
trx_date: moment(new Date()).format('YYYY-MM-DD'),
|
|
couriers: [],
|
|
selected_courier: {},
|
|
trx_note: '',
|
|
item_groups: [{ id: 4, fulltitle: '' }],
|
|
select_item_group: { id: 4, fulltitle: '' },
|
|
item_subgroups: [{ id: 0, fulltitle: '' }],
|
|
select_item_subgroup: { id: 0, fulltitle: '' },
|
|
selected_itemgroupname: '',
|
|
selected_itemsubgroupname: '',
|
|
langs: [],
|
|
selected_lang: {},
|
|
current_page: 1,
|
|
total_page: 1,
|
|
selected_detail: {},
|
|
dialog_print_lang: false,
|
|
templates: [],
|
|
selected_template: {},
|
|
dialog_template: false,
|
|
selected_test: {},
|
|
tabs_fisik: [],
|
|
riwayats: [],
|
|
riwayats_row: [],
|
|
fisiks: [],
|
|
umum_saran: '',
|
|
k3s: [],
|
|
konsul: '',
|
|
show_print: false,
|
|
cantedit: false,
|
|
standart_bmi: ['who', 'asia_pacific'],
|
|
selected_standart_bmi: 'asia_pacific',
|
|
dialog_note: false,
|
|
url_print: '',
|
|
sellang: {},
|
|
words: [],
|
|
data_6mwt: {
|
|
bb: 0,
|
|
tb: 0,
|
|
bmi: 0,
|
|
distance: 0,
|
|
rounds: 0,
|
|
pretest: {
|
|
tensi: '',
|
|
spo2: '',
|
|
nadi: '',
|
|
dyspnea: '',
|
|
fatigue: ''
|
|
},
|
|
posttest: {
|
|
tensi: '',
|
|
spo2: '',
|
|
nadi: '',
|
|
dyspnea: '',
|
|
fatigue: ''
|
|
},
|
|
details_6mwt: [
|
|
{ waktu: 'MENIT KE 1', spo2: 0, nadi: 0 },
|
|
{ waktu: 'MENIT KE 2', spo2: 0, nadi: 0 },
|
|
{ waktu: 'MENIT KE 3', spo2: 0, nadi: 0 },
|
|
{ waktu: 'MENIT KE 4', spo2: 0, nadi: 0 },
|
|
{ waktu: 'MENIT KE 5', spo2: 0, nadi: 0 },
|
|
{ waktu: 'MENIT KE 6', spo2: 0, nadi: 0 }
|
|
]
|
|
},
|
|
switch_exclude: false,
|
|
companies: [],
|
|
selected_company: { id: 0, name: 'Semua' },
|
|
dialog_xsignature: false,
|
|
snackbar: { value: false, color: 'success', mode: '', timeout: 300 },
|
|
doctors: [],
|
|
selected_doctor: {},
|
|
search_lab_no: '',
|
|
search_type: '',
|
|
station_id: null,
|
|
location_id: null,
|
|
next_url: null,
|
|
loading_search: false,
|
|
type_sds_form: "SDS30",
|
|
data_sds: {
|
|
"sds30": {
|
|
"questions": [
|
|
],
|
|
"options": [
|
|
],
|
|
"interpretation": [
|
|
],
|
|
"interpretationRule": [
|
|
]
|
|
},
|
|
"srq20": {
|
|
"questions": [
|
|
],
|
|
"options": [
|
|
],
|
|
"interpretation": [
|
|
],
|
|
"interpretationRule": [
|
|
]
|
|
},
|
|
"identitas": {
|
|
"nama": "",
|
|
"usia": "",
|
|
"masa_kerja": "",
|
|
"departement": "",
|
|
"jenis_kelamin": "",
|
|
"jenis_kelamin_option": [
|
|
"Pria",
|
|
"Wanita"
|
|
],
|
|
"status_pekerja": "",
|
|
"status_pekerja_option": [
|
|
"Tetap",
|
|
"Tidak tetap (Kontrak)"
|
|
],
|
|
"jenis_pekerjaan": "",
|
|
"jenis_pekerjaan_option": [
|
|
"Kantor",
|
|
"Lapangan"
|
|
],
|
|
"level_jabatan": "",
|
|
"level_jabatan_option": [
|
|
"Manager",
|
|
"Supervisor",
|
|
"Staff"
|
|
],
|
|
"pendidikan": "",
|
|
"pendidikan_option": [
|
|
"SLTA",
|
|
"S1",
|
|
"S2,S3"
|
|
],
|
|
"status_perkawinan": "",
|
|
"status_perkawinan_option": [
|
|
"Singel",
|
|
"Menikah",
|
|
"Duda",
|
|
"Janda"
|
|
]
|
|
}
|
|
},
|
|
dialog_alert_reset: false,
|
|
msg_alert_reset: '',
|
|
last_prm_fisik: {},
|
|
result_lang: 'ID',
|
|
loader_umum:false
|
|
},
|
|
mutations: {
|
|
update_loader_umum(state, val) {
|
|
state.loader_umum = val
|
|
},
|
|
update_result_lang(state, val) {
|
|
state.result_lang = val
|
|
},
|
|
update_last_prm_fisik(state, val) {
|
|
state.last_prm_fisik = val
|
|
},
|
|
update_dialog_alert_reset(state, val) {
|
|
state.dialog_alert_reset = val
|
|
},
|
|
update_msg_alert_reset(state, val) {
|
|
state.msg_alert_reset = val
|
|
},
|
|
update_min_start_date(state, val) {
|
|
state.min_start_date = val
|
|
},
|
|
update_max_start_date(state, val) {
|
|
state.max_start_date = val
|
|
},
|
|
update_min_end_date(state, val) {
|
|
state.min_end_date = val
|
|
},
|
|
update_max_end_date(state, val) {
|
|
state.max_end_date = val
|
|
},
|
|
update_loading_search(state, val) {
|
|
state.loading_search = val
|
|
},
|
|
update_loading_search(state, val) {
|
|
state.loading_search = val
|
|
},
|
|
update_type_sds_form(state, val) {
|
|
state.type_sds_form = val
|
|
},
|
|
update_data_sds(state, val) {
|
|
state.data_sds = val
|
|
},
|
|
update_next_url(state, val) {
|
|
state.next_url = val
|
|
},
|
|
update_location_id(state, val) {
|
|
state.location_id = val
|
|
},
|
|
update_station_id(state, val) {
|
|
state.station_id = val
|
|
},
|
|
update_search_type(state, val) {
|
|
state.search_type = val
|
|
},
|
|
update_search_lab_no(state, val) {
|
|
state.search_lab_no = val
|
|
},
|
|
update_selected_doctor(state, val) {
|
|
state.selected_doctor = val
|
|
},
|
|
update_doctors(state, val) {
|
|
state.doctors = val
|
|
},
|
|
update_snackbar(state, val) {
|
|
state.snackbar = val
|
|
},
|
|
update_dialog_xsignature(state, val) {
|
|
state.dialog_xsignature = val
|
|
},
|
|
update_selected_company(state, val) {
|
|
state.selected_company = val
|
|
},
|
|
update_companies(state, val) {
|
|
state.companies = val
|
|
},
|
|
update_switch_exclude(state, val) {
|
|
state.switch_exclude = val
|
|
},
|
|
update_data_6mwt(state, val) {
|
|
state.data_6mwt = val
|
|
},
|
|
update_sellang(state, val) {
|
|
state.sellang = val
|
|
},
|
|
update_url_print(state, val) {
|
|
state.url_print = val
|
|
},
|
|
update_dialog_note(state, val) {
|
|
state.dialog_note = val
|
|
},
|
|
update_standart_bmi(state, val) {
|
|
state.standart_bmi = val
|
|
},
|
|
update_selected_standart_bmi(state, val) {
|
|
state.selected_standart_bmi = val
|
|
},
|
|
update_cantedit(state, val) {
|
|
state.cantedit = val
|
|
},
|
|
update_show_print(state, val) {
|
|
state.show_print = val
|
|
},
|
|
update_show_print(state, val) {
|
|
state.show_print = val
|
|
},
|
|
update_konsul(state, val) {
|
|
state.konsul = val
|
|
},
|
|
update_k3s(state, val) {
|
|
state.k3s = val
|
|
},
|
|
update_umum_saran(state, val) {
|
|
state.umum_saran = val
|
|
},
|
|
update_tabs_fisik(state, val) {
|
|
state.tabs_fisik = val
|
|
},
|
|
update_riwayats(state, val) {
|
|
state.riwayats = val
|
|
},
|
|
update_riwayats_row(state, val) {
|
|
state.riwayats_row = val
|
|
},
|
|
update_fisiks(state, val) {
|
|
state.fisiks = val
|
|
},
|
|
update_selected_test(state, val) {
|
|
state.selected_test = val
|
|
},
|
|
update_dialog_print_lang(state, val) {
|
|
state.dialog_print_lang = val
|
|
},
|
|
update_selected_lang(state, val) {
|
|
state.selected_lang = val
|
|
},
|
|
update_dialog_template(state, val) {
|
|
state.dialog_template = val
|
|
},
|
|
update_templates(state, val) {
|
|
state.templates = val
|
|
},
|
|
update_selected_template(state, val) {
|
|
state.selected_template = val
|
|
},
|
|
update_selected_detail(state, val) {
|
|
state.selected_detail = val
|
|
},
|
|
update_current_page(state, val) {
|
|
state.current_page = val
|
|
},
|
|
update_total_page(state, val) {
|
|
state.total_page = val
|
|
},
|
|
update_x_addr_id(state, val) {
|
|
state.x_addr_id = val
|
|
},
|
|
update_last_id(state, val) {
|
|
state.last_id = val
|
|
},
|
|
update_last_trx(state, val) {
|
|
state.last_trx = val
|
|
},
|
|
update_last_saved_id(state, val) {
|
|
state.last_saved_id = val
|
|
},
|
|
update_act(state, val) {
|
|
state.act = val
|
|
},
|
|
update_start_date(state, val) {
|
|
state.start_date = val
|
|
},
|
|
update_end_date(state, val) {
|
|
state.end_date = val
|
|
},
|
|
update_name_lab(state, val) {
|
|
state.name_lab = val
|
|
},
|
|
update_stations(state, val) {
|
|
state.stations = val
|
|
},
|
|
update_selected_station(state, val) {
|
|
state.selected_station = val
|
|
},
|
|
update_act_addr(state, val) {
|
|
state.act_addr = val
|
|
},
|
|
update_get_data_status(state, val) {
|
|
state.get_data_status = val
|
|
},
|
|
update_search_error_message(state, patient) {
|
|
state.search_error_message = patient
|
|
},
|
|
update_search_transaction(state, val) {
|
|
state.search_transaction = val
|
|
},
|
|
update_transactions(state, data) {
|
|
state.transactions = data
|
|
},
|
|
update_selected_transaction(state, val) {
|
|
state.selected_transaction = val
|
|
},
|
|
update_details(state, data) {
|
|
state.details = data
|
|
},
|
|
update_selected_detail(state, val) {
|
|
state.selected_detail = val
|
|
},
|
|
update_save_status(state, val) {
|
|
state.save_status = val
|
|
},
|
|
update_btn_save_seen(state, val) {
|
|
state.btn_save_seen = val
|
|
},
|
|
update_pgrs_save(state, val) {
|
|
state.pgrs_save = val
|
|
},
|
|
update_save_error_message(state, msg) {
|
|
state.save_error_message = ''
|
|
},
|
|
update_no_save(state, val) {
|
|
state.no_save = val
|
|
},
|
|
update_open_alert_confirmation(state, val) {
|
|
state.open_alert_confirmation = val
|
|
},
|
|
update_alert_success(state, val) {
|
|
state.alert_success = val
|
|
},
|
|
update_msg_success(state, val) {
|
|
state.msg_success = val
|
|
},
|
|
update_dialog_success(state, val) {
|
|
state.dialog_success = val
|
|
},
|
|
update_dialog_doctor(state, val) {
|
|
state.dialog_doctor = val
|
|
},
|
|
update_dialog_confirmation_delete(state, val) {
|
|
state.dialog_confirmation_delete = val
|
|
},
|
|
update_msg_confirmation_delete(state, val) {
|
|
state.msg_confirmation_delete = val
|
|
},
|
|
update_search_status(state, val) {
|
|
state.search_status = val
|
|
},
|
|
update_errors(state, val) {
|
|
state.errors = val
|
|
},
|
|
update_total_transactions(state, val) {
|
|
state.total_transactions = val
|
|
},
|
|
update_open_dialog_info(state, val) {
|
|
state.open_dialog_info = val
|
|
},
|
|
update_msg_info(state, val) {
|
|
state.msg_info = val
|
|
},
|
|
update_dialog_action(state, val) {
|
|
state.dialog_action = val
|
|
},
|
|
update_msg_action(state, val) {
|
|
state.msg_action = val
|
|
},
|
|
update_current_status(state, val) {
|
|
state.current_status = val
|
|
},
|
|
update_uploaded_files(state, val) {
|
|
state.uploaded_files = val
|
|
},
|
|
update_uploaded_error(state, val) {
|
|
state.uploaded_error = val
|
|
},
|
|
update_photos(state, val) {
|
|
state.photos = val
|
|
},
|
|
update_words(state, val) {
|
|
state.words = val
|
|
},
|
|
update_selected_photo(state, val) {
|
|
state.selected_photo = val
|
|
},
|
|
update_dialog_image(state, val) {
|
|
state.dialog_image = val
|
|
},
|
|
update_image(state, val) {
|
|
state.image = val
|
|
},
|
|
update_doctors(state, val) {
|
|
state.doctors = val
|
|
},
|
|
update_selected_doctor(state, val) {
|
|
state.selected_doctor = val
|
|
},
|
|
update_doctor_address(state, val) {
|
|
state.doctor_address = val
|
|
},
|
|
update_selected_doctor_address(state, val) {
|
|
state.selected_doctor_address = val
|
|
},
|
|
update_trx_date(state, val) {
|
|
state.trx_date = val
|
|
},
|
|
update_couriers(state, val) {
|
|
state.couriers = val
|
|
},
|
|
update_selected_courier(state, val) {
|
|
state.selected_courier = val
|
|
},
|
|
update_trx_note(state, val) {
|
|
state.trx_note = val
|
|
},
|
|
update_item_groups(state, val) {
|
|
state.item_groups = val
|
|
},
|
|
update_select_item_group(state, val) {
|
|
state.select_item_group = val
|
|
},
|
|
update_item_subgroups(state, val) {
|
|
state.item_subgroups = val
|
|
},
|
|
update_select_item_subgroup(state, val) {
|
|
state.select_item_subgroup = val
|
|
},
|
|
update_selected_itemgroupname(state, val) {
|
|
state.selected_itemgroupname = val
|
|
},
|
|
update_selected_itemsubgroupname(state, val) {
|
|
state.selected_itemsubgroupname = val
|
|
},
|
|
update_item_langs(state, val) {
|
|
state.langs = val
|
|
},
|
|
},
|
|
actions: {
|
|
|
|
async save_signature(context, prm) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
prm.trx = context.state.selected_transaction
|
|
let resp = await api.save_signature(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_get_data_status", 3)
|
|
} else {
|
|
context.commit("update_get_data_status", 2)
|
|
var xurl = resp.data.data
|
|
var trx = context.state.selected_transaction
|
|
trx.image_signature = xurl
|
|
context.commit("update_selected_transaction", trx)
|
|
context.commit("update_dialog_xsignature", false)
|
|
context.commit("update_snackbar", { value: true, text: "Tanda Tangan berhasil disimpan", color: 'success', mode: '', timeout: 3000 })
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_get_data_status", 3)
|
|
}
|
|
},
|
|
async get6mwt(context, prm) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.get6mwt(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_get_data_status", 3)
|
|
} else {
|
|
context.commit("update_get_data_status", 2)
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
context.commit("update_data_6mwt", data.records)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_get_data_status", 3)
|
|
}
|
|
},
|
|
async getsds(context, prm) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.getsds(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_get_data_status", 3)
|
|
} else {
|
|
context.commit("update_get_data_status", 2)
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
context.commit("update_data_sds", resp.data)
|
|
context.commit("update_type_sds_form", resp.data.type)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_get_data_status", 3)
|
|
}
|
|
},
|
|
async get_details(context, prm) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.get_details(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_get_data_status", 3)
|
|
} else {
|
|
context.commit("update_get_data_status", 2)
|
|
let dt = resp.data.records
|
|
let sel_trx = context.state.selected_transaction
|
|
sel_trx.details = dt
|
|
context.commit("update_selected_transaction", sel_trx)
|
|
var trx = sel_trx
|
|
if (trx.details.length > 0) {
|
|
context.commit("update_details", trx.details);
|
|
console.log("before");
|
|
console.log(trx.details[0].template_name);
|
|
if (
|
|
trx.details[0].template_name === "Fisik Umum" ||
|
|
trx.details[0].template_name === "Fisik Umum K3" ||
|
|
trx.details[0].template_name === "Fisik Umum Konsul"
|
|
) {
|
|
console.log(trx.details[0].template_name);
|
|
if (trx.details[0].template_name === "Fisik Umum")
|
|
context.commit("update_tabs_fisik", [
|
|
{ id: 1, name: "RIWAYAT", name_eng: "HISTORY" },
|
|
{ id: 2, name: "FISIK", name_eng: "PHYSICAL EXAMINATION" },
|
|
]);
|
|
if (trx.details[0].template_name === "Fisik Umum K3")
|
|
context.commit("update_tabs_fisik", [
|
|
{ id: 1, name: "RIWAYAT", name_eng: "HISTORY" },
|
|
{ id: 2, name: "FISIK", name_eng: "PHYSICAL EXAMINATION" },
|
|
{ id: 3, name: "PAJANAN", name_eng: "EXPOSURE" },
|
|
]);
|
|
if (trx.details[0].template_name === "Fisik Umum Konsul")
|
|
context.commit("update_tabs_fisik", [
|
|
{ id: 1, name: "RIWAYAT", name_eng: "HISTORY" },
|
|
{ id: 2, name: "FISIK", name_eng: "PHYSICAL EXAMINATION" },
|
|
{ id: 3, name: "KONSULTASI", name_eng: "CONSULTATION" },
|
|
]);
|
|
var prm = trx.details[0];
|
|
prm.act = trx.details[0].template_name;
|
|
prm.language_id = context.state.sellang.id;
|
|
prm.language_name = context.state.sellang.name;
|
|
context.dispatch("getumum", prm);
|
|
// this.generateRiwayatRow()
|
|
} else if (trx.details[0].template_name === "6MWT") {
|
|
console.log(trx.details[0].template_name);
|
|
var prm = trx.details[0];
|
|
prm.language_id = context.state.sellang.id;
|
|
prm.language_name = context.state.sellang.name;
|
|
context.dispatch("get6mwt", prm);
|
|
// this.generateRiwayatRow()
|
|
} else if (trx.details[0].template_name === "SDS") {
|
|
console.log(trx.details[0].template_name);
|
|
var prm = trx.details[0];
|
|
prm.language_id = context.state.sellang.id;
|
|
prm.language_name = context.state.sellang.name;
|
|
context.dispatch("getsds", prm);
|
|
// this.generateRiwayatRow()
|
|
} else {
|
|
var prm = {
|
|
selected_trx: trx,
|
|
trx: trx.details[0],
|
|
lang: context.state.sellang,
|
|
idx: 0,
|
|
detail: trx.details[0],
|
|
};
|
|
context.dispatch("getrstbylang", prm);
|
|
}
|
|
} else {
|
|
context.commit("update_details", []);
|
|
context.commit("update_data_6mwt", []);
|
|
}
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_get_data_status", 3)
|
|
}
|
|
},
|
|
async getdoctors(context) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
let resp = await api.getdoctors(one_token())
|
|
if (resp.status != "OK") {
|
|
context.commit("update_get_data_status", 3)
|
|
} else {
|
|
context.commit("update_get_data_status", 2)
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
context.commit("update_doctors", data.records['doctors'])
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_get_data_status", 3)
|
|
}
|
|
},
|
|
async searchdoctor(context, prm) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
let param = {}
|
|
param.token = one_token()
|
|
param.search = prm
|
|
let resp = await api.searchdoctor(param)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_get_data_status", 3)
|
|
} else {
|
|
context.commit("update_get_data_status", 2)
|
|
|
|
context.commit("update_doctors", resp.data.records)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_get_data_status", 3)
|
|
}
|
|
},
|
|
async getumum(context, prm) {
|
|
context.commit("update_loader_umum", true)
|
|
try {
|
|
prm.token = one_token()
|
|
prm.lang = context.state.result_lang
|
|
let resp = await api.getumum(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_loader_umum", false)
|
|
} else {
|
|
context.commit("update_loader_umum", false)
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
context.commit("update_words", resp.data.translate)
|
|
context.commit("update_riwayats", data.records['riwayats'])
|
|
context.commit("update_fisiks", data.records['fisiks'])
|
|
context.commit("update_umum_saran", data.records['umum_saran'])
|
|
context.commit("update_k3s", data.records['k3s'])
|
|
context.commit("update_konsul", data.records['konsul'])
|
|
context.commit("update_show_print", false)
|
|
|
|
var riwayats = data.records['riwayats']
|
|
var idx_keluhan = _.findIndex(riwayats, function (o) { return o.title == "KELUHAN SAAT INI"; });
|
|
if (_.has(riwayats[idx_keluhan], 'version')) {
|
|
if (riwayats[idx_keluhan].version === 2) {
|
|
var idx_etnis = _.findIndex(riwayats, function (o) { return o.title == "ETNIS"; });
|
|
var arr_etnis = riwayats[idx_etnis]
|
|
arr_etnis.flag_normal = 'N'
|
|
var count_y = 0
|
|
count_y = _.filter(arr_etnis.details, function (o) { return o.chx }).length
|
|
console.log("default other asian")
|
|
console.log(count_y)
|
|
if (count_y === 0) {
|
|
var idx_otherasian = _.findIndex(arr_etnis.details, function (o) { return o.label == "Other Asian"; });
|
|
arr_etnis.details[idx_otherasian].chx = true
|
|
}
|
|
riwayats[idx_etnis] = arr_etnis
|
|
context.commit("update_riwayats", riwayats)
|
|
}
|
|
}
|
|
|
|
if (parseInt(data.total) > 0) {
|
|
context.commit("update_show_print", true)
|
|
}
|
|
if (context.state.selected_transaction.status_name !== 'BARU' && context.state.result_lang === 'ID')
|
|
context.commit("update_cantedit", true)
|
|
else
|
|
context.commit("update_cantedit", false)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_loader_umum", false)
|
|
}
|
|
},
|
|
async search(context, prm) {
|
|
context.commit("update_transactions", [])
|
|
context.commit("update_search_transaction", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
prm.current_page = context.state.current_page
|
|
prm.lastid = context.state.last_id
|
|
let resp = await api.search(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_search_transaction", 3)
|
|
context.commit("update_loading_search", false)
|
|
context.commit("update_search_error_message", resp.message)
|
|
} else {
|
|
context.commit("update_search_transaction", 2)
|
|
context.commit("update_loading_search", false)
|
|
context.commit("update_search_error_message", "")
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
context.commit("update_companies", resp.data.companies)
|
|
|
|
var trx = []
|
|
context.commit("update_transactions", [])
|
|
if (data.records.length > 0) {
|
|
context.commit("update_transactions", resp.data.records)
|
|
if (prm.lastid === -1) {
|
|
trx = resp.data.records[0]
|
|
context.commit("update_last_id", trx.re_id)
|
|
context.dispatch("get_details", trx)
|
|
}
|
|
else {
|
|
let arrtrx = context.state.transactions
|
|
var idx = _.findIndex(arrtrx, item => item.re_id === context.state.last_id)
|
|
trx = resp.data.records[idx]
|
|
context.dispatch("get_details", trx)
|
|
}
|
|
context.commit("update_selected_transaction", trx)
|
|
if (context.state.selected_transaction.status_name !== 'BARU')
|
|
context.commit("update_cantedit", true)
|
|
else
|
|
context.commit("update_cantedit", false)
|
|
|
|
/*if (!_.isEmpty(trx.details)) {
|
|
context.commit("update_details", trx.details)
|
|
if (trx.details[0].template_name === 'Fisik Umum' || trx.details[0].template_name === 'Fisik Umum K3' || trx.details[0].template_name === 'Fisik Umum Konsul') {
|
|
if (trx.details[0].template_name === 'Fisik Umum')
|
|
context.commit("update_tabs_fisik", [{ id: 1, name: 'RIWAYAT' }, { id: 2, name: 'FISIK' }])
|
|
if (trx.details[0].template_name === 'Fisik Umum K3')
|
|
context.commit("update_tabs_fisik", [{ id: 1, name: 'RIWAYAT' }, { id: 2, name: 'FISIK' }, { id: 3, name: 'PAJANAN' }])
|
|
if (trx.details[0].template_name === 'Fisik Umum Konsul')
|
|
context.commit("update_tabs_fisik", [{ id: 1, name: 'RIWAYAT' }, { id: 2, name: 'FISIK' }, { id: 3, name: 'KONSULTASI' }])
|
|
|
|
|
|
var prm = trx.details[0]
|
|
prm.act = trx.details[0].template_name
|
|
if (!_.isEmpty(context.state.sellang) && trx.re_id === context.state.selected_transaction.re_id) {
|
|
prm.language_id = context.state.sellang.id
|
|
prm.language_name = context.state.sellang.name
|
|
}
|
|
|
|
context.dispatch("getumum", prm)
|
|
// this.generateRiwayatRow()
|
|
}
|
|
else if (trx.details[0].template_name === '6MWT') {
|
|
var xprm = prm
|
|
var prm = trx.details[0]
|
|
if (!_.isEmpty(context.state.sellang) && trx.re_id === context.state.selected_transaction.re_id) {
|
|
prm.language_id = old_selected_lang_id
|
|
prm.language_name = old_selected_lang_name
|
|
}
|
|
context.dispatch("get6mwt", prm)
|
|
// this.generateRiwayatRow()
|
|
}
|
|
else if (trx.details[0].template_name === 'SDS') {
|
|
var xprm = prm
|
|
var prm = trx.details[0]
|
|
if (!_.isEmpty(context.state.sellang) && trx.re_id === context.state.selected_transaction.re_id) {
|
|
prm.language_id = old_selected_lang_id
|
|
prm.language_name = old_selected_lang_name
|
|
}
|
|
context.dispatch("getsds", prm)
|
|
// this.generateRiwayatRow()
|
|
}
|
|
else {
|
|
console.log(context.state.sellang)
|
|
console.log(prm.re_id)
|
|
console.log(context.state.selected_transaction.re_id)
|
|
if (!_.isEmpty(context.state.sellang) && trx.re_id === context.state.selected_transaction.re_id) {
|
|
var prm = {
|
|
selected_trx: trx,
|
|
trx: trx.details[0],
|
|
lang: context.state.sellang,
|
|
idx: 0,
|
|
detail: trx.details[0]
|
|
}
|
|
context.dispatch("getrstbylang", prm)
|
|
}
|
|
|
|
}
|
|
}
|
|
else {
|
|
context.commit("update_details", [])
|
|
}*/
|
|
}
|
|
else {
|
|
context.commit("update_transactions", [])
|
|
context.commit("update_selected_transaction", {})
|
|
}
|
|
|
|
context.commit("update_total_transactions", data.total)
|
|
context.commit("update_total_page", data.total)
|
|
context.commit("update_no_save", 0)
|
|
context.commit("update_act", 'edit')
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_search_transaction", 3)
|
|
context.commit("update_search_error_message", e.message)
|
|
console.log(e)
|
|
}
|
|
},
|
|
async search_bynolab(context) {
|
|
context.commit("update_search_transaction", 1)
|
|
try {
|
|
let prmx = {}
|
|
prmx.token = one_token()
|
|
prmx.nolab = context.state.search_lab_no
|
|
prmx.type = context.state.search_type
|
|
let resp = await api.search_bynolab(prmx)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_search_transaction", 3)
|
|
context.commit("update_search_error_message", resp.message)
|
|
} else {
|
|
context.commit("update_next_url", resp.data.next_url)
|
|
context.commit("update_search_transaction", 2)
|
|
context.commit("update_search_error_message", "")
|
|
context.commit("update_transactions", resp.data.records)
|
|
var trx = resp.data.records[0]
|
|
context.commit("update_selected_transaction", trx)
|
|
if (context.state.selected_transaction.status_name !== 'BARU')
|
|
context.commit("update_cantedit", true)
|
|
else
|
|
context.commit("update_cantedit", false)
|
|
|
|
if (!_.isEmpty(trx.details)) {
|
|
context.commit("update_details", trx.details)
|
|
if (trx.details[0].template_name === 'Fisik Umum' || trx.details[0].template_name === 'Fisik Umum K3' || trx.details[0].template_name === 'Fisik Umum Konsul') {
|
|
if (trx.details[0].template_name === 'Fisik Umum')
|
|
context.commit("update_tabs_fisik", [{ id: 1, name: 'RIWAYAT', name_eng: 'HISTORY' }, { id: 2, name: 'FISIK', name_eng: 'PHYSICAL EXAMINATION' }])
|
|
if (trx.details[0].template_name === 'Fisik Umum K3')
|
|
context.commit("update_tabs_fisik", [{ id: 1, name: 'RIWAYAT', name_eng: 'HISTORY' }, { id: 2, name: 'FISIK', name_eng: 'PHYSICAL EXAMINATION' }, { id: 3, name: 'PAJANAN', name_eng: 'EXPOSURE' }])
|
|
if (trx.details[0].template_name === 'Fisik Umum Konsul')
|
|
context.commit("update_tabs_fisik", [{ id: 1, name: 'RIWAYAT', name_eng: 'HISTORY' }, { id: 2, name: 'FISIK', name_eng: 'PHYSICAL EXAMINATION' }, { id: 3, name: 'KONSULTASI', name_eng: 'CONSULTATION' }])
|
|
|
|
|
|
var prm = trx.details[0]
|
|
prm.act = trx.details[0].template_name
|
|
if (!_.isEmpty(context.state.sellang) && trx.re_id === context.state.selected_transaction.re_id) {
|
|
prm.language_id = context.state.sellang.id
|
|
prm.language_name = context.state.sellang.name
|
|
}
|
|
|
|
context.dispatch("getumum", prm)
|
|
// this.generateRiwayatRow()
|
|
}
|
|
else if (trx.details[0].template_name === '6MWT') {
|
|
var xprm = prm
|
|
var prm = trx.details[0]
|
|
if (!_.isEmpty(context.state.sellang) && trx.re_id === context.state.selected_transaction.re_id) {
|
|
prm.language_id = old_selected_lang_id
|
|
prm.language_name = old_selected_lang_name
|
|
}
|
|
context.dispatch("get6mwt", prm)
|
|
// this.generateRiwayatRow()
|
|
}
|
|
else {
|
|
console.log(context.state.sellang)
|
|
console.log(prm.re_id)
|
|
console.log(context.state.selected_transaction.re_id)
|
|
if (!_.isEmpty(context.state.sellang) && trx.re_id === context.state.selected_transaction.re_id) {
|
|
var prm = {
|
|
selected_trx: trx,
|
|
trx: trx.details[0],
|
|
lang: context.state.sellang,
|
|
idx: 0,
|
|
detail: trx.details[0]
|
|
}
|
|
context.dispatch("getrstbylang", prm)
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_search_transaction", 3)
|
|
context.commit("update_search_error_message", e.message)
|
|
console.log(e)
|
|
}
|
|
},
|
|
async getdoctorcouriers(context, prm) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.getdoctorcouriers(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_get_data_status", 3)
|
|
} else {
|
|
context.commit("update_get_data_status", 2)
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
context.commit("update_doctors", data.records['doctors'])
|
|
context.commit("update_couriers", data.records['couriers'])
|
|
context.dispatch("search", prm)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_get_data_status", 3)
|
|
}
|
|
},
|
|
async getgroups(context, prm) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.getgroups(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_get_data_status", 3)
|
|
} else {
|
|
context.commit("update_get_data_status", 2)
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
var groups = data.records['groups']
|
|
var langs = data.records['langs']
|
|
context.commit("update_item_langs", langs)
|
|
context.commit("update_item_groups", groups)
|
|
context.commit("update_select_item_group", groups[0])
|
|
context.commit("update_selected_itemgroupname", groups[0].fulltitle)
|
|
context.commit("update_item_subgroups", groups[0].childrens)
|
|
context.commit("update_select_item_subgroup", groups[0].childrens[0])
|
|
context.commit("update_selected_itemsubgroupname", groups[0].childrens[0].fulltitle)
|
|
prm.groupid = groups[0].id
|
|
prm.subgroupid = groups[0].childrens[0].id
|
|
context.dispatch("search", prm)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_get_data_status", 3)
|
|
}
|
|
},
|
|
async upload(context, prm) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
|
|
let resp = await api.upload(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_get_data_status", 3)
|
|
} else {
|
|
context.commit("update_get_data_status", 2)
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total,
|
|
error: resp.data.errors.error
|
|
}
|
|
context.commit("update_uploaded_files", data.records)
|
|
|
|
var msg = "Photo telah berhasil diupload"
|
|
if (data.error) {
|
|
msg = data.error
|
|
context.commit("update_current_status", 'STATUS_FAILED')
|
|
}
|
|
else {
|
|
context.commit("update_current_status", 'STATUS_SUCCESS')
|
|
}
|
|
|
|
context.commit("update_msg_info", msg)
|
|
context.commit("update_open_dialog_info", true)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_get_data_status", 3)
|
|
}
|
|
},
|
|
async doaction(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.doaction(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_dialog_action", false)
|
|
context.dispatch("search", prm)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async savedoctor(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.savedoctor(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_dialog_doctor", false)
|
|
|
|
if (context.state.search_lab_no === '') {
|
|
//console.log("aye")
|
|
var transactions = context.state.transactions
|
|
//console.log(transactions)
|
|
//var selected = context.state.selected_transaction
|
|
//var idx = _.findIndex(transactions, item => item.re_id === selected.re_id)
|
|
//console.log(idx)
|
|
var search_prm = {
|
|
startdate: context.state.start_date,
|
|
enddate: context.state.end_date,
|
|
search: context.state.name_lab,
|
|
stationid: context.state.selected_station.id,
|
|
groupid: context.state.select_item_group.id,
|
|
subgroupid: context.state.select_item_subgroup.id,
|
|
current_page: 1,
|
|
lastid: context.state.last_id
|
|
}
|
|
context.dispatch("search", search_prm)
|
|
} else {
|
|
location.reload()
|
|
}
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async printcount(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.printcount(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_dialog_action", false)
|
|
//context.dispatch("search",prm)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async deletephoto(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.deletephoto(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_act", '-')
|
|
context.commit("update_dialog_confirmation_delete", false)
|
|
context.commit("update_selected_photo", {})
|
|
context.dispatch("search", prm)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async getdoctoraddress(context, prm) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.getdoctoraddress(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_get_data_status", 3)
|
|
} else {
|
|
context.commit("update_get_data_status", 2)
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
context.commit("update_doctor_address", data.records)
|
|
context.commit("update_selected_doctor_address", {})
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async getordersamples(context, prm) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.getordersamples(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_get_data_status", 3)
|
|
} else {
|
|
context.commit("update_get_data_status", 2)
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
context.commit("update_details", data.records)
|
|
context.commit("update_selected_detail", {})
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_get_data_status", 3)
|
|
}
|
|
},
|
|
async getrstbylang(context, prm) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.getrstbylang(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_get_data_status", 3)
|
|
} else {
|
|
context.commit("update_get_data_status", 2)
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
if (data.records.length > 0) {
|
|
var seltrx = prm.selected_trx
|
|
seltrx.details[prm.idx].details = data.records
|
|
seltrx.details[prm.idx].language_id = prm.lang.id
|
|
seltrx.details[prm.idx].language_name = prm.lang.name
|
|
seltrx.details[prm.idx].note = data.records[0].note
|
|
context.commit("update_selected_transaction", seltrx)
|
|
}
|
|
else {
|
|
var seltrx = prm.selected_trx
|
|
seltrx.details[prm.idx].details = []
|
|
seltrx.details[prm.idx].language_id = prm.lang.id
|
|
seltrx.details[prm.idx].language_name = prm.lang.name
|
|
seltrx.details[prm.idx].note = ''
|
|
context.commit("update_selected_transaction", seltrx)
|
|
}
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_get_data_status", 3)
|
|
}
|
|
},
|
|
async save(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.save(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
context.commit("update_msg_info", resp.message)
|
|
context.commit("update_open_dialog_info", true)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_selected_transaction", {})
|
|
context.commit("update_details", [])
|
|
context.commit("update_selected_detail", {})
|
|
context.commit("update_selected_doctor", {})
|
|
context.commit("update_selected_doctor_address", {})
|
|
context.commit("update_selected_courier", {})
|
|
context.commit("update_trx_date", moment(new Date()).format('YYYY-MM-DD'))
|
|
context.commit("update_trx_note", '')
|
|
context.commit("update_act", 'new')
|
|
context.commit("update_dialog_success", true)
|
|
//context.commit("update_last_id", resp.data.id)
|
|
var msg = "Transaksi penyimpanan " + resp.data.numbering + " berhasil dong ..."
|
|
context.commit("update_msg_success", msg)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async deletetrx(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.deletetrx(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_selected_transaction", {})
|
|
context.commit("update_details", [])
|
|
context.commit("update_selected_detail", {})
|
|
context.commit("update_selected_doctor", {})
|
|
context.commit("update_selected_doctor_address", {})
|
|
context.commit("update_selected_courier", {})
|
|
context.commit("update_trx_date", moment(new Date()).format('YYYY-MM-DD'))
|
|
context.commit("update_trx_note", '')
|
|
context.commit("update_act", 'new')
|
|
context.commit("update_dialog_confirmation_delete", false)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Transaksi hapus " + prm.trx_numbering + " berhasil dong ..."
|
|
context.commit("update_msg_success", msg)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async savetypesds(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.savetypesds(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
context.commit("update_msg_info", resp.message)
|
|
context.commit("update_snackbar", { value: true, text: "Gagal menyimpan type SDS, pastikan koneksi internet", color: 'error', mode: '', timeout: 3000 })
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_snackbar", { value: true, text: "Simpan type SDS berhasil", color: 'success', mode: '', timeout: 3000 })
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async saveresult(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.saveresult(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
context.commit("update_msg_info", resp.message)
|
|
context.commit("update_open_dialog_info", true)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
//context.commit("update_last_id",prm.lastid)
|
|
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)
|
|
context.commit("update_dialog_success", true)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async check_fisik_eng(context, prm) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.check_fisik_eng(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_get_data_status", 3)
|
|
} else {
|
|
context.commit("update_get_data_status", 2)
|
|
context.commit("update_open_dialog_info", false)
|
|
if (resp.data.records.length === 0) {
|
|
context.dispatch("savefisik", prm)
|
|
}
|
|
else {
|
|
context.commit("update_dialog_alert_reset", true)
|
|
context.commit("update_msg_alert_reset", "Data versi inggris sudah ada, apakah anda ingin melakukan reset data?")
|
|
context.commit("update_last_prm_fisik", prm)
|
|
}
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_get_data_status", 3)
|
|
}
|
|
},
|
|
async savefisik(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
prm.lang = context.state.result_lang
|
|
let resp = await api.savefisik(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
context.commit("update_msg_info", resp.message)
|
|
context.commit("update_open_dialog_info", true)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
//context.commit("update_last_id",prm.lastid)
|
|
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.records && resp.data.records.So_ResultEntryID) {
|
|
const rec = resp.data.records
|
|
const statusMap = { NEW: 'BARU', VAL1: 'VALIDASI', VAL2: 'VERIFIKASI' }
|
|
const status_name = statusMap[rec.So_ResultEntryStatus] || 'NO TEMPLATE'
|
|
let transactions = [...context.state.transactions]
|
|
let idx = _.findIndex(transactions, t => t.re_id == rec.So_ResultEntryID)
|
|
if (idx !== -1) {
|
|
transactions[idx] = { ...transactions[idx], status_name, status: rec.So_ResultEntryStatus }
|
|
context.commit("update_transactions", transactions)
|
|
}
|
|
context.commit("update_cantedit", status_name !== 'BARU')
|
|
}
|
|
context.commit("update_dialog_success", true)
|
|
if (context.state.search_lab_no !== '') {
|
|
console.log(context.state.next_url)
|
|
console.log(context.state.search_bynolab)
|
|
console.log(context.state.location_id)
|
|
window.location = "/one-ui/" + context.state.next_url + "?labnumber=" + context.state.search_lab_no + "&stat=" + context.state.station_id + "&loc=" + context.state.location_id
|
|
}
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async save6mwt(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.save6mwt(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
context.commit("update_msg_info", resp.message)
|
|
context.commit("update_open_dialog_info", true)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
//context.commit("update_last_id",prm.lastid)
|
|
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)
|
|
context.commit("update_dialog_success", true)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async savesds(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
prm.type = context.state.type_sds_form
|
|
let resp = await api.savesds(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
context.commit("update_msg_info", resp.message)
|
|
context.commit("update_open_dialog_info", true)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
//context.commit("update_last_id",prm.lastid)
|
|
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)
|
|
context.commit("update_dialog_success", true)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async save_flagprint(context, prm) {
|
|
context.commit("update_get_data_status", 1)
|
|
console.log('backen oeyy')
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.save_flagprint(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_get_data_status", 3)
|
|
} else {
|
|
context.commit("update_get_data_status", 2)
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_get_data_status", 3)
|
|
}
|
|
},
|
|
async gettemplate(context, prm) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.gettemplate(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_get_data_status", 3)
|
|
} else {
|
|
context.commit("update_get_data_status", 2)
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
if (data.records) {
|
|
var temp_val = data.records
|
|
context.commit("update_templates", temp_val)
|
|
context.commit("update_selected_template", temp_val[0])
|
|
context.commit("update_dialog_template", true)
|
|
/*var seltrx = context.state.selected_transaction
|
|
|
|
seltrx.details[prm.idx].details.forEach(function(temp,index) {
|
|
var template_detail_id = seltrx.details[prm.idx].details[index].template_detail_id
|
|
var value_now = seltrx.details[prm.idx].details[index].result_value
|
|
var filter_temp = _.filter(temp_val, function(o) { return o.So_TemplateDetailID === template_detail_id })
|
|
if(!value_now || value_now === ''){
|
|
seltrx.details[prm.idx].details[index].result_value = filter_temp[0].So_TemplateValueText
|
|
}
|
|
|
|
})*/
|
|
|
|
//context.commit("update_selected_transaction",seltrx)
|
|
}
|
|
else {
|
|
var msg = "Belum dibuat dong template nya"
|
|
context.commit("update_msg_info", msg)
|
|
context.commit("update_open_dialog_info", true)
|
|
}
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_get_data_status", 3)
|
|
}
|
|
},
|
|
async searchcompany(context, prm) {
|
|
context.commit("update_autocomplete_status", 1)
|
|
try {
|
|
//console.log(prm)
|
|
let resp = await api.searchcompany(one_token(), prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_autocomplete_status", 3)
|
|
} else {
|
|
context.commit("update_autocomplete_status", 2)
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
context.commit("update_companies", resp.data.records)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_autocomplete_status", 3)
|
|
}
|
|
},
|
|
}
|
|
} |