This commit is contained in:
2024-03-26 15:56:31 +08:00
parent 634e8b71ab
commit 0855ae42cd
547 changed files with 94818 additions and 60463 deletions

View File

@ -10,7 +10,6 @@ var groupAssets = [[]];
var jobsiteAssets = [[]];
function updateAssets() {
assetDictionary = [[]];
groupAssets = [[]];
jobsiteAssets = [[]];
@ -95,7 +94,8 @@ if (typeof (AssetObject) != "function") {
bodyContentStyle: { top: null },
bodyContainerHeight: 0,
bodyContainerStyle: { height: null },
scrollTop: 0
scrollTop: 0,
HistoryTitle: GetTextByKey("P_MA_LOCATIONHISTORY", "Location History")
},
computed: {
bodyClientRowCount: function () {
@ -149,6 +149,11 @@ if (typeof (AssetObject) != "function") {
linkMachineClick: function (m) {
linkMachineClick(m);
this.refresh();
if (assetsummaryctr)
assetsummaryctr.status = 1;
$("#assetsummary").hide();
$("#assetsummarytrigle").hide();
},
locationHistoryClick: function (m, ev) {
if (selectedAsset)
@ -178,7 +183,7 @@ if (typeof (AssetObject) != "function") {
$("#assetsummarytrigle").css({ 'left': left + 1, 'top': $(ev.target).offset().top - 60 });
if (assetsummaryctr)
assetsummaryctr.status = 1;
assetsummaryctr = new $assetsummary($("#assetsummary"), m.CompanyID, m.ID, m.AlertTips, 0);
assetsummaryctr = new $assetsummary($("#assetsummary"), m.CompanyID || "", m.ID, m.ViewAlertTypes, m.AlertTips, 0);
},
assetSummaryMouseleave: function (m, ev) {
if (assetsummaryctr)
@ -228,7 +233,8 @@ if (typeof (AssetObject) != "function") {
bodyContentStyle: { top: null },
bodyContainerHeight: 0,
bodyContainerStyle: { height: null },
scrollTop: 0
scrollTop: 0,
HistoryTitle: GetTextByKey("P_MA_LOCATIONHISTORY", "Location History")
},
computed: {
bodyClientRowCount: function () {
@ -487,6 +493,36 @@ if (typeof (AssetObject) != "function") {
displayFilerIcon();
}
this.searchMachine1 = function (isauto) {
if (inSearchingMachine)
return;
inSearchingMachine = true;
$('#loadingDiv').show();
currentShownIndex = -1;
allMachineCheckBox.splice(0, allMachineCheckBox.length);//清空CheckBox数组
//this.getMachines(isauto);//getMachines放在loadMapAlertLayer加载完成后执行
if (allBasicAssetsObj && !BasicAssetsExpire) {
if (!IsDealer && MapViewSearchAssetsApiAddress != "")
this.loadMapAlertLayer1(isauto);
else //Dealer站点用旧方式
this.loadMapAlertLayer(isauto);
}
else {
if (!IsDealer && MapViewSearchAssetsApiAddress != "")
this.getAssetBasicInfos1(function () {
_this.loadMapAlertLayer1(isauto);
});
else//Dealer站点用旧方式
this.getAssetBasicInfos(function () {
_this.loadMapAlertLayer(isauto);
});
}
this.getCompanyLocations();
displayFilerIcon();
}
this.getAssetBasicInfos = function (next) {
if (inGettingAllBasicAssets)
@ -516,6 +552,76 @@ if (typeof (AssetObject) != "function") {
showMachineAlert();
});
}
this.getAssetBasicInfos1 = function (next) {
var mal = $("#selMapAlertLayer").val();
if (!mal) mal = "";
var item = {
'ViewID': mal,
'ContractorID': companyids,
'SearchText': htmlencode($("#txtMachineSearchText").val()),
'Onroad': $("#selOnroad").val(),
'Layers': parametervalues,
'ExcludeNoLocation': $("#exclude00Div").attr("state") != "0", //$("#chkExcludeNoLoc").prop("checked"),
'Attachment': $("#selAttachment").val()
};
_network.apipost(MapViewSearchAssetsApiAddress, companyid, item, function (data) {
inGettingAllBasicAssets = false;
if (data !== "0") {
data = convertAssetBasicObjs(data);
allBasicAssetsObj = new AllBasicAssetsObject();
allBasicAssetsObj.setAssets(data);
BasicAssetsExpire = false;
if (allBasicAssetsObj_Timeout)
clearTimeout(allBasicAssetsObj_Timeout)
allBasicAssetsObj_Timeout = setTimeout(function () {
BasicAssetsExpire = true;
}, 5 * 60 * 1000);
if (next)
next();
}
else {
showMachineAlert();
}
}, function (request, textStatus, errorThrown) {
inGettingAllBasicAssets = false;
showMachineAlert();
});
}
function convertAssetBasicObjs(data) {
if (typeof data === 'string')
data = data.split(String.fromCharCode(175));
if (data == '') return [];
var assets = [];
for (var i = 0; i < data.length; i++) {
var a = {};
var s = data[i];
var ss = s.split(String.fromCharCode(170));
a.Id = Number(ss[0]);
a.VIN = ss[1];
a.Name = ss[2];
a.MakeName = ss[3];
a.ModelName = ss[4];
a.TypeName = ss[5];
a.OnRoad = ss[6] == "1";
a.Attachment = ss[7] == "1";
if (ss[8])
a.AssetGroups = ss[8].split(',');
else
a.AssetGroups = ["-1"];
if (ss[9])
a.JobSites = ss[9].split(',');
else
a.JobSites = ["-1"];
assets.push(a);
}
return assets;
}
var notificationAssetQueue = [];
this.getAssetBasicInfoByAssets = function (aids) {
@ -591,8 +697,53 @@ if (typeof (AssetObject) != "function") {
$('#loadingDiv').hide();
});
}
this.getMachines1 = function (isauto) {
var mal = $("#selMapAlertLayer").val();
if (!mal) mal = "";
var item = {
'IsAutoRefresh': isauto,
'ViewID': mal,
'ContractorID': companyids,
'SearchText': htmlencode($("#txtMachineSearchText").val()),
'Onroad': Number($("#selOnroad").val()),
'Layers': parametervalues,
'ExcludeNoLocation': $("#exclude00Div").attr("state") != "0", //$("#chkExcludeNoLoc").prop("checked"),
'Attachment': Number($("#selAttachment").val())
};
_network.apipost(MapViewQueryViewAssetsApiAddress, companyid, item, function (data) {
if (data !== "0") {
mapHelper.clearMachine();
allAssets = convertAssetObjs(data);
updateAssets();
_this.getAssetGroups(item);//Asset取完再取group
jobsiteObject.searchJobSite(isauto);//Asset取完再取jobsite
showAssets();
if (isFirstLoad || $("#autoRecenterDiv").attr("state") == "1") {
isFirstLoad = false;
zoomMap();
}
getNowFormatDate();
}
else {
showMachineAlert();
}
inSearchingMachine = false;
$('#loadingDiv').hide();
}, function (request, textStatus, errorThrown) {
inSearchingMachine = false;
showMachineAlert();
$('#loadingDiv').hide();
});
}
function convertAssetObjs(data) {
if (typeof data === 'string')
data = data.split(String.fromCharCode(175));
if (data == '') return [];
var assets = [];
for (var i = 0; i < data.length; i++) {
var a = {};
@ -612,6 +763,7 @@ if (typeof (AssetObject) != "function") {
a.IconUrl = ss[3];
a.AlertTips = ss[4];
a.Priority = Number(ss[5]);
a.ViewAlertTypes = ss[6];
if (allBasicAssetsObj) {
var ta = allBasicAssetsObj.getAsset(a.ID);
@ -838,12 +990,12 @@ if (typeof (AssetObject) != "function") {
sel.dropdownVals(userParams.MapViewContratorID.split(","));
}
$("#contractorCtrl").css("display", "inline-flex");
$("#contentCtrl").css("top", 115 + 30);
}
else {
$("#btnToggleTimeline").show();
$("#btnImportShapeFile").show();
}
// $("#contentCtrl").css("top", $("#divleft1").height() + $("#divleft2").height());//移到splitIcon事件里面执行
}
@ -903,6 +1055,30 @@ if (typeof (AssetObject) != "function") {
$('#loadingDiv').hide();
});
}
this.loadMapAlertLayer1 = function (isauto) {
var sel = $("#selMapAlertLayer");
var selmal = sel.val();//记录已选择的值
if (!selmal) selmal = userParams.MapAlertLayer;
var p = companyids + ";" + selmal;
_network.mapviewquery("GetMapAlertLayers", p, function (data) {
if (data && data.length > 0) {
$("#mapAlertLayerDiv").show();
$("#splitIconRight").show();
$("#rightCtrl").show();
showMapAlertLayer(data);
}
else {
$("#mapAlertLayerDiv").hide();
$("#splitIconRight").hide();
$("#rightCtrl").hide();
}
_this.getMachines1(isauto);
}, function () {
$('#loadingDiv').hide();
});
}
var _websocket;
function openmsgwebsocket() {
@ -921,7 +1097,10 @@ if (typeof (AssetObject) != "function") {
}
}
openmsgwebsocket();
try {
openmsgwebsocket();
}
catch { }
}
}

View File

@ -3,7 +3,7 @@ var PopupViewShowing = false;
function machineDetailClick(m) {
if (m) {
showMachineDetail(m.CompanyID, m.ID, m.VIN);
showMachineDetail(m.CompanyID || "", m.ID, m.VIN);
clearLocationHistory();//关闭历史记录
$("#locationhistoryDiv").hide();

View File

@ -43,7 +43,8 @@ if (typeof (JobsiteObject) != "function") {
bodyContentStyle: { top: null },
bodyContainerHeight: 0,
bodyContainerStyle: { height: null },
scrollTop: 0
scrollTop: 0,
HistoryTitle: GetTextByKey("P_MA_LOCATIONHISTORY", "Location History")
},
computed: {
bodyClientRowCount: function () {

View File

@ -17,6 +17,36 @@ $(function () {
});
}());
function getMapAlertLayerLang(texts, defaulttext) {
if (!texts || texts.length == 0)
return defaulttext;
var fr_langs = ["fr-fr", "fr-ca"];
for (var i = 0; i < texts.length; i++) {
var t = texts[i];
if (_fleet.currentLang === t.Key) {
if (t.Value === "") {
if (fr_langs.indexOf(t.Key) >= 0) {//需先找父语种 fr 是否有值
for (var j = 0; j < texts.length; j++) {
if (texts[j].Key === "fr") {
if (texts[j].Value === "")
return defaulttext
else
return texts[j].Value;
}
}
}
else
return defaulttext;
}
else
return t.Value;
}
}
return defaulttext;
}
function showMapAlertLayer(data) {
var opt = $('<option></option>').val("").text("(None)");
var sel = $("#selMapAlertLayer");
@ -24,7 +54,7 @@ function showMapAlertLayer(data) {
sel.append(opt);
for (var i = 0; i < data.length; i++) {
var mal = data[i];
opt = $('<option></option>').val(mal.ID).text(mal.Name).data("mal", mal);
opt = $('<option></option>').val(mal.ID).text(getMapAlertLayerLang(mal.LocalNames, mal.Name)).data("mal", mal);
sel.append(opt);
}
if (userParams && userParams.MapAlertLayer) {
@ -51,13 +81,13 @@ function showMapAlertLayerDetail() {
td.append($("<img></img>").attr("src", layer.LegendUrl).css({ "width": 18, "vertical-align": "middle" }));
tr.append(td);
td = $("<td></td>").html(layer.Title).css({ "padding-left": 10, "width": 220 });
td = $("<td></td>").html(getMapAlertLayerLang(layer.LocalTitles, layer.Title)).css({ "padding-left": 10, "width": 220 });
tr.append(td);
}
}
var staticlegend = ["InMotion", "StoppedOn", "StoppedOff", "CGain", "CLoss", "RoadClosure", "LaneClosure"];
var staticlegendtitle = ["In Motion", "Stopped On", "Stopped Off", "Connectivity Recovery", "Connectivity Loss", "Road Closure", "Lane Closure"];
var staticlegend = ["InMotion", "StoppedOn", "StoppedOff", "CGain", "CLoss", "RoadClosure", "LaneClosure", "DriverInsights", "SeatBelt"];
var staticlegendtitle = [GetTextByKey("P_MA_INMOTION", "In Motion"), GetTextByKey("P_MA_STOPPEDON", "Stopped On"), GetTextByKey("P_MA_STOPPEDOFF", "Stopped Off"), GetTextByKey("P_MA_CONNECTIVITYRECOVERY", "Connectivity Recovery"), GetTextByKey("P_MA_CONNECTIVITYLOSS", "Connectivity Loss"), GetTextByKey("P_MA_ROADCLOSURE", "Road Closure"), GetTextByKey("P_MA_LANECLOSURE", "Lane Closure"), GetTextByKey("P_MA_DRIVERINSIGHTS", "Driver Insights"), GetTextByKey("P_MV_SEATBELTNOTDETECTED", "Seat Belt Not Detected")];
for (var i = 0; i < staticlegend.length; i++) {
var tr = $("<tr style='border-bottom: 1px solid lightgray;'></tr>");
tb.append(tr);
@ -71,13 +101,13 @@ function showMapAlertLayerDetail() {
tr.append(td);
}
var harshdrivinglegend = ["#ff3f48cc", "#ff00a8f3", "#fffff200", "#ffff7f27", "#ffec1c24"];
var harshdrivingtitle = ["Hard Acceleration", "Hard Brake", "Hard Turn", "Speeding: Low Severity", "Speeding: High Severity"];
var harshdrivinglegend = ["#ff3f48cc", "#ff00a8f3", "#ffff89e6", "#ffff7f27", "#ffec1c24"];
var harshdrivingtitle = [GetTextByKey("P_MA_HARDACCELERATION", "Hard Acceleration"), GetTextByKey("P_MA_HARDBRAKE", "Hard Brake"), GetTextByKey("P_MA_HARDTURN", "Hard Turn"), GetTextByKey("P_MA_SPEEDINGLOWSEVERITY", "Speeding: Low Severity"), GetTextByKey("P_MA_SPEEDINGHIGHSEVERITY", "Speeding: High Severity")];
for (var i = 0; i < harshdrivinglegend.length; i++) {
var tr = $("<tr style='border-bottom: 1px solid lightgray;'></tr>");
tb.append(tr);
var ironurl = userParams.MachineIconURL.toLowerCase().replace("machinetypeicon.ashx", "machinemovingicon.ashx");
var ironurl = userParams.MachineMovingIconURL;
var url = ironurl + "?tp=0&bkcolor=" + encodeURIComponent(harshdrivinglegend[i]) + "&heading=45";
var td = $("<td></td>").css("width", 30);
td.append($("<img></img>").attr("src", url).css({ "width": 18, "vertical-align": "middle" }));
@ -114,7 +144,15 @@ function getAlertLayerParameters() {
for (var l = 0; l < parameterinput.length; l++) {
var ipt = parameterinput[l];
var param = ipt.data("parameter");
if (ipt.data('commoninput'))
if (ipt.data('inputtype') == "dropdown") {
if (ipt.allselected())
param.ParameterValue = ALL_VALUE;
else if (param.IsField && param.MutipleSelect)
param.ParameterValue = ipt.dropdownVals().join(',');
else
param.ParameterValue = ipt.dropdownVal();
}
else
param.ParameterValue = ipt.val();
}
}
@ -146,7 +184,7 @@ function setAlertLayerParameters() {
var li = $("<li class='nav_item'></li>").data("layerid", layer.ID).click(layerHasParam++, layerclick);
var img = $("<img></img>").attr("src", layer.LegendUrl).css({ "width": 18, "vertical-align": "middle" });
var span = $("<span></span>").text(layer.Title).css({ "margin-left": 10, "vertical-align": "middle" });
var span = $("<span></span>").text(getMapAlertLayerLang(layer.LocalTitles, layer.Title)).css({ "margin-left": 10, "vertical-align": "middle" });
li.append(img).append(span);
ul.append(li);
var tb = $("<table class='tb_parameter'></table>").data("layerid", layer.ID);
@ -189,7 +227,7 @@ function createParameters(params, tb) {
var tr_param = $("<tr></tr>");
tb.append(tr_param);
tr_param.append($("<td></td>").addClass('td_paramtype').html(param.Caption));
tr_param.append($("<td></td>").addClass('td_paramtype').html(getMapAlertLayerLang(param.LocalCaptions, param.Caption)));
var td = $("<td></td>");
var ipt = createParameterInput(param);
@ -211,7 +249,7 @@ function createParameterInput(param) {
paramvalue = param.DefaultValue;
if (param.DisplayStyle == 0) {//inputbox
return $("<input type='text' />").val(paramvalue).data("parameter", param).data('commoninput', true)
return $("<input type='text' />").val(paramvalue).data("parameter", param)
.attr("paramcaption", param.Name.toLowerCase())
.keyup(function () {
$("[paramcaption='" + param.Name.toLowerCase() + "']").val($(this).val());
@ -220,149 +258,27 @@ function createParameterInput(param) {
});
}
else if (param.DisplayStyle == 1 || param.DisplayStyle == 2) {//Dropdown or Combobox
var defaultcheckall = false;
if (param.IsAllAllowed && paramvalue === ALL_VALUE)
defaultcheckall = true;
if (param.IsField && param.MutipleSelect) {//多选
var divcontrol = $('<div class="div_filter"></div>').data("parameter", param);
var seldiv = $('<div class="left dropdown"></div>');
var span = $('<span class="text_span"></span>');
var spanimg = $('<span class="fa dropdown_button">&#xf078;</span>');
var divpanel = $('<div class="div_panel" style="display: none;z-index:10;margin-left:-1px;position:fixed;"></div>');
var ul = $('<ul></ul>');
divpanel.append(ul).mousedown(FALSE);
seldiv.append(span).append(spanimg).append(divpanel);
seldiv.mousedown(function (e) {
$('.div_panel').each(function () {
var t = $(this);
if (!t.is(divpanel))
t.css('display', 'none');
});
var display = divpanel.css('display');
if (display == 'none') {
var t = $(e.target);
divpanel.css('top', seldiv.offset().top + seldiv.height());
if (seldiv.offset().top + seldiv.height() + divpanel.height() > $(document).height())
divpanel.css({ 'bottom': 0 });
else
divpanel.css({ 'bottom': 'unset' });
divpanel.css({ 'display': 'block' });
} else {
divpanel.css('display', 'none');
}
return false;
});
var itemclick = function (isall, checked) {
var chks = ul.find('input');
if (isall) {
chks.prop('checked', checked);
if (checked) {
span.attr('title', ALL_TEXT).text(ALL_TEXT);
param.ParameterValue = ALL_VALUE;
}
else {
span.attr('title', "").text("");
param.ParameterValue = "";
}
return;
}
else {
if (chkall)
chkall.prop('checked', false);//(ALL)取消选中
}
var texts = [];
var paramvalues = [];
for (var i = 0; i < chks.length; i++) {
var c = $(chks[i]);
if (c.prop('checked')) {
var text = c.next('label').text();
if (!text) text = c.val();
texts.push(text);
paramvalues.push(c.val());
}
}
texts = texts.join(', ');
span.attr('title', texts).text(texts);
paramvalues = paramvalues.join('^');
param.ParameterValue = paramvalues;
};
var chkall = undefined;
if (param.IsAllAllowed) {
var liall = $('<li></li>');
chkall = $('<input type="checkbox" id="chkall' + (++idindex) + '" style="width:16px;"/>');
if (defaultcheckall)
chkall.attr('checked', true);
chkall.change(function () {//全选
itemclick(true, $(this).prop('checked'));
});
liall.append(chkall);
liall.append($('<label for="chkall' + idindex + '"></label>').text(ALL_TEXT));
ul.append(liall);
}
var ds = getLookupDatasource(param.LookupDatasourceID)
if (ds && ds.Items) {
var paramvalueAry = paramvalue.split("^");
var texts = [];
for (var s = 0; s < ds.Items.length; s++) {
var item = ds.Items[s];
var txt = param.DisplayCaptionField ? item.Value : item.Key;
var li = $('<li></li>');
var chk = $('<input type="checkbox" style="width:16px;"/>').val(item.Key).attr("id", "chkp" + ++paramindex);
chk.change(function () {
itemclick(false, $(this).prop('checked'));
});
li.append(chk);
li.append($('<label for=' + ("chkp" + paramindex) + '></label>').text(txt));
ul.append(li);
if (defaultcheckall || paramvalueAry.indexOf(item.Key) > -1) {//选中默认值
chk.attr('checked', true);
var text = chk.next('label').text();
if (!text) text = chk.val();
texts.push(text);
}
}
if (defaultcheckall)
texts = ALL_TEXT;
else
texts = texts.join(', ');
span.attr('title', texts).text(texts);
param.ParameterValue = paramvalue;
}
divcontrol.append(seldiv);
return divcontrol;
}
else {
var sel = $("<select></select>").data("parameter", param).data('commoninput', true)
.attr("paramcaption", param.Name.toLowerCase())
.change(function () {
$("[paramcaption='" + param.Name.toLowerCase() + "']").val($(this).val());
});
var ds = getLookupDatasource(param.LookupDatasourceID)
if (ds && ds.Items) {
if (param.IsField && param.IsAllAllowed) {
var opall = $("<option></option>").val(ALL_VALUE).text(ALL_TEXT);
sel.append(opall);
}
for (var s = 0; s < ds.Items.length; s++) {
var item = ds.Items[s];
var opt = $("<option></option>").val(item.Key);
var txt = param.DisplayCaptionField ? item.Value : item.Key;
opt.text(txt);
sel.append(opt);
}
sel.val(paramvalue);
}
return sel;
var divcontrol = $('<div class="div_filter"></div>').data("parameter", param).data('inputtype', "dropdown");
var ds = getLookupDatasource(param.LookupDatasourceID);
var source = [...ds.Items];
if (param.IsAllAllowed && !(param.IsField && param.MutipleSelect))//单选加入all选项
source.splice(0, 0, { Key: ALL_VALUE, Value: ALL_TEXT });
divcontrol.css('width', 200).dropdown(source, {
search: true,
multiselect: param.IsField && param.MutipleSelect,
valueKey: 'Key',
allowselectall: param.IsAllAllowed,
textKey: param.DisplayCaptionField ? "Value" : "Key"
});
if (param.IsField && param.MutipleSelect) {
if (paramvalue == ALL_VALUE)
divcontrol.allselected(true);
else if (paramvalue)
divcontrol.dropdownVals(paramvalue.split(','));
}
else
divcontrol.dropdownVal(paramvalue);
return divcontrol;
}
}
@ -392,6 +308,7 @@ function getParameterValue(paramid, isCriteria) {
if (parametervalues && parametervalues.length > 0) {
for (var i = 0; i < parametervalues.length; i++) {
var layer = parametervalues[i];
if (!layer.Pivots) continue;
var params = [];
for (var j = 0; j < layer.Pivots.length; j++) {
if (layer.Pivots[j].IsCriteriaSQL == isCriteria)

View File

@ -31,6 +31,8 @@ if (typeof (MapObject) !== "function") {
ColorC = undefined;
ClusterLayerC = undefined;
ArcGISDynamicMapServiceLayerC = undefined;
WMSLayerC = undefined;
WMSLayerInfoC = undefined;
On = undefined;
Dom = undefined;
@ -66,21 +68,21 @@ if (typeof (MapObject) !== "function") {
if (userParams) {
if (userParams.BaseMap == "Imagery") {
basemap = "satellite";
$("#basemapImg").css("background-image", "url('https://js.arcgis.com/3.40/esri/images/basemap/satellite.jpg')");
$("#basemapImg").css("background-image", "url('https://js.arcgis.com/3.44/esri/images/basemap/satellite.jpg')");
$("#basemapTitle").text(GetTextByKey("P_MAP_IMAGERY", "Imagery"));
}
else if (userParams.BaseMap == "Streets") {
basemap = "streets";
$("#basemapImg").css("background-image", "url('https://js.arcgis.com/3.40/esri/images/basemap/streets.jpg')");
$("#basemapImg").css("background-image", "url('https://js.arcgis.com/3.44/esri/images/basemap/streets.jpg')");
$("#basemapTitle").text(GetTextByKey("P_MAP_STREETS", "Streets"));
}
else {
$("#basemapImg").css("background-image", "url('https://js.arcgis.com/3.40/esri/images/basemap/topo.jpg')");
$("#basemapImg").css("background-image", "url('https://js.arcgis.com/3.44/esri/images/basemap/topo.jpg')");
$("#basemapTitle").text(GetTextByKey("P_MAP_TOPOGRAPHIC", "Topographic"));
}
}
else {
$("#basemapImg").css("background-image", "url('https://js.arcgis.com/3.40/esri/images/basemap/topo.jpg')");
$("#basemapImg").css("background-image", "url('https://js.arcgis.com/3.44/esri/images/basemap/topo.jpg')");
$("#basemapTitle").text(GetTextByKey("P_MAP_TOPOGRAPHIC", "Topographic"));
}
mapObj.MyMap = new MapC(this.mapContainer, {
@ -159,7 +161,7 @@ if (typeof (MapObject) !== "function") {
url: "http://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer"
})],
title: GetTextByKey("P_MAP_IMAGERY", "Imagery"),
thumbnailUrl: "https://js.arcgis.com/3.40/esri/images/basemap/satellite.jpg"
thumbnailUrl: "https://js.arcgis.com/3.44/esri/images/basemap/satellite.jpg"
});
basemapGallery.add(satellitemap);
@ -168,7 +170,7 @@ if (typeof (MapObject) !== "function") {
url: "http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"
})],
title: GetTextByKey("P_MAP_TOPOGRAPHIC", "Topographic"),
thumbnailUrl: "https://js.arcgis.com/3.40/esri/images/basemap/topo.jpg"
thumbnailUrl: "https://js.arcgis.com/3.44/esri/images/basemap/topo.jpg"
});
basemapGallery.add(topomap);
@ -178,7 +180,7 @@ if (typeof (MapObject) !== "function") {
url: "http://server.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer"
})],
title: GetTextByKey("P_MAP_STREETS", "Streets"),
thumbnailUrl: "https://js.arcgis.com/3.40/esri/images/basemap/streets.jpg"
thumbnailUrl: "https://js.arcgis.com/3.44/esri/images/basemap/streets.jpg"
});
basemapGallery.add(streetmap);
@ -251,6 +253,8 @@ if (typeof (MapObject) !== "function") {
"esri/Color",
"extras1/clusterlayer",
"esri/layers/ArcGISDynamicMapServiceLayer",
"esri/layers/WMSLayer",
"esri/layers/WMSLayerInfo",
"esri/urlUtils",
"dojo/on",
"dojo/dom",
@ -284,6 +288,8 @@ if (typeof (MapObject) !== "function") {
Color,
ClusterLayer,
ArcGISDynamicMapServiceLayer,
WMSLayer,
WMSLayerInfo,
urlUtils,
on,
dom) {
@ -317,6 +323,8 @@ if (typeof (MapObject) !== "function") {
ColorC = Color;
ClusterLayerC = ClusterLayer;
ArcGISDynamicMapServiceLayerC = ArcGISDynamicMapServiceLayer;
WMSLayerC = WMSLayer;
WMSLayerInfoC = WMSLayerInfo;
On = on;
Dom = dom;
@ -369,8 +377,24 @@ if (typeof (MapObject) !== "function") {
this.showWeatherLayer = function (state) {
if (state) {
if (!this.WeatherLayer)
this.WeatherLayer = new ArcGISDynamicMapServiceLayerC("https://new.nowcoast.noaa.gov/arcgis/rest/services/nowcoast/radar_meteo_imagery_nexrad_time/MapServer");
if (!this.WeatherLayer) {
//this.WeatherLayer = new ArcGISDynamicMapServiceLayerC("https://new.nowcoast.noaa.gov/arcgis/rest/services/nowcoast/radar_meteo_imagery_nexrad_time/MapServer");
var layer1 = new WMSLayerInfoC({
name: 'base_reflectivity_mosaic',
title: 'Weahter'
});
var resourceInfo = {
extent: new ExtentC(-126.4, 31.0 - 109.7, 41.5, {
wkid: 4326
}),
layerInfos: [layer1]
};
this.WeatherLayer = new WMSLayerC("https://nowcoast.noaa.gov/geoserver/weather_radar/wms", {
resourceInfo: resourceInfo,
visibleLayers: ['base_reflectivity_mosaic']
});
}
this.WeatherLayer.refreshInterval = 5;
this.MyMap.addLayer(this.WeatherLayer);
}
@ -395,6 +419,7 @@ if (typeof (MapHelper) !== "function") {
this.unShownJobSiteIDs = [];//不需要显示的JobSiteID
var toolTipAssetSummary;
var toolTipJobsiteSummary;
var isHistoryTooltip = false;
function afterMapInitialized() {
var alwaysShow = false;
@ -420,6 +445,7 @@ if (typeof (MapHelper) !== "function") {
//delete window.currentRouteStopName;
} else {
alwaysShow = true;
isHistoryTooltip = false;
}
}
});
@ -435,11 +461,12 @@ if (typeof (MapHelper) !== "function") {
});
mapObj.BaseMapLayer.on("click", function (e) {
if (e.graphic) {
if (e.graphic && !e.graphic.isHistoryLine) {
mapObj.BaseMachineLayer.clearSingles();
e.graphic.getDojoShape().moveToFront();
showInfoWindow(e);
alwaysShow = true;
isHistoryTooltip = false;
}
});
@ -459,11 +486,16 @@ if (typeof (MapHelper) !== "function") {
});
mapObj.HisptoryPointLayer.on("click", function (e) {
if (e.graphic) {
if (e.graphic && !e.graphic.isCamSymbol) {
mapObj.MyMap.infoWindow.clearFeatures();
if (e.graphic.StartOrEndPoint)
e.graphic.StartOrEndPoint.getDojoShape().moveToFront();
if (e.graphic.CameraGraphic)
e.graphic.CameraGraphic.getDojoShape().moveToFront();
e.graphic.getDojoShape().moveToFront();
//showInfoWindow(e);
alwaysShow = true;
isHistoryTooltip = true;
mapObj.MyMap.infoWindow.setFeatures(locationHistoryPointGraphics);
var index = locationHistoryPointGraphics.indexOf(e.graphic);
@ -490,6 +522,7 @@ if (typeof (MapHelper) !== "function") {
mapObj.MyMap.infoWindow.clearFeatures();
e.graphic.getDojoShape().moveToFront();
alwaysShow = true;
isHistoryTooltip = false;
var singles = [];
for (var ii in machineGraphics) {
@ -502,6 +535,11 @@ if (typeof (MapHelper) !== "function") {
if (singles.length > 0) {
mapObj.MyMap.infoWindow.setFeatures(singles);
mapObj.MyMap.infoWindow.show(e.screenPoint, mapObj.MyMap.getInfoWindowAnchor(e.screenPoint));
var esripopop = $(".esriPopupWrapper");
$(".maximize").css("display", "none");
esripopop.find(".next").removeAttr("title");
esripopop.find(".prev").removeAttr("title");
esripopop.find(".close").removeAttr("title");
}
else//shape
showInfoWindow(e);
@ -546,7 +584,7 @@ if (typeof (MapHelper) !== "function") {
var assetInfos = null;
if (mapObj.MyMap.infoWindow.features && mapObj.MyMap.infoWindow.features.length > 0)
assetInfos = mapObj.MyMap.infoWindow.features.map(function (item) { return item.attributes });
toolTipAssetSummary = new $assetsummary("assetDetailCtrl", f.attributes.CompanyID, f.attributes.ID, f.attributes.AlertTip, 1, assetInfos);
toolTipAssetSummary = new $assetsummary("assetDetailCtrl", f.attributes.CompanyID || "", f.attributes.ID, f.attributes.ViewAlertTypes, f.attributes.AlertTip, 1, assetInfos);
var esripopop = $(".esriPopupWrapper");
esripopop.find(".tempdropdown").remove();
@ -675,6 +713,9 @@ if (typeof (MapHelper) !== "function") {
var esripopop = $(".esriPopupWrapper");
esripopop.find(".tempdropdown").remove();
esripopop.find(".title").unbind().removeClass("titlelink");
esripopop.find(".next").removeAttr("title");
esripopop.find(".prev").removeAttr("title");
esripopop.find(".close").removeAttr("title");
$(".esriPopupWrapper").find(".tempdropdown").remove();
if (enableInfoWindow && e.graphic && e.graphic.attributes) {
$(".maximize").css("display", "none");
@ -688,7 +729,7 @@ if (typeof (MapHelper) !== "function") {
mapObj.MyMap.infoWindow.setContent("<div id='assetDetailCtrl'></div>");
if (toolTipAssetSummary)
toolTipAssetSummary.status = 1;
toolTipAssetSummary = new $assetsummary("assetDetailCtrl", e.graphic.attributes.CompanyID, e.graphic.attributes.ID, e.graphic.attributes.AlertTip, 1);
toolTipAssetSummary = new $assetsummary("assetDetailCtrl", e.graphic.attributes.CompanyID || "", e.graphic.attributes.ID, e.graphic.attributes.ViewAlertTypes, e.graphic.attributes.AlertTip, 1);
} else {
var currentattrs = mapObj.MyMap.infoWindow.currentattributes;
if (!currentattrs || e.graphic.attributes.ID != currentattrs.ID) {
@ -735,6 +776,7 @@ if (typeof (MapHelper) !== "function") {
this.showAssetDetailInfo = function (assetdetail) {
var attrs = mapObj.MyMap.infoWindow.currentattributes;
if (attrs && attrs.Type === 0 && attrs.ID == assetdetail.ID) {
assetdetail.ViewAlertTypes = attrs.ViewAlertTypes;
assetdetail.AlertTip = attrs.AlertTip;
var popContent = getAssetPopupContent(assetdetail);
@ -755,8 +797,8 @@ if (typeof (MapHelper) !== "function") {
var ps = [];
var infowindowassetexist = false;//infowindow显示的机器是否在查询结果里
var infowindowassetid = -1;
if (toolTipAssetSummary)
toolTipAssetSummary.clearCache();
if (typeof clearAssetsummaryCache === "function")
clearAssetsummaryCache();
if (toolTipAssetSummary && toolTipAssetSummary.status == 0)
infowindowassetid = toolTipAssetSummary.assetid;
for (var i = 0; i < machines.length; i++) {
@ -764,8 +806,13 @@ if (typeof (MapHelper) !== "function") {
var p = this.createMachinePoint(machine);
ps.push(p);
shownMachines["MachineID" + machine.ID] = p;
if (infowindowassetid == machine.ID)
if (infowindowassetid == machine.ID) {
infowindowassetexist = true;
if (toolTipAssetSummary && toolTipAssetSummary.status == 0) {
toolTipAssetSummary.viewalerttypes = machine.ViewAlertTypes;
toolTipAssetSummary.alerttips = machine.AlertTips;
}
}
}
if (toolTipAssetSummary && toolTipAssetSummary.status == 0) {
if (infowindowassetexist) {
@ -789,7 +836,7 @@ if (typeof (MapHelper) !== "function") {
popContent += "<b>" + GetTextByKey("P_MV_TYPE_COLON", "Type:") + " </b>" + machine.AssetType + "<br/>";
var attributes = {
"Type": 0,//用于区分InfoWindow是否是Asset
"CompanyID": machine.CompanyID,
"CompanyID": machine.CompanyID || "",
"ID": machine.ID,
"Name": htmlencode(machine.Name),
"Name2": htmlencode(machine.Name2),
@ -802,7 +849,8 @@ if (typeof (MapHelper) !== "function") {
//"EngineHours": machine.EngineHours,
//"Odometer": machine.Odometer,
//"OdometerUOM": machine.OdometerUOM,
"AlertTip": htmlencode(machine.AlertTips),
"ViewAlertTypes": machine.ViewAlertTypes,
"AlertTip": machine.AlertTips,
"IconUrl": machine.IconUrl,
//"EmptyIconUrl": machine.IconUrl.replace(new RegExp("typeid=\\d+&", "i"), "typeid=-1&").replace(new RegExp("mid=\\d+&", "i"), ""),
"EmptyIconUrl": machine.IconUrl.replace("typeid", "typeid=-1&t").replace("mid", "m"),
@ -1061,20 +1109,27 @@ if (typeof (MapHelper) !== "function") {
var locationHistoryPolylines = [];
var locationLineGraphics = [];
var locationHistoryPointGraphics = [];
this.showLocationHistoryFromStart = function (m, locs, toindex, needCenter) {//从开始位置显示到指定索引的索引Location
this.clearLocationHistory();
var point;
this.showLocationHistoryFromStart = function (m, locs, toindex, needCenter, noClear, color, width) {//从开始位置显示到指定索引的索引Location
if (noClear) {
lastLocation = null;
} else {
this.clearLocationHistory();
}
for (var i = 0; i < locs.length && i <= toindex; i++) {
var loc = locs[i];
point = this.showLocationHistory(m, loc, false);
}
if (needCenter) {
mapObj.MyMap.centerAt(point);
var flag = null;
if (noClear) {
if (i == 0) {
flag = 0;
} else if (i == locs.length - 1 || i == toindex) {
flag = 1;
}
}
this.showLocationHistory(m, loc, (i == toindex) && needCenter, color, width, flag);
}
}
this.showLocationHistory = function (m, loc, needCenter) {
this.showLocationHistory = function (m, loc, needCenter, color, width, flag) {
var point = new PointC({
longitude: loc.Longitude,
latitude: loc.Latitude
@ -1093,24 +1148,38 @@ if (typeof (MapHelper) !== "function") {
polyLine.StartTime = lastLocation.LocationTime;
polyLine.EndTime = loc.LocationTime;
var lineGraphic = this.createLocationHistoryLineGraphic(polyLine);
var lineGraphic = this.createLocationHistoryLineGraphic(polyLine, color, width);
locationLineGraphics["l" + lastLocation.LogId] = lineGraphic;
lineGraphic.isHistoryLine = true;
mapObj.BaseMapLayer.add(lineGraphic);
}
else {
var level = mapObj.MyMap.getLevel();
if (level < 12)
if (level < 12) {
level = 12
mapObj.MyMap.setLevel(level);
mapObj.MyMap.setLevel(level);
}
}
var startOrEndPoint = null;
if (flag == 0) {
startOrEndPoint = this.createLocationHistorySymbolPoint(point, [34, 139, 34]);
} else if (flag == 1) {
startOrEndPoint = this.createLocationHistorySymbolPoint(point, [255, 0, 0]);
}
lastLocation = loc;
var gpoint = this.createLocationHistoryPoint(m, point);
gpoint.StartOrEndPoint = startOrEndPoint;
if (gpoint.StartOrEndPoint)
mapObj.HisptoryPointLayer.add(gpoint.StartOrEndPoint);
if (gpoint.CameraGraphic)
mapObj.HisptoryPointLayer.add(gpoint.CameraGraphic);
mapObj.HisptoryPointLayer.add(gpoint);
locationHistoryPointGraphics.push(gpoint);
if (needCenter)
mapObj.MyMap.centerAt(point);
if (needCenter) {
setTimeout(function () { mapObj.MyMap.centerAt(point) }, 100);
}
return point;
}
@ -1123,9 +1192,18 @@ if (typeof (MapHelper) !== "function") {
}
locationLineGraphics = [];
for (var i in locationHistoryPointGraphics) {
if (locationHistoryPointGraphics[i].StartOrEndPoint)
mapObj.HisptoryPointLayer.remove(locationHistoryPointGraphics[i].StartOrEndPoint);
if (locationHistoryPointGraphics[i].CameraGraphic)
mapObj.HisptoryPointLayer.remove(locationHistoryPointGraphics[i].CameraGraphic);
mapObj.HisptoryPointLayer.remove(locationHistoryPointGraphics[i]);
}
locationHistoryPointGraphics = [];
if (isHistoryTooltip) {
isHistoryTooltip = false;
mapObj.MyMap.infoWindow.hide();
}
}
var lastRouteLine;
@ -1363,10 +1441,87 @@ if (typeof (MapHelper) !== "function") {
mapObj.MyMap.setExtent(tempExtent, true);
}
this.createLocationHistoryPoint = function (m, point) {
var picSymbol = new PictureMarkerSymbolC(point.loc.IconURL, 14, 14);//url,width,height
this.createLocationHistorySymbolPoint = function (point, color) {
var symbol = new SimpleMarkerSymbolC({
color: [255, 255, 255],
size: 8,
style: 'esriSMSCircle',
outline: {
color: color,
width: 6,
style: 'esriSLSSolid'
}
});
// Location History 中构造设置不生效,原因未知
if (symbol.size == 0) {
symbol.setSize(8);
}
if (symbol.outline.width == 0) {
symbol.outline.setWidth(8);
}
var g = new GraphicC(point, symbol);
return g;
};
var popContent = "<b>" + GetTextByKey("P_MV_NAME_COLON", "Name:") + " </b>" + htmlencode(m.Name) + "<br/>";
var inMotionIcon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEySURBVDhPtVItT8RAEB1ZWbnmksrKSmQVGlmJrOw/2BWXQAIhCJIicRjkJeCKQ5w4WbmyAlGBKG6Z3c4c2+1eguElr5vOx5s3ycD/QkK+uduc41tQ5A+QkICCK+SENO2+NfYlPmNeUGUEdpKCnhvErTAW+UPuiwxYV1KHh3my9gpNvaudgHpXvoDluHaioA2KTKc7J9B/9os48ZU6EfN0tzOT7TOCNWZKyFjA7r5Isn1GZA0rcMECdZhk+8PX4N7oGhK/JFD6CbZ/GA4m2SZHsdUaEi5ZIPUT1v44jSa7z9x/ep0aPer1GosDU9Bxwk4sn8pFcfFYOEdeTFMnAc8Wg5O137w1fuGR1Uv1u8aJY6rEjfgOG33aAVjXUEcEs5OPsJF44oxjkHCGrJEK2cQbAX4AQa0yMfhNcXQAAAAASUVORK5CYII=";
var inMotionIcon_seatbelt = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAI9SURBVDhPvVQhjOJQEK1EInGLRCKRSOTKypVIJK4/gQTEJVtBsgiSIkhAXAKCZBEksEEgEBUnKhBsgkCc6CWIboKYnff5A21hb3PmXvJS/u/M+/NmfrH+OxzHyTPLMRbMq38DJ1aUUj6Tut0u9ft9/cSaGfD7JxP6d3BglhO8TqdDQRAQEPwO6O39jfyDr9fb7ZZ6vR6EXzk+Z1JvgZcctJtMJnSMjlSf1ynTzJClLHrZvOgnaP+06XA80Gq1okaj8Yfz7reBxYbT6VRXUugULgK5HzldWXpvsVvQZrNBpWsjcQWfYsMmKsu7+UsiWJ1WtaBaqsR+tp3VlaK/nF83UmfAKkMnx5NAVAKgl+l3lUGFwjBElaGR0tUVms0mRafo0jOh2BXEbQt34Y5c10WV517yj0dMDb1LB4tdQdo2OA7GNBqNIGiLYBXDiE9SKHbRK+CebWfh0HK5hKASQXswGOjkeKDYReVohYinbXu+R7hqKEwES+12m8IoTATCLvZk6pgq+pW2jQPxFbFOUQsCmBKmVe6XL4GoKL4Gi91iotc47HQ6YcoRC2aMnK5SwTZ6BHuwW5vVEmJCfCliG4fO53MIekbqDKjzps+g4a8hPbgPN0Jx4sDn9TPt93uIHTg/a6SuQA9ardYHPn5UWuqVvhRDZRAz969iJG7BL0t8YoCpRVFE6/1aXydcDVQEIfTM2ERlX4sJOAj2W0z9nc5mM33P8MQa+0yP425tfgdOwr90jamYdbO+TjMBy/oEcsmWzBePQsYAAAAASUVORK5CYII=";
var stoppedOnIcon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADvSURBVDhPnZItD8JADIZfiUQikUgkjiX7wCKRk0gEnjkSBIoEP8NPQILjJyCRSCRupb3rLdtyLNnepLlc7572ei3+iRJMKERAMabqahfNMShi7Nm+DFHViggXPh/p1bokA194NqGqcdC3vEYRK5MxwssHNI0DfGovYMfZHG4DojyzdkjtXlbnk70NcDWg1mlrlAtO+c5mk9VJzsUntsDY1Fo6usAJluBa173gGBm0l33gVGoelo5usB0e/rBbF1jaakCRjKL58WqrtC1eX3NQGF6VLWsxzrpRpC59wcML+UbTJ44+YzsydC9CnPwQ8AONg7vacAr1YwAAAABJRU5ErkJggg==";
var stoppedOnIcon_seatbelt = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIYSURBVDhPvZQxaFpRFIYdMzpmzOjY0a1ZAkKXdqpDh9ApUAgpZJAuPtCgdKmlQhwsShDiUiJUqAUhgoQMDnbKGwwE6pAu5RVCscXh7//fd2818aVtHPrD4XrvPed7555zr7H/rmw2u0Zbn7OE3bqbGJjyPG9IQ6VSQb1eN6PmNJ/7m9b1z6JjnAG1crkM3/dh9Jnjp2PgfGimo9EI1WpV4A/0X7Whi9ImnS5arRam36+AtxngwQqwEbtue2ng6yX6/T5yudw3xkWXgbDDdrsdZvI0sQiat8erJuvBYKBMTy1iJn4lrWOazJ6sRUNu2qO4yVT1ZXzGokLpqBTweit03l0HDrzQXm6Gc41uTXP5vUghCAJlGViUyS6Rz+eBn5NZzRTkdJC1axydtK812ZcLlEolZRnWkj8eqmumds7pLsCTIzSbTQHTDrhlmvF+fzkg13u9noCeA6YbjUZ415YBfqxBV02JOWCyWCwCV8FyQJZKr4icewYoqUvq1u/u/SuQV2w6narLEwJXLM5k6Zlj65mp0/PXxn0kao1l6na7AtYsKpToXBxSwPFh9JO7ae9eYTweC3bJ+LhFzaQaFAqFH3r8JtPtZDTIPjvB7P1LWcSiuJnkF311bTLhRT87Bfaf84j3gTfPDEg1s8dUZrfDnOik4xdo5p12Oh1zzzRqrnVajX6Lx/ybGKR/6R2aR8vY+ayb1xSL/QL9uQvrk6zAAAAAAABJRU5ErkJggg==";
var stoppedOffIcon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADWSURBVDhPjZItFsIwEIRXIpFIZGUlskdAIpFIjlCHrOQIPQKykiMgI5FIHOHbNq/N9gcy781LOpnJbprIErxIBguYB+k3MK4+Ihf4Zu5jotWMm2C1YCHH8IgDY7L+ZCxCpAOCVnSxcYn4XoxDBwjX3lBV3jfNlHUdb3Brg3xo1eGMapyDc304cNue1Yjp4b22fDJierjUynqXg5gePmp4bcT0cPd4aL3pxYQwftcGFQiZ+eP/aR8K4UPKBnjOIWLBonZwHweU6NOnOQeMO6hXWGql+ZDIF0fPnCjLPKZjAAAAAElFTkSuQmCC";
var driverInsightIcon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFWSURBVDhPY6Ap2FEZqbG9OtxhZ1WoAVSIMNhfH8+xsyqsfUdl2PedVeH/d9fF/AfRILyjKnz5lpJQCahSTACyCaj5OkwDCN/ZuxrOhuLnIFdBtSAA1Ob7aIr///7+5f/epiQUsR2V4e8xXLKzMnw6siIQPj278T8IXFwxEUUcirdDtUJsh/kZGYOcDwJPzx5AEYfh7eXhCmADIH7HVPD23lWwAd/evcKQA2GgpQFgA7ZXhWagS4L8DQI/Pr0H00f6C1HkwbgyvAFiADiuUSXPL+kBB+Ch7hywITe2LESRB+HtVeEJYAP21/sLoEs+OrkLrglk2Murp1DkIRgpgQGjcD+yJLoGEB85UYGiHKoVAkDJFhYTIGefmF6DpDgcHAbIYlgT087KsAiQIegJB4Zh4jsqwgqgWjAByCXA0D2OrhmKsSdjbGBbVZgFOHqBUQWyEbtGBgYAaNW8JHqlggcAAAAASUVORK5CYII=";
var driverInsightIcon_seatbelt = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJVSURBVDhPvVQxSBtRGM7o6NjR0bGjY0fHbs3gULro0MFuUkpzmsAFFIwQaMCDpBBswCVDxNhGOIyl1SOEDHrFSBWjFQV7IuKpR/n7fy/vJbm7tKWLH3yc773///L9//+ekQdHLBYbYj7p4bA8+j9w4qimaXUmZTIZyuVy4os10+bz5zL07+DAQU7IptNpsm2bgOvzE7r4vkNXPw7EutlskmEYEF7l+EcyNQwcctBBsVikO/eG9taW6NPbMVp7/azzBRuFBbq9cqharVI8Hr/kvP5tYLEPpVJJONmcf9URAPfXl31rUx8Xri3LgtMvUqIL/pUoyoSzjdmXvmTQc69pfeaFbw9rOEV/OX9KSrWBUhm0WzR8SaC1OC16h1KDZ7WcTo7jwKUjpYS74UQiQb+8e1+vFFEucFIzQ2fgzc9zSqVScNnuJf/xFFND7/oloFcAEvudn+1sU6FQgGBUCU5gGEdbH0PB6BOAXgHBYYH7lWUyTROCmhKM5vN54SQYXM/PiYFgUBD9VnofijnmVuCqwZgSHEkmkyIxGAzXSgTiKC8Yg1bhFbHOYyEIYEqYlmVM+4KDAlj3Dg7OPc/DlF0WHJBywqWGsvHMVAKCv75700kG0cPePbSpUqlAMCul2oA6b9YZdNr4LESDF1lR7R9urlCr1YLYKecPSqku0ANd12/x+OF0K+BOUT07iMn7NyolwuDDEf5FG1NzXZecoz0xGFwNOIIQeibLhLM/iylwEMrXmeKdlstlcc/wxRr7zCzHhcv8FzgJ/6UnmRpzSq670/QhEvkNNxMGho8aL+YAAAAASUVORK5CYII=";
var cameraIcon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAVCAYAAAAnzezqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAAB6JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAAC8ElEQVR42uyVb2jUdRzHX5/fvxv73e7WOb3WjbuWLTRTnJZJZLmghAzWsywMrSCiB1GQIIgJghD9gbACgwIHkYtiPTEXQjI0NdzahN2EtE7L7drmzd3d5u5+9/vz7YH3zCiYO33SC77wffDhy5v35/P+fuSzM1kO/jLx2rmJa68USp5CRDFfFJiGGA/caQ+8u6l1T7IxNO54ChH46VKB0aKDLkKgoGtwnE1tMYzBsdn3TmfyOwDE0LgpBFwvYCiTX7Ov788Hd3ekNpq6zBQdn5IXIAi6JhiASPV+6OzkS9GwRc/W+0k0WLjB/A0QAU2ENw//ztF0bk1fKrqqpTF08kKuxGLbpN7SuDLrrj9xqbAvW3Ba0hPXDhvFkqfdF6/n0VQES79JB6o8lGjgaDrHham5EKLQBTQh2j82u+dIOveqW/btugaT/svFbRoaKHX9LBR+9TERUbapU3T8zv2nskM9P2ffikdCdu/r7bywegle2ReDGqIJie/PT3/Rn8m/XKn4vPFUK7s7kjTZJt8MT4JS1ESAVDPRk84dcPKO3d52Bx88s5Qn7mm8obY2DoiAr0QXsd/pbGPHYy2ELf0fS2siQFWH6qvnl9O5fNG/t6kmAqouxMPmf88Jt5n/BWg1i6FS9IxMUSh7t0GACOjC+70Z1n0yyJHzV29xCpQCEZa1RvvGpp3pzZ8Osf3bX7l4tXxrZ+CRZGTX9oebN9+bjGS6jl9m7UcDfHl2EgBdpMYtAPJlt67JNk9vWbV42bPr7vrQBefFg8M83ZVmtOiAJhgE17dXsIACKn4AChpDJqYmTJc8d8PdkbdXxOsPfHdu6vPekdzjKIhFQzPGimY7P/LXbGznDxdZuqgO15//XtZEmHN9ugbGMev0SnsiPNEcthCZo+IrdOG351Y2bcymIlu+Hr6y/sm2WLexbW18694fnUP7j/0RA7wF+IeFkG7t7Eh+vCEVHan4AYmIxZnRGWYcj0BBPGx2hy29u8HS+HsA3l0gQ1y8X+cAAAAASUVORK5CYII=";
this.createLocationHistoryPoint = function (m, point) {
var picSymbol = null;
if (point.loc.Abnormal)
picSymbol = new PictureMarkerSymbolC(point.loc.IconURL, 14, 14);//url,width,height
else {
if (point.loc.DriverInsight != 0)//DriverInsights
picSymbol = new PictureMarkerSymbolC(point.loc.SeatBelt == 2 ? driverInsightIcon_seatbelt : driverInsightIcon, 14, 14);//url,width,height
else {
if (point.loc.MoveStatus == 1)//InMotion
picSymbol = new PictureMarkerSymbolC(point.loc.SeatBelt == 2 ? inMotionIcon_seatbelt : inMotionIcon, 14, 14);//url,width,height
else if (point.loc.MoveStatus == 2)//StoppedOn
picSymbol = new PictureMarkerSymbolC(point.loc.SeatBelt == 2 ? stoppedOnIcon_seatbelt : stoppedOnIcon, 14, 14);//url,width,height
else if (point.loc.MoveStatus == 3)//StoppedOff
picSymbol = new PictureMarkerSymbolC(stoppedOffIcon, 14, 14);//url,width,height
else
picSymbol = new PictureMarkerSymbolC(point.loc.IconURL, 14, 14);//url,width,height
}
picSymbol.setAngle(point.loc.Heading);
}
var existsurl = false;
var divContent = "<div style='min-height:200px;'>";
var urlContent = "<div class='divicon_left'>";
if (point.loc.SmartWitnessVideoUrl && point.loc.SmartWitnessVideoUrl.length > 0) {
existsurl = true;
for (var i = 0; i < point.loc.SmartWitnessVideoUrl.length; i++) {
var v = point.loc.SmartWitnessVideoUrl[i];
if (v.Key == "Driver Cam")
urlContent += "<a style='cursor:pointer;margin-left:5px;' onclick='openVideoDialog(\"" + encodeURIComponent(v.Value) + "\")'><img style='width:50px;' src='" + _network.root + "img/DriverCam.png?v=1'/></a>";
else
urlContent += "<a style='cursor:pointer;margin-left:5px;' onclick='openVideoDialog(\"" + encodeURIComponent(v.Value) + "\")'><img style='width:50px;' src='" + _network.root + "img/RoadCam.png?v=1'/></a>";
urlContent += "<br/>";
}
}
if (point.loc.FromSmartWitness && enableSmartWitness) {
if (existsurl)
urlContent += "<br/>";
existsurl = true;
urlContent += "<a style='cursor:pointer;' onclick='openRequestVideoDialog(" + m.ID + "," + point.loc.LogId + ")' title='" + GetTextByKey("P_MV_VIDEOREQUEST", "Video Request") + "'><img style='width:50px;' src='" + _network.root + "img/RequestVideo.png?v=1'></a>";
assetHisLocations[point.loc.LogId] = point.loc;//assetHisLocations定义在asset.js中
}
var popContent = "";
if (existsurl) {
urlContent += "</div>";
divContent += urlContent;
popContent += "<div style='margin-left:60px;'>";
}
else
popContent += "<div>";
popContent += "<div><b>" + GetTextByKey("P_MV_NAME_COLON", "Name:") + " </b>" + htmlencode(m.Name) + "<br/>";
popContent += "<b>" + GetTextByKey("P_MV_NAMECUSTOM_COLON", "Name (Custom):") + " </b> " + htmlencode(m.Name2) + "<br/>";
popContent += "<b>" + GetTextByKey("P_MV_SN_COLON", "SN:") + " </b> " + m.VIN + "<br/>";
popContent += "<b>" + GetTextByKey("P_MV_LATITUDE_COLON", "Latitude:") + " </b>" + point.loc.Latitude + "<br/>";
@ -1385,17 +1540,30 @@ if (typeof (MapHelper) !== "function") {
popContent += "<b>" + GetTextByKey("P_MV_STREET_COLON", "Street:") + "</b>" + point.loc.Street + "<br/>";
if (point.loc.LocationTimeText !== "")
popContent += "<b>" + GetTextByKey("P_MV_TIME_COLON", "Time:") + " </b>" + point.loc.LocationTimeText + "<br/>";
if (point.loc.SmartWitnessVideoUrl && point.loc.SmartWitnessVideoUrl.length > 0) {
for (var i = 0; i < point.loc.SmartWitnessVideoUrl.length; i++) {
var v = point.loc.SmartWitnessVideoUrl[i];
popContent += "<br/><a style='cursor:pointer;' onclick='openVideoDialog(\"" + encodeURIComponent(v.Value) + "\")'>" + htmlencode(v.Key) + "</a>";
}
popContent += "<br/>";
}
if (point.loc.FromSmartWitness && enableSmartWitness) {
popContent += "<br/><span class='iconvideo' style='cursor:pointer;' onclick='openRequestVideoDialog(" + m.ID + "," + point.loc.LogId + ")' title='" + GetTextByKey("P_MV_VIDEOREQUEST", "Video Request") + "'></span>";
assetHisLocations[point.loc.LogId] = point.loc;//assetHisLocations定义在asset.js中
}
var driverInsight = "";
if (point.loc.DriverInsight === 1)//ADAS
driverInsight = GetTextByKey("P_MV_ADVANCEDDRIVERASSISTANCESYSTEMS", "Advanced Driver Assistance Systems");
else if (point.loc.DriverInsight === 2)//ADAS_LDWL
driverInsight = GetTextByKey("P_MV_LANEDEPARTUREWARNINGLEFTSIDE", "Lane Departure Warning (left side)");
else if (point.loc.DriverInsight === 3)//ADAS_LDWR
driverInsight = GetTextByKey("P_MV_LANEDEPARTUREWARNINGRIGHTSIDE", "Lane Departure Warning (right side)");
else if (point.loc.DriverInsight === 4)//ADAS_FCW
driverInsight = GetTextByKey("P_MV_FORWARDCOLLISIONWARNING", "Forward Collision Warning");
else if (point.loc.DriverInsight === 5)//ADAS_HMW
driverInsight = GetTextByKey("P_MV_TAILGATING", "Tailgating");
else if (point.loc.DriverInsight === 6)//ADAS_DISTRACT
driverInsight = GetTextByKey("P_MV_DISTRACTIONS", "Distractions"); //GetTextByKey("P_MV_HEADWAYMONITORINGWARNING", "Headway Monitoring Warning");
else if (point.loc.DriverInsight === 7)//ADAS_PHONE
driverInsight = GetTextByKey("P_MV_PHONEATEARCALLING", "Phone at Ear (Calling)"); //GetTextByKey("P_MV_DISTRACTIONS", "Distractions");
else if (point.loc.DriverInsight === 20)//DSM
driverInsight = GetTextByKey("P_MV_DRIVERSTATEMONITORING", "Driver State Monitoring");// GetTextByKey("P_MV_PHONEATEARCALLING", "Phone at Ear (Calling)");
else if (point.loc.DriverInsight === 21)//DSM_FATIGUE
driverInsight = GetTextByKey("P_MV_FATIGUE", "Fatigue"); //GetTextByKey("P_MV_DRIVERSTATEMONITORING", "Driver State Monitoring");
else if (point.loc.DriverInsight === 22)//DSM_DISTRACT
driverInsight = GetTextByKey("P_MV_DISTRACTIONS", "Distractions");// GetTextByKey("P_MV_FATIGUE", "Fatigue");
else if (point.loc.DriverInsight === 23)//DSM_PHONE
driverInsight = GetTextByKey("P_MV_PHONEATEARCALLING", "Phone at Ear (Calling)");
var harshDriving = "";
if (point.loc.HarshDringEvent === 1)
@ -1411,29 +1579,47 @@ if (typeof (MapHelper) !== "function") {
else if (point.loc.SpeedingBehavior === 2)
speeding = GetTextByKey("P_MV_SPEEDINGHIGHSEVERITY", "Speeding: High Severity");
if (speeding !== "" || harshDriving !== "") {
if (driverInsight !== "" || speeding !== "" || harshDriving !== "") {
popContent += "<br/>";
if (driverInsight !== "")
popContent += driverInsight + "<br/>";
if (harshDriving !== "")
popContent += harshDriving + "<br/>";
if (speeding !== "")
popContent += speeding + "<br/>";
}
popContent += "</div>";
divContent += popContent;
divContent += "</div>";
var g = new GraphicC(point, picSymbol);
g.setAttributes({ "infoContent": popContent, "name": htmlencode(m.DisplayName), "Type": 2 });
g.setAttributes({ "infoContent": divContent, "name": htmlencode(m.DisplayName), "Type": 2 });
if (point.loc.SmartWitnessVideoUrl && point.loc.SmartWitnessVideoUrl.length > 0) {
var camSymbol = new PictureMarkerSymbolC(picSymbol.toJson());
camSymbol.setUrl(cameraIcon);
camSymbol.setAngle(0);
camSymbol.setWidth(24);
camSymbol.setHeight(18);
camSymbol.setOffset(3, 0);
var gcam = new GraphicC(point, camSymbol);
gcam.isCamSymbol = true;
//gcam.setAttributes({ "infoContent": popContent, "name": htmlencode(m.DisplayName), "Type": 2 });
g.CameraGraphic = gcam;
}
return g;
}
this.createLocationHistoryLineGraphic = function (polyline, color) {
this.createLocationHistoryLineGraphic = function (polyline, color, width) {
if (!color)
color = [225, 95, 72];
var lineSymbol = new SimpleLineSymbolC({
color: color,
width: 5
width: width || 5
});
if (lineSymbol.width == 0) //在单独Location History页面中width设置可能无效原因不详
lineSymbol.width = 5;
lineSymbol.width = width || 5;
var g = new GraphicC(polyline, lineSymbol);

View File

@ -64,7 +64,7 @@ function initMapMenuItems(data) {
if (!wspItemAdded) {
items['sep1'] = "---------";
var item = {};
item.name = "Dashboards";
item.name = GetTextByKey("P_MAIN_DASHBOARDS", "Dashboards");
item.icon = createicon;
item.items = wspitems;
items['wsp'] = item;
@ -173,6 +173,9 @@ function getitemname(id, name) {
else if (id === "nav_alertsmanagement") {
name = GetTextByKey("P_ALERTSMANAGEMENTNEW", name);
}
else if (id === "nav_alertsmappings") {
name = GetTextByKey("P_ALERTMAPPINGS", name);;
}
else if (id === "nav_workorder") {
name = GetTextByKey("P_WORKORDERNEW", name);
}
@ -191,6 +194,15 @@ function getitemname(id, name) {
else if (id === "nav_scheduler") {
name = GetTextByKey("P_JS_SCHEDULER", name);
}
else if (id === "nav_surveymanagementresult") {
name = GetTextByKey("P_WOS_SURVEYMANAGEMENTRESULT", name);
}
else if (id === "nav_wosurveytemplate") {
name = GetTextByKey("P_WOS_TEMPLATES", name);
}
else if (id === "nav_wosurveytemplatereport") {
name = GetTextByKey("P_WOS_TEMPLATES_REPORT", name);
}
//Credentials
else if (id === "nav_credential") {
name = GetTextByKey("P_CREDENTIALS", name);
@ -248,5 +260,8 @@ function getitemname(id, name) {
else if (id === "nav_addjobsite") {
name = GetTextByKey("P_JS_ADDJOBSITE", name);
}
else if (id === "nav_assethistory") {
name = GetTextByKey("P_MA_ASSETHISTORY", name);
}
return name;
}

View File

@ -25,6 +25,7 @@ function resetMachineState() {
machineStates = [];
clearLocationHistory();
$("#locationhistoryDiv").hide();
resiezrightCtrl();
$("#tripDiv").hide();
allJobsites = [];
@ -56,16 +57,19 @@ function onPlayClick(last) {
function openSetLocationHistory() {
$('#dialog_locationhistory .dialog-title span.title').text(GetTextByKey("P_MA_LOCATIONHISTORY", 'Location History'));
getLocationPrimaryDataSource();
$("#btnLoadTrip").hide();
getAssetDatasources();
$('#locationhistoryDiv').show();
if ($("#rightCtrl").width() == 0)
$("#splitIconRight").click();
resiezrightCtrl();
}
function locationHistoryClick(e) {
locationTimeperiodChange();
$('#tripDiv').hide();
$('#tbTrips').empty();
$("#btnClearTrip").trigger('click');
if (PopupViewShowing) {
if (e) {
@ -76,7 +80,7 @@ function locationHistoryClick(e) {
'height': document.documentElement.clientHeight - 150
})
.showDialogfixed();
execIframeFunc("getlocationhis", [e.data.CompanyID, e.data.ID, e.data.DisplayName], "iframelochis");
execIframeFunc("getlocationhis", [e.data.CompanyID || "", e.data.ID, e.data.DisplayName], "iframelochis");
}
return;
}
@ -97,14 +101,15 @@ function locationHistoryClick(e) {
}
function locationTimeperiodChange() {
var currentdate = getCurrentDate();
var cdate = getCurrentDate();
if (!cdate) cdate = currentdate;
var timeperiod = $("#dialog_timeperiod").val();
var disabled = false;
if (timeperiod !== "4") {
disabled = true;
var time = new Date(currentdate);
var nowtime = new Date(currentdate);
var time = new Date(cdate);
var nowtime = new Date(cdate);
var hours = nowtime.getHours();
var minutes = nowtime.getMinutes();
if (timeperiod === "2") {
@ -142,6 +147,13 @@ function locationTimeperiodChange() {
$('#dialog_endtimeminute').val(setTimeSelect(minutes));
}
}
$('#dateFrom').attr("disabled", disabled);
$('#dialog_starttimehour').attr("disabled", disabled);
$('#dialog_starttimeminute').attr("disabled", disabled);
$('#dateTo').attr("disabled", disabled);
$('#dialog_endtimehour').attr("disabled", disabled);
$('#dialog_endtimeminute').attr("disabled", disabled);
}
var lastHisFromDT;
@ -163,31 +175,36 @@ function getLocationHistory(last) {
return;
}
if ($.playBar.getAllTime() > 0 && lastHisFromDT == dtfrom && lastHisToDT == dtto)
return 1;
else {
$.playBar.Clear();
LocationHistoryInfo = null;
mapHelper.clearLocationHistory();
lastHisFromDT = dtfrom;
lastHisToDT = dtto;
}
var cid = currentLocationHistoryMachine.CompanyID;
var cid = currentLocationHistoryMachine.CompanyID || "";
var mid = currentLocationHistoryMachine.ID;
var p = mid + ";" + dtfrom + ";" + dtto;
var notShow00loc = $("#chkExclude00Loc").is(":checked");
p += ";" + cid + ";" + (notShow00loc ? "1" : "0") + ";" + Datasource;
$("#btnHisLoading").show();
_network.mapviewquery("GetHistoryLocation", p, function (data) {
$("#btnHisLoading").hide();
if (data && data.Machine.ID === currentLocationHistoryMachine.ID) {
showLocationHistory(data, last);
if ($("#selLocDatasource").val() == "0") {
if ($.playBar.getAllTime() > 0 && lastHisFromDT == dtfrom && lastHisToDT == dtto)
return 1;
else {
$.playBar.Clear();
LocationHistoryInfo = null;
mapHelper.clearLocationHistory();
lastHisFromDT = dtfrom;
lastHisToDT = dtto;
}
}, function () {
$("#btnHisLoading").hide();
});
$("#btnHisLoading").show();
_network.mapviewquery("GetHistoryLocation", p, function (data) {
$("#btnHisLoading").hide();
if (data && data.Machine.ID === currentLocationHistoryMachine.ID) {
showLocationHistory(data, last);
}
}, function () {
$("#btnHisLoading").hide();
});
}
else {
getMultipleHistoryLocation(dtfrom, dtto);
}
}
function showLocationHistory(data, last) {
@ -380,7 +397,7 @@ function requestVideo() {
else
loc = assetHisLocations[parseInt($('#dialog_hlogid').val())];
var cid = loc.CompanyID;
var cid = loc.CompanyID || "";
var logid = loc.LogId;
var src = loc.DataSource;
var subsrc = loc.SubSource;
@ -404,23 +421,69 @@ function openTrips(detail) {
getAssetTripLins(detail);
}
function openTheft(callback) {
var dtfrom = $("#dateFrom").val();
var dtto = $("#dateTo").val();
function getLocationPrimaryDataSource() {
var start_hour = $('#dialog_starttimehour').val();
var start_minute = $('#dialog_starttimeminute').val();
var end_hour = $('#dialog_endtimehour').val();
var end_minute = $('#dialog_endtimeminute').val();
dtfrom = dtfrom.replace("-", "/") + " " + start_hour + ":" + start_minute + ":" + "00";
dtto = dtto.replace("-", "/") + " " + end_hour + ":" + end_minute + ":" + "59";
if (new Date(dtfrom) > new Date(dtto)) {
_dialog.showAlert(GetTextByKey("P_MV_FROMDATETIMEMUSTBEPRIORTOTODATETIME", 'From Date/Time must be prior to To Date/Time.'), GetTextByKey("P_MA_LOCATIONHISTORY", 'Location History'));
return;
}
if (typeof callback === 'function') {
callback();
}
getTheftDatasources(dtfrom, dtto);
}
var prumaryDatasource = null;
function getAssetDatasources() {
var cid = currentLocationHistoryMachine.CompanyID || "";
var mid = currentLocationHistoryMachine.ID;
var p = mid + ";" + cid;
var container = $('#containerTheft').empty();
var dstype = $('#selLocDatasource').val();
prumaryDatasource = null;
_network.mapviewquery("GetAssetLocationDataSources", p, function (data) {
for (var i = 0; i < data.length; i++) {
var ds = data[i];
ds.color = ds.IsPrimary ? [225, 95, 72] : lineColors[i % 16];
if (ds.IsPrimary)
prumaryDatasource = ds.DataSource;
var item = $('<div class="theft-datasource-item"></div>');
var label = $('<label></label>');
label.append($('<input type="checkbox"></input>').data('ds', ds).val(String(i)).prop({
'disabled': dstype == '0',
'checked': dstype != '0' || ds.IsPrimary
}));
_network.mapviewquery("GetLocationPrimaryDataSource", p, function (data) {
if (data && data.Item1.toLowerCase() === "calamp")
label.append($('<span class="theft-datasource-line"></span>').css({
'background-color': '#' + ds.color.map(function (c) { return Number(c).toString(16).padStart(2, '0') }).join(''),
'height': ds.IsPrimary ? 5 : 3
}));
label.append($('<span></span>').text(ds.DisplayName));
item.append(label);
container.append(item);
}
if (prumaryDatasource && prumaryDatasource.toLowerCase() === "calamp" && dstype == '0')
$("#btnLoadTrip").show();
else
$("#btnLoadTrip").hide();
}, function () {
resiezrightCtrl();
});
}
function getAssetTripLins(detail) {
var cid = currentLocationHistoryMachine.CompanyID;
var cid = currentLocationHistoryMachine.CompanyID || "";
var mid = currentLocationHistoryMachine.ID;
var dtfrom = $("#dateFrom").val();
var dtto = $("#dateTo").val();
@ -439,7 +502,7 @@ function getAssetTripLins(detail) {
if (detail)
$("#tripDiv").css({ 'left': 'unset', 'right': 11, 'bottom': 0, 'height': '65%' });
else
$("#tripDiv").css({ 'left': 0, 'right': 'unset', 'bottom': 52, 'height': 450 });
$("#tripDiv").css({ 'left': 0, 'right': 'unset', 'bottom': 1, 'height': 450 });
$("#tripDiv").show();
@ -452,6 +515,232 @@ function getAssetTripLins(detail) {
});
}
var lineColors = [//colorSet Array
[0x43, 0x86, 0xd8],
[0xff, 0x9a, 0x2e],
[0xdb, 0x44, 0x3f],
[0xa8, 0xd4, 0x4f],
[0x85, 0x60, 0xb3],
[0x3c, 0xbf, 0xe3],
[0xaf, 0xd8, 0xf8],
[0x00, 0x8e, 0x8e],
[0x8B, 0xBa, 0x00],
[0xfa, 0xbd, 0x0f],
[0xfa, 0x6e, 0x46],
[0x9d, 0x08, 0x0d],
[0xa1, 0x86, 0xbe],
[0xcc, 0x66, 0x00],
[0xfd, 0xc6, 0x89]
];
var dsLocations;
function changeLocDatasource() {
var dstype = $('#selLocDatasource').val();
if (dstype == "0") {//Primary Only
if (prumaryDatasource && prumaryDatasource.toLowerCase() === "calamp")
$("#btnLoadTrip").show();
else
$("#btnLoadTrip").hide();
$('#playBarContainer').show();
$('#btnTheftModeReload').hide();
}
else if (dstype == "1") {//Multipe Line
$("#btnClearTrip").trigger('click');
$('#btnLoadTrip').hide();
$('#playBarContainer').hide();
$('#btnTheftModeReload').show();
}
else {//Single Line
$("#btnClearTrip").trigger('click');
$('#btnLoadTrip').hide();
$('#playBarContainer').hide();
$('#btnTheftModeReload').show();
}
$('#containerTheft').find('input[type="checkbox"]').each(function () {
var t = $(this);
var ds = t.data('ds');
t.prop({
'disabled': dstype == '0',
'checked': dstype != '0' || ds.IsPrimary
});
});
resiezrightCtrl();
}
function resiezrightCtrl() {
setTimeout(function () {
$("#divLegend").css('max-height', $("#rightCtrl").height() - ($("#locationhistoryDiv").is(":hidden") ? 0 : $("#locationhistoryDiv").height()) - 50);
});
}
function getMultipleHistoryLocation(dtfrom, dtto) {
var cid = currentLocationHistoryMachine.CompanyID || "";
var mid = currentLocationHistoryMachine.ID;
//$("#theftLoading").show();
var notShow00loc = $("#chkExclude00Loc").is(":checked");
var p = mid + ";" + dtfrom + ";" + dtto + ";" + cid + ";" + (notShow00loc ? "1" : "0") + ";";
var container = $('#containerTheft');
var datas = [];
container.find('input[type="checkbox"]').each(function () {
var t = $(this);
if (t.prop('checked')) {
datas.push(t.data('ds'));
}
});
dsLocations = [];
var tasks = datas.map(function (ds, index, array) {
return new Promise(function (resolve) {
_network.mapviewquery('GetHistoryLocation', p + ds.DataSource + ';' + ds.SubSource, function (data) {
if (data?.Machine?.ID === currentLocationHistoryMachine.ID) {
data.DataSource = ds;
dsLocations[index] = data;
}
resolve(data);
}, resolve);
});
});
clearLocationHistory();
Promise.all(tasks).then(function () {
if ($("#selLocDatasource").val() == "1") {
for (var i = 0; i < dsLocations.length; i++) {
var data = dsLocations[i];
if (data.Locations.length > 0) {
mapHelper.showLocationHistoryFromStart(data.Machine, data.Locations, data.Locations.length - 1, i == dsLocations.length - 1, true,
data.DataSource.IsPrimary ? null : data.DataSource.color,
data.DataSource.IsPrimary ? null : 3);
}
}
}
else {
var data = null;
var locs = [];
for (var i = 0; i < dsLocations.length; i++) {
data = dsLocations[i];
if (data.Locations.length > 0)
locs = locs.concat(data.Locations);
}
if (data && locs.length > 0) {
locs.sort(function (a, b) {
if (a.LocationTime == b.LocationTime) {
return 0;
}
return a.LocationTime > b.LocationTime ? 1 : -1;
});
mapHelper.showLocationHistoryFromStart(data.Machine, locs, locs.length - 1, true, true, null, null);
}
}
});
}
function getTheftDatasources(dtfrom, dtto) {
var cid = currentLocationHistoryMachine.CompanyID || "";
var mid = currentLocationHistoryMachine.ID;
$("#theftLoading").show();
var p = mid + ";" + cid;
var container = $('#containerTheft').empty();
_network.mapviewquery("GetTheftDatasources", p, function (data) {
// draw locations
mapHelper.clearLocationHistory();
var cid = currentLocationHistoryMachine.CompanyID || "";
var mid = currentLocationHistoryMachine.ID;
var notShow00loc = $("#chkExclude00Loc").is(":checked");
var p = mid + ";" + dtfrom + ";" + dtto + ";" + cid + ";" + (notShow00loc ? "1" : "0") + ";";
dsLocations = [];
var tasks = data.map(function (ds, index, array) {
return new Promise(function (resolve) {
_network.mapviewquery('GetHistoryLocation', p + ds.DataSource + ';' + ds.SubSource, function (data) {
if (data?.Machine?.ID === currentLocationHistoryMachine.ID) {
ds.color = ds.IsPrimary ? [225, 95, 72] : lineColors[index % 16];
ds.count = data?.Locations?.length;
data.DataSource = ds;
dsLocations[index] = data;
if (ds.count > 0) {
mapHelper.showLocationHistoryFromStart(data.Machine, data.Locations, data.Locations.length - 1, index == array.length - 1, true,
ds.IsPrimary ? null : ds.color,
ds.IsPrimary ? null : 3);
}
}
resolve(data);
resiezrightCtrl();
}, resolve);
});
});
Promise.all(tasks).then(function () {
function sourcechanged() {
mapHelper.clearLocationHistory();
var datas = [];
container.find('input[type="checkbox"]').each(function () {
var t = $(this);
if (t.prop('checked')) {
datas.push(dsLocations[t.val()]);
}
});
if ($("#selLocDatasource").val() == "1") {
for (var i = 0; i < datas.length; i++) {
var data = datas[i];
mapHelper.showLocationHistoryFromStart(data.Machine, data.Locations, data.Locations.length - 1, i == datas.length - 1, true,
data.DataSource.IsPrimary ? null : data.DataSource.color,
data.DataSource.IsPrimary ? null : 3);
}
}
else {
var data = null;
var locs = [];
for (var i = 0; i < datas.length; i++) {
data = datas[i];
locs = locs.concat(data.Locations);
}
if (data && locs.length > 0) {
locs.sort(function (a, b) {
if (a.LocationTime == b.LocationTime) {
return 0;
}
return a.LocationTime > b.LocationTime ? 1 : -1;
});
mapHelper.showLocationHistoryFromStart(data.Machine, locs, locs.length - 1, true, true, null, null);
}
}
}
$("#selLocDatasource").off("change").on('change', sourcechanged);
for (var i = 0; i < data.length; i++) {
var ds = data[i];
if (ds.color == null) {
continue;
}
var item = $('<div class="theft-datasource-item"></div>');
var label = $('<label></label>');
label.append($('<input type="checkbox"></input>').data('ds', ds).val(String(i)).prop({
'disabled': !(ds.count > 0),
'checked': ds.count > 0
}).on('change', sourcechanged));
label.append($('<span class="theft-datasource-line"></span>').css({
'background-color': '#' + ds.color.map(function (c) { return Number(c).toString(16).padStart(2, '0') }).join(''),
'height': ds.IsPrimary ? 5 : 3
}));
label.append($('<span></span>').text(ds.DisplayName));
item.append(label);
container.append(item);
}
$("#theftLoading").hide();
});
}, function () {
});
}
function showAssetTripLins(data) {
var tb = $("#tbTrips");
tb.empty();
@ -635,3 +924,42 @@ function setAttachemntIcon(filetype, sdown) {
sdown.attr('src', 'img/icon/txt.jpg')
}
}
function initaiwebsocket() {
var _aiwebsocket;
function openaimsgwebsocket() {
if (typeof AiNotifyAddress !== "undefined") {
_aiwebsocket = new $websocket(AiNotifyAddress);
_aiwebsocket.onreceive = onaimsgreceived;
_aiwebsocket.connect();
}
}
function onaimsgreceived(data) {
console.log(JSON.stringify(data));
if (data) {
if (data.CMD == "100") {//Locate Asset
var m = getAsset(data.Args.Id);
if (m)
mapHelper.locateMachine(m);
}
}
}
openaimsgwebsocket();
}
function OnRightExpend(e) {
var t = $(e);
var tid = t.attr("target");
if (t.hasClass("iconchevrondown")) {
t.removeClass("iconchevrondown").addClass("iconchevronright");
$("#" + tid).hide();
}
else {
t.removeClass("iconchevronright").addClass("iconchevrondown");
$("#" + tid).show();
}
resiezrightCtrl();
}

1
Site/js/mapview/mapview.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -32,8 +32,7 @@ function showSearchList(grid_dt, data) {
}
r.Text = false;
r.Email = false;
var fr = { Values: r };
rows.push(fr);
rows.push(r);
}
grid_dt.setData(rows);
@ -44,24 +43,17 @@ function openSavedSearches() {
showmaskbg(true);
$('#dialog_savedsearches .dialog-title span.title').text(GetTextByKey("P_MV_SAVEDSEARCHES", 'Saved Searches'));
$('#dialog_savedsearches')
.attr('act', 'edit')
.css({
'width': 450,
'top': (document.documentElement.clientHeight - $('#dialog_savedsearches').height()) / 4,
'left': (document.documentElement.clientWidth - $('#dialog_savedsearches').width()) / 2
})
.showDialogfixed();
}).showDialogfixed();
showGridList(savedsearches_dt)
}
var savedsearches_dt;
function InitSavedSearchGrid() {
savedsearches_dt = new GridView('#savedsearchlist');
savedsearches_dt.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
savedsearches_dt = createGridView('#savedsearchlist');
var list_columns = [
{ name: 'Name', caption: GetTextByKey("P_MV_SEARCHNAME", "Search Name"), valueIndex: 'Name', css: { 'width': 250, 'text-align': 'left' } },
{ name: 'IsDefault', caption: GetTextByKey("P_MV_DEFAULT", "Default"), valueIndex: 'IsDefaultText', css: { 'width': 70, 'text-align': 'left' } },
@ -82,49 +74,50 @@ function InitSavedSearchGrid() {
if (list_columns[hd].type) {
col.type = list_columns[hd].type;
}
if (col.name === "Apply") {
col.isurl = true;
col.text = "\uf1da";
col.sortable = false;
col.resizable = false;
col.type = GridView.ColumnTypes.Icon;
col.text = 'history';
col.iconType = 'fa-light';
col.events = {
onclick: function () {
onLoadSavedSearches(this);
}
};
col.classFilter = function (e) {
return "icon-col";
}
col.attrs = { 'title': GetTextByKey("P_MV_APPLY", 'Apply') };
}
else if (col.name === "Delete") {
col.isurl = true;
col.text = "\uf00d";
col.sortable = false;
col.resizable = false;
col.type = GridView.ColumnTypes.Icon;
col.text = 'times';
col.iconType = 'fa-light';
col.events = {
onclick: function () {
OnDeleteSavedSearches(this);
}
};
col.classFilter = function (e) {
return "icon-col";
};
col.attrs = { 'title': GetTextByKey("P_MV_DELETE", 'Delete') };
}
columns.push(col);
}
savedsearches_dt.canMultiSelect = false;
savedsearches_dt.multiSelect = false;
savedsearches_dt.columns = columns;
savedsearches_dt.init();
savedsearches_dt.selectedrowchanged = function (rowindex) {
savedsearches_dt.onSelectedRowChanged = function (rowindex) {
var rowdata = savedsearches_dt.source[rowindex];
if (rowdata) {
$('#savedsearch_searchname').val(rowdata.Values.Name);
$('#savedsearch_searchname').val(rowdata.Name);
}
};
savedsearches_dt.rowdblclick = function (rowindex) {
savedsearches_dt.onRowDblClicked = function (rowindex) {
var rowdata = savedsearches_dt.source[rowindex];
if (rowdata) {
onLoadSavedSearches(rowdata.Values);
onLoadSavedSearches(rowdata);
}
};
}
@ -210,12 +203,7 @@ function openSaveSearch() {
var savesearch_dt;
function InitSaveSearchGrid() {
savesearch_dt = new GridView('#savesearchlist');
savesearch_dt.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
savesearch_dt = createGridView('#savesearchlist');
var list_columns = [
{ name: 'Name', caption: GetTextByKey("P_MV_SEARCHNAME", "Search Name"), valueIndex: 'Name', css: { 'width': 250, 'text-align': 'left' } },
{ name: 'IsDefault', caption: GetTextByKey("P_MV_DEFAULT", "Default"), valueIndex: 'IsDefaultText', css: { 'width': 70, 'text-align': 'left' } }
@ -239,12 +227,6 @@ function InitSaveSearchGrid() {
savesearch_dt.canMultiSelect = false;
savesearch_dt.columns = columns;
savesearch_dt.init();
savesearch_dt.selectedrowchanged = function (rowindex) {
var rowdata = savesearch_dt.source[rowindex];
if (rowdata) {
}
}
}
function onSaveSearch() {

View File

@ -8,7 +8,8 @@ function initshape() {
shapevm = new Vue({
el: '#shapeList',
data: {
shapes: []
shapes: [],
DeleteTitle: GetTextByKey("P_MV_DELETE", "Delete")
},
methods: {
reload: function (data) {
@ -111,7 +112,7 @@ function deleteShapeClick(e) {
return;
}
var item = {
'Key': e.data.CompanyID,
'Key': e.data.CompanyID || "",
'Value': e.data.ID
};
showmaskbg(true);
@ -207,7 +208,7 @@ function SaveImportShapeFile() {
function getShapeFileData(s, needLocate) {
var item = {
'Key': s.CompanyID,
'Key': s.CompanyID||"",
'Value': s.ID,
'Tag1': s.FileName
};

View File

@ -33,11 +33,11 @@
var t = TransitionTime(allTime);
$('.BarFinishTime').html(t.StringTime);
$('#btnPlay').click(function () {
$('#btnPlay').on('click', function () {
if ($.playBar.onPlayClick)
$.playBar.onPlayClick(false);
}).attr("title", GetTextByKey("P_MV_PLAYBACK", "Playback"));
$('#btnPlayEnd').click(function () {
$('#btnPlayEnd').on('click', function () {
if ($.playBar.onPlayClick)
$.playBar.onPlayClick(true);
}).attr("title", GetTextByKey("P_MV_QUICKLOADSKIPTOEND", "Quick Load/Skip to End"));