ITP_POMNG02010.js 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045
  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 listObj = {} : 목록화면 Object *
  14. * let viewObj = {} : 상세화면 Object *
  15. * let modifyObj = {} : 수정화면 Object *
  16. * let createObj = {} : 신규화면 Object *
  17. * let sfflyObj = {} : 공급업체담당자 Object *
  18. *******************************************************/
  19. /*화면 변수*/
  20. const POMNG02010_GRID_ID = '#ITP_POMNG02010_jqGrid';
  21. const POMNG02010_GRID_LIST = '#ITP_POMNG02010_jqGrid_list';
  22. const POMNG02010_GRID_PAGER = '#ITP_POMNG02010_jqGridPager';
  23. const POMNG02010_GRID_EMPTY = '#ITP_POMNG02010_jqGridEmpty';
  24. const POMNG02010_VIEW_GRID_ID = '#ITP_POMNG02010_VIEW_jqGrid';
  25. const POMNG02010_VIEW_GRID_LIST = '#ITP_POMNG02010_VIEW_jqGrid_list';
  26. const POMNG02010_VIEW_GRID_PAGER = '#ITP_POMNG02010_VIEW_jqGridPager';
  27. const POMNG02010_VIEW_GRID_EMPTY = '#ITP_POMNG02010_VIEW_jqGridEmpty';
  28. const POMNG02010_DETAIL_GRID_ID = '#ITP_POMNG02010_DETAIL_jqGrid';
  29. const POMNG02010_DETAIL_GRID_LIST = '#ITP_POMNG02010_DETAIL_jqGrid_list';
  30. const POMNG02010_DETAIL_GRID_PAGER = '#ITP_POMNG02010_DETAIL_jqGridPager';
  31. const POMNG02010_DETAIL_GRID_EMPTY = '#ITP_POMNG02010_DETAIL_jqGridEmpty';
  32. //let ITP_FORM_POMNG02010_DETAIL_IS_DUPLICATE = false;
  33. let ITP_FORM_POMNG02010_DETAIL_IS_WRITING = false;
  34. let POMNG02010_GRID_LAST_ROW_ID;
  35. let SCREEN_MODE;
  36. //let ITP_COMMON_ASSGN_TASK = fn_make_common_cd_list(CODE_LIST, 'ASSGN_TASK', true, '담당업무');
  37. /*API URL*/
  38. let API_DETAIL_GRID_LIST = '/api/pomng/detail-grid-list'; // 목록
  39. let API_DETAIL_INFO = '/api/pomng/info-pchReq'; // 상세
  40. let API_DETAIL_SAVE = '/api/pomng/save-pchReq'; // 저장
  41. //let API_INTI_PW = '/api/spply/inti-spplyPw'; // 패스워드 초기화
  42. //let API_POP_GRID_LIST = '/api/spply/pop-grid-list'; // 공급사 팝업 그리드 리스트
  43. /*화면 Grid ColModel*/
  44. const gridColModel = {
  45. list: [
  46. {
  47. index: 'BRAND_ID', name: 'brandId',
  48. label: ITP_MSG_LOCALE.label.brandId, //브랜드ID
  49. width: '10', fixed: false, align: 'center',
  50. sortable: false, hidden: true
  51. },
  52. {
  53. index: 'BRAND_NM', name: 'brandNm',
  54. label: ITP_MSG_LOCALE.label.brandNm, //브랜드명
  55. width: '10', fixed: false, align: 'left',
  56. minwidth: 120,
  57. sortable: false, hidden: false
  58. },
  59. {
  60. index: 'STORE_ID', name: 'storeId',
  61. label: ITP_MSG_LOCALE.label.storeId, //매장아이디
  62. width: '13', fixed: false, align: 'center',
  63. sortable: false, hidden: true
  64. },
  65. {
  66. index: 'PCH_REQ_UNQ_NO', name: 'pchReqUnqNo',
  67. label: ITP_MSG_LOCALE.label.pchReqUnqNo, //구매요청번호
  68. width: '10', fixed: false, align: 'center',
  69. minwidth: 120,
  70. sortable: false, hidden: false
  71. },
  72. {
  73. index: 'PCH_REQ_NM', name: 'pchReqNm',
  74. label: ITP_MSG_LOCALE.label.pchReqNm, //구매요청명
  75. width: '13', fixed: false, align: 'left',
  76. minwidth: 200,
  77. sortable: false, hidden: false
  78. },
  79. {
  80. index: 'PCH_REQ_ST_CD', name: 'pchReqStCd',
  81. label: ITP_MSG_LOCALE.label.pchReqStCd, //구매요청상태
  82. width: '15', fixed: false, align: 'center',
  83. minwidth: 10,
  84. sortable: false, hidden: true
  85. },
  86. {
  87. index: 'PCH_REQ_ST_NM', name: 'pchReqStNm',
  88. label: ITP_MSG_LOCALE.label.pchReqStNm, //구매요청상태명
  89. width: '6', fixed: false, align: 'center',
  90. minwidth: 100,
  91. sortable: false, hidden: false
  92. },
  93. {
  94. index: 'PCH_REQ_DT', name: 'pchReqDt',
  95. label: ITP_MSG_LOCALE.label.pchReqDt, //구매요청일
  96. width: '10', fixed: false, align: 'center',
  97. minwidth: 100,
  98. sortable: false, hidden: false
  99. },
  100. {
  101. index: 'PCH_REQ_ITEM_QTY', name: 'pchReqItemQty',
  102. label: ITP_MSG_LOCALE.label.pchReqItemQty, //요청품목수
  103. width: '10', fixed: false, align: 'right',
  104. sortable: false, hidden: false,
  105. formatter: 'integer', formatoptions: { defaultValue: '', thousandsSeparator: ',' }
  106. },
  107. {
  108. index: 'PCH_REQ_TOTAL_AMT', name: 'pchReqTotalAmt',
  109. label: ITP_MSG_LOCALE.label.pchReqTotalAmt, //요청금액
  110. width: '10', fixed: false, align: 'right',
  111. sortable: false, hidden: false,
  112. formatter: 'integer', formatoptions: { defaultValue: '', thousandsSeparator: ',' }
  113. },
  114. {
  115. index: 'PCH_REQ_RJCT_DT', name: 'pchReqRjctDt',
  116. label: ITP_MSG_LOCALE.label.pchReqRjctDt, //반려일자
  117. width: '10', fixed: false, align: 'center',
  118. sortable: false, hidden: false
  119. },
  120. {
  121. index: 'PCH_REQ_RJCT_NM', name: 'pchReqRjctNm',
  122. label: ITP_MSG_LOCALE.label.pchReqRjctNm, //반려자
  123. width: '10', fixed: false, align: 'left',
  124. sortable: false, hidden: false
  125. },
  126. {
  127. index: 'PCH_REQ_MGR_NM', name: 'pchReqMgrNm',
  128. label: ITP_MSG_LOCALE.label.pchReqMgrNm, //구매요청자명
  129. width: '10', fixed: false, align: 'left',
  130. minwidth: 100,
  131. sortable: false, hidden: false
  132. },
  133. {
  134. index: 'DLV_REQ_DT', name: 'dlvReqDt',
  135. label: ITP_MSG_LOCALE.label.dlvReqDt, //납품요청일
  136. width: '10', fixed: false, align: 'center',
  137. minwidth: 100,
  138. sortable: false, hidden: false
  139. },
  140. {
  141. index: 'WHS_LOCATION_NM', name: 'whsLocationNm',
  142. label: ITP_MSG_LOCALE.label.whsLocationNm, //납품창고
  143. width: '10', fixed: false, align: 'left',
  144. minwidth: 200,
  145. sortable: false, hidden: false
  146. }
  147. ],
  148. detail: [
  149. {
  150. index: 'VIEW_CD', name: 'viewCd',
  151. label: ITP_MSG_LOCALE.label.viewCd,
  152. width: '10', fixed: false, align: 'center',
  153. sortable: false, hidden: true
  154. },
  155. {
  156. index: 'PCH_REQ_UNQ_NO', name: 'pchReqUnqNo',
  157. label: ITP_MSG_LOCALE.label.pchReqUnqNo
  158. , //구매요청번호
  159. width: '10', fixed: false, align: 'center',
  160. sortable: false, hidden: true
  161. },
  162. {
  163. index: 'PCH_REQ_Dtl_NO', name: 'pchReqDtlNo',
  164. label: ITP_MSG_LOCALE.label.pchReqDtlNo
  165. , //구매요청상세번호
  166. width: '10', fixed: false, align: 'center',
  167. sortable: false, hidden: true
  168. },
  169. {
  170. index: 'ITEM_ID', name: 'itemId',
  171. label: ITP_MSG_LOCALE.label.itemId,
  172. width: '20', fixed: false, align: 'center',
  173. sortable: false, editable: false, edittype: 'text',
  174. editrules: { required: true }
  175. },
  176. {
  177. index: 'ITEM_NM', name: 'itemNm',
  178. label: ITP_MSG_LOCALE.label.itemNm,
  179. width: '30', fixed: false, align: 'left',
  180. sortable: true, editable: false, edittype: 'text',
  181. editrules: { required: true }
  182. },
  183. {
  184. index: 'UNIT', name: 'unit',
  185. label: ITP_MSG_LOCALE.label.unit,
  186. width: '10', fixed: false, align: 'center',
  187. sortable: false, editable: false, edittype: 'text'
  188. },
  189. {
  190. index: 'UNIT_AMT', name: 'unitAmt',
  191. label: ITP_MSG_LOCALE.label.unitAmt,
  192. width: '10', fixed: false, align: 'right',
  193. sortable: false, editable: false, edittype: 'text', hidden: false,
  194. formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
  195. },
  196. {
  197. index: 'PCH_REQ_QTY', name: 'pchReqQty',
  198. label: ITP_MSG_LOCALE.label.pchReqQty, //단가
  199. width: '10', fixed: false, align: 'right',
  200. classes: 'input_color',
  201. sortable: true, editable: true, edittype: 'text',
  202. editrules: {required: true, number:true},
  203. formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
  204. },
  205. {
  206. index: 'PCH_REQ_AMT', name: 'pchReqAmt',
  207. label: ITP_MSG_LOCALE.label.pchReqAmt,
  208. width: '10', fixed: false, align: 'right',
  209. sortable: false, editable: false, edittype: 'text', hidden: false,
  210. formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
  211. },
  212. {
  213. index: 'PCH_REQ_DTL_ST_NM', name: 'pchReqDtlStNm',
  214. label: ITP_MSG_LOCALE.label.pchReqDtlStNm,
  215. width: '10', fixed: false, align: 'center',
  216. sortable: false, editable: false, edittype: 'text', hidden: false
  217. },
  218. {
  219. index: 'PCH_REQ_DTL_ST_CD', name: 'pchReqDtlStCd',
  220. label: ITP_MSG_LOCALE.label.pchReqDtlStNm,
  221. width: '10', fixed: false, align: 'right',
  222. sortable: false, editable: false, edittype: 'text', hidden: true
  223. },
  224. {
  225. index: 'BRAND_UNIT_UNQ_NO', name: 'brandUnitUnqNo',
  226. label: ITP_MSG_LOCALE.label.brandUnitUnqNo,
  227. width: '10', fixed: false, align: 'center',
  228. sortable: false, editable: false, edittype: 'text', hidden: true
  229. },
  230. {
  231. index: 'STORE_UNIT_UNQ_NO', name: 'storeUnitUnqNo',
  232. label: ITP_MSG_LOCALE.label.storeUnitUnqNo,
  233. width: '10', fixed: false, align: 'center',
  234. sortable: false, editable: false, edittype: 'text', hidden: true
  235. },
  236. {
  237. index: 'UNIT_GUBUN', name: 'unitGubun',
  238. label: ITP_MSG_LOCALE.label.unitGubun,
  239. width: '10', fixed: false, align: 'center',
  240. sortable: false, editable: false, edittype: 'text', hidden: true
  241. }
  242. ]
  243. };
  244. /*화면공통 Object*/
  245. let pageObj = {
  246. init: function () {
  247. this.ui.init();
  248. this.event.init();
  249. this.action();
  250. },
  251. itp_POMNG02010_param: {},
  252. itp_POMNG02010_search: false,
  253. ui: {
  254. init: function () {
  255. this.view();
  256. //this.form();
  257. this.grid();
  258. this.ready();
  259. },
  260. view: function() {
  261. // 버튼 권한설정
  262. fn_proc_btn_auth('POMNG02010');
  263. // 공통코드 표시
  264. $('select').each(function() {
  265. if($(this).data('select-code')) {
  266. fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
  267. }
  268. });
  269. var now = new Date();
  270. $('#ITP_TAB_POMNG02010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
  271. $('#ITP_FORM_POMNG02010_SEARCH_FROM_DT').datepicker('setDate', new Date(now.setDate(now.getDate()-30)));
  272. $('#ITP_FORM_POMNG02010_SEARCH_TO_DT').datepicker('setDate', new Date(now.setDate(now.getDate()+30)));
  273. },
  274. /*
  275. form: function() {
  276. itp_fn_form_event.onKeyup('#ITP_FORM_POMNG02010_DETAIL');
  277. },
  278. */
  279. grid: function() {
  280. itp_fn_jqgrid_resize(POMNG02010_GRID_ID, POMNG02010_GRID_LIST, 'lg');
  281. itp_fn_fire_window_resize();
  282. },
  283. ready: function() {
  284. listObj.init();
  285. }
  286. },
  287. action: function () {
  288. var _this = this;
  289. // 납품장소 조회 버튼 클릭
  290. $('#ITP_FORM_POMNG02010_SSEARCH_SWHS_NM').on('click', function() {
  291. console.log("=================================");
  292. _this.popup('S');
  293. });
  294. // 납품장소 텍스트 삭제 버튼 클릭
  295. $('#ITP_FORM_POMNG02010_SDELETE_SWHS_NM').on('click', function() {
  296. console.log("=================================");
  297. $('#ITP_FORM_POMNG02010_SEARCH_SWHS_NM').val('');
  298. $('#ITP_FORM_POMNG02010_SEARCH_SWHS_ID').val('');
  299. });
  300. // 수정 화면에서의 납품장소 조회 버튼 클릭
  301. $('#ITP_FORM_POMNG02010_SEARCH_WHS_NM').on('click', function() {
  302. console.log("=================================");
  303. _this.popup('U');
  304. });
  305. // 납품장소 텍스트 삭제 버튼 클릭
  306. $('#ITP_FORM_POMNG02010_DELETE_WHS_NM').on('click', function() {
  307. console.log("=================================");
  308. $('#ITP_FORM_POMNG02010_DETAIL_WHS_NM').val('');
  309. $('#ITP_FORM_POMNG02010_DETAIL_WHS_ID').val('');
  310. $('#ITP_FORM_POMNG02010_DETAIL_LOCATION_NM').val('');
  311. $('#ITP_FORM_POMNG02010_DETAIL_LOCATION').val('');
  312. });
  313. },
  314. popup: function (arg) {
  315. var popFn ;
  316. // 팝업
  317. if (arg == "S") {
  318. popFn = this.callback.create;
  319. } else {
  320. popFn = this.callback.modify;
  321. }
  322. var whsDvsn = "";
  323. if (fn_make_user_info.get('storeId') == '' ) {
  324. whsDvsn = "";
  325. } else {
  326. whsDvsn = "W02";
  327. }
  328. const key = {brandId:fn_make_user_info.get('brandId'),storeId:fn_make_user_info.get('storeId'), whsDvsn: whsDvsn};
  329. fn_call_popup('biz', 'BIZPOP_WHS_LOCATION', '#ITP_ASIDE', popFn, key, 'S');
  330. },
  331. callback: {
  332. create: function(rowDataPop) {
  333. console.log(rowDataPop);
  334. if(rowDataPop) {
  335. $('#ITP_FORM_POMNG02010_SEARCH_SWHS_NM').val(rowDataPop.whsNm);
  336. $('#ITP_FORM_POMNG02010_SEARCH_SWHS_ID').val(rowDataPop.whsId);
  337. }
  338. },
  339. modify: function(rowDataPop) {
  340. console.log(rowDataPop);
  341. if(rowDataPop) {
  342. $('#ITP_FORM_POMNG02010_DETAIL_WHS_NM').val(rowDataPop.whsNm);
  343. $('#ITP_FORM_POMNG02010_DETAIL_WHS_ID').val(rowDataPop.whsId);
  344. $('#ITP_FORM_POMNG02010_DETAIL_LOCATION_NM').val(rowDataPop.locationNm);
  345. $('#ITP_FORM_POMNG02010_DETAIL_LOCATION').val(rowDataPop.location);
  346. }
  347. }
  348. },
  349. event: {
  350. init: function () {
  351. this.button();
  352. },
  353. button: function () {
  354. // 버튼 클릭 이벤트
  355. $('button').each(function() {
  356. var id = $(this).attr('id');
  357. $(this).on('click', function() {
  358. switch (id) {
  359. case 'ITP_BTN_POMNG02010_SRH' : listObj.button.search(); break; // 조회 버튼 클릭
  360. //case 'ITP_BTN_POMNG02010_NEWREG' : listObj.button.create(); break; // 신규등록 버튼
  361. case 'ITP_BTN_POMNG02010_MODIFY' : modifyObj.button.modify(); break; // 수정 버튼
  362. case 'ITP_BTN_POMNG02010_CANCELLIST' : modifyObj.button.cancel(); break; // 취소/목록 버튼
  363. case 'ITP_BTN_POMNG02010_REQ' : modifyObj.button.save("PR20"); break; // 구매요청
  364. case 'ITP_BTN_POMNG02010_SAVE' : modifyObj.button.save("PR00"); break; // 임시저장
  365. case 'ITP_BTN_POMNG02010_DETAIL_ADDROW' : pageObj.grid.button.addRow(); break; // 품목추가
  366. case 'ITP_BTN_POMNG02010_DETAIL_DELROW' : pageObj.grid.button.delRow(); break; // 품목삭제
  367. case 'ITP_BTN_POMNG02010_EXCEL' : listObj.excelDown(); break; // 엑셀 다운로드 버튼
  368. }
  369. });
  370. });
  371. $('body').on('click', function(e) {
  372. var gridId = POMNG02010_DETAIL_GRID_ID.replace('#', '');
  373. var rids = $(POMNG02010_DETAIL_GRID_ID).jqGrid('getDataIDs');
  374. var last_row_id = rids[rids.length - 1];
  375. itp_fn_grid_reset_selection(e, last_row_id, gridId, 'POMNG02010_DETAIL');
  376. pageObj.grid.recal();
  377. });
  378. }
  379. },
  380. switchScreen: function(mode) {
  381. $('.itp_det_head').find('button[id^="ITP_BTN_POMNG02010_"]').each(function(i) {
  382. $(this).hide();
  383. });
  384. $('#ITP_TAB_POMNG02010').find('div[id$="_CONTAINER"]').each(function(i) {
  385. $(this).hide();
  386. });
  387. if(mode == 'LIST') { // 목록
  388. fn_show_btn_auth_array(['#ITP_BTN_POMNG02010_SRH', '#ITP_BTN_POMNG02010_NEWREG']);
  389. $('#ITP_AJAX_POMNG02010_LIST_CONTAINER').show();
  390. $('#ITP_FORM_POMNG02010_DETAIL_SBRAND_ID').val(fn_make_user_info.get('brandId'));
  391. $('#ITP_FORM_POMNG02010_DETAIL_SSTORE_ID').val(fn_make_user_info.get('storeId'));
  392. $('#ITP_BTN_POMNG02010_EXCEL').show();
  393. SCREEN_MODE = 'LIST' ;
  394. } else if(mode == 'ADD') { // 등록
  395. fn_show_btn_auth_array(['#ITP_BTN_POMNG02010_CANCELLIST', '#ITP_BTN_POMNG02010_SAVE']);
  396. $('#ITP_AJAX_POMNG02010_DETAIL_CONTAINER').show();
  397. $('#ITP_FORM_POMNG02010_DETAIL').find('input, textarea, select, checkbox').each(function(i, elem) {
  398. $(this).attr('id') === 'ITP_FORM_POMNG02010_DETAIL_VIEW_CD' ? $(this).val('C') : $(this).val('');
  399. if(elem.type === 'select') {
  400. $(this).val('').prop('selected', true);
  401. }
  402. });
  403. SCREEN_MODE = 'DETAIL' ;
  404. } else if(mode == 'MODIFY') { // 수정
  405. fn_show_btn_auth_array(['#ITP_BTN_POMNG02010_CANCELLIST', '#ITP_BTN_POMNG02010_SAVE', '#ITP_BTN_POMNG02010_REQ']);
  406. $('#ITP_AJAX_POMNG02010_DETAIL_CONTAINER').show();
  407. $('#ITP_FORM_POMNG02010_DETAIL .itp_form_info').show();
  408. $('#ITP_FORM_POMNG02010_DETAIL .itp_form_change').hide();
  409. SCREEN_MODE = 'DETAIL' ;
  410. } else if(mode == 'VIEW') { // 보기
  411. fn_show_btn_auth_array(['#ITP_BTN_POMNG02010_MODIFY', '#ITP_BTN_POMNG02010_CANCELLIST']);
  412. $('#ITP_AJAX_POMNG02010_VIEW_CONTAINER').show();
  413. SCREEN_MODE = 'VIEW' ;
  414. }
  415. },
  416. grid: {
  417. init: function(mode, gridRows) {
  418. console.log(mode);
  419. this.gridId = (mode === 'VIEW') ? POMNG02010_VIEW_GRID_ID : POMNG02010_DETAIL_GRID_ID;
  420. this.gridList = (mode === 'VIEW') ? POMNG02010_VIEW_GRID_LIST : POMNG02010_DETAIL_GRID_LIST;
  421. this.gridEmpty = (mode === 'VIEW') ? POMNG02010_VIEW_GRID_EMPTY : POMNG02010_DETAIL_GRID_EMPTY;
  422. this.gridRows = gridRows;
  423. this.unload();
  424. this.load(mode, gridRows);
  425. },
  426. gridId: '',
  427. gridList: '',
  428. gridEmpty: '',
  429. gridRows: '',
  430. button: {
  431. addRow: function() {
  432. // 팝업
  433. var popFn = function(rowDataPop) {
  434. console.log(rowDataPop);
  435. // 기존등록 데이터
  436. var exists = '';
  437. const rowData = $(POMNG02010_DETAIL_GRID_ID).getRowData();
  438. $.each(rowData, function(key, value) {
  439. if (value.viewCd != "D") {
  440. exists = exists + value.brandUnitUnqNo + ';';
  441. }
  442. });
  443. $.each(rowDataPop, function(key, value) {
  444. if (exists.indexOf(value.brandUnitUnqNo) < 0 && value.podrPssblDvsn == 'PO01') {
  445. value['viewCd'] = "C";
  446. $(POMNG02010_DETAIL_GRID_ID).jqGrid('addRowData', value.brandUnitUnqNo, value, 'last');
  447. }
  448. });
  449. $(POMNG02010_DETAIL_GRID_EMPTY).hide();
  450. };
  451. const key = {brandId:fn_make_user_info.get('brandId'),storeId:fn_make_user_info.get('storeId')};
  452. fn_call_popup('biz', 'BIZPOP_ITEM', '#ITP_ASIDE', popFn, key, 'S'); // ==>dwkim 추후 작업 진행 파라메타 설명필요
  453. },
  454. delRow: function() {
  455. itp_fn_grid_del_row(POMNG02010_DETAIL_GRID_ID);
  456. pageObj.grid.recal();
  457. }
  458. },
  459. load: function(mode, gridRows) {
  460. var _this = this;
  461. var option = {
  462. gridId: _this.gridId,
  463. colModel: gridColModel.detail,
  464. data: gridRows,
  465. multiselect: true,
  466. //cellEdit: (mode !== 'VIEW'),
  467. loadComplete: function(data) {
  468. //console.log(data);
  469. //$(_this.gridList).find('.ui-jqgrid .ui-jqgrid-bdiv').css('overflow-x', 'hidden');
  470. //(Array.isArray(data.rows) && data.rows.length === 0) ? $(_this.gridEmpty).show() : $(_this.gridEmpty).hide();
  471. $(_this.mode === 'VIEW' ? POMNG02010_VIEW_GRID_LIST : POMNG02010_DETAIL_GRID_LIST).find('.ui-jqgrid .ui-jqgrid-bdiv').css('overflow-x', 'hidden');
  472. data.records === 0 ? _this.clearData() : $(_this.mode === 'VIEW' ? POMNG02010_VIEW_GRID_EMPTY : POMNG02010_DETAIL_GRID_EMPTY).hide();
  473. },
  474. onCellSelect: function(rowid, cellIdx, cellValue) {
  475. if(mode !== 'VIEW') {
  476. POMNG02010_GRID_LAST_ROW_ID = itp_fn_set_data_editable(rowid, cellIdx, POMNG02010_GRID_LAST_ROW_ID, POMNG02010_DETAIL_GRID_ID, ['pchReqUnqNo']);
  477. }
  478. }
  479. };
  480. itp_fn_grid_make_local(option);
  481. },
  482. recal: function() {
  483. console.log("recal call");
  484. if (SCREEN_MODE === 'DETAIL') {
  485. var ids = $(POMNG02010_DETAIL_GRID_ID).getDataIDs();
  486. $.each(ids, function(idx, rowId) {
  487. console.log("recal start");
  488. var viewCd = jQuery(POMNG02010_DETAIL_GRID_ID).jqGrid('getCell', rowId, 'viewCd');
  489. var unitAmt = jQuery(POMNG02010_DETAIL_GRID_ID).jqGrid('getCell', rowId, 'unitAmt');
  490. var pchReqQty = jQuery(POMNG02010_DETAIL_GRID_ID).jqGrid('getCell', rowId, 'pchReqQty');
  491. if(viewCd != 'D' && unitAmt != null && unitAmt != '' && pchReqQty != null && pchReqQty != '') {
  492. jQuery(POMNG02010_DETAIL_GRID_ID).jqGrid('setRowData',rowId,{pchReqAmt: parseInt(unitAmt)*parseInt(pchReqQty)});
  493. }
  494. });
  495. const rowData = $(POMNG02010_DETAIL_GRID_ID).getRowData();
  496. var pchReqAmt = 0 ;
  497. $.each(rowData, function(key, value) {
  498. // console.log(JSON.stringify(rowData));
  499. if (value.pchReqAmt != null && value.pchReqAmt != "" && value.viewCd != "D") {
  500. pchReqAmt = pchReqAmt + parseInt(value.pchReqAmt) ;
  501. }
  502. });
  503. $('#ITP_FORM_POMNG02010_DETAIL .fnPchReqTotalAmt').text(itp_fn_number_comma(pchReqAmt));
  504. }
  505. },
  506. clearData : function() {
  507. $(this.gridId).jqGrid('clearGridData', true);
  508. $(this.mode === 'VIEW' ? POMNG02010_VIEW_GRID_LIST : POMNG02010_DETAIL_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
  509. $(this.mode === 'VIEW' ? POMNG02010_VIEW_GRID_EMPTY : POMNG02010_DETAIL_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
  510. $(this.mode === 'VIEW' ? POMNG02010_VIEW_GRID_EMPTY : POMNG02010_DETAIL_GRID_EMPTY).show();
  511. },
  512. unload : function() {
  513. $.jgrid.gridUnload(this.gridId);
  514. }
  515. }
  516. };
  517. /*목록화면 Object*/
  518. let listObj = {
  519. init: function () {
  520. this.grid.init();
  521. },
  522. itp_POMNG02010_search: false,
  523. button: {
  524. search: function() {
  525. listObj.itp_POMNG02010_search = true;
  526. let param = $('#ITP_FORM_POMNG02010_SEARCH').serializeObject();
  527. param.gridSize = $.jgrid.defaults.rowNum;
  528. param.gridPage = $.jgrid.defaults.page;
  529. console.log(param);
  530. $(POMNG02010_GRID_ID).setGridParam({'postData': JSON.stringify(param)}).trigger('reloadGrid');
  531. },
  532. create: function() {
  533. if(!fn_make_user_info.isEmpty()) {
  534. //createObj.init();
  535. }
  536. }
  537. },
  538. empty: {
  539. init: function() {
  540. },
  541. itp_POMNG02010_param: {},
  542. push: function() {
  543. },
  544. back: function() {
  545. }
  546. },
  547. grid: {
  548. init: function () {
  549. // 데이터 없을때
  550. itp_fn_jqgrid_resize(POMNG02010_GRID_ID, POMNG02010_GRID_LIST, 'lg');
  551. //itp_fn_fire_window_resize();
  552. //this.reload();
  553. this.search();
  554. },
  555. colModel: gridColModel.list,
  556. search: function() {
  557. pageObj.switchScreen('LIST');
  558. this.unload();
  559. this.load();
  560. },
  561. load: function() {
  562. let param = $('#ITP_FORM_POMNG02010_SEARCH').serializeObject();
  563. param.gridSize = $.jgrid.defaults.rowNum;
  564. param.sbrandId = fn_make_user_info.get('brandId');
  565. param.sstoreId = fn_make_user_info.get('storeId');
  566. var option = {
  567. gridId: POMNG02010_GRID_ID,
  568. colModel: gridColModel.list,
  569. //autowidth: true,
  570. //shrinkToFit:false,
  571. param: param,
  572. url: DOMAIN + API_DETAIL_GRID_LIST,
  573. pager: POMNG02010_GRID_PAGER,
  574. multiselect: true,
  575. rownumbers: false,
  576. onCellSelect: function(rowId, cellIdx, cellValue) {
  577. var cm = $(this).jqGrid('getGridParam', 'colModel');
  578. var colNm = cm[cellIdx].name;
  579. if (colNm == 'pchReqUnqNo') {
  580. const selectVal = $(this).jqGrid('getCell', rowId, 'pchReqUnqNo');
  581. const key = {brandId:fn_make_user_info.get('brandId'), pchReqUnqNo: selectVal, viewCd: 'R'};
  582. var param = $.param(key);
  583. viewObj.init(param);
  584. }
  585. },
  586. loadComplete: function(data) {
  587. console.log(data);
  588. itp_fn_grid_load_complete(data, POMNG02010_GRID_ID, true, 'number', 'POMNG02010', listObj.itp_POMNG02010_search, listObj.empty, true, data.gridRecords, true);
  589. var ids = $(POMNG02010_GRID_ID).getDataIDs();
  590. $.each(ids, function(idx, rowId) {
  591. $(POMNG02010_GRID_ID).jqGrid('setCell', rowId, 'pchReqUnqNo', '', ITP_GRID_COL_STYLE.link);
  592. });
  593. },
  594. onPaging: function(action) {
  595. /*
  596. var pagingFn = {
  597. callBack: function(args) {
  598. $(args).trigger('reloadGrid');
  599. }
  600. };
  601. if (itp_fn_check_grid_is_writing(POMNG02010_DETAIL_GRID_ID)) {
  602. itp_fn_modal_confirm(ITP_MSG_LOCALE.message.ajax.cancelData, pagingFn, POMNG02010_DETAIL_GRID_ID);
  603. return 'stop';
  604. } else {
  605. itp_fn_grid_paging(POMNG02010_DETAIL_GRID_ID, action, param);
  606. }
  607. */
  608. itp_fn_grid_paging(POMNG02010_GRID_ID, action, param);
  609. }
  610. };
  611. itp_fn_grid_make_remote(option);
  612. },
  613. /*
  614. reload : function() {
  615. var _this = this;
  616. $(POMNG02010_GRID_EMPTY).off('click').on('click', function() {
  617. pageObj.itp_OPER03010_param.gridSize = $.jgrid.defaults.rowNum;
  618. $(POMNG02010_GRID_ID).setGridParam({'postData': JSON.stringify(pageObj.itp_POMNG02010_param)}).trigger('reloadGrid');
  619. });
  620. },
  621. */
  622. clearData : function() {
  623. $(POMNG02010_GRID_ID).jqGrid('clearGridData', true);
  624. $(POMNG02010_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
  625. $(POMNG02010_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
  626. $(POMNG02010_GRID_EMPTY).show();
  627. },
  628. unload : function() {
  629. $.jgrid.gridUnload(POMNG02010_GRID_ID);
  630. }
  631. },
  632. excelDown: function() {
  633. var param = {
  634. 'url': API_DETAIL_GRID_LIST,
  635. 'param': $('#ITP_FORM_POMNG02010_SEARCH').serializeObject(),
  636. 'gridColumns': $(POMNG02010_GRID_ID).jqGrid('getGridParam', 'colModel'),
  637. 'fileName': '구매요청현황.xlsx',
  638. 'sheetName': '구매요청리스트'
  639. };
  640. itp_fn_remote_to_excel(param);
  641. }
  642. };
  643. /*상세화면 Object*/
  644. let viewObj = {
  645. init: function (param) {
  646. this.load(param);
  647. },
  648. load: function(param) {
  649. fn_ajax_call(API_DETAIL_INFO, param, this.callback, 'GET');
  650. },
  651. callback: function (result) {
  652. console.log(result);
  653. pageObj.switchScreen('VIEW');
  654. $('#ITP_FORM_POMNG02010_VIEW #ITP_FORM_POMNG02010_VIEW_PCH_REQ_UNQ_NO').val(result.pchReqUnqNo);
  655. $('#ITP_FORM_POMNG02010_VIEW #ITP_FORM_POMNG02010_VIEW_PCH_REQ_MGR_ID').val(result.pchReqMgrId);
  656. $('#ITP_FORM_POMNG02010_VIEW #ITP_FORM_POMNG02010_VIEW_PCH_REQ_ST_CD').val(result.pchReqStCd);
  657. $('#ITP_FORM_POMNG02010_VIEW .fnBrandNm').text(result.brandNm);
  658. $('#ITP_FORM_POMNG02010_VIEW .fnPchReqUnqNo').text(result.pchReqUnqNo);
  659. $('#ITP_FORM_POMNG02010_VIEW .fnPchReqNm').text(result.pchReqNm);
  660. $('#ITP_FORM_POMNG02010_VIEW .fnPchReqStNm').text(result.pchReqStNm);
  661. $('#ITP_FORM_POMNG02010_VIEW .pchReqMgrNm').text(result.pchReqMgrNm);
  662. $('#ITP_FORM_POMNG02010_VIEW .fnPchReqTotalAmt').text(itp_fn_number_comma(result.pchReqTotalAmt));
  663. $('#ITP_FORM_POMNG02010_VIEW .fnDlvReqDt').text(result.dlvReqDt);
  664. $('#ITP_FORM_POMNG02010_VIEW .fnWhsNm').text(result.whsNm + " - " + result.locationNm);
  665. $('#ITP_FORM_POMNG02010_VIEW .fnLoanDvsnNm').text(result.loanDvsnNm);
  666. $('#ITP_FORM_POMNG02010_VIEW .fnOrdUseAmt').text(itp_fn_number_comma(result.ordUseAmt));
  667. $('#ITP_FORM_POMNG02010_VIEW .fnNote').text(result.note);
  668. $('#ITP_FORM_POMNG02010_VIEW .fnPchReqRjctDt').text(result.pchReqRjctDt);
  669. $('#ITP_FORM_POMNG02010_VIEW .fnPchReqRjctNm').text(result.pchReqRjctNm);
  670. $('#ITP_FORM_POMNG02010_VIEW .fnPchReqRjctRsn').text(result.pchReqRjctRsn);
  671. // 품목 리스트 조회
  672. pageObj.grid.init('VIEW', result.pchReqDtlList);
  673. }
  674. };
  675. /*수정화면 Object*/
  676. let modifyObj = {
  677. init: function (param) {
  678. pageObj.grid.init('DETAIL', []);
  679. //this.load(param);
  680. },
  681. button: {
  682. modify: function (param) {
  683. itp_fn_form_clear_validate(null, '#ITP_FORM_POMNG02010_DETAIL');
  684. const selectVal = $('#ITP_FORM_POMNG02010_VIEW_PCH_REQ_UNQ_NO').val();
  685. const writeVal = $('#ITP_FORM_POMNG02010_VIEW_PCH_REQ_MGR_ID').val();
  686. const stCd = $('#ITP_FORM_POMNG02010_VIEW_PCH_REQ_ST_CD').val();
  687. var userId = fn_make_user_info.get('userId');
  688. if (writeVal != userId) {
  689. alert(ITP_MSG_LOCALE.message.ajax.diffWrite);
  690. return;
  691. }
  692. if (stCd != "PR00") {
  693. alert(ITP_MSG_LOCALE.message.ajax.notWrite);
  694. return;
  695. }
  696. const key = {brandId:fn_make_user_info.get('brandId'), pchReqUnqNo: selectVal, viewCd: 'R'};
  697. var param = $.param(key);
  698. //modifyObj.init(param);
  699. modifyObj.load(param);
  700. },
  701. save: function(arg) {
  702. $('body').trigger('click');
  703. const formId = '#ITP_FORM_POMNG02010_DETAIL';
  704. itp_fn_form_clear_validate(null, formId);
  705. itp_fn_grid_save_rows(POMNG02010_DETAIL_GRID_ID);
  706. $('#ITP_FORM_POMNG02010_DETAIL_PCH_REQ_ST_CD').val(arg);
  707. //정산 타입이 무정산이면 스킵
  708. var loanDvsn = $('#ITP_FORM_POMNG02010_DETAIL_LOAN_DVSN').val();
  709. var dlvReqDt = $('#ITP_FORM_POMNG02010_DETAIL_DLV_REQ_DT').val();
  710. var itemcnt = $(POMNG02010_DETAIL_GRID_ID).getGridParam('reccount');
  711. var dlvReqAmt = $('#ITP_FORM_POMNG02010_DETAIL .fnPchReqTotalAmt').text();
  712. var reqMsg = "";
  713. var apprArg = {};
  714. //정산 타입이 무정산이면 스킵
  715. var apprTypeCd = "Y" // Y 정상결재, NP 선불, NA 후불
  716. var now = new Date();
  717. var today = now.getFullYear() +
  718. "." + (now.getMonth()+1 > 9 ? (now.getMonth()+1).toString() : "0" + (now.getMonth()+1).toString()) +
  719. "." + (now.getDate() > 9 ? now.getDate().toString() : "0" + now.getDate().toString());
  720. var dlvReqDt = $('#ITP_FORM_POMNG02010_DETAIL_DLV_REQ_DT').val();
  721. if (today > dlvReqDt) {
  722. alert("납품요청일은 오늘 이후이어야 합니다.");
  723. return;
  724. }
  725. //console.log(loanDvsn);
  726. if (loanDvsn != null && loanDvsn != "") {
  727. if (loanDvsn != 'LD03' && arg == 'PR20' ) {
  728. var pchActAtm = itp_fn_currency_unfmatter($('#ITP_FORM_POMNG02010_DETAIL .fnPchActAmt').text(),"","");
  729. var pchReqAtm = itp_fn_currency_unfmatter($('#ITP_FORM_POMNG02010_DETAIL .fnPchReqTotalAmt').text(),"","");
  730. var mallId = $('#ITP_FORM_POMNG02010_DETAIL_MALL_ID').val();
  731. if (parseInt(pchActAtm) < parseInt(pchReqAtm)) {
  732. dlvReqAmt = itp_fn_number_comma(String(parseInt(pchReqAtm) - parseInt(pchActAtm)));
  733. if (mallId == '') {
  734. if (loanDvsn == 'LD01') {
  735. apprTypeCd = 'NPN';
  736. } else {
  737. apprTypeCd = 'NAN';
  738. }
  739. } else {
  740. if (loanDvsn == 'LD01') {
  741. apprTypeCd = 'NP';
  742. } else {
  743. apprTypeCd = 'NA';
  744. }
  745. }
  746. }
  747. }
  748. }
  749. if (itp_fn_form_event.isValid(formId)) {
  750. const rowData1 = $(POMNG02010_DETAIL_GRID_ID).getRowData();
  751. var dataCnt = 0;
  752. var chkQtyYn = "N";
  753. $.each(rowData1, function(key, value) {
  754. if (value.viewCd != 'D') {
  755. dataCnt = dataCnt + 1;
  756. if (value.pchReqQty == '' || value.pchReqQty < 1 ) {
  757. alert("요청수량을 입력해주세요!");
  758. chkQtyYn = "Y";
  759. return false;
  760. }
  761. }
  762. });
  763. if (dataCnt == 0) {
  764. alert( "요청할 품목내역이 없습니다.");
  765. return ;
  766. }
  767. if (chkQtyYn == "Y") return;
  768. if (arg == 'PR20') {
  769. apprArg.dlvReqDt = dlvReqDt;
  770. apprArg.itemcnt = itemcnt;
  771. apprArg.dlvReqAmt = dlvReqAmt;
  772. console.log("-----------------------");
  773. console.log(dlvReqAmt, apprArg.dlvReqAmt);
  774. if (apprTypeCd == "Y") { // 여신 구분, 여신금액
  775. var prIngFn = {
  776. callBack: function(args) {
  777. modifyObj.button.saveLastReq(arg);
  778. }
  779. };
  780. itp_fn_modal_confirm_req1(apprArg, prIngFn, arg);
  781. } else // 금액 부족시
  782. modifyObj.button.saveApprReq(apprArg,apprTypeCd, arg);
  783. } else {
  784. modifyObj.button.saveReq(arg);
  785. }
  786. }
  787. },
  788. saveReq: function(arg) {
  789. const formId = '#ITP_FORM_POMNG02010_DETAIL';
  790. var saveFn = {
  791. callBack: function(args) {
  792. $(formId).val(arg);
  793. let gridInsertData = [];
  794. let gridUpdateData = [];
  795. let gridDeleteData = [];
  796. const rowData = $(POMNG02010_DETAIL_GRID_ID).getRowData();
  797. $.each(rowData, function(key, value) {
  798. if (value.viewCd !== 'R') {
  799. if (value.viewCd === 'C') {
  800. gridInsertData.push(value);
  801. } else if (value.viewCd === 'U') {
  802. gridUpdateData.push(value);
  803. } else if (value.viewCd === 'D') {
  804. gridDeleteData.push(value);
  805. }
  806. }
  807. });
  808. let param = $(formId).serializeObject();
  809. param.gridInsertData = gridInsertData;
  810. param.gridUpdateData = gridUpdateData;
  811. param.gridDeleteData = gridDeleteData;
  812. console.log(JSON.stringify(param));
  813. var searhFn = function() {
  814. ITP_FORM_POMNG02010_DETAIL_IS_WRITING = false;
  815. modifyObj.button.clear();
  816. };
  817. fn_ajax_call(API_DETAIL_SAVE, JSON.stringify(param), searhFn, 'POST');
  818. }
  819. };
  820. itp_fn_modal_confirm(ITP_MSG_LOCALE.message.ajax.tmpSave, saveFn, null);
  821. },
  822. saveApprReq: function(param, apprTypeCd, arg) {
  823. var apprFn = {
  824. callBack: function(args) {
  825. // 결재금액이 부족하여 결재란으로 이동처리
  826. var popFn = function(rowDataPop) {
  827. // 결재 성공시 승인처리함
  828. console.log(rowDataPop);
  829. modifyObj.button.saveLastReq(arg);
  830. };
  831. // 결제 팝업 : LD01(선불(충전)), LD02(후불(신용))
  832. // 결제타입코드 : 10(선불(충전)), 20(후불(결제)), 30(후불(선결제))
  833. // 구매요청 번호 전달 -
  834. //var loanDvsn = $('#ITP_FORM_LOANMNG02010_SEARCH_STORE_LOAN_DVSN').val();
  835. var pchActAtm = itp_fn_currency_unfmatter($('#ITP_FORM_POMNG02010_DETAIL .fnPchActAmt').text(),"","");
  836. var pchReqAtm = itp_fn_currency_unfmatter($('#ITP_FORM_POMNG02010_DETAIL .fnPchReqTotalAmt').text(),"","");
  837. var args = {'payTpCd': '40',
  838. 'brandId': fn_make_user_info.get('brandId'),
  839. 'storeId': fn_make_user_info.get('storeId'),
  840. 'prchReqUnqNo': $('ITP_FORM_POMNG02010_DETAIL_PCH_REQ_UNQ_NO').val(),
  841. 'goodsAmt': pchReqAtm-pchActAtm};
  842. fn_call_popup('biz', 'BIZPOP_PO_PAYMENT', '#ITP_ASIDE', popFn, args, 'S');
  843. }
  844. };
  845. var apprNFn = {
  846. callBack: function(args) {
  847. // 임시저장 처리한다.
  848. arg = 'PR00';
  849. $('#ITP_FORM_POMNG02010_DETAIL_PCH_REQ_ST_CD').val(arg);
  850. modifyObj.button.saveLastReq(arg);
  851. }
  852. };
  853. if (apprTypeCd == 'NP') { // 선불
  854. itp_fn_modal_confirm_req2(param, apprFn, arg);
  855. } else if (apprTypeCd == 'NA') { //후불
  856. itp_fn_modal_confirm_req3(param, apprFn, arg);
  857. } else if (apprTypeCd == 'NPN') { //선불 pg없음 임시저장으로
  858. itp_fn_modal_confirm_req4(param, apprNFn, arg);
  859. } else if (apprTypeCd == 'NAN') { //후불 pg없음 임시저장으로
  860. itp_fn_modal_confirm_req5(param, apprNFn, arg);
  861. }
  862. },
  863. saveLastReq: function(arg) {
  864. const formId = '#ITP_FORM_POMNG02010_DETAIL';
  865. $(formId).val(arg);
  866. let gridInsertData = [];
  867. let gridUpdateData = [];
  868. let gridDeleteData = [];
  869. const rowData = $(POMNG02010_DETAIL_GRID_ID).getRowData();
  870. $.each(rowData, function(key, value) {
  871. if (value.viewCd !== 'R') {
  872. if (value.viewCd === 'C') {
  873. gridInsertData.push(value);
  874. } else if (value.viewCd === 'U') {
  875. gridUpdateData.push(value);
  876. } else if (value.viewCd === 'D') {
  877. gridDeleteData.push(value);
  878. }
  879. }
  880. });
  881. //if (chkQtyYn == "Y") return;
  882. let param = $(formId).serializeObject();
  883. param.gridInsertData = gridInsertData;
  884. param.gridUpdateData = gridUpdateData;
  885. param.gridDeleteData = gridDeleteData;
  886. console.log(JSON.stringify(param));
  887. var searhFn = function() {
  888. ITP_FORM_POMNG02010_DETAIL_IS_WRITING = false;
  889. modifyObj.button.clear();
  890. };
  891. fn_ajax_call(API_DETAIL_SAVE, JSON.stringify(param), searhFn, 'POST');
  892. },
  893. clear: function () {
  894. document.getElementById('ITP_FORM_POMNG02010_DETAIL').reset();
  895. listObj.grid.search();
  896. },
  897. cancel: function () {
  898. listObj.grid.search();
  899. }
  900. },
  901. load: function(param) {
  902. console.log("=================================");
  903. console.log(param);
  904. console.log("=================================");
  905. fn_ajax_call(API_DETAIL_INFO, param, this.callback, 'GET');
  906. },
  907. callback: function (result) {
  908. console.log(result);
  909. pageObj.switchScreen('MODIFY');
  910. $('#ITP_FORM_POMNG02010_DETAIL #ITP_FORM_POMNG02010_DETAIL_VIEW_CD').val('U');
  911. $('#ITP_FORM_POMNG02010_DETAIL #ITP_FORM_POMNG02010_DETAIL_PCH_REQ_UNQ_NO').val(result.pchReqUnqNo);
  912. $('#ITP_FORM_POMNG02010_DETAIL #ITP_FORM_POMNG02010_DETAIL_BRAND_ID').val(result.brandId);
  913. $('#ITP_FORM_POMNG02010_DETAIL .fnBrandNm').text(result.brandNm);
  914. $('#ITP_FORM_POMNG02010_DETAIL #ITP_FORM_POMNG02010_DETAIL_STORE_ID').val(result.storeId);
  915. $('#ITP_FORM_POMNG02010_DETAIL #ITP_FORM_POMNG02010_DETAIL_LOAN_DVSN').val(result.loanDvsn);
  916. $('#ITP_FORM_POMNG02010_DETAIL #ITP_FORM_POMNG02010_DETAIL_LOAN_MGNT_UNQ_NO').val(result.loanMgntUnqNo);
  917. $('#ITP_FORM_POMNG02010_DETAIL #ITP_FORM_POMNG02010_DETAIL_PCH_REQ_DVSN').val(result.pchReqDvsn);
  918. $('#ITP_FORM_POMNG02010_DETAIL #ITP_FORM_POMNG02010_DETAIL_PCH_REQ_ST_CD').val(result.pchReqStCd);
  919. $('#ITP_FORM_POMNG02010_DETAIL .fnPchReqUnqNo').text(result.pchReqUnqNo);
  920. $('#ITP_FORM_POMNG02010_DETAIL #ITP_FORM_POMNG02010_DETAIL_PCH_REQ_NM').val(result.pchReqNm);
  921. $('#ITP_FORM_POMNG02010_DETAIL .fnPchReqDept').text(result.pchReqDePt);
  922. $('#ITP_FORM_POMNG02010_DETAIL .fnPchReqMgrNm').text(result.pchReqMgrNm);
  923. $('#ITP_FORM_POMNG02010_DETAIL #ITP_FORM_POMNG02010_DETAIL_PCH_REQ_MGR_ID').val(result.pchReqMgrId);
  924. $('#ITP_FORM_POMNG02010_DETAIL .fnPchReqTotalAmt').text(itp_fn_number_comma(result.pchReqTotalAmt));
  925. $('#ITP_FORM_POMNG02010_DETAIL #ITP_FORM_POMNG02010_DETAIL_DLV_REQ_DT').val(result.dlvReqDt);
  926. $('#ITP_FORM_POMNG02010_DETAIL #ITP_FORM_POMNG02010_DETAIL_WHS_ID').val(result.whsId);
  927. $('#ITP_FORM_POMNG02010_DETAIL #ITP_FORM_POMNG02010_DETAIL_WHS_NM').val(result.whsNm);
  928. $('#ITP_FORM_POMNG02010_DETAIL #ITP_FORM_POMNG02010_DETAIL_LOCATION').val(result.location);
  929. $('#ITP_FORM_POMNG02010_DETAIL #ITP_FORM_POMNG02010_DETAIL_LOCATION_NM').val(result.locationNm);
  930. $('#ITP_FORM_POMNG02010_DETAIL .fnLoanDvsnNm').text(result.loanDvsnNm);
  931. $('#ITP_FORM_POMNG02010_DETAIL .fnPchActAmt').text(itp_fn_number_comma(result.ordUseAmt));
  932. $('#ITP_FORM_POMNG02010_DETAIL #ITP_FORM_POMNG02010_DETAIL_NOTE').val(result.note);
  933. $('#ITP_FORM_POMNG02010_DETAIL #ITP_FORM_POMNG02010_DETAIL_MALL_ID').val(result.mallId);
  934. // 품목 리스트 조회
  935. pageObj.grid.init('DETAIL', result.pchReqDtlList);
  936. // modifyObj.grid.load(result.spplyMgrList);
  937. },
  938. };