<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ page isELIgnored="false" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String basePath = request.getContextPath();
%>
<!DOCTYPE html>
<html>
<head>
    <jsp:include page="../../../common/admin/head.jsp"></jsp:include>
    <meta charset="utf-8">
    <title>ECharts</title>
    <!-- 引入 echarts.js -->
    <script src="<%=basePath%>/resource/plugins/echarts/echarts.min.js"></script>
</head>
<body>
<jsp:include page="../../../common/admin/body_pre.jsp"></jsp:include>
<div class="row hidden-print">
    <div class="col-lg-12">
        <div class="ibox">
            <div class="ibox-title">
                <h2>共享资源图谱</h2>
                <ol class="breadcrumb">
                    <li>
                        <a href="javascript:void(0);" >资源图谱</a>
                    </li>
                    <li class="active">
                        <strong>共享资源图谱</strong>
                    </li>
                </ol>
            </div>
        </div>
    </div>
</div>

<jsp:include page="../../../common/admin/grid_pre.jsp"></jsp:include>
<button id="btnAdd" onclick="javascript:window.location.href='<%=basePath%>/admin/resourceShareImg/allImageList.htm'" type="button" class="btn btn-sm btn-primary btn-position"><i class="fa fa-bars" aria-hidden="true"></i></button>
<jsp:include page="../../../common/admin/grid_middle.jsp"></jsp:include>
<div id="divGrid">
    <div id="congtent" style="height: 600px"></div>
</div>
<jsp:include page="../../../common/admin/grid_post.jsp"></jsp:include>
<jsp:include page="../../../common/admin/body_post.jsp"></jsp:include>
<script type="text/javascript">
    var str = "" ;
    resourceImageAll(str) ;
    function searchImg() {
        resourceImageAll($("#resourceName").val()) ;
    }
    function resourceImageAll(str) {
        var dom = document.getElementById("congtent");
        var myChart = echarts.init(dom);
        // var app = {};
        option = null;
        myChart.showLoading();
        $.get('<%=basePath%>/admin/resourceShareImg/findAll.action',
            {resourceName:str},
            function (data) {
                myChart.hideLoading();

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

                            data: [data],

                            left: '2%',
                            right: '2%',
                            top: '8%',
                            bottom: '20%',


                            symbol: 'emptyCircle',

                            orient: 'vertical',

                            expandAndCollapse: false,

                            label: {
                                normal: {
                                    position: 'top',
                                    rotate: -90,
                                    verticalAlign: 'middle',
                                    align: 'right',
                                    fontSize: 9
                                }
                            },

                            leaves: {
                                label: {
                                    normal: {
                                        position: 'bottom',
                                        rotate: -90,
                                        verticalAlign: 'middle',
                                        align: 'left'
                                    }
                                }
                            },

                            animationDurationUpdate: 750
                        }
                    ]
                });
                myChart.on('click', function (params) {
                    if (params.name!='资源全景'){
                        if (params.value.indexOf('主题')!= -1) {
                            $.popBsPartial({
                                url: "<%=basePath%>/admin/resourceShareImg/theme.htm?theme=" + params.value,
                                size: WySharpSize.Middle
                            });
                        }
                        if (params.value.indexOf('资源')!= -1) {
                            $.popBsPartial({
                                url: "<%=basePath%>/admin/resourceShareImg/property.htm?resourceId=" + params.value,
                                size: WySharpSize.Middle
                            });
                        }
                    }
                });
            });
    }

</script>
</body>
</html>
