Initial import
This commit is contained in:
155
one-ui/masterdata/one-md-jpa-test-info/modules/samplecall.js
Normal file
155
one-ui/masterdata/one-md-jpa-test-info/modules/samplecall.js
Normal file
@@ -0,0 +1,155 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/samplecall.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
last_id:-1,
|
||||
last_saved_id:-1,
|
||||
x_addr_id:0,
|
||||
btn_hide:false,
|
||||
act:'edit',
|
||||
act_addr:'new',
|
||||
get_data_status:0,
|
||||
search_patient: 0,
|
||||
search_status: 0,
|
||||
search_error_message: '',
|
||||
preffix:'',
|
||||
patient_name:'',
|
||||
suffix:'',
|
||||
patients: [],
|
||||
selected_patient: {},
|
||||
save_status: 0,
|
||||
btn_save_seen: true,
|
||||
pgrs_save: false,
|
||||
save_error_message: '',
|
||||
no_save: 0,
|
||||
new_jpa:'',
|
||||
msg_snackbar:'',
|
||||
alert_success:false
|
||||
},
|
||||
mutations: {
|
||||
update_alert_success(state,val){
|
||||
state.alert_success = val
|
||||
},
|
||||
update_msg_snackbar(state, val){
|
||||
state.msg_snackbar = val
|
||||
},
|
||||
update_new_jpa(state, val) {
|
||||
state.new_jpa = val
|
||||
},
|
||||
update_last_id(state, val) {
|
||||
state.last_id = val
|
||||
},
|
||||
update_last_saved_id(state, val) {
|
||||
state.last_saved_id = val
|
||||
},
|
||||
update_act(state, val) {
|
||||
state.act = 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_patient(state, patient) {
|
||||
state.search_patient = patient
|
||||
},
|
||||
update_patients(state, data) {
|
||||
state.patients = data
|
||||
},
|
||||
update_selected_patient(state, val) {
|
||||
state.selected_patient = 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
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
async search(context, prm) {
|
||||
context.commit("update_search_patient", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.search(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_patient", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_patient", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_patients", data.records)
|
||||
context.commit("update_no_save", 0)
|
||||
if(prm.lastid === -1){
|
||||
var pat = data.records[0]
|
||||
if(data.records.length === 0){
|
||||
context.commit("update_selected_patient", {})
|
||||
context.dispatch("samplesend/update_patients", [],{root:true})
|
||||
}else{
|
||||
console.log('aye')
|
||||
context.commit("update_selected_patient", data.records[0])
|
||||
context.dispatch("samplesend/search", data.records[0],{root:true})
|
||||
}
|
||||
}
|
||||
else{
|
||||
context.commit("update_selected_patient", data.records[prm.lastid])
|
||||
context.dispatch("samplesend/search", data.records[prm.lastid],{root:true})
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_patient", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
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)
|
||||
} else {
|
||||
context.commit("update_save_status",2)
|
||||
context.commit("update_new_jpa",'')
|
||||
var msg = ''
|
||||
if(prm.id === 0)
|
||||
msg = "JPA "+prm.value+" berhasil ditambahkan"
|
||||
else{
|
||||
if(prm.status === 'N')
|
||||
msg = "JPA "+prm.value+" berhasil dihapus"
|
||||
else
|
||||
msg = "JPA diubah menjadi "+prm.Nat_JpaName
|
||||
}
|
||||
context.commit("samplesend/update_msg_snackbar",msg,{root:true})
|
||||
context.commit("samplesend/update_alert_success",true,{root:true})
|
||||
setInterval(function(){ context.commit("update_alert_success",false) }, 5000)
|
||||
context.dispatch("search",{lastid:-1})
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
260
one-ui/masterdata/one-md-jpa-test-info/modules/samplesend.js
Normal file
260
one-ui/masterdata/one-md-jpa-test-info/modules/samplesend.js
Normal file
@@ -0,0 +1,260 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/samplesend.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
last_id:-1,
|
||||
last_saved_id:-1,
|
||||
x_addr_id:0,
|
||||
btn_hide:false,
|
||||
act:'edit',
|
||||
act_addr:'new',
|
||||
get_data_status:0,
|
||||
search_patient: 0,
|
||||
search_status: 0,
|
||||
search_error_message: '',
|
||||
preffix:'',
|
||||
patient_name:'',
|
||||
suffix:'',
|
||||
patients: [],
|
||||
selected_patient: {},
|
||||
save_status: 0,
|
||||
btn_save_seen: true,
|
||||
pgrs_save: false,
|
||||
save_error_message: '',
|
||||
no_save: 0,
|
||||
new_jpa:'',
|
||||
value_new_jpa_group:'',
|
||||
dialog_jpa_group:false,
|
||||
jpa_groups:[],
|
||||
msg_snackbar:'',
|
||||
alert_success:false
|
||||
},
|
||||
mutations: {
|
||||
update_alert_success(state,val){
|
||||
state.alert_success = val
|
||||
},
|
||||
update_msg_snackbar(state, val){
|
||||
state.msg_snackbar = val
|
||||
},
|
||||
update_jpa_groups(state, val){
|
||||
state.jpa_groups = val
|
||||
},
|
||||
update_dialog_jpa_group(state, val){
|
||||
state.dialog_jpa_group = val
|
||||
},
|
||||
update_value_new_jpa_group(state, val){
|
||||
state.value_new_jpa_group = val
|
||||
},
|
||||
update_new_jpa(state, val) {
|
||||
state.new_jpa = val
|
||||
},
|
||||
update_last_id(state, val) {
|
||||
state.last_id = val
|
||||
},
|
||||
update_last_saved_id(state, val) {
|
||||
state.last_saved_id = val
|
||||
},
|
||||
update_act(state, val) {
|
||||
state.act = 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_patient(state, patient) {
|
||||
state.search_patient = patient
|
||||
},
|
||||
update_patients(state, data) {
|
||||
state.patients = data
|
||||
},
|
||||
update_selected_patient(state, val) {
|
||||
state.selected_patient = 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
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
async search(context, prm) {
|
||||
context.commit("update_search_patient", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.search(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_patient", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_patient", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_patients", data.records)
|
||||
context.commit("update_no_save", 0)
|
||||
if(prm.lastid === -1){
|
||||
var pat = data.records[0]
|
||||
if(data.records.length === 0){
|
||||
context.commit("update_selected_patient", {})
|
||||
}else{
|
||||
context.commit("update_selected_patient", data.records[0])
|
||||
context.dispatch("samplestorage/search",{
|
||||
code:context.rootState.samplestorage.code,
|
||||
name: context.rootState.samplestorage.name,
|
||||
status:context.rootState.samplestorage.selected_status.id,
|
||||
jpagroup:data.records[0].Nat_JPAGroupID,
|
||||
current_page:1,
|
||||
lastid:-1
|
||||
},{root:true})
|
||||
}
|
||||
}
|
||||
else{
|
||||
context.commit("update_selected_patient", data.records[prm.lastid])
|
||||
context.dispatch("samplestorage/search",{
|
||||
code:context.rootState.samplestorage.code,
|
||||
name: context.rootState.samplestorage.name,
|
||||
status:context.rootState.samplestorage.selected_status.id,
|
||||
jpagroup:data.records[prm.lastid].Nat_JPAGroupID,
|
||||
current_page:1,
|
||||
lastid:-1
|
||||
},{root:true})
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_patient", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async search_listing(context, prm) {
|
||||
//context.commit("update_search_patient", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.search_listing(prm)
|
||||
if (resp.status != "OK") {
|
||||
//context.commit("update_search_patient", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
//context.commit("update_search_patient", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_jpa_groups", data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
//context.commit("update_search_patient", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
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)
|
||||
} else {
|
||||
context.commit("update_save_status",2)
|
||||
context.commit("update_new_jpa",'')
|
||||
context.commit("update_msg_snackbar","JPA Grup berhasil ditambahkan")
|
||||
context.commit("update_alert_success",true)
|
||||
setInterval(function(){ context.commit("update_alert_success",false) }, 5000)
|
||||
var xselpat = context.rootState.samplecall.selected_patient
|
||||
xselpat.lastid = -1
|
||||
context.dispatch("search",xselpat)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
async savejpagroup(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.savejpagroup(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status",3)
|
||||
} else {
|
||||
context.commit("update_save_status",2)
|
||||
context.commit("update_new_jpa",'')
|
||||
context.commit("update_msg_snackbar","JPA Grup berhasil ditambahkan")
|
||||
context.commit("update_alert_success",true)
|
||||
setInterval(function(){ context.commit("update_alert_success",false) }, 5000)
|
||||
var xselpat = context.rootState.samplecall.selected_patient
|
||||
xselpat.lastid = -1
|
||||
context.dispatch("search",xselpat)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
async saveEditJpaGroup(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.savelistingjpagroup(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status",3)
|
||||
} else {
|
||||
context.commit("update_save_status",2)
|
||||
context.dispatch("search_listing",{})
|
||||
if(prm.status === 'Y')
|
||||
context.commit("update_msg_snackbar","Data telah diubah")
|
||||
else
|
||||
context.commit("update_msg_snackbar","Data telah dihapus")
|
||||
|
||||
context.commit("update_alert_success",true)
|
||||
setInterval(function(){ context.commit("update_alert_success",false) }, 5000)
|
||||
var xselpat = context.rootState.samplecall.selected_patient
|
||||
xselpat.lastid = -1
|
||||
context.dispatch("search",xselpat)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
async savealljpadetail(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
console.log(prm)
|
||||
prm.token = one_token()
|
||||
let resp= await api.savealljpadetail(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status",3)
|
||||
} else {
|
||||
context.commit("update_save_status",2)
|
||||
context.commit("update_msg_snackbar","Data telah tersimpan")
|
||||
context.commit("update_alert_success",true)
|
||||
setInterval(function(){ context.commit("update_alert_success",false) }, 5000)
|
||||
context.dispatch("search_listing",{})
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
468
one-ui/masterdata/one-md-jpa-test-info/modules/samplestorage.js
Normal file
468
one-ui/masterdata/one-md-jpa-test-info/modules/samplestorage.js
Normal file
@@ -0,0 +1,468 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/samplestorage.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
last_id:-1,
|
||||
last_saved_id:-1,
|
||||
x_addr_id:0,
|
||||
act:'new',
|
||||
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'),
|
||||
total_transaction: 0,
|
||||
transactions:[],
|
||||
selected_transaction: {},
|
||||
save_status: 0,
|
||||
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:'',
|
||||
current_page:1,
|
||||
total_page:1,
|
||||
code:'',
|
||||
name:'',
|
||||
dialognew:false,
|
||||
xform:{
|
||||
code:'',
|
||||
name:'',
|
||||
shortname:'',
|
||||
codebarcode:'',
|
||||
worklistname:'',
|
||||
xgroup:{},
|
||||
subgroup:{},
|
||||
subsubgroup:{},
|
||||
type:{},
|
||||
unit:{},
|
||||
fontsize:'',
|
||||
fontcolor:'',
|
||||
flaggluc:'',
|
||||
nonlab:{id:"",name:"LAB"},
|
||||
flagbold:'N',
|
||||
flagitalic:'N',
|
||||
flagquantitative:'N',
|
||||
deltacheck:'N',
|
||||
trendanalysis:'N',
|
||||
isresult:'N',
|
||||
isprice:'N',
|
||||
printresult:'N',
|
||||
printnote:'N',
|
||||
isworklist:'N',
|
||||
sample:{},
|
||||
flaglow:'',
|
||||
flaghigh:''
|
||||
},
|
||||
groups:[],
|
||||
subgroups:[],
|
||||
subsubgroups:[],
|
||||
types:[],
|
||||
units:[],
|
||||
nonlabs:[],
|
||||
samples:[],
|
||||
autocomplete_status:0,
|
||||
code_exist:'N',
|
||||
statuses:[{id:'Y',name:'sudah dipilih'},{id:'A',name:'semua'}],
|
||||
selected_status:{id:'Y',name:'sudah dipilih'},
|
||||
msg_snackbar:'',
|
||||
alert_success:false
|
||||
},
|
||||
mutations: {
|
||||
update_alert_success(state,val){
|
||||
state.alert_success = val
|
||||
},
|
||||
update_msg_snackbar(state, val){
|
||||
state.msg_snackbar = val
|
||||
},
|
||||
update_statuses(state, val) {
|
||||
state.statuses = val
|
||||
},
|
||||
update_selected_status(state, val) {
|
||||
state.selected_status = val
|
||||
},
|
||||
update_code_exist(state, val) {
|
||||
state.code_exist = val
|
||||
},
|
||||
update_samples(state, val) {
|
||||
state.samples = val
|
||||
},
|
||||
update_nonlabs(state, val) {
|
||||
state.nonlabs = val
|
||||
},
|
||||
update_autocomplete_status(state, val) {
|
||||
state.autocomplete_status = val
|
||||
},
|
||||
update_units(state, val) {
|
||||
state.units = val
|
||||
},
|
||||
update_types(state, val) {
|
||||
state.types = val
|
||||
},
|
||||
update_subgroups(state, val) {
|
||||
state.subgroups = val
|
||||
},
|
||||
update_subsubgroups(state, val) {
|
||||
state.subsubgroups = val
|
||||
},
|
||||
update_groups(state, val) {
|
||||
state.groups = val
|
||||
},
|
||||
update_xform(state, val) {
|
||||
state.xform = val
|
||||
},
|
||||
update_dialognew(state, val) {
|
||||
state.dialognew = val
|
||||
},
|
||||
update_code(state, val) {
|
||||
state.code = val
|
||||
},
|
||||
update_name(state, val) {
|
||||
state.name = val
|
||||
},
|
||||
update_total_page(state, val) {
|
||||
state.total_page = val
|
||||
},
|
||||
update_current_page(state, val) {
|
||||
state.current_page = val
|
||||
},
|
||||
update_x_addr_id(state, val) {
|
||||
state.x_addr_id = val
|
||||
},
|
||||
update_last_id(state, val) {
|
||||
state.last_id = 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_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_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_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
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
async search(context, prm) {
|
||||
context.commit("update_search_transaction", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.search(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_transaction", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_transaction", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_transactions", data.records)
|
||||
context.commit("update_total_transactions", data.total)
|
||||
context.commit("update_total_page", data.total)
|
||||
context.commit("update_no_save", 0)
|
||||
/*if(prm.lastid === -1){
|
||||
context.commit("update_selected_transaction", data.records[0])
|
||||
var doc = data.records[0]
|
||||
|
||||
}
|
||||
else{
|
||||
context.commit("update_selected_transaction", data.records[prm.lastid])
|
||||
var doc = data.records[prm.lastid]
|
||||
|
||||
}*/
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_transaction", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getinitdatas(context) {
|
||||
context.commit("update_get_data_status",1)
|
||||
try {
|
||||
let resp= await api.getinitdatas(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_groups",data.records.groups)
|
||||
//context.commit("update_subgroups",data.records.subgroups)
|
||||
context.commit("update_types",data.records.types)
|
||||
context.commit("update_nonlabs",data.records.nonlabs)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_get_data_status",3)
|
||||
}
|
||||
},
|
||||
async getdataselected(context,prm) {
|
||||
context.commit("update_get_data_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.getdataselected(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_xform",data.records.xform)
|
||||
context.commit("update_subgroups",data.records.subgroups)
|
||||
context.commit("update_subsubgroups",data.records.subsubgroups)
|
||||
var units = []
|
||||
units.push(data.records.xform.unit)
|
||||
context.commit("update_units",units)
|
||||
var samples = []
|
||||
samples.push(data.records.xform.sample)
|
||||
context.commit("update_samples",samples)
|
||||
context.commit("update_dialognew",true)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_get_data_status",3)
|
||||
}
|
||||
},
|
||||
async checkcodeexist(context,prm) {
|
||||
context.commit("update_get_data_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.checkcodeexist(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_code_exist",data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_get_data_status",3)
|
||||
}
|
||||
},
|
||||
async get_subgroups(context,prm) {
|
||||
context.commit("update_get_data_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.get_subgroups(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_subgroups",data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_get_data_status",3)
|
||||
}
|
||||
},
|
||||
async get_subsubgroups(context,prm) {
|
||||
context.commit("update_get_data_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.get_subsubgroups(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_subsubgroups",data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_get_data_status",3)
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
async searchunit(context,prm) {
|
||||
context.commit("update_autocomplete_status",1)
|
||||
try {
|
||||
let resp= await api.searchunit(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_units",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_autocomplete_status",3)
|
||||
}
|
||||
},
|
||||
async searchsample(context,prm) {
|
||||
context.commit("update_autocomplete_status",1)
|
||||
try {
|
||||
let resp= await api.searchsample(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_samples",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_autocomplete_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)
|
||||
} else {
|
||||
context.commit("update_save_status",2)
|
||||
var msg = ''
|
||||
if(prm.status === 'N')
|
||||
msg = "Pemeriksaan "+prm.Nat_TestName+" batal dipilih"
|
||||
else{
|
||||
msg = "Pemeriksaan "+prm.Nat_TestName+" berhasil dipilih"
|
||||
}
|
||||
context.commit("samplesend/update_msg_snackbar",msg,{root:true})
|
||||
context.commit("samplesend/update_alert_success",true,{root:true})
|
||||
setInterval(function(){ context.commit("samplesend/update_alert_success",false,{root:true}) }, 5000)
|
||||
context.dispatch("search",prm.paramsearch)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
async doaddtest(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.doaddtest(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
|
||||
}
|
||||
if(data.records === 0 || data.records === '0'){
|
||||
var msg = "Data pemeriksaan berhasil disisipkan ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
context.commit("update_dialog_success", true)
|
||||
//context.commit("update_dialognew", false)
|
||||
context.dispatch("samplestoragesas/search",prm.paramsearch,{root:true})
|
||||
}
|
||||
else{
|
||||
var msg = "Sudah ada dong, pemeriksaan yang sama dikeluarga ini"
|
||||
context.commit("update_msg_info", msg)
|
||||
context.commit("update_open_dialog_info", true)
|
||||
}
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user