ITP_ORDMNG01010.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. require(['config'], function() {
  2. require([
  3. ], function($) {
  4. pageObj.init();
  5. });
  6. });
  7. // 화면변수
  8. const ORDMNG01010_GRID_ID = '#ITP_ORDMNG01010_jqGrid';
  9. const ORDMNG01010_GRID_LIST = '#ITP_ORDMNG01010_jqGrid_list';
  10. const ORDMNG01010_GRID_PAGER = '#ITP_ORDMNG01010_jqGridPager';
  11. const ORDMNG01010_GRID_EMPTY = '#ITP_ORDMNG01010_jqGridEmpty';
  12. const ORDMNG01010_VIEW_GRID_ID = '#ITP_ORDMNG01010_VIEW_jqGrid';
  13. const ORDMNG01010_VIEW_GRID_LIST = '#ITP_ORDMNG01010_VIEW_jqGrid_list';
  14. const ORDMNG01010_VIEW_GRID_PAGER = '#ITP_ORDMNG01010_VIEW_jqGridPager';
  15. const ORDMNG01010_VIEW_GRID_EMPTY = '#ITP_ORDMNG01010_VIEW_jqGridEmpty';
  16. let ITP_COMMON_PCH_ODR_ST_CD = fn_make_common_cd_list(CODE_LIST, 'PCH_ODR_ST_CD', true, '발주상태코드');
  17. // 그리드 전화번호 '-' 함수
  18. function convertTel(value){
  19. answer = (value.startsWith('0')) ? value.replace(/[^0-9]/g, "")
  20. .replace(/(^02|^0505|^1[0-9]{3}|^0[0-9]{2})([0-9]+)?([0-9]{4})$/,"$1-$2-$3")
  21. .replace("--", "-") : '';
  22. return answer;
  23. }
  24. //API URL
  25. let API_POMNG_PO_SPPLY_PO_GRID_LIST = '/api/pomng/po/spply-po-grid-list';
  26. let API_POMNG_PO_INFO_SPPLY_PCHORD = '/api/pomng/po/info-spply-pchOdr';
  27. //화면 grid ColModel
  28. const gridColModel = {
  29. list:[
  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: 'BRAND_ID', name: 'brandId',
  38. label: ITP_MSG_LOCALE.label.brandId,
  39. width: '10', fixed: false, align: 'center',
  40. sortable: false, hidden: true
  41. },
  42. {
  43. index: 'PODR_MGR_NM', name: 'podrMgrNm',
  44. label: ITP_MSG_LOCALE.label.podrMgrNm,
  45. width: '10', fixed: false, align: 'center',
  46. sortable: false, hidden: true
  47. },
  48. {
  49. index: 'BRAND_NM', name: 'brandNm',
  50. label: ITP_MSG_LOCALE.label.brandNm, // 브랜드명
  51. width: '7', fixed: false, align: 'center',
  52. sortable: false, hidden: false
  53. },
  54. {
  55. index: 'PCH_PODR_UNQ_NO', name: 'pchPodrUnqNo',
  56. label: ITP_MSG_LOCALE.label.pchPodrUnqNo, // 발주번호
  57. width: '7', fixed: false, align: 'center',
  58. sortable: false, hidden: false
  59. },
  60. {
  61. index: 'PCH_ORD_ST_CD', name: 'pchOdrStCd',
  62. label: ITP_MSG_LOCALE.label.pchOdrStNm, // 발주상태
  63. width: '7', fixed: false, align: 'center',
  64. sortable: false, formatter: 'select',
  65. editoptions: {value: ITP_COMMON_PCH_ODR_ST_CD}
  66. },
  67. {
  68. index: 'PODR_DT', name: 'podrDt',
  69. label: ITP_MSG_LOCALE.label.podrDt, // 발주일자
  70. width: '8', fixed: false, align: 'center',
  71. sortable: false, hidden: false
  72. },
  73. {
  74. index: 'DIV_REQ_DT', name: 'dlvReqDt',
  75. label: ITP_MSG_LOCALE.label.dlvReqDt, // 납품요청일
  76. width: '8', fixed: false, align: 'center',
  77. sortable: false, hidden: false
  78. },
  79. {
  80. index: 'WHS_NM', name: 'whsNm',
  81. label: ITP_MSG_LOCALE.label.whsNm, // 납품장소
  82. width: '7', fixed: false, align: 'center',
  83. sortable: false, hidden: false
  84. },
  85. {
  86. index: 'PODR_TOTAL_AMT', name: 'podrTotalAmt',
  87. label: ITP_MSG_LOCALE.label.podrTotalAmt, // 총 발주금액
  88. width: '7', fixed: false, align: 'center',
  89. sortable: false, hidden: false,
  90. formatter: 'integer', formatoptions: {thousandsSeparator: ','}
  91. },
  92. {
  93. index: 'SPPLY_ITME_ID', name: 'podrItemQty',
  94. label: ITP_MSG_LOCALE.label.podrItemQty, // 발주품목수
  95. width: '8', fixed: false, align: 'center',
  96. sortable: false, hidden: false
  97. },
  98. {
  99. index: 'PODR_MGR_NM', name: 'podrMgrNm',
  100. label: ITP_MSG_LOCALE.label.podrMgrNm, // 발주 담당자
  101. width: '8', fixed: false, align: 'center',
  102. sortable: false, hidden: false
  103. }
  104. ],
  105. view: [
  106. {
  107. index: 'PCH_PODR_DTL_NO', name: 'pchPodrDtlNo',
  108. label: ITP_MSG_LOCALE.label.pchPodrDtlNo, // 항번
  109. width: '10', fixed: false, align: 'center',
  110. sortable: false, hidden: false
  111. },
  112. {
  113. index: 'ITEM_ID', name: 'itemId',
  114. label: ITP_MSG_LOCALE.label.itemId, // 품목번호
  115. width: '10', fixed: false, align: 'center',
  116. sortable: false, hidden: false
  117. },
  118. {
  119. index: 'ITEM_NM', name: 'itemNm',
  120. label: ITP_MSG_LOCALE.label.itemNm, // 품목명
  121. width: '8', fixed: false, align: 'center',
  122. sortable: false, hidden: false
  123. },
  124. {
  125. index: 'UNIT_AMT', name: 'unitAmt',
  126. label: ITP_MSG_LOCALE.label.unitAmt, // 단가
  127. width: '8', fixed: false, align: 'center',
  128. sortable: false, hidden: false,
  129. formatter: 'integer', formatoptions: {thousandsSeparator: ','}
  130. },
  131. {
  132. index: 'UNIT', name: 'unit',
  133. label: ITP_MSG_LOCALE.label.unit, // 기본단위
  134. width: '8', fixed: false, align: 'center',
  135. sortable: false, hidden: false
  136. },
  137. {
  138. index: 'PODR_QTY', name: 'podrQty',
  139. label: ITP_MSG_LOCALE.label.podrQty, // 발주수량
  140. width: '8', fixed: false, align: 'center',
  141. sortable: false, hidden: false
  142. },
  143. {
  144. index: 'PODR_AMT', name: 'podrAmt',
  145. label: ITP_MSG_LOCALE.label.podrAmt, // 발주금액
  146. width: '8', fixed: false, align: 'center',
  147. sortable: false, hidden: false,
  148. formatter: 'integer', formatoptions: {thousandsSeparator: ','}
  149. }
  150. ],
  151. detail: []
  152. };
  153. /*화면공통 Object*/
  154. let pageObj = {
  155. init: function() {
  156. this.ui.init();
  157. this.event.init();
  158. },
  159. ui: {
  160. init: function() {
  161. this.view();
  162. this.grid();
  163. this.ready();
  164. },
  165. view: function() {
  166. // 버튼 권한설정
  167. fn_proc_btn_auth('ORDMNG01010');
  168. // 공통코드 표시
  169. $('select').each(function() {
  170. if($(this).data('select-code')) {
  171. fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
  172. }
  173. });
  174. // 조회일자 지정
  175. var now = new Date();
  176. var defaultToDate = new Date(now);
  177. console.log(now.getDate());
  178. $('#ITP_TAB_ORDMNG01010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
  179. $('#ITP_FORM_ORDMNG01010_SEARCH_FROM_DT').datepicker('setDate', now);
  180. $('#ITP_FORM_ORDMNG01010_SEARCH_TO_DT').datepicker('setDate', defaultToDate.setDate(now.getDate() + 7));
  181. },
  182. grid: function() {
  183. itp_fn_jqgrid_resize(ORDMNG01010_GRID_ID, ORDMNG01010_GRID_LIST, 'lg');
  184. listObj.empty.init();
  185. itp_fn_fire_window_resize();
  186. },
  187. ready: function() {
  188. listObj.init();
  189. }
  190. },
  191. event: {
  192. init: function() {
  193. this.button();
  194. },
  195. button: function() {
  196. // 버튼 클릭 이벤트
  197. $('button').each(function() {
  198. var id = $(this).attr('id');
  199. $(this).on('click', function() {
  200. switch (id) {
  201. case 'ITP_BTN_ORDMNG01010_SRH' : listObj.button.search(); break; // 조회 버튼 클릭
  202. case 'ITP_BTN_ORDMNG01010_NEWREG' : listObj.button.create(); break; // 신규등록 버튼
  203. case 'ITP_BTN_ORDMNG01010_MODIFY' : modifyObj.button.modify(); break; // 수정 버튼
  204. case 'ITP_BTN_ORDMNG01010_CANCELLIST' : viewObj.button.cancel(); break; // 취소/목록 버튼
  205. case 'ITP_BTN_ORDMNG01010_DELETE' : break; // 삭제 버튼
  206. case 'ITP_BTN_ORDMNG01010_SAVE' : createObj.button.save(); break; // 저장 버튼
  207. case 'ITP_FORM_ORDMNG01010_VIEW_DUP' : createObj.button.duplicate(); break; // 중복체크
  208. case 'ITP_BTN_ORDMNG01010_RESET_PW' : createObj.button.resetPass(); break; // 상세:비밀번호 초기화
  209. case 'ITP_BTN_ORDMNG01010_VIEW_ADDROW' : pageObj.grid.button.addRow(); break; // 상세:추가버튼
  210. case 'ITP_BTN_ORDMNG01010_VIEW_DELROW' : pageObj.grid.button.delRow(); break; // 상세:삭제버튼
  211. }
  212. });
  213. });
  214. }
  215. },
  216. switchScreen: function(mode) {
  217. $('.itp_det_head').find('button[id^="ITP_BTN_ORDMNG01010_"]').each(function(i) {
  218. $(this).hide();
  219. });
  220. $('#ITP_TAB_ORDMNG01010').find('div[id$="_CONTAINER"]').each(function(i) {
  221. $(this).hide();
  222. });
  223. if(mode == 'LIST') { // 목록
  224. fn_show_btn_auth_array(['#ITP_BTN_ORDMNG01010_SRH', '#ITP_BTN_ORDMNG01010_NEWREG']);
  225. $('#ITP_AJAX_ORDMNG01010_LIST_CONTAINER').show();
  226. $('#ITP_FORM_ORDMNG01010_SEARCH #ITP_FORM_ORDMNG01010_SEARCH_BRAND_ID').val(fn_make_user_info.get('brandId'));
  227. $('#ITP_BTN_ORDMNG01010_SEARCH_WHS_NM').show();
  228. $('#ITP_BTN_ORDMNG01010_DELETE_WHS_NM').show();
  229. } else if(mode == 'ADD') { // 등록
  230. $('#ITP_AJAX_ORDMNG01010_DETAIL_CONTAINER').show();
  231. fn_show_btn_auth_array(['#ITP_BTN_ORDMNG01010_CANCELLIST', '#ITP_BTN_ORDMNG01010_SAVE']);
  232. $('#ITP_FORM_ORDMNG01010_DETAIL').find('input, textarea, select, checkbox').each(function(i, elem) {
  233. $(this).attr('id') === 'ITP_FORM_ORDMNG01010_DETAIL_VIEW_CD' ? $(this).val('C') : $(this).val('');
  234. if(elem.type === 'select') {
  235. $(this).val('').prop('selected', true);
  236. }
  237. });
  238. $('#ITP_FORM_ORDMNG01010_DETAIL #ITP_FORM_ORDMNG01010_DETAIL_FILE_NO').val('');
  239. $('#ITP_FORM_ORDMNG01010_DETAIL_BRAND_ID').removeAttr('readonly');
  240. $('#ITP_FORM_ORDMNG01010_DETAIL_BRAND_NM').removeAttr('readonly');
  241. $('#ITP_FORM_ORDMNG01010_DETAIL_BSNS_REG_NO').removeAttr('readonly');
  242. $('#ITP_FORM_ORDMNG01010_DETAIL_CORP_REG_NO').removeAttr('readonly');
  243. // $('#ITP_FORM_ORDMNG01010_DETAIL_SEARCH_AFFL_SHOP').removeAttr('disabled');
  244. // $('#ITP_FORM_ORDMNG01010_DETAIL_DELETE_AFFL_SHOP').removeAttr('disabled');
  245. $('#ITP_FORM_ORDMNG01010_DETAIL_SEARCH_AFFL_SHOP').show();
  246. $('#ITP_FORM_ORDMNG01010_DETAIL_DELETE_AFFL_SHOP').show();
  247. $('#ITP_FORM_ORDMNG01010_DETAIL .itp_form_info').hide();
  248. $('#ITP_FORM_ORDMNG01010_DETAIL .itp_form_change').show();
  249. $('#ITP_FORM_ORDMNG01010_DETAIL #ITP_FORM_ORDMNG01010_DETAIL_AFFL_SHOP_ID').val(fn_make_user_info.get('afflShopId'));
  250. $('#ITP_FORM_ORDMNG01010_DETAIL #ITP_FORM_ORDMNG01010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
  251. $('.fnBrandId').text('(자동부여)');
  252. } else if(mode == 'MODIFY') { // 수정
  253. $('#ITP_AJAX_ORDMNG01010_DETAIL_CONTAINER').show();
  254. fn_show_btn_auth_array(['#ITP_BTN_ORDMNG01010_CANCELLIST', '#ITP_BTN_ORDMNG01010_SAVE']);
  255. $('#ITP_FORM_ORDMNG01010_DETAIL_BRAND_ID').attr('readonly', true);
  256. $('#ITP_FORM_ORDMNG01010_DETAIL_BRAND_NM').attr('readonly', true);
  257. $('#ITP_FORM_ORDMNG01010_DETAIL_BSNS_REG_NO').attr('readonly', true);
  258. $('#ITP_FORM_ORDMNG01010_DETAIL_CORP_REG_NO').attr('readonly', true);
  259. // $('#ITP_FORM_ORDMNG01010_DETAIL_SEARCH_AFFL_SHOP').attr('disabled', true);
  260. // $('#ITP_FORM_ORDMNG01010_DETAIL_DELETE_AFFL_SHOP').attr('disabled', true);
  261. $('#ITP_FORM_ORDMNG01010_DETAIL_SEARCH_AFFL_SHOP').hide();
  262. $('#ITP_FORM_ORDMNG01010_DETAIL_DELETE_AFFL_SHOP').hide();
  263. $('#ITP_FORM_ORDMNG01010_DETAIL .itp_form_info').show();
  264. $('#ITP_FORM_ORDMNG01010_DETAIL .itp_form_change').hide();
  265. $('#ITP_FORM_ORDMNG01010_DETAIL #ITP_FORM_ORDMNG01010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
  266. } else if(mode == 'VIEW') { // 보기
  267. $('#ITP_AJAX_ORDMNG01010_VIEW_CONTAINER').show();
  268. fn_show_btn_auth_array(['#ITP_BTN_ORDMNG01010_MODIFY', '#ITP_BTN_ORDMNG01010_CANCELLIST']);
  269. }
  270. }
  271. };
  272. /*목록화면 Object*/
  273. let listObj = {
  274. init: function() {
  275. this.grid.init();
  276. this.action();
  277. },
  278. itp_ORDMNG01010_param: {},
  279. itp_ORDMNG01010_search: false,
  280. button: {
  281. search: function() {
  282. listObj.itp_ORDMNG01010_search = true;
  283. let param = $('#ITP_FORM_ORDMNG01010_SEARCH').serializeObject();
  284. param.gridSize = $.jgrid.defaults.rowNum;
  285. param.gridPage = $.jgrid.defaults.page;
  286. param.sspplyId = LOGIN_USER_INFO.spplyId;
  287. param.sidx = '0';
  288. console.log(JSON.stringify(param));
  289. $(ORDMNG01010_GRID_ID).setGridParam({'postData': JSON.stringify(param)}).trigger('reloadGrid');
  290. }
  291. },
  292. empty: {
  293. init: function() {
  294. var _this = this;
  295. this.push();
  296. $(ORDMNG01010_GRID_EMPTY).on('click', function() {
  297. _this.back();
  298. listObj.itp_ORDMNG01010_param.gridSize = $.jgrid.defaults.rowNum;
  299. $(ORDMNG01010_GRID_ID).setGridParam({'postData': JSON.stringify(listObj.itp_ORDMNG01010_param)}).trigger('reloadGrid');
  300. });
  301. },
  302. push: function() {
  303. let param = $('#ITP_FORM_ORDMNG01010_SEARCH').serializeObject();
  304. listObj.itp_ORDMNG01010_param = param;
  305. listObj.itp_ORDMNG01010_param.sbrandId = LOGIN_USER_INFO.brandId;
  306. listObj.itp_ORDMNG01010_param.sspplyId = LOGIN_USER_INFO.spplyId;
  307. listObj.itp_ORDMNG01010_param.sidx = '0';
  308. },
  309. back: function() {
  310. $('#ITP_FORM_ORDMNG01010_SERVICE_BRAND_TYPE').val(listObj.itp_ORDMNG01010_param.brandType);
  311. $('#ITP_FORM_ORDMNG01010_SERVICE_ST_CD').val(listObj.itp_ORDMNG01010_param.stCd);
  312. $('#ITP_FORM_ORDMNG01010_SEARCH_BRAND_NM').val(listObj.itp_ORDMNG01010_param.brandNm);
  313. console.log('here');
  314. console.log(listObj.itp_ORDMNG01010_param);
  315. }
  316. },
  317. grid: {
  318. init: function() {
  319. // 데이터 없을때
  320. listObj.empty.push();
  321. this.search();
  322. },
  323. colModel: gridColModel.list,
  324. search: function() {
  325. pageObj.switchScreen('LIST');
  326. this.unload();
  327. this.load();
  328. },
  329. load: function() {
  330. let param = $('#ITP_FORM_ORDMNG01010_SEARCH').serializeObject();
  331. param.gridSize = $.jgrid.defaults.rowNum;
  332. param.sspplyId = LOGIN_USER_INFO.spplyId;
  333. param.sidx = '0';
  334. console.log(JSON.stringify(param));
  335. var option = {
  336. gridId: ORDMNG01010_GRID_ID,
  337. colModel: gridColModel.list,
  338. param: param,
  339. url: DOMAIN + API_POMNG_PO_SPPLY_PO_GRID_LIST,
  340. pager: ORDMNG01010_GRID_PAGER,
  341. onCellSelect: function(rowId, cellIdx, cellValue) {
  342. var cm = $(this).jqGrid('getGridParam', 'colModel');
  343. var colNm = cm[cellIdx].name;
  344. if (colNm === 'pchPodrUnqNo') {
  345. const pchPodrUnqNoVal = $(this).jqGrid('getCell', rowId, 'pchPodrUnqNo');
  346. const brandIdVal = $(this).jqGrid('getCell', rowId, 'brandId');
  347. const spplyIdVal = LOGIN_USER_INFO.spplyId;
  348. const key = {pchPodrUnqNo: pchPodrUnqNoVal, brandId: brandIdVal, spplyId: spplyIdVal};
  349. var param = $.param(key);
  350. viewObj.init(param);
  351. }
  352. },
  353. loadComplete: function(data) {
  354. console.log(data);
  355. itp_fn_grid_load_complete(data, ORDMNG01010_GRID_ID, true, 'number', 'ORDMNG01010', listObj.itp_ORDMNG01010_search, listObj.empty, true, data.gridRecords, true);
  356. var ids = $(ORDMNG01010_GRID_ID).getDataIDs();
  357. $.each(ids, function(idx, rowId) {
  358. $(ORDMNG01010_GRID_ID).jqGrid('setCell', rowId, 'pchPodrUnqNo', '', ITP_GRID_COL_STYLE.link);
  359. });
  360. },
  361. onPaging: function(action) {
  362. itp_fn_grid_paging(ORDMNG01010_GRID_ID, action, param);
  363. }
  364. };
  365. itp_fn_grid_make_remote(option);
  366. },
  367. clearData: function() {
  368. $(ORDMNG01010_GRID_ID).jqGrid('clearGridData', true);
  369. $(ORDMNG01010_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
  370. $(ORDMNG01010_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
  371. $(ORDMNG01010_GRID_EMPTY).show();
  372. },
  373. unload: function() {
  374. $.jgrid.gridUnload(ORDMNG01010_GRID_ID);
  375. }
  376. },
  377. action: function() {
  378. var _this = this;
  379. // 납품장소 조회 버튼 클릭
  380. $('#ITP_BTN_ORDMNG01010_SEARCH_WHS_NM').on('click', function() {
  381. _this.popup();
  382. });
  383. // 납품장소 텍스트 삭제 버튼 클릭
  384. $('#ITP_BTN_ORDMNG01010_DELETE_WHS_NM').on('click', function() {
  385. $('#ITP_FORM_ORDMNG01010_DETAIL_WHS_NM').val('');
  386. $('#ITP_FORM_ORDMNG01010_DETAIL_WHS_ID').val('');
  387. });
  388. },
  389. popup: function() {
  390. // 팝업
  391. var popFn = this.callback.create;
  392. const key = {brandId:fn_make_user_info.get('brandId'),storeId:fn_make_user_info.get('storeId')};
  393. fn_call_popup('biz', 'BIZPOP_WHS_LOCATION', '#ITP_ASIDE', popFn, key, 'S');
  394. },
  395. callback: {
  396. create: function(rowDataPop) {
  397. if(rowDataPop) {
  398. $('#ITP_FORM_ORDMNG01010_DETAIL_WHS_NM').val(rowDataPop.whsNm);
  399. $('#ITP_FORM_ORDMNG01010_DETAIL_WHS_ID').val(rowDataPop.whsId);
  400. }
  401. }
  402. }
  403. };
  404. /*상세화면 Object*/
  405. let viewObj = {
  406. init: function(param) {
  407. this.load(param);
  408. },
  409. itp_ORDMNG01010_param: {},
  410. itp_ORDMNG01010_search: false,
  411. button: {
  412. cancel: function() {
  413. listObj.grid.search();
  414. }
  415. },
  416. empty: {
  417. init: function() {
  418. var _this = this;
  419. this.push();
  420. $(ORDMNG01010_VIEW_GRID_EMPTY).on('click', function() {
  421. _this.back();
  422. viewObj.itp_ORDMNG01010_param.gridSize = $.jgrid.defaults.rowNum;
  423. $(ORDMNG01010_GRID_ID).setGridParam({'postData': JSON.stringify(viewObj.itp_ORDMNG01010_param)}).trigger('reloadGrid');
  424. });
  425. },
  426. push: function() {
  427. let param = $('#ITP_FORM_ORDMNG01010_VIEW').serializeObject();
  428. viewObj.itp_ORDMNG01010_param = param;
  429. },
  430. back: function() {
  431. $('#ITP_FORM_ORDMNG01010_SERVICE_BRAND_TYPE').val(viewObj.itp_ORDMNG01010_param.brandType);
  432. $('#ITP_FORM_ORDMNG01010_SERVICE_ST_CD').val(viewObj.itp_ORDMNG01010_param.stCd);
  433. $('#ITP_FORM_ORDMNG01010_SEARCH_BRAND_NM').val(viewObj.itp_ORDMNG01010_param.brandNm);
  434. }
  435. },
  436. load: function(param) {
  437. fn_ajax_call(API_POMNG_PO_INFO_SPPLY_PCHORD, param, this.callback, 'GET');
  438. },
  439. callback: function(result) {
  440. console.log(result);
  441. let telNo = convertTel(result.podrMgrTelNo);
  442. pageObj.switchScreen('VIEW');
  443. $('#ITP_FORM_ORDMNG01010_VIEW #ITP_FORM_ORDMNG01010_VIEW_AFFL_SHOP_ID').val(result.afflShopId);
  444. $('#ITP_FORM_ORDMNG01010_VIEW .fnBrandNm').text(result.brandNm); // 브랜드명
  445. $('#ITP_FORM_ORDMNG01010_VIEW .fnPchPodrUnqNo').text(result.pchPodrUnqNo);
  446. $('#ITP_FORM_ORDMNG01010_VIEW .fnPodrDt').text(result.podrDt);
  447. $('#ITP_FORM_ORDMNG01010_VIEW .fnPchOdrStCd').text(result.pchOdrStNm);
  448. $('#ITP_FORM_ORDMNG01010_VIEW .fnPodrTotalAmt').text(result.podrTotalAmt.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','));
  449. $('#ITP_FORM_ORDMNG01010_VIEW .fnPodrMgrNm').text(result.podrMgrNm + ' (' + telNo + ')');
  450. $('#ITP_FORM_ORDMNG01010_VIEW .fnDlvReqDt').text(result.dlvReqDt);
  451. viewObj.grid.init('VIEW', result.pchOdrDtlList)
  452. },
  453. grid: {
  454. init: function(mode, gridData) {
  455. this.mode = mode;
  456. this.gridId = (mode === 'VIEW') ? ORDMNG01010_VIEW_GRID_ID : ORDMNG01010_DETAIL_GRID_ID;
  457. this.gridList = (mode === 'VIEW') ? ORDMNG01010_VIEW_GRID_LIST : ORDMNG01010_DETAIL_GRID_LIST;
  458. this.gridEmpty = (mode === 'VIEW') ? ORDMNG01010_VIEW_GRID_EMPTY : ORDMNG01010_DETAIL_GRID_EMPTY;
  459. this.unload();
  460. this.load(mode, gridData);
  461. },
  462. mode: '',
  463. colModel: gridColModel.view,
  464. load: function(mode, gridData) {
  465. var _this = this;
  466. var option = {
  467. gridId: _this.gridId,
  468. colModel: gridColModel.view,
  469. data: gridData,
  470. multiselect: true,
  471. loadComplete: function(data) {
  472. console.log(data);
  473. itp_fn_grid_load_complete(data, ORDMNG01010_VIEW_GRID_ID, true, 'number', 'ORDMNG01010', viewObj.itp_ORDMNG01010_search, viewObj.empty, true, data.gridRecords, true);
  474. }
  475. };
  476. itp_fn_grid_make_local(option);
  477. },
  478. unload: function() {
  479. $.jgrid.gridUnload(this.gridId);
  480. }
  481. }
  482. };