Files
FE_CPONE/test/vuex/one-report-v2/api/report.js
2026-04-27 10:13:31 +07:00

98 lines
2.2 KiB
JavaScript

const URL = "/one-api/v1/report-v2/main/";
const dUrl = "/one-api/v1/report-v2/lookup/dropdown/";
const aUrl = "/one-api/v1/report-v2/lookup/ac/";
export async function list(search) {
try {
var resp = await axios.post(URL + 'list',{token: window.one_token(), search});
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp;
return data;
} catch(e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function lookupparam(prm) {
try {
var resp = await axios.post(URL + 'lookupparam',prm);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp;
return data;
} catch(e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function detail(id) {
try {
var resp = await axios.post(URL + 'detail',{id:id,token: window.one_token()});
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp;
return data;
} catch(e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function listdropdown(sp) {
try {
var resp = await axios.post(dUrl + sp);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch(e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function listautocomplete(prm) {
try {
var sp = prm.sp
var search = prm.search
var resp = await axios.post(aUrl + sp ,
{search: prm.search} );
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp;
return data;
} catch(e) {
return {
status: "ERR",
message: e.message
};
}
}