173 lines
5.6 KiB
JavaScript
173 lines
5.6 KiB
JavaScript
// 1 => LOADING
|
|
// 2 => DONE
|
|
// 3 => ERROR
|
|
import * as api from "../api/re_dnafragmentasi.js"
|
|
window.api = api
|
|
|
|
export default {
|
|
namespaced: true,
|
|
state: {
|
|
get_data_status:0,
|
|
save_status:0,
|
|
dialog_dnafragmentasi:false,
|
|
diagnosis_klinis:'',
|
|
halo_luas:'',
|
|
halo_sedang:'',
|
|
halo_sempit:'',
|
|
tanpa_halo:'',
|
|
kesimpulan:'',
|
|
catatan:'',
|
|
dfi:'',
|
|
selected_methode:{},
|
|
results:[],
|
|
doctors:[],
|
|
selected_doctor:{},
|
|
onprocess:false,
|
|
methodes:[],
|
|
selected_dnafragmentasi:{}
|
|
},
|
|
mutations: {
|
|
update_selected_dnafragmentasi(state,value) {
|
|
state.selected_dnafragmentasi = value
|
|
},
|
|
update_methodes(state,value) {
|
|
state.methodes = value
|
|
},
|
|
update_selected_methode(state,value) {
|
|
state.selected_methode = value
|
|
},
|
|
update_dfi(state,value) {
|
|
state.dfi = value
|
|
},
|
|
update_onprocess(state,value) {
|
|
state.onprocess = value
|
|
},
|
|
update_doctors(state,value) {
|
|
state.doctors = value
|
|
},
|
|
update_selected_doctor(state,value) {
|
|
state.selected_doctor = value
|
|
},
|
|
update_save_status(state,value) {
|
|
state.save_status = value
|
|
},
|
|
update_results(state,value) {
|
|
state.results = value
|
|
},
|
|
update_get_data_status(state,value) {
|
|
state.get_data_status = value
|
|
},
|
|
update_selected_fna(state,value) {
|
|
state.selected_fna = value
|
|
},
|
|
update_dialog_dnafragmentasi(state,value) {
|
|
state.dialog_dnafragmentasi = value
|
|
},
|
|
update_diagnosis_klinis(state,value) {
|
|
state.diagnosis_klinis = value
|
|
},
|
|
update_halo_luas(state,value) {
|
|
state.halo_luas = value
|
|
},
|
|
update_halo_sedang(state,value) {
|
|
state.halo_sedang = value
|
|
},
|
|
update_halo_sempit(state,value) {
|
|
state.halo_sempit = value
|
|
},
|
|
update_tanpa_halo(state,value) {
|
|
state.tanpa_halo = value
|
|
},
|
|
update_kesimpulan(state,value) {
|
|
state.kesimpulan = value
|
|
},
|
|
update_catatan(state,value) {
|
|
state.catatan = value
|
|
}
|
|
},
|
|
actions: {
|
|
async get_dnafragmentasiresult(context,prm) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
//console.log(prm)
|
|
prm.token = one_token()
|
|
|
|
let resp = await api.getdnafragmentasiresult(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
|
|
}
|
|
console.log(data.records)
|
|
context.commit("update_dialog_dnafragmentasi", true)
|
|
context.commit("update_results", data.records['results'])
|
|
context.commit("update_doctors", data.records['doctors'])
|
|
context.commit("update_methodes", data.records['methodes'])
|
|
var selected_doctor = {
|
|
id:data.records['results']['doctor_id'],
|
|
name:data.records['results']['doctor_name']
|
|
}
|
|
context.commit("update_selected_doctor", selected_doctor)
|
|
var selected_methode = {
|
|
id:data.records['results']['methode_id'],
|
|
name:data.records['results']['methode_name']
|
|
}
|
|
console.log("ger result dna fragmentasi")
|
|
context.commit("update_selected_methode", selected_methode)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_get_data_status", 3)
|
|
}
|
|
},
|
|
async get_doctors(context,prm) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.get_doctors(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)
|
|
context.commit("update_selected_doctor", {})
|
|
context.commit("update_dialog_dnafragmentasi", true)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_get_data_status", 3)
|
|
}
|
|
},
|
|
async saveresult_dnafragmentasi(context,prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
//prm.id = context.state.selected_fna.id
|
|
prm.token = one_token()
|
|
let resp = await api.saveresult_dnafragmentasi(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
context.commit("update_onprocess", false)
|
|
context.commit("update_dialog_dnafragmentasi", false)
|
|
context.dispatch('re_px/search','',{root:true})
|
|
context.dispatch('re_patient/info_req','',{root:true})
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|