table表单判断点击数据

var day_news,day_one,day_two,day_three,day_four,day_five,day_six,day_seven;
var arr = [],arr1 = [],arr2 = [],arr3 = [],arr4 = [],arr5 = [],arr6 = [],arr7 = [];
arr.splice( 0,arr); arr1.splice( 0,arr1); arr2.splice( 0,arr2); arr3.splice( 0,arr3); arr4.splice( 0,arr4); arr5.splice( 0,arr5);arr6.splice( 0,arr6);arr7.splice( 0,arr7);
var brandCode = $reportData.val(),brandName = $reportData.find( 'option:selected').text();
//获取勾选的品牌数据

//今天的数据
if( $( "#mcRepmentTable3 tr").find( "td:eq(2)")){
$( "#mcRepmentTable3 tr").find( "td:eq(2)").find( ":checkbox:checked").each( function(){
if($( "#mcRepmentTable3 tr").find( "td:eq(2)").find( ":checkbox:checked").prop( "checked")== true){
var good_id = $( this).attr( 'data_goodId');
arr.push(good_id);
}
});
var date =$( "#mcRepmentTable3 tr").find( "td:eq(2)").find( "input[type=checkbox]").attr( 'data_time');
var data = {
"data" : date,
"create_name": create_name,
"create_account":create_account,
"list" : arr
}
day_news=data;
}

//前一天的数据
if( $( "#mcRepmentTable3 tr").find( "td:eq(3)")){
$( "#mcRepmentTable3 tr").find( "td:eq(3)").find( ":checkbox:checked").each( function(){
if($( "#mcRepmentTable3 tr").find( "td:eq(3)").find( ":checkbox:checked").prop( "checked")== true){
var good_id = $( this).attr( 'data_goodId');
arr1.push(good_id);
}
});
var date =$( "#mcRepmentTable3 tr").find( "td:eq(3)").find( "input[type=checkbox]").attr( 'data_time');
var data1 = {
"data" : date,
"create_name": create_name,
"create_account":create_account,
"list" : arr1
}
day_one = data1;
}

//前两天的数据
if( $( "#mcRepmentTable3 tr").find( "td:eq(4)")){
$( "#mcRepmentTable3 tr").find( "td:eq(4)").find( ":checkbox:checked").each( function(){
if($( "#mcRepmentTable3 tr").find( "td:eq(4)").find( ":checkbox:checked").prop( "checked")== true){
var good_id = $( this).attr( 'data_goodId');
arr2.push(good_id);
}
});
var date =$( "#mcRepmentTable3 tr").find( "td:eq(4)").find( "input[type=checkbox]").attr( 'data_time');
var data2 = {
"data" : date,
"create_name": create_name,
"create_account":create_account,
"list" : arr2
}
day_two=data2;
}

//前三天的数据
if( $( "#mcRepmentTable3 tr").find( "td:eq(5)")){
$( "#mcRepmentTable3 tr").find( "td:eq(5)").find( ":checkbox:checked").each( function(){
if($( "#mcRepmentTable3 tr").find( "td:eq(5)").find( ":checkbox:checked").prop( "checked")== true){
var good_id = $( this).attr( 'data_goodId');
arr3.push(good_id);
}
});
var date =$( "#mcRepmentTable3 tr").find( "td:eq(5)").find( "input[type=checkbox]").attr( 'data_time');
var data3 = {
"data" : date,
"create_name": create_name,
"create_account":create_account,
"list" : arr3
}
day_three=data3;
}
//前四天的数据
if( $( "#mcRepmentTable3 tr").find( "td:eq(6)")){
$( "#mcRepmentTable3 tr").find( "td:eq(6)").find( ":checkbox:checked").each( function(){
if($( "#mcRepmentTable3 tr").find( "td:eq(6)").find( ":checkbox:checked").prop( "checked")== true){
var good_id = $( this).attr( 'data_goodId');
arr4.push(good_id);
}
});
var date =$( "#mcRepmentTable3 tr").find( "td:eq(6)").find( "input[type=checkbox]").attr( 'data_time');
var data4 = {
"data" : date,
"create_name": create_name,
"create_account":create_account,
"list" : arr4
}
day_four=data4;
}

//前五天的数据
if( $( "#mcRepmentTable3 tr").find( "td:eq(7)")){
$( "#mcRepmentTable3 tr").find( "td:eq(7)").find( ":checkbox:checked").each( function(){
if($( "#mcRepmentTable3 tr").find( "td:eq(7)").find( ":checkbox:checked").prop( "checked")== true){
var good_id = $( this).attr( 'data_goodId');
arr5.push(good_id);
}
});
var date =$( "#mcRepmentTable3 tr").find( "td:eq(7)").find( "input[type=checkbox]").attr( 'data_time');
var data5 = {
"data" : date,
"create_name": create_name,
"create_account":create_account,
"list" : arr5
}
day_five=data5;
}

//前六天的数据
if( $( "#mcRepmentTable3 tr").find( "td:eq(8)")){
$( "#mcRepmentTable3 tr").find( "td:eq(8)").find( ":checkbox:checked").each( function(){
if($( "#mcRepmentTable3 tr").find( "td:eq(8)").find( ":checkbox:checked").prop( "checked")== true){
var good_id = $( this).attr( 'data_goodId');
arr6.push(good_id);
}
});
var date =$( "#mcRepmentTable3 tr").find( "td:eq(8)").find( "input[type=checkbox]").attr( 'data_time');
var data6 = {
"data" : date,
"create_name": create_name,
"create_account":create_account,
"list" : arr6
}
day_six=data6;
}


////前七天的数据
if( $( "#mcRepmentTable3 tr").find( "td:eq(9)")){
$( "#mcRepmentTable3 tr").find( "td:eq(9)").find( ":checkbox:checked").each( function(){
if($( "#mcRepmentTable3 tr").find( "td:eq(9)").find( ":checkbox:checked").prop( "checked")== true){
var good_id = $( this).attr( 'data_goodId');
arr7.push(good_id);
}
});
var date =$( "#mcRepmentTable3 tr").find( "td:eq(9)").find( "input[type=checkbox]").attr( 'data_time');
var data7 = {
"data" : date,
"create_name": create_name,
"create_account":create_account,
"list" : arr7
}
day_seven=data7;
}

//数据整合
var list = [];

if(day_news.list.length> 0){
list.push(day_news);
}
if(day_one.list.length> 0){
list.push(day_one);
}
if(day_two.list.length> 0){
list.push(day_two);
}
if(day_three.list.length> 0){
list.push(day_three);
}
if(day_four.list.length> 0){
list.push(day_four);
} if(day_five.list.length> 0){
list.push(day_five);
}
if(day_six.list.length> 0){
list.push(day_six);
}
if(day_seven.list.length> 0){
list.push(day_seven);
}
var list = {
"brandCode" : brandCode,
"brandName" : brandName,
"listvo" : list
}

猜你喜欢

转载自blog.csdn.net/zxmin1302/article/details/80437540
今日推荐