Commit 5175b176 by Takumi Imai

Merge branch 'feature/1.0_check_web_dev' into feature/1.0_check_web_dev_imai

# Conflicts:
#	abvw/common/js/appCommon/constant.js
parent 7284ccb8
...@@ -203,10 +203,9 @@ CHK_Common.getUrlParameter = function () { ...@@ -203,10 +203,9 @@ CHK_Common.getUrlParameter = function () {
* @returns sid * @returns sid
*/ */
CHK_Common.getSid = function () { CHK_Common.getSid = function () {
return ClientData.userInfo_sid(); return ClientData.userInfo_sid();
}; };
/** /**
* cms communication * cms communication
* *
...@@ -216,29 +215,32 @@ CHK_Common.getSid = function () { ...@@ -216,29 +215,32 @@ CHK_Common.getSid = function () {
* @param {Object} callback * @param {Object} callback
* @param {Object} errorCallback * @param {Object} errorCallback
*/ */
CHK_Common.cmsAjax = function (url, param, async = true, type, dataType, callback, errorCallback) { CHK_Common.cmsAjax = function (url, param, async = true, callback, errorCallback) {
var sysSettings = AVWEB.avwSysSetting(); var sysSettings = AVWEB.avwSysSetting();
if (url) { if (url) {
$.ajax({ $.ajax({
type: type, type: 'post',
url: url, url: url,
data: param, data: param,
dataType: dataType, dataType: 'json',
cache: false, cache: false,
async: async, async: async,
crossDomain: true, crossDomain: true,
beforeSend: function(xhr) { beforeSend: function (xhr) {
xhr.setRequestHeader('X-AGT-AppId', sysSettings.appName); xhr.setRequestHeader('X-AGT-AppId', sysSettings.appName);
xhr.setRequestHeader('X-AGT-AppVersion', sysSettings.appVersion); xhr.setRequestHeader('X-AGT-AppVersion', sysSettings.appVersion);
}, },
success: function (result) { success: function (result) {
if (result.status == '200') { if (result.httpStatus == '200') {
if (callback) callback(result); if (callback) callback(result);
} else if (result.status == '401') {
CHK_Common.goUrlWithCurrentParams(CHK_CONSTANT.PAGE_NAME.LOGIN);
} else if (errorCallback) { } else if (errorCallback) {
errorCallback(); errorCallback();
} else if (result.httpStatus == '401') {
CHK_Common.goUrlWithCurrentParams(CHK_CONSTANT.PAGE_NAME.LOGIN);
} else if (result.httpStatus == '403') {
CHK_Common.closeLoading();
CHK_Common.displayAlert('errorOccurred');
} else { } else {
CHK_Common.closeLoading(); CHK_Common.closeLoading();
CHK_Common.displayAlert(result.message); CHK_Common.displayAlert(result.message);
...@@ -299,7 +301,7 @@ CHK_Common.checkAuth = function (async = true) { ...@@ -299,7 +301,7 @@ CHK_Common.checkAuth = function (async = true) {
params.sid = CHK_Common.getSid; params.sid = CHK_Common.getSid;
var urlPath = ClientData.userInfo_accountPath(); var urlPath = ClientData.userInfo_accountPath();
const url = CHK_CONSTANT.URL.BASE_CMS + urlPath + CHK_CONSTANT.URL.BASE_CHECKAPI + CHK_CONSTANT.URL.AUTH_SESSION; const url = CHK_CONSTANT.URL.BASE_CMS + urlPath + CHK_CONSTANT.URL.BASE_CHECKAPI + CHK_CONSTANT.URL.AUTH_SESSION;
CHK_Common.cmsAjax(url, params, async, CONSTANT.API_TYPE.GET, CONSTANT.DATA_TYPE.TEXT, function () { CHK_Common.cmsAjax(url, params, async, null, function () {
CHK_Common.goUrlWithCurrentParams(CHK_CONSTANT.PAGE_NAME.LOGIN); CHK_Common.goUrlWithCurrentParams(CHK_CONSTANT.PAGE_NAME.LOGIN);
}); });
}; };
...@@ -54,16 +54,6 @@ CHK_CONSTANT.URL = { ...@@ -54,16 +54,6 @@ CHK_CONSTANT.URL = {
AUTH_SESSION: 'getSession/checkAuthUser', AUTH_SESSION: 'getSession/checkAuthUser',
}; };
CONSTANT.API_TYPE = {
POST: 'post',
GET: 'get'
}
CONSTANT.DATA_TYPE = {
TEXT: 'text',
JSON: 'json',
}
CHK_CONSTANT.LANG = { CHK_CONSTANT.LANG = {
SAVE_NAME: 'lang', SAVE_NAME: 'lang',
JAPAN: 'ja', JAPAN: 'ja',
......
...@@ -48,20 +48,19 @@ CHK_OL.init = function () { ...@@ -48,20 +48,19 @@ CHK_OL.init = function () {
CHK_OL.getAllDataWeb = function (searchKeyword, sortIndex, searchStartDate, searchEndDate, operationGroupMasterId) { CHK_OL.getAllDataWeb = function (searchKeyword, sortIndex, searchStartDate, searchEndDate, operationGroupMasterId) {
let param = {}; let param = {};
param.sid = CHK_Common.getSid(); param.sid = CHK_Common.getSid();
param.operationGroupMasterId = searchKeyword; param.operationName = searchKeyword;
param.sort = sortIndex; param.sort = sortIndex;
param.startDate = searchStartDate; param.startDate = searchStartDate;
param.endDate = searchEndDate; param.endDate = searchEndDate;
param.operationGroupMasterId = operationGroupMasterId; param.operationGroupMasterId = operationGroupMasterId;
const url = CHK_CONSTANT.URL.BASE_CMS + ClientData.userInfo_accountPath() + CHK_CONSTANT.URL.BASE_CHECKAPI + CHK_CONSTANT.URL.ALL_OPERATION_LIST; const url = CHK_CONSTANT.URL.BASE_CMS + ClientData.userInfo_accountPath() + CHK_CONSTANT.URL.BASE_CHECKAPI + CHK_CONSTANT.URL.ALL_OPERATION_LIST;
CHK_Common.cmsAjax(url, param, false, CONSTANT.API_TYPE.GET, CONSTANT.DATA_TYPE.JSON,function (json) { CHK_Common.cmsAjax(url, param, false, function (json) {
CHK_OL.operationList = json.operationList; CHK_OL.operationList = json.operationList;
CHK_OL.operationGroupMaster = json.operationGroupMasterList; CHK_OL.operationGroupMaster = json.operationGroupMasterList;
CHK_OL.isOperationGroupMaster = json.isOperationGroupMaster; CHK_OL.isOperationGroupMaster = json.isOperationGroupMaster;
CHK_OL.operationSearchCriteria = json.operationSearchCriteria; CHK_OL.operationSearchCriteria = json.operationSearchCriteria;
CHK_OL.setSearchInfoWeb(); CHK_OL.setSearchInfoWeb();
console.log('json.operationList', JSON.stringify(json.operationList));
}); });
}; };
...@@ -173,6 +172,7 @@ CHK_OL.initCategory = function () { ...@@ -173,6 +172,7 @@ CHK_OL.initCategory = function () {
} }
$('#operationGroupMasterButton').removeClass('d-none'); $('#operationGroupMasterButton').removeClass('d-none');
CHK_OL.setCategoryHeight();
$(window).resize(function () { $(window).resize(function () {
CHK_OL.setCategoryHeight(); CHK_OL.setCategoryHeight();
}); });
...@@ -201,15 +201,14 @@ CHK_OL.createBreadcrumbList = function () { ...@@ -201,15 +201,14 @@ CHK_OL.createBreadcrumbList = function () {
if (typeof CHK_OL.operationGroupMasterId == 'undefined' || CHK_OL.operationGroupMasterId == 0) { if (typeof CHK_OL.operationGroupMasterId == 'undefined' || CHK_OL.operationGroupMasterId == 0) {
$('#groupMasterPath').append('<li class="breadcrumb-item"><a href="#" class="text-decoration-none text-dark">' + CHK_Common.getMsg('all') + '</a></li>'); $('#groupMasterPath').append('<li class="breadcrumb-item"><a href="#" class="text-decoration-none text-dark">' + CHK_Common.getMsg('all') + '</a></li>');
} else { } else {
const groupMaster = CHK_OL.operationGroupMaster.filter(it => it.operationGroupMasterId == CHK_OL.operationGroupMasterId)[0]; let treeList = [];
const groupMasterPathIdlist = groupMaster.treePath.split('/'); CHK_OL.createBreadcrumbTree(treeList, CHK_OL.operationGroupMasterId);
groupMasterPathIdlist.forEach(function (parentId) { treeList.forEach(function (operationGroupMaster) {
const pathOperationGroupMaster = CHK_OL.operationGroupMaster.filter(it => it.operationGroupMasterId == parentId)[0];
$('#groupMasterPath').append( $('#groupMasterPath').append(
'<li class="breadcrumb-item"><a onclick="CHK_OL.changeOperationGroupMaster(' + '<li class="breadcrumb-item"><a onclick="CHK_OL.changeOperationGroupMaster(' +
pathOperationGroupMaster.operationGroupMasterId + operationGroupMaster.operationGroupMasterId +
');" class="text-decoration-none text-dark">' + ');" class="text-decoration-none text-dark">' +
pathOperationGroupMaster.operationGroupMasterName + operationGroupMaster.operationGroupMasterName +
'</a></li>', '</a></li>',
); );
}); });
...@@ -217,6 +216,24 @@ CHK_OL.createBreadcrumbList = function () { ...@@ -217,6 +216,24 @@ CHK_OL.createBreadcrumbList = function () {
}; };
/** /**
* create Breadcrumb tree List
*
* @param {list} treeList
* @param {string} operationGroupMasterId
* @returns
*/
CHK_OL.createBreadcrumbTree = function (treeList, operationGroupMasterId) {
if (operationGroupMasterId == 0) {
return treeList;
}
const groupMaster = CHK_OL.operationGroupMaster.filter(it => it.operationGroupMasterId == operationGroupMasterId)[0];
CHK_OL.createBreadcrumbTree(treeList, groupMaster.parentOperationGroupMasterId);
treeList.push(groupMaster);
return treeList;
};
/**
* create category(operationGroupMaster) structure * create category(operationGroupMaster) structure
*/ */
CHK_OL.createCategoryList = function () { CHK_OL.createCategoryList = function () {
...@@ -233,9 +250,7 @@ CHK_OL.createCategoryList = function () { ...@@ -233,9 +250,7 @@ CHK_OL.createCategoryList = function () {
}); });
//common //common
const noCategory = $( const noCategory = $("<dl id='groupMasterId_0' class='group-category-list'><dt><a onclick='CHK_OL.changeOperationGroupMaster(0);'>" + CHK_Common.getMsg('all') + '</a></dt></dl>');
"<dl id='groupMasterId_0' class='group-category-list'><dt><a onclick='CHK_OL.changeOperationGroupMaster(0);'>" + CHK_Common.getMsg(CHK_CONSTANT.MSG_MAP.all) + '</a></dt></dl>',
);
$('#category-menu').append(noCategory); $('#category-menu').append(noCategory);
//create category(operationGroupMaster) structure //create category(operationGroupMaster) structure
...@@ -316,17 +331,19 @@ CHK_OL.changeSortType = function (sortType) { ...@@ -316,17 +331,19 @@ CHK_OL.changeSortType = function (sortType) {
$('.sort-type').removeClass('active'); $('.sort-type').removeClass('active');
$(sortType).addClass('active'); $(sortType).addClass('active');
CHK_OL.sortIndex = $(sortType).attr('data-sort'); CHK_OL.sortIndex = $(sortType).attr('data-sort');
CHK_OL.sortOperationList(sortType); const sortStr = sortType.dataset.sort;
const sortNumber = parseFloat(sortStr);
CHK_OL.sortOperationList(sortNumber);
CHK_OL.createOperationList(CHK_OL.operationList); CHK_OL.createOperationList(CHK_OL.operationList);
}; };
/** /**
* sort the operationList * sort the operationList
* *
* @param {Number} sortType * @param {Number} sortNumber
*/ */
CHK_OL.sortOperationList = function (sortType) { CHK_OL.sortOperationList = function (sortNumber) {
switch (sortType) { switch (sortNumber) {
case CHK_CONSTANT.SORT_TYPE.NAME: case CHK_CONSTANT.SORT_TYPE.NAME:
CHK_OL.operationList.sort(function (a, b) { CHK_OL.operationList.sort(function (a, b) {
if (a.operationName > b.operationName) return 1; if (a.operationName > b.operationName) return 1;
...@@ -336,15 +353,15 @@ CHK_OL.sortOperationList = function (sortType) { ...@@ -336,15 +353,15 @@ CHK_OL.sortOperationList = function (sortType) {
break; break;
case CHK_CONSTANT.SORT_TYPE.START_DATE_DESC: case CHK_CONSTANT.SORT_TYPE.START_DATE_DESC:
CHK_OL.operationList.sort(function (a, b) { CHK_OL.operationList.sort(function (a, b) {
if (setOperationDate(a.operationStartDate) < setOperationDate(b.operationStartDate)) return 1; if (CHK_OL.setOperationDate(a.operationStartDate) < CHK_OL.setOperationDate(b.operationStartDate)) return 1;
if (setOperationDate(a.operationStartDate) > setOperationDate(b.operationStartDate)) return -1; if (CHK_OL.setOperationDate(a.operationStartDate) > CHK_OL.setOperationDate(b.operationStartDate)) return -1;
return 0; return 0;
}); });
break; break;
case CHK_CONSTANT.SORT_TYPE.START_DATE_ASC: case CHK_CONSTANT.SORT_TYPE.START_DATE_ASC:
CHK_OL.operationList.sort(function (a, b) { CHK_OL.operationList.sort(function (a, b) {
if (setOperationDate(a.operationStartDate) > setOperationDate(b.operationStartDate)) return 1; if (CHK_OL.setOperationDate(a.operationStartDate) > CHK_OL.setOperationDate(b.operationStartDate)) return 1;
if (setOperationDate(a.operationStartDate) < setOperationDate(b.operationStartDate)) return -1; if (CHK_OL.setOperationDate(a.operationStartDate) < CHK_OL.setOperationDate(b.operationStartDate)) return -1;
return 0; return 0;
}); });
break; break;
...@@ -389,6 +406,7 @@ CHK_OL.search = function () { ...@@ -389,6 +406,7 @@ CHK_OL.search = function () {
CHK_OL.getAllDataWeb(searchKeyword, CHK_OL.sortIndex, searchStartDate, searchEndDate, CHK_OL.operationGroupMasterId); CHK_OL.getAllDataWeb(searchKeyword, CHK_OL.sortIndex, searchStartDate, searchEndDate, CHK_OL.operationGroupMasterId);
CHK_OL.createOperationList(CHK_OL.operationList); CHK_OL.createOperationList(CHK_OL.operationList);
CHK_OL.createCategory();
CHK_Common.closeLoading(); CHK_Common.closeLoading();
}; };
......
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