$('#companytaskorderId_all').click(function(){
if($(this).is(":checked")){
$(".conpantClasscheckbox").attr("checked",true);
}else{
$(".conpantClasscheckbox").attr("checked",false);
}
if($(this).is(":checked")){
$(".conpantClasscheckbox").attr("checked",true);
}else{
$(".conpantClasscheckbox").attr("checked",false);
}
});
<!--总的checkbox-->
<input class="conpantClasscheckbox" id="companytaskorderId_all" type="checkbox" name="" value="all">
<!--子的checkbox-->
<input class="conpantClasscheckbox" type="checkbox" id="companytaskorderId_1" value="1" name="companytaskorderId">
<input class="conpantClasscheckbox" type="checkbox" id="companytaskorderId_2" value="2" name="companytaskorderId">