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

@ -1,6 +1,6 @@
var $assetalertfilter = function (id) {
this.containerId = id;
this.title = GetTextByKey("P_XXX", 'Asset Alert Filter Templates');
this.title = GetTextByKey("P_WO_ASSETALERTFILTERTEMPLATES", 'Asset Alert Filter Templates');
this.onOK = null;
this.onDialogClosed = null;
this.includechild = true;

View File

@ -18,8 +18,11 @@
var __proto = $assetselector.prototype;
function initMachinesGrid(parent) {
var grid = new GridView(parent);
grid.lang = {
var gv = GridView;
if (typeof GridView1 !== 'undefined')//兼容FIC的旧的GridView
gv = GridView1
var grid = new gv(parent);
grid.langs = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
@ -224,12 +227,12 @@
var filterdiv = $('<div style="margin: 4px 0 0 10px; float: left; line-height: 25px"></div>').appendTo(content);
$('<label style="margin-left:5px;margin-right:5px;"></label>').text(GetTextByKey("P_JS_ASSETGROUP", 'Asset Group')).appendTo(filterdiv);
this.selgroup = $('<select style="width:120px;height:22px;"></select>').change(onSearch.bind(this)).appendTo(filterdiv);
getAssetGroups(this.selgroup);
$('<label style="margin-left:5px;margin-right:5px;"></label>').text(GetTextByKey("P_XXXXXX", 'Jobsite')).appendTo(filterdiv);
getAssetGroups(this.selgroup, this.companyId || "");
$('<label style="margin-left:5px;margin-right:5px;"></label>').text(GetTextByKey("P_SELECTASSETS_JOBSITE", 'Jobsite')).appendTo(filterdiv);
this.seljs = $('<select style="width:120px;height:22px;"></select>').change(onSearch.bind(this)).appendTo(filterdiv);
$('<label style="margin-left:5px;margin-right:5px;"></label>').text(GetTextByKey("P_XXXXXX", 'Jobsite Code')).appendTo(filterdiv);
$('<label style="margin-left:5px;margin-right:5px;"></label>').text(GetTextByKey("P_SELECTASSETS_JOBSITECODE", 'Jobsite Code')).appendTo(filterdiv);
this.seljscode = $('<select style="width:120px;height:22px;"></select>').change(onSearch.bind(this)).appendTo(filterdiv);
getJobSites(this.seljs, this.seljscode);
getJobSites(this.seljs, this.seljscode, this.companyId || "");
}
$('<div style="clear: both"></div>').appendTo(content);
@ -241,7 +244,7 @@
$('<input type="button" value="' + GetTextByKey("P_SELECTASSETS_OK", "OK") + '" />').click(onOKClick.bind(this)).appendTo(dialogFunction);
$('<div class="clear"></div>').appendTo(dialogFunction);
$('<div class="maskbg" style="display: none"><div class="loading_icon c-spin"></div></div>').appendTo(dialog);
$('<div class="maskbg" style="display: none"><div class="loading c-spin"></div></div>').appendTo(dialog);
// init
initMachinesGrid.call(this, this.machineList);
@ -357,7 +360,7 @@
if (exceptShareAsset && it.ShareStatus == 2)
continue;
if (excepts == null || !hasMachine(it.Id, excepts)) {
items.push({ Values: it });
items.push(it);
}
}
gridAssets.setData(items);
@ -379,8 +382,8 @@
this.dialog.hideDialog();
}
function getAssetGroups(ctrl) {
devicerequest('GetMachineGroups', '' + String.fromCharCode(170) + '', function (data) {
function getAssetGroups(ctrl, companyId) {
devicerequest('GetMachineGroups', companyId + String.fromCharCode(170) + '', function (data) {
if (typeof data === 'string') {
return;
}
@ -394,8 +397,8 @@
});
}
function getJobSites(ctrl, ctrl1) {
jobsiterequest('GetJobSiteDataSource', '', function (data) {
function getJobSites(ctrl, ctrl1, companyId) {
jobsiterequest('GetJobSiteDataSource', companyId, function (data) {
if (typeof data === 'string') {
return;
}

View File

@ -6,13 +6,18 @@ if (typeof ($assetsummary) != "function") {
var infowindowScrollTop = 0;
var assetInfoCache = [];
var assetExtCache = [];
$assetsummary = function (p, cid, assetid, alerttips, type, assets) {//type 0.left;1.bottom
function clearAssetsummaryCache() {
assetInfoCache = [];
assetExtCache = [];
}
$assetsummary = function (p, cid, assetid, viewalerttypes, alerttips, type, assets) {//type 0.left;1.bottom
if (typeof p === "string")
p = $("#" + p);
if (!p)
p = document;
this.companyid = cid || "";
this.assetid = assetid;
this.viewalerttypes = viewalerttypes;
this.alerttips = alerttips;
this.type = type;
this.assets = assets;
@ -378,16 +383,17 @@ if (typeof ($assetsummary) != "function") {
div_summary.append(br);
if (asset.Description && asset.Description !== "") {
asset.Description = replaceHtmlText(asset.Description);
b = $('<b>' + GetTextByKey("P_MV_DESCRIPTION_COLON", "Description:") + ' </b>');
div_summary.append(b);
label = $('<label></label>').html(asset.Description);
//label = $('<label></label>').html(replaceHtmlText(asset.Description));
label = $('<label></label>').text(asset.Description);
div_summary.append(label).append(br).append(br);
}
if (_this.alerttips && _this.alerttips !== "") {
var atips = replaceHtmlText(_this.alerttips)
label = $('<label></label>').html(atips);
//var atips = replaceHtmlText(_this.alerttips)
//label = $('<label></label>').html(atips);
label = $('<label></label>').text(_this.alerttips);
div_summary.append(label).append(br);
}
if (canViewAlertsManagement) {
@ -481,24 +487,20 @@ if (typeof ($assetsummary) != "function") {
if (j === "AlertLocalTime")
r[j] = { DisplayValue: r["AlertLocalTimeStr"], Value: r[j] };
}
var fr = { Values: r };
rows.push(fr);
rows.push(r);
}
_this.grid_alertsdt.setData(rows);
if (_this.grid_alertsdt)
_this.grid_alertsdt.setData(rows);
}
function InitAlertsGridData() {
_this.grid_alertsdt = new GridView('#divalertgrid_' + _this.ctrlindex);
_this.grid_alertsdt.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
if ($('#divalertgrid_' + _this.ctrlindex).length < 1) return;
_this.grid_alertsdt = createGridView('#divalertgrid_' + _this.ctrlindex);
var list_columns = [
{ name: 'AlertLocalDateStr', caption: GetTextByKey("P_MV_DATE", "Date"), valueIndex: 'AlertLocalDateStr', css: { 'width': 70, 'text-align': 'left' } },
{ name: 'AlertLocalTimeStr', caption: GetTextByKey("P_MV_TIME", "Time"), valueIndex: 'AlertLocalTimeStr', css: { 'width': 75, 'text-align': 'left' } },
{ name: 'Level', caption: GetTextByKey("P_MV_LEVEL", "Level"), valueIndex: 'Level', css: { 'width': 60, 'text-align': 'left' } },
{ name: 'AlertType', caption: GetTextByKey("P_AM_ALERTTYPE", "Alert Type"), valueIndex: 'AlertType', css: { 'width': 60, 'text-align': 'left' } },
{ name: 'Description', caption: GetTextByKey("P_MV_DESCRIPTION", "Description"), valueIndex: 'Description', css: { 'width': 200, 'text-align': 'left' } }
];
var columns = [];
@ -518,12 +520,6 @@ if (typeof ($assetsummary) != "function") {
_this.grid_alertsdt.canMultiSelect = false;
_this.grid_alertsdt.columns = columns;
_this.grid_alertsdt.init();
_this.grid_alertsdt.selectedrowchanged = function (rowindex) {
var rowdata = _this.grid_alertsdt.source[rowindex];
if (rowdata) {
}
}
}
function devicerequest(method, param, callback, error) {
@ -583,7 +579,7 @@ if (typeof ($assetsummary) != "function") {
return;
}
_this.showLoading();
devicerequest('GetAssetExtInfo', _this.companyid + String.fromCharCode(170) + _this.assetid, function (data) {
devicerequest('GetAssetExtInfo', _this.companyid + String.fromCharCode(170) + _this.assetid + String.fromCharCode(170) + (_this.viewalerttypes || ""), function (data) {
_this.hideLoading();
if (typeof data === 'string') {
return;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,278 +0,0 @@

if (typeof ($editableselect) != "function") {
$(document).mousedown(function (e) {
var drop = $('#dropdowndiv');
if (drop.length > 0) {
var editselctrl = drop.parent();
var t = $(e.target);
if (!t.is(editselctrl)
&& !t.parent().is(editselctrl)
&& !t.parent().parent().is(editselctrl)
&& !t.parent().parent().parent().is(editselctrl))
$('#dropdowndiv').remove();
}
});
$(window).resize(function (e) {
$('#dropdowndiv').remove();
});
$editableselect = function (parent, maxlength, maxwidth) {
this.datasource = undefined;
this.valuepath = undefined;
this.displaypath = undefined;
this.changedhandler = undefined;
this.isEnabled = true;
this.maxshowncount = 2000;
this.maxlength = maxlength > 0 ? maxlength : 50;
var basectrl = undefined;
var inputctrl = undefined;
var iconctrl = undefined;
var _this = this;
this.val = function (value) {
if (arguments.length === 0)
return inputctrl.data("val");
else {
inputctrl.data("val", value);
if (this.datasource) {
for (var i = 0, j = 0; i < this.datasource.length; i++) {
var obj = this.datasource[i];
var v = "";
if (this.valuepath)
v += obj[this.valuepath];
else
v += obj;
if (v.toLowerCase() == ("" + value).toLowerCase()) {
var text = "";
if (this.displaypath)
text = obj[this.displaypath];
else
text += obj;
inputctrl.val(text);
inputctrl.data("obj", obj);
return;
}
}
inputctrl.val("");
inputctrl.data("obj", null);
}
}
}
this.text = function (text) {
if (arguments.length === 0)
return inputctrl.val();
else {
inputctrl.val(text);
if (this.datasource) {
for (var i = 0, j = 0; i < this.datasource.length; i++) {
var obj = this.datasource[i];
var t = "";
if (this.displaypath)
t += obj[this.displaypath];
else
t += obj;
if (t.toLowerCase() == ("" + text).toLowerCase()) {
var value = "";
if (this.valuepath)
value = obj[this.valuepath];
else
value += obj;
inputctrl.data("val", value);
inputctrl.data("obj", obj);
return;
}
}
inputctrl.data("val", "");
inputctrl.data("obj", null);
}
}
}
this.selecteditem = function () {
return inputctrl.data("obj");
}
this.selectedindex = function () {
return _this.datasource.indexOf(inputctrl.data("obj"));
}
this.change = function (func) {
this.changedhandler = func;
}
this.tabIndex = function (tabindex) {
inputctrl.attr("tabIndex", tabindex);
}
this.setEnable = function (enable) {
this.isEnabled = enable;
inputctrl.attr("disabled", !enable);
}
this.reload = function () {
setTimeout(function () {
inputctrl.css("width", parent.width() - 22);
});
}
basectrl = $('<div class="editseldiv"></div>');
inputctrl = $('<input class="editselinput" autocomplete="off" style="padding-top:0;padding-bottom:0;" />').attr("maxlength", this.maxlength)
.css("width", parent.width() - 22)
.css("border", "none").css("height", 20)
.bind('input propertychange', function () { changeSearchvalue(this); });
inputctrl.keydown(onkeydown);
iconctrl = $('<div class="dropdownicon"></div>')
.css("line-height", "normal").click(iconClick);
basectrl.append(inputctrl).append(iconctrl);
parent.append(basectrl);
function onkeydown(e) {
if (e.keyCode == 13 || e.keyCode == 38 || e.keyCode == 40) {//Enter Up Down键
var drop = $('#dropdowndiv');
if (e.keyCode == 13) {
if (drop.length > 0) {
drop.find("li.itemselected").click();
}
}
else {//Up
var selectedIndex = -1;
var lis = drop.find("li");
lis.each(function () {
var li = $(this);
if (li.hasClass("itemselected")) {
selectedIndex = $(this).attr("index");
li.removeClass("itemselected");
}
});
if (e.keyCode == 38)
selectedIndex--;
else if (e.keyCode == 40)
selectedIndex++;
if (selectedIndex < 0)
selectedIndex = lis.length - 1;
if (selectedIndex > lis.length - 1)
selectedIndex = 0;
var next = drop.find("li[index=" + selectedIndex + "]");
if (next.length > 0) {
$(next[0]).addClass("itemselected");
var offsetTop = next[0].offsetTop;
if (offsetTop >= drop.height() - drop.scrollTop() - 20) {
drop.scrollTop(offsetTop - drop.height() + 20);
}
}
}
}
}
function iconClick(e) {
if (_this.isEnabled) {
var drop = $('#dropdowndiv');
if (drop.length > 0) {
$('#dropdowndiv').remove();
}
else {
createDropdown(_this, undefined);
inputctrl.select();
inputctrl.focus();
}
}
}
//搜索
function changeSearchvalue(obj) {
var inp = $(obj);
var text = $.trim(inp.val());
var matched = false;
for (var i = 0, j = 0; i < _this.datasource.length; i++) {
var obj = _this.datasource[i];
var t = "";
if (_this.displaypath)
t += obj[_this.displaypath];
else
t += obj;
if (t.toLowerCase() == ("" + text).toLowerCase()) {
var value = "";
if (_this.valuepath)
value = obj[_this.valuepath];
else
value += obj;
inp.data("val", value);
inputctrl.data("obj", obj);
matched = true;
break;
}
}
if (!matched) {
inp.data("val", "");
inputctrl.data("obj", null);
}
if (_this.changedhandler)
_this.changedhandler();
createDropdown(_this, text);
}
function createDropdown(selctrl, searchtext) {
$("#dropdowndiv").remove();//移除已创建的下拉框
var dropdiv = $('<div id="dropdowndiv" class="editseldorp"></div>');
dropdiv.css("min-width", basectrl.width());
if (maxwidth != undefined)
dropdiv.css("max-width", maxwidth);
var ul = $('<ul style="padding:0px;list-style:none;margin:0px;"></ul>');
if (!selctrl.datasource) return;
if (basectrl.css("position") !== "relative") {
dropdiv.css('top', basectrl.position().top + 22);
dropdiv.css('left', basectrl.position().left);
}
var index = 0;
for (var i = 0, j = 0; i < selctrl.datasource.length && j < selctrl.maxshowncount; i++) {
var obj = selctrl.datasource[i];
var text = "";
if (selctrl.displaypath)
text = obj[selctrl.displaypath];
else
text += obj;
var value = "";
if (selctrl.valuepath)
value = obj[selctrl.valuepath];
else
value += obj;
if (!searchtext || text.toLowerCase().indexOf(searchtext.toLowerCase()) >= 0) {
var item = $('<li class="editselitem"></li>').data("obj", obj).data("val", value).text(text).attr("index", index++)
.click(function () { itemClick(this) });
ul.append(item);
j++;
}
}
ul.appendTo(dropdiv);
basectrl.append(dropdiv);
}
//drop选中
function itemClick(item) {
item = $(item);
inputctrl.val(item.text());
var oldValue = inputctrl.data("val");
var newValue = item.data("val");
inputctrl.data("val", newValue);
inputctrl.data("obj", item.data("obj"));
if (_this.changedhandler && newValue != oldValue)
_this.changedhandler();
$('#dropdowndiv').remove();
}
}
}

View File

@ -1,212 +0,0 @@

var ALL_TEXT = "(All)";
var paramindex = -1;
function editmultiselect(param) {
var divcontrol = $('<div class="div_filter"></div>');
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-top:20px;margin-left:-1px;"></div>');
divpanel.data("self", divpanel);
if (param.width && param.width > 0)
divpanel.css('width', param.width);
$(document).mousedown(function (e) {
var t = $(e.target);
$('.div_panel').each(function () {
if (!t.is(divpanel)
&& !t.parent().is(divpanel)
&& !t.parent().parent().is(divpanel)
&& !t.parent().parent().parent().is(divpanel)) {
var v = divpanel.is(":visible");
divpanel.hide();
if (v && param.oncompleted)
param.oncompleted();
}
});
});
divpanel.completed = function () {
if (param.oncompleted)
param.oncompleted();
}
var inputctrl;
//if (param.allowsearch === true) {
var inputdiv = $('<div style="margin:3px;"></div>');
divpanel.append(inputdiv);
inputctrl = $('<input maxlength="100" style="padding-top:0;padding-bottom:0;width:96%;" />');
inputctrl.bind('input propertychange', function () { changeSearchvalue(this); });
inputdiv.append(inputctrl);
//}
var ul = $('<ul></ul>');
divpanel.append(ul);
ul.mousedown(false);
seldiv.append(span).append(spanimg).append(divpanel);
divcontrol.append(seldiv);
var ctrlclick = function () {
$('.div_panel').each(function (e) {
var t = $(this);
var v = t.is(":visible");
if (!t.is(divpanel)) {
t.css('display', 'none');
if (v)
t.data("self").completed();
}
});
var display = divpanel.css('display');
if (display == 'none') {
divpanel.css({ 'display': 'block' });
} else {
divpanel.css('display', 'none');
}
return false;
}
span.mousedown(ctrlclick);
spanimg.mousedown(ctrlclick);
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);
}
else {
span.attr('title', "").text("");
}
param.selectedvalue = [];
param.selecteditems = [];
return;
}
else {
if (chkall)
chkall.prop('checked', false);//(ALL)取消选中
}
var texts = [];
var paramvalues = [];
var paramitems = [];
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.data("value");
texts.push(text);
paramvalues.push(c.data("value"));
paramitems.push(c);
}
}
texts = texts.join(', ');
span.attr('title', texts).text(texts);
param.selectedvalue = paramvalues;
param.selecteditems = paramitems;
};
divcontrol.setValues = function (values) {
var chks = ul.find('input');
for (var i = 0; i < chks.length; i++) {
var chk = $(chks[i]);
if (values.indexOf(chk.data("value")) >= 0)
chk.prop('checked', true);
else
chk.prop('checked', false);
}
var texts = [];
var paramvalues = [];
var paramitems = [];
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.data("value");
texts.push(text);
paramvalues.push(c.data("value"));
paramitems.push(c);
}
}
texts = texts.join(', ');
span.attr('title', texts).text(texts);
param.selectedvalue = paramvalues;
param.selecteditems = paramitems;
}
var chkall = undefined;
var showItems = function (searchtext) {
ul.empty();
if (param.allowall !== false) {
var liall = $('<li></li>');
chkall = $('<input type="checkbox" style="width:16px;"/>');
chkall.change(function () {//全选
itemclick(true, $(this).prop('checked'));
});
liall.append(chkall);
liall.append($('<label for="chkall"></label>').text(ALL_TEXT));
ul.append(liall);
}
if (param && param.items) {
var texts = [];
for (var s = 0; s < param.items.length; s++) {
var item = param.items[s];
var value = item[param.valuepath || "Key"];
var txt = item[param.textpath || "Value"];
var li = $('<li></li>').data("item", item);
var chk = $('<input type="checkbox" style="width:16px;"/>').data("value", value).attr("id", "chkp" + ++paramindex);
if (item.sublevel > 0)
chk.css("margin-left", "" + (20 * item.sublevel) + "px");
chk.change(function () {
itemclick(false, $(this).prop('checked'));
});
li.append(chk);
var lbl = $('<label for=' + ("chkp" + paramindex) + '></label>').text(txt)
li.append(lbl);
ul.append(li);
}
texts = texts.join(', ');
span.attr('title', texts).text(texts);
divcontrol.setValues(param.selectedvalue);
}
}
var filterItems = function (searchtext) {
if (!searchtext)
searchtext = "";
searchtext = $.trim(searchtext);
ul.find("li").each(function () {
var li = $(this);
var item = li.data("item");
if (item) {
var txt = item[param.textpath || "Value"];
if (searchtext != "" && txt.toLowerCase().indexOf(searchtext.toLowerCase()) < 0)
li.hide();
else
li.show();
}
})
}
//搜索
function changeSearchvalue(obj) {
var inp = $(obj);
var text = inp.val();
filterItems(text);
}
divcontrol.reset = function () {
if (inputctrl)
inputctrl.val("");
showItems();
itemclick(true, false);
}
showItems();
return divcontrol;
}

View File

@ -251,13 +251,29 @@ function getFavoriteNavInfoByID(id, text, icon) {
$(icon).addClass("iconworkorder");
}
else if (id === "nav_workorderhis") {
title = GetTextByKey("P_XXX", title);
title = GetTextByKey("P_WORKORDERHISTORY", title);
$(icon).addClass("iconhistory");
}
else if (id === "nav_maintenanceschedule") {
title = GetTextByKey("P_PM_MAINTENANCESCHEDULES", title);
$(icon).addClass("iconmaintenanceschedule");
}
else if (id === "nav_customerrecord") {
title = GetTextByKey("P_CUSTOMERRECORD", title);
}
else if (id === "nav_customersatisfactionsurveys") {
title = GetTextByKey("P_CUSTOMERSATISFACTIONSURVEYS", title);
$(icon).addClass("icontemplate");
}
else if (id === "nav_surveymanagementresult") {
title = GetTextByKey("P_WOS_SURVEYMANAGEMENTRESULT", title);
}
else if (id === "nav_wosurveytemplate") {
title = GetTextByKey("P_WOS_TEMPLATES", title);
}
else if (id === "nav_wosurveytemplatereport") {
title = GetTextByKey("P_WOS_TEMPLATES_REPORT", title);
}
else if (id === "nav_record") {
title = GetTextByKey("P_MAINTENANCERECORDLEGACY", title);
$(icon).addClass("iconrecord");
@ -298,6 +314,14 @@ function getFavoriteNavInfoByID(id, text, icon) {
title = GetTextByKey("P_MANAGEMODELS", title);
$(icon).addClass("iconmanagmodels");
}
else if (id === "nav_assethistory") {
title = GetTextByKey("P_MA_ASSETHISTORY", title);
$(icon).addClass("iconhistory");
}
else if (id === "nav_shareasset") {
title = GetTextByKey("P_SHAREASSETS", title);
$(icon).addClass("iconshare");
}
else if (id === "nav_jobsiterequirements") {
title = GetTextByKey("P_JS_JOBSITEREQUIREMENTS", title);
}
@ -310,6 +334,27 @@ function getFavoriteNavInfoByID(id, text, icon) {
else if (id === "nav_scheduler") {
title = GetTextByKey("P_JS_SCHEDULER", title);
}
else if (id === "100") {//Map View
title = GetTextByKey("P_MAPVIEW", title);
}
else if (id === "250") {//FilterQ
title = GetTextByKey("P_MODULE_FILTERQ", title);
}
else if (id === "500") {//FilterQ
title = "M3";
}
else if (id === "550") {//Over/Under Trucking Alerts
title = GetTextByKey("P_MODULE_OVERUNDERTRUCKINGALERTS", title);
}
else if (id === "650") {//Inspection
title = GetTextByKey("P_MODULE_INSPECTION", title);
}
else if (id === "700") {//Team Intelligence
title = GetTextByKey("P_MODULE_TEAMINTELLIGENCE", title);
}
else if (id === "600") {//OTR Config
title = GetTextByKey("P_MODULE_OTRCONFIG", title);
}
return title;
}
@ -396,19 +441,19 @@ function onOpenSite(m) {
function setAppMoudule(mouduleid, name, type) {
if (!name) {
if (mouduleid === 100)
name = "Map View";
name = GetTextByKey("P_MAPVIEW", "Map View");
else if (mouduleid === 150)
name = "Jobsites";
name = GetTextByKey("P_MODULE_JOBSITES", "Jobsites");
else if (mouduleid === 250)
name = "FilterQ";
name = GetTextByKey("P_MODULE_FILTERQ", "FilterQ");
else if (mouduleid === 500)
name = "M3";
else if (mouduleid === 550)
name = "Over/Under Trucking Alerts";
name = GetTextByKey("P_MODULE_OVERUNDERTRUCKINGALERTS", "Over/Under Trucking Alerts");
else if (mouduleid === 650)
name = "Inspection";
name = GetTextByKey("P_MODULE_INSPECTION", "Inspection");
else if (mouduleid === 700)
name = "Team Intelligence";
name = GetTextByKey("P_MODULE_TEAMINTELLIGENCE", "Team Intelligence");
}
return setNavigate(mouduleid + '', name, type);
@ -439,8 +484,11 @@ function showFavConfirm(msg, title, fok, fcancel) {
var grid_favoritedt;
function InitFavoriteGrid() {
grid_favoritedt = new GridView('#favoritelist');
grid_favoritedt.lang = {
var gv = GridView;
if (typeof GridView1 !== 'undefined')//兼容FIC的旧的GridView
gv = GridView1
grid_favoritedt = new gv('#favoritelist');
grid_favoritedt.langs = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
@ -465,62 +513,52 @@ function InitFavoriteGrid() {
if (list_columns[hd].type) {
col.type = list_columns[hd].type;
}
if (col.name === "Delete") {
col.isurl = true;
col.text = "\uf00d";
col.sortable = false;
col.resizable = false;
col.type = gv.ColumnTypes.Icon;
col.text = 'times';
col.iconType = 'fa-light';
col.events = {
onclick: function () {
OnDeleteFavorite(this);
}
};
col.classFilter = function (e) {
return "icon-col";
};
col.attrs = { 'title': GetTextByKey("P_FAV_DELETE", 'Delete') };
}
else if (col.name === "Up") {
col.isurl = true;
col.text = "\uf062";
col.sortable = false;
col.resizable = false;
col.type = gv.ColumnTypes.Icon;
col.text = 'arrow-up';
col.iconType = 'fa-light';
col.events = {
onclick: function () {
onSortFavorite(true, this);
}
};
col.classFilter = function (e) {
return "icon-col";
};
col.attrs = { 'title': GetTextByKey("P_FAV_UP", 'Up') };
col.attrs = { 'title': GetTextByKey("P_FAV_UP", 'Delete') };
}
else if (col.name === "Down") {
col.isurl = true;
col.text = "\uf063";
col.sortable = false;
col.resizable = false;
col.type = gv.ColumnTypes.Icon;
col.text = 'arrow-down';
col.iconType = 'fa-light';
col.events = {
onclick: function () {
onSortFavorite(false, this);
}
};
col.classFilter = function (e) {
return "icon-col";
};
col.attrs = { 'title': GetTextByKey("P_FAV_DOWN", 'Down') };
col.attrs = { 'title': GetTextByKey("P_FAV_DOWN", 'Delete') };
}
columns.push(col);
}
grid_favoritedt.canMultiSelect = false;
grid_favoritedt.columns = columns;
grid_favoritedt.init();
grid_favoritedt.selectedrowchanged = function (rowindex) {
var rowdata = grid_favoritedt.source[rowindex];
if (rowdata) {
}
};
grid_favoritedt.rowdblclick = function (rowindex) {
var rowdata = grid_favoritedt.source[rowindex];
if (rowdata) {
}
};
}
var favgridinited = false;
@ -535,8 +573,8 @@ function showFavoritesGridList(data) {
var rows = [];
for (var i = 0; i < data.length; i++) {
var r = data[i];
var fr = { Values: r };
rows.push(fr);
r.Name = getFavoriteNavInfoByID(r.ID, r.Name);
rows.push(r);
}
grid_favoritedt.setData(rows);
@ -552,7 +590,7 @@ function openFavoriteDialog() {
'width': 540,
'top': (document.documentElement.clientHeight - $('#dialog_favorite').height()) / 4,
'left': (document.documentElement.clientWidth - $('#dialog_favorite').width()) / 2
}).showDialogfixed();
}).showDialogfixed(false);//false兼容Inspection中的showDialogfixed
$("#btnfavsave").focus();
if (userfavorates)
@ -574,8 +612,9 @@ function onSortFavorite(isasc, fav) {
var index;
var currentfavs = [];
for (var i = 0; i < grid_favoritedt.source.length; i++) {
var userfav = grid_favoritedt.source[i].Values;
var tempsource = grid_favoritedt.source;
for (var i = 0; i < tempsource.length; i++) {
var userfav = tempsource[i];
if (fav.ID === userfav.ID)
index = i;
else
@ -601,8 +640,9 @@ function onSaveFavoriteSort() {
if (!grid_favoritedt)
return;
var data = [];
for (var i = 0; i < grid_favoritedt.source.length; i++) {
data.push(grid_favoritedt.source[i].Values);
var tempsource = grid_favoritedt.source;
for (var i = 0; i < tempsource.length; i++) {
data.push(tempsource[i]);
}
saveFavorites(data, true);
@ -614,7 +654,9 @@ function onSaveFavoriteSort() {
function onInitTitleSites() {
if (appmoudulesdata) {
var menudiv = $("#divfavmenu");
var syssetli = $("#lisyssetting");
var syssetli = $("#lisyssetting").on('click', function () {
window.location.href = $(this).data('url');
});
var liversion = $("#liVersion");
menudiv.parent().find(".dynamicmenu").remove();
@ -726,13 +768,11 @@ function createSettingSite(m, syssetli, sub) {
}
icon = createMouduleIcon(sm, 1);
var li = $('<li class="dynamicmenu"></li>').click(function () {
var li = $('<li class="dynamicmenu flex"></li>').click(function () {
onOpenSite(sm);
});
var fav_a = $('<a style="padding-left:0;"></a>');
li.append(fav_a);
fav_a.append($('<div></div>').append(icon));
fav_a.append($('<span></span>').text(name));
li.append($('<div></div>').append(icon));
li.append($('<span></span>').text(name));
syssetli.before(li);
}
@ -741,8 +781,11 @@ function createSettingSite(m, syssetli, sub) {
var dashboarddata;
var grid_dbdt;
function InitDBGridData() {
grid_dbdt = new GridView('#dashboardslist');
grid_dbdt.lang = {
var gv = GridView;
if (typeof GridView1 !== 'undefined')//兼容FIC的旧的GridView
gv = GridView1
grid_dbdt = new gv('#dashboardslist');
grid_dbdt.langs = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
@ -786,13 +829,7 @@ function InitDBGridData() {
grid_dbdt.canMultiSelect = false;
grid_dbdt.columns = columns;
grid_dbdt.init();
grid_dbdt.rowdblclick = openDashboard;
grid_dbdt.selectedrowchanged = function (rowindex) {
var rowdata = grid_dbdt.source[rowindex];
if (rowdata) {
}
}
grid_dbdt.onCellDblClicked = openDashboard;
}
function showChartNotes(iid, notes) {
@ -855,9 +892,7 @@ function showDashboards(data) {
if (j === "IsChart")
r[j] = { DisplayValue: r["IsChart"] ? "Chart" : "Dashboard", Value: r[j] };
}
var fr = { Values: r };
rows.push(fr);
rows.push(r);
}
grid_dbdt.setData(rows);
@ -897,7 +932,7 @@ function openDashboard() {
return;
}
var dah = grid_dbdt.source[index].Values;
var dah = grid_dbdt.source[index];
if (dah.IsChart.Value) {
setRecentOpenedDashboard(dah.ID);
$('#dialog_dashboards').hideDialog();

View File

@ -1,6 +1,6 @@

var $layoutcolumnselector = function (grid) {
this.title = GetTextByKey("P_GRID_XXXXXX", 'Layout');
this.title = GetTextByKey("P_GL_LAYOUT", 'Layout');
this.dialogId = 'dialog_layouts';
$("#" + this.dialogId).remove();
this.grid = grid;
@ -16,24 +16,27 @@ var $layoutcolumnselector = function (grid) {
function initColumnsGrid(parent) {
var divheader = $("<div style='font-size:14px;background-color:#fafafa;'></div>").appendTo(parent);
var tbheader = $("<table style='width:100%;'></table>").appendTo(divheader);
var tbheader = $("<table style='width:100%;border-collapse: collapse;'></table>").appendTo(divheader);
var trheader = $("<tr></tr>").appendTo(tbheader);
trheader.append();
var td = $("<td style='width:30px'></td>");
trheader.append(td);
$("<input type='checkbox' />").appendTo(td).on('click', function (e) {
tbdata.find("input[type='checkbox']:enabled").prop("checked", $(e.target).prop("checked"));
tbdata.find(".chkselected:enabled").prop("checked", $(e.target).prop("checked")).trigger('change');
});
trheader.append($("<td style='width:220px'></td>").text(GetTextByKey("P_GRID_COLUMN", "Column")));
trheader.append($("<td style='width:220px'></td>").text(GetTextByKey("P_GRID_CAPTION", "Caption")));
trheader.append($("<td></td>").text(GetTextByKey("P_XXXXXX", "Width")));
trheader.append($("<td style='width:90px'></td>").text(GetTextByKey("P_GL_WIDTH", "Width")));
trheader.append($("<td style='font-family:FontAwesome; padding-left: 5px; width: 33px; cursor: default'></td>").text('\uf2dc').attr('title', GetTextByKey("P_GRID_FREEZECOLUMNS", "Freeze Columns")));
trheader.append($("<td style='font-family:FontAwesome; padding-left: 5px; width: 33px; cursor: default'></td>").text('\uf362').attr('title', GetTextByKey("P_GRID_WRAPTEXT", "Wrap Text")));
trheader.append($("<td style='font-family:FontAwesome; padding-left: 5px; cursor: default'></td>").text('\uf7a4').attr('title', GetTextByKey("P_GRID_MAXLINES", "Maximum Rows Displayed for Wrapped Text")));
var divdata = $("<div style=' height: 400px; overflow: auto;line-height:30px;'></div>").appendTo(parent);
tbdata = $("<table style='width:100%;'></table>").appendTo(divdata);
tbdata = $("<table style='width:100%;border-collapse: collapse;'></table>").appendTo(divdata);
}
function createDialog() {
var dialog = $('<div class="dialog" style="display: none; width: 605px; height: 610px;min-width: 560px;line-height:30px;">').attr('id', this.dialogId);
var dialog = $('<div class="dialog" style="display: none; width: 720px; height: 610px;min-width: 560px;line-height:30px;">').attr('id', this.dialogId);
var title = $('<div class="dialog-title"></div>').appendTo(dialog);
title.append($('<span class="title"></span>').text(this.title));
@ -45,22 +48,22 @@ var $layoutcolumnselector = function (grid) {
txtSearch && txtSearch.val("");
showdata.call(_this, false);
}).appendTo(layoutOptionDiv);
$("<label for='rdoCurrentLayout'></label>").text(GetTextByKey("P_XXXXXX", "Show Current Layout")).appendTo(layoutOptionDiv);
$("<label for='rdoCurrentLayout'></label>").text(GetTextByKey("P_GL_SHOWCURRENTLAYOUT", "Show Current Layout")).appendTo(layoutOptionDiv);
var rdoDefaultLayout = $("<input type='radio' id='rdoDefaultLayout' name='layoutoption' style='margin-left:60px;' />").on('click', function () {
txtSearch && txtSearch.val("");
showdata.call(_this, true);
}).appendTo(layoutOptionDiv);
$("<label for='rdoDefaultLayout'></label>").text(GetTextByKey("P_XXXXXX", "Show Default Layout")).appendTo(layoutOptionDiv);
$("<label for='rdoDefaultLayout'></label>").text(GetTextByKey("P_GL_SHOWDEFAULTLAYOUT", "Show Default Layout")).appendTo(layoutOptionDiv);
var chkDisplayedOnly = $("<input type='checkbox' id='chkDisplayedOnly' name='layoutoption' style='margin-left:60px;' />").on('click', function () {
searchColumns(txtSearch.val().trim());
}).appendTo(layoutOptionDiv);
$("<label for='chkDisplayedOnly'></label>").text(GetTextByKey("P_XXXXXX", "Displayed Only")).appendTo(layoutOptionDiv);
$("<label for='chkDisplayedOnly'></label>").text(GetTextByKey("P_GL_DISPLAYEDONLY", "Displayed Only")).appendTo(layoutOptionDiv);
$('<div style="margin-left:20px;"></div>').text(GetTextByKey("P_XXXXXX", "To move columns, drag and drop on column name.")).appendTo(dialog);
$('<div style="margin-left:20px;"></div>').text(GetTextByKey("P_GL_TOMOVECOLUMNSDRAGANDDROPONCOLUMNNAME", "To move columns, drag and drop on column name.")).appendTo(dialog);
var searchDiv = $('<div style="margin-left:10px;margin-right:10px;"></div>').appendTo(dialog);
var txtSearch = $("<input type='text' style='margin-left: 7px;width:95%;' />").appendTo(searchDiv);
txtSearch.attr("placeholder", GetTextByKey("P_XXXXXX", "Search Columns"));
txtSearch.attr("placeholder", GetTextByKey("P_GL_SEARCHCOLUMNS", "Search Columns"));
txtSearch.on('input propertychange', function () {
searchColumns($(this).val().trim());
});
@ -68,7 +71,7 @@ var $layoutcolumnselector = function (grid) {
searchColumns($(this).val().trim());
});
var columnListDiv = $('<div style="width: 580px; height: 440px; margin: 5px 10px 4px 10px;overflow:auto;"></div>').appendTo(dialog);
var columnListDiv = $('<div style="width: 700px; height: 440px; margin: 5px 10px 4px 10px;overflow:auto;"></div>').appendTo(dialog);
var dialogFunction = $('<div class="dialog-func"></div>').appendTo(dialog);
$('<input type="button" value="' + GetTextByKey("P_GRID_CANCEL", "Cancel") + '" class="dialog-close" />').appendTo(dialogFunction);
@ -135,21 +138,29 @@ var $layoutcolumnselector = function (grid) {
var dc = this.grid.allcolumns[j];
dc = $.extend(true, {}, dc);
dc.OriginalCaption = dc.caption;
dc.OriginalCaption = typeof (dc.caption) === "function" ? dc.name : dc.caption;
dc.UserCaption = "";
dc.Width = dc.width;
dc.Selected = dc.visible !== false;
dc.IsFixed = false;
dc.Wrap = false;
dc.MaxLines = 0;
tmpColumns.push(dc);
}
}
else if (this.grid.columns && this.grid.columns.length > 0) {
var fixedindex = this.grid.columns.findLastIndex((c) => c.isfixed === true);
for (var i = 0; i < this.grid.columns.length; i++) {
var cc = $.extend(true, {}, this.grid.columns[i]);
cc.OriginalCaption = typeof (cc.caption) === "function" ? cc.name : cc.OriginalCaption;
//if (!cc.alwaysshow) {
cc.Width = cc.width;
cc.Selected = cc.visible !== false;
cc.IsFixed = i == fixedindex;
cc.Wrap = cc.contentWrap;
cc.MaxLines = cc.maxLines;
tmpColumns.push(cc);
//}
}
@ -158,20 +169,15 @@ var $layoutcolumnselector = function (grid) {
var dc = this.grid.allcolumns[j];
//if (dc.alwaysshow) continue;
var selected = false;
for (var i = 0; i < tmpColumns.length; i++) {
var tc = tmpColumns[i];
if (tc.name == dc.name) {
selected = true;
break;
}
}
if (!selected) {
var isnew = tmpColumns.find(function (tc) { return tc.name == dc.name }) == null;
if (isnew) {
dc = $.extend(true, {}, dc);
dc.OriginalCaption = dc.caption;
dc.OriginalCaption = typeof (dc.caption) === "function" ? dc.name : dc.caption;
dc.UserCaption = "";
dc.Width = dc.width;
dc.Selected = false;
dc.Wrap = false;
dc.MaxLines = 0;
tmpColumns.push(dc);
}
}
@ -185,31 +191,69 @@ var $layoutcolumnselector = function (grid) {
var tr = $("<tr></tr>").appendTo(tbdata).data("rowInfo", rowInfo);
var td = $("<td style='width:30px'></td>").appendTo(tr);
rowInfo.chkSelected = $("<input type='checkbox' />").appendTo(td);
rowInfo.chkSelected = $("<input type='checkbox' class='chkselected' />").appendTo(td);
rowInfo.chkSelected.prop("checked", c.Selected);
if (c.alwaysshow)
rowInfo.chkSelected.prop("checked", true).prop("disabled", true);
//rowInfo.chkSelected.on('change', tr, function (e) {
// var selptr = e.data;
// var checked = $(e.target).prop("checked");
// var isfixed = selptr.data("rowInfo").chkIsFixed.prop("checked");
// if (!checked && isfixed) {
// selptr.data("rowInfo").chkIsFixed.prop("checked", false).trigger('change');
// }
//});
td = $("<td style='width:220px'></td>").appendTo(tr);
rowInfo.txtOriginalCaption = $("<span></span>").appendTo(td);
rowInfo.txtOriginalCaption.text(c.alwaysshow ? c.text : c.OriginalCaption);
if (c.name === "Selected")
rowInfo.txtOriginalCaption.text('\uf0c8');
var iconname = "";
if (c.alwaysshow)
rowInfo.txtOriginalCaption.addClass('icon-col').css('cursor', 'default');
iconname = c.text;
else
rowInfo.txtOriginalCaption.text(c.OriginalCaption);
if (c.name === "Selected")
iconname = 'square';
if (c.alwaysshow) {
rowInfo.txtOriginalCaption.addClass('cell-icon').css('cursor', 'default');
var icon = libui.createIcon('fa-light', iconname);
rowInfo.txtOriginalCaption.append(icon);
}
td = $("<td style='width:220px'></td>").appendTo(tr);
rowInfo.txtCaption = $("<input type='text' style='width:210px' maxlength='200' />").appendTo(td);
rowInfo.txtCaption = $("<input type='text' style='width:210px;background-color:transparent;' maxlength='200' />").appendTo(td);
rowInfo.txtCaption.val(c.UserCaption);
if (c.alwaysshow)
rowInfo.txtCaption.prop("disabled", true);
td = $("<td></td>").appendTo(tr);
rowInfo.txtWidth = $("<input type='text' style='width:70px' maxlength='6' />").appendTo(td);
rowInfo.txtWidth.val(c.Width || c.width);
td = $("<td style='width:90px'></td>").appendTo(tr);
rowInfo.txtWidth = $("<input type='text' style='width:70px;background-color:transparent;' maxlength='6' />").appendTo(td);
rowInfo.txtWidth.val(c.Width);
if (c.alwaysshow)
rowInfo.txtWidth.prop("disabled", true);
td = $("<td></td>").appendTo(tr);
rowInfo.chkIsFixed = $("<input type='checkbox' class='chkfixed' />").appendTo(td);
rowInfo.chkIsFixed.prop("checked", c.IsFixed);
rowInfo.chkIsFixed.on('change', tr, function (e) {
var target = $(e.target);
var checked = target.prop("checked");
if (checked) {
tbdata.find('.chkfixed:checked').each(function () {
if (!$(this).is(target))
$(this).prop('checked', false);
});
}
});
td = $('<td></td>').appendTo(tr);
rowInfo.chkWrap = $('<input type="checkbox" />').appendTo(td);
rowInfo.chkWrap.prop('checked', c.Wrap);
td = $("<td style='width:40px'></td>").appendTo(tr);
rowInfo.txtMaxLines = $("<input type='text' style='width:20px;background-color:transparent;' maxlength='2' />").appendTo(td);
rowInfo.txtMaxLines.val(c.MaxLines > 0 ? String(c.MaxLines) : '');
if (c.name !== "Selected")
bindDrag(tr);
}
@ -234,6 +278,7 @@ var $layoutcolumnselector = function (grid) {
var t = $(this);
if (t.is(draggingrow))
return;
var t = $(this);
var after = e.originalEvent.clientY > t.offset().top + t.height() / 2;
if (after) {
@ -251,6 +296,16 @@ var $layoutcolumnselector = function (grid) {
for (var i = 0; i < trs.length; i++) {
var tr = $(trs[i]);
var rowInfo = tr.data("rowInfo");
var width = $.trim(rowInfo.txtWidth.val());
if (isNaN(width) || width <= 0) {
showAlert(GetTextByKey('P_GRID_INVALIDWIDTH', 'Column width is invalid.'), GetTextByKey('P_GL_LAYOUT', 'Layout'));
return;
}
var maxLines = $.trim(rowInfo.txtMaxLines.val());
if (maxLines != '' && (isNaN(maxLines) || maxLines <= 0)) {
showAlert(GetTextByKey('P_GRID_INVALIDMAXLINES', 'Column max lines is invalid.'), GetTextByKey('P_GL_LAYOUT', 'Layout'));
return;
}
var col = rowInfo.ColumnData;
if (rowInfo) {
var sort = 0;
@ -260,8 +315,11 @@ var $layoutcolumnselector = function (grid) {
'Visible': rowInfo.chkSelected.prop("checked"),
'ColumnKey': col.name,
'Caption': $.trim(rowInfo.txtCaption.val()),
'Width': $.trim(rowInfo.txtWidth.val()),
'Sort': sort
'Width': width,
'IsFixed': rowInfo.chkIsFixed.prop("checked"),
'Sort': sort,
'Wrap': rowInfo.chkWrap.prop('checked'),
'MaxLines': maxLines
}
if (isNaN(colinfo.Width) || eval(colinfo.Width) <= 0)
colinfo.Width = col.width;
@ -270,7 +328,7 @@ var $layoutcolumnselector = function (grid) {
}
if (colinfos.length == 0) {
showAlert(GetTextByKey("P_GRID_PLEASESELECTATLEASTONECOLUMN", "Please select at least one column."), GetTextByKey("P_GRID_XXXXXX", 'Layout'));
showAlert(GetTextByKey("P_GRID_PLEASESELECTATLEASTONECOLUMN", "Please select at least one column."), GetTextByKey("P_GL_LAYOUT", 'Layout'));
return;
}
@ -279,7 +337,7 @@ var $layoutcolumnselector = function (grid) {
})();
var $layoutsavedialog = function (grid, layoutid, type) {
this.title = GetTextByKey("P_GRID_XXXXXX", 'Save Layout');
this.title = GetTextByKey("P_GL_SAVELAYOUT", 'Save Layout');
this.type = type;
this.dialogId = 'dialog_savelayout';
$("#" + this.dialogId).remove();
@ -321,15 +379,15 @@ var $layoutsavedialog = function (grid, layoutid, type) {
};
function createSaveLayoutDialog() {
var dialog = $('<div class="dialog" style="display: none; width: 440px; height: 220px;min-width:440px;line-height:30px;">').attr('id', this.dialogId);
var dialog = $('<div class="dialog" style="display: none; width: 440px; min-width:440px;line-height:30px;">').attr('id', this.dialogId);
var title = $('<div class="dialog-title"></div>').appendTo(dialog);
title.append($('<span class="title"></span>').text(this.title));
title.append('<em class="dialog-close"></em>');
var layoutNameDiv = $('<div style="margin-left:10px;margin-right:10px;margin-top:10px;"></div>').appendTo(dialog);
layoutNameDiv.append($('<span style="margin-left:10px;"></span>').text(GetTextByKey("P_XXXXXX", "Layout Name:")));
txtLayoutName = $("<input type='text' style='width:320px;margin-left:5px;' maxlength='200' />").appendTo(layoutNameDiv);
layoutNameDiv.append($('<span style="margin-left:10px;"></span>').text(GetTextByKey("P_GL_LAYOUTNAME_COLON", "Layout Name:")));
txtLayoutName = $("<input type='text' style='width:285px;margin-left:5px;' maxlength='200' />").appendTo(layoutNameDiv);
if (currentLayout && this.type == 1) {//type == 1 在列表上直接保存
if (!currentLayout.IsPublic || IsAdmin)
txtLayoutName.val(currentLayout.LayoutName || "");
@ -337,16 +395,16 @@ var $layoutsavedialog = function (grid, layoutid, type) {
var layoutAttrDiv = $('<div style="margin-left:10px;margin-right:10px;"></div>').appendTo(dialog);
chkMyDefault = $("<input type='checkbox' id='chkMyDefault' style='margin-left: 83px;' />").appendTo(layoutAttrDiv);
$("<label for='chkMyDefault'></label>").text(GetTextByKey("P_XXXXXX", "Save as my Default")).appendTo(layoutAttrDiv);
$("<label for='chkMyDefault'></label>").text(GetTextByKey("P_GL_SAVEASMYDEFAULT", "Save as my Default")).appendTo(layoutAttrDiv);
if (IsAdmin) {
layoutAttrDiv = $('<div style="margin-left:10px;margin-right:10px;"></div>').appendTo(dialog);
chkPublic = $("<input type='checkbox' id='chkPublic' style='margin-left: 83px;' />").appendTo(layoutAttrDiv);
$("<label for='chkPublic'></label>").text(GetTextByKey("P_XXXXXX", "Make Public")).appendTo(layoutAttrDiv);
$("<label for='chkPublic'></label>").text(GetTextByKey("P_GL_MAKEPUBLIC", "Make Public")).appendTo(layoutAttrDiv);
layoutAttrDiv = $('<div style="margin-left:10px;margin-right:10px;"></div>').appendTo(dialog);
chkCompanyDefault = $("<input type='checkbox' id='chkCompanyDefault' style='margin-left: 83px;' />").appendTo(layoutAttrDiv);
$("<label for='chkCompanyDefault'></label>").text(GetTextByKey("P_XXXXXX", "Save as Company Default")).appendTo(layoutAttrDiv);
$("<label for='chkCompanyDefault'></label>").text(GetTextByKey("P_GL_SAVEASCOMPANYDEFAULT", "Save as Company Default")).appendTo(layoutAttrDiv);
chkMyDefault.on('click', function (e) {
if (chkMyDefault.prop("checked")) {
@ -385,7 +443,7 @@ var $layoutsavedialog = function (grid, layoutid, type) {
var dialogFunction = $('<div class="dialog-func"></div>').appendTo(dialog);
$('<input type="button" value="' + GetTextByKey("P_GRID_CANCEL", "Cancel") + '" class="dialog-close" />').appendTo(dialogFunction);
$('<input type="button" value="' + GetTextByKey("P_GRID_XXXXXX", "Save Layout") + '" />').on('click', onSaveLayoutClick.bind(this)).appendTo(dialogFunction);
$('<input type="button" value="' + GetTextByKey("P_GL_SAVELAYOUT", "Save Layout") + '" />').on('click', onSaveLayoutClick.bind(this)).appendTo(dialogFunction);
$('<div class="clear"></div>').appendTo(dialogFunction);
$('<div class="maskbg" style="display: none"></div>').appendTo(dialog);
@ -402,7 +460,7 @@ var $layoutsavedialog = function (grid, layoutid, type) {
IsPublic: chkPublic == null ? false : chkPublic.prop("checked"),
};
if (!layoutinfo.LayoutName || layoutinfo.LayoutName.trim() == '') {
showAlert(GetTextByKey("P_GRID_XXXXXX", "Layout name is required."), GetTextByKey("P_GRID_XXXXXX", 'Layout'));
showAlert(GetTextByKey("P_GL_LAYOUTNAMEISREQUIRED", "Layout name is required."), GetTextByKey("P_GL_LAYOUT", 'Layout'));
return;
}
if (layoutinfo.IsPublic)
@ -444,7 +502,7 @@ var $layoutsavedialog = function (grid, layoutid, type) {
}
if (priLayouts.length > 0) {
text += GetTextByKey("P_XXXXXX", "My Saved Layouts");
text += GetTextByKey("P_GL_MYSAVEDLAYOUTS", "My Saved Layouts");
for (var i = 0; i < priLayouts.length; i++) {
var item = priLayouts[i];
text += "<br/>&nbsp;&nbsp;&nbsp;&nbsp;" + item.LayoutName + (item.IsDefault ? " *" : "");
@ -455,7 +513,7 @@ var $layoutsavedialog = function (grid, layoutid, type) {
if (pubLayouts.length > 0) {
if (text != "")
text += "<br/>";
text += GetTextByKey("P_XXXXXX", "Company Layouts");
text += GetTextByKey("P_GL_COMPANYLAYOUTS", "Company Layouts");
for (var i = 0; i < pubLayouts.length; i++) {
var item = pubLayouts[i];
text += "<br/>&nbsp;&nbsp;&nbsp;&nbsp;" + item.LayoutName + (item.IsDefault ? " *" : "");
@ -474,7 +532,7 @@ var $layoutsavedialog = function (grid, layoutid, type) {
var $managelayoutdialog = function (layoutid) {
this.title = GetTextByKey("P_GRID_XXXXXX", 'Manage Layout');
this.title = GetTextByKey("P_GL_MANAGELAYOUT", 'Manage Layout');
this.dialogId = 'dialog_managelayout';
$("#" + this.dialogId).remove();
this.layoutid = layoutid;
@ -520,12 +578,12 @@ var $managelayoutdialog = function (layoutid) {
var content = $('<div style="height: 360px;overflow:auto;">').appendTo(dialog);
var labelDiv = $('<div style="margin-left:10px;margin-right:10px;margin-top:10px;"></div>').appendTo(content);
labelDiv.append($('<span style="margin-left:10px;"></span>').text(GetTextByKey("P_XXXXXX", "My Saved Layouts")));
labelDiv.append($('<span style="margin-left:10px;"></span>').text(GetTextByKey("P_GL_MYSAVEDLAYOUTS", "My Saved Layouts")));
myLayoutsDiv = $('<div style="margin-left:10px;margin-right:10px;margin-top:10px;"></div>').appendTo(content);
if (IsAdmin) {
labelDiv = $('<div style="margin-left:10px;margin-right:10px;margin-top:10px;"></div>').appendTo(content);
labelDiv.append($('<span style="margin-left:10px;"></span>').text(GetTextByKey("P_XXXXXX", "Company Layouts")));
labelDiv.append($('<span style="margin-left:10px;"></span>').text(GetTextByKey("P_GL_COMPANYLAYOUTS", "Company Layouts")));
companyLayoutsDiv = $('<div style="margin-left:10px;margin-right:10px;margin-top:10px;"></div>').appendTo(content);
}
@ -589,8 +647,8 @@ var $managelayoutdialog = function (layoutid) {
}
function deleteLayout(id, div) {
var msg = GetTextByKey("P_GRID_XXXXXX", 'Are you sure you want to delete this layout?');
var title = GetTextByKey("P_GRID_XXXXXX", 'Layout');
var msg = GetTextByKey("P_GL_AREYOUSUREYOUWANTTODELETETHISLAYOUT", 'Are you sure you want to delete this layout?');
var title = GetTextByKey("P_GL_LAYOUT", 'Layout');
showLayoutConfirm(_this.dialog, msg, title, function (e) {
div.remove();
_network.commonpagequery(9, id, function (data) { }, function (e) { });
@ -618,17 +676,17 @@ function CreateLayoutMenus(sender, layoutid, grid) {
var ulmenus = $('<ul class="lefttitlemenu_ul" style="line-height:32px;max-height:480px;max-width:400px; overflow: hidden auto;"></ul>');
funmenu.append(ulmenus);
var li = $('<li style="line-height:32px;"></li>').text(GetTextByKey("P_GRID_XXXXXX", 'Update Layout'));
var li = $('<li style="line-height:32px;"></li>').text(GetTextByKey("P_GL_UPDATELAYOUT", 'Update Layout'));
ulmenus.append(li);
li.on('click', function () {
ShowSelectLayoutColumnsDialog(layoutid, grid);
});
li = $('<li style="line-height:32px;"></li>').text(GetTextByKey("P_GRID_XXXXXX", 'Save Layout'));
li = $('<li style="line-height:32px;"></li>').text(GetTextByKey("P_GL_SAVELAYOUT", 'Save Layout'));
ulmenus.append(li);
li.on('click', function () {
ShowSaveLayoutDialog(null, null, layoutid, grid, 1);
});
li = $('<li style="line-height:32px;"></li>').text(GetTextByKey("P_GRID_XXXXXX", 'Manage Layout'));
li = $('<li style="line-height:32px;"></li>').text(GetTextByKey("P_GL_MANAGELAYOUT", 'Manage Layout'));
ulmenus.append(li);
li.on('click', function () {
ShowManageLayoutDialog(layoutid);
@ -768,17 +826,12 @@ function getGridLayout(layoutid, grid, next) {
function showGridLayout(grid, columninfos, next) {
var allColumns = $.extend(true, [], grid.allcolumns);
for (var i = 0; i < allColumns.length; i++) {
allColumns[i].OriginalCaption = allColumns[i].caption;
if (allColumns[i].alwaysshow && columninfos && columninfos.length > 0) {//new alwaysshow column
var exists = false;
for (var j = 0; j < columninfos.length; j++) {
if (allColumns[i].name == columninfos[j].ColumnKey) {
exists = true;
break;
}
}
if (!exists)
columninfos.push({ ColumnKey: allColumns[i].name, Caption: allColumns[i].caption, Width: allColumns[i].width });
var c = allColumns[i];
c.OriginalCaption = c.caption;
if (c.alwaysshow && columninfos && columninfos.length > 0) {//new alwaysshow column
var isnew = columninfos.find(function (ci) { return ci.ColumnKey == c.name }) == null;
if (isnew)
columninfos.push({ ColumnKey: c.name, Caption: c.caption, Width: c.width, Wrap: c.contentWrap, MaxLines: c.maxLines });
}
}
@ -786,9 +839,12 @@ function showGridLayout(grid, columninfos, next) {
var tmpColumns = allColumns;
if (columninfos && columninfos.length > 0) {
tmpColumns = [];
var fixedindex = columninfos.findLastIndex((c) => c.IsFixed === true);
for (var i = 0; i < columninfos.length; i++) {
var tmpcol = readColumnWidthSort(allColumns, columninfos[i]);
if (tmpcol) {
if (i <= fixedindex)
tmpcol.isfixed = true;
if (tmpcol.Sort != undefined && tmpcol.Sort != 0) {
if (grid.$refs && grid.$refs.grid) {//datagrid:vue
grid.$refs.grid.sortKey = tmpcol.name;
@ -799,8 +855,10 @@ function showGridLayout(grid, columninfos, next) {
grid.sortDirection = tmpcol.Sort;
}
}
if (tmpcol.name == "Selected")
if (tmpcol.name == "Selected") {
tmpcol.isfixed = true;
tmpColumns.splice(0, 0, tmpcol);
}
else
tmpColumns.push(tmpcol);
}
@ -819,18 +877,21 @@ function showGridLayout(grid, columninfos, next) {
}
}
function readColumnWidthSort(columns, colinfo) {
function readColumnWidthSort(columns, colinfo, fixedindex) {
for (var i = 0; i < columns.length; i++) {
if (columns[i].name == colinfo.ColumnKey) {
var c = columns[i];
if (c.name == colinfo.ColumnKey) {
if (colinfo.Caption && colinfo.Caption.trim() != "") {
columns[i].caption = colinfo.Caption;
columns[i].UserCaption = colinfo.Caption;
c.caption = colinfo.Caption;
c.UserCaption = colinfo.Caption;
}
columns[i].width = parseInt(colinfo.Width);
columns[i].Sort = colinfo.Sort;
if (columns[i].visible !== false || !columns[i].alwaysshow)
columns[i].visible = colinfo.Visible == undefined ? true : colinfo.Visible;
return columns[i];
c.width = parseInt(colinfo.Width);
c.Sort = colinfo.Sort;
if (c.visible !== false || !c.alwaysshow)
c.visible = colinfo.Visible == undefined ? true : colinfo.Visible;
c.contentWrap = colinfo.Wrap;
c.maxLines = colinfo.MaxLines;
return c;
}
}
return undefined;
@ -845,12 +906,12 @@ function saveGridLayout(dialog, layoutid, grid, layoutinfo, colinfos, next, over
layoutinfo.Layout = JSON.stringify(colinfos)
_network.commonpagequery(8, htmlencode(JSON.stringify([JSON.stringify(layoutinfo), overwrite ? 1 : 0])), function (e) {
if (e == -1) {
showAlert(GetTextByKey("P_GRID_XXXXXX", "Layout {0} is in use by the Organization and cannot be used. Please select another name.").replace('{0}', layoutinfo.LayoutName)
, GetTextByKey("P_GRID_XXXXXX", 'Layout'));
showAlert(GetTextByKey("P_GL_LAYOUTNAMEINUSE", "Layout {0} is in use by the Organization and cannot be used. Please select another name.").replace('{0}', layoutinfo.LayoutName)
, GetTextByKey("P_GL_LAYOUT", 'Layout'));
}
else if (e == -2) {
showLayoutConfirm(dialog, GetTextByKey('P_GRID_XXXXXX', 'Layout {0} already exists, Do you want to overwrite it?').replace('{0}', layoutinfo.LayoutName)
, GetTextByKey('P_GRID_XXXXXX', 'Layout'), function () {
showLayoutConfirm(dialog, GetTextByKey('P_GL_LAYOUTNAMEEXISTS', 'Layout {0} already exists, Do you want to overwrite it?').replace('{0}', layoutinfo.LayoutName)
, GetTextByKey('P_GL_LAYOUT', 'Layout'), function () {
saveGridLayout(dialog, layoutid, grid, layoutinfo, colinfos, next, true);
});
}
@ -868,7 +929,9 @@ function saveGridLayout(dialog, layoutid, grid, layoutinfo, colinfos, next, over
function getLayoutOnGrid(grid) {
colinfos = [];
var fixedindex = grid.columns.findLastIndex((c) => c.isfixed === true);
for (var i = 0; i < grid.columns.length; i++) {
var c = grid.columns[i];
var sort = 0;
var sortKey = "";
var sortDirection = 0;
@ -880,16 +943,19 @@ function getLayoutOnGrid(grid) {
sortKey = grid.sortKey;
sortDirection = grid.sortDirection;
}
if (sortKey && (sortKey == grid.columns[i].name || sortKey == grid.columns[i].key))
if (sortKey && (sortKey == c.name || sortKey == c.key))
sort = sortDirection;
if (isNaN(sort))
sort = 0;
var columnwidth = {
'Visible': grid.columns[i].visible !== false,
'ColumnKey': grid.columns[i].name,
'Caption': grid.columns[i].UserCaption,
'Width': grid.columns[i].width,
'Sort': sort
'Visible': c.visible !== false,
'ColumnKey': c.name,
'Caption': c.UserCaption,
'Width': c.width,
'IsFixed': i == fixedindex,
'Sort': sort,
'Wrap': c.contentWrap,
'MaxLines': c.maxLines
}
colinfos.push(columnwidth);
}

View File

@ -195,8 +195,8 @@ if (typeof ($jobsitesummary) != "function") {
b = $('<b>' + GetTextByKey("P_MV_NOTES_COLON", "Notes:") + ' </b>');
div_summary.append(b);
var notes = (js.Notes && js.Notes !== "") ? replaceHtmlText(js.Notes) : "";
var label = $('<label></label>').html(notes);
//var notes = (js.Notes && js.Notes !== "") ? replaceHtmlText(js.Notes) : "";
var label = $('<label></label>').text(js.Notes || "");
div_summary.append(label).append(br);
}
}

File diff suppressed because one or more lines are too long

20
Site/js/lib/amrnb.js Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1
Site/js/lib/element.min.css vendored Normal file
View File

@ -0,0 +1 @@
.schedule-item-container fieldset{margin-top:10px;border-width:1px;border-radius:4px;border-color:var(--border-color)}.schedule-item-container fieldset legend,.schedule-item-container fieldset span{font-weight:400;font-size:var(--font-size);padding-left:8px;padding-right:6px;color:var(--color)}.schedule-item-container fieldset .ui-input{line-height:20px;height:20px}.schedule-item-container fieldset .schedule-item-monthly{margin-top:5px}.schedule-item-container fieldset .schedule-item-monthly .ui-input{width:40px}.schedule-item-container fieldset.schedule-item-daily-frequency .ui-input{vertical-align:top;margin-top:5px}.schedule-item-container fieldset .schedule-item-table{width:100%}.schedule-item-container fieldset .schedule-item-line-occur-every{display:flex;align-items:flex-start}.schedule-item-container fieldset .schedule-item-line-occur-every>.schedule-item-block>.scheldule-item-line{display:flex;align-items:center;margin-top:5px}.schedule-item-container fieldset .schedule-item-line-occur-every>.schedule-item-block>.scheldule-item-line>span{flex:1 1 auto}.schedule-item-container fieldset .schedule-item-line-occur-every>.schedule-item-block>.scheldule-item-line>.ui-input{margin-top:0}.schedule-item-container fieldset .schedule-item-line-occur-every>span{line-height:36px}.schedule-item-container fieldset .schedule-item-line-occur-every .ui-input{width:70px}.schedule-item-container fieldset .schedule-item-line-duration{display:flex;align-items:center;height:36px}.schedule-item-container fieldset .schedule-item-line>.schedule-item-placeholder{flex:1 1 auto}.schedule-item-container .schedule-item-frequency{margin-top:0}.schedule-item-container .schedule-item-frequency>.schedule-item-line{line-height:24px}.schedule-item-container .ui-drop-wrapper>.ui-drop-header{height:24px}

2
Site/js/lib/element.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
(function(i,c){typeof exports=="object"&&typeof module<"u"?c(exports):typeof define=="function"&&define.amd?define(["exports"],c):(i=typeof globalThis<"u"?globalThis:i||self,c(i["lib-utility"]={}))})(this,function(i){"use strict";function c(e,t,n){if(e==null)return;let r=`; domain=${location.host}; path=/`;if(n!=null){const l=new Date;l.setTime(l.getTime()+n*24*60*60*1e3),r+=`; expires=${l.toGMTString()}`}/^(https|wss):$/.test(location.protocol)&&(r+="; secure"),document.cookie=`${e}=${encodeURIComponent(t)}${r}`}function f(e){if(e==null)return null;e+="=";const t=document.cookie.split(";");for(let n of t)if(n=n.trim(),n.indexOf(e)===0)return decodeURIComponent(n.substring(e.length));return null}function k(e){c(e,"",-1)}function d(e){return/^(https?|wss?|ftp):/.test(e)||typeof consts>"u"?e:(consts.path||"")+e}function w(e,t={}){return fetch(d(e),{method:t.method||"GET",headers:{...t.customerHeaders,Accept:t.accept||"application/json"},signal:t.signal,cache:"default"})}function A(e,t,n={}){return t instanceof FormData||(typeof t!="string"&&(t=JSON.stringify(t)),n.customerHeaders==null&&(n.customerHeaders={}),n.customerHeaders["Content-Type"]==null&&(n.customerHeaders["Content-Type"]="application/json")),fetch(d(e),{method:n.method||"POST",headers:n.customerHeaders,body:t,signal:n.signal,cache:"no-cache"})}function O(e,t,n={}){return new Promise((r,l)=>{const a=new XMLHttpRequest;if(a.onreadystatechange=function(){this.readyState===XMLHttpRequest.DONE&&(this.status===200?r(this):l(`${this.status} ${this.statusText}: ${this.responseText}`))},typeof n.progress=="function"&&a.upload.addEventListener("progress",function(u){u.lengthComputable&&n.progress.call(this,u)},!1),a.open("POST",d(e)),n.customerHeaders!=null)for(let u of Object.entries(n.customerHeaders))a.setRequestHeader(u[0],u[1]);a.send(t)})}function o(e){return e==null||typeof e!="string"||e.length===0}function C(e,t,n){return o(e)||t==null?!1:(typeof t!="string"&&(t=String(t)),n?e.toLowerCase().indexOf(t.toLowerCase())>=0:e.indexOf(t)>=0)}function L(e,t){return o(e)||o(t)?!1:e.indexOf(t)===e.length-t.length}function N(e,t,n){return o(e)||isNaN(t)||t<=e.length?e:(n??" ").repeat(t-e.length)}function H(e){const t=/(http|ftp|https):\/\/.+?(\s|\r\n|\r|\n|\"|\'|\*|$)/g,n=e.match(t);if(e=m(e),(n==null?void 0:n.length)>0){const r=[];for(let l of n)l=l.replace(/["'\r\n ]/g,""),r.indexOf(l)<0&&r.push(l);for(let l of r)e=e.replaceAll(l,'<a target="_blank" href="'+l+'"><svg><use xlink:href="'+(typeof consts<"u"&&consts.path||"")+'fonts/fa-regular.svg#link"></use></svg></a>')}return e}function m(e){return e==null?"":String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll(`\r
(function(i,c){typeof exports=="object"&&typeof module<"u"?c(exports):typeof define=="function"&&define.amd?define(["exports"],c):(i=typeof globalThis<"u"?globalThis:i||self,c(i["lib-utility"]={}))})(this,function(i){"use strict";function c(e,t,n){if(e==null)return;let r=`; domain=${location.host}; path=/`;if(n!=null){const l=new Date;l.setTime(l.getTime()+n*24*60*60*1e3),r+=`; expires=${l.toGMTString()}`}/^(https|wss):$/.test(location.protocol)&&(r+="; secure"),document.cookie=`${e}=${encodeURIComponent(t)}${r}`}function f(e){if(e==null)return null;e+="=";const t=document.cookie.split(";");for(let n of t)if(n=n.trim(),n.startsWith(e))return decodeURIComponent(n.substring(e.length));return null}function $(e){c(e,"",-1)}function d(e){return/^(https?|wss?|ftp):/.test(e)||typeof consts>"u"?e:(consts.path||"")+e}function w(e,t={}){return fetch(d(e),{method:t.method||"GET",headers:{...t.customHeaders,Accept:t.accept??"application/json"},mode:t.mode,signal:t.signal,cache:"default"})}function A(e,t,n={}){return t instanceof FormData||(typeof t!="string"&&(t=JSON.stringify(t)),n.customHeaders==null&&(n.customHeaders={}),n.customHeaders["Content-Type"]==null&&(n.customHeaders["Content-Type"]="application/json")),fetch(d(e),{method:n.method||"POST",headers:n.customHeaders,body:t,signal:n.signal,cache:"no-cache"})}function C(e,t,n={}){return new Promise((r,l)=>{const a=new XMLHttpRequest;if(a.onreadystatechange=function(){this.readyState===XMLHttpRequest.DONE&&(this.status===200?r(this):l(`${this.status} ${this.statusText}: ${this.responseText}`))},typeof n.progress=="function"&&a.upload.addEventListener("progress",function(u){u.lengthComputable&&n.progress.call(this,u)},!1),a.open("POST",d(e)),n.customHeaders!=null)for(let u of Object.entries(n.customHeaders))a.setRequestHeader(u[0],u[1]);a.send(t)})}function o(e){return e==null||typeof e!="string"||e.length===0}function L(e,t,n){return o(e)||t==null?!1:(typeof t!="string"&&(t=String(t)),n?e.toLowerCase().includes(t.toLowerCase()):e.includes(t))}function N(e,t){return o(e)||o(t)?!1:e.endsWith(t)}function E(e,t,n){return o(e)||isNaN(t)||t<=e.length?e:(n??" ").repeat(t-e.length)}function H(e){const t=/(http|ftp|https):\/\/.+?(\s|\r\n|\r|\n|\"|\'|\*|$)/g,n=e.match(t);if(e=b(e),(n==null?void 0:n.length)>0){const r=[];for(let a of n)a=a.replace(/["'\r\n ]/g,""),r.indexOf(a)<0&&r.push(a);let l;typeof consts<"u"?l=consts.path:typeof _network<"u"?l=_network.root:typeof _net<"u"&&(l=_net.root);for(let a of r)e=e.replaceAll(a,`<a target="_blank" href="${a}"><svg><use xlink:href="${l||""}fonts/fa-regular.svg#link"></use></svg></a>`)}return e}function b(e){return e==null?"":String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll(`\r
`,"<br/>").replaceAll(`
`,"<br/>").replaceAll(" ","&nbsp;")}let g;function h(){var n,r;let e;switch(typeof consts<"u"&&(e=f((n=consts.cookie)==null?void 0:n.lang),o(e)&&(e=(r=consts.user)==null?void 0:r.language)),o(e)&&(e=f("lgid")),o(e)&&(e=navigator.language||"en-us"),e=e.toLowerCase().replace(/-/g,"_"),o(e)&&(e="en"),e){case"en":case"en_au":case"fr":case"zh_cn":return e}const t=e.split("_")[0];switch(t){case"en":case"fr":return t}return"en"}function T(e){return typeof consts<"u"?(consts.prefix||"")+`res_${e}`:`res_${e}`}async function v(e=""){const t=h(),r=await(await w(`language/${t}${e}`)).json();return localStorage.setItem(T(t),JSON.stringify(r)),r}async function p(e,t){(t==null||typeof consts>"u")&&(t=await v(e));const n=Number(consts.resver);return(isNaN(t.ver)||isNaN(n)||n>t.ver)&&(console.log(`found new language res version: ${t.ver} => ${n}`),t=await v(e)),Object.defineProperty(t,"r",{writable:!1,configurable:!1,enumerable:!1,value:function(r,l){return s(this,r,l)}}),g=t,t}function s(e,t,n){return e[t]??n}function S(e,t){for(let n of e.querySelectorAll("[data-lgid]")){const r=n.dataset.lgid;n.tagName==="INPUT"?n.value=s(t,r,n.value):n.innerText=s(t,r,n.innerText)}for(let n of e.querySelectorAll("[data-title-lgid]")){const r=n.dataset.titleLgid;n.setAttribute("title",s(t,r,n.getAttribute("title")))}for(let n of e.querySelectorAll("[data-placeholder-lgid]")){const r=n.dataset.placeholderLgid;n.setAttribute("placeholder",s(t,r,n.getAttribute("placeholder")))}}async function E(e=document.body,t={}){const n=h();let r=localStorage.getItem(T(n)),l;if(r!=null)try{r=JSON.parse(r),l=await p(t.template,r)}catch(a){console.error("error while parsing lgres, try refresh ...",a),l=await p(t.template)}else l=await p(t.template);try{return document.readyState==="loading"?await new Promise((a,u)=>{let $=setTimeout(()=>u("timeout"),3e4);document.addEventListener("DOMContentLoaded",()=>{clearTimeout($),$=void 0,typeof t.callback=="function"&&t.callback(l),S(e,l),a(l)})}):(typeof t.callback=="function"&&t.callback(l),S(e,l),l)}catch(a){console.error("error while loading language res ...",a)}}function y(e,t){return g!=null?s(g,e,t):t}const P={get current(){return h()},get unknownError(){return y("unknownError","An unknown error occurred, please contact the administrator.")},get savedSuccessfully(){return y("savedSuccessfully","Saved successfully.")}};let b=typeof globalThis<"u"?globalThis:self;function M(e){return!isNaN(e)&&e>0}function j(){return/mobile/i.test(navigator.userAgent)}function q(e,t=100,n=b,...r){if(e==null)return;e.tiid&&clearTimeout(e.tiid);const l=new Date;e.tdate==null||l-e.tdate>t?(e.apply(n,r),e.tdate=l):e.tiid=setTimeout(()=>e.apply(n,r),t)}function R(e,t=100,n=b,...r){e!=null&&(e.tiid&&clearTimeout(e.tiid),e.tiid=setTimeout(()=>e.apply(n,r),t))}function _(e){return(e>0?Math.floor:Math.ceil)(e)}function I(e){return/^\w[-\w.+]*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(e)}function U(e){return!!(/^[1-9]\d{9,}$/.test(e)||/^\+?[1-9][\d-]{9,}\d$/.test(e)&&/^[1-9]\d{9,}$/.test(e.replace("+","").replace(new RegExp("-","g"),"")))}i.contains=C,i.debounce=R,i.deleteCookie=k,i.endsWith=L,i.escapeHtml=m,i.formatUrl=H,i.get=w,i.getCookie=f,i.global=b,i.init=E,i.isEmail=I,i.isMobile=j,i.isPhone=U,i.isPositive=M,i.lang=P,i.nullOrEmpty=o,i.padStart=N,i.post=A,i.r=y,i.setCookie=c,i.throttle=q,i.truncate=_,i.upload=O,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
`,"<br/>").replaceAll(" ","&nbsp;")}function O(e){return e==null?"":(typeof e!="string"&&(e=String(e)),e.replace(/(=[A-Fa-f0-9]{2}){4}/g,t=>decodeURIComponent(t.replaceAll("=","%"))).replace(/&#x([0-9a-fA-F]{2,6});/g,(t,n)=>String.fromCodePoint(parseInt(n,16))))}let g;function p(){var n,r;let e;switch(typeof consts<"u"&&(e=f((n=consts.cookie)==null?void 0:n.lang),o(e)&&(e=(r=consts.user)==null?void 0:r.language)),o(e)&&(e=f("lgid")),o(e)&&(e=navigator.language||"en-us"),e=e.toLowerCase().replace(/-/g,"_"),o(e)&&(e="en"),e){case"en":case"en_au":case"fr":case"zh_cn":return e}const t=e.split("_")[0];switch(t){case"en":case"fr":return t}return"en"}function S(e){return typeof consts<"u"?(consts.prefix||"")+`res_${e}`:`res_${e}`}async function T(e=""){const t=p(),n=e.length>0?e.replace("{lgid}",t):`language/${t}`,l=await(await w(n)).json();return localStorage.setItem(S(t),JSON.stringify(l)),l}async function h(e,t){(t==null||typeof consts>"u")&&(t=await T(e));const n=Number(consts.resver);return(isNaN(t.ver)||isNaN(n)||n>t.ver)&&(console.log(`found new language res version: ${t.ver} => ${n}`),t=await T(e)),Object.defineProperty(t,"r",{writable:!1,configurable:!1,enumerable:!1,value:function(r,l){return s(this,r,l)}}),g=t,t}function s(e,t,n){return e[t]??n}function v(e,t){for(let n of e.querySelectorAll("[data-lgid]")){const r=n.dataset.lgid;n.tagName==="INPUT"?n.value=s(t,r,n.value):n.innerText=s(t,r,n.innerText)}for(let n of e.querySelectorAll("[data-title-lgid]")){const r=n.dataset.titleLgid;n.setAttribute("title",s(t,r,n.getAttribute("title")))}for(let n of e.querySelectorAll("[data-placeholder-lgid]")){const r=n.dataset.placeholderLgid;n.setAttribute("placeholder",s(t,r,n.getAttribute("placeholder")))}}async function P(e=document.body,t={}){const n=p();let r=localStorage.getItem(S(n)),l;if(r!=null)try{r=JSON.parse(r),l=await h(t.template,r)}catch(a){console.error("error while parsing lgres, try refresh ...",a),l=await h(t.template)}else l=await h(t.template);try{return document.readyState==="loading"?await new Promise((a,u)=>{let k=setTimeout(()=>u("timeout"),3e4);document.addEventListener("DOMContentLoaded",()=>{clearTimeout(k),k=void 0,typeof t.callback=="function"&&t.callback(l),v(e,l),a(l)})}):(typeof t.callback=="function"&&t.callback(l),v(e,l),l)}catch(a){console.error("error while loading language res ...",a)}}function y(e,t){return g!=null?s(g,e,t):t}const _={get current(){return p()},get unknownError(){return y("unknownError","An unknown error occurred, please contact the administrator.")},get savedSuccessfully(){return y("savedSuccessfully","Saved successfully.")}};let m=typeof globalThis<"u"?globalThis:self;function j(e){return!isNaN(e)&&e>0}function M(){return/mobile/i.test(navigator.userAgent)}function I(e,t=100,n=m,...r){if(e==null)return;e.tiid&&clearTimeout(e.tiid);const l=new Date;e.tdate==null||l-e.tdate>t?(e.apply(n,r),e.tdate=l):e.tiid=setTimeout(()=>e.apply(n,r),t)}function R(e,t=100,n=m,...r){e!=null&&(e.tiid&&clearTimeout(e.tiid),e.tiid=setTimeout(()=>e.apply(n,r),t))}function q(e){return(e>0?Math.floor:Math.ceil)(e)}function U(e){return/^\w[-\w.+]*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(e)}function D(e){return!!(/^[1-9]\d{9,}$/.test(e)||/^\+?[1-9][\d-]{9,}\d$/.test(e)&&/^[1-9]\d{9,}$/.test(e.replace("+","").replace(new RegExp("-","g"),"")))}i.contains=L,i.debounce=R,i.deleteCookie=$,i.endsWith=N,i.escapeEmoji=O,i.escapeHtml=b,i.formatUrl=H,i.get=w,i.getCookie=f,i.global=m,i.init=P,i.isEmail=U,i.isMobile=M,i.isPhone=D,i.isPositive=j,i.lang=_,i.nullOrEmpty=o,i.padStart=E,i.post=A,i.r=y,i.setCookie=c,i.throttle=I,i.truncate=q,i.upload=C,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
//# sourceMappingURL=utility.min.js.map

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -1,415 +0,0 @@
var ALL_TEXT = "(All)";
var ALL_VALUE = "@all";
$(function () {
// global event
}());
function showMapAlertLayer(data) {
var opt = $('<option></option>').val("").text("(None)");
var sel = $("#selMapAlertLayer");
sel.empty();
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);
sel.append(opt);
}
if (userParams && userParams.MapAlertLayer) {
sel.val(userParams.MapAlertLayer);
}
showMapAlertLayerDetail();
}
function showMapAlertLayerDetail() {
var mal = $("#selMapAlertLayer").find("option:selected").data("mal");
var tb = $("#tbLegend");
tb.empty();
var haspramameter = false;
if (mal && mal.Layers) {
//var tr = $("<tr></tr>");
//tb.append(tr);
//var td = $("<td class='mapalertlayertitle'></td>").html("Icon Definition").css("width", 100);
//tr.append(td);
//td = $("<td class='mapalertlayertitle'></td>").html("Alert Title").css("width", 150);
//tr.append(td);
for (var i = 0; i < mal.Layers.length; i++) {
var layer = mal.Layers[i];
if ((layer.CriteriaSQLParameters && layer.CriteriaSQLParameters.length > 0)
|| (layer.AlertSQLParameters && layer.AlertSQLParameters.length > 0))
haspramameter = true;
var tr = $("<tr style='border-bottom: 1px solid lightgray;'></tr>");
tb.append(tr);
if (layer.IconColor.length == 9)
layer.IconColor = "#" + layer.IconColor.substring(3);
var td = $("<td></td>").css("width", 30);
td.append($("<img></img>").attr("src", layer.LegendUrl).css({ "width": 18, "vertical-align": "middle" }));
//td.append($("<div></div>").css({ "background-color": layer.IconColor, "width": 24, "height": 16 }));
tr.append(td);
td = $("<td></td>").html(layer.Title).css({ "padding-left": 10, "width": 220 });
tr.append(td);
}
}
var staticlegend = ["InMotion", "StoppedOn", "StoppedOff", "CGain", "CLoss"];
var staticlegendtitle = ["In Motion", "Stopped On", "Stopped Off", "Connectivity Recovery", "Connectivity Loss"];
for (var i = 0; i < staticlegend.length; i++) {
var tr = $("<tr style='border-bottom: 1px solid lightgray;'></tr>");
tb.append(tr);
var url = userParams.MachineIconURL + "?legend=" + staticlegend[i];
var td = $("<td></td>").css("width", 30);
td.append($("<img></img>").attr("src", url).css({ "width": 18, "vertical-align": "middle" }));
tr.append(td);
td = $("<td></td>").html(staticlegendtitle[i]).css({ "padding-left": 10, "width": 220 });
tr.append(td);
}
var harshdrivinglegend = ["#ff3f48cc", "#ff00a8f3", "#fffff200", "#ffff7f27", "#ffec1c24"];
var harshdrivingtitle = ["Hard Acceleration", "Hard Brake", "Hard Turn", "Speeding: Low Severity", "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 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" }));
tr.append(td);
td = $("<td></td>").html(harshdrivingtitle[i]).css({ "padding-left": 10, "width": 220 });
tr.append(td);
}
if (haspramameter) {
$('#setparameter').css('display', '');
}
else {
$('#setparameter').css('display', 'none');
}
var right = $('#mapAlertLayerDiv').width() + 100;
$('#filterIconDiv').css('right', right);
}
function setParameterDatimeTimePicker(ipt) {
ipt.datetimepicker({
timepicker: false,
format: 'm/d/Y',
enterLikeTab: false,
onSelectDate: function (v, inp) {
var date = new DateFormatter().formatDate(v, 'm/d/Y 00:00:00');
inp.parent().data('val', [date]);
}
});
}
function getAlertLayerParameters() {
if (parameterinput.length > 0) {//更新参数选择的值
for (var l = 0; l < parameterinput.length; l++) {
var ipt = parameterinput[l];
var param = ipt.data("parameter");
if (ipt.data('commoninput'))
param.ParameterValue = ipt.val();
}
}
var mal = $("#selMapAlertLayer").find("option:selected").data("mal");
if (mal)
return mal.Layers;
return null;
}
var parameterinput = [];
var paramindex = -1;
function setAlertLayerParameters() {
parameterinput = [];
paramindex = -1;
var ul = $("#ul_parameter");
ul.empty();
var pdiv = $("#parameter_right");
pdiv.empty();
var mal = $("#selMapAlertLayer").find("option:selected").data("mal");
var layerHasParam = 0;
if (mal && mal.Layers) {
for (var i = 0; i < mal.Layers.length; i++) {
var layer = mal.Layers[i];
var criteriaparam = layer.CriteriaSQLParameters;
var alertparam = layer.AlertSQLParameters;
if (layer && (criteriaparam || alertparam)) {
var li = $("<li class='nav_item'></li>").data("layerid", layer.ID).click(layerHasParam++, layerclick);
if (layer.IconColor.length == 9)
layer.IconColor = "#" + layer.IconColor.substring(3);
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" });
li.append(img).append(span);
ul.append(li);
var tb = $("<table class='tb_parameter'></table>").data("layerid", layer.ID);
if (layerHasParam == 1)
li.addClass("selected");
else
tb.css('display', 'none');
pdiv.append(tb);
if (criteriaparam && criteriaparam.length > 0)
createParameters(criteriaparam, tb, 1);
if (alertparam && alertparam.length > 0)
createParameters(alertparam, tb, 2);
}
}
}
}
function createParameters(params, tb, type) {
var tr = $("<tr></tr>").append("<td colspan='2' style='padding-left:10px;font-weight:bold;font-size:16px;'>Criteria</td>");
tb.append(tr);
for (var j = 0; j < params.length; j++) {
var param = params[j];
var tr_param = $("<tr></tr>");
tb.append(tr_param);
tr_param.append($("<td></td>").addClass('td_paramtype').html(param.Caption));
var td = $("<td></td>");
var ipt = createParameterInput(param, type, j);
parameterinput.push(ipt);
if (param.DataType == 3 && param.DisplayStyle != 1 && param.DisplayStyle != 2) {
setParameterDatimeTimePicker(ipt);
}
td.append(ipt);
tr_param.append(td);
}
}
function FALSE() { return false; }
function createParameterInput(param, type) {
var paramvalue = getParameterValue(param.ID, type);
if (paramvalue == null)
paramvalue = param.DefaultValue;
if (param.DisplayStyle == 0) {//inputbox
return $("<input type='text' />").val(paramvalue).data("parameter", param).data('commoninput', true)
.attr("paramcaption", param.Name.toLowerCase())
.keyup(function () {
$("[paramcaption='" + param.Name.toLowerCase() + "']").val($(this).val());
}).change(function () {
$("[paramcaption='" + param.Name.toLowerCase() + "']").val($(this).val());
});
}
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-top:20px;margin-left:-1px;"></div>');
var ul = $('<ul></ul>');
divpanel.append(ul).mousedown(FALSE);
seldiv.append(span).append(spanimg).append(divpanel);
seldiv.mousedown(function () {
$('.div_panel').each(function () {
var t = $(this);
if (!t.is(divpanel))
t.css('display', 'none');
});
var display = divpanel.css('display');
if (display == 'none') {
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" 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"></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;
}
}
}
function getLookupDatasource(dsid) {
var mal = $("#selMapAlertLayer").find("option:selected").data("mal");
if (mal && mal.LookupDataSources) {
for (var i = 0; i < mal.LookupDataSources.length; i++) {
var ds = mal.LookupDataSources[i];
if (ds.ID.toLowerCase() == dsid.toLowerCase())
return ds;
}
}
return null;
}
function layerclick(e) {
$('#ul_parameter li').removeClass("selected");
$(this).addClass("selected");
var index = e.data;
var tbs = $('.tb_parameter');
tbs.hide();
$(tbs[index]).show();
}
function getParameterValue(paramid, paramtype) {
if (parametervalues && parametervalues.length > 0) {
for (var i = 0; i < parametervalues.length; i++) {
var layer = parametervalues[i];
var params;
if (paramtype == 1)
params = layer.CriteriaSQLParameters;
else
params = layer.AlertSQLParameters;
if (layer && (params || params)) {
for (var j = 0; j < params.length; j++) {
var param = params[j];
if (param.ID == paramid)
return param.ParameterValue;
}
}
}
}
return null;
}
function openSetAlertLayerParameters() {
setAlertLayerParameters();
showmaskbg(true);
$('#dialog_parameter .dialog-title span.title').text('Pivots');
$('#dialog_parameter')
.attr('act', 'edit')
.css({
'width': 570,
'top': (document.documentElement.clientHeight - $('#dialog_parameter').height()) / 4,
'left': (document.documentElement.clientWidth - $('#dialog_parameter').width()) / 2
})
.showDialog();
pivotsDialogOpend = true;
}
var parametervalues;
function setParameterCompleted() {
parametervalues = getAlertLayerParameters();
machineObject.searchMachine(false);
$('#dialog_parameter').hideDialog();
showmaskbg(false);
pivotsDialogOpend = false;
}

View File

@ -110,7 +110,7 @@ if (typeof $mapcontrol !== 'object') {
$("#basemapGallery").hide();
});
var basemap = "topo";
$("#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"));
var basemapGallery = new BasemapGalleryC({
@ -123,7 +123,7 @@ if (typeof $mapcontrol !== 'object') {
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);
@ -132,7 +132,7 @@ if (typeof $mapcontrol !== 'object') {
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);
@ -142,7 +142,7 @@ if (typeof $mapcontrol !== 'object') {
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);

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"));

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

File diff suppressed because one or more lines are too long

View File

@ -205,6 +205,14 @@
else {
msg.Message = htmlencode(msg.Message);
}
if (msg.Message.indexOf("\r\n") > -1) {
var reg = new RegExp("\r\n", "g");
msg.Message = msg.Message.replace(reg, "<br/>");
}
if (msg.Message.indexOf("\n") > -1) {
var reg = new RegExp("\n", "g");
msg.Message = msg.Message.replace(reg, "<br/>");
}
}
vusermsg.reload(data);
}

View File

@ -15,7 +15,7 @@ if (typeof _fleet !== 'object') {
return 'zh-TW';
case 'pt-br':
return 'pt-BR';
case 'pt-pt':
case 'pt':
return 'pt-PT';
default:
return lang.split('-')[0];
@ -96,6 +96,58 @@ if (typeof _network !== 'object') {
_network.mainpagequery = function (method, param, callback, error, nolog) {
_network.request("IronIntelMain.aspx?tp=ashx", -1, method, param, callback, error, nolog);
}
_network.apiget = function (url, custid, data, callback, error, nolog) {
$.ajax({
url: url,
headers: { 'CustId': custid },
type: 'GET',
dataType: 'text',
//contentType: 'text/plain',
cache: false,
data: data,
async: true,
xhrFields: {
withCredentials: true
},
success: callback,
error: function (request, textStatus, errorThrown) {
if (error)
error(request, textStatus, errorThrown);
if (!nolog) {
if (request && request.readyState == 0)
console.log(request);
else
writelog_ironintel("_network.apiget", url + "." + JSON.stringify(data), JSON.stringify(request), textStatus + errorThrown);
}
}
});
}
_network.apipost = function (url, custid, data, callback, error, nolog) {
$.ajax({
url: url,
headers: { 'CustId': custid },
type: 'POST',
dataType: 'text',
contentType: 'text/plain',
cache: false,
data: typeof data === 'string' ? data : JSON.stringify(data),
async: true,
xhrFields: {
withCredentials: true
},
success: callback,
error: function (request, textStatus, errorThrown) {
if (error)
error(request, textStatus, errorThrown);
if (!nolog) {
if (request && request.readyState == 0)
console.log(request);
else
writelog_ironintel("_network.apiget", url + "." + JSON.stringify(data), JSON.stringify(request), textStatus + errorThrown);
}
}
});
}
function getFilterHandlerURL() {
if (typeof sitePath !== 'string')
@ -223,7 +275,7 @@ if (typeof $websocket !== 'function') {
function dragTitle(ev) {
if (ev.target && ev.target.nodeName === 'EM')
return false;
return;
var dialog = ev.data;
@ -258,7 +310,7 @@ if (typeof $websocket !== 'function') {
e.cancelBubble = true;
};
return false;
return;
}
$.fn.dialog = function (closefunc, removable) {
@ -457,9 +509,17 @@ if (typeof $websocket !== 'function') {
this.hide();
};
function clearDropdowns() {
function clearDropdowns(flag) {
var dropdownpanel = $('.dropdown-wrapper .dropdown-panel.active');
dropdownpanel.removeClass('active');
if (flag) {
$('.dropdown-panel-sep.active').removeClass('active');
//var activeSeps = $('.dropdown-panel-sep.active');
//if (activeSeps.length > 0) {
// activeSeps.removeClass('active');
// //setTimeout(function () { activeSeps.remove(); }, 1000);
//}
}
var dd = dropdownpanel.parent().data('dropdown');
if (dd && dd.multiselect && dd.oncollapsed)
dd.oncollapsed();
@ -467,7 +527,7 @@ if (typeof $websocket !== 'function') {
$(function () {
$(document)
.on('mousedown.dropdown', clearDropdowns)
.on('mousedown.dropdown', '.dropdown-wrapper .dropdown-panel', function (e) { e.stopPropagation() });
.on('mousedown.dropdown', '.dropdown-wrapper .dropdown-panel, .dropdown-panel-sep', function (e) { e.stopPropagation() });
});
var Dropdown = function () { };
@ -477,7 +537,7 @@ if (typeof $websocket !== 'function') {
var list;
var checkbox = li.children('input');
if (checkbox.attr('isall') == '1') {
li.parent().find('input').prop('checked', this.__isallchecked = checkbox.prop('checked'));
li.parent().find('input:enabled').prop('checked', this.__isallchecked = checkbox.prop('checked'));
list = [];
} else {
if (checkbox.prop('checked')) {
@ -522,11 +582,14 @@ if (typeof $websocket !== 'function') {
var scrolled = null;
var valueKey = this.valueKey;
var textKey = this.textKey;
var enableKey = this.enableKey;
var htmlKey = this.htmlKey;
var multiselect = this.multiselect;
var allowselectall = this.allowselectall !== false;
var search = this.search;
var This = this;
var allchecked = this.__isallchecked;
if (multiselect) { // && source == this.source
if (multiselect && allowselectall) { // && source == this.source
var liall = $('<li></li>');
list.append(liall.append(
$('<input type="checkbox" isall="1"></input>').prop('checked', allchecked).on('change', function () { triggerMultiSelect.call(This, liall) }),
@ -534,7 +597,7 @@ if (typeof $websocket !== 'function') {
));
}
for (var i = 0; i < source.length; i++) {
if (i >= 200) break;
if (search && i >= 200) break;
var item = source[i];
var li = $('<li></li>').data('item', item).attr({
'value': item[valueKey],
@ -549,8 +612,17 @@ if (typeof $websocket !== 'function') {
lbl = $('<label></label>').text(item[textKey]);
}
var chkbox = $('<input type="checkbox" class="dataitem"></input>');
if (allchecked || selectedlist.filter(function (s) { return s[valueKey] === item[valueKey] }).length > 0) {
if (item.__selected)
chkbox.prop('checked', true);
if (item.sublevel > 0)
chkbox.css("margin-left", "" + (20 * item.sublevel) + "px");
if (allchecked || selectedlist.filter(function (s) { return s[valueKey] === item[valueKey] }).length > 0) {
if (!enableKey || item[enableKey] !== false)
chkbox.prop('checked', true);
}
if (enableKey) {
var enable = item[enableKey];
chkbox.prop('disabled', enable === false);
}
!function (l) {
chkbox.on('change', function () {
@ -585,14 +657,18 @@ if (typeof $websocket !== 'function') {
options = {};
}
this.multiselect = options.multiselect;
this.allowselectall = options.allowselectall;
this.search = options.search;
this.parent = options.parent;
this.textKey = options.textKey || 'text';
this.valueKey = options.valueKey || 'value';
this.enableKey = options.enableKey;
this.htmlKey = options.htmlKey || 'html';
this.searchKeys = options.searchKeys;
this.disabled = options.disabled || false;
this.maxlength = options.maxlength || 500;
this.miniWidth = options.miniWidth || false;
this.holder = options.holder;
this.searchPlaceholder = options.searchPlaceholder || (GetTextByKey('P_WO_SEARCH', 'Search') + '...');
var container = $('<div class="dropdown-wrapper"></div>');
container.data('dropdown', this);
@ -703,7 +779,7 @@ if (typeof $websocket !== 'function') {
}
var valueKey = this.valueKey;
var textKey = this.textKey;
var itemlist = this.source.filter(function (i) { return selectedlist.indexOf(i[valueKey]) >= 0 });
var itemlist = this.source.filter(function (i) { i.__selected = selectedlist.indexOf(i[valueKey]) >= 0; return selectedlist.indexOf(i[valueKey]) >= 0 });
if (itemlist.length == 0) {
this.label.removeData('selectedlist').html('&nbsp;');
return false;
@ -733,6 +809,7 @@ if (typeof $websocket !== 'function') {
var This = this;
var textKey = this.textKey;
var valueKey = this.valueKey;
var enableKey = this.enableKey;
var searchKeys = this.searchKeys;
if (!searchKeys || searchKeys.length == 0) searchKeys = [textKey];
if (this.dropdownContainer == null) {
@ -757,7 +834,7 @@ if (typeof $websocket !== 'function') {
source = source.filter(function (i) {
for (var k = 0; k < searchKeys.length; k++) {
var text = i[searchKeys[k]].toLowerCase();
if (text.indexOf(key) >= 0) return true;
if (i.__selected || text.indexOf(key) >= 0) return true;
}
return false;
});
@ -771,18 +848,28 @@ if (typeof $websocket !== 'function') {
var list = $('<ul class="dropdown-list"></ul>');
if (this.multiselect) {
list.on('mouseup', function (e) {
var li = $(e.target);
if (li.is('input[type="checkbox"]')) {
var t = $(e.target);
var li = t;
if (t.is('input[type="checkbox"]') || t.is('label'))
li = t.parent();
var item = li.data('item');
if (t.is('input[type="checkbox"]')) {
if (item)
item.__selected = !t.prop('checked');
return;
}
if (li.is('label')) {
li = li.parent();
if (item && enableKey && item[enableKey] === false) {
return;
}
if (li.is('li')) {
e.preventDefault();
var checkbox = li.children('input[type="checkbox"]');
var checked = !checkbox.prop('checked');
checkbox.prop('checked', checked);
if (checkbox.attr("isall") !== "1")
item.__selected = checked;
triggerMultiSelect.call(This, li);
}
});
@ -791,7 +878,7 @@ if (typeof $websocket !== 'function') {
var li = $(e.target);
if (li.is('li')) {
var item = li.data('item');
clearDropdowns();
clearDropdowns(true);
if (item[textKey] == null || String(item[textKey]).trim() == '') {
This.label.data('selected', item).val(item[valueKey]).html('&nbsp;');
} else {
@ -808,7 +895,12 @@ if (typeof $websocket !== 'function') {
}
panel.append(list);
this.dropdownContainer = panel;
this.container.append(panel);
if (this.holder instanceof $) {
panel.addClass('dropdown-panel-sep');
this.holder.append(panel);
} else {
this.container.append(panel);
}
}
var source = this.source;
if (typeof this.sourceFilter === 'function') {
@ -834,6 +926,15 @@ if (typeof $websocket !== 'function') {
this.dropdownContainer.css('margin-top', '').removeClass('slide-up');
}
this.dropdownContainer.css('min-width', this.container.width() + 2);
if (this.miniWidth) {
this.dropdownContainer.css('width', this.container.width() + 2);
}
if (this.holder != null) {
this.dropdownContainer.offset({
'top': offset.top + 28,
'left': offset.left
});
}
this.dropdownContainer.addClass('active');
var panel = this.dropdownContainer;
setTimeout(function () { panel.children('.dropdown-search').children('input[type="text"]').focus().val("") }, 120);
@ -863,11 +964,20 @@ if (typeof $websocket !== 'function') {
return this;
};
$.fn.dropdownDisabled = function (flag) {
this.data('dropdown').setDisabled(flag);
var dropdown = this.data('dropdown');
if (!dropdown) return;
dropdown.setDisabled(flag);
return this;
};
$.fn.dropdownItem = function () {
var dropdown = this.data('dropdown');
if (!dropdown) return;
var item = dropdown.selected;
return item;
};
$.fn.dropdownVal = function (value) {
var dropdown = this.data('dropdown');
if (!dropdown) return;
if (value === void 0) {
var item = dropdown.selected;
return item && item[dropdown.valueKey];
@ -881,6 +991,7 @@ if (typeof $websocket !== 'function') {
};
$.fn.dropdownVals = function (list) {
var dropdown = this.data('dropdown');
if (!dropdown) return;
if (list === void 0) {
if (dropdown == null) {
return [];
@ -888,14 +999,44 @@ if (typeof $websocket !== 'function') {
var list = dropdown.selectedlist;
return list.map(function (it) { return it[dropdown.valueKey] });
}
dropdown.__isallchecked = false;
dropdown.selectlist(list);
return this;
};
$.fn.dropdownTexts = function () {
var dropdown = this.data('dropdown');
if (dropdown == null) {
return [];
}
var list = dropdown.selectedlist;
return list.map(function (it) { return it[dropdown.textKey] });
};
$.fn.dropdownSource = function (source) {
this.data('dropdown').setSource(source);
var dropdown = this.data('dropdown');
if (!dropdown) return;
dropdown.setSource(source);
return this;
};
$.fn.allselected = function (checked) {
var dropdown = this.data('dropdown');
if (!dropdown) return;
if (checked === void 0) {
return dropdown.__isallchecked;
}
dropdown.__isallchecked = checked;
dropdown.label.text(GetTextByKey('P_GRID_ALL', '(All)'));
//this.find('input[isall="1"]').prop('checked', checked).change();
return this;
};
$.fn.allowselectall = function (checked) {
var dropdown = this.data('dropdown');
if (!dropdown) return;
if (checked === void 0) {
return dropdown.allowselectall;
}
dropdown.allowselectall = checked;
return this;
};
})();
if (typeof _dialog !== 'object') {
@ -1148,6 +1289,16 @@ function checkPhoneNumber(num) {
return false;
}
function convertDateFormat(dateString) {
const date = new Date(dateString);
const month = date.getMonth() + 1; //月份是从0开始的
const day = date.getDate();
const year = date.getFullYear();
// 使用两位数表示月份和日期
return `${year}-${month.toString().padStart(2, '0')}-${day.toString().padStart(2, '0')}`;
}
function getInnerOffset(ele) {
// _this.chartDiv.offset().left - (_this.container ? _this.getContainer().offset().left : 0) + _this.getContainer().scrollLeft();
//var offset = ele.offset();
@ -1447,6 +1598,22 @@ $.isGuid = function (v) {
return /^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$/.test(v);
}
$.generateUUID = function () {
var d = new Date().getTime();
var d2 = ((typeof performance !== 'undefined') && performance.now && (performance.now() * 1000)) || 0;
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16;
if (d > 0) {
r = (d + r) % 16 | 0;
d = Math.floor(d / 16);
} else {
r = (d2 + r) % 16 | 0;
d2 = Math.floor(d2 / 16);
}
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
});
};
function converthtmlurl(msg) {
if (msg == null) {
@ -1456,9 +1623,9 @@ function converthtmlurl(msg) {
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/ /g, '&nbsp;')
.replace(/(https?|ftp):\/\/[\w-_]+(\.[\w-_]+)+\/?[^\s\r\n"'$]*/g, '<a href="$&" target="_blank">$&</a>')
.replace(/\r\n/g, '<br/>')
.replace(/\n/g, '<br/>')
.replace(/(https?|ftp):\/\/[\w-_]+(\.[\w-_]+)+\/?[^\s\r\n"'\*$]*/g, '<a href="$&" target="_blank">$&</a>');
.replace(/\n/g, '<br/>');
//const p = /(http|ftp|https):\/\/.+?(\s|\r\n|\r|\n|\"|\'|\*|$)/g;
//var r = msg.match(p);
@ -1497,14 +1664,14 @@ function formatUrl(msg) {
//const urlReg = /(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?/ig;
//const urlArrray = str.match(urlReg);
const p = /(http|ftp|https):\/\/.+?(\s|\r\n|\r|\n|\"|\'|\*|$)/g;
const p = /(http|ftp|https):\/\/.+?(\<|\s|\r\n|\r|\n|\"|\'|$)/g;
var r = msg.match(p);
msg = htmlencode(msg);
var rs = [];
if (r && r.length > 0) {
for (var i = 0; i < r.length; i++) {
var t = r[i].replace("\"", "").replace("\'", "").replace("\r\n", "").replace("\r", "").replace("\n", "").replace(" ", "");
var t = r[i].replace("\"", "").replace("\'", "").replace("\r\n", "").replace("\r", "").replace("\n", "").replace(" ", "").replace("<", "");
if (rs.indexOf(t) < 0)
rs.push(htmlencode(t));
}
@ -1632,31 +1799,498 @@ function showConfirm(msg, title, fok, fcancel) {
}
}
function showConfirmYesNoCancel(msg, title, fok, fcancel, fclose) {
if (window.parent && typeof window.parent.showconfirm == 'function') {
window.parent.showConfirmYesNoCancel(msg, title, fok, fcancel, fclose);
} else {
showmaskbg(true);
_dialog.showConfirmYesNoCancel(msg, title, function (e) {
showmaskbg(false);
if (typeof fok === 'function') {
fok(e);
}
}, function () {
if (fcancel)
fcancel();
showmaskbg(false);
}, function () {
if (fclose)
fclose();
showmaskbg(false);
});
}
showmaskbg(true);
_dialog.showConfirmYesNoCancel(msg, title, function (e) {
showmaskbg(false);
if (typeof fok === 'function') {
fok(e);
}
}, function () {
if (fcancel)
fcancel();
showmaskbg(false);
}, function () {
if (fclose)
fclose();
showmaskbg(false);
});
}
function showConfirmOKCancel(msg, title, fok, fcancel, fclose) {
showmaskbg(true);
_dialog.showConfirmOKCancel(msg, title, function (e) {
showmaskbg(false);
if (typeof fok === 'function') {
fok(e);
}
}, function () {
if (fcancel)
fcancel();
showmaskbg(false);
}, function () {
if (fclose)
fclose();
showmaskbg(false);
});
}
function showAlert(msg, title, icon, next) {
if (window.parent && typeof window.parent.showalert == 'function') {
window.parent.showalert(msg, title, icon, next);
} else {
if (msg && msg.hasOwnProperty('LGID')) {
if (!msg.LGID.startWith('LHBIS_') && !msg.LGID.startWith('FI_HOST_')) {
msg.LGID = 'LHBIS_FIC_CLIENT_MODULES_' + msg.LGID;
}
msg = GetLanguageByKey(msg.LGID, msg.Default);
} else if (title === true) {
msg = msg.escapeHtml().replace(/\n/g, '<br/>');
title = undefined;
}
_dialog.showAlert(msg, title, icon, next);
}
}
}
function createGridView(parent, fulllang) {
var grid = new GridView(parent);
grid.langs = getGridLanguages(fulllang);
return grid;
}
function createGridView1(parent, fulllang) {
var grid = new GridView1(parent);
grid.langs = getGridLanguages(fulllang);
return grid;
}
function getGridLanguages(full) {
if (full) {
return {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset"),
null: GetTextByKey("P_GRID_NULL", "(Null)"),
// 内置多列排序面板中的资源
sort: GetTextByKey("P_GRID_SORT", "Sort"),
addLevel: GetTextByKey("P_GRID_ADDLEVEL", "Add Level"),
deleteLevel: GetTextByKey("P_GRID_DELETELEVEL", "Delete Level"),
copyLevel: GetTextByKey("P_GRID_COPYLEVEL", "Copy Level"),
column: GetTextByKey("P_GRID_COLUMN", "Column"),
order: GetTextByKey("P_GRID_ORDER", "Order"),
asc: GetTextByKey("P_GRID_ASC", "Ascending"),
desc: GetTextByKey("P_GRID_DESC", "Descending"),
cancel: GetTextByKey("P_GRID_CANCEL", "Cancel"),
duplicatePrompt: GetTextByKey("P_GRID_DUPLICATEPROMPT", "{column} is being sorted more than once. Delete the duplicate sort criteria and try again."),
requirePrompt: GetTextByKey("P_GRID_REQUIREPROMPT", "All sort criteria must have a column specified. Check the selected sort criteria and try again.")
};
}
return {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset"),
null: GetTextByKey("P_GRID_NULL", "(Null)")
};
}
function getdaytext(day) {
var text = day;
switch (day) {
case "Sunday":
text = GetTextByKey("P_CM_SUNDAY", "Sunday");
break;
case "Monday":
text = GetTextByKey("P_CM_MONDAY", "Monday");
break;
case "Tuesday":
text = GetTextByKey("P_CM_TUESDAY", "Tuesday");
break;
case "Wednesday":
text = GetTextByKey("P_CM_WEDNESDAY", "Wednesday");
break;
case "Thursday":
text = GetTextByKey("P_CM_THURSDAY", "Thursday");
break;
case "Friday":
text = GetTextByKey("P_CM_FRIDAY", "Friday");
break;
case "Saturday":
text = GetTextByKey("P_CM_SATURDAY", "Saturday");
break;
}
return text;
}
var libui = window['lib-ui'];
if (libui != null) {
var CheckboxColumn = Object.create(libui.GridCheckboxColumn, {
setValue: {
value: function (element, val) {
if (element.tagName !== 'LABEL') {
element.innerText = val;
} else {
Object.getPrototypeOf(this).setValue(element, val);
}
}
},
setEnabled: {
value: function (element, enabled) {
if (element.tagName === 'LABEL') {
Object.getPrototypeOf(this).setEnabled(element, enabled);
}
}
},
toString: {
value: function () { return 'Checkbox' }
}
});
var NoteColumn = Object.create(libui.GridColumn, {
canEdit: {
get: function () { return true }
},
create: {
value: function (col, index, grid) {
var flex = libui.createElement('div', 'cell-flex');
var iconedit = libui.createIcon('fa-light', 'pen');
iconedit.classList.add('cell-flex-icon');
iconedit.style.display = 'none';
flex.append(iconedit, libui.createElement('span', 'cell-flex-memo'));
if (!col.readonly) {
if (typeof col.onClicked === 'function') {
iconedit.addEventListener('click', function () {
var item = grid.source[grid.startIndex + index];
col.onClicked.call(col, item, flex);
});
}
}
return flex;
}
},
getElement: {
value: function (element) {
return element.children[1];
}
},
setValue: {
value: function (element, val) {
element.children[1].innerHTML = converthtmlurl(val || '');
}
},
//getValue: {
// value: function (e) {
// var label = e.target.querySelector('.cell-flex-memo');
// if (label != null) {
// return label.innerText;
// }
// return e.target.innerText;
// }
//},
setEditing: {
value: function (element, editing) {
var icon = element.children[0];
icon.style.display = editing && !icon.disabled ? '' : 'none';
}
},
setEnabled: {
value: function (element, enabled, editing) {
var icon = element.children[0];
icon.disabled = enabled === false;
icon.style.display = editing && enabled !== false ? '' : 'none';
}
},
toString: {
value: function () { return 'Note' }
}
});
var CommunicationColumn = Object.create(NoteColumn, {
create: {
value: function (col, index, grid) {
var flex = libui.createElement('div', 'cell-flex');
var span = libui.createElement('span', 'cell-flex-icon');
span.style.display = 'none';
span.title = GetTextByKey('P_WO_COMMUNICATIONACKNOWLEDGED', 'Communication Acknowledged');
var iconedit = libui.createIcon('fa-light', 'clipboard-check');
span.appendChild(iconedit);
flex.append(span, libui.createElement('span', 'cell-flex-memo'));
if (!col.readonly) {
if (typeof col.onClicked === 'function') {
iconedit.addEventListener('click', function () {
var item = grid.source[grid.startIndex + index];
col.onClicked.call(col, item, flex);
});
}
}
return flex;
}
},
setValue: {
value: function (element, val) {
element.children[1].innerHTML = window['lib-utility'].escapeEmoji(val || '');
}
},
toString: {
value: function () { return 'Communication' }
}
});
var ContactsColumn = Object.create(libui.GridColumn, {
create: {
value: function () {
return libui.createElement('span', 'span-contacts');
}
},
setValue: {
value: function (element, contacts) {
element.innerText = contacts.join('\n');
}
},
toString: {
value: function () { return 'Contacts' }
}
});
var ThumbnailUrlColumn = Object.create(libui.GridColumn, {
create: {
value: function () {
return libui.createElement('img', '');
}
},
setValue: {
value: function (element, val, vals, col) {
var filetype = vals.values.FileType;
var sdown = $(element);
if (imgTypes.indexOf(vals.values.FileType.toLowerCase()) >= 0) {
sdown.css('width', 30).css('height', 30).css('vertical-align', 'middle');
sdown.attr('src', vals.values.ThumbnailUrl);
}
else {
sdown.css('width', 30).css('height', 30).css('line-height', 40).css('vertical-align', 'middle');;
if ([".doc", ".docx"].indexOf(filetype) >= 0) {
sdown.attr('src', '../img/icon/word.jpg')
} else if ([".xls", ".xlsx"].indexOf(filetype) >= 0) {
sdown.attr('src', '../img/icon/excel.jpg')
} else if ([".ppt", ".pptx"].indexOf(filetype) >= 0) {
sdown.attr('src', '../img/icon/ppt.jpg')
} else if ([".pdf", ".xps"].indexOf(filetype) >= 0) {
sdown.attr('src', '../img/icon/pdf.jpg')
} else if ([".mp4", ".mov", ".avi", ".mkv", ".3gp", ".ts", ".m2ts"].indexOf(filetype) >= 0) {
sdown.attr('src', '../img/icon/vedio.jpg')
} else if ([".zip", ".rar", ".7z"].indexOf(filetype) >= 0) {
sdown.attr('src', '../img/icon/zip.jpg')
} else if ([".msg"].indexOf(filetype) >= 0) {
sdown.attr('src', '../img/icon/msg.jpg')
} else if ([".xml"].indexOf(filetype) >= 0) {
sdown.attr('src', '../img/icon/xml.jpg')
} else {
sdown.attr('src', '../img/icon/txt.jpg')
}
}
}
},
toString: {
value: function () { return 'Thumbnail' }
}
});
var SchedulesColumn = Object.create(libui.GridColumn, {
createCaption: {
value: function () {
if (!assetsObj?.HasSchedule) {
return;
}
var container = $('<span></span>').css({ position: 'relative', height: 26, width: '100%', display: 'block' });
var left = 0;
for (var i = 0; i < assetsObj.Labels.length; i++) {
var label = assetsObj.Labels[i];
var sp = $('<span class="span-caption"></span>').text(label.Key).css({ left: left });
left += parseInt(label.Value) * 5;
container.append(sp);
}
//grid_dt.resize();
//var totalDays = (led.getTime() - fbd.getTime()) / (1000 * 60 * 60 * 24);
//var interval = parseInt(totalDays / labelCount);
//if (totalDays % labelCount != 0)
// interval += 1;
//var d = new Date(assetsObj.BeginDate);
//var w = col.width / labelCount;
//for (var i = 0; i < labelCount; i++) {
// var label = new DateFormatter().formatDate(d, 'm/d/Y');
// var sp = $('<span class="span-caption"></span>').text(label).css({ left: w * i });
// container.append(sp);
// d = new Date(d.getTime() + interval * 1000 * 60 * 60 * 24);
//}
return container[0];
}
},
create: {
value: function () {
var container = document.createElement('div');
container.style.cssText = 'position: relative; height: 20px';
return container;
}
},
setValue: {
value: function (element, _val, row, col) {
element.replaceChildren();
var item = row.values;
if (item.ScheduleParts && assetsObj?.HasSchedule) {
var labelCount = 4;
var totalDays = assetsObj.TotalDays;
var interval = parseInt(totalDays / labelCount);
if (totalDays % labelCount != 0) {
interval += 1;
}
totalDays = interval * labelCount;
var d = new Date(assetsObj.BeginDate);
for (var i = 0; i < item.ScheduleParts.length; i++) {
var sp = item.ScheduleParts[i];
var bdate = new Date(sp.BeginDate);
var edate = new Date(sp.EndDate);
var l = (bdate.getTime() - d.getTime()) / (1000 * 60 * 60 * 24) / totalDays * col.width;
var w = (edate.getTime() - bdate.getTime()) / (1000 * 60 * 60 * 24) / totalDays * col.width;
var color = "";
if (sp.Schedules.length == 1) {
color = sp.Schedules[0].Color;
} else {
for (var j = 0; j < sp.Schedules.length; j++) {
if (color !== "")
color += ","
color += sp.Schedules[j].Color;
}
}
var df = new DateFormatter();
var title = df.formatDate(bdate, 'm/d/Y') + " - " + df.formatDate(new Date((edate.getTime() - 1000 * 60 * 60 * 24)), 'm/d/Y') + "\n";
for (var j = 0; j < sp.Schedules.length; j++) {
var bd = new Date(sp.Schedules[j].BeginDate);
var ed = new Date(sp.Schedules[j].EndDate);
title += sp.Schedules[j].JobSiteName + ": " + df.formatDate(bd, 'm/d/Y') + " - " + df.formatDate(ed, 'm/d/Y');
if (sp.Schedules[j].PointOfContact)
title += "\n " + GetTextByKey("P_JS_CONTACT_COLON", "Contact: ") + " " + sp.Schedules[j].PointOfContact;
if (sp.Schedules[j].Creator)
title += "\n " + GetTextByKey("P_JS_CREATOR_COLON", "Creator: ") + " " + sp.Schedules[j].Creator;
if (j != sp.Schedules.length - 1)
title += "\n";
}
var bar = libui.createElement('span', 'span-bar');
bar.style.cssText = 'left: ' + l + 'px; width: ' + Math.max(1, w - 1) + 'px; border-left: 1px solid transparent';
if (sp.Schedules.length == 1) {
bar.style.backgroundColor = color;
} else {
//bar.css("background", "url(img/gridline.jpg) repeat 20px 20px");
//bar.css("background", "linear-gradient(45deg," + color + ")");
//bar.css("background-image", "repeating-linear-gradient(45deg,white, white 5px,#ff9900 5px,#ff9900 7px)");
//bar.css("background-image", "repeating-linear-gradient(135deg,blue 1px, transparent 0), repeating-linear-gradient(45deg, red 1px, transparent 0)");
//bar.css("background-size", "5px 5px");
//bar.css("background-image", "url(\"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'><g fill='orange' fill-opacity='1'><path fill-rule='evenodd' d='M0 0h4v4H0V0zm4 4h4v4H4V4z'/></g></svg>\")");
bar.style.backgroundImage = "url(\"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'><g fill-opacity='0.5'><path d='M0 0L8 8z M0 8L8 0z' style='fill:white;stroke:gray;stroke-width:1'/></g></svg>\")";
}
bar.title = title;
if (!IsReadOnly && typeof col.onScheduleClicked === 'function') {
bar.addEventListener('dblclick', (function (sp) { return col.onScheduleClicked.bind(col, item, sp) })(sp));
}
element.append(bar);
}
}
}
},
toString: {
value: function () { return 'Schedules' }
}
});
var DispatchSchedulesColumn = Object.create(SchedulesColumn, {
createCaption: {
value: function (col) {
if (!dispatchAssetsObj?.HasSchedule) {
return;
}
var labelCount = 4;
var totalDays = dispatchAssetsObj.TotalDays;
var interval = parseInt(totalDays / labelCount);
if (totalDays % labelCount != 0) {
interval += 1;
}
var container = $('<span></span>').css({ position: 'relative', height: 26, width: '100%', display: 'block' });
var d = new Date(dispatchAssetsObj.BeginDate);
var w = col.width / labelCount;
for (var i = 0; i < labelCount; i++) {
var label = new DateFormatter().formatDate(d, 'm/d/Y');
var sp = $('<span class="span-caption"></span>').text(label).css({ left: w * i });
container.append(sp);
d = new Date(d.getTime() + interval * 1000 * 60 * 60 * 24);
}
return container[0];
}
},
setValue: {
value: function (element, _val, row, col) {
element.replaceChildren();
var item = row.values;
if (item.ScheduleParts && dispatchAssetsObj?.HasSchedule) {
var labelCount = 4;
var totalDays = dispatchAssetsObj.TotalDays;
var interval = parseInt(totalDays / labelCount);
if (totalDays % labelCount != 0) {
interval += 1;
}
totalDays = interval * labelCount;
var d = new Date(dispatchAssetsObj.BeginDate);
for (var i = 0; i < item.ScheduleParts.length; i++) {
var sp = item.ScheduleParts[i];
var bdate = new Date(sp.BeginDate);
var edate = new Date(sp.EndDate);
var l = (bdate.getTime() - d.getTime()) / (1000 * 60 * 60 * 24) / totalDays * col.width;
if (l < i + 1) {
l = i + 1;
}
var w = (edate.getTime() - bdate.getTime()) / (1000 * 60 * 60 * 24) / totalDays * col.width;
if (w < 1) {
w = 1;
}
var color = "";
if (sp.Schedules.length == 1) {
color = sp.Schedules[0].Color;
} else {
for (var j = 0; j < sp.Schedules.length; j++) {
if (color !== "")
color += ","
color += sp.Schedules[j].Color;
}
}
var title = "";
var df = new DateFormatter();
for (var j = 0; j < sp.Schedules.length; j++) {
var bd = new Date(sp.Schedules[j].BeginDate);
var ed = new Date(sp.Schedules[j].EndDate);
title += sp.Schedules[j].JobSiteName + ": " + df.formatDate(bd, 'm/d/Y') + " - " + df.formatDate(ed, 'm/d/Y');
if (j != sp.Schedules.length - 1) {
title += "\n";
}
}
var bar = libui.createElement('span', 'span-bar');
bar.style.cssText = 'left: ' + l + 'px; width: ' + w + 'px';
if (sp.Schedules.length == 1) {
bar.style.backgroundColor = color;
} else {
bar.style.backgroundImage = "url(\"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'><g fill-opacity='0.5'><path d='M0 0L8 8z M0 8L8 0z' style='fill:white;stroke:gray;stroke-width:1'/></g></svg>\")";
}
bar.title = title;
element.append(bar);
}
}
}
},
toString: {
value: function () { return 'DispatchSchedules' }
}
});
}