Authored by 马力

Merge branch 'hotfix_13965' into grey

@@ -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
@@ -643,11 +656,12 @@ $(document).on("click", ".btnsku", function () { @@ -643,11 +656,12 @@ $(document).on("click", ".btnsku", function () {
643 }) 656 })
644 }); 657 });
645 658
  659 +window._count1 = 0;
  660 +window._count2 = 0;
646 $(document).on("change", ".wqt_checkbox,.wqt_all", function () { 661 $(document).on("change", ".wqt_checkbox,.wqt_all", function () {
647 - var _count1 = 0,  
648 - _count2 = 0,  
649 - _isAdvance0 = 0, 662 + var _isAdvance0 = 0,
650 _isAdvance1 = 0; 663 _isAdvance1 = 0;
  664 +
651 $.each(g.selected, function (index, item) { 665 $.each(g.selected, function (index, item) {
652 /*添加兼容逻辑*/ 666 /*添加兼容逻辑*/
653 if (item.status == 8 || item.status == 3 || item.status == 2 || item.status == 0) { 667 if (item.status == 8 || item.status == 3 || item.status == 2 || item.status == 0) {
@@ -664,16 +678,17 @@ $(document).on("change", ".wqt_checkbox,.wqt_all", function () { @@ -664,16 +678,17 @@ $(document).on("change", ".wqt_checkbox,.wqt_all", function () {
664 678
665 }); 679 });
666 if (_isAdvance0 && _isAdvance1) { 680 if (_isAdvance0 && _isAdvance1) {
  681 + $('#onshelve').addClass('disabled');
  682 + $('#offshelve').addClass('disabled');
667 return; 683 return;
668 } 684 }
669 -  
670 - if (_count1 == g.selected.length) { 685 + if (_count1 > 0 ) {
671 $('#onshelve').removeClass('disabled'); 686 $('#onshelve').removeClass('disabled');
672 } else { 687 } else {
673 $('#onshelve').addClass('disabled'); 688 $('#onshelve').addClass('disabled');
674 } 689 }
675 690
676 - if (_count2 == g.selected.length) { 691 + if (_count2 > 0) {
677 $('#offshelve').removeClass('disabled'); 692 $('#offshelve').removeClass('disabled');
678 } else { 693 } else {
679 $('#offshelve').addClass('disabled'); 694 $('#offshelve').addClass('disabled');