ITP_RTNMNG06010.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. require(['config'], function() {
  2. require([
  3. ], function($) {
  4. pageObj.init();
  5. });
  6. });
  7. //화면변수
  8. const RTNMNG06010_GRID_ID = '#ITP_RTNMNG06010_jqGrid';
  9. const RTNMNG06010_GRID_LIST = '#ITP_RTNMNG06010_jqGrid_list';
  10. const RTNMNG06010_GRID_PAGER = '#ITP_RTNMNG06010_jqGridPager';
  11. const RTNMNG06010_GRID_EMPTY = '#ITP_RTNMNG06010_jqGridEmpty';
  12. //API URL
  13. let API_POMNG_INOUTMNG_WAREHOUSE_GRID_LIST = '/api/rtnmng/inoutmng/retstock-result-grid-list';
  14. //화면 grid ColModel
  15. const gridColModel = {
  16. list:[
  17. {
  18. index: 'VIEW_CD', name: 'viewCd',
  19. label: ITP_MSG_LOCALE.label.viewCd,
  20. width: '10', fixed: false, align: 'center',
  21. sortable: false, hidden: true
  22. },
  23. {
  24. index: 'BRAND_NM', name: 'brandNm',
  25. label: '브랜드',
  26. width: '10', fixed: false, align: 'left',
  27. sortable: false, hidden: false
  28. },
  29. {
  30. index: 'RTN_PODR_UNQ_NO', name: 'rtnPodrUnqNo',
  31. label: '반품발주번호',
  32. width: '10', fixed: false, align: 'center',
  33. sortable: false, hidden: false
  34. },
  35. {
  36. index: 'RTN_PODR_DTL_NO', name: 'rtnPodrDtlNo',
  37. label: '항번',
  38. width: '5', fixed: false, align: 'center',
  39. sortable: false, hidden: false
  40. },
  41. {
  42. index: 'ITEM_ID', name: 'itemId',
  43. label: ITP_MSG_LOCALE.label.itemId, // 품목번호
  44. width: '8', fixed: false, align: 'center',
  45. sortable: false, hidden: false
  46. },
  47. {
  48. index: 'ITEM_NM', name: 'itemNm',
  49. label: ITP_MSG_LOCALE.label.itemNm, // 품목명
  50. width: '8', fixed: false, align: 'left',
  51. sortable: false, hidden: false
  52. },
  53. {
  54. index: 'RODR_QTY', name: 'rodrQty',
  55. label: '반품발주수량',
  56. width: '5', fixed: false, align: 'right',
  57. sortable: false, hidden: false,
  58. formatter: 'integer', formatoptions: {thousandsSeparator: ','}
  59. },
  60. {
  61. index: 'COL_REQ_QTY', name: 'colReqQty',
  62. label: '수거요청수량',
  63. width: '5', fixed: false, align: 'right',
  64. sortable: false, hidden: false,
  65. formatter: 'integer', formatoptions: {thousandsSeparator: ','}
  66. },
  67. {
  68. index: 'COL_QTY', name: 'colQty',
  69. label: '수거수량',
  70. width: '5', fixed: false, align: 'right',
  71. sortable: false, hidden: false,
  72. formatter: 'integer', formatoptions: {thousandsSeparator: ','}
  73. },
  74. {
  75. index: 'COL_AMT', name: 'colAmt',
  76. label: '수거금액',
  77. width: '8', fixed: false, align: 'right',
  78. sortable: false, hidden: false,
  79. formatter: 'integer', formatoptions: {thousandsSeparator: ','}
  80. },
  81. {
  82. index: 'RTN_WHS_NM', name: 'rtnWhsNm',
  83. label: '수거창고',
  84. width: '10', fixed: false, align: 'left',
  85. sortable: false, hidden: false
  86. },
  87. {
  88. index: 'COL_SCH_DT', name: 'colSchDt',
  89. label: '수거예정일',
  90. width: '8', fixed: false, align: 'center',
  91. sortable: false, hidden: false
  92. },
  93. {
  94. index: 'PICK_MGR_NM', name: 'pickMgrNm',
  95. label: '수거담당자명',
  96. width: '8', fixed: false, align: 'left',
  97. sortable: false, hidden: false
  98. },
  99. {
  100. index: 'PICK_MGR_TEL_NO', name: 'pickMgrTelNo',
  101. label: '수거담당자전화번호',
  102. width: '10', fixed: false, align: 'center',
  103. sortable: false, hidden: false
  104. }
  105. ],
  106. view: [],
  107. detail: []
  108. };
  109. /*화면공통 Object*/
  110. let pageObj = {
  111. init: function() {
  112. this.ui.init();
  113. this.event.init();
  114. },
  115. ui: {
  116. init: function() {
  117. this.view();
  118. this.grid();
  119. this.ready();
  120. },
  121. view: function() {
  122. // 버튼 권한설정
  123. fn_proc_btn_auth('RTNMNG06010');
  124. // 공통코드 표시
  125. $('select').each(function() {
  126. if($(this).data('select-code')) {
  127. fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
  128. }
  129. });
  130. // 조회일자 지정
  131. var now = new Date();
  132. var defaultToDate = new Date(now);
  133. defaultToDate.setDate(now.getDate() + 5);
  134. $('#ITP_TAB_RTNMNG06010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
  135. $('#ITP_FORM_RTNMNG06010_SEARCH_FROM_DT').datepicker('setDate', now);
  136. $('#ITP_FORM_RTNMNG06010_SEARCH_TO_DT').datepicker('setDate', defaultToDate);
  137. },
  138. grid: function() {
  139. itp_fn_jqgrid_resize(RTNMNG06010_GRID_ID, RTNMNG06010_GRID_LIST, 'lg');
  140. listObj.empty.init();
  141. itp_fn_fire_window_resize();
  142. },
  143. ready: function() {
  144. listObj.init();
  145. }
  146. },
  147. event: {
  148. init: function() {
  149. this.button();
  150. },
  151. button: function() {
  152. // 버튼 클릭 이벤트
  153. $('button').each(function() {
  154. var id = $(this).attr('id');
  155. $(this).on('click', function() {
  156. switch (id) {
  157. case 'ITP_BTN_RTNMNG06010_SRH' : listObj.button.search(); break; // 조회 버튼 클릭
  158. case 'ITP_BTN_RTNMNG06010_NEWREG' : listObj.button.create(); break; // 신규등록 버튼
  159. case 'ITP_BTN_RTNMNG06010_MODIFY' : modifyObj.button.modify(); break; // 수정 버튼
  160. case 'ITP_BTN_RTNMNG06010_CANCELLIST' : viewObj.button.cancel(); break; // 취소/목록 버튼
  161. case 'ITP_BTN_RTNMNG06010_DELETE' : break; // 삭제 버튼
  162. }
  163. });
  164. });
  165. }
  166. },
  167. switchScreen: function(mode) {
  168. $('.itp_det_head').find('button[id^="ITP_BTN_RTNMNG06010_"]').each(function(i) {
  169. $(this).hide();
  170. });
  171. $('#ITP_TAB_RTNMNG06010').find('div[id$="_CONTAINER"]').each(function(i) {
  172. $(this).hide();
  173. });
  174. if(mode == 'LIST') { // 목록
  175. fn_show_btn_auth_array(['#ITP_BTN_RTNMNG06010_SRH', '#ITP_BTN_RTNMNG06010_NEWREG']);
  176. $('#ITP_AJAX_RTNMNG06010_LIST_CONTAINER').show();
  177. $('#ITP_FORM_RTNMNG06010_SEARCH #ITP_FORM_RTNMNG06010_SEARCH_SBRAND_ID').val(fn_make_user_info.get('brandId'));
  178. $('#ITP_FORM_RTNMNG06010_SEARCH #ITP_FORM_RTNMNG06010_SEARCH_SSTORE_ID').val(fn_make_user_info.get('storeId'));
  179. $('#ITP_BTN_RTNMNG06010_SEARCH_SPPLY_ID').show();
  180. $('#ITP_BTN_RTNMNG06010_DELETE_SPPLY_ID').show();
  181. $('#ITP_BTN_RTNMNG06010_SEARCH_WHS_ID').show();
  182. $('#ITP_BTN_RTNMNG06010_DELETE_WHS_ID').show();
  183. }
  184. }
  185. }
  186. /*목록화면 Object*/
  187. let listObj = {
  188. init: function() {
  189. this.grid.init();
  190. this.action();
  191. },
  192. itp_RTNMNG06010_param: {},
  193. itp_RTNMNG06010_search: false,
  194. button: {
  195. search: function() {
  196. listObj.itp_RTNMNG06010_search = true;
  197. let param = $('#ITP_FORM_RTNMNG06010_SEARCH').serializeObject();
  198. param.gridSize = $.jgrid.defaults.rowNum;
  199. param.gridPage = $.jgrid.defaults.page;
  200. console.log(JSON.stringify(param));
  201. $(RTNMNG06010_GRID_ID).setGridParam({'postData': JSON.stringify(param)}).trigger('reloadGrid');
  202. }
  203. },
  204. empty: {
  205. init: function() {
  206. },
  207. push: function() {
  208. },
  209. back: function() {
  210. }
  211. },
  212. grid: {
  213. init: function() {
  214. // 데이터 없을때
  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. let param = $('#ITP_FORM_RTNMNG06010_SEARCH').serializeObject();
  225. param.gridSize = $.jgrid.defaults.rowNum;
  226. console.log(JSON.stringify(param));
  227. var option = {
  228. gridId: RTNMNG06010_GRID_ID,
  229. colModel: gridColModel.list,
  230. param: param,
  231. url: DOMAIN + API_POMNG_INOUTMNG_WAREHOUSE_GRID_LIST,
  232. pager: RTNMNG06010_GRID_PAGER,
  233. rownumbers: false,
  234. loadComplete: function(data) {
  235. console.log(data);
  236. itp_fn_grid_load_complete(data, RTNMNG06010_GRID_ID, true, 'number', 'RTNMNG06010', listObj.itp_RTNMNG06010_search, listObj.empty, true, data.gridRecords, true);
  237. var ids = $(RTNMNG06010_GRID_ID).getDataIDs();
  238. $.each(ids, function(idx, rowId) {
  239. $(RTNMNG06010_GRID_ID).jqGrid('setCell', rowId, 'pchPodrUnqNo', '', ITP_GRID_COL_STYLE.link);
  240. });
  241. },
  242. onPaging: function(action) {
  243. itp_fn_grid_paging(RTNMNG06010_GRID_ID, action, param);
  244. }
  245. };
  246. itp_fn_grid_make_remote(option);
  247. },
  248. clearData: function() {
  249. $(RTNMNG06010_GRID_ID).jqGrid('clearGridData', true);
  250. $(RTNMNG06010_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
  251. $(RTNMNG06010_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
  252. $(RTNMNG06010_GRID_EMPTY).show();
  253. },
  254. unload: function() {
  255. $.jgrid.gridUnload(RTNMNG06010_GRID_ID);
  256. }
  257. },
  258. action: function() {
  259. var _this = this;
  260. // 공급업체 조회 버튼 클릭
  261. $('#ITP_BTN_RTNMNG06010_SEARCH_POP_SSPPLY_NM').on('click', function() {
  262. _this.popup('spply');
  263. });
  264. // 공급업체 텍스트 삭제 버튼 클릭
  265. $('#ITP_BTN_RTNMNG06010_SEARCH_DEL_SSPPLY_NM').on('click', function() {
  266. $('#ITP_FORM_RTNMNG06010_SEARCH_SSPPLY_NM').val('');
  267. $('#ITP_FORM_RTNMNG06010_SEARCH_SSPPLY_ID').val('');
  268. });
  269. // 매장/창고 조회 버튼 클릭
  270. $('#ITP_BTN_RTNMNG06010_SEARCH_POP_SWHS_NM').on('click', function() {
  271. _this.popup('whs');
  272. });
  273. // 매장/창고 텍스트 삭제 버튼 클릭
  274. $('#ITP_BTN_RTNMNG06010_SEARCH_DEL_SWHS_NM').on('click', function() {
  275. $('#ITP_FORM_RTNMNG06010_SEARCH_SWHS_NM').val('');
  276. $('#ITP_FORM_RTNMNG06010_SEARCH_SWHS_ID').val('');
  277. });
  278. // 매장/창고 조회 버튼 클릭
  279. $('#ITP_BTN_RTNMNG06010_SEARCH_POP_SRTN_WHS_NM').on('click', function() {
  280. _this.popup('rwhs');
  281. });
  282. // 매장/창고 텍스트 삭제 버튼 클릭
  283. $('#ITP_BTN_RTNMNG06010_SEARCH_DEL_SRTN_WHS_NM').on('click', function() {
  284. $('#ITP_FORM_RTNMNG06010_SEARCH_SRTN_WHS_NM').val('');
  285. $('#ITP_FORM_RTNMNG06010_SEARCH_SRTN_WHS_ID').val('');
  286. });
  287. },
  288. popup: function(keyword) {
  289. if(keyword === 'spply'){
  290. var popFn = this.callback.supply;
  291. const key = {brandId:fn_make_user_info.get('brandId'),storeId:fn_make_user_info.get('storeId')};
  292. fn_call_popup('biz', 'BIZPOP_STORE_SPPLY', '#ITP_ASIDE', popFn, key, 'S');
  293. } else if(keyword === 'whs'){
  294. var popFn = this.callback.whs;
  295. const key1 = {brandId:fn_make_user_info.get('brandId'),storeId:fn_make_user_info.get('storeId'), whsDvsn:""};
  296. fn_call_popup('biz', 'BIZPOP_WHS_LOCATION', '#ITP_ASIDE', popFn, key1, 'S');
  297. } else if(keyword === 'rwhs'){
  298. var popFn = this.callback.rwhs;
  299. const key1 = {brandId:fn_make_user_info.get('brandId'),storeId:fn_make_user_info.get('storeId'), whsDvsn:""};
  300. fn_call_popup('biz', 'BIZPOP_WHS_LOCATION', '#ITP_ASIDE', popFn, key1, 'S');
  301. }
  302. },
  303. callback: {
  304. supply: function(rowDataPop) {
  305. $('#ITP_FORM_RTNMNG06010_SEARCH_SSPPLY_NM').val(rowDataPop.spplyNm);
  306. $('#ITP_FORM_RTNMNG06010_SEARCH_SSPPLY_ID').val(rowDataPop.spplyId);
  307. },
  308. whs: function(rowDataPop) {
  309. $('#ITP_FORM_RTNMNG06010_SEARCH_SWHS_NM').val(rowDataPop.whsNm);
  310. $('#ITP_FORM_RTNMNG06010_SEARCH_SWHS_ID').val(rowDataPop.whsId);
  311. },
  312. rwhs: function(rowDataPop) {
  313. $('#ITP_FORM_RTNMNG06010_SEARCH_SRTN_WHS_NM').val(rowDataPop.whsNm);
  314. $('#ITP_FORM_RTNMNG06010_SEARCH_SRTN_WHS_ID').val(rowDataPop.whsId);
  315. }
  316. }
  317. }
  318. console.log(CONN_KEY);