Flatten nested repos
This commit is contained in:
118
test/vuex/one-sampling-v3/modules/queue.js
Normal file
118
test/vuex/one-sampling-v3/modules/queue.js
Normal file
@@ -0,0 +1,118 @@
|
||||
import * as api from "../api/queue.js"
|
||||
window.api = api
|
||||
|
||||
export default {
|
||||
namespaced : true,
|
||||
state : {
|
||||
search_status: 0,
|
||||
search_error_message: '',
|
||||
|
||||
order_id: 0,
|
||||
station_id: 0,
|
||||
act: 'CALL',
|
||||
call_status: null,
|
||||
call_status_id: null
|
||||
},
|
||||
|
||||
mutations : {
|
||||
update_search_status (state, v) {
|
||||
state.search_status = v
|
||||
},
|
||||
|
||||
update_search_error_message (state, v) {
|
||||
state.search_error_message = v
|
||||
},
|
||||
|
||||
update_order_id (state, v) {
|
||||
state.order_id = v
|
||||
},
|
||||
|
||||
update_station_id (state, v) {
|
||||
state.station_id = v
|
||||
},
|
||||
|
||||
update_act (state, v) {
|
||||
state.act = v
|
||||
},
|
||||
|
||||
update_call_status (state, v) {
|
||||
state.call_status = v
|
||||
},
|
||||
|
||||
update_call_status_id (state, v) {
|
||||
state.call_status_id = v
|
||||
}
|
||||
},
|
||||
|
||||
actions : {
|
||||
async call(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
let resp = await api.call(one_token(), context.state.order_id, context.state.station_id, context.state.act)
|
||||
|
||||
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 = JSON.parse(resp.data.data)
|
||||
context.commit("update_call_status", data.call_status_code)
|
||||
context.commit("update_call_status_id", data.call_status_id)
|
||||
|
||||
let x = context.rootState.patient.patients
|
||||
let y = context.rootState.patient.total_patient
|
||||
for (let i in x) {
|
||||
if (x[i].T_OrderHeaderID == context.state.order_id) {
|
||||
x[i].call_status_id = data.call_status_id
|
||||
x[i].call_status_code = data.call_status_code
|
||||
}
|
||||
}
|
||||
|
||||
context.commit('patient/update_patients', {records:x, total:y}, {root:true})
|
||||
}
|
||||
} catch(e) {
|
||||
console.log(e)
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", e.message )
|
||||
}
|
||||
},
|
||||
|
||||
async recall(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
let resp = await api.recall(one_token(), context.state.order_id, context.state.station_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 = JSON.parse(resp.data.data)
|
||||
context.commit("update_call_status", data.call_status_code)
|
||||
context.commit("update_call_status_id", data.call_status_id)
|
||||
|
||||
let x = context.rootState.patient.patients
|
||||
let y = context.rootState.patient.total_patient
|
||||
for (let i in x) {
|
||||
if (x[i].T_OrderHeaderID == context.state.order_id) {
|
||||
x[i].call_status_id = data.call_status_id
|
||||
x[i].call_status_code = data.call_status_code
|
||||
}
|
||||
}
|
||||
|
||||
context.commit('patient/update_patients', {records:x, total:y}, {root:true})
|
||||
}
|
||||
} catch(e) {
|
||||
console.log(e)
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", e.message )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user