Initial import
This commit is contained in:
75
process/one-process-verification-px/modules/list_px.js
Normal file
75
process/one-process-verification-px/modules/list_px.js
Normal file
@@ -0,0 +1,75 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/list_px.js"
|
||||
window.api = api
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
search: '',
|
||||
search_status:0,
|
||||
search_error_message:'',
|
||||
selected_px: {},
|
||||
orders: [],
|
||||
patients: []
|
||||
},
|
||||
mutations: {
|
||||
update_search_error_message(state,status) {
|
||||
state.search_message= status
|
||||
},
|
||||
update_search(state,status) {
|
||||
state.search= status
|
||||
},
|
||||
update_selected_px(state,val) {
|
||||
state.selected_px= val
|
||||
},
|
||||
update_search_status(state,status) {
|
||||
state.search_status = status
|
||||
},
|
||||
update_patients(state,status) {
|
||||
state.patients = status
|
||||
},
|
||||
update_orders(state,status) {
|
||||
state.orders= status
|
||||
}
|
||||
|
||||
},
|
||||
actions: {
|
||||
async search_order(context,prm) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
let resp= await api.search_order(prm)
|
||||
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 = resp.data.records
|
||||
context.commit("update_orders", data)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
},
|
||||
async search(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
let resp= await api.search(one_token())
|
||||
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 = resp.data.records
|
||||
context.commit("update_patients", data)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user