@model GBLab.Entities.T_SystemConfig
@{
    Layout = null;
}
<form method="post" action="/Manage/SystemConfig/Action_Edit_Add" class="pageForm required-validate" onsubmit="return validateCallback(this, dialogAjaxDone);" style="margin-top:4px;">
    <span id="SystemConfig_TypeId" style="display: none;">@Request.QueryString["F_TypeId"].ToString()</span>
    <div class="tabs" currentindex="0" eventtype="click">
        <div class="tabsHeader">
            <div class="tabsHeaderContent">
                <ul>
                    <li><a href="javascript:;"><span>基本信息</span></a></li>
                    <li style="display:none"><a href="javascript:;"><span>站点配置</span></a></li>
                    <li><a href="javascript:;"><span>百度地图</span></a></li>
                    <li><a href="javascript:;"><span>Seo信息</span></a></li>
                    <li><a href="javascript:;"><span>辅助信息</span></a></li>
                </ul>
            </div>
        </div>
        <div class="tabsContent" layoutH="78">
            <div>
                <div class="pageFormContent" style="padding: 5px; background-color: #eef4f5;border-style:none;" layoutH="88">
                    <dl class='nowrap' style="display: none;">
                        <dt>执行参数：</dt>
                        <dd>
                            <input type="text" name="Action" maxlength="20" alt="请输入执行参数" value='@Request.QueryString["Action"].ToString()' />
                        </dd>
                    </dl>

                    <dl class='nowrap' style="display: none;">
                        <dt>序号：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_Id", "序号", Model.F_Id == null ? "" : Model.F_Id.ToString(), "true", "", "1", "80", "", ""))
                        </dd>
                    </dl>
                    <dl class='nowrap' style="display: none;">
                        <dt>分类：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_TypeId", "分类", Model.F_TypeId == null ? "" : Model.F_TypeId.ToString(), "true", "", "1", "80", "", ""))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>网站名称：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_Name", "网站名称", Model.F_Name == null ? "" : Model.F_Name.ToString(), "false", "", "1", "80", "", ""))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>网站链接：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_SiteUrl", "网站链接", Model.F_SiteUrl == null ? "" : Model.F_SiteUrl.ToString(), "false", "", "1", "80", "", ""))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>网站LOGO：</dt>
                        <dd style='margin-bottom:15px;'>
                            @Html.Raw(Html.WebFile_Image("F_Logo", Model.F_Logo == null ? "" : Model.F_Logo.ToString(), "false"))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>联系人：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_AdminName", "联系人", Model.F_AdminName == null ? "" : Model.F_AdminName.ToString(), "false", "", "1", "80", "", ""))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>联系邮箱：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_AdminEmail", "联系邮箱", Model.F_AdminEmail == null ? "" : Model.F_AdminEmail.ToString(), "false", "", "1", "80", "", ""))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>联系电话：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_AdminPhone", "联系电话", Model.F_AdminPhone == null ? "" : Model.F_AdminPhone.ToString(), "false", "", "1", "80", "", ""))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>联系移动电话：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_ContactMobilePhone", "联系移动电话", Model.F_ContactMobilePhone == null ? "" : Model.F_ContactMobilePhone.ToString(), "false", "", "1", "80", "", ""))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>联系地址：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_MutiRow("F_Address", Model.F_Address == null ? "" : Model.F_Address.ToString(), "5", "100"))
                        </dd>
                    </dl>
                </div>
            </div>
            <div style="display:none">
                <div style="display:none" class="pageFormContent" style="padding: 5px; background-color: #eef4f5;border-style:none;" layoutH="88">
                    <dl class='nowrap'>
                        <dt>是否开启站点：</dt>
                        <dd>
                            @Html.DropDownListFor(model => model.F_IsOpenSite, ViewData["DroupInfo_TrueOrFalse"] as List<SelectListItem>, new { @class = "combox", })
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>是否记录系统日志：</dt>
                        <dd>
                            @Html.DropDownListFor(model => model.F_IsRecordSystemLog, ViewData["DroupInfo_TrueOrFalse"] as List<SelectListItem>, new { @class = "combox", })
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>站点统计代码：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_MutiRow("F_SiteCountCode", Model.F_SiteCountCode == null ? "" : Model.F_SiteCountCode.ToString(), "5", "100"))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>站点分享代码：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_MutiRow("F_SiteShareCode", Model.F_SiteShareCode == null ? "" : Model.F_SiteShareCode.ToString(), "5", "100"))
                        </dd>
                    </dl>
                </div>
            </div>
            <div>
                <div class="pageFormContent" style="background-color: #eef4f5;border-style:none;padding:0px;" layoutH="88">
                    <div id="Item_BaiduMap" style="width: 100%;height: 100%;margin: 0px;padding:0px;">
                    </div>
                    <dl class='nowrap' style="display:none;">
                        <dt>百度经度：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_BaiduJingDu", "百度经度", Model.F_BaiduJingDu == null ? "" : Model.F_BaiduJingDu.ToString(), "false", "", "1", "80", "", ""))
                        </dd>
                    </dl>
                    <dl class='nowrap' style="display:none;">
                        <dt>百度纬度：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_BaiduWeiDu", "百度纬度", Model.F_BaiduWeiDu == null ? "" : Model.F_BaiduWeiDu.ToString(), "false", "", "1", "80", "", ""))
                        </dd>
                    </dl>
                </div>
            </div>
            <div>
                <div class="pageFormContent" style="padding: 5px; background-color: #eef4f5;border-style:none;" layoutH="88">
                    <dl class='nowrap'>
                        <dt>Seo标题：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_Title", "Seo标题", Model.F_Title == null ? "" : Model.F_Title.ToString(), "false", "", "1", "80", "", ""))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>Seo关键字：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_MutiRow("F_KeyWord", Model.F_KeyWord == null ? "" : Model.F_KeyWord.ToString(), "5", "100"))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>Seo描述：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_MutiRow("F_Description", Model.F_Description == null ? "" : Model.F_Description.ToString(), "5", "100"))
                        </dd>
                    </dl>
                </div>
            </div>
            <div>
                <div class="pageFormContent" style="padding: 5px; background-color: #eef4f5;border-style:none;" layoutH="88">
                    <dl class='nowrap'>
                        <dt>更新日期：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Date("F_UpdateDate", Model.F_UpdateDate.ToString("yyyy-MM-dd HH:mm:ss"), "yyyy-MM-dd HH:mm:ss", "-30", "20", "true", "true"))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>更新人：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_UpdateUserId", "更新时间", Model.T_UpdateUser == null ? "" : Model.T_UpdateUser.F_Name, "true", "", "1", "80", "", "", "true", "true"))
                        </dd>
                    </dl>
                </div>
            </div>
        </div>
        <div class="tabsFooter">
            <div class="tabsFooterContent">
            </div>
        </div>
    </div>
    <div class="tabsFooter">
        <div class="tabsFooterContent">
            <div class="formBar" style="padding: 0;border-width: 1px;margin-top:3px;">
                <ul style="margin-top: 3px; margin-right: 3px;">
                    <li>
                        <div class="buttonActive">
                            <div class="buttonContent">
                                <button type="submit">
                                    提交
                                </button>
                            </div>
                        </div>
                    </li>
                    <li>
                        <div class="button">
                            <div class="buttonContent">
                                <button type="button" class="close">
                                    取消
                                </button>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</form>

<script type="text/javascript">
        var mapMid = new BMap.Map("Item_BaiduMap");
        $(function () {
            SetMapMid();
        });

        function SetMapMid() {
            var geoc = new BMap.Geocoder();
            var opts = {
                width: 240,     // 信息窗口宽度
                height: 120,     // 信息窗口高度
                enableMessage: false//设置允许信息窗发送短息
            }

            // 百度地图API功能
            if ($("#Item_F_BaiduJingDu").val()!= '') {
                var point = new BMap.Point(@Model.F_BaiduJingDu,@Model.F_BaiduWeiDu);
                mapMid.centerAndZoom(point, 14);

                var marker;
                var lastPoint = new BMap.Point(@Model.F_BaiduJingDu,@Model.F_BaiduWeiDu);
                marker = new BMap.Marker(lastPoint);

                mapMid.clearOverlays();

                var pt = point;
                marker = new BMap.Marker(pt);
                marker.addEventListener("click", function () {
                    var showStr = "经纬度值:<br>" + "经度:" + pt.lng + "<br/>纬度 :" + pt.lat + "<br/>";
                    var infoWindow = new BMap.InfoWindow(showStr, opts);
                    mapMid.openInfoWindow(infoWindow, pt);
                });

                mapMid.addOverlay(marker);
                geoc.getLocation(pt, function (rs) {
                    var addComp = rs.addressComponents;
                    var showStr = "<a href='#this' style='color:green;font-size:12pt;font-weight:bold;' onclick='Item_SystemConfig_BaiduMap(\"" + pt.lng + "\",\"" + pt.lat + "\")'>提交公司地址</a><br/><br/>"
                    showStr += "经纬度值:<br>" + "经度:" + pt.lng + "<br/>纬度 :" + pt.lat + "<br/>" + addComp.province + addComp.city + addComp.district + addComp.street + addComp.streetNumber;
                    var infoWindow = new BMap.InfoWindow(showStr, opts);
                    mapMid.openInfoWindow(infoWindow, pt);
                });
            } else {
                mapMid.centerAndZoom("厦门", 14);
            }
            var top_left_control = new BMap.ScaleControl({ anchor: BMAP_ANCHOR_TOP_LEFT }); // 左上角，添加比例尺
            var top_left_navigation = new BMap.NavigationControl();
            mapMid.addControl(top_left_control);
            mapMid.addControl(top_left_navigation);
            mapMid.addControl(new BMap.MapTypeControl());
            mapMid.enableScrollWheelZoom(true);
            mapMid.disableDoubleClickZoom();
            //map.addOverlay(new BMap.Marker(lastPoint));

            mapMid.addEventListener("dblclick", function (e) {
                var marker;
                var lastPoint = new BMap.Point(118.10, 24.50);
                marker = new BMap.Marker(lastPoint);

                mapMid.clearOverlays();

                var pt = e.point;
                marker = new BMap.Marker(pt);
                marker.addEventListener("click", function () {
                    var showStr = "经纬度值:<br>" + "经度:" + pt.lng + "<br/>纬度 :" + pt.lat + "<br/>";
                    var infoWindow = new BMap.InfoWindow(showStr, opts);
                    mapMid.openInfoWindow(infoWindow, pt);
                });
                mapMid.addOverlay(marker);
                geoc.getLocation(pt, function (rs) {
                    var addComp = rs.addressComponents;
                    var showStr = "<a href='#this' style='color:green;font-size:12pt;font-weight:bold;' onclick='Item_SystemConfig_BaiduMap(\"" + pt.lng + "\",\"" + pt.lat + "\")'>提交公司地址</a><br/><br/>"
                    showStr += "经纬度值:<br>" + "经度:" + pt.lng + "<br/>纬度 :" + pt.lat + "<br/>" + addComp.province + addComp.city + addComp.district + addComp.street + addComp.streetNumber;
                    var infoWindow = new BMap.InfoWindow(showStr, opts);
                    mapMid.openInfoWindow(infoWindow, pt);
                });
            });
            $("#Item_BaiduMap").css("overflow", "hidden")
        }

        function Item_SystemConfig_BaiduMap(jingdu, weidu) {
            alertMsg.confirm("确认此处为公司的地址吗？", {
                okCall: function () {
                    // 获取分类信息
                    $.ajax({
                        type: "Post",
                        url: "/Manage/SystemConfig/Action_Edit_UpdateBaiduMap",
                        data: "configId=" + $("#Item_F_Id").val() + "&jingdu=" + jingdu + "&weidu=" + weidu,
                        success: function (data) {
                            if (data.statusCode == 200) {
                                alertMsg.correct("更新成功!");
                            } else {
                                alertMsg.error("更新失败!");
                            }
                        }
                    });
                }
            });
        }
</script>