fix: align BOM columns in planning detail

This commit is contained in:
Codex 2026-10-12 11:42:33 +08:00
parent 1210109255
commit 7aeb35595e
2 changed files with 32 additions and 2 deletions

View File

@ -27835,7 +27835,7 @@ window.showProductDetail = function(productCode) {
</div> </div>
<div class="pd-card-body" style="padding:0;overflow-x:auto"> <div class="pd-card-body" style="padding:0;overflow-x:auto">
${bomMaterials.length > 0 ${bomMaterials.length > 0
? '<table class="data-table" style="font-size:12px"><thead><tr><th style="text-align:center">\u7269\u6599\u7f16\u53f7</th><th style="text-align:center">\u7269\u6599\u540d\u79f0</th><th style="text-align:center">\u53ef\u7528\u5e93\u5b58</th><th style="text-align:center">\u751f\u4ea7\u5728\u9014</th><th style="text-align:center">\u91c7\u8d2d\u5728\u9014</th><th style="text-align:center">\u5355\u4ef7</th></tr></thead><tbody>' + bomHtml + '</tbody></table>' ? '<table class="data-table" style="font-size:12px"><thead><tr><th style="text-align:center">\u7269\u6599\u7f16\u53f7</th><th style="text-align:center">\u7269\u6599\u540d\u79f0</th><th style="text-align:center">\u4f9b\u5e94\u5546</th><th style="text-align:center">\u53ef\u7528\u5e93\u5b58</th><th style="text-align:center">\u751f\u4ea7\u5728\u9014</th><th style="text-align:center">\u91c7\u8d2d\u5728\u9014</th><th style="text-align:center">\u5355\u4ef7</th></tr></thead><tbody>' + bomHtml + '</tbody></table>'
: '<div style="padding:24px;text-align:center;color:var(--text-light)">\u6682\u65e0BOM\u7269\u6599\u6e05\u5355</div>' : '<div style="padding:24px;text-align:center;color:var(--text-light)">\u6682\u65e0BOM\u7269\u6599\u6e05\u5355</div>'
} }
</div> </div>
@ -28064,7 +28064,7 @@ window.showBomProductDetail = function(productCode) {
</div> </div>
<div class="pd-card-body" style="padding:0;overflow-x:auto"> <div class="pd-card-body" style="padding:0;overflow-x:auto">
${bomMaterials.length > 0 ${bomMaterials.length > 0
? '<table class="data-table" style="font-size:12px"><thead><tr><th style="text-align:center">\u7269\u6599\u7f16\u53f7</th><th style="text-align:center">\u7269\u6599\u540d\u79f0</th><th style="text-align:center">\u53ef\u7528\u5e93\u5b58</th><th style="text-align:center">\u751f\u4ea7\u5728\u9014</th><th style="text-align:center">\u91c7\u8d2d\u5728\u9014</th><th style="text-align:center">\u5355\u4ef7</th></tr></thead><tbody>' + bomHtml + '</tbody></table>' ? '<table class="data-table" style="font-size:12px"><thead><tr><th style="text-align:center">\u7269\u6599\u7f16\u53f7</th><th style="text-align:center">\u7269\u6599\u540d\u79f0</th><th style="text-align:center">\u4f9b\u5e94\u5546</th><th style="text-align:center">\u53ef\u7528\u5e93\u5b58</th><th style="text-align:center">\u751f\u4ea7\u5728\u9014</th><th style="text-align:center">\u91c7\u8d2d\u5728\u9014</th><th style="text-align:center">\u5355\u4ef7</th></tr></thead><tbody>' + bomHtml + '</tbody></table>'
: '<div style="padding:24px;text-align:center;color:var(--text-light)">\u6682\u65e0BOM\u7269\u6599\u6e05\u5355</div>' : '<div style="padding:24px;text-align:center;color:var(--text-light)">\u6682\u65e0BOM\u7269\u6599\u6e05\u5355</div>'
} }
</div> </div>

View File

@ -0,0 +1,30 @@
"""计划预测 SKU 详情弹窗 BOM 列对齐回归测试。"""
import unittest
from pathlib import Path
APP_JS = (Path(__file__).resolve().parents[1] / 'static/js/app.js').read_text(encoding='utf-8')
class PlanningBomPopupColumnsTest(unittest.TestCase):
def test_bom_headers_include_supplier_between_name_and_inventory(self):
header_sequence = (
'\\u7269\\u6599\\u540d\\u79f0</th>'
'<th style="text-align:center">\\u4f9b\\u5e94\\u5546</th>'
'<th style="text-align:center">\\u53ef\\u7528\\u5e93\\u5b58</th>'
)
self.assertGreaterEqual(APP_JS.count(header_sequence), 2)
def test_bom_rows_render_supplier_before_inventory(self):
row_sequence = (
"escHtml(m.material_name) + '</td>' +\n"
" '<td style=\"text-align:center\">' + "
"(bomCanSupplier ? escHtml(m.material_supplier || '-') : '-') + '</td>' +\n"
" '<td style=\"text-align:center\">' + m.available_qty.toLocaleString()"
)
self.assertGreaterEqual(APP_JS.count(row_sequence), 2)
if __name__ == '__main__':
unittest.main()