Files
MES/static/js/admin_config.js
2026-08-08 18:28:49 +08:00

20 lines
1.1 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// admin_config.js — 系统配置页:序列号前缀规则 增/删 行交互
// 由 app/views/Admin/config.php 以 nonce 方式加载(配合 CSP script-src 'nonce-***'
// 注意:本文件由外部引入,不再依赖 'unsafe-inline'。
$(function () {
// 添加前缀规则行
$('#addPrefixRow').click(function () {
var row = '<div class="prefix-rule-row" style="display:flex; gap:10px; margin-bottom:8px; align-items:center;">' +
'<input type="text" name="prefix_types[]" class="form-control" style="flex:1;" placeholder="产品类型(如:成品、电芯、PCBA">' +
'<input type="text" name="prefix_values[]" class="form-control" style="width:120px;" placeholder="前缀(如:CP">' +
'<button type="button" class="btn btn-danger btn-sm remove-prefix-row" title="删除"><i class="fa fa-trash"></i></button>' +
'</div>';
$('#prefixRulesContainer').append(row);
});
// 删除前缀规则行(事件委托)
$('#prefixRulesContainer').on('click', '.remove-prefix-row', function () {
$(this).closest('.prefix-rule-row').remove();
});
});