Selaa lähdekoodia

모바일 메인 수정

juney 2 vuotta sitten
vanhempi
commit
23659b0060
1 muutettua tiedostoa jossa 220 lisäystä ja 0 poistoa
  1. 220 0
      src/main/webapp/mobile/js/app/main.js

+ 220 - 0
src/main/webapp/mobile/js/app/main.js

@@ -12,10 +12,230 @@ require(['config'], function() {
12 12
 
13 13
 let MOBILE_APP_VERSION = '';
14 14
 
15
+let NTICE_DETAIL_GRID_LIST = '/api/ntice/main-detail-grid-list';
16
+let MAIN_CHART_COUNT = '/api/main/chart/count';
17
+let MAIN_CHART_PCH_REQ_CHART = '/api/main/chart/pch-req-chart';
18
+let MAIN_CHART_PCH_ODR_CHART = '/api/main/chart/pch-odr-chart';
19
+let MAIN_CHART_PR_RANK_CHART = '/api/main/chart/pr-rank-chart';
20
+let MAIN_CHART_STL_CHART = '/api/main/chart/stl-chart';
21
+let MAIN_CHART_SFT_STCK_CHART = '/api/main/chart/sft-stck-chart';
22
+let MAIN_CHART_DELI_CHART = '/api/main/chart/deli-chart';
23
+
24
+var chartCnt=0;
25
+
15 26
 var mobMainObj = {
16 27
 	init: function () {
28
+		this.ui();
29
+		this.notice.init();
30
+		this.count.init();
31
+		this.chart.init();
32
+	},
33
+	ui: function() {
34
+		var authTpCd = fn_make_user_info.get('authTpCd');
35
+		if(authTpCd === '40' || authTpCd === '10') {
36
+			$('#ITP_MAIN_HEADER_BRAND').show();
37
+		} else if(authTpCd === '50') {
38
+			$('#ITP_MAIN_HEADER_STORE').show();
39
+		} else if(authTpCd === '60') {
40
+			$('#ITP_MAIN_HEADER_SPPLY').show();
41
+		}
17 42
 	},
43
+	notice: {
44
+		init: function () {
45
+			this.load();
46
+		},
47
+		load: function () {
48
+			var searchFn = function (result) {
49
+				console.log(result);
50
+				if(result.gridRecords > 0) {
51
+
52
+				} else {
53
+
54
+				}
55
+			};
56
+			const param = {};
57
+			fn_ajax_call(NTICE_DETAIL_GRID_LIST, JSON.stringify(param), searchFn, 'POST');
58
+		}
59
+	},
60
+	count: {
61
+		init: function () {
62
+			this.load();
63
+		},
64
+		load: function () {
65
+			var brandId = fn_make_user_info.get('brandId');
66
+			var storeId = fn_make_user_info.get('storeId');
67
+			var spplyId = fn_make_user_info.get('spplyId');
68
+
69
+			if(brandId == '' && storeId == '' && spplyId == '') {
70
+				return;
71
+			}
72
+
73
+			const key = { brandId:brandId, storeId:storeId, spplyId:spplyId };
74
+			var param = $.param(key);
75
+			fn_ajax_call(MAIN_CHART_COUNT, param, function(result) {
76
+				console.log(result);
77
+
78
+				$('#ITP_MAIN_CONTAINER .fnPr20Count').text( CommonObj.currency.add( result.pr20Count, '건' ));
79
+				$('#ITP_MAIN_CONTAINER .fnDp02Amt').text( CommonObj.currency.add( result.dp02Amt ));
80
+				$('#ITP_MAIN_CONTAINER .fnUnpaidAmt').text( CommonObj.currency.add( result.unpaidAmt ));
81
+
82
+				$('#ITP_MAIN_CONTAINER .fnPo30Count').text( CommonObj.currency.add( result.po30Count, '건' ));
83
+				$('#ITP_MAIN_CONTAINER .fnPoEndCount').text( CommonObj.currency.add( result.poEndCount, '건' ));
84
+				$('#ITP_MAIN_CONTAINER .fnPoPsblAmt').text( CommonObj.currency.add( result.poPsblAmt ));
85
+
86
+				$('#ITP_MAIN_CONTAINER .fnOrdersCount').text( CommonObj.currency.add( result.ordersCount, '건' ) );
87
+				$('#ITP_MAIN_CONTAINER .fnOrdersAmt').text( CommonObj.currency.add( result.ordersAmt ));
88
+				$('#ITP_MAIN_CONTAINER .fnSttlReqAmt').text( CommonObj.currency.add( result.sttlReqAmt ));
89
+
90
+			}, 'GET');
91
+		}
92
+	},
93
+	chart: {
94
+		init: function () {
95
+			//그래프
96
+			google.charts.load('current', {'packages':['corechart']});
97
+			google.charts.load('current', {'packages':['bar']});
98
+			this.view();
99
+		},
100
+		view:function() {
101
+			$('div[id^="ITP_MAIN_DRAW"]').hide();
102
+			var authTpCd = fn_make_user_info.get('authTpCd');
103
+			if(authTpCd === '40' || authTpCd === '10') {
104
+				this.brand.init();
105
+			} else if(authTpCd === '50') {
106
+				this.store.init();
107
+			} else if(authTpCd === '60') {
108
+				this.spply.init();
109
+			}
110
+		},
111
+		brand: {
112
+			init: function() {
113
+				$('#ITP_MAIN_DRAW_CHART_REQ').show();
114
+				google.charts.setOnLoadCallback(this.drawChartReq); // 구매요청
115
+
116
+				$('#ITP_MAIN_DRAW_CHART_PODR').show();
117
+				google.charts.setOnLoadCallback(this.drawChartPodr); // 구매발주
118
+
119
+				$('#ITP_MAIN_DRAW_CHART_REQ_UP').show();
120
+				google.charts.setOnLoadCallback(this.drawChartReqUp); // 매출순위
121
+
122
+				if(fn_make_user_info.get('brandId')) {
123
+					$('#ITP_MAIN_DRAW_CHART_CORE').show();
124
+					google.charts.setOnLoadCallback(this.drawChartcore); // 정산
125
+					chartCnt=4;
126
+				} else {
127
+					chartCnt=3;
128
+				}
129
+
130
+				$('#ITP_MAIN_DRAW_LINE').show();
131
+				$('#ITP_MAIN_DRAW_LINE .itp_main_draw_line').show();
132
+				google.charts.setOnLoadCallback(this.drawLine); // 안전재고
133
+			},
134
+			drawChartReq: function() {
135
+				const key = { brandId:fn_make_user_info.get('brandId'), storeId:fn_make_user_info.get('storeId'), prType: $('#ITP_FORM_MAIN_SEARCH_PR_TYPE').val() };
136
+				var param = $.param(key);
137
+				fn_ajax_call(MAIN_CHART_PCH_REQ_CHART, param, function(result) {
138
+
139
+					var data = google.visualization.arrayToDataTable( eval(result.chartData) );
140
+					var options = {
141
+						legend: { position: 'left' },
142
+						bar: { groupWidth: "50%" },
143
+						width: chartCnt==4? 245: 300,
144
+					};
145
+					var chart = new google.charts.Bar(document.getElementById('ITP_PCH_REQ_GRAPH'));
146
+					// chart.draw(data, options);
147
+					console.log("xx draw char req xx", param, data, chart)
148
+					chart.draw(data, google.charts.Bar.convertOptions(options));
149
+
150
+				}, 'GET');
151
+			},
152
+			drawChartPodr: function() {
153
+				const key = { brandId:fn_make_user_info.get('brandId'), storeId:fn_make_user_info.get('storeId'), poType: $('#ITP_FORM_MAIN_SEARCH_PO_TYPE').val() };
154
+				var param = $.param(key);
155
+				fn_ajax_call(MAIN_CHART_PCH_ODR_CHART, param, function(result) {
156
+
157
+					var data = google.visualization.arrayToDataTable( eval(result.chartData) );
158
+
159
+					var options = {
160
+						legend: { position: 'left' },
161
+						bar: { groupWidth: "50%" },
162
+						width: chartCnt==4? 245: 300,
163
+					};
164
+					var chart = new google.charts.Bar(document.getElementById('ITP_PCH_PODR_GRAPH'));
165
+					// chart.draw(data, options);
166
+					chart.draw(data, google.charts.Bar.convertOptions(options));
167
+
168
+				}, 'GET');
169
+			},
170
+			drawChartReqUp: function() {
171
+				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() };
172
+				var param = $.param(key);
173
+				fn_ajax_call(MAIN_CHART_PR_RANK_CHART, param, function(result) {
174
+
175
+					var data = google.visualization.arrayToDataTable( eval(result.chartData) );
176
+
177
+					var options = {
178
+						title: '구매요청 상위 품목',
179
+						legend: { position: 'left' },
180
+						bars: 'horizontal',
181
+						width: 300,
182
+					};
183
+					console.log("xxxxxxxxxxx drawChartReqUp xxxxxxxxxxx")
184
+
185
+					var chart = new google.charts.Bar(document.getElementById('ITP_PCH_REQ_UP_ITEM_GRAPH'));
186
+					chart.draw(data, options);
187
+
188
+				}, 'GET');
189
+			},
190
+			drawChartcore: function() {
191
+				const key = { brandId:fn_make_user_info.get('brandId'), storeId:fn_make_user_info.get('storeId'), spplyId:fn_make_user_info.get('spplyId') };
192
+				var param = $.param(key);
193
+				fn_ajax_call(MAIN_CHART_STL_CHART, param, function(result) {
194
+
195
+					// var data = google.visualization.arrayToDataTable([ [' ', ' '], ['요청', 25], ['확인', 65], ['반려', 10] ]);
196
+					var data = google.visualization.arrayToDataTable( eval(result.chartData) );
197
+
198
+					var options = {
199
+						// title: '정산',
200
+						legend: { position: 'left' },
201
+						width: 300,
202
+					};
203
+					var chart = new google.visualization.PieChart(document.getElementById('ITP_STTL_GRAPH'));
204
+					console.log("xxxxxxxxxxx drawChartcore xxxxxxxxxxx", data, options )
205
+					chart.draw(data, options);
206
+
207
+				}, 'GET');
208
+			},
209
+			drawLine: function() {
210
+				const key = { brandId:fn_make_user_info.get('brandId'), storeId:fn_make_user_info.get('storeId') };
211
+				var param = $.param(key);
212
+				fn_ajax_call(MAIN_CHART_SFT_STCK_CHART, param, function(result) {
213
+
214
+					var data = google.visualization.arrayToDataTable( eval(result.chartData) );
215
+
216
+					var options = {
217
+						title: '',
218
+						width: 900,
219
+						legend: { position: 'top' }
220
+					};
221
+
222
+					var chart = new google.visualization.LineChart(document.getElementById('ITP_SAFE_STCK_GRAPH'));
223
+					chart.draw(data, options);
224
+
225
+				}, 'GET');
226
+			}
227
+		},
228
+		store: {
229
+			init: function() {
230
+
231
+			}
232
+		},
233
+		spply: {
234
+			init: function() {
18 235
 
236
+			}
237
+		}
238
+	}
19 239
 };
20 240
 
21 241
 function appCallFnVersion(version) {