160 lines
5.1 KiB
JavaScript
160 lines
5.1 KiB
JavaScript
// 1 => LOADING
|
|
// 2 => DONE
|
|
// 3 => ERROR
|
|
import * as api from "../api/re_px.js"
|
|
window.api = api
|
|
|
|
export default {
|
|
namespaced: true,
|
|
state: {
|
|
get_data_status:0,
|
|
save_status:0,
|
|
dialog_papsmear:false,
|
|
diagnosis_klinis:'',
|
|
makroskopis:'',
|
|
mikroskopis:'',
|
|
kesimpulan:'',
|
|
saran:'',
|
|
selected_papsmear:{},
|
|
results:[],
|
|
doctors:[],
|
|
selected_doctor:{},
|
|
checks:[],
|
|
bahans:[],
|
|
categories:[],
|
|
maturasi:[],
|
|
onprocess:false
|
|
},
|
|
mutations: {
|
|
update_onprocess(state,value) {
|
|
state.onprocess = 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_checks(state,value) {
|
|
state.checks = value
|
|
},
|
|
update_bahans(state,value) {
|
|
state.bahans = value
|
|
},
|
|
update_categories(state,value) {
|
|
state.categories = value
|
|
},
|
|
update_get_data_status(state,value) {
|
|
state.get_data_status = value
|
|
},
|
|
update_selected_papsmear(state,value) {
|
|
state.selected_papsmear = value
|
|
},
|
|
update_dialog_papsmear(state,value) {
|
|
state.dialog_papsmear = value
|
|
},
|
|
update_diagnosis_klinis(state,value) {
|
|
state.diagnosis_klinis = value
|
|
},
|
|
update_makroskopis(state,value) {
|
|
state.makroskopis = value
|
|
},
|
|
update_mikroskopis(state,value) {
|
|
state.mikroskopis = value
|
|
},
|
|
update_kesimpulan(state,value) {
|
|
state.kesimpulan = value
|
|
},
|
|
update_saran(state,value) {
|
|
state.saran = value
|
|
}
|
|
},
|
|
actions: {
|
|
async get_papsmearresult(context,prm) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.getpapsmearresult(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_results", data.records['results'])
|
|
context.commit("update_checks", data.records['checks'])
|
|
context.commit("update_bahans", data.records['bahans'])
|
|
context.commit("update_maturasi", data.records['maturasi'])
|
|
context.commit("update_categories", data.records['categories'])
|
|
context.commit("update_doctors", data.records['doctors'])
|
|
var selected_doctor = {
|
|
id:data.records['results'][0]['doctor_id'],
|
|
name:data.records['results'][0]['doctor_name']
|
|
}
|
|
context.commit("update_selected_doctor", selected_doctor)
|
|
context.commit("update_dialog_papsmear", true)
|
|
}
|
|
} 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_papsmear(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_papsmear(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_papsmear", false)
|
|
context.dispatch('re_px/search','',{root:true})
|
|
context.dispatch('re_patient/info_req','',{root:true})
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|