Flatten nested repos
This commit is contained in:
55
test/vuex/one-process-resultvalidation-v6/modules/company.js
Normal file
55
test/vuex/one-process-resultvalidation-v6/modules/company.js
Normal file
@@ -0,0 +1,55 @@
|
||||
import * as api from "../api/company.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
loading: false,
|
||||
company: { M_CompanyID : 0 , M_CompanyName : 'All'},
|
||||
companies: [],
|
||||
error: '',
|
||||
token: {}
|
||||
},
|
||||
mutations: {
|
||||
update_loading(state,status) {
|
||||
state.loading= status
|
||||
},
|
||||
update_company(state,status) {
|
||||
state.company= status
|
||||
},
|
||||
update_companies(state,status) {
|
||||
state.companies= status
|
||||
},
|
||||
update_error(state,status) {
|
||||
state.error= status
|
||||
},
|
||||
update_token(state,status) {
|
||||
state.token= status
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
async search(context,qry) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let token = context.state.token
|
||||
if (token.hasOwnProperty("token")) {
|
||||
token.cancel()
|
||||
}
|
||||
token = axios.CancelToken.source()
|
||||
context.commit("update_token",token)
|
||||
|
||||
let resp= await api.search(one_token(),qry, token.token)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_error", resp.message)
|
||||
} else {
|
||||
context.commit("update_loading",false)
|
||||
context.commit("update_error","")
|
||||
context.commit('update_companies',resp.data.data)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_loading",false)
|
||||
context.commit("update_error",e.message )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
134
test/vuex/one-process-resultvalidation-v6/modules/re_fna.js
Normal file
134
test/vuex/one-process-resultvalidation-v6/modules/re_fna.js
Normal file
@@ -0,0 +1,134 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/re_fna.js"
|
||||
window.api = api
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
get_data_status:0,
|
||||
save_status:0,
|
||||
dialog_fna:false,
|
||||
diagnosis_klinis:'',
|
||||
makroskopis:'',
|
||||
mikroskopis:'',
|
||||
kesimpulan:'',
|
||||
saran:'',
|
||||
selected_fna:{},
|
||||
results:[],
|
||||
doctors:[],
|
||||
selected_doctor:{}
|
||||
},
|
||||
mutations: {
|
||||
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_fna(state,value) {
|
||||
state.dialog_fna = 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_fnaresult(context,prm) {
|
||||
context.commit("update_get_data_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.getfnaresult(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_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_fna", 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_fna(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_fna(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_fna", false)
|
||||
context.dispatch('re_px/search','',{root:true})
|
||||
context.dispatch('re_patient/info_req','',{root:true})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
102
test/vuex/one-process-resultvalidation-v6/modules/re_history.js
Normal file
102
test/vuex/one-process-resultvalidation-v6/modules/re_history.js
Normal file
@@ -0,0 +1,102 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../../one-process-resultentry/api/re_history.js"
|
||||
window.api = api
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
order_id:0,
|
||||
|
||||
search_status:0,
|
||||
search_error_message:'',
|
||||
search_dialog_is_active: false,
|
||||
|
||||
// HISTORY
|
||||
total_px: 0,
|
||||
pxs: [{
|
||||
date: '2019-07-07',
|
||||
data: [
|
||||
{px_name: 'Hematologi Rutin', is_result: 'N', result: '', flag: '', level:1},
|
||||
{px_name: 'Trombosit', is_result: 'Y', result: '300', flag: 'H', level:2},
|
||||
{px_name: 'Leukosit', is_result: 'Y', result: '100', flag: '', level:2},
|
||||
{px_name: 'Hemoglobin', is_result: 'Y', result: '105', flag: '', level:2} ]
|
||||
},
|
||||
{
|
||||
date: '2019-06-07',
|
||||
data: [
|
||||
{px_name: 'SGOT', is_result: 'Y', result: '230', flag: '', level:1},
|
||||
{px_name: 'SGPT', is_result: 'Y', result: '320', flag: 'H', level:1} ]
|
||||
}],
|
||||
selected_px: {},
|
||||
selected_px_idx: 0,
|
||||
|
||||
dialog_history: false,
|
||||
selected_tab: 0
|
||||
},
|
||||
mutations: {
|
||||
update_search_dialog_is_active(state,status) {
|
||||
state.search_dialog_is_active = status
|
||||
},
|
||||
update_search_error_message(state,status) {
|
||||
state.search_error_message = status
|
||||
},
|
||||
|
||||
update_search_status(state,status) {
|
||||
state.search_status = status
|
||||
},
|
||||
|
||||
update_id(state, id) {
|
||||
state.order_id = id
|
||||
},
|
||||
|
||||
update_pxs(state, pxs) {
|
||||
state.pxs = pxs.records
|
||||
},
|
||||
|
||||
update_selected_px(state, px) {
|
||||
state.selected_px = px
|
||||
},
|
||||
|
||||
update_selected_px_idx(state, idx) {
|
||||
state.selected_px_idx = idx
|
||||
},
|
||||
|
||||
update_dialog_history(state, v) {
|
||||
state.dialog_history = v
|
||||
},
|
||||
|
||||
update_selected_tab(state, v) {
|
||||
state.selected_tab = v
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async history(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
let resp= await api.history(one_token(), context.rootState.re_patient.selected_patient.T_OrderHeaderID)
|
||||
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
|
||||
context.commit('update_pxs', {
|
||||
records: resp.data
|
||||
})
|
||||
|
||||
if (resp.data.length > 0) {
|
||||
context.commit('update_selected_tab', resp.data[0].id)
|
||||
}
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
154
test/vuex/one-process-resultvalidation-v6/modules/re_lcprep.js
Normal file
154
test/vuex/one-process-resultvalidation-v6/modules/re_lcprep.js
Normal file
@@ -0,0 +1,154 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/re_lcprep.js"
|
||||
window.api = api
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
get_data_status:0,
|
||||
save_status:0,
|
||||
dialog_lcprep:false,
|
||||
diagnosis_klinis:'',
|
||||
makroskopis:'',
|
||||
mikroskopis:'',
|
||||
kesimpulan:'',
|
||||
saran:'',
|
||||
selected_lcprep:{},
|
||||
results:[],
|
||||
doctors:[],
|
||||
selected_doctor:{},
|
||||
adekuasi:[],
|
||||
kategoriumum:[],
|
||||
interpretasi:[],
|
||||
maturasi:[]
|
||||
},
|
||||
mutations: {
|
||||
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_lcprep(state,value) {
|
||||
state.selected_lcprep = value
|
||||
},
|
||||
update_dialog_lcprep(state,value) {
|
||||
state.dialog_lcprep = 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_lcprepresult(context,prm) {
|
||||
context.commit("update_get_data_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.getlcprepresult(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_adekuasi", data.records['adekuasi'])
|
||||
context.commit("update_kategoriumum", data.records['kategoriumum'])
|
||||
context.commit("update_interpretasi", data.records['interpretasi'])
|
||||
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_lcprep", 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_lcprep(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_lcprep(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_lcprep", false)
|
||||
context.dispatch('re_px/search','',{root:true})
|
||||
context.dispatch('re_patient/info_req','',{root:true})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
155
test/vuex/one-process-resultvalidation-v6/modules/re_papsmear.js
Normal file
155
test/vuex/one-process-resultvalidation-v6/modules/re_papsmear.js
Normal file
@@ -0,0 +1,155 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/re_papsmear.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:[]
|
||||
},
|
||||
mutations: {
|
||||
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_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)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
217
test/vuex/one-process-resultvalidation-v6/modules/re_patient.js
Normal file
217
test/vuex/one-process-resultvalidation-v6/modules/re_patient.js
Normal file
@@ -0,0 +1,217 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/re_patient.js"
|
||||
window.api = api
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
order_id:0,
|
||||
search: '',
|
||||
nolab: '',
|
||||
sdate: new Date().toISOString().substr(0, 10),
|
||||
edate: null,
|
||||
|
||||
search_status:0,
|
||||
search_error_message:'',
|
||||
search_dialog_is_active: false,
|
||||
|
||||
patients: [],
|
||||
total_patient: 0,
|
||||
total_patient_page: 0,
|
||||
curr_patient_page: 1,
|
||||
selected_patient: { },
|
||||
validation_note: '',
|
||||
|
||||
|
||||
// PX
|
||||
total_px: 0,
|
||||
pxs: [],
|
||||
|
||||
// Print
|
||||
print_dialog: false,
|
||||
rpt_url: '',
|
||||
current_page:1,
|
||||
total_patients:0,
|
||||
dialog_req: false,
|
||||
dialog_note: false,
|
||||
info_req: {req_fo:[],req_spec_col:[],req_spec_ver:[],req_samp_ver:[],req_pre_an:[]}
|
||||
},
|
||||
mutations: {
|
||||
update_total_patients(state, val) {
|
||||
state.total_patients = val
|
||||
},
|
||||
update_current_page(state, val) {
|
||||
state.current_page = val
|
||||
},
|
||||
update_search_dialog_is_active(state,status) {
|
||||
state.search_dialog_is_active = status
|
||||
},
|
||||
update_search_error_message(state,status) {
|
||||
state.search_error_message = status
|
||||
},
|
||||
|
||||
update_validation_note(state,val) {
|
||||
state.validation_note=val
|
||||
},
|
||||
update_search(state,val) {
|
||||
state.search=val
|
||||
},
|
||||
|
||||
update_nolab(state, val) {
|
||||
state.nolab = val
|
||||
},
|
||||
|
||||
update_search_status(state,status) {
|
||||
state.search_status = status
|
||||
},
|
||||
|
||||
update_patients(state, data) {
|
||||
state.patients= data.records
|
||||
state.total_patient = data.total
|
||||
state.total_patient_page = data.total_page
|
||||
},
|
||||
|
||||
update_curr_patient_page(state, data) {
|
||||
state.curr_patient_page = data
|
||||
},
|
||||
|
||||
update_selected_patient(state,val) {
|
||||
state.selected_patient=val
|
||||
},
|
||||
|
||||
update_id(state, id) {
|
||||
state.order_id = id
|
||||
},
|
||||
|
||||
update_pxs(state, pxs) {
|
||||
state.pxs = pxs.records
|
||||
},
|
||||
|
||||
update_sdate(state, date) {
|
||||
state.sdate = date
|
||||
},
|
||||
|
||||
update_edate(state, date) {
|
||||
state.edate = date
|
||||
},
|
||||
|
||||
update_print_dialog(state, v) {
|
||||
state.print_dialog = v
|
||||
},
|
||||
|
||||
update_rpt_url(state, v) {
|
||||
let user = window.one_user()
|
||||
state.rpt_url = '/birt/frameset?__report=report/one/lab/rpt_test.rptdesign&__format=pdf&username='+user.M_UserUsername+'%20&PID='+v+'&ts='+Math.floor(Date.now() / 1000)
|
||||
},
|
||||
|
||||
update_info_req(state, v) {
|
||||
state.info_req = v
|
||||
},
|
||||
|
||||
update_dialog_req(state, v) {
|
||||
state.dialog_req = v
|
||||
},
|
||||
|
||||
update_dialog_note(state, v) {
|
||||
state.dialog_note= v
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async save_note(context) {
|
||||
let resp = await api.save_note(one_token(), context.state.selected_patient.T_OrderHeaderID,
|
||||
context.state.validation_note)
|
||||
if (resp.staus != 'OK' ) {
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
},
|
||||
async send_to_adm(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
let resp = await api.send_to_adm(one_token(), context.state.selected_patient.T_OrderHeaderID)
|
||||
let patients = context.state.patients
|
||||
let patient = context.state.selected_patient
|
||||
let idx = _.findIndex(patients, { 'T_OrderHeaderID' : patient.T_OrderHeaderID } )
|
||||
if (idx > -1 ) {
|
||||
patients[idx].T_OrderHeaderAddOnReadyPrint = 'P'
|
||||
let data = {
|
||||
records: patients,
|
||||
total_patient_page : conext.state.total_patient_page,
|
||||
total_patient : context.state.total_patient
|
||||
}
|
||||
context.commit("update_patients", patients)
|
||||
}
|
||||
context.commit("update_search_status", 0)
|
||||
} catch(e) {
|
||||
context.commit("update_search_status", 3)
|
||||
}
|
||||
},
|
||||
async search(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
let inp_no = context.state.search
|
||||
let company_id = 0
|
||||
if (context.rootState.company.company)
|
||||
company_id = context.rootState.company.company.M_CompanyID
|
||||
|
||||
let resp= await api.search(one_token(), context.state.sdate, inp_no , context.state.current_page, company_id)
|
||||
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_page: resp.data.total_page
|
||||
}
|
||||
context.commit("update_patients", data)
|
||||
context.commit("update_total_patients", data.total)
|
||||
|
||||
if (data.records.length < 1) {
|
||||
context.commit('update_selected_patient', null)
|
||||
context.commit('re_px/update_pxs', [], {root:true})
|
||||
}
|
||||
else {
|
||||
context.commit('update_selected_patient', data.records[0])
|
||||
context.commit('re_px/update_id', data.records[0].T_OrderHeaderID, {root:true})
|
||||
context.dispatch('re_px/search', null, {root:true})
|
||||
|
||||
context.dispatch('info_req')
|
||||
}
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
},
|
||||
|
||||
async info_req(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
let resp= await api.info_req(one_token(), context.state.selected_patient.T_OrderHeaderID)
|
||||
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
context.commit("update_validation_note", resp.data.validation_note)
|
||||
context.commit('update_info_req', resp.data)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", e.message )
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
361
test/vuex/one-process-resultvalidation-v6/modules/re_px.js
Normal file
361
test/vuex/one-process-resultvalidation-v6/modules/re_px.js
Normal file
@@ -0,0 +1,361 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/re_px.js"
|
||||
import * as api_ver from "../../one-process-resultverification/api/re_px.js"
|
||||
window.api = api
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
order_id: 0,
|
||||
contain_val: false,
|
||||
|
||||
search_status:0,
|
||||
search_error_message:'',
|
||||
search_dialog_is_active: false,
|
||||
|
||||
// PX
|
||||
total_px: 0,
|
||||
pxs: [],
|
||||
selected_px: {},
|
||||
selected_px_idx: 0,
|
||||
|
||||
groups: [{id:'1', name:'DUMMY - KIMIA'}, {id:'2', name:'DUMMY - HEMATOLOGI'}],
|
||||
selected_group: {},
|
||||
|
||||
reruns: [{date:'2019-07-10 08:00', instrument:'COBAS', result:'56'}, {date:'2019-07-10 08:20', instrument:'COBAS', result:'68'}],
|
||||
selected_rerun: {},
|
||||
dialog_rerun: false,
|
||||
snackbar: false,
|
||||
snackbar_err: false,
|
||||
|
||||
dialog_trend: false,
|
||||
info_trend: {},
|
||||
|
||||
dialog_unval: false,
|
||||
unval_actions: [{"val":"1", "label":"Rerun"}, {"val":"2", "label":"Ganti Hasil"}, {"val":"3", "label":"Tolak Sampel"}],
|
||||
selected_unval_action: null
|
||||
},
|
||||
mutations: {
|
||||
update_search_dialog_is_active(state,status) {
|
||||
state.search_dialog_is_active = status
|
||||
},
|
||||
update_search_error_message(state,status) {
|
||||
state.search_error_message = status
|
||||
},
|
||||
|
||||
update_search_status(state,status) {
|
||||
state.search_status = status
|
||||
},
|
||||
|
||||
update_id(state, id) {
|
||||
state.order_id = id
|
||||
},
|
||||
|
||||
update_pxs(state, pxs) {
|
||||
state.pxs = pxs.records
|
||||
},
|
||||
|
||||
update_selected_px(state, px) {
|
||||
state.selected_px = px
|
||||
},
|
||||
|
||||
update_selected_px_idx(state, idx) {
|
||||
state.selected_px_idx = idx
|
||||
},
|
||||
|
||||
update_selected_group(state, group) {
|
||||
state.selected_group = group
|
||||
},
|
||||
|
||||
update_dialog_rerun(state, v) {
|
||||
state.dialog_rerun = v
|
||||
},
|
||||
|
||||
update_reruns(state, reruns) {
|
||||
state.reruns = reruns.records
|
||||
},
|
||||
|
||||
update_selected_rerun(state, rerun) {
|
||||
state.selected_rerun = rerun
|
||||
},
|
||||
|
||||
update_snackbar(state, v) {
|
||||
state.snackbar = v
|
||||
},
|
||||
|
||||
update_snackbar_err(state, v) {
|
||||
state.snackbar_err = v
|
||||
},
|
||||
|
||||
update_dialog_trend(state, v) {
|
||||
state.dialog_trend = v
|
||||
},
|
||||
|
||||
update_info_trend(state, v) {
|
||||
state.info_trend = v
|
||||
},
|
||||
|
||||
update_contain_val(state, v) {
|
||||
state.contain_val = v
|
||||
},
|
||||
|
||||
update_groups(state, v) {
|
||||
state.groups = v.records
|
||||
},
|
||||
|
||||
update_selected_unval_action(state, v) {
|
||||
state.selected_unval_action = v
|
||||
},
|
||||
|
||||
update_dialog_unval(state, v) {
|
||||
state.dialog_unval = v
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async single_validation(context,prm) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
await api.single_validation(one_token(), prm.order_id, prm.validation)
|
||||
context.commit("update_search_status", 0)
|
||||
} catch(e) {
|
||||
context.commit("update_search_error_message",e.message)
|
||||
context.commit("update_search_status", 3)
|
||||
}
|
||||
},
|
||||
async search(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
context.commit('update_contain_val', false)
|
||||
try {
|
||||
let resp= await api.search(one_token(), context.state.order_id)
|
||||
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
for (let i in data.records) {
|
||||
let x = data.records[i]
|
||||
// if (x.validation == "X" && x.sample_handling_perfect == "Y" && x.verification == "Y") {
|
||||
// if (x.mr_state == "Y")
|
||||
// x.validation = "Y"
|
||||
// else
|
||||
// x.validation = "N"
|
||||
|
||||
// data.records[i] = x
|
||||
// }
|
||||
x.validation_old = x.validation
|
||||
if (x.validation_old == "Y")
|
||||
context.commit('update_contain_val', true)
|
||||
}
|
||||
|
||||
context.commit("update_pxs", data)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
},
|
||||
|
||||
async confirm(context) {
|
||||
let data = []
|
||||
let x = context.state.pxs
|
||||
for (let i in x) {
|
||||
let y = x[i]
|
||||
//if ( y.validation_old != y.validation)
|
||||
if (y.verification == 'Y' && y.validation != 'Y' ) {
|
||||
y.validation = 'Y'
|
||||
data.push({id:y.id, mr_state:y.mr_state, validation:y.validation, test_id:y.t_testid, test_name:y.t_testname})
|
||||
}
|
||||
}
|
||||
|
||||
if (data.length < 1) {
|
||||
context.commit('update_snackbar_err', true)
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
let resp= await api.confirm(one_token(), JSON.stringify(data))
|
||||
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
|
||||
context.dispatch("search")
|
||||
context.commit("update_snackbar", true)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
},
|
||||
|
||||
async unvalidate(context) {
|
||||
let order_id = context.rootState.re_patient.selected_patient.T_OrderHeaderID
|
||||
try {
|
||||
let resp= await api.unvalidate(one_token(), order_id)
|
||||
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
|
||||
context.dispatch("search")
|
||||
context.commit("update_snackbar", true)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
},
|
||||
|
||||
async mr_state(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
let resp= await api.mr_state(one_token(), context.state.selected_px.id)
|
||||
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
|
||||
context.commit('update_info_trend', resp.data)
|
||||
context.commit('update_dialog_trend', true)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
},
|
||||
|
||||
async print_count(context) {
|
||||
let order_id = context.state.order_id
|
||||
try {
|
||||
let resp= await api.print_count(one_token(), order_id)
|
||||
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
},
|
||||
|
||||
async search_group(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
|
||||
let resp= await api.search_group()
|
||||
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status", 2)
|
||||
context.commit("update_search_error_message","")
|
||||
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
context.commit("update_groups", data)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
},
|
||||
|
||||
async delta_check(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
let resp= await api_ver.delta_check(one_token(), context.state.selected_px.id)
|
||||
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
|
||||
context.commit('update_info_trend', resp.data)
|
||||
context.commit('update_dialog_trend', true)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
},
|
||||
|
||||
async trend_analysis(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
let resp= await api_ver.trend_analysis(one_token(), context.state.selected_px.id)
|
||||
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
|
||||
context.commit('update_info_trend', resp.data)
|
||||
context.commit('update_dialog_trend', true)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
},
|
||||
|
||||
async reject(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
let resp= await api.reject(one_token(), context.state.selected_px.id, context.state.selected_unval_action)
|
||||
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
|
||||
context.dispatch("search")
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user