$(document).ready(function(){
$('input:checkbox[name="supplyCheckBox"]').each(function(i){
$(this).click(function(){
// 复选框选中个数
var checkedSize = $('input:checkbox[name="supplyCheckBox"][ checked]').length;
// 检查是否超过3个选中
if (checkedSize > 1) {
alert("只能选择一个报价信息!");
if ($(this).is(':checked')) {
$(this).parent().removeClass("checked");
$(this).attr("checked", false);
}else {
$(this).parent().addClass("checked");
$(this).attr("checked", true);
}
return;
}
})
});
});
$('#quoteButton').bind("click",function(e){
e.preventDefault();
// 复选框选中个数
var checkbox = document.getElementsByName("supplyCheckBox");
var checkedSize = 0; //初始化一下number
var quoteNo = ''; //记录所选数据的id
if(checkbox.length != 0) //判断条件是当选择的个数不为0时
{
for( i = 0; i < checkbox.length; i ++) //循环遍历复选框
{
if (checkbox[i].checked == true) //如果[i]个复选框为选中状态
{
checkedSize ++; //累加所选的个数
quoteNo=checkbox[i].defaultValue;
}
}
}
// 检查是否超过3个选中
if (checkedSize < 1) {
alert("请选择唯一的中标对象!");
return;
}
if (checkedSize == 1) {
location.href="${contextPath}/systems/srm/purchase/iq/chooseQuote.html?quoteNo=" + quoteNo;
}
});
$('input:checkbox[name="supplyCheckBox"]').each(function(i){
$(this).click(function(){
// 复选框选中个数
var checkedSize = $('input:checkbox[name="supplyCheckBox"][ checked]').length;
// 检查是否超过3个选中
if (checkedSize > 1) {
alert("只能选择一个报价信息!");
if ($(this).is(':checked')) {
$(this).parent().removeClass("checked");
$(this).attr("checked", false);
}else {
$(this).parent().addClass("checked");
$(this).attr("checked", true);
}
return;
}
})
});
});
$('#quoteButton').bind("click",function(e){
e.preventDefault();
// 复选框选中个数
var checkbox = document.getElementsByName("supplyCheckBox");
var checkedSize = 0; //初始化一下number
var quoteNo = ''; //记录所选数据的id
if(checkbox.length != 0) //判断条件是当选择的个数不为0时
{
for( i = 0; i < checkbox.length; i ++) //循环遍历复选框
{
if (checkbox[i].checked == true) //如果[i]个复选框为选中状态
{
checkedSize ++; //累加所选的个数
quoteNo=checkbox[i].defaultValue;
}
}
}
// 检查是否超过3个选中
if (checkedSize < 1) {
alert("请选择唯一的中标对象!");
return;
}
if (checkedSize == 1) {
location.href="${contextPath}/systems/srm/purchase/iq/chooseQuote.html?quoteNo=" + quoteNo;
}
});