ITP_RTNMNG01010.js 18 KB

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