endorsement.js 3.47 KB
var path = "";
$(document).ready(function () {
    var location = window.document.location;
    path = location.protocol + "//" + location.host + "/OfficialDocument";
    $("#div-document-selecttype>div").click(checkboxType_selected);
    $("#doctype-selecttype>div").click(checkboxDocType_selected);
    $("#allselected").click(checkboxType_selected);
    //点击打开详情页面
    $("#datalist tbody tr").click(openDetails);
//    addEvent();
});
function addEvent() {
    $("#btnNewDispatch").click(newDispatch);
    $("#btnNewReceived").click(newReceivedWindow);
    $("#btnNewLetters").click(newLettersWindow);
}

//右侧复选操作
function checkboxType_selected(evt) {
    var checkbox = evt.currentTarget;
    if($(checkbox).attr("class") == "div-checkbox-selected") {
        $(checkbox).attr("class", "div-checkbox");
        $(checkbox).find("img").attr("src", global.contextPath+"/image/officedocument/32x32/menu-document-checkbox.png");

    }else {
    	if(checkbox.innerText == "全部"){
    		$("#doctype-selecttype>div").attr("class", "div-checkbox").find("img").attr("src", global.contextPath+"/image/officedocument/32x32/menu-document-checkbox.png");
    	}
        $(checkbox).attr("class", "div-checkbox-selected");
        $(checkbox).find("img").attr("src", global.contextPath+"/image/officedocument/32x32/menu-document-selected.png");
    }
}
//公文筛选复选操作
function checkboxDocType_selected(evt) {
    var checkbox = evt.currentTarget;
    if ($(checkbox).attr("class") == "div-checkbox-selected") {
//        if ($(".div-checkbox-selected").length <= 1) {
//            layer.msg("请至少选中一项");
//            return;
//        }
    	/*if ($("#doctype-selecttype .div-checkbox-selected").length <= 1) {
            layer.msg("请至少选中一项公文");
            return;
        }*/
        $(checkbox).attr("class", "div-checkbox");
        $(checkbox).find("img").attr("src", global.contextPath+"/image/officedocument/32x32/menu-document-checkbox.png");

    } else {
    	if(checkbox.innerText == "发文" ||checkbox.innerText == "收文" ||checkbox.innerText == "信件"||checkbox.innerText == "纪要"){
    		$("#allselected").attr("class", "div-checkbox").find("img").attr("src", global.contextPath+"/image/officedocument/32x32/menu-document-checkbox.png");
    	}
        $(checkbox).attr("class", "div-checkbox-selected");
        $(checkbox).find("img").attr("src", global.contextPath+"/image/officedocument/32x32/menu-document-selected.png");
    	if($("#doctype-selecttype .div-checkbox-selected").length == 4){
    		$("#doctype-selecttype>div").attr("class", "div-checkbox").find("img").attr("src", global.contextPath+"/image/officedocument/32x32/menu-document-checkbox.png");
    		$("#allselected").attr("class", "div-checkbox-selected").find("img").attr("src", global.contextPath+"/image/officedocument/32x32/menu-document-selected.png");
    	}
    }
}
//打开详情页面
function openDetails() {
    var type=$(this).find(".td-document-type span").html();
    if (type.indexOf("信件")>=0) {
        newLettersWindow();
    } else if (type.indexOf("收文") >= 0) {
        newReceivedWindow();
    } else if (type.indexOf("发文") >= 0) {
        newDispatch();
    }
}

//收文
function newReceivedWindow() {
    window.open(path + "/form/newCirculate.html");//newReceived.html");
}
//信件
function newLettersWindow() {
    window.open(path + "/form/newLetters.html");
}
//发文
function newDispatch() {
    window.open(path + "/form/newDispatch.html");
}