|
@@ -0,0 +1,272 @@
|
|
1
|
+/********************************************************
|
|
2
|
+ --------------------------------------------------------
|
|
3
|
+ - Object 목록 -
|
|
4
|
+ --------------------------------------------------------
|
|
5
|
+ * const gridColModel = {} : 화면 Grid Object *
|
|
6
|
+ * let pageObj = {} : 화면공통 Object *
|
|
7
|
+ * let listObj = {} : 목록화면 Object *
|
|
8
|
+ * let viewObj = {} : 상세화면 Object *
|
|
9
|
+ * let modifyObj = {} : 수정화면 Object *
|
|
10
|
+ * let createObj = {} : 신규화면 Object *
|
|
11
|
+ * let locInfoObj = {} : 로케이션정보 Object *
|
|
12
|
+ *******************************************************/
|
|
13
|
+
|
|
14
|
+/*화면 변수*/
|
|
15
|
+const STOCKMNG01010_GRID_ID = '#ITP_STOCKMNG01010_jqGrid';
|
|
16
|
+const STOCKMNG01010_GRID_LIST = '#ITP_STOCKMNG01010_jqGrid_list';
|
|
17
|
+const STOCKMNG01010_GRID_PAGER = '#ITP_STOCKMNG01010_jqGridPager';
|
|
18
|
+const STOCKMNG01010_GRID_EMPTY = '#ITP_STOCKMNG01010_jqGridEmpty';
|
|
19
|
+
|
|
20
|
+let ITP_FORM_STOCKMNG01010_DETAIL_IS_DUPLICATE = false;
|
|
21
|
+let ITP_FORM_STOCKMNG01010_DETAIL_IS_WRITING = false;
|
|
22
|
+let STOCKMNG01010_DETAIL_GRID_LAST_ROW_ID;
|
|
23
|
+
|
|
24
|
+/*API URL*/
|
|
25
|
+let STOCK_MNG_DETAIL_GRID_LIST = '/api/stock/mng/detail-grid-list';
|
|
26
|
+let WHS_MNG_ADD_WHS = '/api/whs/mng/add-whs';
|
|
27
|
+
|
|
28
|
+/*화면 Grid ColModel*/
|
|
29
|
+const gridColModel = {
|
|
30
|
+ list: [
|
|
31
|
+ {
|
|
32
|
+ index: 'BRAND_ID', name: 'brandId',
|
|
33
|
+ label: "브랜드ID",
|
|
34
|
+ width: '0', fixed: false, align: 'center',
|
|
35
|
+ sortable: false, hidden: true
|
|
36
|
+ },
|
|
37
|
+ {
|
|
38
|
+ index: 'STORE_ID', name: 'storeId',
|
|
39
|
+ label: "매장ID",
|
|
40
|
+ width: '0', fixed: false, align: 'center',
|
|
41
|
+ sortable: false, hidden: true
|
|
42
|
+ },
|
|
43
|
+ {
|
|
44
|
+ index: 'BRAND_NM', name: 'brandNm',
|
|
45
|
+ label: ITP_MSG_LOCALE.label.brandNm, //브랜드
|
|
46
|
+ width: '13', fixed: false, align: 'center',
|
|
47
|
+ sortable: false, hidden: false
|
|
48
|
+ },
|
|
49
|
+ {
|
|
50
|
+ index: 'STORE_NM', name: 'storeNm',
|
|
51
|
+ label: "매장명",
|
|
52
|
+ width: '13', fixed: false, align: 'center',
|
|
53
|
+ sortable: false, hidden: false
|
|
54
|
+ },
|
|
55
|
+ {
|
|
56
|
+ index: 'WHS_ID', name: 'whsId',
|
|
57
|
+ label: "창고번호",
|
|
58
|
+ width: '8', fixed: false, align: 'center',
|
|
59
|
+ sortable: false, hidden: false
|
|
60
|
+ },
|
|
61
|
+ {
|
|
62
|
+ index: 'WHS_NM', name: 'whsNm',
|
|
63
|
+ label: "창고명",
|
|
64
|
+ width: '13', fixed: false, align: 'center',
|
|
65
|
+ sortable: false, hidden: false
|
|
66
|
+ },
|
|
67
|
+ {
|
|
68
|
+ index: 'WHS_ST_NM', name: 'whsStNm',
|
|
69
|
+ label: ITP_MSG_LOCALE.label.status, //상태
|
|
70
|
+ width: '6', fixed: false, align: 'center',
|
|
71
|
+ sortable: false, hidden: false
|
|
72
|
+ },
|
|
73
|
+ {
|
|
74
|
+ index: 'MGR_NM', name: 'mgrNm',
|
|
75
|
+ label: "담당자명",
|
|
76
|
+ width: '8', fixed: false, align: 'center',
|
|
77
|
+ sortable: false, hidden: false
|
|
78
|
+ },
|
|
79
|
+ {
|
|
80
|
+ index: 'MGR_TEL_NO', name: 'mgrTelNo',
|
|
81
|
+ label: "연락처",
|
|
82
|
+ width: '8', fixed: false, align: 'center',
|
|
83
|
+ sortable: false, hidden: false
|
|
84
|
+ }
|
|
85
|
+ ]
|
|
86
|
+};
|
|
87
|
+
|
|
88
|
+require(['config'], function() {
|
|
89
|
+ require([
|
|
90
|
+ ], function($) {
|
|
91
|
+ pageObj.init();
|
|
92
|
+ });
|
|
93
|
+});
|
|
94
|
+
|
|
95
|
+/*화면공통 Object*/
|
|
96
|
+let pageObj = {
|
|
97
|
+ init: function () {
|
|
98
|
+ this.ui.init();
|
|
99
|
+ this.event.init();
|
|
100
|
+ },
|
|
101
|
+ ui: {
|
|
102
|
+ init: function () {
|
|
103
|
+ this.view();
|
|
104
|
+ this.grid();
|
|
105
|
+ this.ready();
|
|
106
|
+ },
|
|
107
|
+ view: function() {
|
|
108
|
+ // 버튼 권한설정
|
|
109
|
+ fn_proc_btn_auth('STOCKMNG01010');
|
|
110
|
+
|
|
111
|
+ // 브랜드ID 지정
|
|
112
|
+ var data = JSON.parse(sessionStorage.getItem('itp_manage_brand_cd'));
|
|
113
|
+ $('#ITP_FORM_STOCKMNG01010_SEARCH_BRAND_ID').val(data.brandId);
|
|
114
|
+
|
|
115
|
+ // 공통코드 표시
|
|
116
|
+ // fn_make_select(CODE_LIST, 'WHS_DVSN', 'ITP_FORM_STOCKMNG01010_WHS_DVSN');
|
|
117
|
+ // fn_make_select(CODE_LIST, 'WHS_ST_CD', 'ITP_FORM_STOCKMNG01010_WHS_ST_CD');
|
|
118
|
+ // fn_make_select(CODE_LIST, 'WHS_ST_CD', 'ITP_FORM_STOCKMNG01010_DETAIL_WHS_ST_CD', true, '선택');
|
|
119
|
+
|
|
120
|
+ // 조회일자 지정
|
|
121
|
+ $('#ITP_TAB_STOCKMNG01010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
|
|
122
|
+ },
|
|
123
|
+ grid: function() {
|
|
124
|
+ itp_fn_jqgrid_resize(STOCKMNG01010_GRID_ID, STOCKMNG01010_GRID_LIST, 'lg');
|
|
125
|
+ listObj.empty.init();
|
|
126
|
+ itp_fn_fire_window_resize();
|
|
127
|
+ },
|
|
128
|
+ ready: function() {
|
|
129
|
+ listObj.init();
|
|
130
|
+ }
|
|
131
|
+ },
|
|
132
|
+ event: {
|
|
133
|
+ init: function () {
|
|
134
|
+ this.button();
|
|
135
|
+ },
|
|
136
|
+ button: function () {
|
|
137
|
+ // 버튼 클릭 이벤트
|
|
138
|
+ $('button').each(function() {
|
|
139
|
+ var id = $(this).attr('id');
|
|
140
|
+ $(this).on('click', function() {
|
|
141
|
+ switch (id) {
|
|
142
|
+ case 'ITP_BTN_STOCKMNG01010_SRH' : listObj.button.search(); break; // 조회 버튼
|
|
143
|
+ case 'ITP_BTN_STOCKMNG01010_ADDROW' : locInfoObj.button.addRow(); break; // 재고처리 버튼
|
|
144
|
+ case 'ITP_BTN_STOCKMNG01010_DELROW' : locInfoObj.button.delRow(); break; // 재고이력 버튼
|
|
145
|
+ }
|
|
146
|
+ });
|
|
147
|
+ });
|
|
148
|
+
|
|
149
|
+ $('body').on('click', function(e) {
|
|
150
|
+
|
|
151
|
+ });
|
|
152
|
+
|
|
153
|
+ }
|
|
154
|
+ },
|
|
155
|
+ switchScreen: function(mode) {
|
|
156
|
+ if(mode == 'LIST') { // 목록
|
|
157
|
+ fn_show_btn_auth('#ITP_BTN_STOCKMNG01010_SRH');
|
|
158
|
+
|
|
159
|
+ $('#ITP_AJAX_STOCKMNG01010_LIST_CONTAINER').show();
|
|
160
|
+ }
|
|
161
|
+ }
|
|
162
|
+};
|
|
163
|
+
|
|
164
|
+/*목록화면 Object*/
|
|
165
|
+let listObj = {
|
|
166
|
+ init: function () {
|
|
167
|
+ this.grid.init();
|
|
168
|
+ },
|
|
169
|
+ itp_STOCKMNG01010_search: false,
|
|
170
|
+ button: {
|
|
171
|
+ search: function() {
|
|
172
|
+ listObj.itp_STOCKMNG01010_search = true;
|
|
173
|
+ let param = $('#ITP_FORM_STOCKMNG01010_SEARCH').serializeObject();
|
|
174
|
+ param.gridSize = $.jgrid.defaults.rowNum;
|
|
175
|
+ param.gridPage = $.jgrid.defaults.page;
|
|
176
|
+ $(STOCKMNG01010_GRID_ID).setGridParam({'postData': JSON.stringify(param)}).trigger('reloadGrid');
|
|
177
|
+ },
|
|
178
|
+ create: function() {
|
|
179
|
+ pageObj.switchScreen('ADD');
|
|
180
|
+ itp_fn_form_clear_validate(null, '#ITP_FORM_STOCKMNG01010_DETAIL');
|
|
181
|
+ // 로케이션 리스트 조회
|
|
182
|
+ createObj.init();
|
|
183
|
+ }
|
|
184
|
+ },
|
|
185
|
+ empty: {
|
|
186
|
+ init: function() {
|
|
187
|
+ var _this = this;
|
|
188
|
+ this.push();
|
|
189
|
+ $(STOCKMNG01010_GRID_EMPTY).on('click', function() {
|
|
190
|
+ _this.back();
|
|
191
|
+ _this.itp_STOCKMNG01010_param.gridSize = $.jgrid.defaults.rowNum;
|
|
192
|
+ $(STOCKMNG01010_GRID_ID).setGridParam({'postData': JSON.stringify(_this.itp_STOCKMNG01010_param)}).trigger('reloadGrid');
|
|
193
|
+ });
|
|
194
|
+ },
|
|
195
|
+ itp_STOCKMNG01010_param: {},
|
|
196
|
+ push: function() {
|
|
197
|
+ let param = $('#ITP_FORM_STOCKMNG01010_SEARCH').serializeObject();
|
|
198
|
+ listObj.itp_STOCKMNG01010_param = param;
|
|
199
|
+ },
|
|
200
|
+ back: function() {
|
|
201
|
+ $('#ITP_FORM_STOCKMNG01010_DEVI_TP_CD').val(this.itp_STOCKMNG01010_param.deviTpCd);
|
|
202
|
+ $('#ITP_FORM_STOCKMNG01010_ORDER_YN').val(this.itp_STOCKMNG01010_param.orderYn);
|
|
203
|
+ $('#ITP_FORM_STOCKMNG01010_ADT_AUTH_CD').val(this.itp_STOCKMNG01010_param.adtAuthCd);
|
|
204
|
+ $('#ITP_FORM_STOCKMNG01010_EMAIL_RCV_YN').val(this.itp_STOCKMNG01010_param.emailRcvYn);
|
|
205
|
+ $('#ITP_FORM_STOCKMNG01010_MEMB_EXIT_DT').val(this.itp_STOCKMNG01010_param.membExitDt);
|
|
206
|
+ $('#ITP_FORM_STOCKMNG01010_FROM_DT').val(this.itp_STOCKMNG01010_param.fromDt);
|
|
207
|
+ $('#ITP_FORM_STOCKMNG01010_TO_DT').val(this.itp_STOCKMNG01010_param.toDt);
|
|
208
|
+ $('#ITP_FORM_STOCKMNG01010_KEYWORD').val(this.itp_STOCKMNG01010_param.keyword);
|
|
209
|
+ }
|
|
210
|
+ },
|
|
211
|
+ grid: {
|
|
212
|
+ init: function () {
|
|
213
|
+ // 데이터 없을때
|
|
214
|
+ listObj.empty.push();
|
|
215
|
+ this.search();
|
|
216
|
+ },
|
|
217
|
+ colModel: gridColModel.list,
|
|
218
|
+ search: function() {
|
|
219
|
+ pageObj.switchScreen('LIST');
|
|
220
|
+ this.unload();
|
|
221
|
+ this.load();
|
|
222
|
+ },
|
|
223
|
+ load: function() {
|
|
224
|
+ var data = JSON.parse(sessionStorage.getItem('itp_manage_brand_cd'));
|
|
225
|
+ $('#ITP_FORM_STOCKMNG01010_SEARCH_BRAND_ID').val(data.brandId);
|
|
226
|
+
|
|
227
|
+ let param = $('#ITP_FORM_STOCKMNG01010_SEARCH').serializeObject();
|
|
228
|
+ param.gridSize = $.jgrid.defaults.rowNum;
|
|
229
|
+
|
|
230
|
+ var option = {
|
|
231
|
+ gridId: STOCKMNG01010_GRID_ID,
|
|
232
|
+ colModel: gridColModel.list,
|
|
233
|
+ param: JSON.stringify(param),
|
|
234
|
+ url: DOMAIN + STOCK_MNG_DETAIL_GRID_LIST,
|
|
235
|
+ pager: STOCKMNG01010_GRID_PAGER,
|
|
236
|
+ onCellSelect: function(rowId, cellIdx, cellValue) {
|
|
237
|
+ var cm = $(this).jqGrid('getGridParam', 'colModel');
|
|
238
|
+ var colNm = cm[cellIdx].name;
|
|
239
|
+ if (colNm == 'whsNm') {
|
|
240
|
+ const brandIdVal = $(this).jqGrid('getCell', rowId, 'brandId');
|
|
241
|
+ const whsIdVal = $(this).jqGrid('getCell', rowId, 'whsId');
|
|
242
|
+
|
|
243
|
+ const key = {brandId: brandIdVal, whsId: whsIdVal, viewCd: 'R'};
|
|
244
|
+ var param = $.param(key);
|
|
245
|
+ viewObj.init(param);
|
|
246
|
+ }
|
|
247
|
+ },
|
|
248
|
+ loadComplete: function(data) {
|
|
249
|
+ console.log(data);
|
|
250
|
+ itp_fn_grid_load_complete(data, STOCKMNG01010_GRID_ID, true, 'number', 'STOCKMNG01010', listObj.itp_STOCKMNG01010_search, listObj.empty, true, data.gridRecords, true);
|
|
251
|
+ var ids = $(STOCKMNG01010_GRID_ID).getDataIDs();
|
|
252
|
+ $.each(ids, function(idx, rowId) {
|
|
253
|
+ $(STOCKMNG01010_GRID_ID).jqGrid('setCell', rowId, 'whsNm', '', ITP_GRID_COL_STYLE.link);
|
|
254
|
+ });
|
|
255
|
+ },
|
|
256
|
+ onPaging: function(action) {
|
|
257
|
+ itp_fn_grid_paging(STOCKMNG01010_GRID_ID, action, param);
|
|
258
|
+ }
|
|
259
|
+ };
|
|
260
|
+ itp_fn_grid_make_remote(option);
|
|
261
|
+ },
|
|
262
|
+ clearData : function() {
|
|
263
|
+ $(STOCKMNG01010_GRID_ID).jqGrid('clearGridData', true);
|
|
264
|
+ $(STOCKMNG01010_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
|
|
265
|
+ $(STOCKMNG01010_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
|
|
266
|
+ $(STOCKMNG01010_GRID_EMPTY).show();
|
|
267
|
+ },
|
|
268
|
+ unload : function() {
|
|
269
|
+ $.jgrid.gridUnload(STOCKMNG01010_GRID_ID);
|
|
270
|
+ }
|
|
271
|
+ }
|
|
272
|
+};
|