1.html代码:
<td width="80px;">科目名称:</td>
<td >
<select id="accountitem" name="accountitem" class="easyui-combobox" data-options="editable:false,panelHeight:'auto',
onSelect: function(){getAccountnameList();},onLoadSuccess : function(){getAccountnameList();}">
<option value="01">2013第一季度</option>
<option value="02">2013第二季度</option>
<option value="03">2013第三季度</option>
</select>
</td>
<td>账户名称:</td>
<td >
<select id="accountname" name="accountname" class="easyui-combobox" data-options="editable:false,panelHeight:'auto'"></select>
</td>
2.js代码
/* 动态加载账户名称 */
function getAccountnameList(){
//获取下拉列表的选项值
var id = $("#accountitem").combobox("getValue");
$('#accountname').combobox({
url: '${ctx}/oa/fdr/accountnameList?id='+id,
valueField: 'id', //id是返回json字符串中的key,对应下拉列表值
textField: 'name', //name是返回json字符串中的key,对应下拉列表显示文本
onLoadSuccess : function(record){
//默认选中第一项
$('#accountname').combobox('setValue',record[0].id);
}
});
getCapitalsummary();
};
//json数据如下:
[{"group":"","id":"cwzhnhfsy","name":"农行","selected":true},
{"group":"","id":"cwzhnhpos","name":"工行","selected":false},
{"group":"","id":"cwzhjhlzl","name":"建行","selected":false},
{"group":"","id":"cwzhjnpos","name":"POS机","selected":false}]
/* 动态加载期初余额 */
function getCapitalsummary(){
var accountname = $("#accountname").combobox("getValue");
$.post('${ctx}/oa/fdr/capitalsummary',{accountname:accountname},function(data){
//使用jquery动态给easyui-numberbox赋值
$("#beginningbalance").numberbox('setValue', data.beginningbalance);
},'json');
};
//json数据如下:
{"beginningbalance":0,"incomeamount":0,"spendingamount":0}