ITP_POMNG05010.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  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. *******************************************************/
  18. /*화면 변수*/
  19. const POMNG05010_GRID_ID = '#ITP_POMNG05010_jqGrid';
  20. const POMNG05010_GRID_LIST = '#ITP_POMNG05010_jqGrid_list';
  21. const POMNG05010_GRID_PAGER = '#ITP_POMNG05010_jqGridPager';
  22. const POMNG05010_GRID_EMPTY = '#ITP_POMNG05010_jqGridEmpty';
  23. /*API URL*/
  24. let API_DETAIL_GRID_LIST = '/api/pomng/inoutmng/deli-grid-list';// 목록
  25. let API_DETAIL_INFO = '/api/pomng/inoutmng/info-inv'; // 상세
  26. /*화면 Grid ColModel*/
  27. const gridColModel = {
  28. list: [
  29. {
  30. index: 'Brand_ID', name: 'brandId', //서버로 전송시 데이터 명 , 데이터명
  31. label: ITP_MSG_LOCALE.label.brandId, //브랜드아이디
  32. width: '18', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
  33. sortable: false, hidden: true //정렬가능 여부,화면표시 여부
  34. },
  35. {
  36. index: 'Brand_Nm', name: 'brandNm', //정렬가능 여부,화면표시 여부
  37. label: ITP_MSG_LOCALE.label.brandNm, //브랜드이름
  38. width: '20', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
  39. sortable: false, hidden: false //정렬가능 여부,화면표시 여부
  40. },
  41. {
  42. index: 'DLV_STTMT_NO', name: 'dlvSttmtUnqNo', //서버로 전송시 데이터 명 , 데이터명
  43. label: ITP_MSG_LOCALE.label.dlvSttmtUnqNo, //납품서번호
  44. width: '20', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
  45. sortable: false, hidden: false //정렬가능 여부,화면표시 여부
  46. },
  47. {
  48. index: 'DLV_ST_CD', name: 'dlvStCd', //서버로 전송시 데이터 명 , 데이터명
  49. label: '납품상태', //납품서상태
  50. width: '12', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
  51. sortable: false, hidden: false //정렬가능 여부,화면표시 여부
  52. },
  53. {
  54. index: 'PODR_REG_DT', name: 'podrRegDt', //서버로 전송시 데이터 명 , 데이터명
  55. label: '수주일자', //수주일자
  56. width: '14', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
  57. sortable: false, hidden: false //정렬가능 여부,화면표시 여부
  58. },
  59. {
  60. index: 'DLV_REQ_DT', name: 'dlvReqDt', //서버로 전송시 데이터 명 , 데이터명
  61. label: ITP_MSG_LOCALE.label.dlvReqDt, //납품요청일
  62. width: '14', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
  63. sortable: false, hidden: false //정렬가능 여부,화면표시 여부
  64. },
  65. {
  66. index: 'DLV_SCH_DT', name: 'dlvSchDt', //서버로 전송시 데이터 명 , 데이터명
  67. label: ITP_MSG_LOCALE.label.dlvSchDt, //납품예정일
  68. width: '14', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
  69. sortable: false, hidden: false //정렬가능 여부,화면표시 여부
  70. },
  71. {
  72. index: 'DLV_CMPLT_DT', name: 'dlvCmpltDt', //서버로 전송시 데이터 명 , 데이터명
  73. label: ITP_MSG_LOCALE.label.dlvCmpltDt, //납품완료일
  74. width: '10', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
  75. sortable: false, hidden: false //정렬가능 여부,화면표시 여부
  76. },
  77. {
  78. index: 'ITEM_ID', name: 'itemId', //서버로 전송시 데이터 명 , 데이터명
  79. label: ITP_MSG_LOCALE.label.itemId, //품목번호
  80. width: '11', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
  81. sortable: false, hidden: false //정렬가능 여부,화면표시 여부
  82. },
  83. {
  84. index: 'ITEM_NM', name: 'itemNm', //서버로 전송시 데이터 명 , 데이터명
  85. label: ITP_MSG_LOCALE.label.itemNm, //품목명
  86. width: '10', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
  87. sortable: false, hidden: false //정렬가능 여부,화면표시 여부
  88. },
  89. {
  90. index: 'PODR_QTY', name: 'podrQty', //서버로 전송시 데이터 명 , 데이터명
  91. label: ITP_MSG_LOCALE.label.podrQty, //수주수량
  92. width: '6', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
  93. sortable: false, hidden: false //정렬가능 여부,화면표시 여부
  94. },
  95. {
  96. index: 'DLV_QTY', name: 'dlvQty', //서버로 전송시 데이터 명 , 데이터명
  97. label: ITP_MSG_LOCALE.label.dlvQty, //납품수량
  98. width: '6', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
  99. sortable: false, hidden: false //정렬가능 여부,화면표시 여부
  100. },
  101. {
  102. index: 'UNIT', name: 'unit', //서버로 전송시 데이터 명 , 데이터명
  103. label: ITP_MSG_LOCALE.label.unit, //납품수량
  104. width: '6', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
  105. sortable: false, hidden: false //정렬가능 여부,화면표시 여부
  106. },
  107. {
  108. index: 'UNIT_AMT', name: 'unitAmt', //서버로 전송시 데이터 명 , 데이터명
  109. label: ITP_MSG_LOCALE.label.unitAmt, //납품금액
  110. width: '6', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
  111. sortable: false, hidden: false //정렬가능 여부,화면표시 여부
  112. },
  113. {
  114. index: 'WHS_NM', name: 'whsNm', //서버로 전송시 데이터 명 , 데이터명
  115. label: ITP_MSG_LOCALE.label.whsNm, //납품장소
  116. width: '6', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
  117. sortable: false, hidden: false //정렬가능 여부,화면표시 여부
  118. },
  119. {
  120. index: 'DLV_MGR_NM', name: 'dlvMgrNm', //서버로 전송시 데이터 명 , 데이터명
  121. label: ITP_MSG_LOCALE.label.dlvMgrNm, //납품담당자
  122. width: '8', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
  123. sortable: false, hidden: false //정렬가능 여부,화면표시 여부
  124. },
  125. {
  126. index: 'DLV_MGR_TEL_NO', name: 'dlvMgrTelNo', //서버로 전송시 데이터 명 , 데이터명
  127. label: ITP_MSG_LOCALE.label.dlvMgrTelNo, //납품담당연락처
  128. width: '10', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
  129. sortable: false, hidden: false //정렬가능 여부,화면표시 여부
  130. }
  131. ]
  132. };
  133. /*화면공통 Object*/
  134. let pageObj = {
  135. init: function () {
  136. this.ui.init();
  137. this.event.init();
  138. this.action();
  139. },
  140. ui: {
  141. init: function () {
  142. this.view();
  143. listObj.init();
  144. },
  145. view: function() {
  146. // 버튼 권한설정
  147. fn_proc_btn_auth('POMNG05010');
  148. // 공통코드 표시 sfasfdasfafas
  149. $('select').each(function() {
  150. if($(this).data('select-code')) {
  151. fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
  152. }
  153. });
  154. // 조회일자 지정
  155. var now = new Date();
  156. $('#ITP_TAB_POMNG05010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
  157. $('#ITP_FORM_POMNG05010_SEARCH_FROM_DT').datepicker('setDate', new Date(now.setMonth(now.getMonth() - 1)));
  158. $('#ITP_FORM_POMNG05010_SEARCH_TO_DT').datepicker('setDate', new Date());
  159. },
  160. },
  161. action: function () {
  162. var _this = this;
  163. // 검색 공급사
  164. $('#ITP_BTN_POMNG05010_SEARCH_SPPLY_NM').on('click', function() {
  165. _this.popup('SS');
  166. });
  167. // 검색 텍스트 삭제 버튼 클릭
  168. $('#ITP_BTN_POMNG05010_DELETE_SPPLY_NM').on('click', function() {
  169. $('#ITP_FORM_POMNG05010_SEARCH_SPPLY_NM').val('');
  170. $('#ITP_FORM_POMNG05010_SEARCH_SPPLY_ID').val('');
  171. });
  172. // 검색 납품장소
  173. $('#ITP_BTN_POMNG05010_SEARCH_SWHS_NM').on('click', function() {
  174. _this.popup('SW');
  175. });
  176. // 검색 납품장소 텍스트 삭제 버튼 클릭
  177. $('#ITP_BTN_POMNG05010_DELETE_SWHS_NM').on('click', function() {
  178. $('#ITP_FORM_POMNG05010_SEARCH_WHS_NM').val('');
  179. $('#ITP_FORM_POMNG05010_SEARCH_WHS_ID').val('');
  180. });
  181. },
  182. popup: function (arg) {
  183. var popFn ;
  184. // 팝업
  185. if (arg == "SW") {
  186. popFn = this.callback.searWhs;
  187. } else if (arg == "SS") {
  188. popFn = this.callback.searSpply;
  189. }
  190. const key = {brandId:fn_make_user_info.get('brandId'),storeId:fn_make_user_info.get('storeId')};
  191. if (arg == "SW" ) {
  192. const keya = {brandId:fn_make_user_info.get('brandId'),storeId:fn_make_user_info.get('storeId'), whsDvsn:""};
  193. fn_call_popup('biz', 'BIZPOP_WHS_LOCATION', '#ITP_ASIDE', popFn, keya, 'S');
  194. } else if (arg == "SS") {
  195. fn_call_popup('biz', 'BIZPOP_STORE_SPPLY', '#ITP_ASIDE', popFn, key, 'S');
  196. }
  197. },
  198. callback: {
  199. searSpply: function(rowDataPop) {
  200. if(rowDataPop) {
  201. $('#ITP_FORM_POMNG05010_SEARCH_SPPLY_NM').val(rowDataPop.spplyNm);
  202. $('#ITP_FORM_POMNG05010_SEARCH_SPPLY_ID').val(rowDataPop.spplyId);
  203. }
  204. },
  205. searWhs: function(rowDataPop) {
  206. if(rowDataPop) {
  207. $('#ITP_FORM_POMNG05010_SEARCH_WHS_NM').val(rowDataPop.whsNm);
  208. $('#ITP_FORM_POMNG05010_SEARCH_WHS_ID').val(rowDataPop.whsId);
  209. }
  210. }
  211. },
  212. event: {
  213. init: function () {
  214. this.button();
  215. },
  216. button: function () {
  217. // 버튼 클릭 이벤트
  218. $('button').each(function() {
  219. var id = $(this).attr('id');
  220. $(this).on('click', function() {
  221. switch (id) {
  222. case 'ITP_BTN_POMNG05010_SRH' : listObj.button.search(); break; // 조회 버튼 클릭
  223. case 'ITP_BTN_POMNG05010_PRT' : listObj.button.print(); // 납품서출력 버튼
  224. }
  225. });
  226. });
  227. }
  228. },
  229. screen: function() {
  230. $('#ITP_FORM_POMNG05010_SEARCH_BRAND_ID').val(fn_make_user_info.get('brandId'));//input hidden 값 넣기
  231. $('#ITP_FORM_POMNG05010_SEARCH_DTL_GUBUN').val(('dtlGubun'));
  232. }
  233. };
  234. /*목록화면 Object*/
  235. let listObj = {
  236. init: function () {
  237. this.grid.init();
  238. },
  239. itp_POMNG05010_search: false,
  240. button: {
  241. search: function() {
  242. listObj.itp_POMNG05010_search = true;
  243. let param = $('#ITP_FORM_POMNG05010_SEARCH').serializeObject();
  244. param.gridSize = $.jgrid.defaults.rowNum;
  245. param.gridPage = $.jgrid.defaults.page;
  246. $(POMNG05010_GRID_ID).setGridParam({'postData': JSON.stringify(param)}).trigger('reloadGrid');
  247. },
  248. print: function() {
  249. if(!fn_make_user_info.isEmpty()) {
  250. const rowKey = $(POMNG05010_GRID_ID).getGridParam('selrow'); // 그리드 셀 선택
  251. if (!rowKey) {//선택 안했을시
  252. alert("납품서를 선택해주세요 (대표 납품서번호)") ; //출력
  253. return; //리턴
  254. }
  255. var selectedIds = $(POMNG05010_GRID_ID).getGridParam('selarrrow');
  256. if(selectedIds.length > 1) { // 1이상 선택시
  257. alert("납품서 하나만 선택해주세요 (대표 납품서번호)") ;//출력
  258. return; //리턴
  259. }
  260. var selRowData ; //변수선언
  261. for (var i=selectedIds.length-1; i>=0; i--) {//1개만 선택시
  262. selRowData = $(POMNG05010_GRID_ID).jqGrid('getRowData', selectedIds[i]);//cell 선택
  263. }
  264. const key = {brandId :fn_make_user_info.get('brandId'), dlvSttmtUnqNo : selRowData.dlvSttmtUnqNo}; //popup key 값 설정
  265. fn_call_popup('biz', 'BIZPOP_DLV_STTMT_PRN', '#ITP_ASIDE',null, key, 'S'); //config 참고 421줄 팝업 이름,키
  266. }
  267. }
  268. },
  269. empty: {
  270. init: function() {
  271. var _this = this;
  272. this.push();
  273. $(POMNG05010_GRID_EMPTY).on('click', function() {
  274. _this.back();
  275. _this.itp_POMNG05010_param.gridSize = $.jgrid.defaults.rowNum;
  276. $(POMNG05010_GRID_ID).setGridParam({'postData': JSON.stringify(_this.itp_POMNG05010_param)}).trigger('reloadGrid');
  277. });
  278. },
  279. itp_POMNG05010_param: {},
  280. push: function() {
  281. let param = $('#ITP_FORM_POMNG05010_SEARCH').serializeObject();
  282. listObj.itp_POMNG05010_param = param;
  283. },
  284. },
  285. grid: {
  286. init: function () {
  287. listObj.empty.push();
  288. this.search();
  289. },
  290. colModel: gridColModel.list,
  291. search: function() {
  292. pageObj.screen();
  293. this.load();
  294. },
  295. load: function() {
  296. let param = $('#ITP_FORM_POMNG05010_SEARCH').serializeObject();
  297. param.gridSize = $.jgrid.defaults.rowNum;
  298. param.sbrandId = fn_make_user_info.get('brandId');
  299. var option = {
  300. gridId: POMNG05010_GRID_ID,
  301. colModel: gridColModel.list,
  302. param: param,
  303. url: DOMAIN + API_DETAIL_GRID_LIST,
  304. pager: POMNG05010_GRID_PAGER,
  305. multiselect: true,
  306. loadComplete: function(data) {
  307. itp_fn_grid_load_complete(data, POMNG05010_GRID_ID, true, 'number', 'POMNG05010', listObj.itp_POMNG05010_search, listObj.empty, true, data.gridRecords, true);
  308. },
  309. onPaging: function(action) {
  310. itp_fn_grid_paging(POMNG05010_GRID_ID, action, param);
  311. }
  312. };
  313. itp_fn_grid_make_remote(option);
  314. }
  315. }
  316. };