Commit 84a967d3 by NGO THI HONG

#19123 sort New report List, Continous Work, Warning List

parent 9daff73b
......@@ -184,9 +184,105 @@ CHK_pu.createNewReportList = function(operationList, isSearched = false) {
}
};
CHK_pu.sortContinousWorkList = function(operationList) {
var newOperationList = [];
for (var i = 0; i < operationList.length; i++) {
if (operationList[i].reportType === 3)
{
if(typeof operationList[i].processList === 'undefined' ) continue;
if (operationList[i].processList && operationList[i].processList.length != 0)
{
for( var j = 0; j < operationList[i].processList.length; j++ )
{
if(typeof operationList[i].processList[j].phaseList === 'undefined' ) continue;
for(var g = 0; g < operationList[i].processList[j].phaseList.length; g++ )
{
if(operationList[i].processList[j].phaseList[g].phaseStatus != 999)
{
var item = {reportType: operationList[i].reportType,
phaseList: operationList[i].processList[j].phaseList,
processKey: operationList[i].processList[j].processKey,
permitCodeRequiredFlg: operationList[i].permitCodeRequiredFlg,
operationId: operationList[i].operationId,
contentId: operationList[i].contentId,
operationName: operationList[i].operationName,
taskCode: operationList[i].processList[j].taskCode,
taskKey: operationList[i].processList[j].taskKey,
taskName: operationList[i].processList[j].taskName,
updateDate: operationList[i].processList[j].phaseList[g].updateDate,
phaseNo: operationList[i].processList[j].phaseList[g].phaseNo,
phaseName: operationList[i].processList[j].phaseList[g].phaseName
};
newOperationList.push(item);
}
}
}
}
}
}
newOperationList = newOperationList.sort(function(a,b) {
if (!a.updateDate) {
a.updateDate = "1900-01-01 09:00:00";
}
if (!b.updateDate) {
b.updateDate = "1900-01-01 09:00:00";
}
if (a.updateDate < b.updateDate) return 1;
if (a.updateDate > b.updateDate) return -1;
return 0;
});
console.log("newOperationList: " + JSON.stringify(newOperationList));
return newOperationList;
}
CHK_pu.createContinousWorkList = function(operationList, isSearched = false) {
CHK_pu.sortWarningList = function(operationList) {
var newOperationList = [];
for (var i = 0; i < operationList.length; i++) {
if(typeof operationList[i].warningReportList === 'undefined' ) continue;
if (operationList[i].warningReportList && operationList[i].warningReportList.length != 0)
{
for( var j = 0; j < operationList[i].warningReportList.length; j++ )
{
var item = {reportType: operationList[i].reportType,
permitCodeRequiredFlg: operationList[i].permitCodeRequiredFlg,
operationId: operationList[i].operationId,
contentId: operationList[i].contentId,
operationName: operationList[i].operationName,
taskCode: operationList[i].warningReportList[j].taskCode,
taskKey: operationList[i].warningReportList[j].taskKey,
taskName: operationList[i].warningReportList[j].taskName,
taskType: operationList[i].warningReportList[j].taskType,
updateDate: operationList[i].warningReportList[j].updateDate,
reportStartDateString: operationList[i].warningReportList[j].reportStartDateString,
reportEndDateString: operationList[i].warningReportList[j].reportEndDateString,
processKey: operationList[i].warningReportList[j].processKey,
phaseNo: operationList[i].warningReportList[j].phaseNo,
phaseName: operationList[i].warningReportList[j].phaseName
};
newOperationList.push(item);
}
}
}
newOperationList = newOperationList.sort(function(a,b) {
if (!a.updateDate) {
a.updateDate = "1900-01-01 09:00:00";
}
if (!b.updateDate) {
b.updateDate = "1900-01-01 09:00:00";
}
if (a.updateDate < b.updateDate) return 1;
if (a.updateDate > b.updateDate) return -1;
return 0;
});
console.log("newOperationList: " + JSON.stringify(newOperationList));
return newOperationList;
}
CHK_pu.createContinousWorkList = function(operationListOld, isSearched = false) {
var operationList = CHK_pu.sortContinousWorkList(operationListOld);
$("#continousWork-list").empty();
CHK_pu.countContinousWorkReport = 0;
if (typeof operationList === 'undefined' || operationList.length < 1) {
......@@ -194,47 +290,34 @@ CHK_pu.createContinousWorkList = function(operationList, isSearched = false) {
return;
}
$('#notFoundContinousWork').addClass('d-none');
for (var i = 0; i < operationList.length; i++) {
if (operationList[i].reportType === 3)
{
if (!operationList[i].processList || operationList[i].processList.length == 0) continue;
//TODO aタグlist.html 転移処理
for (var j = 0; j < operationList[i].processList.length; j++) {
for( var g = 0; g < operationList[i].processList[j].phaseList.length; g++)
{
if(operationList[i].processList[j].phaseList[g].phaseStatus != 999)
{
var messageli = $("<li class='item list-unstyled rounded border mb-2' id = 'list_" + operationList[i].processList[j].processKey + "'></li>") ;
var ahrefRequiredFlg ;
if (operationList[i].permitCodeRequiredFlg == 1)
{
ahrefRequiredFlg = $("<a href=\"javascript:CHK.displayAlert('onlyRfid');\" class='d-block px-3 py-3 text-decoration-none text-dark'></a>");
}
else
{
ahrefRequiredFlg = $("<a href=\"javascript:CHK_L.sendAppCommand('goOperation', '" + operationList[i].operationId + "', '" + operationList[i].contentId
+ " ', null ,'DETAIL_FORM_INPUT' ,'CONTINOUS_WORK','" + operationList[i].processList[j].processKey + "','" + operationList[i].processList[j].phaseList[g].phaseNo + "');\" class='d-block px-3 py-2 text-decoration-none text-dark'></a>");
}
var divTitle = $("<div class='title'>" + operationList[i].operationName + "</div>");
var divSubTitleWrap = $("<div class='sub-title-wrap'> </div>");
var iIcon = $("<i class='fas fa-chevron-right fs-12''></i>");
var divProccess = $("<div class='tag fs-8 text-secondary px-2 py-1 mr-2 rounded border mb-1'>" + operationList[i].processList[j].phaseList[g].phaseName + "</div>");
var divCode = $(" <div class='fs-8 text-secondary mr-2'><div class='data'>" + operationList[i].processList[j].taskCode + "</div></div>");
var divSubTitle = $("<div class='sub-title'>" + operationList[i].processList[j].taskName + "</div>");
divSubTitleWrap.append(divCode);
divSubTitleWrap.append(divSubTitle);
ahrefRequiredFlg.append(divProccess);
ahrefRequiredFlg.append(divTitle);
ahrefRequiredFlg.append(divSubTitleWrap);
ahrefRequiredFlg.append(iIcon);
messageli.append(ahrefRequiredFlg);
$("#continousWork-list").append(messageli);
CHK_pu.countContinousWorkReport = CHK_pu.countContinousWorkReport + 1;
}
}
}
}
var messageli = $("<li class='item list-unstyled rounded border mb-2' id = 'list_" + operationList[i].processKey + "'></li>") ;
var ahrefRequiredFlg ;
if (operationList[i].permitCodeRequiredFlg == 1)
{
ahrefRequiredFlg = $("<a href=\"javascript:CHK.displayAlert('onlyRfid');\" class='d-block px-3 py-3 text-decoration-none text-dark'></a>");
}
else
{
ahrefRequiredFlg = $("<a href=\"javascript:CHK_L.sendAppCommand('goOperation', '" + operationList[i].operationId + "', '" + operationList[i].contentId
+ " ', null ,'DETAIL_FORM_INPUT' ,'CONTINOUS_WORK','" + operationList[i].processKey + "','" + operationList[i].phaseNo + "');\" class='d-block px-3 py-2 text-decoration-none text-dark'></a>");
}
var divTitle = $("<div class='title'>" + operationList[i].operationName + "</div>");
var divSubTitleWrap = $("<div class='sub-title-wrap'> </div>");
var iIcon = $("<i class='fas fa-chevron-right fs-12''></i>");
var divProccess = $("<div class='tag fs-8 text-secondary px-2 py-1 mr-2 rounded border mb-1'>" + operationList[i].phaseName + "</div>");
var divCode = $(" <div class='fs-8 text-secondary mr-2'><div class='data'>" + operationList[i].taskCode + "</div></div>");
var divSubTitle = $("<div class='sub-title'>" + operationList[i].taskName + "</div>");
divSubTitleWrap.append(divCode);
divSubTitleWrap.append(divSubTitle);
ahrefRequiredFlg.append(divProccess);
ahrefRequiredFlg.append(divTitle);
ahrefRequiredFlg.append(divSubTitleWrap);
ahrefRequiredFlg.append(iIcon);
messageli.append(ahrefRequiredFlg);
$("#continousWork-list").append(messageli);
CHK_pu.countContinousWorkReport = CHK_pu.countContinousWorkReport + 1;
}
// show not found if
......@@ -248,7 +331,8 @@ CHK_pu.createContinousWorkList = function(operationList, isSearched = false) {
};
CHK_pu.createReportWithWarning = function(operationList, isSearched = false) {
CHK_pu.createReportWithWarning = function(operationListOld, isSearched = false) {
var operationList = CHK_pu.sortWarningList(operationListOld);
$("#reportWithWarning-list").empty();
CHK_pu.countReportWithWarning = 0;
......@@ -262,38 +346,34 @@ CHK_pu.createReportWithWarning = function(operationList, isSearched = false) {
var msgLevelAnswer = getMsg("reportLevelAnswer") ;
console.log("msgLevelAnswer :" + msgLevelAnswer);
for (var i = 0; i < operationList.length; i++) {
if(!operationList[i].warningReportList || operationList[i].warningReportList.length === 0) continue;
//TODO aタグlist.html 転移処理
var operationNameLi;
for (var j = 0; j < operationList[i].warningReportList.length; j++)
{
switch (operationList[i].reportType)
switch (operationList[i].reportType)
{
case 0:
operationNameLi = $("<li class='item list-unstyled rounded border mb-2' id = 'list_" + operationList[i].warningReportList[j].taskKey
operationNameLi = $("<li class='item list-unstyled rounded border mb-2' id = 'list_" + operationList[i].taskKey
+ "'><a href=\"javascript:CHK_L.sendAppCommand('goOperation', '" + operationList[i].operationId + "', '" + operationList[i].contentId
+ " ', null ,'DETAIL_FORM_INPUT' ,'REPORT_WARNING','" + operationList[i].warningReportList[j].taskKey + "');\" class='d-block px-3 py-2 text-decoration-none text-dark'>"
+ " ', null ,'DETAIL_FORM_INPUT' ,'REPORT_WARNING','" + operationList[i].taskKey + "');\" class='d-block px-3 py-2 text-decoration-none text-dark'>"
+"<div class='title'>" + operationList[i].operationName
+ "</div> <div class='sub-title-wrap'> <div class='fs-8 text-secondary mr-2'><div class='data'>" + operationList[i].warningReportList[j].taskCode
+ "</div></div> <div class='sub-title'>" + operationList[i].warningReportList[j].taskName
+ "</div> <div class='sub-title-wrap'> <div class='fs-8 text-secondary mr-2'><div class='data'>" + operationList[i].taskCode
+ "</div></div> <div class='sub-title'>" + operationList[i].taskName
+ "</div></div> <i class='fas fa-chevron-right fs-12'></i> </a></li>");
break;
case 1:
operationNameLi = $("<li class='item list-unstyled rounded border mb-2' id = 'list_" + operationList[i].warningReportList[j].taskKey
operationNameLi = $("<li class='item list-unstyled rounded border mb-2' id = 'list_" + operationList[i].taskKey
+ "'><a href=\"javascript:CHK_L.sendAppCommand('goOperation', '" + operationList[i].operationId + "', '" + operationList[i].contentId
+ " ', null ,'DETAIL_FORM_INPUT' ,'REPORT_WARNING','" + operationList[i].warningReportList[j].taskKey + "');\" class='d-block px-3 py-2 text-decoration-none text-dark'>"
+ " ', null ,'DETAIL_FORM_INPUT' ,'REPORT_WARNING','" + operationList[i].taskKey + "');\" class='d-block px-3 py-2 text-decoration-none text-dark'>"
+"<div class='title'>" + operationList[i].operationName
+ "</div> <div class='sub-title-wrap'> <div class='fs-8 text-secondary mr-2'><div class='sub-title'>" + CHK_pu.getInspectDate(operationList[i].warningReportList[j].reportStartDateString) + " ~ " + CHK_pu.getInspectDate(operationList[i].warningReportList[j].reportEndDateString)
+ "</div> <div class='sub-title-wrap'> <div class='fs-8 text-secondary mr-2'><div class='sub-title'>" + CHK_pu.getInspectDate(operationList[i].reportStartDateString) + " ~ " + CHK_pu.getInspectDate(operationList[i].reportEndDateString)
+ "</div></div> </div> <i class='fas fa-chevron-right fs-12'></i> </a></li>");
break;
case 2:
operationNameLi = $("<li class='item list-unstyled rounded border mb-2' id = 'list_" + operationList[i].warningReportList[j].taskKey + "'></li>");
operationNameLi = $("<li class='item list-unstyled rounded border mb-2' id = 'list_" + operationList[i].taskKey + "'></li>");
var ahrefRequiredFlg = $("<a href=\"javascript:CHK_L.sendAppCommand('goOperation', '" + operationList[i].operationId + "', '" + operationList[i].contentId
+ " ', null ,'DETAIL_FORM_INPUT' ,'REPORT_WARNING','" + operationList[i].warningReportList[j].taskKey + "','" + operationList[i].warningReportList[j].taskType + "');\" class='d-block px-3 py-2 text-decoration-none text-dark'></a>");
+ " ', null ,'DETAIL_FORM_INPUT' ,'REPORT_WARNING','" + operationList[i].taskKey + "','" + operationList[i].taskType + "');\" class='d-block px-3 py-2 text-decoration-none text-dark'></a>");
var liTagTitle = $("<div class='title'>" + operationList[i].operationName + "</div>") ;
var liTagReportType;
if( operationList[i].warningReportList[j].taskType == 0 )
if( operationList[i].taskType == 0 )
{
liTagReportType = $("<div class='tag fs-8 text-secondary px-2 py-1 mr-2 rounded border mb-1'>" + msgLevelReport + "</div>") ;
}
......@@ -302,8 +382,8 @@ CHK_pu.createReportWithWarning = function(operationList, isSearched = false) {
liTagReportType = $("<div class='tag fs-8 text-secondary px-2 py-1 mr-2 rounded border mb-1'>" + msgLevelAnswer + "</div>") ;
}
var divCode = $("<div class='sub-title-wrap'> <div class='fs-8 text-secondary mr-2'><div class='data'>" + operationList[i].warningReportList[j].taskCode
+ "</div></div> <div class='sub-title'>" + operationList[i].warningReportList[j].taskName + "</div></div>");
var divCode = $("<div class='sub-title-wrap'> <div class='fs-8 text-secondary mr-2'><div class='data'>" + operationList[i].taskCode
+ "</div></div> <div class='sub-title'>" + operationList[i].taskName + "</div></div>");
var iIcon = $("<i class='fas fa-chevron-right fs-12'></i>");
ahrefRequiredFlg.append(liTagReportType);
ahrefRequiredFlg.append(liTagTitle);
......@@ -312,21 +392,19 @@ CHK_pu.createReportWithWarning = function(operationList, isSearched = false) {
operationNameLi.append(ahrefRequiredFlg);
break;
case 3:
operationNameLi = $("<li class='item list-unstyled rounded border mb-2' id = 'list_" + operationList[i].warningReportList[j].taskKey
operationNameLi = $("<li class='item list-unstyled rounded border mb-2' id = 'list_" + operationList[i].taskKey
+ "'><a href=\"javascript:CHK_L.sendAppCommand('goOperation', '" + operationList[i].operationId + "', '" + operationList[i].contentId
+ " ', null ,'DETAIL_FORM_INPUT' ,'REPORT_WARNING','" + operationList[i].warningReportList[j].processKey + "','" + operationList[i].warningReportList[j].phaseNo + "');\" class='d-block px-3 py-2 text-decoration-none text-dark'>"
+"<div class='tag fs-8 text-secondary px-2 py-1 mr-2 rounded border mb-1'>" + operationList[i].warningReportList[j].phaseName
+ " ', null ,'DETAIL_FORM_INPUT' ,'REPORT_WARNING','" + operationList[i].processKey + "','" + operationList[i].phaseNo + "');\" class='d-block px-3 py-2 text-decoration-none text-dark'>"
+"<div class='tag fs-8 text-secondary px-2 py-1 mr-2 rounded border mb-1'>" + operationList[i].phaseName
+ "</div> <div class='title'>" + operationList[i].operationName
+ "</div> <div class='sub-title-wrap'> <div class='fs-8 text-secondary mr-2'><div class='data'>" + operationList[i].warningReportList[j].taskCode
+ "</div></div> <div class='sub-title'>" + operationList[i].warningReportList[j].taskName
+ "</div> <div class='sub-title-wrap'> <div class='fs-8 text-secondary mr-2'><div class='data'>" + operationList[i].taskCode
+ "</div></div> <div class='sub-title'>" + operationList[i].taskName
+ "</div></div> <i class='fas fa-chevron-right fs-12'></i> </a></li>");
break;
}
$("#reportWithWarning-list").append(operationNameLi);
CHK_pu.countReportWithWarning = CHK_pu.countReportWithWarning + 1;
}
}
// show not found if
if (CHK_pu.countReportWithWarning < 1) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment