<%@ page import="com.lightinit.hsdataplatformresdir.dictionary.DicResourceCatelogType" %>
<%@ page import="com.lightinit.hsdataplatformresdir.dictionary.DicResourceState" %>
<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ page isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String basePath = request.getContextPath();
%>
<jsp:include page="../../../common/admin/modal_content_pre.jsp"><jsp:param name="modal_title" value="目录图谱"/></jsp:include>
<button id="btnImg" onclick="themeListHidden()" type="button" class="btn btn-sm btn-primary "><i class="fa fa-bars" aria-hidden="true"></i></button>
<button id="btnNoImg"  onclick="themeListShow()" type="button" class="btn btn-sm btn-primary "><i class="fa fa-bullseye" aria-hidden="true"></i></button>
<div id="main" style="width: 600px;height:550px;"></div>
<div id="divGridResourceList" hidden>

</div>
<input type="hidden" name="formSerializeResourceList"/>
<input type="hidden" id="pageNoResourceList" name="pageNo" value="1"/>
<input type="hidden" id="theme" value="${theme}">
<jsp:include page="../../../common/admin/modal_content_post.jsp"></jsp:include>
<jsp:include page="../../../common/admin/modal_footer_pre.jsp"></jsp:include>
<button type="button" class="btn btn-default" data-dismiss="modal"><i class="fa fa-close"></i>取消</button>
<jsp:include page="../../../common/admin/modal_footer_post.jsp"></jsp:include>
<script type="text/javascript">
    $("#btnNoImg").hide() ;

    var dom = document.getElementById("main");
    var myChart = echarts.init(dom);
    var app = {};
    option = null;
    myChart.showLoading();
    $.get('<%=basePath%>/admin/datacatelog_mgr/getDataById.action?id='+$("#theme").val(), function (data) {
        myChart.hideLoading();
        var result=data.data;
        var data = JSON.parse(result);
        echarts.util.each(data.children, function (datum, index) {
            index % 2 === 0 && (datum.collapsed = true);
        });

        myChart.setOption(option = {
            tooltip: {
                trigger: 'item',
                triggerOn: 'mousemove'
            },
            series: [
                {
                    type: 'tree',

                    data: [data],

                    top: '1%',
                    left: '7%',
                    bottom: '1%',
                    right: '20%',

                    symbolSize: 7,

                    label: {
                        normal: {
                            position: 'left',
                            verticalAlign: 'middle',
                            align: 'right',
                            fontSize: 9
                        }
                    },

                    leaves: {
                        label: {
                            normal: {
                                position: 'right',
                                verticalAlign: 'middle',
                                align: 'left'
                            }
                        }
                    },

                    expandAndCollapse: true,
                    animationDuration: 550,
                    animationDurationUpdate: 750
                }
            ]
        });
    });;
    if (option && typeof option === "object") {
        myChart.setOption(option, true);
    }
    function themeListHidden(){
        $("#main").hide() ;
        $("#divGridResourceList").show() ;
        $("#btnNoImg").show() ;
        $("#btnImg").hide() ;
    }

    function themeListShow(){
        $("#main").show() ;
        $("#divGridResourceList").hide() ;
        $("#btnNoImg").hide() ;
        $("#btnImg").show() ;
    }

    $("#divGridResourceList").renderPartial({url: "<%=basePath%>/admin/datacatelog_mgr/getlist.action?supplier="+$("#theme").val()});

    function searchResourceList() {
        var formSerialize = $("input[type='hidden'][name='formSerializeResourceList']").val();
        var pageNo = $("input[type='hidden'][id='pageNoResourceList']").val();
        var theme = $("#theme").val();
        var formData = formSerialize + "&pageNo=" + pageNo+"&supplier="+theme;
        $("#divGridResourceList").renderPartial({url: "<%=basePath%>/admin/datacatelog_mgr/getlist.action"
            , data: formData,onFinished: function(t){
                debugger;
            }
        });
    }
</script>