|
@@ -0,0 +1,588 @@
|
|
1
|
+require(['config'], function() {
|
|
2
|
+ require([
|
|
3
|
+ ], function($) {
|
|
4
|
+ pageObj.init();
|
|
5
|
+ });
|
|
6
|
+});
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+//화면변수
|
|
10
|
+const POMNG04010_GRID_ID = '#ITP_POMNG04010_jqGrid';
|
|
11
|
+const POMNG04010_GRID_LIST = '#ITP_POMNG04010_jqGrid_list';
|
|
12
|
+const POMNG04010_GRID_PAGER = '#ITP_POMNG04010_jqGridPager';
|
|
13
|
+const POMNG04010_GRID_EMPTY = '#ITP_POMNG04010_jqGridEmpty';
|
|
14
|
+
|
|
15
|
+const POMNG04010_DETAIL_GRID_ID = '#ITP_POMNG04010_DETAIL_jqGrid';
|
|
16
|
+const POMNG04010_DETAIL_GRID_LIST = '#ITP_POMNG04010_DETAIL_jqGrid_list';
|
|
17
|
+const POMNG04010_DETAIL_GRID_PAGER = '#ITP_POMNG04010_DETAIL_jqGridPager';
|
|
18
|
+const POMNG04010_DETAIL_GRID_EMPTY = '#ITP_POMNG04010_DETAIL_jqGridEmpty';
|
|
19
|
+
|
|
20
|
+let ITP_PODR_DTL_ST_CD = fn_make_common_cd_list(CODE_LIST, 'PODR_DTL_ST_CD', true, '구매발주상세상태코드');
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+//API URL
|
|
24
|
+let API_POMNG_PO_DETAIL_GRID_LIST = '/api/pomng/po/detail-grid-list';
|
|
25
|
+let API_POMNG_PO_INFO_PCHODR = '/api/pomng/po/info-pchOdr';
|
|
26
|
+let API_POMNG_PO_CANCEL_PCHPO = '/api/pomng/po/cancel-pchPo';
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+//화면 grid ColModel
|
|
30
|
+const gridColModel = {
|
|
31
|
+ list:[
|
|
32
|
+ {
|
|
33
|
+ index: 'VIEW_CD', name: 'viewCd',
|
|
34
|
+ label: ITP_MSG_LOCALE.label.viewCd,
|
|
35
|
+ width: '10', fixed: false, align: 'center',
|
|
36
|
+ sortable: false, hidden: true
|
|
37
|
+ },
|
|
38
|
+ {
|
|
39
|
+ index: 'BRAND_NM', name: 'brandNm',
|
|
40
|
+ label: ITP_MSG_LOCALE.label.brandNm, // 브랜드명
|
|
41
|
+ width: '10', fixed: false, align: 'center',
|
|
42
|
+ sortable: false, hidden: false
|
|
43
|
+ },
|
|
44
|
+ {
|
|
45
|
+ index: 'PCH_PODR_UNQ_NO', name: 'pchPodrUnqNo',
|
|
46
|
+ label: ITP_MSG_LOCALE.label.pchPodrUnqNo, // 발주번호
|
|
47
|
+ width: '10', fixed: false, align: 'center',
|
|
48
|
+ sortable: false, hidden: false
|
|
49
|
+ },
|
|
50
|
+ {
|
|
51
|
+ index: 'PCH_ODR_ST_NM', name: 'pchOdrStNm',
|
|
52
|
+ label: ITP_MSG_LOCALE.label.pchOdrStNm, // 발주상태명
|
|
53
|
+ width: '10', fixed: false, align: 'center',
|
|
54
|
+ sortable: false, hidden: false
|
|
55
|
+ },
|
|
56
|
+ {
|
|
57
|
+ index: 'PODR_DT', name: 'podrDt',
|
|
58
|
+ label: ITP_MSG_LOCALE.label.podrDt, // 발주일자
|
|
59
|
+ width: '10', fixed: false, align: 'center',
|
|
60
|
+ sortable: false, hidden: false
|
|
61
|
+ },
|
|
62
|
+ {
|
|
63
|
+ index: 'LOCATION_NM', name: 'locationNm',
|
|
64
|
+ label: ITP_MSG_LOCALE.label.locationNm, // 입고처
|
|
65
|
+ width: '10', fixed: false, align: 'center',
|
|
66
|
+ sortable: false, hidden: false
|
|
67
|
+ },
|
|
68
|
+ {
|
|
69
|
+ index: 'SPPLY_NM', name: 'spplyNm',
|
|
70
|
+ label: ITP_MSG_LOCALE.label.spplyNm, // 공급업체명
|
|
71
|
+ width: '10', fixed: false, align: 'center',
|
|
72
|
+ sortable: false, hidden: false
|
|
73
|
+ },
|
|
74
|
+ {
|
|
75
|
+ index: 'PODR_TOTAL_AMT', name: 'podrTotalAmt',
|
|
76
|
+ label: ITP_MSG_LOCALE.label.podrTotalAmt, // 총 발주금액
|
|
77
|
+ width: '8', fixed: false, align: 'center',
|
|
78
|
+ sortable: false, hidden: false,
|
|
79
|
+ formatter: 'integer', formatoptions: {thousandsSeparator: ','}
|
|
80
|
+ },
|
|
81
|
+ {
|
|
82
|
+ index: 'PODR_ITEM_QTY', name: 'podrItemQty',
|
|
83
|
+ label: ITP_MSG_LOCALE.label.podrItemQty, // 발주품목수
|
|
84
|
+ width: '7', fixed: false, align: 'center',
|
|
85
|
+ sortable: false, hidden: false
|
|
86
|
+ },
|
|
87
|
+ {
|
|
88
|
+ index: 'PODR_MGR_NM', name: 'podrMgrNm',
|
|
89
|
+ label: ITP_MSG_LOCALE.label.podrMgrNm, // 발주담당자
|
|
90
|
+ width: '10', fixed: false, align: 'center',
|
|
91
|
+ sortable: false, hidden: false
|
|
92
|
+ }
|
|
93
|
+ ],
|
|
94
|
+ view: [],
|
|
95
|
+ detail: [
|
|
96
|
+ {
|
|
97
|
+ index: 'VIEW_CD', name: 'viewCd',
|
|
98
|
+ label: ITP_MSG_LOCALE.label.viewCd,
|
|
99
|
+ width: '10', fixed: false, align: 'center',
|
|
100
|
+ sortable: false, hidden: true
|
|
101
|
+ },
|
|
102
|
+ {
|
|
103
|
+ index: 'PCH_PODR_DTL_NO', name: 'pchPodrDtlNo',
|
|
104
|
+ label: ITP_MSG_LOCALE.label.pchPodrDtlNo, // 발주항번
|
|
105
|
+ width: '5', fixed: false, align: 'center',
|
|
106
|
+ sortable: false, hidden: false
|
|
107
|
+ },
|
|
108
|
+ {
|
|
109
|
+ index: 'ITEM_ID', name: 'itemId',
|
|
110
|
+ label: ITP_MSG_LOCALE.label.itemId, // 품목번호
|
|
111
|
+ width: '5', fixed: false, align: 'center',
|
|
112
|
+ sortable: false, hidden: false
|
|
113
|
+ },
|
|
114
|
+ {
|
|
115
|
+ index: 'ITEM_NM', name: 'itemNm',
|
|
116
|
+ label: ITP_MSG_LOCALE.label.itemNm, // 품목명
|
|
117
|
+ width: '5', fixed: false, align: 'center',
|
|
118
|
+ sortable: false, hidden: false
|
|
119
|
+ },
|
|
120
|
+ {
|
|
121
|
+ index: 'UNIT_AMT', name: 'unitAmt',
|
|
122
|
+ label: ITP_MSG_LOCALE.label.unitAmt, // 단가
|
|
123
|
+ width: '5', fixed: false, align: 'center',
|
|
124
|
+ sortable: false, hidden: false,
|
|
125
|
+ formatter: 'integer', formatoptions: {thousandsSeparator: ','}
|
|
126
|
+ },
|
|
127
|
+ {
|
|
128
|
+ index: 'UNIT', name: 'unit',
|
|
129
|
+ label: ITP_MSG_LOCALE.label.unit, // 기본단위
|
|
130
|
+ width: '5', fixed: false, align: 'center',
|
|
131
|
+ sortable: false, hidden: false
|
|
132
|
+ },
|
|
133
|
+ {
|
|
134
|
+ index: 'PODR_QTY', name: 'podrQty',
|
|
135
|
+ label: ITP_MSG_LOCALE.label.podrQty, // 발주수량
|
|
136
|
+ width: '5', fixed: false, align: 'center',
|
|
137
|
+ sortable: false, hidden: false
|
|
138
|
+ },
|
|
139
|
+ {
|
|
140
|
+ index: 'PODR_AMT', name: 'podrAmt',
|
|
141
|
+ label: ITP_MSG_LOCALE.label.podrAmt, // 발주금액
|
|
142
|
+ width: '5', fixed: false, align: 'center',
|
|
143
|
+ sortable: false, hidden: false,
|
|
144
|
+ formatter: 'integer', formatoptions: {thousandsSeparator: ','}
|
|
145
|
+ },
|
|
146
|
+ {
|
|
147
|
+ index: 'WHS_PASS_QTY', name: 'whsPassQty',
|
|
148
|
+ label: ITP_MSG_LOCALE.label.whsPassQty, // 출고가능수량
|
|
149
|
+ width: '5', fixed: false, align: 'center',
|
|
150
|
+ sortable: false, hidden: false
|
|
151
|
+ },
|
|
152
|
+ {
|
|
153
|
+ index: 'PODR_DTL_ST_CD', name: 'podrDtlStCd',
|
|
154
|
+ label: ITP_MSG_LOCALE.label.podrDtlStCd, // 구매발주상세상태코드
|
|
155
|
+ width: '5', fixed: false, align: 'center',
|
|
156
|
+ sortable: false, hidden: false, formatter: 'select', edittype: 'select',
|
|
157
|
+ editoptions: {value: ITP_PODR_DTL_ST_CD},
|
|
158
|
+ }
|
|
159
|
+ ]
|
|
160
|
+};
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+/*화면공통 Object*/
|
|
164
|
+let pageObj = {
|
|
165
|
+ init: function() {
|
|
166
|
+ this.ui.init();
|
|
167
|
+ this.event.init();
|
|
168
|
+ },
|
|
169
|
+ ui: {
|
|
170
|
+ init: function() {
|
|
171
|
+ this.view();
|
|
172
|
+ this.grid();
|
|
173
|
+ this.ready();
|
|
174
|
+ },
|
|
175
|
+ view: function() {
|
|
176
|
+ // 버튼 권한설정
|
|
177
|
+ fn_proc_btn_auth('POMNG04010');
|
|
178
|
+ // 공통코드 표시
|
|
179
|
+ $('select').each(function() {
|
|
180
|
+ if($(this).data('select-code')) {
|
|
181
|
+ fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
|
|
182
|
+ }
|
|
183
|
+ });
|
|
184
|
+ // 조회일자 지정
|
|
185
|
+ var now = new Date();
|
|
186
|
+ var defaultToDate = new Date(now);
|
|
187
|
+ defaultToDate.setDate(now.getDate() + 5);
|
|
188
|
+ $('#ITP_TAB_POMNG04010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
|
|
189
|
+ $('#ITP_FORM_POMNG04010_SEARCH_FROM_DT').datepicker('setDate', '2020.10.01');
|
|
190
|
+ $('#ITP_FORM_POMNG04010_SEARCH_TO_DT').datepicker('setDate', '2024.10.01');
|
|
191
|
+ },
|
|
192
|
+ grid: function() {
|
|
193
|
+ itp_fn_jqgrid_resize(POMNG04010_GRID_ID, POMNG04010_GRID_LIST, 'lg');
|
|
194
|
+ listObj.empty.init();
|
|
195
|
+ itp_fn_fire_window_resize();
|
|
196
|
+ },
|
|
197
|
+ ready: function() {
|
|
198
|
+ listObj.init();
|
|
199
|
+ }
|
|
200
|
+ },
|
|
201
|
+ event: {
|
|
202
|
+ init: function() {
|
|
203
|
+ this.button();
|
|
204
|
+ },
|
|
205
|
+ button: function() {
|
|
206
|
+ // 버튼 클릭 이벤트
|
|
207
|
+ $('button').each(function() {
|
|
208
|
+ var id = $(this).attr('id');
|
|
209
|
+ $(this).on('click', function() {
|
|
210
|
+ switch (id) {
|
|
211
|
+ case 'ITP_BTN_POMNG04010_SRH' : listObj.button.search(); break; // 조회 버튼 클릭
|
|
212
|
+ case 'ITP_BTN_POMNG04010_NEWREG' : listObj.button.create(); break; // 신규등록 버튼
|
|
213
|
+ case 'ITP_BTN_POMNG04010_MODIFY' : modifyObj.button.modify(); break; // 수정 버튼
|
|
214
|
+ case 'ITP_BTN_POMNG04010_CANCELLIST' : modifyObj.button.cancel(); break; // 취소/목록 버튼
|
|
215
|
+ case 'ITP_BTN_POMNG04010_DELETE' : modifyObj.button.del(); break; // 발주 취소 버튼(예정)
|
|
216
|
+ }
|
|
217
|
+ });
|
|
218
|
+ });
|
|
219
|
+ }
|
|
220
|
+ },
|
|
221
|
+ switchScreen: function(mode) {
|
|
222
|
+ $('.itp_det_head').find('button[id^="ITP_BTN_POMNG04010_"]').each(function(i) {
|
|
223
|
+ $(this).hide();
|
|
224
|
+ });
|
|
225
|
+ $('#ITP_TAB_POMNG04010').find('div[id$="_CONTAINER"]').each(function(i) {
|
|
226
|
+ $(this).hide();
|
|
227
|
+ });
|
|
228
|
+ if(mode == 'LIST') { // 목록
|
|
229
|
+ fn_show_btn_auth_array(['#ITP_BTN_POMNG04010_SRH', '#ITP_BTN_POMNG04010_NEWREG']);
|
|
230
|
+ $('#ITP_AJAX_POMNG04010_LIST_CONTAINER').show();
|
|
231
|
+ $('#ITP_FORM_POMNG04010_SEARCH #ITP_FORM_POMNG04010_SEARCH_BRAND_ID').val(fn_make_user_info.get('brandId'));
|
|
232
|
+ $('#ITP_BTN_POMNG04010_SEARCH_SPPLY_ID').show();
|
|
233
|
+ $('#ITP_BTN_POMNG04010_DELETE_SPPLY_ID').show();
|
|
234
|
+ $('#ITP_BTN_POMNG04010_SEARCH_WHS_ID').show();
|
|
235
|
+ $('#ITP_BTN_POMNG04010_DELETE_WHS_ID').show();
|
|
236
|
+
|
|
237
|
+ } else if(mode == 'ADD') { // 등록
|
|
238
|
+ $('#ITP_AJAX_POMNG04010_DETAIL_CONTAINER').show();
|
|
239
|
+ fn_show_btn_auth_array(['#ITP_BTN_POMNG04010_CANCELLIST', '#ITP_BTN_POMNG04010_SAVE']);
|
|
240
|
+
|
|
241
|
+ $('#ITP_FORM_POMNG04010_DETAIL').find('input, textarea, select, checkbox').each(function(i, elem) {
|
|
242
|
+ $(this).attr('id') === 'ITP_FORM_POMNG04010_DETAIL_VIEW_CD' ? $(this).val('C') : $(this).val('');
|
|
243
|
+ if(elem.type === 'select') {
|
|
244
|
+ $(this).val('').prop('selected', true);
|
|
245
|
+ }
|
|
246
|
+ });
|
|
247
|
+ $('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_FILE_NO').val('');
|
|
248
|
+ $('#ITP_FORM_POMNG04010_DETAIL_BRAND_ID').removeAttr('readonly');
|
|
249
|
+ $('#ITP_FORM_POMNG04010_DETAIL_BRAND_NM').removeAttr('readonly');
|
|
250
|
+ $('#ITP_FORM_POMNG04010_DETAIL_BSNS_REG_NO').removeAttr('readonly');
|
|
251
|
+ $('#ITP_FORM_POMNG04010_DETAIL_CORP_REG_NO').removeAttr('readonly');
|
|
252
|
+ // $('#ITP_FORM_POMNG04010_DETAIL_SEARCH_AFFL_SHOP').removeAttr('disabled');
|
|
253
|
+ // $('#ITP_FORM_POMNG04010_DETAIL_DELETE_AFFL_SHOP').removeAttr('disabled');
|
|
254
|
+ $('#ITP_FORM_POMNG04010_DETAIL_SEARCH_AFFL_SHOP').show();
|
|
255
|
+ $('#ITP_FORM_POMNG04010_DETAIL_DELETE_AFFL_SHOP').show();
|
|
256
|
+ $('#ITP_FORM_POMNG04010_DETAIL .itp_form_info').hide();
|
|
257
|
+ $('#ITP_FORM_POMNG04010_DETAIL .itp_form_change').show();
|
|
258
|
+
|
|
259
|
+ $('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_AFFL_SHOP_ID').val(fn_make_user_info.get('afflShopId'));
|
|
260
|
+ $('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
|
|
261
|
+
|
|
262
|
+ $('.fnBrandId').text('(자동부여)');
|
|
263
|
+ } else if(mode == 'MODIFY') { // 수정
|
|
264
|
+ $('#ITP_AJAX_POMNG04010_DETAIL_CONTAINER').show();
|
|
265
|
+ fn_show_btn_auth_array(['#ITP_BTN_POMNG04010_CANCELLIST', '#ITP_BTN_POMNG04010_SAVE']);
|
|
266
|
+
|
|
267
|
+ $('#ITP_BTN_POMNG04010_CANCELLIST').show();
|
|
268
|
+ $('#ITP_BTN_POMNG04010_DELETE').show();
|
|
269
|
+
|
|
270
|
+ $('#ITP_FORM_POMNG04010_DETAIL_BRAND_ID').attr('readonly', true);
|
|
271
|
+ $('#ITP_FORM_POMNG04010_DETAIL_BRAND_NM').attr('readonly', true);
|
|
272
|
+ $('#ITP_FORM_POMNG04010_DETAIL_BSNS_REG_NO').attr('readonly', true);
|
|
273
|
+ $('#ITP_FORM_POMNG04010_DETAIL_CORP_REG_NO').attr('readonly', true);
|
|
274
|
+ // $('#ITP_FORM_POMNG04010_DETAIL_SEARCH_AFFL_SHOP').attr('disabled', true);
|
|
275
|
+ // $('#ITP_FORM_POMNG04010_DETAIL_DELETE_AFFL_SHOP').attr('disabled', true);
|
|
276
|
+ $('#ITP_FORM_POMNG04010_DETAIL_SEARCH_AFFL_SHOP').hide();
|
|
277
|
+ $('#ITP_FORM_POMNG04010_DETAIL_DELETE_AFFL_SHOP').hide();
|
|
278
|
+ $('#ITP_FORM_POMNG04010_DETAIL .itp_form_info').show();
|
|
279
|
+ $('#ITP_FORM_POMNG04010_DETAIL .itp_form_change').hide();
|
|
280
|
+
|
|
281
|
+ $('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
|
|
282
|
+ } else if(mode == 'VIEW') { // 보기
|
|
283
|
+ $('#ITP_AJAX_POMNG04010_VIEW_CONTAINER').show();
|
|
284
|
+ fn_show_btn_auth_array(['#ITP_BTN_POMNG04010_MODIFY', '#ITP_BTN_POMNG04010_CANCELLIST']);
|
|
285
|
+ }
|
|
286
|
+ }
|
|
287
|
+};
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+/*목록화면 Object*/
|
|
291
|
+let listObj = {
|
|
292
|
+ init: function() {
|
|
293
|
+ this.grid.init();
|
|
294
|
+ this.action();
|
|
295
|
+ },
|
|
296
|
+ itp_POMNG04010_param: {},
|
|
297
|
+ itp_POMNG04010_search: false,
|
|
298
|
+ button: {
|
|
299
|
+ search: function() {
|
|
300
|
+ listObj.itp_POMNG04010_search = true;
|
|
301
|
+ let param = $('#ITP_FORM_POMNG04010_SEARCH').serializeObject();
|
|
302
|
+ param.gridSize = $.jgrid.defaults.rowNum;
|
|
303
|
+ param.gridPage = $.jgrid.defaults.page;
|
|
304
|
+ param.sidx = '0';
|
|
305
|
+ console.log(JSON.stringify(param));
|
|
306
|
+ $(POMNG04010_GRID_ID).setGridParam({'postData': JSON.stringify(param)}).trigger('reloadGrid');
|
|
307
|
+ }
|
|
308
|
+ },
|
|
309
|
+ empty: {
|
|
310
|
+ init: function() {
|
|
311
|
+ var _this = this;
|
|
312
|
+ this.push();
|
|
313
|
+ $(POMNG04010_GRID_EMPTY).on('click', function() {
|
|
314
|
+ _this.back();
|
|
315
|
+ listObj.itp_POMNG04010_param.gridSize = $.jgrid.defaults.rowNum;
|
|
316
|
+ $(POMNG04010_GRID_ID).setGridParam({'postData': JSON.stringify(listObj.itp_POMNG04010_param)}).trigger('reloadGrid');
|
|
317
|
+ });
|
|
318
|
+ },
|
|
319
|
+ push: function() {
|
|
320
|
+ let param = $('#ITP_FORM_POMNG04010_SEARCH').serializeObject();
|
|
321
|
+ listObj.itp_POMNG04010_param = param;
|
|
322
|
+ param.sidx = '0';
|
|
323
|
+ },
|
|
324
|
+ back: function() {
|
|
325
|
+ $('#ITP_FORM_POMNG04010_SERVICE_BRAND_TYPE').val(listObj.itp_POMNG04010_param.brandType);
|
|
326
|
+ $('#ITP_FORM_POMNG04010_SERVICE_ST_CD').val(listObj.itp_POMNG04010_param.stCd);
|
|
327
|
+ $('#ITP_FORM_POMNG04010_SEARCH_BRAND_NM').val(listObj.itp_POMNG04010_param.brandNm);
|
|
328
|
+ }
|
|
329
|
+ },
|
|
330
|
+ grid: {
|
|
331
|
+ init: function() {
|
|
332
|
+ // 데이터 없을때
|
|
333
|
+ listObj.empty.push();
|
|
334
|
+ this.search();
|
|
335
|
+ },
|
|
336
|
+ colModel: gridColModel.list,
|
|
337
|
+ search: function() {
|
|
338
|
+ pageObj.switchScreen('LIST');
|
|
339
|
+ this.unload();
|
|
340
|
+ this.load();
|
|
341
|
+ },
|
|
342
|
+ load: function() {
|
|
343
|
+ let param = $('#ITP_FORM_POMNG04010_SEARCH').serializeObject();
|
|
344
|
+ param.gridSize = $.jgrid.defaults.rowNum;
|
|
345
|
+ param.sidx = '0';
|
|
346
|
+ console.log(JSON.stringify(param));
|
|
347
|
+ var option = {
|
|
348
|
+ gridId: POMNG04010_GRID_ID,
|
|
349
|
+ colModel: gridColModel.list,
|
|
350
|
+ param: param,
|
|
351
|
+ url: DOMAIN + API_POMNG_PO_DETAIL_GRID_LIST,
|
|
352
|
+ pager: POMNG04010_GRID_PAGER,
|
|
353
|
+ onCellSelect: function(rowId, cellIdx, cellValue) {
|
|
354
|
+ var cm = $(this).jqGrid('getGridParam', 'colModel');
|
|
355
|
+ var colNm = cm[cellIdx].name;
|
|
356
|
+ if (colNm === 'pchPodrUnqNo') {
|
|
357
|
+ const pchPodrUnqNoVal = $(this).jqGrid('getCell', rowId, 'pchPodrUnqNo');
|
|
358
|
+ const brandIdVal = $(this).jqGrid('getCell', rowId, 'brandId');
|
|
359
|
+ const key = {pchPodrUnqNo: pchPodrUnqNoVal, brandId: brandIdVal};
|
|
360
|
+ var param = $.param(key);
|
|
361
|
+ modifyObj.init(param);
|
|
362
|
+ }
|
|
363
|
+ },
|
|
364
|
+ loadComplete: function(data) {
|
|
365
|
+ console.log(data);
|
|
366
|
+ itp_fn_grid_load_complete(data, POMNG04010_GRID_ID, true, 'number', 'POMNG04010', listObj.itp_POMNG04010_search, listObj.empty, true, data.gridRecords, true);
|
|
367
|
+ var ids = $(POMNG04010_GRID_ID).getDataIDs();
|
|
368
|
+ $.each(ids, function(idx, rowId) {
|
|
369
|
+ $(POMNG04010_GRID_ID).jqGrid('setCell', rowId, 'pchPodrUnqNo', '', ITP_GRID_COL_STYLE.link);
|
|
370
|
+ });
|
|
371
|
+ },
|
|
372
|
+ onPaging: function(action) {
|
|
373
|
+ itp_fn_grid_paging(POMNG04010_GRID_ID, action, param);
|
|
374
|
+ }
|
|
375
|
+ };
|
|
376
|
+ itp_fn_grid_make_remote(option);
|
|
377
|
+ },
|
|
378
|
+ clearData: function() {
|
|
379
|
+ $(POMNG04010_GRID_ID).jqGrid('clearGridData', true);
|
|
380
|
+ $(POMNG04010_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
|
|
381
|
+ $(POMNG04010_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
|
|
382
|
+ $(POMNG04010_GRID_EMPTY).show();
|
|
383
|
+ },
|
|
384
|
+ unload: function() {
|
|
385
|
+ $.jgrid.gridUnload(POMNG04010_GRID_ID);
|
|
386
|
+ }
|
|
387
|
+ },
|
|
388
|
+ action: function() {
|
|
389
|
+ var _this = this;
|
|
390
|
+ // 공급업체 조회 버튼 클릭
|
|
391
|
+ $('#ITP_BTN_POMNG04010_SEARCH_SPPLY_ID').on('click', function() {
|
|
392
|
+ _this.popup('spply');
|
|
393
|
+ });
|
|
394
|
+ // 공급업체 텍스트 삭제 버튼 클릭
|
|
395
|
+ $('#ITP_BTN_POMNG04010_DELETE_SPPLY_ID').on('click', function() {
|
|
396
|
+ $('#ITP_FORM_POMNG04010_DETAIL_SPPLY_NM').val('');
|
|
397
|
+ $('#ITP_FORM_POMNG04010_DETAIL_SPPLY_ID').val('');
|
|
398
|
+ });
|
|
399
|
+ // 매장/창고 조회 버튼 클릭
|
|
400
|
+ $('#ITP_BTN_POMNG04010_SEARCH_WHS_ID').on('click', function() {
|
|
401
|
+ _this.popup('whs');
|
|
402
|
+ });
|
|
403
|
+ // 매장/창고 텍스트 삭제 버튼 클릭
|
|
404
|
+ $('#ITP_BTN_POMNG04010_DELETE_WHS_ID').on('click', function() {
|
|
405
|
+ $('#ITP_FORM_POMNG04010_DETAIL_WHS_NM').val('');
|
|
406
|
+ $('#ITP_FORM_POMNG04010_DETAIL_WHS_ID').val('');
|
|
407
|
+ });
|
|
408
|
+ },
|
|
409
|
+ popup: function(keyword) {
|
|
410
|
+ var popFn = this.callback.create;
|
|
411
|
+ // const key = {brandId:fn_make_user_info.get('brandId'),storeId:fn_make_user_info.get('storeId')};
|
|
412
|
+ if(keyword === 'spply'){
|
|
413
|
+ fn_call_popup('biz', 'BIZPOP_STORE_SPPLY', '#ITP_ASIDE', popFn, /*key*/null, 'S');
|
|
414
|
+ } else if(keyword === 'whs'){
|
|
415
|
+ fn_call_popup('biz', 'BIZPOP_WHS_LOCATION', '#ITP_ASIDE', popFn, /*key*/null, 'S');
|
|
416
|
+ }
|
|
417
|
+ },
|
|
418
|
+ callback: {
|
|
419
|
+ create: function(rowDataPop) {
|
|
420
|
+ console.log(rowDataPop);
|
|
421
|
+ if(rowDataPop.hasOwnProperty('whsId') == false) {
|
|
422
|
+ $('#ITP_FORM_POMNG04010_DETAIL_SPPLY_NM').val(rowDataPop.spplyNm);
|
|
423
|
+ $('#ITP_FORM_POMNG04010_DETAIL_SPPLY_ID').val(rowDataPop.spplyId);
|
|
424
|
+ } else {
|
|
425
|
+ $('#ITP_FORM_POMNG04010_DETAIL_WHS_NM').val(rowDataPop.whsNm);
|
|
426
|
+ $('#ITP_FORM_POMNG04010_DETAIL_WHS_ID').val(rowDataPop.whsId);
|
|
427
|
+ }
|
|
428
|
+ }
|
|
429
|
+ }
|
|
430
|
+};
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+/*수정화면 Object*/
|
|
434
|
+let modifyObj = {
|
|
435
|
+ init: function(param) {
|
|
436
|
+ this.load(param);
|
|
437
|
+ },
|
|
438
|
+ itp_POMNG04010_param: {},
|
|
439
|
+ itp_POMNG04010_search: false,
|
|
440
|
+ button: {
|
|
441
|
+ cancel: function() {
|
|
442
|
+ listObj.grid.search();
|
|
443
|
+ },
|
|
444
|
+ del: function() {
|
|
445
|
+ console.log('here');
|
|
446
|
+ const formId = '#ITP_FORM_POMNG04010_DETAIL';
|
|
447
|
+ itp_fn_form_clear_validate(null, formId);
|
|
448
|
+ itp_fn_grid_save_rows(POMNG04010_DETAIL_GRID_ID);
|
|
449
|
+ let gridUpdateData = [];
|
|
450
|
+ for(var i=0; i<$(POMNG04010_DETAIL_GRID_ID).getGridParam('reccount'); i++) {
|
|
451
|
+ $(POMNG04010_DETAIL_GRID_ID).jqGrid('saveCell', i+1, 2)
|
|
452
|
+ }
|
|
453
|
+ const selection = $(POMNG04010_DETAIL_GRID_ID).getGridParam('selarrrow');
|
|
454
|
+ console.log(selection);
|
|
455
|
+ const rowData = $(POMNG04010_DETAIL_GRID_ID).getRowData();
|
|
456
|
+ let newData = [];
|
|
457
|
+ for(let i = 0; i < selection.length; i++){
|
|
458
|
+ let before = $(POMNG04010_DETAIL_GRID_ID).getRowData(selection[i]);
|
|
459
|
+ //before.podrDtlStCd = 'POD2';
|
|
460
|
+ //console.log(before)
|
|
461
|
+ newData.push(before);
|
|
462
|
+ }
|
|
463
|
+ console.log(newData);
|
|
464
|
+ let param = $(formId).serializeObject();
|
|
465
|
+ param.gridUpdateData = newData;
|
|
466
|
+ console.log(JSON.stringify(param));
|
|
467
|
+ var searhFn = function() {
|
|
468
|
+ ITP_FORM_POMNG02010_DETAIL_IS_WRITING = false;
|
|
469
|
+ listObj.grid.search();
|
|
470
|
+ };
|
|
471
|
+ fn_ajax_call(API_POMNG_PO_CANCEL_PCHPO, JSON.stringify(param), searhFn, 'POST');
|
|
472
|
+ }
|
|
473
|
+ },
|
|
474
|
+ empty: {
|
|
475
|
+ init: function() {
|
|
476
|
+ var _this = this;
|
|
477
|
+ this.push();
|
|
478
|
+ $(POMNG04010_VIEW_GRID_EMPTY).on('click', function() {
|
|
479
|
+ _this.back();
|
|
480
|
+ viewObj.itp_POMNG04010_param.gridSize = $.jgrid.defaults.rowNum;
|
|
481
|
+ $(POMNG04010_GRID_ID).setGridParam({'postData': JSON.stringify(viewObj.itp_POMNG04010_param)}).trigger('reloadGrid');
|
|
482
|
+ });
|
|
483
|
+ },
|
|
484
|
+ push: function() {
|
|
485
|
+ let param = $('#ITP_FORM_POMNG04010_DETAIL').serializeObject();
|
|
486
|
+ viewObj.itp_POMNG04010_param = param;
|
|
487
|
+ },
|
|
488
|
+ back: function() {
|
|
489
|
+ $('#ITP_FORM_POMNG04010_SERVICE_BRAND_TYPE').val(viewObj.itp_POMNG04010_param.brandType);
|
|
490
|
+ $('#ITP_FORM_POMNG04010_SERVICE_ST_CD').val(viewObj.itp_POMNG04010_param.stCd);
|
|
491
|
+ $('#ITP_FORM_POMNG04010_SEARCH_BRAND_NM').val(viewObj.itp_POMNG04010_param.brandNm);
|
|
492
|
+ }
|
|
493
|
+ },
|
|
494
|
+ load: function(param) {
|
|
495
|
+ fn_ajax_call(API_POMNG_PO_INFO_PCHODR, param, this.callback, 'GET');
|
|
496
|
+ },
|
|
497
|
+ callback: function(result) {
|
|
498
|
+ console.log(result);
|
|
499
|
+
|
|
500
|
+ // 그리드 전화번호 '-' 함수
|
|
501
|
+ function convertTel(value){
|
|
502
|
+ answer = (value.startsWith('0')) ? value.replace(/[^0-9]/g, "")
|
|
503
|
+ .replace(/(^02|^0505|^1[0-9]{3}|^0[0-9]{2})([0-9]+)?([0-9]{4})$/,"$1-$2-$3")
|
|
504
|
+ .replace("--", "-") : '';
|
|
505
|
+ return answer;
|
|
506
|
+ }
|
|
507
|
+ let telNo = convertTel(result.podrMgrTelNo);
|
|
508
|
+
|
|
509
|
+ pageObj.switchScreen('MODIFY');
|
|
510
|
+ $('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_AFFL_SHOP_ID').val(result.afflShopId);
|
|
511
|
+ $('#ITP_FORM_POMNG04010_DETAIL .fnBrandNm').text(result.brandNm);
|
|
512
|
+ $('#ITP_FORM_POMNG04010_DETAIL .fnPchPodrUnqNo').text(result.pchPodrUnqNo);
|
|
513
|
+ $('#ITP_FORM_POMNG04010_DETAIL .fnSpplyNm').text(result.spplyId);
|
|
514
|
+ $('#ITP_FORM_POMNG04010_DETAIL .fnPodrDt').text(result.podrDt);
|
|
515
|
+ $('#ITP_FORM_POMNG04010_DETAIL .fnPchOdrStCd').text(result.pchOdrStNm);
|
|
516
|
+ $('#ITP_FORM_POMNG04010_DETAIL .fnPodrTotalAmt').text(result.podrTotalAmt.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','));
|
|
517
|
+ $('#ITP_FORM_POMNG04010_DETAIL .fnPodrMgrNm').text(result.podrMgrNm);
|
|
518
|
+ $('#ITP_FORM_POMNG04010_DETAIL .fnPodrMgrNo').text(telNo);
|
|
519
|
+ $('#ITP_FORM_POMNG04010_DETAIL .fnDlvDvsn').text(result.dlvDvsnNm);
|
|
520
|
+ $('#ITP_FORM_POMNG04010_DETAIL .fnDlvReqDt').text(result.dlvReqDt);
|
|
521
|
+ $('#ITP_FORM_POMNG04010_DETAIL .fnShmtWhsNm').text(result.shmtWhsDvsnNm);
|
|
522
|
+
|
|
523
|
+ $('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_BRANDID').val(result.brandId);
|
|
524
|
+ $('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_DLV_DVSN').val(result.dlvDvsnNm);
|
|
525
|
+ $('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_PCH_PODR_UNQ_NO').val(result.pchPodrUnqNo);
|
|
526
|
+ $('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_STORE_ID').val(result.storeId);
|
|
527
|
+ $('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_SHM_LOCATION').val(result.shmtLocation);
|
|
528
|
+ $('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_SHM_WHS_ID').val(result.shmtWhsId);
|
|
529
|
+
|
|
530
|
+ modifyObj.grid.init('MODIFY', result.pchOdrDtlList)
|
|
531
|
+ },
|
|
532
|
+ grid: {
|
|
533
|
+ init: function(mode, gridData) {
|
|
534
|
+ this.mode = mode;
|
|
535
|
+ this.gridId = (mode === 'VIEW') ? POMNG04010_VIEW_GRID_ID : POMNG04010_DETAIL_GRID_ID;
|
|
536
|
+ this.gridList = (mode === 'VIEW') ? POMNG04010_VIEW_GRID_LIST : POMNG04010_DETAIL_GRID_LIST;
|
|
537
|
+ this.gridEmpty = (mode === 'VIEW') ? POMNG04010_VIEW_GRID_EMPTY : POMNG04010_DETAIL_GRID_EMPTY;
|
|
538
|
+ this.unload();
|
|
539
|
+ this.load(mode, gridData);
|
|
540
|
+ },
|
|
541
|
+ mode: '',
|
|
542
|
+ colModel: gridColModel.view,
|
|
543
|
+ load: function(mode, gridData) {
|
|
544
|
+ var _this = this;
|
|
545
|
+ var option = {
|
|
546
|
+ gridId: _this.gridId,
|
|
547
|
+ colModel: gridColModel.detail,
|
|
548
|
+ data: gridData,
|
|
549
|
+ multiselect: true,
|
|
550
|
+ loadComplete: function(data) {
|
|
551
|
+ console.log(data);
|
|
552
|
+ itp_fn_grid_load_complete(data, POMNG04010_DETAIL_GRID_ID, true, 'number', 'POMNG04010', modifyObj.itp_POMNG04010_search, modifyObj.empty, true, data.gridRecords, true);
|
|
553
|
+ var idArry = $(POMNG04010_DETAIL_GRID_ID).jqGrid('getDataIDs');
|
|
554
|
+ for(var i = 0; i < idArry.length; i++){
|
|
555
|
+ var ret = $(POMNG04010_DETAIL_GRID_ID).getRowData(idArry[i]);
|
|
556
|
+ console.log(1111111);
|
|
557
|
+ console.log(ret);
|
|
558
|
+ if(ret.podrDtlStCd == 'POD4'){
|
|
559
|
+ $("#jqg_list_"+idArry[i]).attr("disabled", true);
|
|
560
|
+ }
|
|
561
|
+ }
|
|
562
|
+ },
|
|
563
|
+ onSelectAll: function(aRowids, status) {
|
|
564
|
+ if(status){
|
|
565
|
+ var cbs = $("tr.jqgrow > td > input.cbox:disabled", $(POMNG04010_DETAIL_GRID_ID)[0]);
|
|
566
|
+ cbs.removeAttr("checked");
|
|
567
|
+ $(POMNG04010_DETAIL_GRID_ID)[0].p.selarrrow = $("#grid_id").find("tr.jqgrow:has(td > input.cbox:checked)").map(function() { return this.id; }).get();
|
|
568
|
+ }
|
|
569
|
+ }
|
|
570
|
+ };
|
|
571
|
+ itp_fn_grid_make_local(option);
|
|
572
|
+ },
|
|
573
|
+ unload: function() {
|
|
574
|
+ $.jgrid.gridUnload(this.gridId);
|
|
575
|
+ }
|
|
576
|
+ },
|
|
577
|
+ isValid: function(formId) {
|
|
578
|
+ var isValid = false;
|
|
579
|
+ $(formId).find('input, select, checkbox, textarea').each(function(k) {
|
|
580
|
+ if($(this).data('check-required')) {
|
|
581
|
+ var arry = $(this).data('check-required').split(',');
|
|
582
|
+ isValid = itp_fn_form_validate(formId, '#' + $(this).attr('id'), arry, undefined);
|
|
583
|
+ if(!isValid) return false;
|
|
584
|
+ }
|
|
585
|
+ });
|
|
586
|
+ return isValid;
|
|
587
|
+ },
|
|
588
|
+};
|