Flatten nested repos
This commit is contained in:
216
test/vuex/cpone-process-resultvalidation/modules/re_mikro.js
Normal file
216
test/vuex/cpone-process-resultvalidation/modules/re_mikro.js
Normal file
@@ -0,0 +1,216 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/re_mikro.js"
|
||||
window.api = api
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
get_data_status:0,
|
||||
save_status:0,
|
||||
dialog_mikro:false,
|
||||
diagnosis_klinis:'',
|
||||
hasil_biakan:'',
|
||||
sample_name:'',
|
||||
kesimpulan:'',
|
||||
saran:'',
|
||||
result_other:'',
|
||||
selected_mikro:{},
|
||||
results:{xid:'0',orderdetail_id:'0',T_BacteriaID:'0',T_BacteriaName:'',doctor_id:'0',doctor_name:'',details:[]},
|
||||
doctors:[],
|
||||
selected_doctor:{},
|
||||
adekuasi:[],
|
||||
kategoriumum:[],
|
||||
interpretasi:[],
|
||||
maturasi:[],
|
||||
bacteries:[],
|
||||
selected_bacteria:{},
|
||||
result_values:[{id:'Negatif',value:'Negatif'},{id:'Positif',value:'Positif'},{id:'other',value:'Lainnya'}],
|
||||
selected_result_value:{id:'Negatif',value:'Negatif'}
|
||||
},
|
||||
mutations: {
|
||||
update_result_other(state,value) {
|
||||
state.result_other = value
|
||||
},
|
||||
update_result_values(state,value) {
|
||||
state.result_values = value
|
||||
},
|
||||
update_selected_result_value(state,value) {
|
||||
state.selected_result_value = value
|
||||
},
|
||||
update_bacteries(state,value) {
|
||||
state.bacteries = value
|
||||
},
|
||||
update_selected_bacteria(state,value) {
|
||||
state.selected_bacteria = value
|
||||
},
|
||||
update_maturasi(state,value) {
|
||||
state.maturasi = 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_adekuasi(state,value) {
|
||||
state.adekuasi = value
|
||||
},
|
||||
update_kategoriumum(state,value) {
|
||||
state.kategoriumum = value
|
||||
},
|
||||
update_interpretasi(state,value) {
|
||||
state.interpretasi = value
|
||||
},
|
||||
update_get_data_status(state,value) {
|
||||
state.get_data_status = value
|
||||
},
|
||||
update_selected_mikro(state,value) {
|
||||
state.selected_mikro = value
|
||||
},
|
||||
update_dialog_mikro(state,value) {
|
||||
state.dialog_mikro = value
|
||||
},
|
||||
update_diagnosis_klinis(state,value) {
|
||||
state.diagnosis_klinis = value
|
||||
},
|
||||
update_hasil_biakan(state,value) {
|
||||
state.hasil_biakan = value
|
||||
},
|
||||
update_sample_name(state,value) {
|
||||
state.sample_name = value
|
||||
},
|
||||
update_kesimpulan(state,value) {
|
||||
state.kesimpulan = value
|
||||
},
|
||||
update_saran(state,value) {
|
||||
state.saran = value
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async get_mikroresult(context,prm) {
|
||||
context.commit("update_get_data_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
console.log(prm)
|
||||
let resp = await api.getmikroresult(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_selected_bacteria",{})
|
||||
context.commit("update_selected_doctor", {})
|
||||
// context.commit("update_results", {xid:'0',orderdetail_id:'0',T_BacteriaID:'0',T_BacteriaName:'',doctor_id:'0',doctor_name:'',details:[]})
|
||||
|
||||
context.commit("update_doctors", data.records['doctors'])
|
||||
context.commit("update_bacteries", data.records['bacteries'])
|
||||
|
||||
if(!_.isEmpty(data.records['results'])){
|
||||
context.commit("update_results", data.records['results'])
|
||||
var rows = data.records['results']
|
||||
context.commit("update_selected_bacteria",{id:rows['T_BacteriaID'],name:rows['T_BacteriaName']})
|
||||
var selected_doctor = {
|
||||
id:rows['doctor_id'],
|
||||
name:rows['doctor_name']
|
||||
}
|
||||
|
||||
context.commit("update_selected_doctor", selected_doctor)
|
||||
var selected_result_vaue = {
|
||||
id:rows['result_value'],
|
||||
value:rows['result_value']
|
||||
}
|
||||
if(rows['result_value'] === 'other'){
|
||||
selected_result_vaue = {
|
||||
id:'other',
|
||||
value:'Lainnya'
|
||||
}
|
||||
}
|
||||
|
||||
context.commit("update_selected_result_value", selected_result_vaue)
|
||||
}
|
||||
context.commit("update_dialog_mikro", true)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_get_data_status", 3)
|
||||
}
|
||||
},
|
||||
async getantibiotics(context,prm) {
|
||||
context.commit("update_get_data_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.getantibiotics(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 results = context.state.results
|
||||
results.details = data.records
|
||||
context.commit("update_results", results)
|
||||
}
|
||||
} 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_fna", true)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_get_data_status", 3)
|
||||
}
|
||||
},
|
||||
async saveresult_mikro(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_mikro(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_dialog_mikro", false)
|
||||
context.dispatch('re_px/search','',{root:true})
|
||||
context.dispatch('re_patient/info_req','',{root:true})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user