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.
87 lines
4.0 KiB
87 lines
4.0 KiB
5 years ago
|
<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" method="GET">
|
||
|
<tr>
|
||
|
<td class="td_bg">
|
||
|
<label for="pid">分类:</label>
|
||
|
<select name="pid" id="pid">
|
||
|
<option value="0" <?= isset($pid) ? ('0' === $pid ? 'selected' : '') : '' ?>>全部</option>
|
||
|
<?php if (isset($parents) && count($parents) > 0): ?>
|
||
|
<?php foreach ($parents as $parent): ?>
|
||
|
<option value="<?= $parent->id ?>" <?= $parent->id == $pid ? 'selected' : '' ?>><?= $parent->name ?></option>
|
||
|
<?php endforeach; ?>
|
||
|
<?php endif; ?>
|
||
|
</select>
|
||
|
<label for="name">更换项目(配件名):</label>
|
||
|
<input type="text" id="name" name="name" size="15" value="<?= isset($name) ? $name : '' ?>">
|
||
|
<input type="submit" class="act_btn" id="search-btn" name="search-btn" value="搜索">
|
||
|
<input type="button" class="act_btn" value="添加" onclick="location.href='/fix-car-category/info'">
|
||
|
</td>
|
||
|
</tr>
|
||
|
</form>
|
||
|
<tr>
|
||
|
<td class="td_bg">
|
||
|
<label for="gid">分组名:</label>
|
||
|
<select name="gid" id="gid">
|
||
|
<option value="">--请选择--</option>
|
||
|
<?php if($groups): ?>
|
||
|
<?php foreach($groups as $group): ?>
|
||
|
<option value="<?= $group->id ?>"><?= $group->name ?></option>
|
||
|
<?php endforeach; ?>
|
||
|
<?php endif; ?>
|
||
|
</select>
|
||
|
<input type="button" class="act_btn" value="分组" onclick="toDoGroup()">
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
|
||
|
<tr>
|
||
|
<td width="5%" class="bg_tr" align="center"><input type="checkbox" onclick="checkAll()"></td>
|
||
|
<td width="5%" align="center" class="bg_tr" nowrap>排序</td>
|
||
|
<td align="center" class="bg_tr">更换项目(配件名)</td>
|
||
|
<td width="5%" align="center" class="bg_tr">操作</td>
|
||
|
</tr>
|
||
|
<?php if (count($sons) > 0): ?>
|
||
|
<?php foreach($sons as $key=>$son): ?>
|
||
|
<tr onMouseOver=overColor(this) onMouseOut=outColor(this)>
|
||
|
<td align="center" class="td_bg"><input type="checkbox" class="once-check" value="<?= $son->id ?>"></td>
|
||
|
<td align="center" class="td_bg"><?= $key + 1 ?></td>
|
||
|
<td align="left" class="td_bg"><?= $son->name ?></td>
|
||
|
<td align="center" class="td_bg"><a href="javascript:void(0)" onclick="edit(<?= $son->id ?>)">详情</a></td>
|
||
|
</tr>
|
||
|
<?php endforeach; ?>
|
||
|
<?php endif; ?>
|
||
|
<tr>
|
||
|
<td height="25" colspan="12" align="center" class="td_bg"><?= isset($page_info) ? $page_info : '' ?></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
<script type="text/javascript" language="javascript">
|
||
|
//编辑
|
||
|
function edit(id) {
|
||
|
window.location.href = '/fix-car-category/info?id=' + id;
|
||
|
}
|
||
|
//全选
|
||
|
function checkAll(){
|
||
|
$('.once-check').attr('checked',!$('.once-check').attr('checked'));
|
||
|
}
|
||
|
//分组
|
||
|
function toDoGroup(){
|
||
|
var groupId = $('#gid').val(),
|
||
|
categoryIdArr = [],
|
||
|
$checked = $('.once-check:checked'),
|
||
|
len = $checked.length;
|
||
|
if(groupId < 1 || len < 1 || pid < 1) return false;
|
||
|
$checked.each(function(){
|
||
|
categoryIdArr.push($(this).val());
|
||
|
});
|
||
|
$.post('/fix-car-category/grouping',{gid:groupId,category_id:categoryIdArr},function(data){
|
||
|
alert(data.msg);
|
||
|
if(data.success){
|
||
|
location.reload();
|
||
|
}
|
||
|
},'json');
|
||
|
}
|
||
|
</script>
|