MapPreview.js 32.8 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737
layui.config({
    base: "/js/"
}).use(['form', 'I18nPage', 'vue', 'layer', 'utils', 'element', 'hhweb', 'jquery', 'table', 'mappreview/gooflow', 'mappreview/maplayout'], function () {
    var form = layui.form, element = layui.element,
        layer = layui.layer,
        $ = layui.jquery,
        hhweb = layui.hhweb,
        I18nPage = layui.I18nPage,
        table = layui.table;

    var index = layer.getFrameIndex(window.name); //获取窗口索引
    var id = $.getUrlParam("id");   //ID

    var Lang = I18nPage.GetLang();

    if (Lang == "cn") {
        $($("select[name='Edit_PointTurn']")[0][0]).text("否");
        $($("select[name='Edit_PointTurn']")[0][1]).text("是");

        $("input[name='IsDefault']").prop("lay-text", "是|否");
    }
    else {
        $($("select[name='Edit_PointTurn']")[0][0]).text("No");
        $($("select[name='Edit_PointTurn']")[0][1]).text("Yes");
        $("input[name='IsDefault']").prop("lay-text", "Yes|No");
    }
    form.render();

    var MessageContainer = {};
    I18nPage.GetI18nMessage({
        Type: "PM",
        Code: "MapPreview",
        Container: MessageContainer,
    });

    I18nPage.GetI18nText({
        Type: "LP",
        Code: "MapPreview",
    });

    var cols_arr = I18nPage.GetI18nTable(
        {
            TableNo: "map-MapPreview",
        }
    );

    var datajson = [];
    var areaHide = false;

    var pointNameValue = {};
    pointNameValue["运行点"] = "1";
    pointNameValue["避让点"] = "2";
    pointNameValue["充电点"] = "3";
    pointNameValue["停车点"] = "7";
    pointNameValue["走弧点"] = "13";
    pointNameValue["虚拟点"] = "14";
    pointNameValue["暂停点"] = "16";
    pointNameValue["电梯点"] = "18";
    pointNameValue["电梯等待点"] = "19";
    //运行区的运行点可旋转时为整体旋转点
    pointNameValue["整体旋转点"] = "12";
    //取放料区的运行点为站台点
    pointNameValue["站台点"] = "4";
    pointNameValue["对接点"] = "20";
    pointNameValue["对接等待点"] = "21";
    pointNameValue["托盘旋转点"] = "6";
    pointNameValue["电梯关门点"] = "17";

    var mainList = {
        Load: function () {
            table.render({
                elem: '#mainList'
                , data: datajson
                , even: true
                , page: true //开启分页
                , cols: cols_arr
                , id: 'mainList'
                , limit: 5
                , limits: [5, 10, 20, 50]
                , height: '250'
                , size: 'sm'
                , done: function (res) { }
            });

            table.on('row(mainList)', function (obj) {
                $('#' + obj.data.RegionId).fadeOut('slow', function () {
                    $(this).fadeIn('slow', function () {
                    });
                });
            });
        }
    };

    mainList.Load();

    var vm = new Vue({
        el: "#formEdit",
        data() {
            return {
                Id: '',
                forms: [],
                frmPreview: ''
            }
        }
    });

    /*=========流程设计(begin)======================*/
    var flowDesignPanel = $('#flowPanel').flowdesign({
        OpenNode: function (id, object, flag) {
            if (flag == undefined) {
                //双击进入的
                flag = false;
            }

            if (!areaHide && !flag) {
                if (object.setInfo == null || object.setInfo == undefined) {
                    return;
                }

                var pointupd = "";
                if ($("input[name=Region_Point1]").val() == "") {
                    pointupd = "Point1";
                }
                else if ($("input[name=Region_Point2]").val() == "") {
                    pointupd = "Point2";
                }
                else if ($("[name='Edit_PointDodge']").val() == 1 && $("input[name=Region_Point3]").val() == "") {
                    pointupd = "Point3";
                }

                if (pointupd !== "") {
                    $("input[name=Region_" + pointupd + "_Id]").val(object.id);
                    $("input[name=Region_" + pointupd + "]").val(object.setInfo.RFID);
                    $("input[name=Region_" + pointupd + "_XY]").val("(" + object.left + "," + object.top + ")");

                    $("input[name=Region_" + pointupd + "]").toggleClass("layui-bg-red");
                    $("input[name=Region_" + pointupd + "]").fadeOut('slow', function () {
                        $(this).fadeIn('slow', function () {
                            $("input[name=Region_" + pointupd + "]").toggleClass("layui-bg-red");
                        });
                    });
                }
                return;
            }

            $("#nodeForm input[name=Id]").val(object.id);
            $("#nodeForm input[name=Name]").val(object.name);
            $("#nodeForm input[name=Left]").val(object.left);
            $("#nodeForm input[name=Top]").val(object.top);

            $("#nodeForm input[name=X_Y]").val("(" + object.left + "," + object.top + ")");

            $("#nodeForm input[name=IsEnable]")[0].checked = true;

            SwitchPic("up", false);
            SwitchPic("down", false);
            SwitchPic("left", false);
            SwitchPic("right", false);
            EnablePic("up", false);
            EnablePic("down", false);
            EnablePic("left", false);
            EnablePic("right", false);

            $("#nodeForm input[name=txt_up]").val("");
            $("#nodeForm input[name=txt_down]").val("");
            $("#nodeForm input[name=txt_left]").val("");
            $("#nodeForm input[name=txt_right]").val("");

            $("#nodeForm input[name=RFID]").val("");
            $("#nodeForm input[name=PauseTime]").val("");
            $("#nodeForm input[name=ArcingLevel]").val("");
            $("#nodeForm select[name='Edit_PointType']").empty();

            //点所在区域
            var point_area = "";
            var areas = flowDesignPanel.exportData().areas;
            for (var i in areas) {
                if (areas[i].color !== "user_group") {
                    var json1 = {
                        Left: object.left,
                        Top: object.top,
                        Width: object.width,
                        Height: object.height,
                    };
                    var json2 = {
                        Left: areas[i].left,
                        Top: areas[i].top,
                        Width: areas[i].width,
                        Height: areas[i].height,
                    };
                    if (flowDesignPanel.CheckPut(json1, json2) == "in" || flowDesignPanel.CheckPut(json1, json2) == "equal") {
                        if (areas[i].color == "user_yunxingqu") {
                            point_area = areas[i].color;

                            $("#nodeForm select[name='Edit_PointType']").append('<option value="' + pointNameValue["运行点"] + '" selected="selected">' + MessageContainer["YXD"] + '</option>');
                            $("#nodeForm select[name='Edit_PointType']").append('<option value="' + pointNameValue["避让点"] + '">' + MessageContainer["BRD"] + '</option>');
                            $("#nodeForm select[name='Edit_PointType']").append('<option value="' + pointNameValue["充电点"] + '">' + MessageContainer["CDD"] + '</option>');
                            $("#nodeForm select[name='Edit_PointType']").append('<option value="' + pointNameValue["虚拟点"] + '">' + MessageContainer["XND"] + '</option>');
                            $("#nodeForm select[name='Edit_PointType']").append('<option value="' + pointNameValue["暂停点"] + '">' + MessageContainer["ZTD"] + '</option>');
                            $("#nodeForm select[name='Edit_PointType']").append('<option value="' + pointNameValue["电梯等待点"] + '">' + MessageContainer["DTDDD"] + '</option>');
                            $("#nodeForm select[name='Edit_PointType']").append('<option value="' + pointNameValue["对接等待点"] + '">' + MessageContainer["TSJDDD"] + '</option>');
                            $("#nodeForm select[name='Edit_PointType']").append('<option value="' + pointNameValue["托盘旋转点"] + '">' + MessageContainer["TPXZD"] + '</option>');
                            $("#nodeForm select[name='Edit_PointType']").append('<option value="' + pointNameValue["电梯关门点"] + '">' + MessageContainer["DTGMD"] + '</option>');
                            $("#nodeForm select[name='Edit_PointType']").append('<option value="' + pointNameValue["走弧点"] + '">' + MessageContainer["ZHD"] + '</option>');
                            $("#nodeForm select[name='Edit_PointType']").append('<option value="' + pointNameValue["整体旋转点"] + '">' + MessageContainer["XZD"] + '</option>');

                            $("[name='Edit_PointType']").val(pointNameValue["运行点"]);
                            form.render();
                            break;
                        }
                        else if (areas[i].color == "user_tingchequ") {
                            point_area = areas[i].color;

                            $("#nodeForm select[name='Edit_PointType']").append('<option value="' + pointNameValue["停车点"] + '" selected="selected">' + MessageContainer["TCD"] + '</option>');
                            $("[name='Edit_PointType']").val(pointNameValue["停车点"]);
                            form.render();
                            break;
                        }
                        else if (areas[i].color == "user_quliaoqu" || areas[i].color == "user_fangliaoqu") {
                            point_area = areas[i].color;

                            $("#nodeForm select[name='Edit_PointType']").append('<option value="' + pointNameValue["运行点"] + '" selected="selected">' + MessageContainer["YXD"] + '</option>');
                            $("[name='Edit_PointType']").val(pointNameValue["运行点"]);

                            form.render();
                            break;
                        }
                        else if (areas[i].color.indexOf("user_diantiqu") > -1) {
                            point_area = areas[i].color;

                            $("#nodeForm select[name='Edit_PointType']").append('<option value="' + pointNameValue["电梯点"] + '" selected="selected">' + MessageContainer["DTD"] + '</option>');
                            $("[name='Edit_PointType']").val(pointNameValue["电梯点"]);
                            $("#nodeForm select[name='Edit_PointType']")[0].disabled = true;
                            $("#nodeForm select[name='Edit_PointTurn']")[0].disabled = true;
                            form.render();
                            break;
                        }
                        else if (areas[i].color.indexOf("user_tishengjiqu") > -1) {
                            point_area = areas[i].color;

                            $("#nodeForm select[name='Edit_PointType']").append('<option value="' + pointNameValue["对接点"] + '" selected="selected">' + MessageContainer["TSJD"] + '</option>');
                            $("[name='Edit_PointType']").val(pointNameValue["对接点"]);
                            $("#nodeForm select[name='Edit_PointType']")[0].disabled = true;
                            $("#nodeForm select[name='Edit_PointTurn']")[0].disabled = true;
                            form.render();
                            break;
                        }
                    }
                }
            }
            $("[name='Edit_PointTurn']").val("0");

            var areas = flowDesignPanel.exportData().areas;
            for (var i in areas) {
                var _area = areas[i];
                if (_area.color.indexOf("user_rfid") > -1) {
                    if (_area.left == object.left && _area.top < object.top) {
                        EnablePic("up", true);
                    }
                    if (_area.left == object.left && _area.top > object.top) {
                        EnablePic("down", true);
                    }
                    if (_area.top == object.top && _area.left < object.left) {
                        EnablePic("left", true);
                    }
                    if (_area.top == object.top && _area.left > object.left) {
                        EnablePic("right", true);
                    }
                }
            }

            if (object.setInfo !== undefined) {
                if (object.setInfo.point_type !== undefined) {
                    $("[name='Edit_PointType']").val(object.setInfo.point_type);
                }

                if (object.setInfo.point_turn !== undefined) {
                    $("[name='Edit_PointTurn']").val(object.setInfo.point_turn);
                }

                //位置不能动,先设置方向选择可不可用,再设置当前的值
                SwitchPic("up", object.setInfo.chk_up);
                SwitchPic("down", object.setInfo.chk_down);
                SwitchPic("left", object.setInfo.chk_left);
                SwitchPic("right", object.setInfo.chk_right);

                form.render();

                $("#nodeForm input[name=IsEnable]")[0].checked = object.setInfo.IsEnable;

                $("#nodeForm input[name=txt_up]").val(object.setInfo.txt_up);
                $("#nodeForm input[name=txt_down]").val(object.setInfo.txt_down);
                $("#nodeForm input[name=txt_left]").val(object.setInfo.txt_left);
                $("#nodeForm input[name=txt_right]").val(object.setInfo.txt_right);

                $("#nodeForm input[name=RFID]").val(object.setInfo.RFID);
                $("#nodeForm input[name=PauseTime]").val(object.setInfo.PauseTime);
                $("#nodeForm input[name=ArcingLevel]").val(object.setInfo.ArcingLevel);
                
            }

            SwitchPointType($("[name='Edit_PointType']").val());

            layer.open({
                type: 1,
                area: ['395px', '570px'], //宽高
                maxmin: false, //开启最大化最小化按钮
                title: MessageContainer["RFIDSetting"],
                content: $('#nodeForm'),
                shadeClose: true,
                btn: [MessageContainer["CloseBtn"]],
                yes: function (index, layero) {
                    layer.close(index);
                },
                cancel: function (index) {
                    layer.close(index);
                }
            });
        },
        OpenArea: function (id, object) {
            $("#areaForm input[name=Id]").val(object.id);
            $("#areaForm input[name=Name]").val(object.name);
            $("#areaForm input[name=Left]").val(object.left);
            $("#areaForm input[name=Top]").val(object.top);
            $("#areaForm input[name=Width]").val(object.width);
            $("#areaForm input[name=Height]").val(object.height);
            $("#areaForm input[name=XY]").val("(" + object.left + "," + object.top + ")");

            var title = '';
            var height = '300px'

            $(".HeightPixUp").show();
            $(".HeightPixDown").show();
            $(".WidthPixUp").show();
            $(".WidthPixDown").show();
            $("#divCharge").hide();

            $("#areaForm input[name=hidChargeRFID]").val("");
            $("#areaForm input[name=hidChargeDirection]").val("");
            $("#areaForm input[name=hidChargeLength]").val("");
            $("#areaForm input[name=txt_up]").val("");
            $("#areaForm input[name=txt_down]").val("");
            $("#areaForm input[name=txt_left]").val("");
            $("#areaForm input[name=txt_right]").val("");

            if (object.color == "user_cangchuqu") {
                title = MessageContainer["CCQ"];
            }

            if (object.color == "user_shengchanxian") {
                title = MessageContainer["SCX"];
            }

            if (object.color == "user_yunxingqu") {
                title = MessageContainer["YXQ"];
            }

            if (object.color.indexOf("user_chongdianzhuang") > -1) {
                title = MessageContainer["CDZ"];
                height = '370px'

                $(".HeightPixUp").hide();
                $(".HeightPixDown").hide();
                $(".WidthPixUp").hide();
                $(".WidthPixDown").hide();

                var _upPoint, _downPoint, _leftPoint, _rightPoint;
                _upPoint = _downPoint = _leftPoint = _rightPoint = "";
                var areas = flowDesignPanel.exportData().areas;
                for (var i in areas) {
                    var _area = areas[i];
                    if (_area.color.indexOf("user_rfid") > -1) {
                        if (_area.left == object.left && _area.top == object.top - 30) {
                            if (_area.setInfo !== null && _area.setInfo !== undefined) {
                                if (_area.setInfo.point_type == pointNameValue["充电点"]) {
                                    _upPoint = _area.id;
                                }
                            }
                        }
                        if (_area.left == object.left && _area.top == object.top + 30) {
                            if (_area.setInfo !== null && _area.setInfo !== undefined) {
                                if (_area.setInfo.point_type == pointNameValue["充电点"]) {
                                    _downPoint = _area.id;
                                }
                            }
                        }
                        if (_area.top == object.top && _area.left == object.left - 30) {
                            if (_area.setInfo !== null && _area.setInfo !== undefined) {
                                if (_area.setInfo.point_type == pointNameValue["充电点"]) {
                                    _leftPoint = _area.id;
                                }
                            }

                        }
                        if (_area.top == object.top && _area.left == object.left + 30) {
                            if (_area.setInfo !== null && _area.setInfo !== undefined) {
                                if (_area.setInfo.point_type == pointNameValue["充电点"]) {
                                    _rightPoint = _area.id;
                                }
                            }
                        }
                    }
                }

                if (_upPoint == "") {
                    $("#DivRadioUp").html('<input type="radio" data-type="up" name="ChargeDirection"  value="' + _upPoint + '" title="' + MessageContainer["UP"] + '" disabled>');
                } else {
                    $("#DivRadioUp").html('<input type="radio" data-type="up" name="ChargeDirection" lay-filter="ChargeDirection" value="' + _upPoint + '" title="' + MessageContainer["UP"] + '">');
                }

                if (_downPoint == "") {
                    $("#DivRadioDown").html('<input type="radio" data-type="down" name="ChargeDirection" value="' + _downPoint + '" title="' + MessageContainer["DOWN"] + '" disabled>');
                } else {
                    $("#DivRadioDown").html('<input type="radio" data-type="down" name="ChargeDirection" lay-filter="ChargeDirection" value="' + _downPoint + '" title="' + MessageContainer["DOWN"] + '">');
                }

                if (_leftPoint == "") {
                    $("#DivRadioLeft").html('<input type="radio" data-type="left" name="ChargeDirection" value="' + _leftPoint + '" title="' + MessageContainer["LEFT"] + '" disabled>');
                } else {
                    $("#DivRadioLeft").html('<input type="radio" data-type="left" name="ChargeDirection" lay-filter="ChargeDirection" value="' + _leftPoint + '" title="' + MessageContainer["LEFT"] + '">');
                }

                if (_rightPoint == "") {
                    $("#DivRadioRight").html('<input type="radio" data-type="right" name="ChargeDirection" value="' + _rightPoint + '" title="' + MessageContainer["RIGHT"] + '" disabled>');
                } else {
                    $("#DivRadioRight").html('<input type="radio" data-type="right" name="ChargeDirection" lay-filter="ChargeDirection" value="' + _rightPoint + '" title="' + MessageContainer["RIGHT"] + '">');
                }
                form.render();

                if (object.setInfo !== null && object.setInfo !== undefined) {
                    $("#areaForm input[name=hidChargeRFID]").val(object.setInfo.ChargeRFID);
                    $("#areaForm input[name=hidChargeDirection]").val(object.setInfo.ChargeDirection);
                    $("#areaForm input[name=hidChargeLength]").val(object.setInfo.ChargeLength);

                    $("#areaForm input[name=txt_up]").val(object.setInfo.txt_up);
                    $("#areaForm input[name=txt_down]").val(object.setInfo.txt_down);
                    $("#areaForm input[name=txt_left]").val(object.setInfo.txt_left);
                    $("#areaForm input[name=txt_right]").val(object.setInfo.txt_right);

                    var ChargeDirection = $("#areaForm input[name=hidChargeDirection]").val();

                    if (ChargeDirection == "up") {
                        $(":radio[name='ChargeDirection'][value='" + _upPoint + "']").prop("checked", "checked");
                    }
                    else if (ChargeDirection == "down") {
                        $(":radio[name='ChargeDirection'][value='" + _downPoint + "']").prop("checked", "checked");
                    }
                    else if (ChargeDirection == "left") {
                        $(":radio[name='ChargeDirection'][value='" + _leftPoint + "']").prop("checked", "checked");
                    }
                    else if (ChargeDirection == "right") {
                        $(":radio[name='ChargeDirection'][value='" + _rightPoint + "']").prop("checked", "checked");
                    }
                    form.render();
                }

                $("#divCharge").show();
            }

            if (object.color == "user_tingchequ") {
                title = MessageContainer["TCQ"];
            }

            if (object.color == "user_fangliaoqu") {
                title = MessageContainer["FLQ"];
            }

            if (object.color == "user_quliaoqu") {
                title = MessageContainer["QLQ"];
            }

            if (object.color.indexOf("user_diantiqu_") >= 0) {
                title = MessageContainer["DTQ"];
            }

            if (object.color.indexOf("user_tishengjiqu_") >= 0) {
                title = MessageContainer["TSJQ"];
            }

            layer.open({
                type: 1,
                area: ['395px', height],
                maxmin: false,
                title: MessageContainer["AreaSetting"].replace("{0}", title),
                content: $('#areaForm'),
                shadeClose: true,
                btn: [MessageContainer["CloseBtn"]],
                yes: function (index, layero) {
                    layer.close(index);
                },
                cancel: function (index) {
                    layer.close(index);
                }
            });
        },
        ShowNode: function (id, object) {
            this.OpenNode(id, object);
        },
        ShowArea: function (id, object) {
            if (!load) {
                return false;
            }
            this.OpenArea(id, object);
        },
    });
    /*=========流程设计(end)=====================*/
    $.getJSON('/map/Map/get?id=' + id,
        function (data) {
            var obj = data.Result;

            url = "/map/Map/Upd";
            vm.$set('$data', obj);

            $('input:checkbox[name="IsDefault"][value="' + obj.IsDefault + '"]').prop('checked', true);
            form.render();

            flowDesignPanel.loadData(JSON.parse(obj.MapContent));
            flowDesignPanel.setTitle(obj.Name);

            var Regions = JSON.parse(obj.MapContent).Regions;
            if (Regions.length > 0) {
                datajson = Regions;
                mainList.Load();
            }
            RefreshRFIDNum();
        });

    $('#btnApply').on('click', function () {
        if (vm.$data.Name == undefined || vm.$data.Name == "") {
            //不能用return false,用了会不跑layui的表单必填验证;
            return;
        }
        element.tabChange('mytab', '2');
    });

    element.on('tab(mytab)', function (data) {
        if (data.index == 0) {
            $("#tab2").attr("style", "pointer-events:none; color:#A0A0A0;");
        } else {
            $("#tab2").attr("style", "");
            flowDesignPanel.setTitle($("#formEdit input[name=Name]").val());
        }
    });

    flowDesignPanel.reinitSize($(window).width(), $(window).height() - 100);

    $(window).resize(function () {
        flowDesignPanel.reinitSize($(window).width(), $(window).height() - 100);
    });

    var scale = 1.0;
    $('.ico_big').on('click', function () {
        if (scale < 1.5) {
            scale += 0.1;
            scale = Math.round(scale * 10) / 10;
            flowDesignPanel.resetScale(scale);
            ResizeNode(scale);
        }
    });
    $('.ico_small').on('click', function () {
        if (scale > 0.5) {
            scale -= 0.1;
            scale = Math.round(scale * 10) / 10;
            flowDesignPanel.resetScale(scale);
            ResizeNode(scale);
        }
    });
    $('.ico_reset').on('click', function () {
        scale = 1.0;
        flowDesignPanel.resetScale(scale);
        ResizeNode(scale);
    });
    var switchFlag = false;
    $('.ico_switch').on('click', function () {
        switchFlag = !switchFlag;
        var areas = flowDesignPanel.exportData().areas;
        for (var i in areas) {
            var _area = areas[i];
            if (_area.color.indexOf("user_rfid") > -1) {
                if (switchFlag) {
                    $("#" + _area.id).hide();
                }
                else {
                    $("#" + _area.id).show();
                }
            }
        }
    });

    function RefreshRFIDNum() {
        var icon_yxd = 0, icon_xzd = 0, icon_xnd = 0, icon_ztd = 0;
        var areas = flowDesignPanel.exportData().areas;
        for (var i in areas) {
            var _area = areas[i];
            if (_area.color.indexOf("user_rfid") > -1) {
                if (_area.setInfo !== null && _area.setInfo !== undefined) {
                    if (_area.setInfo.point_turn == 1) {
                        icon_xzd++;
                    }
                    else {
                        if (_area.setInfo.point_type == pointNameValue["运行点"]) {
                            icon_yxd++;
                        }
                        else if (_area.setInfo.point_type == pointNameValue["虚拟点"]) {
                            icon_xnd++;
                        }
                        else if (_area.setInfo.point_type == pointNameValue["暂停点"]) {
                            icon_ztd++;
                        }
                    }
                }
            }
        }
        $("#icon_yxd").html(icon_yxd);
        $("#icon_xzd").html(icon_xzd);
        $("#icon_xnd").html(icon_xnd);
        $("#icon_ztd").html(icon_ztd);
    }

    function ResizeNode(scale) {
        $(".GooFlow_work .GooFlow_work_inner").css("background-image", "url('/images/map/bj/bj_" + Math.floor(30 * scale) + ".png')");
        $(".GooFlow_work").css("background-image", "url('/images/map/bj/bj_" + Math.floor(30 * scale) + ".png')");

        $(".GooFlow_area.area_user_cangchuqu .bg").css("background-image", "url('/images/map/qy/ccq/ccq_" + Math.floor(30 * scale) + ".png')");
        $(".GooFlow_area.area_user_zhangaiqu .bg").css("background-image", "url('/images/map/qy/zaq/zaq_" + Math.floor(30 * scale) + ".png')");
        $(".GooFlow_area.area_user_shengchanxian .bg").css("background-image", "url('/images/map/qy/xtq/xtq_" + Math.floor(30 * scale) + ".png')");
        $(".GooFlow_area.area_user_yunxingqu .bg").css("background-image", "url('/images/map/qy/yxq/yxq_" + Math.floor(30 * scale) + ".png')");
        $(".GooFlow_area.area_user_tingchequ .bg").css("background-image", "url('/images/map/qy/tcq/tcq_" + Math.floor(30 * scale) + ".png')");

        $(".GooFlow_area.area_user_diantiqu_xz .bg").css("background-image", "url('/images/map/qy/dtq_xz/dtq_xz_" + Math.floor(30 * scale) + ".png')");
        $(".GooFlow_area.area_user_diantiqu_yx .bg").css("background-image", "url('/images/map/qy/dtq_yx/dtq_yx_" + Math.floor(30 * scale) + ".png')");
        $(".GooFlow_area.area_user_diantiqu_gz .bg").css("background-image", "url('/images/map/qy/dtq_gz/dtq_gz_" + Math.floor(30 * scale) + ".png')");

        $(".GooFlow_area.area_user_tishengjiqu_xz .bg").css("background-image", "url('/images/map/qy/tsjq_xz/tsjq_xz_" + Math.floor(30 * scale) + ".png')");
        $(".GooFlow_area.area_user_tishengjiqu_yx .bg").css("background-image", "url('/images/map/qy/tsjq_yx/tsjq_yx_" + Math.floor(30 * scale) + ".png')");
        $(".GooFlow_area.area_user_tishengjiqu_gz .bg").css("background-image", "url('/images/map/qy/tsjq_gz/tsjq_gz_" + Math.floor(30 * scale) + ".png')");

        $(".GooFlow_area.area_user_fangliaoqu .bg").css("background-image", "url('/images/map/qy/flq/flq_" + Math.floor(30 * scale) + ".png')");
        $(".GooFlow_area.area_user_quliaoqu .bg").css("background-image", "url('/images/map/qy/qlq/qlq_" + Math.floor(30 * scale) + ".png')");

        $(".GooFlow_area.area_user_agv_ds .bg").css({ "width": Math.floor(30 * scale) + "px", "height": Math.floor(30 * scale) + "px" });
        $(".GooFlow_area.area_user_agv_fds .bg").css({ "width": Math.floor(30 * scale) + "px", "height": Math.floor(30 * scale) + "px" });
        $(".GooFlow_area.area_user_agv_gz .bg").css({ "width": Math.floor(30 * scale) + "px", "height": Math.floor(30 * scale) + "px" });
        $(".GooFlow_area.area_user_agv_lx .bg").css({ "width": Math.floor(30 * scale) + "px", "height": Math.floor(30 * scale) + "px" });
        $(".GooFlow_area.area_user_agv_cd .bg").css({ "width": Math.floor(30 * scale) + "px", "height": Math.floor(30 * scale) + "px" });
    }

    //让层自适应iframe
    layer.iframeAuto(index);

    $(document).ready(function () {
        var _move = false;//移动标记
        var _x, _y;//鼠标离控件左上角的相对位置

        $("#treeDiv1").click(function () {
            //alert("click");//点击(松开后触发)
        }).mousedown(function (e) {
            _move = true;
            _x = e.pageX - parseInt($("#treeDiv").css("left"));
            _y = e.pageY - parseInt($("#treeDiv").css("top"));
            //$("#treeDiv").fadeTo(20, 0.25);//点击后开始拖动并透明显示
        });
        $(document).mousemove(function (e) {
            if (_move) {
                var x = e.pageX - _x;//移动时根据鼠标位置计算控件左上角的绝对位置
                var y = e.pageY - _y;
                $("#treeDiv").css({ top: y, left: x });//控件新位置
            }
        }).mouseup(function () {
            _move = false;
            //$("#treeDiv").fadeTo("fast", 1);//松开鼠标后停止移动并恢复成不透明
        });
    });

    $('.SwitchRegion').on('click', function () {
        $("#SwitchRegion").toggle();
        areaHide = !areaHide;
        if (areaHide) {
            $("#treeDiv").height(30);
        }
        else {
            $("#treeDiv").height(350);
        }
    });

    function SwitchPointType(type) {
        //运行点
        if (type == pointNameValue["运行点"]) {
        }
        else {
            $("#nodeForm select[name='Edit_PointTurn']").val(0);
        }
        //暂停点
        if (type == pointNameValue["暂停点"]) {
            $("#nodeForm input[name='PauseTime']")[0].placeholder = MessageContainer["InputInfo"];
        }
        else {
            $("#nodeForm input[name='PauseTime']")[0].placeholder = "";
        }
        form.render();
    }

    function SwitchPic(direct, flag) {
        if (flag == undefined) {
            if ($('#hid' + direct).val() == 0) {
                $('#hid' + direct).val(1);
                $('#div' + direct).css("background-image", "url('/images/map/direct/" + direct + "1.png')");
            }
            else {
                $('#hid' + direct).val(0);
                $('#div' + direct).css("background-image", "url('/images/map/direct/" + direct + "0.png')");
                $("#nodeForm input[name=txt_" + direct + "]").val("");
            }
        }
        else {
            if (flag) {
                $('#hid' + direct).val(1);
                $('#div' + direct).css("background-image", "url('/images/map/direct/" + direct + "1.png')");
            }
            else {
                $('#hid' + direct).val(0);
                $('#div' + direct).css("background-image", "url('/images/map/direct/" + direct + "0.png')");
            }
        }
    }

    function EnablePic(direct, flag) {
        if (flag) {
            $('#div' + direct).css("pointer-events", "unset");
            $('#div' + direct).css("background-image", "url('/images/map/direct/" + direct + "0.png')");
        }
        else {
            $('#div' + direct).css("pointer-events", "none");
            $('#div' + direct).css("background-image", "url('/images/map/direct/" + direct + "2.png')");
        }
    }
})