You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
simple-yewu/frontend/views/company/dp-index.php

74 lines
2.7 KiB

5 years ago
<?php
use \common\libs\MyLib;
?>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script>
<script type="text/javascript" language="javascript" src="/js/func.js"></script>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
<form id="searchForm">
<tr>
<td class="td_bg">
<input type="button" class="act_btn" id="add-btn" name="add-btn" value="添加">
<input type="button" class="act_btn" id="back-btn" name="back-btn" value="返回">
<?=$company_info->name?>
</td>
</tr>
</form>
</table>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
<tr>
<td align="center" width="50" align="center" class="bg_tr">序号</td>
<td width="60%" align="center" align="center" class="bg_tr">部门名称</td>
<td width="30" align="center" class="bg_tr">操作</td>
</tr>
<?php
foreach($items as $index => $item) {
?>
<tr onMouseOver=overColor(this) onMouseOut=outColor(this)>
<td align="center" class="td_bg" nowrap ><?=$item['id']?></td>
<td align="left" class="td_bg" nowrap ><?=$item['name']?></td>
<td align="center" class="td_bg" nowrap>
[<a href="javascript:void(0);" onclick="edit(<?=$item['id']?>)">修改</a>]
[<a href="javascript:void(0);" onclick="del(<?=$item['id']?>)">删除</a>]
</td>
</tr>
<?php
}
?>
</table>
<script type="text/javascript" language="javascript">
//编辑
function edit(id) {
var params = $('#searchForm').serialize();
window.location.href = '/company/dp-edit?company_id=<?=$company_id?>&id=' + id;
}
//删除
function del(id) {
if(confirm('是否确认删除?')) {
$.post('/company/dp-delete',{company_id:<?=$company_id?>,id:id},function(obj){
alert(obj.msg);
if(obj.success) {
window.location.reload();
}
},'json');
}
}
//返回按钮
$('#back-btn').click(function(){
window.location.href='/company/index';
});
$(function(){
$("#search-btn").click(function(){
$('#page').val(0);
var params = $('#searchForm').serialize();
window.location.href = "/company/dp-index?company_id=<?=$company_id?>&" + params;
});
$('#add-btn').click(function(){
window.location.href = '/company/dp-edit?company_id=<?=$company_id?>&id=0';
});
});
</script>