334 lines
8.1 KiB
JavaScript
334 lines
8.1 KiB
JavaScript
const URL = "/one-api/v1/masterdata/";
|
|
|
|
export async function search_company(token, search) {
|
|
try {
|
|
var resp = await axios.post(URL + 'pricecopyjpa_v4/search_company', {
|
|
token:token,
|
|
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_packet(token, mou, type, query, withPxs) {
|
|
try {
|
|
var resp = await axios.post(URL + 'packet_v3/search_packet' + (withPxs?'/1':''), {
|
|
token:token,
|
|
mou: mou,
|
|
search: query,
|
|
type: type
|
|
});
|
|
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 getjpagroups(token) {
|
|
try {
|
|
var resp = await axios.post(URL + 'pricecopyjpa_v4/getjpagroups', {
|
|
token:token
|
|
});
|
|
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_2(prm) {
|
|
try {
|
|
var resp = await axios.post(URL + 'pricecopyjpa_v4/search_company_2',prm);
|
|
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_single_company(token, id) {
|
|
try {
|
|
var resp = await axios.post(URL + 'pricecopyjpa_v4/search_single_company', {
|
|
token:token,
|
|
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 copy_price(prm) {
|
|
try {
|
|
var resp = await axios.post(URL + 'pricecopyjpa_v4/copy_price',prm);
|
|
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_mou(token, company, query) {
|
|
try {
|
|
var resp = await axios.post(URL + 'pricecopyjpa_v4/search_mou', {
|
|
token:token,
|
|
company_id: company,
|
|
search: query
|
|
});
|
|
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_price(token, mou, query, page) {
|
|
try {
|
|
var resp = await axios.post(URL + 'pricecopyjpa_v4/search_price', {
|
|
token:token,
|
|
mou_id: mou,
|
|
search: query,
|
|
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 deleteallprice(token, id) {
|
|
try {
|
|
var resp = await axios.post(URL + 'pricecopyjpa_v4/deleteallprice', {
|
|
token:token,
|
|
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 del_price(token, id) {
|
|
try {
|
|
var resp = await axios.post(URL + 'pricecopyjpa_v4/del_price', {
|
|
token:token,
|
|
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(token, query, mou_id, cito) {
|
|
try {
|
|
var resp = await axios.post(URL + 'pricecopyjpa_v4/search_px', {
|
|
token:token,
|
|
search: query,
|
|
cito: cito,
|
|
mou_id: mou_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 save_px(token, datax, datay) {
|
|
try {
|
|
var resp = await axios.post(URL + 'pricecopyjpa_v4/save_px', {
|
|
token:token,
|
|
data: datax,
|
|
data_others: datay
|
|
});
|
|
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_addon(token, query) {
|
|
try {
|
|
var resp = await axios.post(URL + 'pricecopyjpa_v4/search_addon', {
|
|
token:token,
|
|
search: query
|
|
});
|
|
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_addon(token, name) {
|
|
try {
|
|
var resp = await axios.post(URL + 'pricecopyjpa_v4/save_addon', {
|
|
token:token,
|
|
name: 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 search_price_packet(token, mou, query, page) {
|
|
try {
|
|
var resp = await axios.post(URL + 'pricecopyjpa_v4/search_price_packet', {
|
|
token:token,
|
|
mou_id: mou,
|
|
search: query,
|
|
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
|
|
};
|
|
}
|
|
} |