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.
75 lines
3.0 KiB
75 lines
3.0 KiB
6 years ago
|
<form id="theFrm">
|
||
|
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
|
||
|
<?php if (isset($info)): ?>
|
||
|
<input type="hidden" name="id" value="<?= $info->id ?>">
|
||
|
<?php endif; ?>
|
||
|
<tr>
|
||
|
<td width="20%" height="25" class="td_bg">父级分类</td>
|
||
|
<td width="80%" height="25" class="td_bg">
|
||
|
<select name="pid" id="pid" onchange="getSons($(this).val())">
|
||
|
<option value="0">顶级分类</option>
|
||
|
<?php if (isset($parents) > 0): ?>
|
||
|
<?php foreach ($parents as $parent): ?>
|
||
|
<option value="<?= $parent->id ?>" <?= isset($info) ? ($parent->id === $info->pid ? 'selected' : '') : '' ?>>
|
||
|
--<?= $parent->name ?></option>
|
||
|
<?php endforeach; ?>
|
||
|
<?php endif; ?>
|
||
|
</select>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td width="20%" height="25" class="td_bg">分组名:</td>
|
||
|
<td width="80%" height="25" class="td_bg">
|
||
|
<input type="text" name="name" value="<?= isset($info) ? $info->name : '' ?>">
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td height="22" colspan="2" align="center" class="td_bg">
|
||
|
<input id="submit-btn" type=button class="ACT_btn" name=Submit1
|
||
|
value=" 提交 "/>
|
||
|
|
||
|
<input id="back-btn" type="button" class="ACT_btn" name="Submit2" value=" 返回 ">
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</form>
|
||
|
<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">
|
||
|
$(function () {
|
||
|
//提交按钮
|
||
|
$("#submit-btn").click(function () {
|
||
|
if (confirm('是否确认提交?')) {
|
||
|
var params = $("#theFrm").serialize();
|
||
|
$.post('/fix-car-group/info', params, function (obj) {
|
||
|
if (obj.success) {
|
||
|
$('#back-btn').click();
|
||
|
} else {
|
||
|
alert(obj.msg);
|
||
|
}
|
||
|
}, 'json');
|
||
|
}
|
||
|
});
|
||
|
|
||
|
//返回按钮
|
||
|
$('#back-btn').click(function () {
|
||
|
window.location.href = '/fix-car-group/index';
|
||
|
});
|
||
|
})
|
||
|
|
||
|
//顶级分类 change 事件
|
||
|
function getSons(val) {
|
||
|
if (!val) return false;
|
||
|
$.post('/fix-car-category/get-machine', {pid: val}, function (data) {
|
||
|
if (data.success) {
|
||
|
var _option = '';
|
||
|
for (var i = 0; i < data.content.length; i++) {
|
||
|
_option += '<option value="' + data.content[i].id + '">' + data.content[i].name + '</option>';
|
||
|
}
|
||
|
$('#category_id').html(_option);
|
||
|
}
|
||
|
|
||
|
}, 'json');
|
||
|
}
|
||
|
</script>
|