none
CRM中实现MapPoint地图搜索功能 RRS feed

  • 问题

  • 如题,我想在CRM中定义一个IFrame,然后在IFrame中实现MapPoint搜索功能,例如,我想搜索A,然后在地图上显示A周围5公里内与A有联系的B和C,如果将范围扩大到10公里,可能会看到D和E。将这个地图搜索显示功能加到CRM中。请问如何实现,有没有朋友做过这方面的工作,请多指教!
    2009年5月13日 17:11

答案

  • <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
        <head>
            <title></title>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
            <script type="text/jscript" src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6"></script>
    
            <script type="text/jscript" language=javascript>
                
                // Create the map
                function GetMap()
                {  
                    // Address1: Street 1
                    var address = "";
                    var addressLine1 = parent.document.forms[0].all.address1_line1.DataValue;
    
                    // Postal Code
                    var postalCode = "";
                    var lookupItem = new Array;
                    lookupItem = parent.document.forms[0].all.address1_postalcode.DataValue;       
                    if (lookupItem && lookupItem[0] != null)
                    {
                        postalCode = lookupItem[0].name ;
                    }
                    
                    // City
                    var city = parent.document.forms[0].all.address1_city.DataValue;
    
                    // Province/State
                    var stateOrProvince = "";
                    var provinceLookup = parent.document.forms[0].all.new_provinceid.DataValue;
                    if (provinceLookup[0] != null) {
                        stateOrProvince = provinceLookup[0].name;
                    }
                    
                    // Country
                    var country = parent.document.forms[0].all.new_countryid.DataValue;
    
                    // Compose customer address
                    if (addressLine1 != null)
                    {
                        address = address + addressLine1.replace(",", "") + ", ";
                    }
    
                    if (postalCode != null)
                    {
                        address = address + postalCode + " ";
                    }
    
                    if (city != null)
                    {
                        address = address + city + " ";
                    } 
    
                    if (stateOrProvince != null)
                    {
                        address = address + stateOrProvince + " ";
                    }
    
                    if (country != null)
                    {
                        address = address + country;
                    }
    
                    var Infotot="";
                    var companyname = parent.document.forms[0].all.name.DataValue;
                    if (companyname != null)
                    {
                        Infotot = companyname;
                    }
    
                    var myp = document.getElementById('pinfotot');
                    if (myp != null)
                    {
                        myp.innerHTML= '<b>' + Infotot + '</b>' + ' ' + address;
                        
                        map = new VEMap('myMap');
                        map.LoadMap(new VELatLong(44.407174685222856, 8.93439531326294), 10 ,'r' ,false);
                        map.Find(null,address,null,null,0,1,true,true,true,true,FindCallBack);
                    }
                }
    
                // Find the address
                function FindCallBack(shapeLayer, results, positions, moreResults, e)
                {
                    if(positions != null && positions.length > 0)
                    {
                        latlong = new VELatLong(positions[0].LatLong.Latitude,positions[0].LatLong.Longitude);
                        customerPushPin = new VEShape(VEShapeType.Pushpin,latlong);
                        
                        var companyname = parent.document.forms[0].all.name.DataValue;
                        if (companyname != null)
                        {
                            customerPushPin.SetTitle(companyname);
                        }
               
                        map.AddShape(customerPushPin);
                        map.SetCenterAndZoom(latlong,12);
                    }
                }
    
            </script>
        </head>
    
        <body onload="GetMap();">
            <p style="padding:0px; margin:0px;	font-size: 11px; font-family:      tahoma;" id="pinfotot"></p>
            <div id='myMap' style="position:relative; width:700px; height:400px; ">Loading map...</div>
        </body>
    </html>
    自己在ISV下面建个名字叫map.html的文件,将那些数据拷贝进去就差不多了。
    2009年5月18日 3:39

全部回复

  • 请教各位帮助

    2009年5月15日 7:02
  • <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
        <head>
            <title></title>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
            <script type="text/jscript" src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6"></script>
    
            <script type="text/jscript" language=javascript>
                
                // Create the map
                function GetMap()
                {  
                    // Address1: Street 1
                    var address = "";
                    var addressLine1 = parent.document.forms[0].all.address1_line1.DataValue;
    
                    // Postal Code
                    var postalCode = "";
                    var lookupItem = new Array;
                    lookupItem = parent.document.forms[0].all.address1_postalcode.DataValue;       
                    if (lookupItem && lookupItem[0] != null)
                    {
                        postalCode = lookupItem[0].name ;
                    }
                    
                    // City
                    var city = parent.document.forms[0].all.address1_city.DataValue;
    
                    // Province/State
                    var stateOrProvince = "";
                    var provinceLookup = parent.document.forms[0].all.new_provinceid.DataValue;
                    if (provinceLookup[0] != null) {
                        stateOrProvince = provinceLookup[0].name;
                    }
                    
                    // Country
                    var country = parent.document.forms[0].all.new_countryid.DataValue;
    
                    // Compose customer address
                    if (addressLine1 != null)
                    {
                        address = address + addressLine1.replace(",", "") + ", ";
                    }
    
                    if (postalCode != null)
                    {
                        address = address + postalCode + " ";
                    }
    
                    if (city != null)
                    {
                        address = address + city + " ";
                    } 
    
                    if (stateOrProvince != null)
                    {
                        address = address + stateOrProvince + " ";
                    }
    
                    if (country != null)
                    {
                        address = address + country;
                    }
    
                    var Infotot="";
                    var companyname = parent.document.forms[0].all.name.DataValue;
                    if (companyname != null)
                    {
                        Infotot = companyname;
                    }
    
                    var myp = document.getElementById('pinfotot');
                    if (myp != null)
                    {
                        myp.innerHTML= '<b>' + Infotot + '</b>' + ' ' + address;
                        
                        map = new VEMap('myMap');
                        map.LoadMap(new VELatLong(44.407174685222856, 8.93439531326294), 10 ,'r' ,false);
                        map.Find(null,address,null,null,0,1,true,true,true,true,FindCallBack);
                    }
                }
    
                // Find the address
                function FindCallBack(shapeLayer, results, positions, moreResults, e)
                {
                    if(positions != null && positions.length > 0)
                    {
                        latlong = new VELatLong(positions[0].LatLong.Latitude,positions[0].LatLong.Longitude);
                        customerPushPin = new VEShape(VEShapeType.Pushpin,latlong);
                        
                        var companyname = parent.document.forms[0].all.name.DataValue;
                        if (companyname != null)
                        {
                            customerPushPin.SetTitle(companyname);
                        }
               
                        map.AddShape(customerPushPin);
                        map.SetCenterAndZoom(latlong,12);
                    }
                }
    
            </script>
        </head>
    
        <body onload="GetMap();">
            <p style="padding:0px; margin:0px;	font-size: 11px; font-family:      tahoma;" id="pinfotot"></p>
            <div id='myMap' style="position:relative; width:700px; height:400px; ">Loading map...</div>
        </body>
    </html>
    自己在ISV下面建个名字叫map.html的文件,将那些数据拷贝进去就差不多了。
    2009年5月18日 3:39