Compare commits

3 Commits

Author SHA1 Message Date
dxc
29fd397e4f fix: use path converter for BOM routes
Co-authored-by: aider (openai/DeepSeek-V3.2-Thinking) <aider@aider.chat>
2026-02-28 15:44:38 +08:00
dxc
54d83803c4 fix: URL-encode BOM numbers containing slashes
Co-authored-by: aider (openai/DeepSeek-V3.2-Thinking) <aider@aider.chat>
2026-02-28 15:40:59 +08:00
dxc
05fbb4e3b3 fix: sanitize bomNo to avoid duplicate path in detail API
Co-authored-by: aider (openai/DeepSeek-V3.2-Thinking) <aider@aider.chat>
2026-02-28 15:38:02 +08:00
2 changed files with 11 additions and 5 deletions

View File

@ -80,7 +80,7 @@ def get_bom_list():
return jsonify({'code': 500, 'msg': '内部服务器错误'}), 500
@bom_bp.route('/detail/<bom_no>', methods=['GET'])
@bom_bp.route('/detail/<path:bom_no>', methods=['GET'])
@jwt_required()
@permission_required('bom_manage')
def get_bom_detail(bom_no):
@ -164,7 +164,7 @@ def save_bom():
return jsonify({'code': 500, 'msg': '内部服务器错误'}), 500
@bom_bp.route('/stock/<bom_no>', methods=['GET'])
@bom_bp.route('/stock/<path:bom_no>', methods=['GET'])
@jwt_required()
@permission_required('bom_manage')
def get_bom_with_stock_by_no(bom_no):
@ -188,7 +188,7 @@ def get_bom_with_stock_by_no(bom_no):
# ==================== 删除BOM接口 ====================
@bom_bp.route('/<bom_no>', methods=['DELETE'])
@bom_bp.route('/<path:bom_no>', methods=['DELETE'])
@jwt_required()
@permission_required('bom_manage:operation')
def delete_bom(bom_no):

View File

@ -11,8 +11,11 @@ export function getBomList(params?: any) {
// 获取BOM详情
export function getBomDetail(bomNo: string) {
// 去除首尾斜杠,保留中间斜杠并进行 URL 编码
const trimmed = bomNo.replace(/^\/+|\/+$/g, '');
const encoded = encodeURIComponent(trimmed);
return request({
url: `/v1/bom/detail/${bomNo}`,
url: `/v1/bom/detail/${encoded}`,
method: 'get'
})
}
@ -28,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'
})
}