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/district/index.php

98 lines
4.0 KiB

<?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>
<script type="text/javascript" language="javascript">
//编辑
function edit(id) {
window.location.href = '/district/edit?id=' + id;
}
//删除
function del(id) {
if(confirm('是否确认删除?')) {
$.post('/district/delete',{id:id},function(obj){
alert(obj.msg);
if(obj.success) {
window.location.reload();
}
},'json');
}
}
$(function(){
$("#search-btn").click(function(){
var params = $('#searchForm').serialize();
window.location.href = "/district/index?" + params;
});
$('#add-btn').click(function(){
edit(0);
});
$('#order-btn').click(function(){
if(confirm('是否批量保存排序?')) {
var params = $('#theFrm').serialize();
$.post('/district/order-save',params,function(obj){
alert(obj.msg);
if(obj.success) {
window.location.reload();
}
},'json');
}
});
});
</script>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
<form id="searchForm">
<tr>
<td class="td_bg">
名称:<input name="name" type="text" value="<?=$name?>">
城市:<select name="city_id" id="city_id">
<option value="0">全部</option>
<?php
foreach($city_items as $item) {
echo '<option value="'.$item->id.'"';
if($item->id == $city_id)
echo ' selected ';
echo '>'.$item->name.'</option>';
}
?>
</select>
<input type="button" class="act_btn" id="search-btn" name="search-btn" value="搜索">
<input type="button" class="act_btn" id="add-btn" name="add-btn" value="添加">
<input type="button" class="act_btn" id="order-btn" name="order-btn" value="保存排序">
</td>
</tr>
</form>
</table>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
<tr>
<td width="50" align="center" align="center" class="bg_tr" nowrap>排序</td>
<td width="200" align="center" align="center" class="bg_tr">名称</td>
<td width="70%" align="center" align="center" class="bg_tr">所属城市</td>
<td width="100" align="center" align="center" class="bg_tr">排序</td>
<td width="30" align="center" class="bg_tr">操作</td>
</tr>
<form id="theFrm">
<?php
foreach($items as $index => $item) {
?>
<tr onMouseOver=overColor(this) onMouseOut=outColor(this)>
<td align="center" class="td_bg" nowrap><?=$index+1?></td>
<td align="left" class="td_bg" nowrap><?=$item->name?></td>
<td align="left" class="td_bg" nowrap><?=$item->city->name?></td>
<td align="center" class="td_bg" nowrap>
<input type="text" name="order_ids[<?=$item->id?>]" value="<?=$item->order_id?>" style="width:50px;">
</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
}
?>
</form>
<tr >
<td height="25" colspan="11" align="center" class="td_bg"><?=$page_info?></td>
</tr>
</table>