138 lines
3.4 KiB
JavaScript
138 lines
3.4 KiB
JavaScript
const URL = "/one-api/mockup/refout/";
|
|
|
|
export async function search(search, company, page) {
|
|
try {
|
|
var resp = await axios.post(URL + 'testref/search', {
|
|
company_id: company,
|
|
search: search,
|
|
page: page
|
|
});
|
|
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 search_company() {
|
|
try {
|
|
var resp = await axios.post(URL + 'testref/search_company', {});
|
|
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 search_company_all(search) {
|
|
try {
|
|
var resp = await axios.post(URL + 'testref/search_company_all', {search:search});
|
|
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 search_branch_all() {
|
|
try {
|
|
var resp = await axios.post(URL + 'testref/search_branch_all', {});
|
|
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 save(datax) {
|
|
try {
|
|
var resp = await axios.post(URL + 'testref/save', {data:JSON.stringify(datax)});
|
|
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 remove(token, testref_id) {
|
|
try {
|
|
var resp = await axios.post(URL + 'testref/remove', {token:token, testref_id:testref_id});
|
|
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 search_sampletype() {
|
|
try {
|
|
var resp = await axios.post(URL + 'testref/search_sampletype', {});
|
|
if (resp.status != 200) {
|
|
return {
|
|
status: "ERR",
|
|
message: resp.statusText
|
|
};
|
|
}
|
|
let data = resp.data;
|
|
return data;
|
|
} catch (e) {
|
|
return {
|
|
status: "ERR",
|
|
message: e.message
|
|
};
|
|
}
|
|
} |