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

71 lines
3.5 KiB
PHP

<?php
include APP_PATH . 'app/views/layouts/admin_header.php';
?>
<div class="box">
<div class="box-header with-border">
<h3 class="box-title"><i class="fa fa-list"></i> 资产列表</h3>
<div class="box-tools">
<a href="<?php echo BASE_URL; ?>/General/assetAdd" class="btn btn-primary btn-sm"><i class="fa fa-plus"></i> 添加资产</a>
</div>
</div>
<div class="box-body table-responsive no-padding">
<table class="table table-hover table-striped">
<thead>
<tr>
<th>序号</th>
<th>资产编号</th>
<th>资产名称</th>
<th>类别</th>
<th>规格型号</th>
<th>数量</th>
<th>购置价格</th>
<th>使用部门</th>
<th>使用人</th>
<th>状态</th>
<th style="width:150px">操作</th>
</tr>
</thead>
<tbody>
<?php if (!empty($assets)): ?>
<?php foreach ($assets as $a): ?>
<tr>
<td><?php echo $a['id']; ?></td>
<td><?php echo htmlspecialchars($a['asset_no']); ?></td>
<td><?php echo htmlspecialchars($a['name']); ?></td>
<td><?php echo htmlspecialchars($a['category']); ?></td>
<td><?php echo htmlspecialchars($a['model']); ?></td>
<td><?php echo $a['quantity']; ?></td>
<td>&yen;<?php echo number_format($a['purchase_price'], 2); ?></td>
<td><?php echo htmlspecialchars($a['department']); ?></td>
<td><?php echo htmlspecialchars($a['user_name']); ?></td>
<td>
<?php
$statusLabels = ['normal'=>'正常','scrapped'=>'报废','repairing'=>'维修中','borrowed'=>'借用中'];
$statusColors = ['normal'=>'success','scrapped'=>'default','repairing'=>'warning','borrowed'=>'info'];
$st = $a['status'] ?? 'normal';
?>
<span class="label label-<?php echo $statusColors[$st] ?? 'default'; ?>">
<?php echo $statusLabels[$st] ?? $st; ?>
</span>
</td>
<td>
<a href="<?php echo BASE_URL; ?>/General/assetEdit?id=<?php echo $a['id']; ?>" class="btn btn-xs btn-info"><i class="fa fa-edit"></i> 编辑</a>
<form method="post" action="<?php echo BASE_URL; ?>/General/assetDelete" style="display:inline" onsubmit="return confirm('确定删除该资产吗?');">
<input type="hidden" name="csrf_token" value="<?php echo htmlspecialchars($csrfToken ?? ''); ?>">
<input type="hidden" name="id" value="<?php echo $a['id']; ?>">
<button type="submit" class="btn btn-xs btn-danger"><i class="fa fa-trash"></i> 删除</button>
</form>
</td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr><td colspan="11" class="text-center text-muted">暂无资产数据</td></tr>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
<?php include APP_PATH . 'app/views/layouts/admin_footer.php'; ?>