<!--html代码-->
<div class="layui-form-item">
<label class="layui-form-label">业主承担费用</label>
<div class="layui-input-block">
<input type="checkbox" name="ownerCost" lay-skin="primary" id="owner_all" lay-filter="owner_all" title="全选" value="(1)-(10)">
<input type="checkbox" id="ownerCost2" name="ownerCost" lay-skin="primary" class="ownerCost" lay-filter="owner_one" title="水费" value="(1)">
<input type="checkbox" id="ownerCost3" name="ownerCost" lay-skin="primary" class="ownerCost" lay-filter="owner_one" title="电费" value="(2)">
<input type="checkbox" id="ownerCost4" name="ownerCost" lay-skin="primary" class="ownerCost" lay-filter="owner_one" title="有线电视费" value="(3)">
<input type="checkbox" id="ownerCost5" name="ownerCost" lay-skin="primary" class="ownerCost" lay-filter="owner_one" title="供暖费" value="(4)">
<input type="checkbox" id="ownerCost6" name="ownerCost" lay-skin="primary" class="ownerCost" lay-filter="owner_one" title="煤/燃气费" value="(5)">
<input type="checkbox" id="ownerCost7" name="ownerCost" lay-skin="primary" class="ownerCost" lay-filter="owner_one" title="物业管理费" value="(6)">
<input type="checkbox" id="ownerCost8" name="ownerCost" lay-skin="primary" class="ownerCost" lay-filter="owner_one" title="卫生费" value="(7)">
<input type="checkbox" id="ownerCost9" name="ownerCost" lay-skin="primary" class="ownerCost" lay-filter="owner_one" title="上网费" value="(8)">
<input type="checkbox" id="ownerCost10" name="ownerCost" lay-skin="primary" class="ownerCost" lay-filter="owner_one" title="因居住而发生的费用(含公共电费等)" value="(9)">
<input type="checkbox" id="ownerCost11" name="ownerCost" lay-skin="primary" class="ownerPublic" lay-filter="owner_public" title="公产房房费" value="(10)">
<input type="checkbox" id="ownerCost12" name="ownerCost" lay-skin="primary" class="ownerOther" lay-filter="owner_other" title="其他费用" value="(11)">
</div>
</div>
<!--js代码-->
//委托人费用全选
form.on('checkbox(owner_all)', function(data){
var a = data.elem.checked;
if(a == true){
$(".ownerCost").prop("checked", true);
form.render('checkbox');
}else{
$(".ownerCost").prop("checked", false);
form.render('checkbox');
}
});
//委托人费用有一个未选中全选取消选中
form.on('checkbox(owner_one)', function(data){
var item = $(".ownerCost");
for(var i=0;i<item.length;i++){
if(item[i].checked == false){
$("#owner_all").prop("checked", false);
form.render('checkbox');
}
}
});