363 lines
10 KiB
JavaScript
363 lines
10 KiB
JavaScript
|
|
// 업무리스트 분류 선택
|
|
$(document).ready(function () {
|
|
|
|
/* 쿠키값 셋팅 */
|
|
let cookieChk = false;
|
|
$(".userDept-chk").each( function () {
|
|
// 쿠키설정 확인
|
|
if($(this).hasClass('active')){
|
|
cookieChk = true;
|
|
}
|
|
|
|
});
|
|
if(!cookieChk) $('#userDept-all').addClass('active');
|
|
|
|
let branchChk = false;
|
|
$(".branch-chk").each( function () {
|
|
// 쿠키설정 확인
|
|
if($(this).hasClass('active')){
|
|
branchChk = true;
|
|
}
|
|
|
|
});
|
|
if(!branchChk) $('#branch-all').addClass('active');
|
|
listChk();
|
|
|
|
|
|
/*회원 필터링*/
|
|
$(".btn-chk,.userDept-chk").on("click", function () {
|
|
|
|
let id = this.id;
|
|
let target;
|
|
|
|
if(!id) {
|
|
let className;
|
|
if($(this).hasClass('member-chk')) className ='member-chk';
|
|
else if($(this).hasClass('branch-chk')) className ='branch-chk';
|
|
else if($(this).hasClass('reqType-chk')) className ='reqType-chk';
|
|
else if($(this).hasClass('workType-chk')) className ='workType-chk';
|
|
else if($(this).hasClass('filter-chk')) className ='filter-chk';
|
|
else if($(this).hasClass('userDept-chk')) className ='userDept-chk';
|
|
else className = 'btn-chk'
|
|
|
|
var classNames = className.split(' ');
|
|
$.each(classNames, function (index, className) {
|
|
if (!className.startsWith('btn-') && className !== 'active') {
|
|
target = "."+className;
|
|
}
|
|
});
|
|
if(!target) target = ".member";
|
|
|
|
}else{
|
|
target = "#"+id;
|
|
}
|
|
|
|
let targetGroups = target.split('-');
|
|
let targetGroup = targetGroups[0].replace(/[.#]/g, "");
|
|
|
|
if(id) {
|
|
|
|
/*
|
|
// 전체버튼 토글
|
|
if (!$(target).hasClass('active')) {
|
|
$('.'+targetGroup+'-chk').removeClass('active');
|
|
$(target).addClass('active');
|
|
} else {
|
|
$(target).removeClass('active');
|
|
}*/
|
|
|
|
|
|
// 전체버튼 클릭시 무조전 전체 리스트 노출
|
|
$('.'+targetGroup+'-chk').removeClass('active');
|
|
$(target).addClass('active');
|
|
|
|
|
|
listChk();
|
|
}
|
|
else{
|
|
|
|
// 전체버튼 비활성
|
|
$('#'+targetGroup+'-all').removeClass('active');
|
|
|
|
// 1 해당버튼 토글
|
|
/*$(this).toggleClass('active');
|
|
|
|
let statusM = false;
|
|
$("."+targetGroup+"-chk").each(function (idx, item) {
|
|
if ($(this).hasClass("active")) statusM = true;
|
|
})
|
|
if (!statusM) {
|
|
$('#'+targetGroup+'-all').trigger("click");
|
|
} else {
|
|
listChk(); // 리스트 재설정
|
|
}*/
|
|
|
|
|
|
// 2해당 필더링만
|
|
$('.'+targetGroup+'-chk').removeClass('active');
|
|
$(this).addClass('active');
|
|
listChk(); // 리스트 재설정
|
|
|
|
}
|
|
|
|
//console.log(window.location.pathname);
|
|
|
|
// 쿠키 설정
|
|
/* if(window.location.pathname == '/html/status/daily_list.html') {
|
|
if ($(this).hasClass('active')) {
|
|
let name = $(this).data('status');
|
|
if (name != 'all') $.cookie('UD', 'Y');
|
|
} else {
|
|
let name = $(this).data('status');
|
|
$.removeCookie('UD' + decodeURIComponent(name));
|
|
}
|
|
}*/
|
|
|
|
// 쿠키 설정
|
|
let name = $(this).data('status');
|
|
if ($(this).hasClass('active') && name != 'all') {
|
|
$.cookie('UD', decodeURIComponent(name));
|
|
$.removeCookie('UD_ALL');
|
|
} else {
|
|
$.cookie('UD_ALL', 'active');
|
|
$.removeCookie('UD');
|
|
}
|
|
|
|
});
|
|
|
|
|
|
function listChk(){
|
|
$("[class^='filterChk']").addClass('hidden'); // 초기화
|
|
$("[class^='filterChk']").removeClass('FC'); // 초기화
|
|
|
|
// 활성리스트 설정
|
|
$("[class^='filterChk']").each(function(idx,item){
|
|
|
|
let $this = item;
|
|
|
|
// 진행구분
|
|
let filterChk = false;
|
|
let statusF;
|
|
if($("#filter-all").hasClass('active')) {
|
|
filterChk = true;
|
|
}else{
|
|
$(".filter-chk").each(function (idx, item) {
|
|
|
|
if ($(this).hasClass("active")) {
|
|
statusF = $(this).data('status');
|
|
if($($this).hasClass('filterChk'+statusF)) {
|
|
filterChk = true;
|
|
$($this).addClass('FC');
|
|
return false;
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
// 회원구분
|
|
let memberChk = false;
|
|
let statusM;
|
|
if($("#member-all").hasClass('active')) {
|
|
memberChk = true;
|
|
}else{
|
|
$(".member-chk").each(function(idx,item){
|
|
|
|
if ($(this).hasClass("active")) {
|
|
statusM = $(this).data('status');
|
|
if($($this).hasClass('MC'+statusM)) {
|
|
memberChk = true;
|
|
return false;
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
// 요청구분
|
|
let reqChk = false;
|
|
let statusR;
|
|
if($("#reqType-all").hasClass('active')) {
|
|
reqChk = true;
|
|
}else{
|
|
$(".reqType-chk").each(function(idx,item){
|
|
|
|
if ($(this).hasClass("active")) {
|
|
statusR = $(this).data('status');
|
|
if($($this).hasClass('RT'+statusR)) {
|
|
reqChk = true;
|
|
return false;
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
// 작업구분
|
|
let workChk = false;
|
|
let statusW;
|
|
if($("#workType-all").hasClass('active')) {
|
|
workChk = true;
|
|
}else{
|
|
$(".workType-chk").each(function(idx,item){
|
|
|
|
if ($(this).hasClass("active")) {
|
|
statusW = $(this).data('status');
|
|
if($($this).hasClass('WT'+statusW)) {
|
|
workChk = true;
|
|
return false;
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
// 부서구분
|
|
let deptChk = false;
|
|
let statusD;
|
|
if($("#userDept-all").hasClass('active')) {
|
|
deptChk = true;
|
|
}else{
|
|
$(".userDept-chk").each(function(idx,item){
|
|
|
|
if ($(this).hasClass("active")) {
|
|
statusD = $(this).data('status');
|
|
if($($this).hasClass('UD'+statusD)) {
|
|
deptChk = true;
|
|
return false;
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
//필터링
|
|
//console.log(filterChk + ' = ' + memberChk + ' = ' + reqChk + ' = ' + workChk + ' = ' + deptChk)
|
|
if( deptChk) {
|
|
$(this).removeClass("hidden");
|
|
}
|
|
})
|
|
|
|
// 수량확인
|
|
if($("#filter-all").hasClass('active')) {
|
|
listCnt("[class^='filterChk']");
|
|
}else {
|
|
listCnt(".FC");
|
|
}
|
|
|
|
}
|
|
|
|
// 개별 수량
|
|
function listCnt(elem){
|
|
|
|
// 회원별 수량
|
|
let MC = [];
|
|
$(elem).each(function(idx,item){
|
|
|
|
let $this = item;
|
|
$(".member-chk").each(function(idx,item){
|
|
|
|
statusM = $(this).data('status');
|
|
if($($this).hasClass('MC'+statusM)) {
|
|
|
|
//console.log(statusM);
|
|
if (MC[statusM] !== undefined) {
|
|
MC[statusM]++;
|
|
} else {
|
|
MC[statusM] = 1;
|
|
}
|
|
}
|
|
})
|
|
})
|
|
$(".member-chk > span").text('');
|
|
for (let key in MC) {
|
|
if (MC.hasOwnProperty(key)) {
|
|
$("[data-status='"+key+"']>span").text('('+MC[key]+')');
|
|
}
|
|
}
|
|
|
|
// 요청구분별 수량
|
|
let RT = [];
|
|
$(elem).each(function(idx,item){
|
|
|
|
let $this = item;
|
|
$(".reqType-chk").each(function(idx,item){
|
|
|
|
statusM = $(this).data('status');
|
|
if($($this).hasClass('RT'+statusM) && !$($this).hasClass('hidden')) {
|
|
|
|
//console.log(statusM);
|
|
if (RT[statusM] !== undefined) {
|
|
RT[statusM]++;
|
|
} else {
|
|
RT[statusM] = 1;
|
|
}
|
|
}
|
|
})
|
|
})
|
|
$(".reqType-chk > span").text('');
|
|
for (let key in RT) {
|
|
if (RT.hasOwnProperty(key)) {
|
|
|
|
//console.log("RT:"+key);
|
|
|
|
$("[data-status='"+key+"']>span").text('('+RT[key]+')');
|
|
}
|
|
}
|
|
|
|
|
|
// 작업구분별 수량
|
|
let WT = [];
|
|
$(elem).each(function(idx,item){
|
|
|
|
let $this = item;
|
|
$(".workType-chk").each(function(idx,item){
|
|
|
|
statusM = $(this).data('status');
|
|
//console.log(statusM);
|
|
|
|
if($($this).hasClass('WT'+statusM) && !$($this).hasClass('hidden')) {
|
|
|
|
|
|
if (WT[statusM] !== undefined) {
|
|
WT[statusM]++;
|
|
} else {
|
|
WT[statusM] = 1;
|
|
}
|
|
}
|
|
})
|
|
})
|
|
$(".workType-chk > span").text('');
|
|
for (let key in WT) {
|
|
|
|
//console.log("WT:"+key);
|
|
|
|
if (WT.hasOwnProperty(key)) {
|
|
$("[data-status='"+key+"']>span").text('('+WT[key]+')');
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*작업 스케쥴 확인*/
|
|
$('.progressBoxToggle').on( "click",function() {
|
|
|
|
$(this).find(".progress-group2").toggle();
|
|
|
|
var $content = $(this).parent().find('.deatailBox');
|
|
var $height = $(this).get(0).scrollHeight - 40;
|
|
|
|
try {
|
|
|
|
// 현재 높이와 실제 높이 비교
|
|
if ($content.height() <= 50) {
|
|
$content.height($height); // 컨텐츠 높이에 맞게 늘림
|
|
} else {
|
|
$content.height(50); // 초기 높이로 복귀
|
|
}
|
|
} catch (e) {
|
|
|
|
}
|
|
event.stopImmediatePropagation();
|
|
});
|
|
|
|
}); |