Flatten nested repos
This commit is contained in:
84
test/vuex/one-process-resultvalidation-v8/modules/company.js
Normal file
84
test/vuex/one-process-resultvalidation-v8/modules/company.js
Normal file
@@ -0,0 +1,84 @@
|
||||
import * as api from "../api/company.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
loading: false,
|
||||
company: { M_CompanyID : 0 , M_CompanyName : 'All'},
|
||||
companies: [],
|
||||
error: '',
|
||||
selected_filter_status: {},
|
||||
f_statuss: [],
|
||||
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_selected_filter_status(state, val) {
|
||||
state.selected_filter_status = val
|
||||
},
|
||||
update_f_statuss(state, val) {
|
||||
state.f_statuss = val
|
||||
},
|
||||
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 )
|
||||
}
|
||||
},
|
||||
async getstatus(context) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let resp = await api.getstatus(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
} else {
|
||||
context.commit("update_loading", true)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_f_statuss", data.records.f_statuss)
|
||||
context.commit("update_selected_filter_status", data.records.f_statuss[0])
|
||||
prm.status = data.records.f_statuss[0].M_StatusID
|
||||
// context.dispatch("lookupbyname", prm)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user