//对勾选的下拉选择进行同步选择
function syncLoadTruckTableSelect(prefixSelector,currentLineIndex){
//获取当前操作的select所在行的checkbox的状态
var isChecked = $("#"+prefixSelector+currentLineIndex).closest("tr").find(":checkbox").prop("checked");
if (!isChecked) {
return;
}
var syncValue = $("#"+prefixSelector+currentLineIndex).val();
$("#loadTruckLineTable tr:gt(0) :checkbox:checked").each(function(index) {
debugger;
var lineIndex = $(this).attr("lineIndex");
$("#"+prefixSelector+lineIndex).val(syncValue);
});
}
$(function() {
//拆分table
changeDivSize();
//设定储位同步改变功能
$("#storageMaterialTrailerBodyRight").delegate("select[id^='locationSiteId_']","change",function() {
if(syncStatus) {
var startIndex = $(this).attr("id").indexOf("_");
var index = $(this).attr("id").substring(startIndex + 1);
var locationSiteId = $("#locationSiteId_"+index).find("option:selected").val();
//根据table tr的长度进行同步遍历
var trLength = $("#storageMaterialTrailerBodyRight tr").length;
for(var i = 0; i < trLength; i++) {
//启动位置不需要重新设定,设定储位被选中
if(i != index) {
$("#locationSiteId_"+i).children().each(function() {
var optionValue = $(this).val();
if(optionValue == locationSiteId)
$(this).attr("selected",true);
else
$(this).removeAttr("selected");
});
}
}
}
});
});