75 lines
3.7 KiB
PHP
75 lines
3.7 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/documentAdd" 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 style="width:150px">操作</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php if (!empty($documents)): ?>
|
|
<?php foreach ($documents as $d): ?>
|
|
<tr>
|
|
<td><?php echo $d['id']; ?></td>
|
|
<td><?php echo htmlspecialchars($d['doc_no']); ?></td>
|
|
<td>
|
|
<?php if (!empty($d['file_path'])): ?>
|
|
<a href="<?php echo BASE_URL . htmlspecialchars($d['file_path']); ?>" target="_blank"><?php echo htmlspecialchars($d['title']); ?></a>
|
|
<?php else: ?>
|
|
<?php echo htmlspecialchars($d['title']); ?>
|
|
<?php endif; ?>
|
|
</td>
|
|
<td><?php echo htmlspecialchars($d['category']); ?></td>
|
|
<td><?php echo htmlspecialchars($d['version']); ?></td>
|
|
<td><?php echo htmlspecialchars($d['author']); ?></td>
|
|
<td><?php echo htmlspecialchars($d['department']); ?></td>
|
|
<td>
|
|
<?php
|
|
$statusLabels = ['active'=>'启用','archived'=>'归档','obsolete'=>'作废'];
|
|
$statusColors = ['active'=>'success','archived'=>'info','obsolete'=>'default'];
|
|
$st = $d['status'] ?? 'active';
|
|
?>
|
|
<span class="label label-<?php echo $statusColors[$st] ?? 'default'; ?>">
|
|
<?php echo $statusLabels[$st] ?? $st; ?>
|
|
</span>
|
|
</td>
|
|
<td><?php echo htmlspecialchars($d['created_at']); ?></td>
|
|
<td>
|
|
<a href="<?php echo BASE_URL; ?>/General/documentEdit?id=<?php echo $d['id']; ?>" class="btn btn-xs btn-info"><i class="fa fa-edit"></i> 编辑</a>
|
|
<form method="post" action="<?php echo BASE_URL; ?>/General/documentDelete" 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 $d['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="10" class="text-center text-muted">暂无文档数据</td></tr>
|
|
<?php endif; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<?php include APP_PATH . 'app/views/layouts/admin_footer.php'; ?>
|