Files
Pichome/admin/scripts/admin.js
2022-05-02 22:31:35 +08:00

50 lines
1.6 KiB
JavaScript

/*
* @copyright QiaoQiaoShiDai Internet Technology(Shanghai)Co.,Ltd
* @license https://www.oaooa.com/licenses/
*
* @link https://www.oaooa.com
* @author zyx(zyx@oaooa.com)
*/
function checkAll(type, form, value, checkall, changestyle) {
var checkall = checkall ? checkall : 'chkall';
for(var i = 0; i < form.elements.length; i++) {
var e = form.elements[i];
if(type == 'option' && e.type == 'radio' && e.value == value && e.disabled != true) {
e.checked = true;
} else if(type == 'value' && e.type == 'checkbox' && e.getAttribute('chkvalue') == value) {
e.checked = form.elements[checkall].checked;
if(changestyle) {
multiupdate(e);
}
} else if(type == 'prefix' && e.name && e.name != checkall && (!value || (value && e.name.match(value)))) {
e.checked = form.elements[checkall].checked;
if(changestyle) {
if(e.parentNode && e.parentNode.tagName.toLowerCase() == 'li') {
e.parentNode.className = e.checked ? 'checked' : '';
}
if(e.parentNode.parentNode && e.parentNode.parentNode.tagName.toLowerCase() == 'div') {
e.parentNode.parentNode.className = e.checked ? 'item checked' : 'item';
}
}
}
}
}
function fixTree_organization(el){
el.find('.tree-heng1').each(function(){
var tr=jQuery(this).parent().parent().parent();
var dep=jQuery(this).parent().find('.tree-su').length;
tr.nextAll().each(function(){
var child_org=jQuery(this).find('.child-org');
var dep1=child_org.find('.tree-su').length;
if(dep1<=dep) return false;
else{
child_org.find('.tree-su').eq(dep).removeClass('tree-su');
}
});
});
}