下拉框,把写好的方法,通过改变事件把方法绑定到下拉框里面,只要一选择下拉框里面的option值就会触发
<tr> <td class=“text-center”>客户属性</td> <td><select
class=“form-control w-50” id=“ClientPropertySelect”
name=“ClientPropertyID” οnchange=“tiJiaoP()”></select></td> <td
class=“text-center”>客户价值等级</td> <td><select class=“form-control
w-50” id=“ClientWorthGradeSelect” name=“ClientWorthGradeID”
οnchange=“tiJiaoW()”></select></td> </tr><tr> <td class=“text-center”>客户类别</td> <td><select
class=“form-control w-50” id=“ClientCategorySelect”
name=“ClientCategoryID” οnchange=“tiJiaoC()”></select></td>
</tr>
效果图
//根据选中的下拉框查询出结果
//新增 客户表 多条件查询
function searchSelectClient() {
var ClientPropertySelect = $("#ClientPropertySelect").val(); //客户属性
var ClientWorthGradeSelect = $("#ClientWorthGradeSelect").val(); //客户价值等级
var ClientCategorySelect = $("#ClientCategorySelect").val(); //客户类别if (ClientPropertySelect == “” || ClientPropertySelect == undefined) {
ClientPropertySelect = 0; } if (ClientWorthGradeSelect == “” || ClientWorthGradeSelect == undefined) {
ClientWorthGradeSelect = 0; } if (ClientCategorySelect == “” || ClientCategorySelect == undefined) {
ClientCategorySelect = 0; } tabSelectClient.reload({
url: “/BOManagement/BOManagement/TabSelectClient”,
where: {
ClientPropertySelect: ClientPropertySelect,
ClientWorthGradeSelect: ClientWorthGradeSelect,
ClientCategorySelect: ClientCategorySelect,
}, page: {
curr: 1
} }); }
Value=0是没有选择到的两个下拉框,只要选择其中一个另外两个value=0,这样通过查询的条件就你选择的那个
Else 是你要选择的下拉框的value是0时,另外两个value也为0
//选择客户属性下拉框 弹出客户表
function tiJiaoP() {
if (ClientPropertySelect.value > 0) {
ClientWorthGradeSelect.value = 0;
ClientCategorySelect.value = 0;
searchSelectClient();
$("#modalSelectClient").modal("show");
} else {
ClientWorthGradeSelect.value = 0;
ClientCategorySelect.value = 0;
}
}
//选择客户价值等级下拉框 弹出客户表 function tiJiaoW() {
if (ClientWorthGradeSelect.value > 0) {
ClientPropertySelect.value = 0;
ClientCategorySelect.value = 0;
searchSelectClient();
$("#modalSelectClient").modal(“show”);} else {
ClientPropertySelect.value = 0;
ClientCategorySelect.value = 0; }}
//选择客户价值等级下拉框 弹出客户表
function tiJiaoC() {
if (ClientCategorySelect.value > 0) {
ClientPropertySelect.value = 0;
ClientWorthGradeSelect.value = 0;
searchSelectClient();
$("#modalSelectClient").modal(“show”);} else {
ClientPropertySelect.value = 0;
ClientWorthGradeSelect.value = 0; }}
这样以选择到,就通过改变事件触发选择到的的下拉框值,不用点击提交类的按钮了