123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313 |
- require(['config'], function() {
- require([
- ], function($) {
- pageObj.init(); //config 적용
- });
- });
- /********************************************************
- --------------------------------------------------------
- - Object 목록 -
- --------------------------------------------------------
- * const gridColModel = {} : 화면 Grid Object *
- * let pageObj = {} : 화면공통 Object *
- * let listObj = {} : 목록화면 Object *
- *******************************************************/
- /*화면 변수*/
- const ORDMNG03010_GRID_ID = '#ITP_ORDMNG03010_jqGrid'; //GRID_ID 선언
- const ORDMNG03010_GRID_LIST = '#ITP_ORDMNG03010_jqGrid_list'; //GRID_LIST 선언
- const ORDMNG03010_GRID_PAGER = '#ITP_ORDMNG03010_jqGridPager'; //GRID_PAGER 선언
- const ORDMNG03010_GRID_EMPTY = '#ITP_ORDMNG03010_jqGridEmpty'; //GRID_EMPTY 선언
- /*API URL*/
- let API_DELI_GRID_LIST = '/api/pomng/inoutmng/spply-deli-grid-list';// 목록
- let API_INFO_INV = '/api/pomng/inoutmng/init-spply-inv'; // 상세
- /*화면 Grid ColModel*/
- const gridColModel = {
- list: [
- {
- index: 'Brand_ID', name: 'brandId', //서버로 전송시 데이터 명 , 데이터명
- label: ITP_MSG_LOCALE.label.brandId, //브랜드아이디
- width: '18', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: true //정렬가능 여부,화면표시 여부
- },
- {
- index: 'Brand_Nm', name: 'brandNm', //정렬가능 여부,화면표시 여부
- label: ITP_MSG_LOCALE.label.brandNm, //브랜드이름
- width: '10', fixed: false, align: 'left', // cell가로넓이,고정 여부 ,text정렬
- minwidth: 120, //최소가로넓이 설정
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- },
- {
- index: 'DLV_STTMT_NO', name: 'dlvSttmtUnqNo', //서버로 전송시 데이터 명 , 데이터명
- label: ITP_MSG_LOCALE.label.dlvSttmtUnqNo, //납품서번호
- width: '20', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
- minwidth: 140,
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- },
- {
- index: 'DLV_ST_NM', name: 'dlvStNm', //서버로 전송시 데이터 명 , 데이터명
- label: '납품상태', //납품서상태
- width: '12', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- },
- {
- index: 'PODR_REG_DT', name: 'podrRegDt', //서버로 전송시 데이터 명 , 데이터명
- label: '수주일자', //수주일자
- width: '14', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- },
- {
- index: 'PCH_ITEM_YN', name: 'dlvReqDt', //서버로 전송시 데이터 명 , 데이터명
- label: ITP_MSG_LOCALE.label.dlvReqDt, //납품요청일
- width: '14', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- },
- {
- index: 'PCH_ITEM_YN', name: 'dlvSchDt', //서버로 전송시 데이터 명 , 데이터명
- label: ITP_MSG_LOCALE.label.dlvSchDt, //납품예정일
- width: '14', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- },
- {
- index: 'PCH_ITEM_YN', name: 'dlvCmpltDt', //서버로 전송시 데이터 명 , 데이터명
- label: ITP_MSG_LOCALE.label.dlvCmpltDt, //납품완료일
- width: '14', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- },
- {
- index: 'ITEM_CLASS_NM', name: 'itemId', //서버로 전송시 데이터 명 , 데이터명
- label: ITP_MSG_LOCALE.label.itemId, //품목번호
- minwidth: 180,
- width: '11', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- },
- {
- index: 'PODR_PSSBLDVSN_NM', name: 'itemNm', //서버로 전송시 데이터 명 , 데이터명
- label: ITP_MSG_LOCALE.label.itemNm, //품목명
- minwidth: 140,
- width: '10', fixed: false, align: 'left', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- },
- {
- index: 'PODR_QTY', name: 'podrQty', //서버로 전송시 데이터 명 , 데이터명
- label: ITP_MSG_LOCALE.label.podrQty, //수주수량
- minwidth: 80,
- width: '6', fixed: false, align: 'right', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- },
- {
- index: 'SALE_ITEM_YN', name: 'dlvQty', //서버로 전송시 데이터 명 , 데이터명
- label: ITP_MSG_LOCALE.label.dlvQty, //납품수량
- minwidth: 80,
- width: '6', fixed: false, align: 'right', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- },
- {
- index: 'UNIT', name: 'unit', //서버로 전송시 데이터 명 , 데이터명
- label: ITP_MSG_LOCALE.label.unit, //단위
- minwidth: 80,
- width: '6', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- },
- {
- index: 'PCH_ITEM_YN', name: 'unitAmt', //서버로 전송시 데이터 명 , 데이터명
- label: ITP_MSG_LOCALE.label.unitAmt, //납품금액
- minwidth: 80,
- width: '6', fixed: false, align: 'right ', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: false, //정렬가능 여부,화면표시 여부
- formatter: 'integer', formatoptions: {thousandsSeparator: ','}
- },
- {
- index: 'SALE_ITEM_YN', name: 'whsNm', //서버로 전송시 데이터 명 , 데이터명
- label: ITP_MSG_LOCALE.label.whsNm, //납품장소
- minwidth: 240,
- width: '6', fixed: false, align: 'left', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- },
- {
- index: 'PCH_ITEM_YN', name: 'dlvMgrNm', //서버로 전송시 데이터 명 , 데이터명
- label: ITP_MSG_LOCALE.label.dlvMgrNm, //납품담당자
- minwidth: 100,
- width: '8', fixed: false, align: 'left', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- },
- {
- index: 'PCH_ITEM_YN', name: 'dlvMgrTelNo', //서버로 전송시 데이터 명 , 데이터명
- label: ITP_MSG_LOCALE.label.dlvMgrTelNo, //납품담당연락처
- minwidth: 120,
- width: '10', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- }
- ]
- };
- /*화면공통 Object*/
- let pageObj = {
- init: function () {
- this.ui.init(); //ul 안 init 불러옴
- this.event.init(); //event 안 init 불러옴
- this.action(); //action 불러옴
- },
- ui: {
- init: function () {
- this.view(); //view 불러오기
- listObj.init(); //listObj 에서 init 불러오기
- },
- view: function() {
- // 버튼 권한설정
- fn_proc_btn_auth('ORDMNG03010');
- // 조회일자 달력 팝업 불러오기
- var now = new Date();
- $('#ITP_TAB_ORDMNG03010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
- $('#ITP_FORM_ORDMNG03010_SEARCH_DLV_REQ_DT').datepicker('setDate', new Date(now.setMonth(now.getMonth() - 1)));
- $('#ITP_FORM_ORDMNG03010_SEARCH_DLV_CMPLT_DT').datepicker('setDate', new Date());
- }
- },
-
- event: {
- init: function () {
- this.button(); //button 부르기
- },
- button: function () {
- // 버튼 클릭 이벤트
- $('button').each(function() {
- var id = $(this).attr('id');
- $(this).on('click', function() {
- switch (id) {
- case 'ITP_BTN_ORDMNG03010_SRH' : listObj.button.search(); break; // 조회 버튼 클릭
- case 'ITP_BTN_ORDMNG03010_EXCEL' : listObj.excelDown(); break; // 엑셀 다운로드
- }
- });
- });
- }
- },
- screen: function() {
- $('#ITP_FORM_ORDMNG03010_SEARCH_SPPLY_ID').val(fn_make_user_info.get('userId')); //input hidden 값 넣기
- $('#ITP_FORM_ORDMNG03010_SEARCH_BRAND_ID').val(fn_make_user_info.get('brandId'));//input hidden 값 넣기
- $('#ITP_FORM_ORDMNG03010_SDELETE_SWHS_NM').show(); //버튼 보이게 하기
- $('#ITP_BTN_ORDMNG03010_EXCEL').show(); //버튼 보이게 하기
- },
- action: function() {
- var _this = this;
- $('#ITP_BTN_ORDMNG03010_POPUP').on('click', function() {
- _this.popup();
- });
- },
- popup: function() {
- var selectedIds = $(ORDMNG03010_GRID_ID).getGridParam('selarrrow');
- if(selectedIds.length > 1) { // 1이상 선택시
- alert("납품서 하나만 선택해주세요 (대표 납품서번호)") ;//출력
- return; //리턴
- }
- var selRowData ; //변수선언
- for (var i=selectedIds.length-1; i>=0; i--) {//1개만 선택시
- selRowData = $(ORDMNG03010_GRID_ID).jqGrid('getRowData', selectedIds[i]);//cell 선택
- }
- if (selRowData == null) {
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.noData)
- return;
- }
- const key = {brandId :fn_make_user_info.get('brandId'), dlvSttmtUnqNo : selRowData.dlvSttmtUnqNo}; //popup key 값 설정
- fn_call_popup('biz', 'BIZPOP_DLV_STTMT_PRN', '#ITP_ASIDE',null, key, 'S'); //config 참고 421줄 팝업 이름,키
- }
- };
- /*목록화면 Object*/
- let listObj = {
- init: function () {
- this.grid.init(); //grid 에 init 불러오기
- this.action();
- },
- itp_ORDMNG03010_search: false, //조회 안함
- button: {
- search: function() {
- listObj.itp_ORDMNG03010_search = true; //조회 시작
- let param = $('#ITP_FORM_ORDMNG03010_SEARCH').serializeObject();
- param.gridSize = $.jgrid.defaults.rowNum; // 그리드 사이즈 20
- param.gridPage = $.jgrid.defaults.page; // 페이지 1
- /*물어봐야할것들*/
- $(ORDMNG03010_GRID_ID).setGridParam({'postData': JSON.stringify(param)}).trigger('reloadGrid');
- }
- },
- empty: {
- init: function() {
-
- },
- itp_ORDMNG03010_param: {},//현재 정보는 없음
- push: function() {
-
- }
- },
- grid: {
- init: function () {
- // 데이터 없을때
- this.search();//search 불러오기
- //itp_fn_jqgrid_resize(ORDMNG03010_GRID_ID, ORDMNG03010_GRID_LIST, 'lg');
- },
- colModel: gridColModel.list, //컬럼정보
- search: function() {
- pageObj.screen(); //공통 스크린 불러오기
- this.load(); //load 불러오기
- },
- load: function() {
- let param = $('#ITP_FORM_ORDMNG03010_SEARCH').serializeObject(); //param 값 선언
- param.gridSize = $.jgrid.defaults.rowNum; //그리드 사이즈 20
- param.sbrandId = fn_make_user_info.get('brandId'); //안쓰는 api 값 넣기
- var option = {
- gridId: ORDMNG03010_GRID_ID, //아이디 정보
- colModel: gridColModel.list, //컬럼 정보
- param: param, //파람 정보
- url: DOMAIN + API_DELI_GRID_LIST,//API 주소 정보
- pager: ORDMNG03010_GRID_PAGER, //페이지 정보
- multiselect: true, //동시선택 가능
- /*물어봐야할것들*/
- loadComplete: function(data) {
- itp_fn_grid_load_complete(data, ORDMNG03010_GRID_ID, true, 'number', 'ORDMNG03010', listObj.itp_ORDMNG03010_search, listObj.empty, true, data.gridRecords, true);
- },
- onPaging: function(action) {
- itp_fn_grid_paging(ORDMNG03010_GRID_ID, action, param);
- }
- };
- itp_fn_grid_make_remote(option);
- },
- },
- action: function () {
- var _this = this; //_this 는 this 와 같다
- // 검색 납품장소 클릭
- $('#ITP_FORM_ORDMNG03010_SSEARCH_SWHS_NM').on('click', function() {
- _this.popup(); //'whs 팝업생성'
- });
- // 검색 납품장소 텍스트 삭제 버튼 클릭
- $('#ITP_FORM_ORDMNG03010_SDELETE_SWHS_NM').on('click', function() {
- $('#ITP_FORM_ORDMNG03010_SEARCH_SWHS_NM').val(''); //납품장소 이름 값 제거
- $('#ITP_FORM_ORDMNG03010_SEARCH_SWHS_ID').val(''); //납품장소 아이디 값 제거
- });
-
- },
- popup: function () {
- var popFn = this.callback.searWhs; //popFn 선언
- const key = {brandId:fn_make_user_info.get('brandId'),storeId:fn_make_user_info.get('storeId'), whsDvsn:""};//key 값 선언
- fn_call_popup('biz', 'BIZPOP_WHS_LOCATION', '#ITP_ASIDE', popFn, key, 'S'); //popup 부르기 팝업 이름,popFn,key
- },
- callback: {
- searWhs: function(rowDataPop) {
- if(rowDataPop) {
- $('#ITP_FORM_ORDMNG03010_SEARCH_SWHS_NM').val(rowDataPop.whsNm); // popup 에서 고른 값 넣기
- $('#ITP_FORM_ORDMNG03010_SEARCH_SWHS_ID').val(rowDataPop.whsId); // popup 에서 고른 값 넣기
- }
- }
- },
- excelDown: function() {
- var param = {
- 'url': API_DELI_GRID_LIST,
- 'param': $('#ITP_FORM_ORDMNG03010_SEARCH').serializeObject(),
- 'gridColumns': $(ORDMNG03010_GRID_ID).jqGrid('getGridParam', 'colModel'),
- 'fileName': '공급사 납품서현황.xlsx',
- 'sheetName': '공급사 납품서리스트'
- };
- itp_fn_remote_to_excel(param);
- }
- };
|