// 删除
function removes() {
    var rows = ruletreegrid.treegrid('getSelections');
    if (rows && rows.length == 1) {
        var showmsg = "";
        if (rows[0].pid == 0) {
            // 下面有子节点
            showmsg = "项目下面可能存在细则,是否也一起删除 ?";
        } else {
            showmsg = "是否删除此细则 ?";
        }
        parent.$.messager.confirm('提示', showmsg, function(r) {
            if (r) {
                $.ajax({
                    url : "assess/rule/ruleremoves/" + rows[0].id + ".do",
                    dataType : "json",
                    success : function(data) {
                        if (data && data.success) {
                            if (data.msg && data.msg != "")
                                parent.$.messager.alert('提示', data.msg);
                            else
                                parent.$.messager.alert('提示', "删除成功");
                            ruletreegrid.treegrid('remove', rows[0].id);
                            ruletreegrid.treegrid('reload', rows[0].pid);
                        } else {
                            parent.$.messager.alert('错误', data.msg);
                        }
                    }
                });
            }
        });
    } else {
        parent.$.messager.alert('提示', "请选择一条要删除的项目!");
    }
}

posted on 2016-08-30 16:30  王玉涛  阅读(4169)  评论(0编辑  收藏  举报