123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517 |
- require(['config'], function() {
- require([
- 'jquery'
- ], function($) {
- setTimeout(function() {
- // mobMainObj.init();
- }, 100);
- });
- });
- let MOBILE_APP_VERSION = '';
- let NTICE_DETAIL_GRID_LIST = '/api/ntice/main-detail-grid-list';
- let MAIN_CHART_COUNT = '/api/main/chart/count';
- let MAIN_CHART_PCH_REQ_CHART = '/api/main/chart/pch-req-chart';
- let MAIN_CHART_PCH_ODR_CHART = '/api/main/chart/pch-odr-chart';
- let MAIN_CHART_PR_RANK_CHART = '/api/main/chart/pr-rank-chart';
- let MAIN_CHART_STL_CHART = '/api/main/chart/stl-chart';
- let MAIN_CHART_SFT_STCK_CHART = '/api/main/chart/sft-stck-chart';
- let MAIN_CHART_DELI_CHART = '/api/main/chart/deli-chart';
- var chartCnt=0;
- var chartWidth=window.offsetWidth-16;
- function clickNotify(nticeNo) {
- mobPopObj.popNotice.open(nticeNo);
- }
-
- var mobMainObj = {
- init: function () {
- var PushURL = urlParams.PushURL;
- if(PushURL) {
- const id = PushURL.substring(PushURL.lastIndexOf('/') + 1, PushURL.length).replace(".html", "");
- const href = MOBILE_CONTEXTPATH + PushURL;
- _this.loadPage(id, href);
- } else {
- this.ui();
- this.action();
- this.notice.init();
- // this.count.init();
- // this.chart.init();
- }
-
- },
- ui: function() {
- var authTpCd = fn_make_user_info.get('authTpCd');
- if(authTpCd === '40' ) {
- $('#ITP_BRAND_ICON_BAR').show();
- if(fn_make_user_info.get('authTpCd') === '40') {
- if(fn_make_user_info.get('shmtColProcType') === '10') {
- $('#ITP_BRAND_ICON_BAR .itp_icon_bar').each(function(i) {
- if(i < 2) {
- $(this).find('.md').remove();
- $(this).find('.itp_icon').addClass('w50');
- }
- });
- }
- }
- } else if(authTpCd === '50') {
- $('#ITP_STR_ICON_BAR').show();
- } else if(authTpCd === '60') {
- $('#ITP_SPY_ICON_BAR').show();
- }
- },
- action: function() {
- var _this = this;
- var getURL = function(id) {
- var rtnURL = '';
- $.each(AUTH_MENU_LIST, function(key, value) {
- if(value.menuId === id) {
- rtnURL = value.connUrl;
- return false;
- }
- });
- return rtnURL;
- };
- $('#ITP_MAIN_CONTAINER button').on('click', function() {
- const id = $(this).data('menu-id');
- const connURL = getURL(id);
- if(connURL !== '') {
- const href = MOBILE_CONTEXTPATH + connURL;
- fn_make_slide_menu.loadPage(id, href);
- }
- });
- },
- notice: {
- init: function () {
- this.load();
- },
- load: function () {
- var searhFn = function(result) {
- if(Array.isArray(result.gridRows) && result.gridRows.length ) {
- var s='', idx=1;
- for(var c of result.gridRows ) {
- let title=c.nticeTitl;
- if(title.length>62) {
- title=title.substr(0,62)+'...';
- }
- s+=`<li>
- <div class="itp_note_info">
- <div class="under fnNoteTitle"><a href="javascript:clickNotify('${c.nticeNo}')">${title}</a></div>
- <div style="width:75px;" class="fnNoteDt">${c.addDt}</div>
- </div>
- </li>`;
- }
- $('#ITP_NOTE_ROW').html(s);
- } else {
- $('#ITP_NOTE_ROW').html('<div class="itp_note_bar" style="display: block;"> <h1>등록된 게시물이 없습니다.</h1> </div>')
- }
- };
- fn_ajax_call(NTICE_DETAIL_GRID_LIST, "{}", searhFn, 'POST');
- }
- },
- count: {
- init: function () {
- this.load();
- },
- load: function () {
- var brandId = fn_make_user_info.get('brandId');
- var storeId = fn_make_user_info.get('storeId');
- var spplyId = fn_make_user_info.get('spplyId');
- if(brandId == '' && storeId == '' && spplyId == '') {
- return;
- }
- const key = { brandId:brandId, storeId:storeId, spplyId:spplyId };
- var param = $.param(key);
- fn_ajax_call(MAIN_CHART_COUNT, param, function(result) {
- console.log(result);
- $('#ITP_MAIN_CONTAINER .fnPr20Count').text( CommonObj.currency.add( result.pr20Count, '건' ));
- $('#ITP_MAIN_CONTAINER .fnDp02Amt').text( CommonObj.currency.add( result.dp02Amt ));
- $('#ITP_MAIN_CONTAINER .fnUnpaidAmt').text( CommonObj.currency.add( result.unpaidAmt ));
- $('#ITP_MAIN_CONTAINER .fnPo30Count').text( CommonObj.currency.add( result.po30Count, '건' ));
- $('#ITP_MAIN_CONTAINER .fnPoEndCount').text( CommonObj.currency.add( result.poEndCount, '건' ));
- $('#ITP_MAIN_CONTAINER .fnPoPsblAmt').text( CommonObj.currency.add( result.poPsblAmt ));
- $('#ITP_MAIN_CONTAINER .fnOrdersCount').text( CommonObj.currency.add( result.ordersCount, '건' ) );
- $('#ITP_MAIN_CONTAINER .fnOrdersAmt').text( CommonObj.currency.add( result.ordersAmt ));
- $('#ITP_MAIN_CONTAINER .fnSttlReqAmt').text( CommonObj.currency.add( result.sttlReqAmt ));
- }, 'GET');
- }
- },
- chart: {
- init: function () {
- //그래프
- google.charts.load('current', {'packages':['corechart']});
- google.charts.load('current', {'packages':['bar']});
- this.view();
- },
- view:function() {
- $('div[id^="ITP_MAIN_DRAW"]').hide();
- var authTpCd = fn_make_user_info.get('authTpCd');
- console.log("chart init authTpCd=="+authTpCd)
- if(authTpCd === '40' ) {
- this.brand.init();
- } else if(authTpCd === '50') {
- this.store.init();
- } else if(authTpCd === '60') {
- this.spply.init();
- }
- const me=this;
- $('#ITP_FORM_MAIN_SEARCH_PR_TYPE').on('change', function() {
- me.drawChartReq();
- });
-
- $('#ITP_FORM_MAIN_SEARCH_PO_TYPE').on('change', function() {
- me.drawChartPodr();
- });
-
- $('#ITP_FORM_MAIN_SEARCH_ITEM_CNT_TYPE').on('change', function() {
- me.drawChartReqUp();
- });
-
- $('#ITP_FORM_MAIN_SEARCH_DELI_TYPE').on('change', function() {
- me.drawChartDeli();
- });
-
- $('#ITP_FORM_MAIN_SEARCH_RELEASE_TYPE').on('change', function() {
- me.drawChartRelease();
- });
-
- $('#ITP_FORM_MAIN_SEARCH_ORDERS_TYPE').on('change', function() {
- me.drawChartOrders();
- });
- },
- store: {
- init: function() {
- const chart=mobMainObj.chart;
- $('#ITP_MAIN_HEADER_STORE').show();
- $('#ITP_MAIN_DRAW_CHART_REQ').show();
- google.charts.setOnLoadCallback(chart.drawChartReq); // 구매요청
-
- $('#ITP_MAIN_DRAW_DELI_CHART').show();
- google.charts.setOnLoadCallback(chart.drawChartDeli); // 입고
-
- $('#ITP_MAIN_DRAW_CHART_REQ_UP').show();
- $('#ITP_MAIN_DRAW_CHART_REQ_UP .itp_graph_header > label').html("요청순위");
- google.charts.setOnLoadCallback(chart.drawChartReqUp); // 매출순위
-
- $('#ITP_MAIN_DRAW_CHART_CORE').show();
- google.charts.setOnLoadCallback(chart.drawChartcore); // 정산
- chartCnt=4;
-
- }
- },
- spply: {
- init: function() {
- const chart=mobMainObj.chart;
- $('#ITP_MAIN_HEADER_SPPLY').show();
-
- $('#ITP_MAIN_DRAW_ORDERS_CHART').show();
- google.charts.setOnLoadCallback(chart.drawChartOrders); // 수주내역
-
- $('#ITP_MAIN_DRAW_RELEASE_CHART').show();
- google.charts.setOnLoadCallback(chart.drawChartRelease); // 출고
-
- $('#ITP_MAIN_DRAW_CHART_REQ_UP').show();
- $('#ITP_MAIN_DRAW_CHART_REQ_UP .itp_graph_header > label').html("수주순위");
- google.charts.setOnLoadCallback(chart.drawChartReqUp); // 매출순위
-
- $('#ITP_MAIN_DRAW_CHART_CORE').show();
- google.charts.setOnLoadCallback(chart.drawChartcore); // 정산
- chartCnt=4;
- }
- },
- brand: {
- init: function() {
- const chart=mobMainObj.chart;
- $('#ITP_MAIN_DRAW_CHART_REQ').show();
- google.charts.setOnLoadCallback(chart.drawChartReq); // 구매요청
- $('#ITP_MAIN_DRAW_CHART_PODR').show();
- google.charts.setOnLoadCallback(chart.drawChartPodr); // 구매발주
- $('#ITP_MAIN_DRAW_CHART_REQ_UP').show();
- $('#ITP_MAIN_DRAW_CHART_REQ_UP .itp_graph_header > label').html("요청순위");
- google.charts.setOnLoadCallback(chart.drawChartReqUp); // 매출순위
- if(fn_make_user_info.get('brandId')) {
- $('#ITP_MAIN_DRAW_CHART_CORE').show();
- google.charts.setOnLoadCallback(chart.drawChartcore); // 정산
- }
- $('#ITP_MAIN_DRAW_LINE').show();
- $('#ITP_MAIN_DRAW_LINE .itp_main_draw_line').show();
- google.charts.setOnLoadCallback(chart.drawLine); // 안전재고
- },
- },
- drawChartReq: function() {
- const key = { brandId:fn_make_user_info.get('brandId'), storeId:fn_make_user_info.get('storeId'), prType: $('#ITP_FORM_MAIN_SEARCH_PR_TYPE').val() };
- var param = $.param(key);
- fn_ajax_call(MAIN_CHART_PCH_REQ_CHART, param, function(result) {
- var data = google.visualization.arrayToDataTable( eval(result.chartData) );
- var options = {
- legend: { position: 'left' },
- bar: { groupWidth: "50%" },
- width: chartWidth,
- };
- const el=document.getElementById('ITP_PCH_REQ_GRAPH');
- $(el).css('margin-top','16px');
- var chart = new google.charts.Bar(el);
- // chart.draw(data, options);
- console.log("xx draw char req xx", param, data, chart)
- chart.draw(data, google.charts.Bar.convertOptions(options));
- }, 'GET');
- },
- drawChartPodr: function() {
- const key = { brandId:fn_make_user_info.get('brandId'), storeId:fn_make_user_info.get('storeId'), poType: $('#ITP_FORM_MAIN_SEARCH_PO_TYPE').val() };
- var param = $.param(key);
- fn_ajax_call(MAIN_CHART_PCH_ODR_CHART, param, function(result) {
- var data = google.visualization.arrayToDataTable( eval(result.chartData) );
- var options = {
- legend: { position: 'left' },
- bar: { groupWidth: "50%" },
- width: chartWidth,
- };
- const el=document.getElementById('ITP_PCH_PODR_GRAPH');
- $(el).css('margin-top','16px');
- var chart = new google.charts.Bar(el);
- // chart.draw(data, options);
- chart.draw(data, google.charts.Bar.convertOptions(options));
- }, 'GET');
- },
- drawChartReqUp: function() {
- const key = { brandId:fn_make_user_info.get('brandId'), storeId:fn_make_user_info.get('storeId'), spplyId:fn_make_user_info.get('spplyId'), prType: $('#ITP_FORM_MAIN_SEARCH_ITEM_CNT_TYPE').val() };
- var param = $.param(key);
- fn_ajax_call(MAIN_CHART_PR_RANK_CHART, param, function(result) {
- var data = google.visualization.arrayToDataTable( eval(result.chartData) );
- var options = {
- title: '구매요청 상위 품목',
- legend: { position: 'left' },
- bars: 'horizontal',
- width: chartWidth,
- };
- const el=document.getElementById('ITP_PCH_REQ_UP_ITEM_GRAPH');
- $(el).css('margin-top','40px');
- var chart = new google.charts.Bar(el);
- chart.draw(data, options);
- }, 'GET');
- },
- drawChartcore: function() {
- const key = { brandId:fn_make_user_info.get('brandId'), storeId:fn_make_user_info.get('storeId'), spplyId:fn_make_user_info.get('spplyId') };
- var param = $.param(key);
- fn_ajax_call(MAIN_CHART_STL_CHART, param, function(result) {
- // var data = google.visualization.arrayToDataTable([ [' ', ' '], ['요청', 25], ['확인', 65], ['반려', 10] ]);
- var data = google.visualization.arrayToDataTable( eval(result.chartData) );
- var options = {
- title: '',
- legend: { position: 'left' },
- width: chartWidth,
- };
- const el=document.getElementById('ITP_STTL_GRAPH');
- var chart = new google.visualization.PieChart(el);
- $(el).css('margin-top','40px');
- chart.draw(data, options);
- }, 'GET');
- },
- drawLine: function() {
- const key = { brandId:fn_make_user_info.get('brandId'), storeId:fn_make_user_info.get('storeId') };
- var param = $.param(key);
- fn_ajax_call(MAIN_CHART_SFT_STCK_CHART, param, function(result) {
- var list=[], idx=0, res=eval(result.chartData);
- for(var c of res) {
- if(idx>5) break;
- list.push(res[idx++]);
- }
- var data = google.visualization.arrayToDataTable( list );
- var options = {
- title: '',
- pointSize: 4,
- width: chartWidth + 100,
- legend: { position: 'top' }
- };
- const el=document.getElementById('ITP_SAFE_STCK_GRAPH');
- $(el).css('margin-top','40px');
- var chart = new google.visualization.LineChart(el);
- chart.draw(data, options);
- }, 'GET');
- },
- //수주내역 그래프
- drawChartOrders() {
- const key = { brandId:fn_make_user_info.get('brandId'),
- spplyId:fn_make_user_info.get('spplyId'),
- poType: $('#ITP_FORM_MAIN_SEARCH_ORDERS_TYPE').val() };
- var param = $.param(key);
- fn_ajax_call(MAIN_CHART_PCH_ODR_CHART, param, function(result) {
-
- var data = google.visualization.arrayToDataTable( eval(result.chartData) );
- var options = {
- legend: { position: 'left' },
- width: chartWidth,
- };
- const el=document.getElementById('ITP_ORDERS_GRAPH');
- $(el).css('margin-top','16px');
- var chart = new google.charts.Bar(el);
- chart.draw(data, options);
-
- }, 'GET');
-
- },
- //입고 그래프
- drawChartDeli() {
-
- const key = { brandId:fn_make_user_info.get('brandId'),
- storeId:fn_make_user_info.get('storeId'),
- deliType: $('#ITP_FORM_MAIN_SEARCH_DELI_TYPE').val() };
- var param = $.param(key);
- fn_ajax_call(MAIN_CHART_DELI_CHART, param, function(result) {
-
- var data = google.visualization.arrayToDataTable( eval(result.chartData) );
- var options = {
- legend: { position: 'left' },
- width: chartWidth,
- };
- const el=document.getElementById('ITP_DELI_GRAPH');
- $(el).css('margin-top','16px');
- var chart = new google.charts.Bar(el);
- chart.draw(data, options);
-
- }, 'GET');
-
- },
- //출고 그래프
- drawChartRelease() {
-
- const key = { brandId:fn_make_user_info.get('brandId'),
- spplyId:fn_make_user_info.get('spplyId'),
- deliType: $('#ITP_FORM_MAIN_SEARCH_RELEASE_TYPE').val() };
- var param = $.param(key);
- fn_ajax_call(MAIN_CHART_DELI_CHART, param, function(result) {
-
- var data = google.visualization.arrayToDataTable( eval(result.chartData) );
- var options = {
- legend: { position: 'left' },
- width: chartWidth,
- };
- const el=document.getElementById('ITP_RELEASE_GRAPH');
- $(el).css('margin-top','16px');
- var chart = new google.charts.Bar(el);
- chart.draw(data, options);
-
- }, 'GET');
- },
- //구매발주 그래프
- drawChartPodr() {
-
- const key = { brandId:fn_make_user_info.get('brandId'), storeId:fn_make_user_info.get('storeId'), poType: $('#ITP_FORM_MAIN_SEARCH_PO_TYPE').val() };
- var param = $.param(key);
- fn_ajax_call(MAIN_CHART_PCH_ODR_CHART, param, function(result) {
-
- var data = google.visualization.arrayToDataTable( eval(result.chartData) );
-
- var options = {
- legend: { position: 'left' },
- bar: { groupWidth: "50%" },
- width: chartWidth,
- };
- const el=document.getElementById('ITP_PCH_PODR_GRAPH');
- $(el).css('margin-top','16px');
- var chart = new google.charts.Bar(el);
- // chart.draw(data, options);
- chart.draw(data, google.charts.Bar.convertOptions(options));
-
- }, 'GET');
-
- }
-
- }
- };
- function appCallFnVersion(version) {
- MOBILE_APP_VERSION = version;
- console.log(MOBILE_APP_VERSION);
- }
- let mobPopObj = {
- popNotice: {
- popId: 'ITP_POP_NOTICE',
- open: function (nticeNo) {
- mobPopObj.show(this.popId);
- this.search(nticeNo);
- },
- close: function() {
- mobPopObj.hide(this.popId);
- },
- search: function (nticeNo) {
- const me=this;
- fn_ajax_call('/api/ntice/info-ntice', {nticeNo}, function(result) {
- // 브랜드그룹 셋팅
- $('#ITP_POP_NOTICE_AREA .fnNoteNm').html(result.nticeTitl);
- $('#ITP_POP_NOTICE_AREA .fnNote').html(result.nticeDesc);
- $('#ITP_POP_NOTICE_AREA .fnNoteFromTo').html(result.notiStDay+' ~ '+result.notiEdDay);
- me.makeFileDownloadTable($('#ITP_POP_NOTICE_AREA .fnNoteFile'),result.fileNo);
- /*
- $('#ITP_FORM_NOTICE_INFO_POPUP_AFFL_SHOP_NM').html(result.afflShopNm);
- $('#ITP_FORM_NOTICE_INFO_POPUP_BRAND_NM').html(result.brandNm);
- */
- }, 'GET');
- },
- makeFileDownloadTable: function (el, fileNo) {
- var searhFn = function(result) {
- var html = '';
- html += '<table class="table fileupload-download">';
- html += '<tbody>';
- $.each(result, function (key, value) {
- html += '<tr class="fileupload-downloadrow no-thumb row">';
- html += '<td class="col-xs-9 itp_file_info" data-file-no="' + value.fileNo + '" data-file-seq="' + value.fileSeq + '">';
- html += '<a href="' + DOMAIN + '/api/file/download/' + value.fileNo + '/' + value.fileSeq + '">';
- html += value.fileOrgNm + '</a></td>';
- html += '<td class="col-xs-3">' + value.fileSize + '</td>';
- html += '</tr>';
- });
- html += '</tbody>';
- html += '</table>';
- el.html(html);
- }
- fn_ajax_call('/api/file/list', {fileNo}, searhFn, 'GET');
- }
-
- },
- show: function(popId) {
- $('#' + popId+' .btn-pop-close').on('click', function() {
- mobPopObj.hide(popId);
- });
- $('#' + popId).show();
- },
- hide: function(popId) {
- $('#' + popId).closest('.mobile-pop-close').hide();
- }
- };
- function appCallFnConnKey(connKey) {
- if(connKey) {
- sessionStorage.setItem('itp_login_info', JSON.stringify({
- timestamp: new Date(),
- connKey: connKey
- }));
- itp_fn_session_data(connKey);
- } else {
- location.replace('app:logout');
- }
- }
|