1 Star 0 Fork 0

sky/company

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
psList.php 5.99 KB
一键复制 编辑 原始数据 按行查看 历史
sky 提交于 2024-01-04 15:13 . 提交项目
<?php
include_once('config/config.php');
$LoginAuth = checkAuth();
$size = 2;
$page = 1;
if ($_GET) {
$deleteid = trim($_GET['deleteid']) ?? '';
$page = $_GET['page'] ?? 1;
$size = $_GET['size'] ?? 2;
if ($deleteid) {
$res = del('person', "`id` = '$deleteid'");
if ($res['code'] === 0) {
showMsg($res['msg']);
} else {
showMsg($res['msg'], 'psList.php');
}
}
}
$start = ($page - 1) * $size;
$countsql = "select count(*) from `pre_person`";
$count = find($countsql);
// $sql = "select * from `pre_department` limit $start,$size";
$sql = "select `p`.*,`j`.name as job,`d`.name as department,`r`.province as r1, `r`.city as r2,`r`.district as r3 from `pre_person` as `p` left join `pre_job` as `j` on `p`.jobid = `j`.id left join `pre_department` as `d` on `p`.depid = `d`.id left join `pre_region` as `r` on `r`.parentpath rlike `p`.district order by id desc limit $start,$size";
$data = all($sql);
// pre($sql);
$ShowPage = showPage($page,$count['count(*)'],$size,3);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- 引入样式 -->
<?php include_once('common/meta.php'); ?>
</head>
<body>
<!-- 引入头部 -->
<?php include_once('common/header.php'); ?>
<!-- 引入菜单栏 -->
<?php include_once('common/menu.php'); ?>
<div class="content">
<div class="header">
<h1 class="page-title">员工列表</h1>
</div>
<ul class="breadcrumb">
<li><a href="index.php">Home</a> <span class="divider">/</span></li>
<li class="active">员工列表</li>
</ul>
<div class="container-fluid">
<div class="row-fluid">
<div class="btn-toolbar">
<button class="btn btn-primary" onClick="location='psAdd.php'"><i class="icon-plus"></i>添加员工</button>
</div>
<div class="well">
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>姓名</th>
<th>头像</th>
<th>手机号</th>
<th>邮箱</th>
<th>性别</th>
<th>职位</th>
<th>部门</th>
<th></th>
<th></th>
<th></th>
<th>详细地址</th>
<th>入职时间</th>
<th style="width: 26px;"></th>
</tr>
</thead>
<tbody>
<?php foreach ($data as $item) { ?>
<tr>
<td><?php echo $item['id']; ?></td>
<td><?php echo $item['name']; ?></td>
<td>
<a href="<?php echo @is_file(ltrim($item['avatar'],'/')) ? $item['avatar'] : '/assets/images/avatar.png';?>" target="_blank">
<img src="<?php echo @is_file(ltrim($item['avatar'],'/')) ? $item['avatar'] : '/assets/images/avatar.png';?>" width="35" alt="">
</a>
</td>
<td><?php echo $item['mobile']; ?></td>
<td><?php echo $item['email']; ?></td>
<td>
<?php
switch($item['sex'])
{
case 0:
echo '保密';
break;
case 1:
echo '男';
break;
case 2:
echo '女';
break;
}
?>
</td>
<td><?php echo $item['job']; ?></td>
<td><?php echo $item['department']; ?></td>
<td><?php echo $item['r1']; ?></td>
<td><?php echo $item['r2']; ?></td>
<td><?php echo $item['r3']; ?></td>
<td><?php echo $item['address']; ?></td>
<td>
<?php echo date('Y-m-d',$item['createtime']); ?>
</td>
<td>
<a href="psEdit.php?id=<?php echo $item['id']; ?>"><i class="icon-pencil"></i></a>
<a onclick="del(<?php echo $item['id']; ?>)"><i class="icon-remove"></i></a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php echo $ShowPage; ?>
<!-- 引入底部 -->
<?php include_once('common/footer.php'); ?>
</div>
</div>
</div>
</body>
</html>
<!-- 引入js -->
<?php include_once('common/script.php'); ?>
<script>
function del(id) {
let a = confirm('确认删除该条记录?');
if (a) {
location.href = 'psList.php?deleteid=' + id;
}
}
</script>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/JIE_XIAOQIU/company.git
git@gitee.com:JIE_XIAOQIU/company.git
JIE_XIAOQIU
company
company
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385