71 lines
2.1 KiB
JavaScript
71 lines
2.1 KiB
JavaScript
import * as api from "../api/re_history.js"
|
|
|
|
export default {
|
|
namespaced: true,
|
|
state: {
|
|
order_id:0,
|
|
search_status:0,
|
|
search_error_message:'',
|
|
result: [],
|
|
selected_px:[] ,
|
|
dates: [],
|
|
pxs: [],
|
|
|
|
dialog_history: false,
|
|
selected_tab: 0
|
|
},
|
|
mutations: {
|
|
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_dates(state, dates) {
|
|
state.dates= dates
|
|
},
|
|
update_result(state, result) {
|
|
state.result= result
|
|
},
|
|
update_pxs(state, pxs) {
|
|
state.pxs = pxs
|
|
},
|
|
update_selected_px(state, px) {
|
|
state.selected_px = px
|
|
},
|
|
|
|
update_dialog_history(state, v) {
|
|
state.dialog_history = v
|
|
},
|
|
},
|
|
actions: {
|
|
async history(context) {
|
|
context.commit("update_search_status", 1)
|
|
try {
|
|
context.commit('update_pxs', [])
|
|
context.commit('update_result', [])
|
|
context.commit('update_dates', [])
|
|
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_result', resp.data.result)
|
|
context.commit('update_selected_px', resp.data.pxs)
|
|
context.commit('update_pxs', resp.data.pxs)
|
|
context.commit('update_dates',resp.data.dates)
|
|
}
|
|
} catch(e) {
|
|
context.commit("update_search_status",3)
|
|
context.commit("update_search_error_message",e.message )
|
|
}
|
|
}
|
|
}
|
|
}
|