<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <!--引用jquery-->
    <script type="text/javascript" src="/js/service.js"></script>
    <script type="text/javascript" src="/js/session.js"></script>
    <script type="text/javascript" src="/js/getService.js"></script>
    <script type="text/javascript" src="/js/service/method-get-service.js"></script>
    <script type="text/javascript" src="/lib/jquery-3.4.1.js"></script>
    <script type="text/javascript" src="/lib/jquery-3.4.1.min.js"></script>
    <script type="text/javascript" src="/lib/layer.js"></script>
    

    <script type="text/javascript">
        var srcwidth = 900;  //整个面板的宽
        var currRow = 0;  //当前操作的行

        var HtmlUtil = {
    /*1.用浏览器内部转换器实现html转码*/
    htmlEncode:function (html){
        //1.首先动态创建一个容器标签元素,如DIV
        var temp = document.createElement ("div");
        //2.然后将要转换的字符串设置为这个元素的innerText(ie支持)或者textContent(火狐,google支持)
        (temp.textContent != undefined ) ? (temp.textContent = html) : (temp.innerText = html);
        //3.最后返回这个元素的innerHTML,即得到经过HTML编码转换的字符串了
        var output = temp.innerHTML;
        temp = null;
        return output;
    },
    /*2.用浏览器内部转换器实现html解码*/
    htmlDecode:function (text){
        //1.首先动态创建一个容器标签元素,如DIV
        var temp = document.createElement("div");
        //2.然后将要转换的字符串设置为这个元素的innerHTML(ie,火狐,google都支持)
        temp.innerHTML = text;
        //3.最后返回这个元素的innerText(ie支持)或者textContent(火狐,google支持),即得到经过HTML解码的字符串了。
        var output = temp.innerText || temp.textContent;
        temp = null;
        return output;
    }
};

        $(function () {      
            // $("#showAll").hide();
            const hm = getService.methodGet("/fbsViewAll/fbsViewAll/list");
            if(hm == null){
                $("#showAll").hide();
            }else{
                var decodeHtml = HtmlUtil.htmlDecode(hm.allFile);
                decodeHtml = decodeURIComponent(decodeURI(decodeHtml));
                $("#showAll").html(decodeHtml);
            }

            $('#ggkb').bind("click",function(){
               
                // console.log(htmlencode(hm.allFile));
                // var txt;
                // if (confirm("确定要保存此页面吗?")) {
                //     txt = "您按了确定";
                // } else {
                //     txt = "您按了取消";
                // }

            });


            srcwidth = $(window).width();
            const nameAll = document.getElementsByName('testFileName');
            //绑定需要拖拽改变大小的元素对象 每行的第一列 暂时支持一行两列         
            // $.each(nameAll, function (i, n) {
            //     bindResize(n);          
            // })

            // bindResize(nameAll[0]);            
            // bindResize(document.getElementById('p10'));
            // bindResize(document.getElementById('p20'));
        });
        function bindResize(el) {
            
            var els = el.style,            
            x = y = 0;            
            $(el).mousedown(function (e) {
                currRow = el.id;
                x = e.clientX - el.offsetWidth,
                y = e.clientY - el.offsetHeight;                
                el.setCapture ? (                
                    el.setCapture(),                
                    el.onmousemove = function (ev) {
                        mouseMove(ev || event);
                    },
                    el.onmouseup = mouseUp
                ) : (                    
                    $(document).bind("mousemove", mouseMove).bind("mouseup", mouseUp)
                );                
                e.preventDefault();
            });


            //移动事件
            function mouseMove(e) {
                els.width = e.clientX - x + 'px',
                els.height = e.clientY - y + 'px';

                var cx = currRow.substr(1, 1);  //当前行
                var cy = currRow.substr(2, 1);   //当前列
                      
                
                var docCur = $("#p" + cx + cy);   //current row colum                
                docCur.css({ "width": ((parseInt(docCur.css("width").replace("px", ""))) > srcwidth ? srcwidth : (parseInt(docCur.css("width")))) });                
                var docCurCopy = docCur;

                var cya = parseInt(cy) + 1;   //当前列+1      
                var docNCol = $("#p" + cx + cya);   //next colum
                if (docNCol != null) {
                    docNCol.css({ "left": (parseInt(docCur.css("left").replace("px", ""))) + (parseInt(docCur.css("width").replace("px", ""))) });
                    docNCol.css({ "width": (srcwidth - (parseInt(docCur.css("width").replace("px", "")))) });
                    docNCol.css({ "top": (docCur.css("top")) });
                    docNCol.css({ "height": docCur.css("height") });
                }

                for (var i = 1; i < 4; i++) {
                    var cxa = parseInt(cx) + i;   //当前行+1                        
                    var docNRow = $("#p" + cxa + cy);   //next row
                    if (docNRow != null) {
                        docNRow.css({ "left": (parseInt(docCurCopy.css("left").replace("px", ""))) });
                        docNRow.css({ "top": (parseInt(docCurCopy.css("top").replace("px", ""))) + (parseInt(docCurCopy.css("height").replace("px", ""))) });

                        var docNCol = $("#p" + cxa + 1);   //next colum
                        if (docNCol != null) {
                            
                            docNCol.css({ "left": (parseInt(docNRow.css("left").replace("px", ""))) + (parseInt(docNRow.css("width").replace("px", ""))) });
                            docNCol.css({ "width": (srcwidth - (parseInt(docNRow.css("width").replace("px", "")))) });
                            docNCol.css({ "top": (docNRow.css("top")) });
                            docNCol.css({ "height": docNRow.css("height") });
                        }
                    }
                    docCurCopy = docNRow;
                }                
                $("#megshow").html("#p" + els.width + els.height);
            }
            //停止事件
            function mouseUp() {                
                el.releaseCapture ? (                
                    el.releaseCapture(),                
                    el.onmousemove = el.onmouseup = null
                ) : (                    
                    $(document).unbind("mousemove", mouseMove).unbind("mouseup", mouseUp)
                );
            }
        }



    </script>
    <style type="text/css">
        
        #p00 {  top: 100px; left: 200px;  background: #f1f1f1; margin-bottom: 10px;;float:left;
                text-align: center; line-height: 100px; border: 1px solid #CCC; cursor: se-resize; }
        #p10 { top: 400px; left: 100px;  background: #f1f1f1;  margin-bottom: 10px;float:left;
                text-align: center; line-height: 100px; border: 1px solid #CCC; cursor: se-resize; }
        #p20 { top: 400px; left: 100px;  background: #f1f1f1;  margin-bottom: 10px;float: left;;
                text-align: center; line-height: 100px; border: 1px solid #CCC; cursor: se-resize; }
    </style>
</head>
<body>
    
        <div id="showAll" style="height: 100%;width: 100%;">
        </div>
 
        <script src="/lib/echarts/echarts.min.js"></script>
        <script src="/lib/echarts/theme/macarons.js"></script>
        <script src="/lib/vue.min.js"></script>
        <script src="/js/service/produce-task.js"></script>

        <link href="/lib/bootstrap/bootstrap.min.css" rel="stylesheet" />
        <link href="/css/dashboard.css" rel="stylesheet" />

        <script type="text/javascript">
           
        </script>


</body>
</html>