Authored by ZhongW

分页多选bug

@@ -438,7 +438,7 @@ grid.prototype = { @@ -438,7 +438,7 @@ grid.prototype = {
438 g.selected.push(g.rows[index]); 438 g.selected.push(g.rows[index]);
439 }else{ 439 }else{
440 /**************业务控制 特殊情况**************/ 440 /**************业务控制 特殊情况**************/
441 - if(window.batchOperateShelve){ 441 + if(window.batchOperateShelve && $.inArray(g.rows[index]['productSkn'], window.batchOperateShelve) != -1 ){
442 window.batchOperateShelve.splice($.inArray(g.rows[index]['productSkn'],window.batchOperateShelve),1); 442 window.batchOperateShelve.splice($.inArray(g.rows[index]['productSkn'],window.batchOperateShelve),1);
443 } 443 }
444 /********************************************/ 444 /********************************************/
@@ -84,6 +84,7 @@ var t = new common.tab2({ @@ -84,6 +84,7 @@ var t = new common.tab2({
84 sortFlag = 1; 84 sortFlag = 1;
85 } 85 }
86 batchOperateShelve = []; 86 batchOperateShelve = [];
  87 + pageSkn = [];
87 g.init("/goods/netsale/getList"); 88 g.init("/goods/netsale/getList");
88 }, 89 },
89 columns: [{ 90 columns: [{
@@ -109,6 +110,7 @@ var t = new common.tab2({ @@ -109,6 +110,7 @@ var t = new common.tab2({
109 }] 110 }]
110 }).init(ENUM.tab); 111 }).init(ENUM.tab);
111 112
  113 +var pageSkn = [];
112 var g = new common.grid({ 114 var g = new common.grid({
113 el: "#basicTable", 115 el: "#basicTable",
114 usepagesize:true, 116 usepagesize:true,
@@ -342,7 +344,18 @@ var g = new common.grid({ @@ -342,7 +344,18 @@ var g = new common.grid({
342 HtmArr.push('<a href="javascript:;" class="btn btn-success btn-xs brandSort-btn" data-index="' + item.__index + '" >品牌排序</a>'); 344 HtmArr.push('<a href="javascript:;" class="btn btn-success btn-xs brandSort-btn" data-index="' + item.__index + '" >品牌排序</a>');
343 return HtmArr.join(''); 345 return HtmArr.join('');
344 } 346 }
345 - }] 347 + }],
  348 + complete:function(){
  349 + //渲染表头是否勾选
  350 + $.each(pageSkn, function (i, pageItem) {
  351 + if($.inArray(pageItem, batchOperateShelve) == -1 ) {
  352 + return false;
  353 + }
  354 + $(".wqt_all").prop("checked", true);
  355 + });
  356 +
  357 + pageSkn = [];
  358 + }
346 }); 359 });
347 g.init("/goods/netsale/getList"); 360 g.init("/goods/netsale/getList");
348 361
@@ -642,11 +655,12 @@ $(document).on("click", ".btnsku", function () { @@ -642,11 +655,12 @@ $(document).on("click", ".btnsku", function () {
642 }) 655 })
643 }); 656 });
644 657
  658 +window._count1 = 0;
  659 +window._count2 = 0;
645 $(document).on("change", ".wqt_checkbox,.wqt_all", function () { 660 $(document).on("change", ".wqt_checkbox,.wqt_all", function () {
646 - var _count1 = 0,  
647 - _count2 = 0,  
648 - _isAdvance0 = 0, 661 + var _isAdvance0 = 0,
649 _isAdvance1 = 0; 662 _isAdvance1 = 0;
  663 +
650 $.each(g.selected, function (index, item) { 664 $.each(g.selected, function (index, item) {
651 /*添加兼容逻辑*/ 665 /*添加兼容逻辑*/
652 if (item.status == 8 || item.status == 3 || item.status == 2 || item.status == 0) { 666 if (item.status == 8 || item.status == 3 || item.status == 2 || item.status == 0) {
@@ -663,16 +677,17 @@ $(document).on("change", ".wqt_checkbox,.wqt_all", function () { @@ -663,16 +677,17 @@ $(document).on("change", ".wqt_checkbox,.wqt_all", function () {
663 677
664 }); 678 });
665 if (_isAdvance0 && _isAdvance1) { 679 if (_isAdvance0 && _isAdvance1) {
  680 + $('#onshelve').addClass('disabled');
  681 + $('#offshelve').addClass('disabled');
666 return; 682 return;
667 } 683 }
668 -  
669 - if (_count1 == g.selected.length) { 684 + if (_count1 > 0 ) {
670 $('#onshelve').removeClass('disabled'); 685 $('#onshelve').removeClass('disabled');
671 } else { 686 } else {
672 $('#onshelve').addClass('disabled'); 687 $('#onshelve').addClass('disabled');
673 } 688 }
674 689
675 - if (_count2 == g.selected.length) { 690 + if (_count2 > 0) {
676 $('#offshelve').removeClass('disabled'); 691 $('#offshelve').removeClass('disabled');
677 } else { 692 } else {
678 $('#offshelve').addClass('disabled'); 693 $('#offshelve').addClass('disabled');