Commit bc3a9f61 by Lee Munkyeong

Merge branch 'feature/1.4.0_lmk' into 'feature/1.4.0'

Feature/1.4.0 lmk

See merge request !4
parents bc119407 67359662
......@@ -10254,7 +10254,6 @@ input[type=button].btn-block,input[type=reset].btn-block,input[type=submit].btn-
}
.navbar,.navbar .container,.navbar .container-fluid,.navbar .container-lg,.navbar .container-md,.navbar .container-sm,.navbar .container-xl {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between
......@@ -20189,6 +20188,7 @@ button {
}
.scan-area {
text-align: -webkit-center;
border-radius: 15px;
z-index: 1032;
height: calc(40%);
......@@ -20211,14 +20211,13 @@ button {
}
.loading-spinner {
margin-left: 33%;
margin-top: 10%;
color: lightslategray;
}
.loading-close {
margin-top: 3%;
margin-left: 85%;
margin-right: 1%;
margin-top: 1%;
display: inherit;
}
.overlay.open {
......
......@@ -24,7 +24,11 @@
<i class="fa fa-folder fs-12 p-1" id="category-toggle-button"></i>
<span class="d-none d-md-inline fs-10">カテゴリー</span>
</a>
<a class="navbar-brand lht-0" href="#" style="margin:0px">
<a class="navbar-brand lht-0" href="#" style="margin: 0 10px 0 10px;float: right;">
<i class="fa fa-redo fs-12 p-1" id="updateButton" onclick="CHK_L.sendAppCommand('refreshContent');"></i>
<span class="d-none d-md-inline fs-10">更新</span>
</a>
<a class="navbar-brand lht-0" href="#" style="margin: 0 10px 0 10px;float: right;">
<i class="fa fa-wifi fs-12 p-1" id="rfidScanButton" onclick="CHK.startScan();"></i>
<span class="d-none d-md-inline fs-10">スキャン</span>
</a>
......@@ -104,13 +108,13 @@
</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item sort-type" data-sort="0" onclick="CHK.changeSortType(this);">作業名順</a>
<a class="dropdown-item sort-type" data-sort="1" onclick="CHK.changeSortType(this);">作業期間が新しい順</a>
<a class="dropdown-item sort-type active" data-sort="2" onclick="CHK.changeSortType(this);">作業期間が古い順</a>
<a class="dropdown-item sort-type active" data-sort="1" id="defaultSort" onclick="CHK.changeSortType(this);">作業期間が新しい順</a>
<a class="dropdown-item sort-type" data-sort="2" onclick="CHK.changeSortType(this);">作業期間が古い順</a>
<a class="dropdown-item sort-type" data-sort="3" onclick="CHK.changeSortType(this);">報告タイプ順</a>
<a class="dropdown-item sort-type" data-sort="4" onclick="CHK.changeSortType(this);">閲覧日が新しい順</a>
</div>
<a href="javascript:CHK_L.sendAppCommand('refreshContent');" class="text-decoration-none py-2 lht-0 d-inline-block ml-3">
<i class="fa fa-redo text-dark"></i>
<a href="javascript:CHK.resetSearch();" class="text-decoration-none py-2 lht-0 d-inline-block ml-3">
<i class="fa fa-times text-dark"></i>
<span class="d-none d-md-inline text-dark fs-10">
リセット
</span>
......
......@@ -247,7 +247,6 @@ CHK_L.sendAppCommand = function (command, operationId, contentId, operationGroup
param.operationGroupMasterId = operationGroupMasterId;
CHK.sendABookCheckApi(param);
}
/**
* 定期点検リストを更新
*
......
......@@ -137,6 +137,7 @@ CHK.apiCmd = {
goOperation: "goOperation", //作業開始
goPanoramaEdit: "goPanoramaEdit", //パノラマ作業資料編集
refreshContent: "refreshContent", //新着更新
resetSearch: "resetSearch", //検索条件初期化
editAttached: "editAttached", //添付ファイル編集
saveAttached: "saveAttached", //添付ファイル保存
insertReport: "insertTaskReport", //作業報告保存
......@@ -391,10 +392,8 @@ CHK.initReportApp = function (callback) {
// 作業一覧JSONデータ
CHK.loadJson(CHK.jsonPath.operationList, function (json) {
CHK.operation = json;
if (CHK.isAndroid || CHK.isIOS) {
$('#operationTable').empty();
CHK.operation.searchOperationList = json.operationList;
}
$('#operationTable').empty();
CHK.operation.searchOperationList = json.operationList;
//作業一覧描画
CHK.createOperationList(CHK.operation.operationList);
});
......@@ -408,7 +407,7 @@ CHK.initReportApp = function (callback) {
// 作業・カテゴリー関係JSONデータ
CHK.loadJson(CHK.jsonPath.operationGroupMasterRelationList, function (json) {
CHK.operationGroupMasterRelation = json;
});
// コミュニケーションデータJSONデータ
......@@ -2391,6 +2390,7 @@ CHK.showRelatedContent = function(urlPath, contentId, pageNum) {
}
}
CHK.getOneTimeKey = function(url, callback) {
$.ajax({
type: "GET",
......@@ -2743,21 +2743,19 @@ CHK.showWhiteFrame = function() {
*/
CHK.createCategory = function(operationGroupMasterList) {
if (CHK.isAndroid || CHK.isIOS) {
$('.group-category-list').remove();
$("#groupMasterPath").empty();
if (typeof CHK.operationGroupMasterId == 'undefined' || CHK.operationGroupMasterId == 0) {
$("#groupMasterPath").append('<li class="breadcrumb-item"><a href="#" class="text-decoration-none text-dark">' + getMsg("all") + '</a></li>');
} else {
var groupMaster = operationGroupMasterList.filter(it => it.operationGroupMasterId == CHK.operationGroupMasterId)[0];
var groupMasterPathIdlist = groupMaster.treePath.split('/');
groupMasterPathIdlist.forEach( function (parentId){
var pathOperationGroupMaster = operationGroupMasterList.filter(it => it.operationGroupMasterId == parentId)[0];
$("#groupMasterPath").append('<li class="breadcrumb-item"><a onclick="CHK.changeOperationGroupMaster('
+ pathOperationGroupMaster.operationGroupMasterId + ');" class="text-decoration-none text-dark">'
+ pathOperationGroupMaster.operationGroupMasterName + '</a></li>');
});
}
$('.group-category-list').remove();
$("#groupMasterPath").empty();
if (typeof CHK.operationGroupMasterId == 'undefined' || CHK.operationGroupMasterId == 0) {
$("#groupMasterPath").append('<li class="breadcrumb-item"><a href="#" class="text-decoration-none text-dark">' + getMsg("all") + '</a></li>');
} else {
var groupMaster = operationGroupMasterList.filter(it => it.operationGroupMasterId == CHK.operationGroupMasterId)[0];
var groupMasterPathIdlist = groupMaster.treePath.split('/');
groupMasterPathIdlist.forEach( function (parentId){
var pathOperationGroupMaster = operationGroupMasterList.filter(it => it.operationGroupMasterId == parentId)[0];
$("#groupMasterPath").append('<li class="breadcrumb-item"><a onclick="CHK.changeOperationGroupMaster('
+ pathOperationGroupMaster.operationGroupMasterId + ');" class="text-decoration-none text-dark">'
+ pathOperationGroupMaster.operationGroupMasterName + '</a></li>');
});
}
//サイドメニューカテゴリー構造作成
......@@ -2803,7 +2801,7 @@ CHK.createCategory = function(operationGroupMasterList) {
if (CHK.isIOS) {
sortIndex = CHK_iOS.getSortType();
} else if (CHK.isAndroid) {
// TODO: 端末に保存したsortTypeを取得
sortIndex = android.getSortType();
}
let sortType = document.getElementsByClassName("sort-type")[sortIndex];
CHK.changeSortType(sortType);
......@@ -2829,28 +2827,23 @@ CHK.createOperationList = function(operationList, isSearched = false) {
if (CHK.isIOS) {
webkit.messageHandlers.saveSortType.postMessage(sortType);
} else if (CHK.isAndroid) {
// TODO: sortTypeを端末に保存
android.setSortType(sortType);
}
}
switch(sortType) {
case CHK_CONSTANT.SORT_TYPE.NAME:
console.log(sortType);
operationList.sort((a, b) => (a.operationName > b.operationName) ? 1 : -1);
break;
case CHK_CONSTANT.SORT_TYPE.START_DATE_DESC:
console.log(sortType);
operationList.sort((a, b) => (setOperationDate(a.operationStartDate) < setOperationDate(b.operationStartDate)) ? 1 : -1);
break;
case CHK_CONSTANT.SORT_TYPE.START_DATE_ASC:
console.log(sortType);
operationList.sort((a, b) => (setOperationDate(a.operationStartDate) > setOperationDate(b.operationStartDate)) ? 1 : -1);
break;
case CHK_CONSTANT.SORT_TYPE.TYPE:
console.log(sortType);
operationList.sort((a, b) => (a.operationType < b.operationType) ? 1 : -1);
break;
case CHK_CONSTANT.SORT_TYPE.LAST_EDIT_DATE:
console.log(sortType);
operationList.sort((a, b) => (a.lastEditDate < b.lastEditDate) ? 1 : -1);
break;
}
......@@ -2904,24 +2897,33 @@ CHK.search = function() {
var searchKeyword = $("#searchTaskName").val();
var searchStartDate = $("#searchStartDate").val();
var searchEndDate = $("#searchEndDate").val();
var operationGroupMasterId = CHK.operationGroupMasterId;
var searchResult;
if (CHK.isAndroid) {
searchResult = JSON.parse(android.searchOperationList(searchKeyword, searchStartDate, searchEndDate, CHK.operationGroupMasterId));
CHK.isSearched = true;
CHK.operation.searchOperationList = searchResult.operationList;
CHK.createOperationList(searchResult.operationList);
// TODO: カテゴリの保存
} else if (CHK.isIOS) {
searchResult = CHK_iOS.searchOperationList(searchKeyword, searchStartDate, searchEndDate, CHK.operationGroupMasterId);
CHK.isSearched = true;
CHK.operation.searchOperationList = searchResult.operationList;
CHK.createOperationList(searchResult.operationList);
webkit.messageHandlers.saveOperationGroupMaster.postMessage(CHK.operationGroupMasterId);
let searchButtonTaped = searchKeyword != "" || searchStartDate != "" || searchEndDate != "";
if (searchButtonTaped) {
webkit.messageHandlers.showSearchResultToast.postMessage(searchResult.operationList.length);
}
}
searchResult = CHK.operation.operationList.filter(function(operation) {
var result = true;
if (searchKeyword.length) {
result = result * operation.operationName.includes(searchKeyword);
}
if (searchStartDate.length) {
result = result * (operation.operationEndDate >= searchStartDate);
}
if (searchEndDate.length) {
result = result * (operation.operationStartDate <= searchEndDate);
}
if (operationGroupMasterId != 0) {
var operationGroupMasterIdList = CHK.operationGroupMasterRelation.operationGroupMasterRelationList.filter(function(operationGroupMasterRelation) {
return operationGroupMasterRelation.operationId == operation.operationId;
})
result = result * operationGroupMasterIdList.filter(function(operationGroupMaster){
return operationGroupMaster.operationGroupMasterId == operationGroupMasterId;
}).length;
}
return result;
})
CHK.isSearched = true;
CHK.operation.searchOperationList = searchResult;
CHK.createOperationList(searchResult, CHK.isSearched);
};
/**
......@@ -2990,19 +2992,32 @@ CHK.scanClose = function() {
$(".scan-area").addClass("d-none");
}
CHK.scanResult = function(scannedCode) {
CHK.scanResult = function(scannedCode, scanType) {
if (scannedCode == null || !(scannedCode.length)) {
return;
}
CHK.scanClose();
var operationList = CHK.operation.searchOperationList;
var scannedOperation = operationList.filter(function(operation) {
return operation.permitCode == scannedCode;
return operation.permitCode == scannedCode.substring(4);
})[0];
if (scannedOperation != null) {
CHK_L.sendAppCommand('goOperation', scannedOperation.operationId, scannedOperation.contentId);
CHK.sendScanResult('goOperation', scannedOperation.operationId, scannedOperation.contentId, scanType);
} else {
CHK.displayAlert("notExistCode");
}
}
CHK.sendScanResult = function (command, operationId, contentId, scanType) {
var param = {};
param.cmd = CHK.getCommand(command);
param.operationId = operationId;
param.contentId = contentId;
param.scanType = scanType;
CHK.sendABookCheckApi(param);
}
CHK.alertClose = function() {
$(".alert-overlay").addClass("d-none");
$(".alert-area").addClass("d-none");
......@@ -3012,4 +3027,11 @@ CHK.displayAlert = function(msgCode) {
$("#alertMsg").html(getMsg(msgCode));
$(".alert-overlay").removeClass("d-none");
$(".alert-area").removeClass("d-none");
}
CHK.resetSearch = function() {
$('#searchTaskName').val('');
$('#searchStartDate').val('');
$('#searchEndDate').val('');
CHK.changeSortType($('#defaultSort'));
}
\ No newline at end of file
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