|
@@ -0,0 +1,441 @@
|
|
1
|
+require(['config'], function() {
|
|
2
|
+ require([
|
|
3
|
+ ], function($) {
|
|
4
|
+ pageObj.init();
|
|
5
|
+ });
|
|
6
|
+});
|
|
7
|
+
|
|
8
|
+/********************************************************
|
|
9
|
+ --------------------------------------------------------
|
|
10
|
+ - Object 목록 -
|
|
11
|
+ --------------------------------------------------------
|
|
12
|
+ * const gridColModel = {} : 화면 Grid Object *
|
|
13
|
+ * let pageObj = {} : 화면공통 Object *
|
|
14
|
+ * let listObj = {} : 목록화면 Object *
|
|
15
|
+ * let viewObj = {} : 상세화면 Object *
|
|
16
|
+ * let modifyObj = {} : 수정화면 Object *
|
|
17
|
+ * let createObj = {} : 신규화면 Object *
|
|
18
|
+ *******************************************************/
|
|
19
|
+
|
|
20
|
+/*화면 변수*/
|
|
21
|
+const RTNMNG01010_DETAIL_GRID_ID = '#ITP_RTNMNG01010_DETAIL_jqGrid';
|
|
22
|
+const RTNMNG01010_DETAIL_GRID_LIST = '#ITP_RTNMNG01010_DETAIL_jqGrid_list';
|
|
23
|
+const RTNMNG01010_DETAIL_GRID_PAGER = '#ITP_RTNMNG01010_DETAIL_jqGridPager';
|
|
24
|
+const RTNMNG01010_DETAIL_GRID_EMPTY = '#ITP_RTNMNG01010_DETAIL_jqGridEmpty'; // ==>dwkim html확인필요
|
|
25
|
+
|
|
26
|
+let RTNMNG01010_DETAIL_GRID_LAST_ROW_ID;
|
|
27
|
+
|
|
28
|
+/*API URL*/
|
|
29
|
+let API_DETAIL_INIT_INFO = '/api/rtnmng/init-rtnReq'
|
|
30
|
+let API_DETAIL_SAVE = '/api/rtnmng/save-rtnReq';
|
|
31
|
+
|
|
32
|
+/*화면 Grid ColModel ==>선택박스 항목 추가 부분 */
|
|
33
|
+const gridColModel = {
|
|
34
|
+ detail: [
|
|
35
|
+ {
|
|
36
|
+ index: 'VIEW_CD', name: 'viewCd',
|
|
37
|
+ label: ITP_MSG_LOCALE.label.viewCd,
|
|
38
|
+ width: '10', fixed: false, align: 'center',
|
|
39
|
+ sortable: false, hidden: true
|
|
40
|
+ },
|
|
41
|
+ {
|
|
42
|
+ index: 'ITEM_ID', name: 'itemId',
|
|
43
|
+ label: ITP_MSG_LOCALE.label.itemId,
|
|
44
|
+ width: '20', fixed: false, align: 'center',
|
|
45
|
+ sortable: false, editable: false, edittype: 'text',
|
|
46
|
+ editrules: { required: true }
|
|
47
|
+ },
|
|
48
|
+ {
|
|
49
|
+ index: 'ITEM_NM', name: 'itemNm',
|
|
50
|
+ label: ITP_MSG_LOCALE.label.itemNm,
|
|
51
|
+ width: '30', fixed: false, align: 'center',
|
|
52
|
+ sortable: true, editable: false, edittype: 'text',
|
|
53
|
+ editrules: { required: true }
|
|
54
|
+ },
|
|
55
|
+ {
|
|
56
|
+ index: 'UNIT', name: 'unit',
|
|
57
|
+ label: ITP_MSG_LOCALE.label.unit,
|
|
58
|
+ width: '10', fixed: false, align: 'center',
|
|
59
|
+ sortable: false, editable: false, edittype: 'text'
|
|
60
|
+ },
|
|
61
|
+ {
|
|
62
|
+ index: 'UNIT_AMT', name: 'unitAmt',
|
|
63
|
+ label: ITP_MSG_LOCALE.label.unitAmt,
|
|
64
|
+ width: '10', fixed: false, align: 'center',
|
|
65
|
+ sortable: false, editable: false, edittype: 'text', hidden: false,
|
|
66
|
+ formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
|
|
67
|
+ },
|
|
68
|
+ {
|
|
69
|
+ index: 'PCH_REQ_QTY', name: 'pchReqQty',
|
|
70
|
+ label: ITP_MSG_LOCALE.label.pchReqQty, //수량
|
|
71
|
+ width: '10', fixed: false, align: 'right',
|
|
72
|
+ sortable: false, editable: true, edittype: 'text',
|
|
73
|
+ editrules: { number:true },
|
|
74
|
+ formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
|
|
75
|
+ },
|
|
76
|
+ {
|
|
77
|
+ index: 'PCH_REQ_AMT', name: 'pchReqAmt',
|
|
78
|
+ label: ITP_MSG_LOCALE.label.pchReqAmt,
|
|
79
|
+ width: '10', fixed: false, align: 'right',
|
|
80
|
+ sortable: false, editable: false, edittype: 'text', hidden: false,
|
|
81
|
+ formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
|
|
82
|
+ },
|
|
83
|
+
|
|
84
|
+ {
|
|
85
|
+ index: 'BRAND_UNIT_UNQ_NO', name: 'brandUnitUnqNo',
|
|
86
|
+ label: ITP_MSG_LOCALE.label.brandUnitUnqNo,
|
|
87
|
+ width: '10', fixed: false, align: 'center',
|
|
88
|
+ sortable: false, editable: false, edittype: 'text', hidden: true
|
|
89
|
+ },
|
|
90
|
+ {
|
|
91
|
+ index: 'STORE_UNIT_UNQ_NO', name: 'storeUnitUnqNo',
|
|
92
|
+ label: ITP_MSG_LOCALE.label.storeUnitUnqNo,
|
|
93
|
+ width: '10', fixed: false, align: 'center',
|
|
94
|
+ sortable: false, editable: false, edittype: 'text', hidden: true
|
|
95
|
+ },
|
|
96
|
+ {
|
|
97
|
+ index: 'UNIT_GUBUN', name: 'unitGubun',
|
|
98
|
+ label: ITP_MSG_LOCALE.label.unitGubun,
|
|
99
|
+ width: '10', fixed: false, align: 'center',
|
|
100
|
+ sortable: false, editable: false, edittype: 'text', hidden: true
|
|
101
|
+ }
|
|
102
|
+ ]
|
|
103
|
+};
|
|
104
|
+
|
|
105
|
+/*화면공통 Object*/
|
|
106
|
+let pageObj = {
|
|
107
|
+ init: function() {
|
|
108
|
+ this.ui.init();
|
|
109
|
+ this.event.init();
|
|
110
|
+ this.action();
|
|
111
|
+ },
|
|
112
|
+ action: function () {
|
|
113
|
+ var _this = this;
|
|
114
|
+ // 납품장소 조회 버튼 클릭
|
|
115
|
+ $('#ITP_FORM_RTNMNG01010_SEARCH_WHS_NM').on('click', function() {
|
|
116
|
+ _this.popup();
|
|
117
|
+ });
|
|
118
|
+ // 납품장소 텍스트 삭제 버튼 클릭
|
|
119
|
+ $('#ITP_FORM_RTNMNG01010_DELETE_WHS_NM').on('click', function() {
|
|
120
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL_WHS_NM').val('');
|
|
121
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL_WHS_ID').val('');
|
|
122
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL_LOCATION_NM').val('');
|
|
123
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL_LOCATION').val('');
|
|
124
|
+
|
|
125
|
+ });
|
|
126
|
+ },
|
|
127
|
+ popup: function () {
|
|
128
|
+ // 팝업
|
|
129
|
+ var popFn = this.callback.create;
|
|
130
|
+
|
|
131
|
+ var whsDvsn = "";
|
|
132
|
+ if (fn_make_user_info.get('storeId') == '' ) {
|
|
133
|
+ whsDvsn = "W01";
|
|
134
|
+ } else {
|
|
135
|
+ whsDvsn = "W02";
|
|
136
|
+ }
|
|
137
|
+
|
|
138
|
+ const key = {brandId:fn_make_user_info.get('brandId'),storeId:fn_make_user_info.get('storeId'),whsDvsn: whsDvsn};
|
|
139
|
+ fn_call_popup('biz', 'BIZPOP_WHS_LOCATION', '#ITP_ASIDE', popFn, key, 'S');
|
|
140
|
+
|
|
141
|
+ },
|
|
142
|
+ callback: {
|
|
143
|
+ create: function(rowDataPop) {
|
|
144
|
+ console.log(rowDataPop);
|
|
145
|
+ if(rowDataPop) {
|
|
146
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL_WHS_NM').val(rowDataPop.whsNm);
|
|
147
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL_WHS_ID').val(rowDataPop.whsId);
|
|
148
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL_LOCATION_NM').val(rowDataPop.locationNm);
|
|
149
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL_LOCATION').val(rowDataPop.location);
|
|
150
|
+ }
|
|
151
|
+
|
|
152
|
+ }
|
|
153
|
+ },
|
|
154
|
+ itp_RTNMNG01010_param: {}, // ==>dwkim
|
|
155
|
+ itp_RTNMNG01010_search: false, // ==>dwkim
|
|
156
|
+ ui: {
|
|
157
|
+ init: function() {
|
|
158
|
+ this.view();
|
|
159
|
+ this.grid();
|
|
160
|
+ this.ready();
|
|
161
|
+ },
|
|
162
|
+ view: function() {
|
|
163
|
+ // 버튼 권한설정
|
|
164
|
+ fn_proc_btn_auth('RTNMNG01010');
|
|
165
|
+
|
|
166
|
+ // 공통코드 표시
|
|
167
|
+ $('select').each(function() {
|
|
168
|
+ if ($(this).data('select-code')) {
|
|
169
|
+ fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
|
|
170
|
+ }
|
|
171
|
+ });
|
|
172
|
+
|
|
173
|
+ // 조회일자 지정
|
|
174
|
+ //var now = new Date(date.getDate() + 5);
|
|
175
|
+ var now = new Date();
|
|
176
|
+ $('#ITP_TAB_RTNMNG01010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
|
|
177
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL_DLV_REQ_DT').datepicker('setDate', new Date(now.setDate(now.getDate() + 5)));
|
|
178
|
+
|
|
179
|
+ //납품장소 필드 readonly
|
|
180
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL_WHS_NM').attr('readonly', true);
|
|
181
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL_LOCATION_NM').attr('readonly', true);
|
|
182
|
+
|
|
183
|
+ },
|
|
184
|
+ grid: function() {
|
|
185
|
+ itp_fn_jqgrid_resize(RTNMNG01010_DETAIL_GRID_ID, RTNMNG01010_DETAIL_GRID_LIST, 'lg');
|
|
186
|
+ //listObj.empty.init();
|
|
187
|
+ itp_fn_fire_window_resize();
|
|
188
|
+ },
|
|
189
|
+ ready: function() {
|
|
190
|
+ createObj.init();
|
|
191
|
+ }
|
|
192
|
+ },
|
|
193
|
+ event: {
|
|
194
|
+ init: function() {
|
|
195
|
+ this.button();
|
|
196
|
+ },
|
|
197
|
+ button: function() {
|
|
198
|
+ // 버튼 클릭 이벤트
|
|
199
|
+ $('button').each(function() {
|
|
200
|
+ var id = $(this).attr('id');
|
|
201
|
+ $(this).on('click', function() {
|
|
202
|
+ switch (id) {
|
|
203
|
+ case 'ITP_BTN_RTNMNG01010_SRH': createObj.button.save("PR20"); break; // 구매요청
|
|
204
|
+ case 'ITP_BTN_RTNMNG01010_NEWREG': createObj.button.save("PR00"); break; // 임시저장
|
|
205
|
+ case 'ITP_BTN_RTNMNG01010_DETAIL_ADDROW': pageObj.grid.button.addRow(); break; // 품목추가
|
|
206
|
+ case 'ITP_BTN_RTNMNG01010_DETAIL_DELROW': pageObj.grid.button.delRow(); break; // 품목삭제
|
|
207
|
+ }
|
|
208
|
+ });
|
|
209
|
+ });
|
|
210
|
+
|
|
211
|
+ $('body').on('click', function(e) {
|
|
212
|
+ var gridId = RTNMNG01010_DETAIL_GRID_ID.replace('#', '');
|
|
213
|
+ var rids = $(RTNMNG01010_DETAIL_GRID_ID).jqGrid('getDataIDs');
|
|
214
|
+ var last_row_id = rids[rids.length - 1];
|
|
215
|
+
|
|
216
|
+ itp_fn_grid_reset_selection(e, last_row_id, gridId, 'RTNMNG01010_DETAIL');
|
|
217
|
+
|
|
218
|
+ pageObj.grid.recal();
|
|
219
|
+ });
|
|
220
|
+
|
|
221
|
+ }
|
|
222
|
+ },
|
|
223
|
+ grid: {
|
|
224
|
+ init: function(mode, gridData) {
|
|
225
|
+ this.mode = mode;
|
|
226
|
+ this.gridId = RTNMNG01010_DETAIL_GRID_ID;
|
|
227
|
+ this.unload(); // ==>dwkim
|
|
228
|
+ this.load(gridData);
|
|
229
|
+ },
|
|
230
|
+ mode: 'DETAIL',
|
|
231
|
+ gridId: '',
|
|
232
|
+ button: {
|
|
233
|
+ addRow: function() {
|
|
234
|
+ // 팝업
|
|
235
|
+ var popFn = function(rowDataPop) {
|
|
236
|
+ console.log(rowDataPop);
|
|
237
|
+ // 기존등록 데이터
|
|
238
|
+ var exists = '';
|
|
239
|
+ const rowData = $(RTNMNG01010_DETAIL_GRID_ID).getRowData();
|
|
240
|
+ $.each(rowData, function(key, value) {
|
|
241
|
+ exists = exists + value.brandUnitUnqNo + ';';
|
|
242
|
+ });
|
|
243
|
+
|
|
244
|
+ $.each(rowDataPop, function(key, value) {
|
|
245
|
+ if (exists.indexOf(value.brandUnitUnqNo) < 0 && value.podrPssblDvsn == 'PO01') {
|
|
246
|
+ value['viewCd'] = "C";
|
|
247
|
+ $(RTNMNG01010_DETAIL_GRID_ID).jqGrid('addRowData', value.brandUnitUnqNo, value, 'last');
|
|
248
|
+ }
|
|
249
|
+ });
|
|
250
|
+ $(RTNMNG01010_DETAIL_GRID_EMPTY).hide();
|
|
251
|
+ };
|
|
252
|
+ const key = {brandId:fn_make_user_info.get('brandId'),storeId:fn_make_user_info.get('storeId')};
|
|
253
|
+ fn_call_popup('biz', 'BIZPOP_ITEM', '#ITP_ASIDE', popFn, key, 'S'); // ==>dwkim 추후 작업 진행 파라메타 설명필요
|
|
254
|
+ },
|
|
255
|
+ delRow: function() {
|
|
256
|
+ itp_fn_grid_del_row(RTNMNG01010_DETAIL_GRID_ID);
|
|
257
|
+ // 그리드 포문으로 금액 재계산후 구매요청금액에 넣어줌
|
|
258
|
+ pageObj.grid.recal(); //==>dwkim 왜 호출이 안될까요
|
|
259
|
+ }
|
|
260
|
+ },
|
|
261
|
+ load: function(gridData) { // ==>dwkim 오픈시 데이타 가져오는 부분 넣으면 되는건지 여부 gird가 아님
|
|
262
|
+ var _this = this;
|
|
263
|
+ var option = {
|
|
264
|
+ gridId: this.gridId,
|
|
265
|
+ colModel: gridColModel.detail,
|
|
266
|
+ data: gridData,
|
|
267
|
+ multiselect: true,
|
|
268
|
+ // cellEdit: true,
|
|
269
|
+ onCellSelect: function(rowId, cellIdx, cellValue) {
|
|
270
|
+ RTNMNG01010_DETAIL_GRID_LAST_ROW_ID = itp_fn_set_data_editable(rowId, cellIdx, RTNMNG01010_DETAIL_GRID_LAST_ROW_ID, RTNMNG01010_DETAIL_GRID_ID, ['pchReqQty']);
|
|
271
|
+ },
|
|
272
|
+ loadComplete: function(data) {
|
|
273
|
+ _this.clearData();
|
|
274
|
+ }
|
|
275
|
+ };
|
|
276
|
+ itp_fn_grid_make_local(option);
|
|
277
|
+ },
|
|
278
|
+ clearData: function() {
|
|
279
|
+ // console.log(this.gridId);
|
|
280
|
+ $(RTNMNG01010_DETAIL_GRID_ID).jqGrid('clearGridData', true);
|
|
281
|
+ $(RTNMNG01010_DETAIL_GRID_LIST).find('.ui-jqgrid .ui-jqgrid-bdiv').css('overflow-x', 'hidden');
|
|
282
|
+ $(RTNMNG01010_DETAIL_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
|
|
283
|
+ $(RTNMNG01010_DETAIL_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
|
|
284
|
+ $(RTNMNG01010_DETAIL_GRID_EMPTY).show();
|
|
285
|
+ },
|
|
286
|
+ recal: function() {
|
|
287
|
+
|
|
288
|
+ var ids = $(RTNMNG01010_DETAIL_GRID_ID).getDataIDs();
|
|
289
|
+ $.each(ids, function(idx, rowId) {
|
|
290
|
+
|
|
291
|
+ var viewCd = jQuery(RTNMNG01010_DETAIL_GRID_ID).jqGrid('getCell', rowId, 'viewCd');
|
|
292
|
+ var unitAmt = jQuery(RTNMNG01010_DETAIL_GRID_ID).jqGrid('getCell', rowId, 'unitAmt');
|
|
293
|
+ var pchReqQty = jQuery(RTNMNG01010_DETAIL_GRID_ID).jqGrid('getCell', rowId, 'pchReqQty');
|
|
294
|
+
|
|
295
|
+ if(viewCd != 'D' && unitAmt != null && unitAmt != '' && pchReqQty != null && pchReqQty != '') {
|
|
296
|
+ jQuery(RTNMNG01010_DETAIL_GRID_ID).jqGrid('setRowData',rowId,{pchReqAmt: parseInt(unitAmt)*parseInt(pchReqQty)});
|
|
297
|
+ }
|
|
298
|
+ });
|
|
299
|
+
|
|
300
|
+ const rowData = $(RTNMNG01010_DETAIL_GRID_ID).getRowData();
|
|
301
|
+ var pchReqAmt = 0 ;
|
|
302
|
+ $.each(rowData, function(key, value) {
|
|
303
|
+ // console.log(JSON.stringify(rowData));
|
|
304
|
+ if (value.pchReqAmt != null && value.pchReqAmt != "" && value.viewCd != "D") {
|
|
305
|
+ pchReqAmt = pchReqAmt + parseInt(value.pchReqAmt) ;
|
|
306
|
+ }
|
|
307
|
+ });
|
|
308
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL .fnPchReqAmt').text(itp_fn_number_comma(pchReqAmt));
|
|
309
|
+ },
|
|
310
|
+ unload: function() {
|
|
311
|
+ $.jgrid.gridUnload(this.gridId);
|
|
312
|
+ }
|
|
313
|
+ }
|
|
314
|
+};
|
|
315
|
+
|
|
316
|
+/*신규화면 Object*/
|
|
317
|
+let createObj = {
|
|
318
|
+ init: function() {
|
|
319
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
|
|
320
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL_STORE_ID').val(fn_make_user_info.get('storeId'));
|
|
321
|
+ //let param = 'brandId=' + LOGIN_USER_INFO.brandId + "&spplyId=" + LOGIN_USER_INFO.spplyId;
|
|
322
|
+ this.load();
|
|
323
|
+ },
|
|
324
|
+ newinit: function() {
|
|
325
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
|
|
326
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL_STORE_ID').val(fn_make_user_info.get('storeId'));
|
|
327
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL_PCH_REQ_NM').val('');
|
|
328
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL_NOTE').val('');
|
|
329
|
+ var now = new Date();
|
|
330
|
+ $('#ITP_TAB_RTNMNG01010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
|
|
331
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL_DLV_REQ_DT').datepicker('setDate', new Date(now.setDate(now.getDate() + 5)));
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+ this.load(); //==>dwkim 초기화 하여 다시 초기 데이타 가져와 뿌려줌
|
|
335
|
+ const key = {brandId:fn_make_user_info.get('brandId'),storeId:fn_make_user_info.get('storeId')};
|
|
336
|
+ fn_ajax_call(API_DETAIL_INIT_INFO, key, this.callback, 'GET');
|
|
337
|
+ },
|
|
338
|
+ button: {
|
|
339
|
+ save: function(arg) {
|
|
340
|
+ $('body').trigger('click');
|
|
341
|
+
|
|
342
|
+ const formId = '#ITP_FORM_RTNMNG01010_DETAIL';
|
|
343
|
+ itp_fn_form_clear_validate(null, formId);
|
|
344
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL_PCH_REQ_ST_CD').val(arg);
|
|
345
|
+
|
|
346
|
+ //정산 타입이 무정산이면 스킵
|
|
347
|
+ var loanDvsn = $('#ITP_FORM_RTNMNG01010_DETAIL_LOAN_DVSN').val();
|
|
348
|
+
|
|
349
|
+ if (loanDvsn != null && loanDvsn != "") {
|
|
350
|
+
|
|
351
|
+ if (loanDvsn != 'LD03' && arg == 'PR20' ) {
|
|
352
|
+ var pchActAtm = $('#ITP_FORM_RTNMNG01010_DETAIL .fnPchActAmt').text();
|
|
353
|
+ var pchReqAtm = $('#ITP_FORM_RTNMNG01010_DETAIL .fnPchReqAmt').text();
|
|
354
|
+
|
|
355
|
+ if (parseInt(pchActAtm) < parseInt(pchReqAtm)) {
|
|
356
|
+ alert(ITP_MSG_LOCALE.message.ajax.lackReqAmt);
|
|
357
|
+ return;
|
|
358
|
+ }
|
|
359
|
+ }
|
|
360
|
+ }
|
|
361
|
+
|
|
362
|
+ if (itp_fn_form_event.isValid(formId)) {
|
|
363
|
+ // 품목대상 정보 확인 필요
|
|
364
|
+ var records = $(RTNMNG01010_DETAIL_GRID_ID).getGridParam('reccount');
|
|
365
|
+ if (records == 0) {
|
|
366
|
+ alert( "요청할 품목내역이 없습니다.");
|
|
367
|
+ return ;
|
|
368
|
+ }
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+ var saveReq = {
|
|
372
|
+ callBack: function(args) {
|
|
373
|
+ $(formId).val(arg);
|
|
374
|
+ let gridInsertData = [];
|
|
375
|
+ let gridUpdateData = [];
|
|
376
|
+ let gridDeleteData = [];
|
|
377
|
+
|
|
378
|
+ const rowData = $(RTNMNG01010_DETAIL_GRID_ID).getRowData();
|
|
379
|
+
|
|
380
|
+ $.each(rowData, function(key, value) {
|
|
381
|
+ if (value.viewCd !== 'R') {
|
|
382
|
+ if (value.viewCd === 'C') {
|
|
383
|
+ gridInsertData.push(value);
|
|
384
|
+ } else if (value.viewCd === 'U') {
|
|
385
|
+ gridUpdateData.push(value);
|
|
386
|
+ } else if (value.viewCd === 'D') {
|
|
387
|
+ gridDeleteData.push(value);
|
|
388
|
+ }
|
|
389
|
+ }
|
|
390
|
+ });
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+ let param = $(formId).serializeObject();
|
|
394
|
+ param.gridInsertData = gridInsertData;
|
|
395
|
+ param.gridUpdateData = gridUpdateData;
|
|
396
|
+ param.gridDeleteData = gridDeleteData;
|
|
397
|
+ console.log(JSON.stringify(param));
|
|
398
|
+ var searhFn = function() {
|
|
399
|
+ createObj.newinit();
|
|
400
|
+ };
|
|
401
|
+ fn_ajax_call(API_DETAIL_SAVE, JSON.stringify(param), searhFn, 'POST');
|
|
402
|
+ }
|
|
403
|
+ };
|
|
404
|
+ if (arg == 'PR20') {
|
|
405
|
+ itp_fn_modal_confirm(ITP_MSG_LOCALE.message.ajax.reqSave, saveReq, null);
|
|
406
|
+ } else {
|
|
407
|
+ itp_fn_modal_confirm(ITP_MSG_LOCALE.message.ajax.tmpSave, saveReq, null);
|
|
408
|
+ }
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+ }
|
|
413
|
+ }
|
|
414
|
+ },
|
|
415
|
+ load: function() {
|
|
416
|
+ const key = {brandId:fn_make_user_info.get('brandId'),storeId:fn_make_user_info.get('storeId')};
|
|
417
|
+ fn_ajax_call(API_DETAIL_INIT_INFO, key, this.callback, 'GET');
|
|
418
|
+ },
|
|
419
|
+ callback: function(result) {
|
|
420
|
+
|
|
421
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL #ITP_FORM_RTNMNG01010_DETAIL_VIEW_CD').val('C');
|
|
422
|
+
|
|
423
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL #ITP_FORM_RTNMNG01010_DETAIL_BRAND_ID').val(result.brandId);
|
|
424
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL #ITP_FORM_RTNMNG01010_DETAIL_STORE_ID').val(result.storeId);
|
|
425
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL #ITP_FORM_RTNMNG01010_DETAIL_LOAN_DVSN').val(result.loanDvsn);
|
|
426
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL #ITP_FORM_RTNMNG01010_DETAIL_LOAN_MGNT_UNQ_NO').val(result.loanMgntUnqNo);
|
|
427
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL #ITP_FORM_RTNMNG01010_DETAIL_PCH_REQ_DVSN').val(result.pchReqDvsn);
|
|
428
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL #ITP_FORM_RTNMNG01010_DETAIL_WHS_ID').val(result.whsId);
|
|
429
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL #ITP_FORM_RTNMNG01010_DETAIL_WHS_NM').val(result.whsNm);
|
|
430
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL #ITP_FORM_RTNMNG01010_DETAIL_LOCATION').val(result.location);
|
|
431
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL #ITP_FORM_RTNMNG01010_DETAIL_LOCATION_NM').val(result.locationNm);
|
|
432
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL .fnBrandNm').text(result.brandNm);
|
|
433
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL .fnPchReqDept').text(result.reqDept);
|
|
434
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL .fnPchReqMgrNm').text(result.userNm);
|
|
435
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL .fnPchReqAmt').text("0");
|
|
436
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL .fnLoanDvsnNm').text(result.loanDvsnNm);
|
|
437
|
+ $('#ITP_FORM_RTNMNG01010_DETAIL .fnPchActAmt').text(result.ordUseAmt);
|
|
438
|
+
|
|
439
|
+ pageObj.grid.init();
|
|
440
|
+ }
|
|
441
|
+};
|