69 lines
3.3 KiB
PHP
69 lines
3.3 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/hrAdd" 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($employees)): ?>
|
|
<?php foreach ($employees as $e): ?>
|
|
<tr>
|
|
<td><?php echo $e['id']; ?></td>
|
|
<td><?php echo htmlspecialchars($e['emp_no']); ?></td>
|
|
<td><?php echo htmlspecialchars($e['name']); ?></td>
|
|
<td><?php echo htmlspecialchars($e['gender']); ?></td>
|
|
<td><?php echo htmlspecialchars($e['department']); ?></td>
|
|
<td><?php echo htmlspecialchars($e['position']); ?></td>
|
|
<td><?php echo htmlspecialchars($e['phone']); ?></td>
|
|
<td><?php echo htmlspecialchars($e['entry_date']); ?></td>
|
|
<td>
|
|
<?php
|
|
$statusLabels = ['active'=>'在职','resigned'=>'离职','suspended'=>'停职'];
|
|
$statusColors = ['active'=>'success','resigned'=>'default','suspended'=>'warning'];
|
|
$st = $e['status'] ?? 'active';
|
|
?>
|
|
<span class="label label-<?php echo $statusColors[$st] ?? 'default'; ?>">
|
|
<?php echo $statusLabels[$st] ?? $st; ?>
|
|
</span>
|
|
</td>
|
|
<td>
|
|
<a href="<?php echo BASE_URL; ?>/General/hrEdit?id=<?php echo $e['id']; ?>" class="btn btn-xs btn-info"><i class="fa fa-edit"></i> 编辑</a>
|
|
<form method="post" action="<?php echo BASE_URL; ?>/General/hrDelete" 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 $e['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'; ?>
|