• 欢迎光临~

下拉框联动

开发技术 开发技术 2022-08-01 次浏览

例如:学院和班级,学院改变后班级跟着改变

HTML:

<div class="lr-layout-tool-item" style="padding-top:20px">学院</div>
<div class="lr-layout-tool-item">
<div id="dwbh" style="width:200px"></div>
</div>
<div class="lr-layout-tool-item" style="padding-top:20px">班级</div>
<div class="lr-layout-tool-item">
<div id="banji" style="width:200px"></div>
</div>

 

js:

$('#dwbh').lrselect({
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable',
param: { code: "tjdw", strWhere: "", queryJson: "{}" },
value: 'xueyuan',
text: 'xueyuan',
allowSearch: true,
maxHeight: 200,
select: function (item) {
if (item) {
if (!!item) {
//学院、班级联动
$('#banji').lrselectRefresh({
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable',
param: { code: "tjbm", strWhere: "xueyuan = '" + item.xueyuan + "'", queryJson: "{}" },
});
}
}
}
});
//体检部门
$('#banji').lrselect({
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable',
param: { code: "tjbm", strWhere: "", queryJson: "{}" },
value: 'banji',
text: 'banji',
allowSearch: true,
maxHeight: 200,
select: function (item) {
}
});

 

取值:

var banji= $("#banji").lrselectGet();

 

程序员灯塔
转载请注明原文链接:下拉框联动
喜欢 (0)