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

View File

@ -10,6 +10,7 @@ define(['modules/templates/template', 'modules/templates/addtemplate'], function
var makeinputcontrol = undefined;
var modelinputcontrol = undefined;
var typeinputcontrol = undefined;
var groupinputcontrol = undefined;
tps.createContent = function (args) {
sectiontype = 1;//sectiontype:0 - global,1 - normal
if (args && args.length > 0)
@ -35,15 +36,43 @@ define(['modules/templates/template', 'modules/templates/addtemplate'], function
});
search_bar.append(makeinputcontrol);
search_bar.append('<span style="margin-left:10px;">' + GetTextByKey("P_IPT_MODEL_COLON", "Model:") + '</span>');
modelinputcontrol = $('<select type="text" style="margin-left: 5px; width:160px;height:22px;" autocomplete="off" />');
search_bar.append(modelinputcontrol)
modelinputcontrol = $('<div></div>').css('width', 160).dropdown([], {
search: true,
multiselect: true,
allowselectall: true,
textKey: 'Name',
valueKey: 'ID',
parent: '#content'
});
search_bar.append(modelinputcontrol);
search_bar.append('<span style="margin-left:10px;">' + GetTextByKey("P_IPT_TYPE_COLON", "Type:") + '</span>');
typeinputcontrol = $('<select type="text" style="margin-left: 5px; width:160px;height:22px;" autocomplete="off" />');
search_bar.append(typeinputcontrol)
typeinputcontrol = $('<div></div>').css('width', 160).dropdown([], {
search: true,
multiselect: true,
allowselectall: true,
textKey: 'Name',
valueKey: 'ID',
parent: '#content'
});
search_bar.append(typeinputcontrol);
search_bar.append('<span style="margin-left:10px;">' + GetTextByKey("P_AM_ASSETGROUP_COLON", "Asset Group:") + '</span>');
groupinputcontrol = $('<div></div>').css('width', 160).dropdown([], {
search: true,
multiselect: true,
allowselectall: true,
textKey: 'Name',
valueKey: 'Id',
parent: '#content'
});
search_bar.append(groupinputcontrol);
getAssetMakes();
getAssetModels();
getAssetTypes();
getAssetGroups();
}
searchinputcontrol = $('<input type="text" autocomplete="off" style="margin-left:10px;" />');
@ -82,7 +111,6 @@ define(['modules/templates/template', 'modules/templates/addtemplate'], function
dataheader.append('<div class="question-cell" style="width:400px">' + GetTextByKey("P_IPT_NAME", "Name") + '</div>');
//dataheader.append('<div class="question-cell" style="width: 200px">Display Text</div>');
dataheader.append('<div class="question-cell" style="width:400px">' + GetTextByKey("P_IPT_NOTES", "Notes") + '</div>');
dataheader.append('<div class="question-cell" style="width:200px">' + GetTextByKey("P_IPT_CREATEDBY", "Created By") + '</div>');
dataheader.append('<div class="question-cell" style="width:90px;padding-right:20px;"></div>');
content.append(dataheader);
@ -104,16 +132,20 @@ define(['modules/templates/template', 'modules/templates/addtemplate'], function
var searchtxt = searchinputcontrol.val();
searchtxt = htmlencode(searchtxt);
var makeid = -1;
var modelid = -1;
var typeid = -1;
var modelids = [];
var typeids = [];
var groupids = [];
if (!teamintelligence) {
makeid = makeinputcontrol.val();
modelid = modelinputcontrol.val();
typeid = typeinputcontrol.val();
modelids = modelinputcontrol.dropdownVals();
typeids = typeinputcontrol.dropdownVals();
groupids = groupinputcontrol.dropdownVals();
}
var p = JSON.stringify([teamintelligence, templatestatus, searchtxt, makeid, modelid, typeid]);
var p = JSON.stringify([teamintelligence, templatestatus, searchtxt, makeid, JSON.stringify(modelids), JSON.stringify(typeids), JSON.stringify(groupids)]);
showloading(true);
inspectionrequest("GetTemplates", htmlencode(p), function (data) {
showloading(false);
datacontent.empty();
if (data) {
for (var i = 0; i < data.length; i++) {
@ -122,12 +154,14 @@ define(['modules/templates/template', 'modules/templates/addtemplate'], function
}
}
}, function (err) {
showloading(false);
});
}
var makesdata = undefined;
var modelsdata = undefined;
var typesdata = undefined;
var groupsdata = undefined;
function getAssetMakes() {
inspectionrequest("GetAssetMakes", "", function (data) {
if (data && data.length > 0) {
@ -160,6 +194,16 @@ define(['modules/templates/template', 'modules/templates/addtemplate'], function
});
}
function getAssetGroups() {
inspectionrequest("GetAssetGroups", "", function (data) {
if (data && data.length > 0) {
groupsdata = data;
showAssetGroups();
}
}, function (err) {
});
}
function showAssetMakes() {
makeinputcontrol.append('<option value="-1">*</option>');
if (makesdata && makesdata.length > 0) {
@ -172,31 +216,45 @@ define(['modules/templates/template', 'modules/templates/addtemplate'], function
}
function showAssetModels() {
modelinputcontrol.empty();
var makeid = makeinputcontrol.val();
modelinputcontrol.append('<option value="-1">*</option>');
if (!makeid || makeid == "-1")
modelinputcontrol.prop('disabled', true);
modelinputcontrol.dropdownDisabled(true);
else
modelinputcontrol.prop('disabled', false);
modelinputcontrol.dropdownDisabled(false);
var match_items = [];
if (modelsdata && modelsdata.length > 0 && makeid != "-1") {
for (var i = 0; i < modelsdata.length; i++) {
var item = modelsdata[i];
if (item.MakeID == parseInt(makeid)) {
modelinputcontrol.append('<option value="' + item.ID + '">' + item.Name + '</option>');
match_items.push(item);
}
}
}
modelinputcontrol.dropdownSource(match_items);
modelinputcontrol.dropdownVals([-1]);
}
function showAssetTypes() {
typeinputcontrol.append('<option value="-1">*</option>');
var match_items = [];
if (typesdata && typesdata.length > 0) {
for (var i = 0; i < typesdata.length; i++) {
var item = typesdata[i];
typeinputcontrol.append('<option value="' + item.Key + '">' + item.Value + '</option>');
match_items.push(typesdata[i]);
}
}
typeinputcontrol.dropdownSource(match_items);
}
function showAssetGroups() {
var match_items = [];
if (groupsdata && groupsdata.length > 0) {
for (var i = 0; i < groupsdata.length; i++) {
match_items.push(groupsdata[i]);
}
}
groupinputcontrol.dropdownSource(match_items);
}
return tps;
});