fix: URL-encode BOM numbers containing slashes
Co-authored-by: aider (openai/DeepSeek-V3.2-Thinking) <aider@aider.chat>
This commit is contained in:
@ -11,11 +11,11 @@ export function getBomList(params?: any) {
|
||||
|
||||
// 获取BOM详情
|
||||
export function getBomDetail(bomNo: string) {
|
||||
// 去除首尾斜杠,并按 '/' 分割,取第一个有效部分
|
||||
// 去除首尾斜杠,保留中间斜杠并进行 URL 编码
|
||||
const trimmed = bomNo.replace(/^\/+|\/+$/g, '');
|
||||
const firstPart = trimmed.split('/')[0];
|
||||
const encoded = encodeURIComponent(trimmed);
|
||||
return request({
|
||||
url: `/v1/bom/detail/${firstPart}`,
|
||||
url: `/v1/bom/detail/${encoded}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
@ -31,8 +31,11 @@ export function saveBom(data: any) {
|
||||
|
||||
// 删除BOM(暂未实现,预留)
|
||||
export function deleteBom(bomNo: string) {
|
||||
// 去除首尾斜杠,保留中间斜杠并进行 URL 编码
|
||||
const trimmed = bomNo.replace(/^\/+|\/+$/g, '');
|
||||
const encoded = encodeURIComponent(trimmed);
|
||||
return request({
|
||||
url: `/v1/bom/${bomNo}`,
|
||||
url: `/v1/bom/${encoded}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user