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/fix-car-scale/info.php

88 lines
3.7 KiB

<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 (count($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">
<select name="category_id" id="category_id">
<option value="0">---请选择---</option>
<?php if (isset($sons) > 0): ?>
<?php foreach ($sons as $son): ?>
<option value="<?= $son->id ?>" <?= $son->id == $info->category_id ? 'selected' : '' ?>><?= $son->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 name="scale" size="2" type="text" id="path"
value="<?= isset($info) ? $info->scale : 0 ?>"
size="40"/>%
</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=" 提交 "/>
&nbsp;&nbsp;
<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-scale/info', params, function (obj) {
if (obj.success) {
$('#back-btn').click();
} else {
alert(obj.msg);
}
}, 'json');
}
});
//返回按钮
$('#back-btn').click(function () {
window.location.href = '/fix-car-scale/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>