Browse Source

provider group info set add all select

ayHaru 4 years ago
parent
commit
74c7a443b1
1 changed files with 26 additions and 1 deletions
  1. 26 1
      admin/templates/default/provider.group.set.php

+ 26 - 1
admin/templates/default/provider.group.set.php

@@ -24,6 +24,9 @@
                 <th>
                 <a href="JavaScript:void(0);" class="btn" id="emptyBtn"><span>清空</span></a>
                 </th>
+                <th class="w50 align-center">
+                    全选
+                </th>
                 <?php foreach ($output['amounts'] as $amount){?>
                 <th class="w50 align-center"><?php echo $amount;?></th>
                 <?php }?>
@@ -34,9 +37,12 @@
                     <?php foreach ($output['providers'] as $provider){?>
                         <tr class="trFlex">
                             <td class="w180"><?php echo $provider['name'];?></td>
+                            <td class="w50 align-center">
+                                <input type="checkbox" class="w50 checkAll">
+                            </td>
                             <?php foreach ($output['amounts'] as $amount){?>
                             <td class="w50 align-center">
-                                <input type="checkbox" class="w50" name="info[]" style="vertical-align: middle;"
+                                <input type="checkbox" class="w50 input" name="info[]" style="vertical-align: middle;"
                                        value="<?php echo "{$_GET['quality']}-{$provider['provider_name']}-{$provider['card_type']}-{$amount}-{$provider['provider_id']}";?>"
                                        <?php if(in_array("{$_GET['quality']}-{$provider['provider_name']}-{$provider['card_type']}-{$amount}-{$provider['provider_id']}", $output['sel_data'])){ echo 'checked';}?>
                                 />
@@ -84,5 +90,24 @@
                 }
             })
         })
+        // 全选
+        $('.checkAll').click(function () {
+            let hang = $(this).parent().parent().prevAll().length + 1
+            if ($(this).is(':checked')) {
+                $('.input').each(function () {
+                    let inputH = $(this).parent().parent().prevAll().length + 1
+                    if (hang == inputH) {
+                        $(this).attr("checked",true)
+                    }
+                })
+            } else {
+                $('.input').each(function () {
+                    let inputH = $(this).parent().parent().prevAll().length + 1
+                    if (hang == inputH) {
+                        $(this).attr("checked",false)
+                    }
+                })
+            }
+        })
     });
 </script>