651 lines
20 KiB
Plaintext
651 lines
20 KiB
Plaintext
<!-- #include Virtual="/include/Header.asp"-->
|
|
<style>
|
|
@font-face {
|
|
font-family: 'Noto-Sans';
|
|
src: url("/font/Noto_Sans_KR/NotoSansKR-Medium.otf")
|
|
}
|
|
|
|
@keyframes fadein {
|
|
0% {
|
|
opacity: 0.5;
|
|
}
|
|
100% {
|
|
opacity: 1;
|
|
}
|
|
}
|
|
|
|
body, html {
|
|
font-family: 'Noto-Sans';
|
|
height:100%;
|
|
font-weight: bold;
|
|
}
|
|
.bg-navy-1 {
|
|
background-color: #1A1A3A;
|
|
}
|
|
|
|
.bg-navy-2 {
|
|
background-color: #374669;
|
|
}
|
|
|
|
.bg-navy-3 {
|
|
background-color: #2F75B5;
|
|
}
|
|
|
|
.bg-navy-4 {
|
|
background-color: #707699;
|
|
}
|
|
.bg-gray-1{
|
|
background-color: #0000001a;
|
|
}
|
|
.bg-gray-2{
|
|
background-color: #0000000d;
|
|
}
|
|
ul.my-list {
|
|
list-style: none;
|
|
margin:0px;
|
|
padding:0px
|
|
}
|
|
|
|
ul.my-list li {
|
|
padding:1px 0px 5px 2px ;
|
|
border-bottom: 1px solid #374669;
|
|
transition: .5s;
|
|
cursor: pointer;
|
|
font-size: 15px;
|
|
}
|
|
|
|
ul.my-list li:hover {
|
|
background-color: #1A1A3A;
|
|
color: white;
|
|
padding-left:5px
|
|
}
|
|
|
|
ul.my-list li.selected {
|
|
background-color: #1A1A3A;
|
|
color: white;
|
|
padding-left:5px
|
|
}
|
|
|
|
.main-box div {
|
|
animation: .5s ease fadein;
|
|
}
|
|
|
|
.circle {
|
|
border-radius: 35px;
|
|
width:35px;
|
|
height:35px;
|
|
font-size: 15px;
|
|
line-height: 35px;
|
|
display: inline-block;
|
|
}
|
|
|
|
|
|
.list-box:hover{
|
|
color: #990000;
|
|
cursor: pointer;
|
|
transition: .3s;
|
|
}
|
|
|
|
.list-content {
|
|
font-size: 14px;
|
|
border-left:2px solid #607d8b;
|
|
background-color: #f1f1f1;
|
|
display: none;
|
|
}
|
|
|
|
.filter-box .post-it {
|
|
font-size: .9rem;
|
|
background-color: white;
|
|
position: relative;
|
|
border-right:4px solid #1A1A3A;
|
|
margin-bottom: 2px;
|
|
text-align: right;
|
|
padding-right:5px;
|
|
cursor: pointer;
|
|
transition: .5s;
|
|
}
|
|
|
|
|
|
|
|
.filter-box .post-it::before {
|
|
content:'';
|
|
position:absolute;
|
|
left:0px;
|
|
top:0px;
|
|
height:100%;
|
|
width:0%;
|
|
background-color:yellow;
|
|
transition: .5s;
|
|
z-index: -1;
|
|
}
|
|
|
|
.target-tr {
|
|
background-color: #2196f3;
|
|
color:white;
|
|
}
|
|
|
|
.target-tr button {
|
|
border:1px solid transparent;
|
|
background-color: black;
|
|
color:white;
|
|
}
|
|
|
|
tr button {
|
|
border:1px solid transparent;
|
|
background-color: #2196f3;
|
|
color:white;
|
|
}
|
|
|
|
.photo-box img {
|
|
transition: .5s ease-in;
|
|
}
|
|
.photo-box img:hover {
|
|
transform: scale(1.5);
|
|
}
|
|
|
|
.filter-td {
|
|
cursor: pointer;
|
|
position:relative;
|
|
}
|
|
|
|
|
|
.filter-option{
|
|
width: 100%;
|
|
background-color: #626782;
|
|
box-shadow: 0px 0px 2px 0px rgb(185, 176, 176);
|
|
left:0px;
|
|
top:calc(100%)
|
|
}
|
|
|
|
.filter-option p {
|
|
margin:1px 0px 1px 0px;
|
|
border:1px solid rgb(116, 116, 116);
|
|
padding:.2rem;
|
|
}
|
|
|
|
.filter-option p:hover {
|
|
background-color: yellowgreen;
|
|
}
|
|
|
|
.tr-none {
|
|
display: none;
|
|
}
|
|
|
|
.filter_photo, .filter_model {
|
|
margin-right: 10px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.filter_photo::before{
|
|
content: '파트 : ';
|
|
}
|
|
.filter_model::before{
|
|
content: '진행상황 : ';
|
|
}
|
|
.filter_prev::before{
|
|
content: '사전 조사 : ';
|
|
}
|
|
|
|
.filter_model:hover::after{
|
|
content: '해제';
|
|
color:red;
|
|
font-size: .5rem;
|
|
}
|
|
|
|
.filter_prev:hover::after{
|
|
content: '해제';
|
|
color:red;
|
|
font-size: .5rem;
|
|
}
|
|
|
|
.filter_photo:hover::after{
|
|
content: '해제';
|
|
color:red;
|
|
font-size: .5rem;
|
|
}
|
|
|
|
#h-list {
|
|
cursor: pointer;
|
|
transition:all .5s;
|
|
position: relative;
|
|
padding:.7rem;
|
|
color:white;
|
|
text-decoration: none;
|
|
}
|
|
|
|
#h-list::after {
|
|
display: block;
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
bottom: 0;
|
|
right: 0;
|
|
margin: auto;
|
|
width: 100%;
|
|
height: 5px;
|
|
content: ' ';
|
|
color: transparent;
|
|
background: rgba(255, 255, 255, 0.432);
|
|
visibility: none;
|
|
opacity: 0;
|
|
z-index: -1;
|
|
transition: all .5s
|
|
}
|
|
|
|
#h-list:hover {
|
|
color:#1A1A3A;
|
|
visibility: visible;
|
|
height: 100%;
|
|
}
|
|
|
|
#h-list:hover:after {
|
|
opacity: 1;
|
|
visibility: visible;
|
|
height: 100%;
|
|
}
|
|
|
|
#search-box {
|
|
z-index: 1030;
|
|
}
|
|
|
|
#h-list-item{
|
|
display: block;
|
|
position: absolute;
|
|
background-color: #f6f6f6;
|
|
border-radius: .5rem;
|
|
left:100%;
|
|
top:0px;
|
|
box-shadow: 0px 0px 4px 1px black;
|
|
cursor: default;
|
|
width:200px;
|
|
padding:.1rem;
|
|
transition: ease .5s;
|
|
overflow-y: auto;
|
|
}
|
|
|
|
#h-list-item[data-visible=true]{
|
|
height:350px;
|
|
visibility: visible;
|
|
|
|
}
|
|
|
|
#h-list-item[data-visible=false]{
|
|
height:0px;
|
|
visibility: hidden;
|
|
}
|
|
|
|
.hlist-item {
|
|
cursor: pointer;
|
|
}
|
|
|
|
.hlist-item[data-flag="1"]{
|
|
background-color: lightblue !important;
|
|
}
|
|
|
|
.hlist-item[data-flag="0"]{
|
|
background-color: #e6adad !important;
|
|
}
|
|
|
|
table{
|
|
font-size: 11px;
|
|
margin-bottom:3% !important;
|
|
font-weight: 100;
|
|
}
|
|
table td, th{
|
|
margin:0 !important;
|
|
vertical-align:middle !important;
|
|
}
|
|
select{
|
|
margin-top: 5px;
|
|
}
|
|
</style>
|
|
|
|
<body style="padding-top: 55px;">
|
|
<div class="fixed-top p-3 bg-white text-center h5 shadow-lg" style="font-weight: bold">
|
|
<i class="fa fa-television" aria-hidden="true"></i> Report Api를 사용한 현황 페이지
|
|
</div>
|
|
<div class="container-fluid h-100" >
|
|
<div class="row h-100">
|
|
<div class="col-lg-12 pt-1 h-100 d-flex flex-column bg-navy-2 pb-2">
|
|
<div class="p-2 text-white d-flex flex-row" id="search-box" style="font-weight: bold">
|
|
<!--
|
|
<div>
|
|
<label>
|
|
Select1
|
|
<select name="survey_part" class="form-control form-control-sm" style="display: inline-block">
|
|
<option value="1" selected='selected'>1</option>
|
|
<option value="2" selected='selected'>2</option>
|
|
<option value="3" selected='selected'>3</option>
|
|
</select>
|
|
</label>
|
|
<label>
|
|
Select2
|
|
<select name="group" class="form-control form-control-sm" style="display: inline-block">
|
|
<option value="1">1</option>
|
|
<option value="2">2</option>
|
|
<option value="3">3</option>
|
|
</select>
|
|
</label>
|
|
<button name="btn_search" id="btn_search" class="btn btn-sm btn-secondary">조회</button>
|
|
</div>
|
|
-->
|
|
<div class="ml-2 position-relative" >
|
|
</div>
|
|
<div class="flex-fill"></div>
|
|
<div onclick="window.location.reload()" style="cursor: pointer;" class=" text-right"><i class="fa fa-refresh" aria-hidden="true"></i> 새로고침</div>
|
|
</div>
|
|
<div class="p-2 main-box rounded bg-light h-100 d-flex flex-row shadow-sm" style="overflow-x: auto;">
|
|
<div class="p-2 flex-fill border bg-white rounded shadow-sm " style="overflow:auto;">
|
|
<div class="d-flex flex-column p-2 flex-fill" id="content" style="overflow:auto;">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
<script>
|
|
$("document").ready(function(){
|
|
showLoadingBar()
|
|
setTimeout(() => {
|
|
view_type()
|
|
hideLoadingBar()
|
|
}, 500);
|
|
})
|
|
|
|
$("button[name=btn_search]").on("click", function(e){
|
|
showLoadingBar()
|
|
setTimeout(() => {
|
|
view_type()
|
|
hideLoadingBar()
|
|
}, 500);
|
|
})
|
|
|
|
function showLoadingBar(){
|
|
var maskHeight = $(document).height();
|
|
var maskWidth = window.document.body.clientWidth;
|
|
var mask = "<div id='mask' style='position:absolute; z-index:9000; background-color:#ffffff; display:none; left:0; top:0;'></div>";
|
|
var loadingImg = '';
|
|
loadingImg += "<div id='loadingImg' style='position:absolute; left:calc(50% - 100px); top:40%; display:none; z-index:10000;'>";
|
|
loadingImg += " <img src='/img/load.gif'/>";
|
|
loadingImg += "</div>";
|
|
$('body').append(mask).append(loadingImg);
|
|
$('#mask').css({ 'width' : maskWidth , 'vertical-align' : 'middle', 'height': maskHeight, 'opacity' : '0.7'});
|
|
$('#mask').show(); $('#loadingImg').show();
|
|
}
|
|
|
|
function hideLoadingBar() {
|
|
$('#mask, #loadingImg').hide();
|
|
$('#mask, #loadingImg').remove();
|
|
}
|
|
|
|
function view_type(){
|
|
$("#content").empty();
|
|
var loc = window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/'));
|
|
var pkey = loc.split("/")[2];
|
|
var isKiwi = "0"; //KIWI 프로젝트는 "1"
|
|
var reportToken = getReportToken();/////인증 - Report API로 부터 인증 키를 받아야만 다른 기능을 사용 가능
|
|
|
|
if(reportToken != ""){
|
|
///테이블 상단에 붙일 제목
|
|
var titleArray = [
|
|
/*
|
|
"성별"
|
|
,"연령"
|
|
,"지역"
|
|
*/
|
|
];
|
|
|
|
//"index":"Q1"
|
|
//순위의 경우 Q1_1 : 1순위만 / Q1_7 1~7순위
|
|
//Attr의 경우 Q1 모든 속성에 대한 결과 단, 배너 사용 불가
|
|
// Q1_1, Q1_3, Q1_9 : 1,3,9 속성에 대한 결과만 출력 배너 사용 가능
|
|
var indexArray = [/*"Q1","Q2","Q3"*/];
|
|
|
|
//"banner":"Q1,Q2|Q3" ','옆으로 붙이기 / '|'단으로 쌓기
|
|
//index가 Attr인 경우 해당 결과물엔 배너가 반영 되지 않음
|
|
var bannerParam = "";
|
|
|
|
//"filter":"Q|(Q1>3)" SQL WHERE 문 처럼 단 =, <> 대신 in (), not in () 으로 작성 할 것
|
|
//꼭 Q|로 시작해야 함 Q|를 안붙이면 QID가 아닌 변수명으로 사용해야 함
|
|
var filterParam = "";
|
|
|
|
//// 옵션은 항목이 많아 별도의 함수에 정의
|
|
var optionParam = getOption();
|
|
$.each(indexArray, function(i,e){
|
|
var indexParam = e;
|
|
////HTML 테이블 생성
|
|
var tableA = createnode("table", "" , {"id" : "result_"+i, "class" : "table table-sm text-center table-bordered col-8", "style" : "table-layout:fixed;font-size:20px;"});
|
|
$("#content").append(tableA);
|
|
|
|
////Report API에서 결과를 받아옴
|
|
var resultData = getResultData(reportToken.Token,pkey,isKiwi,indexParam, bannerParam, filterParam, optionParam);
|
|
|
|
////TABLE에 TR로 타이틀을 붙임
|
|
tableA.prepend(createnode("tr", [createnode("th", titleArray[i], {"colspan":Object.keys(resultData[resultData.length-1]).length,"class":"bg-navy-2 text-white"})]));
|
|
|
|
///결과 값을 Table 형태로 그려주는 함수
|
|
//(Table 객체, Report 결과, 옵션 파라미터, Round 할 소수점 자리 수)
|
|
makeTable(tableA, resultData, optionParam,1);
|
|
});
|
|
|
|
///fillCellColor(tableID); ///쿼터를 그린 후 각 셀별로 진척도에 따라서 색을 채워주는 함수
|
|
}
|
|
}
|
|
|
|
function getReportToken(){
|
|
var reportToken = "";
|
|
$.ajax({
|
|
url: 'https://rapi.kric.com/api/v1/encrypt/external',
|
|
type: "POST",
|
|
contentType: "application/json; charset=utf-8",
|
|
data: JSON.stringify({ "external": "KON"}),
|
|
cache: false,
|
|
async: false,
|
|
success: function (data) {
|
|
reportToken = JSON.parse(data);
|
|
},
|
|
error: function (x, h, r) {
|
|
console.log(x);
|
|
console.log(h);
|
|
console.log(r);
|
|
}
|
|
});
|
|
return reportToken;
|
|
|
|
}
|
|
|
|
function getSkey(token,pkey,iskiwi){
|
|
var skey = "";
|
|
$.ajax({
|
|
url: 'https://rapi.kric.com/api/v1/encrypt/pkey',
|
|
type: "GET",
|
|
contentType: "application/json; charset=utf-8",
|
|
cache: false,
|
|
async: false,
|
|
beforeSend : function(xhr){
|
|
xhr.setRequestHeader("token", token);
|
|
xhr.setRequestHeader("pkey",pkey);
|
|
xhr.setRequestHeader("iskiwi",iskiwi);
|
|
},
|
|
success: function (data) {
|
|
skey = data;
|
|
},
|
|
error: function (x, h, r) {
|
|
console.log(x);
|
|
console.log(h);
|
|
console.log(r);
|
|
}
|
|
});
|
|
return skey;
|
|
}
|
|
|
|
function getOption(){
|
|
var reportOption = {
|
|
}
|
|
///일반적인 결과 테이블 사용
|
|
/*
|
|
{
|
|
"POINTER":"10", //출력 소수점(0~14)
|
|
"MPOINTER":"10", //평균(Mean) 출력 소수점(0~14)
|
|
"PRTMODE":"0",// 출력 내용 ("1" -> cell은 N만 Total은 N 만/ "2" -> cell은 %,N Total은 %,N / default -> cell은 %만 Total은 N 만)
|
|
"VGROUP":{"카테고리1":"1,2,3", "카테고리2":"4,5,6", "카테고리3":"7,8,9"}, // 값 그룹화(특정 값을 하나의 라벨로 묶어서 출력)
|
|
"SDATE":"2022-01-25", // 출력 데이터 기간 설정 - 시작 날짜(마지막 문항 기준)
|
|
"EDATE":"2022-01-26", // 출력 데이터 기간 설정 - 끝 날짜(마지막 문항 기준)
|
|
"TEST":"",//"TEST" 테스트 데이터 사용, "ALL" TEST와 실제 데이터 같이 사용 이외의 문자열 테스트 데이터 사용X
|
|
"TURN":"",// "1" 행 열 전환 이외의 문자열 행 열 전환X
|
|
"PRTHEAD":"",//"0" 헤더 출력 안함 이외의 문자열 헤더 출력
|
|
"PRTSUB":"",// "0" sub total 출력 안함 이외의 문자열 sub total 출력
|
|
}
|
|
///쿼터에서 사용
|
|
{
|
|
"QUOTA":"1" // 쿼터인경우 QSORDER(설정된 쿼터 번째 수)
|
|
"SDATE":"2022-01-25", // 출력 데이터 기간 설정 - 시작 날짜(마지막 문항 기준)
|
|
"EDATE":"2022-01-26", // 출력 데이터 기간 설정 - 끝 날짜(마지막 문항 기준)
|
|
"TEST":"",//"TEST" 테스트 데이터 사용, "ALL" TEST와 실제 데이터 같이 사용 이외의 문자열 테스트 데이터 사용X
|
|
}
|
|
*/
|
|
return reportOption;
|
|
}
|
|
|
|
function getResultData(token,pkey,iskiwi,indexParam, bannerParam, filterParam, optionParam){
|
|
var resultData = '';
|
|
var skey = getSkey(token,pkey,iskiwi);
|
|
$.ajax({
|
|
url: 'https://rapi.kric.com/api/v1/report/result',
|
|
type: "POST",
|
|
contentType: "application/json; charset=utf-8",
|
|
data: JSON.stringify({ "indexParam": indexParam, "bannerParam": bannerParam, "filterParam": filterParam, "optionParam" : JSON.stringify(optionParam)}),
|
|
cache: false,
|
|
async: false,
|
|
beforeSend : function(xhr){
|
|
xhr.setRequestHeader("token", token);
|
|
xhr.setRequestHeader("skey",skey);
|
|
},
|
|
success: function (data) {
|
|
resultData = data;
|
|
},
|
|
error: function (x, h, r) {
|
|
console.log(x);
|
|
console.log(h);
|
|
console.log(r);
|
|
}
|
|
});
|
|
return resultData;
|
|
}
|
|
|
|
function makeTable(table, data, options, fixedValue){
|
|
if (Array.isArray(data)) {
|
|
/////일반 Data
|
|
var header = 0;
|
|
var mean = 0;
|
|
$.each(data, function (i1, e1) {
|
|
var tr = [];
|
|
var i2Cnt = 0;
|
|
var roundPointer = 10 ** fixedValue;
|
|
$.each(data[i1], function (i2, e2) {
|
|
var val = e2;
|
|
if (val == null) {
|
|
val = "";
|
|
}
|
|
|
|
var tdJson = {};
|
|
|
|
if (val.indexOf("|") > -1) {
|
|
var splitArray = val.split('|');
|
|
var rowSpan = splitArray[1];
|
|
var colSpan = splitArray[2];
|
|
val = splitArray[0];
|
|
|
|
if (rowSpan != "") {
|
|
tdJson["rowspan"] = rowSpan;
|
|
}
|
|
|
|
if (colSpan != "") {
|
|
tdJson["colspan"] = colSpan;
|
|
}
|
|
|
|
if (i1 == 0 && i2Cnt == 0) {
|
|
if (options["TURN"] == "1") {
|
|
header = parseInt(colSpan);
|
|
}
|
|
else {
|
|
header = parseInt(rowSpan);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (val.trim() != "") {
|
|
var node = "td";
|
|
|
|
if (options["TURN"] != "1" && header > i1 || options["TURN"] == "1" && header > i2Cnt) {
|
|
node = "th";
|
|
tdJson["class"] = "bg-navy-4 text-white";
|
|
}
|
|
|
|
if (i2Cnt > 0 && val.indexOf(".") > 0 && isNaN(val) == false) {
|
|
//val = (Math.round(val * roundPointer) / roundPointer).toFixed(fixedValue) + '<input type="hidden" value = "' + val + '">';
|
|
val = (Math.round(val * roundPointer) / roundPointer).toFixed(fixedValue)
|
|
}
|
|
else{
|
|
|
|
}
|
|
|
|
tr.push(createnode(node, val, tdJson));
|
|
}
|
|
|
|
i2Cnt++;
|
|
});
|
|
table.append(createnode("tr", tr));
|
|
});
|
|
|
|
}
|
|
else {
|
|
var tr = [];
|
|
tr.push(createnode("td", data, { "class": "" }));
|
|
table.append(createnode("tr", tr));
|
|
}
|
|
}
|
|
|
|
function fillCellColor(tableID) {
|
|
var row = $("#"+tableID+" tr:first th:first").attr("rowspan");
|
|
var col = $("#"+tableID+" tr:first th:first").attr("colspan");
|
|
|
|
if (row == undefined) {
|
|
row = 1;
|
|
}
|
|
|
|
if (col == undefined) {
|
|
col = 1;
|
|
}
|
|
|
|
$("#"+tableID+" tr:gt(" + (+row - 1) + ")").each(function (i1, e1) {
|
|
$(e1).find(":gt(" + (+col - 1) + ")").each(function (i2, e2) {
|
|
if ($(e2).html().includes("/")) {
|
|
var tdValues = $(e2).html().split("/");
|
|
var spanColor = "";
|
|
|
|
if (isNaN(tdValues[2]) == false && +tdValues[2] > 0) {
|
|
if (+tdValues[2] <= 100) {
|
|
spanColor = "color:#008000"
|
|
$(e2).css("background", "linear-gradient(to right, #E4FFE4 " + tdValues[2] + "%, #fff 0%)");
|
|
}
|
|
else{
|
|
spanColor = "color:#FF0000"
|
|
$(e2).css("background", "linear-gradient(to right, #FFCCCC " + tdValues[2] + "%, #fff 0%)");
|
|
}
|
|
}
|
|
|
|
$(e2).html("<span style='" + spanColor+"'>" + tdValues[0] + "</span>/" + tdValues[1]);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
</script>
|
|
|
|
<!-- #include Virtual="/include/Footer.asp"-->
|
|
<script>
|
|
var loc = window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/'));
|
|
var pkey = loc.split("/")[2];
|
|
clklog("wi11u215oh",pkey,"","현황 페이지","","");
|
|
</script> |