初始化

This commit is contained in:
2026-08-08 18:28:49 +08:00
parent 9bef4420e0
commit f082037a6e
854 changed files with 217171 additions and 11 deletions
+133
View File
@@ -0,0 +1,133 @@
<?php
$activeMenu = 'config';
include APP_PATH . 'app/views/layouts/admin_header.php';
?>
<?php if (!empty($msg)): ?>
<div class="alert alert-success alert-dismissible">
<button type="button" class="close" data-dismiss="alert">&times;</button>
<i class="fa fa-check-circle"></i> <?php echo htmlspecialchars($msg); ?>
</div>
<?php endif; ?>
<?php if (!empty($error)): ?>
<div class="alert alert-danger alert-dismissible">
<button type="button" class="close" data-dismiss="alert">&times;</button>
<i class="fa fa-exclamation-circle"></i> <?php echo htmlspecialchars($error); ?>
</div>
<?php endif; ?>
<div class="row">
<div class="col-md-6">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title"><i class="fa fa-cog"></i> 系统配置</h3>
</div>
<form method="post" action="">
<input type="hidden" name="csrf_token" value="<?php echo htmlspecialchars($csrfToken); ?>">
<div class="box-body">
<div class="form-group">
<label>公司名称</label>
<input type="text" name="company_name" class="form-control" value="<?php echo htmlspecialchars($sysConfig['company_name'] ?? ''); ?>">
</div>
<div class="form-group">
<label>MES 展示名称</label>
<input type="text" name="mes_name" class="form-control" value="<?php echo htmlspecialchars($sysConfig['mes_name'] ?? ''); ?>">
</div>
</div>
<div class="box-footer">
<button type="submit" class="btn btn-primary"><i class="fa fa-save"></i> 保存配置</button>
</div>
</div>
<!-- 代码前缀规则配置 -->
<div class="box box-warning">
<div class="box-header with-border">
<h3 class="box-title"><i class="fa fa-barcode"></i> 序列号前缀规则</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
</div>
</div>
<div class="box-body">
<p class="text-muted" style="margin-bottom:12px;">
<i class="fa fa-info-circle"></i>
设置各产品类型的序列号前缀。工位录入时,序列号必须匹配对应前缀,否则将报错。
留空表示不检查前缀。
</p>
<div id="prefixRulesContainer">
<?php
$ruleIndex = 0;
if (!empty($codePrefixRules)):
foreach ($codePrefixRules as $typeName => $prefixVal):
?>
<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)"
value="<?php echo htmlspecialchars($typeName); ?>">
<input type="text" name="prefix_values[]" class="form-control" style="width:120px;"
placeholder="前缀(如:CP"
value="<?php echo htmlspecialchars($prefixVal); ?>">
<button type="button" class="btn btn-danger btn-sm remove-prefix-row" title="删除">
<i class="fa fa-trash"></i>
</button>
</div>
<?php
$ruleIndex++;
endforeach;
endif;
?>
</div>
<button type="button" class="btn btn-success btn-sm" id="addPrefixRow" style="margin-top:8px;">
<i class="fa fa-plus"></i> 添加规则
</button>
</div>
</form>
</div>
</div>
<div class="col-md-6">
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title"><i class="fa fa-info-circle"></i> 当前信息</h3>
</div>
<div class="box-body">
<dl class="dl-horizontal">
<dt>公司名称</dt>
<dd><?php echo htmlspecialchars($sysConfig['company_name'] ?? ''); ?></dd>
<dt>系统名称</dt>
<dd><?php echo htmlspecialchars($sysConfig['mes_name'] ?? ''); ?></dd>
<dt>前缀规则</dt>
<dd>
<?php if (!empty($codePrefixRules)): ?>
<table class="table table-condensed table-bordered" style="margin-bottom:0;">
<thead><tr><th>产品类型</th><th>前缀</th></tr></thead>
<tbody>
<?php foreach ($codePrefixRules as $typeName => $prefixVal): ?>
<tr>
<td><?php echo htmlspecialchars($typeName); ?></td>
<td>
<?php if ($prefixVal !== ''): ?>
<code><?php echo htmlspecialchars($prefixVal); ?></code>
<?php else: ?>
<span class="text-muted">无限制</span>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<span class="text-muted">未配置</span>
<?php endif; ?>
</dd>
<dt>PHP 版本</dt>
<dd><?php echo phpversion(); ?></dd>
</dl>
</div>
</div>
</div>
</div>
<?php // v3-P2:原内联 <script> 已抽离为 external JS,并以 nonce 加载,配合 CSP script-src 'nonce-***' ?>
<script src="<?php echo BASE_URL; ?>/static/js/admin_config.js" nonce="<?php echo csp_nonce(); ?>"></script>
<?php include APP_PATH . 'app/views/layouts/admin_footer.php'; ?>