Files
MES/app/views/Front/index.php
T
2026-08-08 18:28:49 +08:00

76 lines
3.8 KiB
PHP

<?php
$activeStation = '';
// 确保 sysConfig 可用
if (!isset($sysConfig)) {
$cfgModel = new app\models\SysConfig();
$sysConfig = $cfgModel->getConfig();
}
include APP_PATH . 'app/views/layouts/station_header.php';
?>
<div class="content">
<!-- 用户信息提示 -->
<div class="alert alert-info" style="margin-bottom:16px; display:flex; align-items:center; gap:8px; flex-wrap:wrap;">
<i class="fa fa-info-circle"></i>
<span>当前登录:<strong><?php echo htmlspecialchars($user['emp_name']); ?></strong></span>
<span style="color:var(--text-light);">| 角色:<?php echo htmlspecialchars(\core\base\Controller::ROLE_NAMES[$user['role']] ?? $user['role']); ?></span>
<span style="color:var(--text-light);">| 选择下方工位开始操作</span>
<span style="margin-left:auto;" class="column-adjuster" title="调整工位卡片列数">
<button type="button" class="col-btn" data-cols="1" title="1列"><i class="fa fa-align-justify"></i></button>
<button type="button" class="col-btn" data-cols="2" title="2列"><i class="fa fa-columns"></i>2</button>
<button type="button" class="col-btn" data-cols="3" title="3列"><i class="fa fa-columns"></i>3</button>
<button type="button" class="col-btn active" data-cols="auto" title="自适应"><i class="fa fa-arrows-h"></i> 自动</button>
</span>
</div>
<!-- 工位网格 -->
<div class="station-grid" id="stationGrid">
<?php
$stationIcons = [
'inbound' => 'fa-sign-in',
'pcb_test' => 'fa-microchip',
'battery' => 'fa-battery-full',
'assembly' => 'fa-cogs',
'finished_test' => 'fa-check-circle',
'warehouse' => 'fa-warehouse',
'delivery' => 'fa-truck',
'document_manage' => 'fa-folder-open',
];
$iconColors = [
'inbound' => ['#10ac84', 'rgba(16,172,132,0.2)'],
'pcb_test' => ['#0abde3', 'rgba(10,189,227,0.2)'],
'battery' => ['#feca57', 'rgba(254,202,87,0.2)'],
'assembly' => ['#a29bfe', 'rgba(162,155,254,0.2)'],
'finished_test' => ['#55efc4', 'rgba(85,239,196,0.2)'],
'warehouse' => ['#fd79a8', 'rgba(253,121,168,0.2)'],
'delivery' => ['#74b9ff', 'rgba(116,185,255,0.2)'],
'document_manage' => ['#e17055', 'rgba(225,112,85,0.2)'],
];
foreach ($stations as $station):
$type = $station['station_type'];
$icon = $stationIcons[$type] ?? 'fa-circle-o';
$color = $iconColors[$type] ?? ['#0abde3', 'rgba(10,189,227,0.2)'];
$disabled = $station['status'] == 0;
?>
<a href="<?php echo $disabled ? '#' : BASE_URL . '/Front/' . $type; ?>"
class="station-card"
style="<?php echo $disabled ? 'opacity:0.5; cursor:not-allowed;' : ''; ?>"
<?php echo $disabled ? 'onclick="return false;"' : ''; ?>>
<div class="station-icon" style="background:<?php echo $color[1]; ?>; color:<?php echo $color[0]; ?>;">
<i class="fa <?php echo $icon; ?>"></i>
</div>
<div class="station-name"><?php echo htmlspecialchars($station['station_name']); ?></div>
<div class="station-code"><?php echo htmlspecialchars($station['station_code']); ?></div>
<div class="station-status">
<span style="color:<?php echo $station['status'] == 1 ? 'var(--success)' : 'var(--danger)'; ?>">
<?php echo $station['status'] == 1 ? '● 启用' : '● 禁用'; ?>
</span>
</div>
</a>
<?php endforeach; ?>
</div>
</div>
<?php include APP_PATH . 'app/views/layouts/station_footer.php'; ?>