ITP_LOANMNG01010.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. /********************************************************
  2. --------------------------------------------------------
  3. - Object 목록 -
  4. --------------------------------------------------------
  5. * const gridColModel = {} : 화면 Grid Object *
  6. * let pageObj = {} : 화면공통 Object *
  7. * let listObj = {} : 목록화면 Object *
  8. * let viewObj = {} : 상세화면 Object *
  9. * let modifyObj = {} : 수정화면 Object *
  10. * let locInfoObj = {} : 로케이션정보 Object *
  11. *******************************************************/
  12. //[grid]
  13. /*화면 변수*/
  14. const LOANMNG01010_GRID_ID = '#ITP_LOANMNG01010_jqGrid';
  15. const LOANMNG01010_GRID_LIST = '#ITP_LOANMNG01010_jqGrid_list';
  16. const LOANMNG01010_GRID_PAGER = '#ITP_LOANMNG01010_jqGridPager';
  17. const LOANMNG01010_GRID_EMPTY = '#ITP_LOANMNG01010_jqGridEmpty';
  18. const LOANMNG01010_VIEW_GRID_ID = '#ITP_LOANMNG01010_VIEW_jqGrid';
  19. const LOANMNG01010_VIEW_GRID_LIST = '#ITP_LOANMNG01010_VIEW_jqGrid_list';
  20. const LOANMNG01010_VIEW_GRID_PAGER = '#ITP_LOANMNG01010_VIEW_jqGridPager';
  21. const LOANMNG01010_VIEW_GRID_EMPTY = '#ITP_LOANMNG01010_VIEW_jqGridEmpty';
  22. let ITP_FORM_LOANMNG01010_DETAIL_IS_DUPLICATE = false;
  23. let ITP_FORM_LOANMNG01010_DETAIL_IS_WRITING = false;
  24. let LOANMNG01010_DETAIL_GRID_LAST_ROW_ID;
  25. /*API URL*/
  26. let LOAN_STATE_DETAIL_GRID_LIST = '/api/loan/state/detail-grid-list';
  27. let LOAN_STATE_INFO_LOAN_MNG = '/api/loan/state/info-loan-mng';
  28. let LOAN_STATE_HIST_GRID_LIST = '/api/loan/state/hist-grid-list';
  29. /* 로그인 권한타입 */
  30. let LOGIN_AUTH_TYPE_CD;
  31. /*화면 Grid ColModel*/
  32. const gridColModel = {
  33. list: [
  34. {
  35. index: 'BRAND_ID', name: 'brandId',
  36. label: "브랜드ID",
  37. width: '0', fixed: false, align: 'center',
  38. sortable: false, hidden: true
  39. },
  40. {
  41. index: 'STORE_ID', name: 'storeId',
  42. label: "매장ID",
  43. width: '0', fixed: false, align: 'center',
  44. sortable: false, hidden: true
  45. },
  46. {
  47. index: 'BRAND_NM', name: 'brandNm',
  48. label: ITP_MSG_LOCALE.label.brandNm, //브랜드
  49. width: '13', fixed: false, align: 'center',
  50. sortable: false, hidden: true
  51. },
  52. {
  53. index: 'STORE_NM', name: 'storeNm',
  54. label: "매장명",
  55. width: '13', fixed: false, align: 'left',
  56. minwidth: 190,
  57. sortable: false, hidden: false, classes: 'ui-ellipsis'
  58. },
  59. {
  60. index: 'LOAN_MGNT_UNQ_NO', name: 'loanMgntUnqNo',
  61. label: "여신관리번호",
  62. minwidth: 190,
  63. width: '10', fixed: false, align: 'center',
  64. sortable: false, hidden: false
  65. },
  66. {
  67. index: 'LOAN_DVSN_NM', name: 'loanDvsnNm',
  68. label: "정산타입",
  69. width: '7', fixed: false, align: 'center',
  70. sortable: false, hidden: false
  71. },
  72. {
  73. index: 'LIMIT_AMT', name: 'limitAmt',
  74. label: "한도금액",
  75. width: '9', fixed: false, align: 'right',
  76. sortable: false, hidden: false,
  77. formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
  78. },
  79. {
  80. index: 'ACCT_BAL', name: 'acctBal',
  81. label: "잔액",
  82. width: '9', fixed: false, align: 'right',
  83. sortable: false, hidden: false,
  84. formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
  85. },
  86. {
  87. index: 'POSB_LIMIT_AMT', name: 'posbLimitAmt',
  88. label: "사용가능금액",
  89. width: '9', fixed: false, align: 'right',
  90. sortable: false, hidden: false,
  91. formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
  92. },
  93. {
  94. index: 'USE_AMT_TOTAL', name: 'useAmtTotal',
  95. label: '사용한금액',
  96. width: '9', fixed: false, align: 'right',
  97. sortable: false, hidden: false,
  98. formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
  99. },
  100. {
  101. index: 'USE_YN_NM', name: 'useYnNm',
  102. label: "사용여부",
  103. width: '8', fixed: false, align: 'center',
  104. sortable: false, hidden: false
  105. },
  106. {
  107. index: 'SYS_CHG_NM', name: 'sysChgNm',
  108. label: "최종수정자",
  109. width: '10', fixed: false, align: 'center',
  110. sortable: false, hidden: false, classes: 'ui-ellipsis'
  111. }
  112. ],
  113. view: [
  114. {
  115. index: 'VIEW_CD', name: 'viewCd',
  116. label: ITP_MSG_LOCALE.label.viewCd,
  117. width: '10', fixed: false, align: 'center',
  118. sortable: false, hidden: true
  119. },
  120. {
  121. index: 'LOAN_REG_DTM', name: 'loanRegDtm',
  122. label: "거래일자",
  123. width: '10', fixed: false, align: 'center',
  124. sortable: false, editable: false, edittype: 'text'
  125. },
  126. {
  127. index: 'DPST_PAY_DVSN_NM', name: 'dpstPayDvsnNm',
  128. label: "입지구분",
  129. width: '10', fixed: false, align: 'center',
  130. sortable: false, editable: false, edittype: 'text'
  131. },
  132. {
  133. index: 'MEDIA_DVSN_NM', name: 'mediaDvsnNm',
  134. label: "매체구분",
  135. width: '10', fixed: false, align: 'center',
  136. sortable: false, editable: false, edittype: 'text'
  137. },
  138. {
  139. index: 'DPST_AMT', name: 'dpstAmt',
  140. label: "입금",
  141. width: '10', fixed: false, align: 'right',
  142. sortable: false, editable: false, edittype: 'text',
  143. formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
  144. },
  145. {
  146. index: 'PAYM_AMT', name: 'paymAmt',
  147. label: "지급",
  148. width: '10', fixed: false, align: 'right',
  149. sortable: false, editable: false, edittype: 'text',
  150. formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
  151. },
  152. {
  153. index: 'TRSC_AF_BAL', name: 'trscAfBal',
  154. label: "잔액",
  155. width: '10', fixed: false, align: 'right',
  156. sortable: false, editable: false, edittype: 'text',
  157. formatter:'integer',formatoptions: { defaultValue: '', thousandsSeparator: ',' }
  158. },
  159. {
  160. index: 'USER', name: 'user',
  161. label: "사용자",
  162. width: '10', fixed: false, align: 'center',
  163. sortable: false, editable: false, edittype: 'text'
  164. },
  165. {
  166. index: 'NO', name: 'no',
  167. label: "관련번호",
  168. width: '10', fixed: false, align: 'center',
  169. sortable: false, editable: false, edittype: 'text'
  170. }
  171. ]
  172. };
  173. require(['config'], function() {
  174. require([
  175. ], function($) {
  176. pageObj.init();
  177. });
  178. });
  179. /*화면공통 Object*/
  180. let pageObj = {
  181. init: function () {
  182. this.ui.init();
  183. this.event.init();
  184. },
  185. ui: {
  186. init: function () {
  187. this.view();
  188. this.grid();
  189. this.ready();
  190. },
  191. view: function() {
  192. // 버튼 권한설정
  193. fn_proc_btn_auth('LOANMNG01010');
  194. // 공통코드 표시
  195. $('select').each(function() {
  196. if($(this).data('select-code')) {
  197. fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
  198. }
  199. });
  200. // 조회일자 지정
  201. var now = new Date();
  202. $('#ITP_FORM_LOANMNG01010_SEARCH_FROM_DT').val(itp_fn_get_before_month() );
  203. $('#ITP_FORM_LOANMNG01010_SEARCH_TO_DT').val(itp_fn_get_today_ko() );
  204. $('#ITP_TAB_LOANMNG01010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
  205. $('#ITP_FORM_LOANMNG01010_SEARCH_FROM_DT').datepicker();
  206. $('#ITP_FORM_LOANMNG01010_SEARCH_TO_DT').datepicker();
  207. // 권한에 따라 매장값 설정
  208. $('#ITP_FORM_LOANMNG01010_SEARCH_BRAND_ID').val(fn_make_user_info.get('brandId'));
  209. LOGIN_AUTH_TYPE_CD = fn_make_user_info.get('authTpCd'); // 권한타입
  210. if(LOGIN_AUTH_TYPE_CD == '50') {
  211. $('#ITP_FORM_LOANMNG01010_SEARCH_STORE_ID').val(fn_make_user_info.get('storeId'));
  212. $('#ITP_FORM_LOANMNG01010_SEARCH_STORE_NM').val(fn_make_user_info.get('storeNm'));
  213. }
  214. },
  215. grid: function() {
  216. listObj.empty.init();
  217. },
  218. ready: function() {
  219. listObj.init();
  220. }
  221. },
  222. event: {
  223. init: function () {
  224. this.button();
  225. },
  226. button: function () {
  227. // 버튼 클릭 이벤트
  228. $('button').each(function() {
  229. var id = $(this).attr('id');
  230. $(this).on('click', function() {
  231. switch (id) {
  232. case 'ITP_BTN_LOANMNG01010_SRH' : listObj.button.search(); break; // 조회 버튼 클릭
  233. case 'ITP_BTN_LOANMNG01010_CANCELLIST' : viewObj.button.cancel(); break; // 취소/목록 버튼
  234. case 'ITP_BTN_LOANMNG01010_VIEW_SEARCH_SRH' : viewObj.button.history(); break; // 이력조회
  235. case 'ITP_BTN_LOANMNG01010_STORE_SEARCH' : listObj.button.popupStore(); break; // 매장선택 팝업
  236. case 'ITP_BTN_LOANMNG01010_STORE_ERASE' : listObj.button.eraseStore(); break; // 매장선택 삭제
  237. case 'ITP_BTN_LOANMNG01010_EXCEL' : listObj.excelDown(); break; // 엑셀다운로드
  238. case 'ITP_BTN_LOANMNG01010_VIEW_EXCEL' : viewObj.histexcelDown(); break; // 이력 엑셀 다운로드
  239. }
  240. });
  241. });
  242. $('body').on('click', function(e) {
  243. });
  244. }
  245. },
  246. switchScreen: function(mode) {
  247. if(mode == 'LIST') { // 목록
  248. $('#ITP_BTN_LOANMNG01010_MODIFY').hide();
  249. $('#ITP_BTN_LOANMNG01010_CANCELLIST').hide();
  250. $('#ITP_BTN_LOANMNG01010_DELETE').hide();
  251. $('#ITP_BTN_LOANMNG01010_SAVE').hide();
  252. if(LOGIN_AUTH_TYPE_CD == '50') {
  253. $('#ITP_BTN_LOANMNG01010_STORE_SEARCH').hide();
  254. $('#ITP_BTN_LOANMNG01010_STORE_ERASE').hide();
  255. } else {
  256. $('#ITP_BTN_LOANMNG01010_STORE_SEARCH').show();
  257. $('#ITP_BTN_LOANMNG01010_STORE_ERASE').show();
  258. }
  259. fn_show_btn_auth('#ITP_BTN_LOANMNG01010_SRH');
  260. $('#ITP_AJAX_LOANMNG01010_LIST_CONTAINER').show();
  261. $('#ITP_AJAX_LOANMNG01010_DETAIL_CONTAINER').hide();
  262. $('#ITP_AJAX_LOANMNG01010_VIEW_CONTAINER').hide();
  263. $('#ITP_BTN_LOANMNG01010_EXCEL').show();
  264. } else if(mode == 'VIEW') { // 보기
  265. $('#ITP_BTN_LOANMNG01010_SRH').hide();
  266. $('#ITP_BTN_LOANMNG01010_DELETE').hide();
  267. $('#ITP_BTN_LOANMNG01010_SAVE').hide();
  268. fn_show_btn_auth('#ITP_BTN_LOANMNG01010_MODIFY');
  269. fn_show_btn_auth('#ITP_BTN_LOANMNG01010_CANCELLIST');
  270. $('#ITP_AJAX_LOANMNG01010_LIST_CONTAINER').hide();
  271. $('#ITP_AJAX_LOANMNG01010_DETAIL_CONTAINER').hide();
  272. $('#ITP_AJAX_LOANMNG01010_VIEW_CONTAINER').show();
  273. $('#ITP_BTN_LOANMNG01010_VIEW_EXCEL').show();
  274. }
  275. }
  276. };
  277. /*목록화면 Object*/
  278. let listObj = {
  279. init: function () {
  280. this.grid.init();
  281. },
  282. itp_LOANMNG01010_search: false,
  283. button: {
  284. search: function() {
  285. listObj.itp_LOANMNG01010_search = true;
  286. let param = $('#ITP_FORM_LOANMNG01010_SEARCH').serializeObject();
  287. param.gridSize = $.jgrid.defaults.rowNum;
  288. param.gridPage = $.jgrid.defaults.page;
  289. $(LOANMNG01010_GRID_ID).setGridParam({'postData': JSON.stringify(param)}).trigger('reloadGrid');
  290. },
  291. popupStore: function() { // 매장선택 팝업
  292. fn_call_popup('biz', 'BIZPOP_BRAND_STORE', '#ITP_ASIDE', function(result) {
  293. // alert(JSON.stringify(result));
  294. $('#ITP_FORM_LOANMNG01010_SEARCH_STORE_ID').val(result[0].storeId);
  295. $('#ITP_FORM_LOANMNG01010_SEARCH_STORE_NM').val(result[0].storeNm);
  296. listObj.button.search();
  297. }, null, 'S');
  298. },
  299. eraseStore: function() { // 매장선택 삭제
  300. $('#ITP_FORM_LOANMNG01010_SEARCH_STORE_ID').val('');
  301. $('#ITP_FORM_LOANMNG01010_SEARCH_STORE_NM').val('');
  302. listObj.button.search();
  303. }
  304. },
  305. empty: {
  306. init: function() {
  307. var _this = this;
  308. this.push();
  309. $(LOANMNG01010_GRID_EMPTY).on('click', function() {
  310. _this.back();
  311. _this.itp_LOANMNG01010_param.gridSize = $.jgrid.defaults.rowNum;
  312. $(LOANMNG01010_GRID_ID).setGridParam({'postData': JSON.stringify(_this.itp_LOANMNG01010_param)}).trigger('reloadGrid');
  313. });
  314. },
  315. itp_LOANMNG01010_param: {},
  316. push: function() {
  317. let param = $('#ITP_FORM_LOANMNG01010_SEARCH').serializeObject();
  318. listObj.itp_LOANMNG01010_param = param;
  319. },
  320. back: function() {
  321. $('#ITP_FORM_LOANMNG01010_WHS_DVSN').val(listObj.itp_LOANMNG01010_param.swhsDvsn);
  322. $('#ITP_FORM_LOANMNG01010_WHS_ST_CD').val(listObj.itp_LOANMNG01010_param.swhsStCd);
  323. $('#ITP_FORM_LOANMNG01010_SEARCH_WHS_NM').val(listObj.itp_LOANMNG01010_param.swhsNm);
  324. }
  325. },
  326. grid: {
  327. init: function () {
  328. // 데이터 없을때
  329. listObj.empty.push();
  330. this.search();
  331. itp_fn_jqgrid_resize(LOANMNG01010_GRID_ID, LOANMNG01010_GRID_LIST, 'lg');
  332. },
  333. colModel: gridColModel.list,
  334. search: function() {
  335. pageObj.switchScreen('LIST');
  336. this.unload();
  337. this.load();
  338. },
  339. load: function() {
  340. let param = $('#ITP_FORM_LOANMNG01010_SEARCH').serializeObject();
  341. param.gridSize = $.jgrid.defaults.rowNum;
  342. var option = {
  343. gridId: LOANMNG01010_GRID_ID,
  344. colModel: gridColModel.list,
  345. param: param,
  346. url: DOMAIN + LOAN_STATE_DETAIL_GRID_LIST,
  347. pager: LOANMNG01010_GRID_PAGER,
  348. onCellSelect: function(rowId, cellIdx, cellValue) {
  349. var cm = $(this).jqGrid('getGridParam', 'colModel');
  350. var colNm = cm[cellIdx].name;
  351. if (colNm == 'loanDvsnNm') {
  352. const loanMgntUnqNoVal = $(this).jqGrid('getCell', rowId, 'loanMgntUnqNo');
  353. const key = {loanMgntUnqNo: loanMgntUnqNoVal, viewCd: 'R'};
  354. var param = $.param(key);
  355. viewObj.init(param);
  356. }
  357. },
  358. loadComplete: function(data) {
  359. // console.log(data);
  360. itp_fn_grid_load_complete(data, LOANMNG01010_GRID_ID, true, 'number', 'LOANMNG01010', listObj.itp_LOANMNG01010_search, listObj.empty, true, data.gridRecords, true);
  361. var ids = $(LOANMNG01010_GRID_ID).getDataIDs();
  362. $.each(ids, function(idx, rowId) {
  363. $(LOANMNG01010_GRID_ID).jqGrid('setCell', rowId, 'loanDvsnNm', '', ITP_GRID_COL_STYLE.link);
  364. });
  365. const self=this;
  366. if(self.sortUse) return;
  367. self.sortUse=true;
  368. self['sort4']='desc';
  369. const th=$(LOANMNG01010_GRID_LIST).find('.ui-jqgrid-labels .ui-th-div').eq(4);
  370. th.find('.s-ico').show();
  371. th.find('.ui-grid-ico-sort').hide();
  372. th.find('.glyphicon-triangle-top').show();//asc 는 bottom 으로
  373. //$(LOANMNG01010_GRID_LIST).find('.ui-jqgrid-labels .ui-th-div').css('cursor','default');
  374. $(LOANMNG01010_GRID_LIST).find('th').eq(4).css({cursor:'pointer',background:'#FFEBCD'});
  375. $(LOANMNG01010_GRID_LIST).find('th').eq(5).css({cursor:'pointer',background:'#FFEBCD'});
  376. $(LOANMNG01010_GRID_LIST).find('.ui-jqgrid-labels>th').on('click', function() {
  377. const idx=$(this).index();
  378. console.log("xxxx grid header click xxxxxxx index=="+idx, param );
  379. if(idx==4 || idx==5) {
  380. var field='',sort=self['sort'+idx];
  381. if(sort ) {
  382. sort=sort=='asc'?'desc':'asc';
  383. } else {
  384. // 등록일 내림차순, 제목 오름차순
  385. sort=idx==4? 'desc':idx==5? 'asc': 'desc';
  386. }
  387. const icon=sort=='asc'? '.glyphicon-triangle-bottom': '.glyphicon-triangle-top';
  388. self['sort'+idx]=sort;
  389. if(idx==4) {
  390. field='storeNm';
  391. } else if(idx==5) {
  392. field='loanMgntUnqNo';
  393. }
  394. let param = $('#ITP_FORM_LOANMNG01010_SEARCH').serializeObject();
  395. param.page=1;
  396. param.sidx=field;
  397. param.sord=sort;
  398. $(LOANMNG01010_GRID_ID).jqGrid('setGridParam',{
  399. postData:JSON.stringify(param)
  400. }).trigger('reloadGrid');
  401. $(this).find('.s-ico').show();
  402. $(this).find('.ui-grid-ico-sort').hide();
  403. $(this).find(icon).show();
  404. }
  405. });
  406. },
  407. onPaging: function(action) {
  408. itp_fn_grid_paging(LOANMNG01010_GRID_ID, action, param);
  409. }
  410. };
  411. itp_fn_grid_make_remote(option);
  412. },
  413. clearData : function() {
  414. $(LOANMNG01010_GRID_ID).jqGrid('clearGridData', true);
  415. $(LOANMNG01010_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
  416. $(LOANMNG01010_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
  417. $(LOANMNG01010_GRID_EMPTY).show();
  418. },
  419. unload : function() {
  420. $.jgrid.gridUnload(LOANMNG01010_GRID_ID);
  421. }
  422. },
  423. excelDown: function() {
  424. var param = {
  425. 'url': LOAN_STATE_DETAIL_GRID_LIST,
  426. 'param': $('#ITP_FORM_LOANMNG01010_SEARCH').serializeObject(),
  427. 'gridColumns': $(LOANMNG01010_GRID_ID).jqGrid('getGridParam', 'colModel'),
  428. 'fileName': '여신현황.xlsx',
  429. 'sheetName': '여신현황리스트'
  430. };
  431. itp_fn_remote_to_excel(param);
  432. }
  433. };
  434. /*상세화면 Object*/
  435. let viewObj = {
  436. init: function (param) {
  437. this.load(param);
  438. },
  439. button: {
  440. cancel: function() {
  441. listObj.grid.search();
  442. },
  443. history: function() {
  444. let param = $('#ITP_FORM_LOANMNG01010_VIEW_SEARCH').serializeObject();
  445. param.gridSize = $.jgrid.defaults.rowNum;
  446. param.gridPage = $.jgrid.defaults.page;
  447. $(LOANMNG01010_VIEW_GRID_ID).setGridParam({'postData': JSON.stringify(param)}).trigger('reloadGrid');
  448. },
  449. },
  450. load: function(param) {
  451. fn_ajax_call(LOAN_STATE_INFO_LOAN_MNG, param, this.callback, 'GET');
  452. },
  453. callback: function (result) {
  454. // console.log(result);
  455. pageObj.switchScreen('VIEW');
  456. $('#ITP_FORM_LOANMNG01010_VIEW_BRAND_ID').val(result.brandId);
  457. $('#ITP_FORM_LOANMNG01010_VIEW_STORE_ID').val(result.storeId);
  458. $('#ITP_FORM_LOANMNG01010_VIEW_LOAN_MGNT_UNQ_NO').val(result.loanMgntUnqNo);
  459. $('#ITP_FORM_LOANMNG01010_VIEW_SEARCH_LOAN_MGNT_UNQ_NO').val(result.loanMgntUnqNo);
  460. $('#ITP_FORM_LOANMNG01010_VIEW .fnBrandNm').text(result.brandNm);
  461. $('#ITP_FORM_LOANMNG01010_VIEW .fnStoreNm').text(result.storeNm);
  462. $('#ITP_FORM_LOANMNG01010_VIEW .fnLoanDvsn').text(result.loanDvsnNm);
  463. var limitAmt;
  464. if(result.loanDvsn == 'LD01') { // 선불(충전)
  465. limitAmt = result.chrgeLimitAmt;
  466. } else if(result.loanDvsn == 'LD02') { // 후불(신용)
  467. limitAmt = result.credtLimitAmt;
  468. }
  469. $('#ITP_FORM_LOANMNG01010_VIEW .fnCredtLimitAmt').text(itp_fn_number_comma(limitAmt));
  470. $('#ITP_FORM_LOANMNG01010_VIEW .fnContDt').text(''); // TODO 계약기간
  471. $('#ITP_FORM_LOANMNG01010_VIEW .fnUseYn').text(result.useYnNm);
  472. $('#ITP_FORM_LOANMNG01010_VIEW .fnPosbLimitAmt').text(itp_fn_number_comma(limitAmt + result.acctBal - result.useAmtTotal)); // TODO 가용한도금액
  473. $('#ITP_FORM_LOANMNG01010_VIEW .fnTmpRcvAcctTotal').text(itp_fn_number_comma(result.acctBal));
  474. $('#ITP_FORM_LOANMNG01010_VIEW .fnUseAmtTotal').text(itp_fn_number_comma(result.useAmtTotal));
  475. $('#ITP_FORM_LOANMNG01010_VIEW .fnLastModify').text(result.sysChgNm + ' / ' + result.sysChgDttm);
  476. // 여신이력 리스트 조회
  477. viewObj.grid.init();
  478. },
  479. grid: {
  480. init: function() {
  481. this.unload();
  482. this.load();
  483. itp_fn_jqgrid_resize(LOANMNG01010_VIEW_GRID_ID, LOANMNG01010_VIEW_GRID_LIST, 'lg');
  484. },
  485. load : function() {
  486. let param = $('#ITP_FORM_LOANMNG01010_VIEW_SEARCH').serializeObject();
  487. param.gridSize = $.jgrid.defaults.rowNum;
  488. param.pagingYn = true; // 페이징
  489. var option = {
  490. gridId: LOANMNG01010_VIEW_GRID_ID,
  491. colModel: gridColModel.view,
  492. param: param,
  493. url: DOMAIN + LOAN_STATE_HIST_GRID_LIST,
  494. pager: LOANMNG01010_VIEW_GRID_PAGER,
  495. loadComplete: function(data) {
  496. itp_fn_grid_load_complete(data, LOANMNG01010_VIEW_GRID_ID, true, undefined, 'LOANMNG01010_VIEW');
  497. },
  498. onPaging: function(action) {
  499. var pagingFn = {
  500. callBack: function(args) {
  501. $(args).trigger('reloadGrid');
  502. }
  503. };
  504. if (itp_fn_check_grid_is_writing(LOANMNG01010_VIEW_GRID_ID)) {
  505. itp_fn_modal_confirm(ITP_MSG_LOCALE.message.ajax.cancelData, pagingFn, LOANMNG01010_VIEW_GRID_ID);
  506. return 'stop';
  507. } else {
  508. itp_fn_grid_paging(LOANMNG01010_VIEW_GRID_ID, action, param);
  509. }
  510. },
  511. onSortCol: function(index, columnIndex, sortOrder) {
  512. var sortingFn = {
  513. callBack: function(args) {
  514. $(args).trigger('reloadGrid');
  515. }
  516. };
  517. if (itp_fn_check_grid_is_writing(LOANMNG01010_VIEW_GRID_ID)) {
  518. itp_fn_modal_confirm(ITP_MSG_LOCALE.message.ajax.cancelData, sortingFn, LOANMNG01010_VIEW_GRID_ID);
  519. return 'stop';
  520. } else {
  521. itp_fn_grid_sorting(LOANMNG01010_VIEW_GRID_ID, index, sortOrder);
  522. }
  523. }
  524. };
  525. itp_fn_grid_make_remote(option);
  526. },
  527. clearData : function() {
  528. $(LOANMNG01010_VIEW_GRID_ID).jqGrid('clearGridData', true);
  529. $(LOANMNG01010_VIEW_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
  530. $(LOANMNG01010_VIEW_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
  531. $(LOANMNG01010_VIEW_GRID_EMPTY).show();
  532. },
  533. unload : function() {
  534. $.jgrid.gridUnload(LOANMNG01010_VIEW_GRID_ID);
  535. }
  536. },
  537. histexcelDown: function() {
  538. var param = {
  539. 'url': LOAN_STATE_HIST_GRID_LIST,
  540. 'param': $('#ITP_FORM_LOANMNG01010_VIEW_SEARCH').serializeObject(),
  541. 'gridColumns': $(LOANMNG01010_VIEW_GRID_ID).jqGrid('getGridParam', 'colModel'),
  542. 'fileName': '여신이력.xlsx',
  543. 'sheetName': '여신이력리스트'
  544. };
  545. itp_fn_remote_to_excel(param);
  546. }
  547. };