119 lines
2.6 KiB
JavaScript
119 lines
2.6 KiB
JavaScript
// API :
|
|
// search bank
|
|
// paramater : query , page , rowPerPage
|
|
const URL =
|
|
"/one-api/mockup/mcu/";
|
|
|
|
export async function search(search) {
|
|
try {
|
|
var resp = await axios.post(URL + 'mcu_reporttemplate/search', {
|
|
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_detail(id) {
|
|
try {
|
|
var resp = await axios.post(URL + 'mcu_reporttemplate/search_detail', {
|
|
template_id: 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_px(search) {
|
|
try {
|
|
var resp = await axios.post(URL + 'mcu_reporttemplate/search_px', {
|
|
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 save(token, template_name) {
|
|
try {
|
|
var resp = await axios.post(URL + 'mcu_reporttemplate/save', {
|
|
token: token,
|
|
template_name: template_name
|
|
});
|
|
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_detail(token, template_id, desc, is_test, test_id, pos, from_id) {
|
|
try {
|
|
var resp = await axios.post(URL + 'mcu_reporttemplate/save_detail', {
|
|
token: token,
|
|
template_id: template_id,
|
|
desc: desc,
|
|
is_test: is_test,
|
|
test_id: test_id,
|
|
pos: pos,
|
|
from_id: from_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
|
|
};
|
|
}
|
|
}
|
|
|