123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328 |
- require(['config'], function() {
- require([
- ], function($) {
- pageObj.init();
- });
- });
- /********************************************************
- --------------------------------------------------------
- - Object 목록 -
- --------------------------------------------------------
- * const gridColModel = {} : 화면 Grid Object *
- * let pageObj = {} : 화면공통 Object *
- * let listObj = {} : 목록화면 Object *
- * let viewObj = {} : 상세화면 Object *
- * let modifyObj = {} : 수정화면 Object *
- * let createObj = {} : 신규화면 Object *
- *******************************************************/
- /*화면 변수*/
- const POMNG05010_GRID_ID = '#ITP_POMNG05010_jqGrid';
- const POMNG05010_GRID_LIST = '#ITP_POMNG05010_jqGrid_list';
- const POMNG05010_GRID_PAGER = '#ITP_POMNG05010_jqGridPager';
- const POMNG05010_GRID_EMPTY = '#ITP_POMNG05010_jqGridEmpty';
- /*API URL*/
- let API_DETAIL_GRID_LIST = '/api/pomng/inoutmng/deli-grid-list';// 목록
- let API_DETAIL_INFO = '/api/pomng/inoutmng/info-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: '20', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- },
- {
- index: 'DLV_STTMT_NO', name: 'dlvSttmtUnqNo', //서버로 전송시 데이터 명 , 데이터명
- label: ITP_MSG_LOCALE.label.dlvSttmtUnqNo, //납품서번호
- width: '20', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- },
- {
- index: 'DLV_ST_CD', name: 'dlvStCd', //서버로 전송시 데이터 명 , 데이터명
- 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: 'DLV_REQ_DT', name: 'dlvReqDt', //서버로 전송시 데이터 명 , 데이터명
- label: ITP_MSG_LOCALE.label.dlvReqDt, //납품요청일
- width: '14', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- },
- {
- index: 'DLV_SCH_DT', name: 'dlvSchDt', //서버로 전송시 데이터 명 , 데이터명
- label: ITP_MSG_LOCALE.label.dlvSchDt, //납품예정일
- width: '14', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- },
- {
- index: 'DLV_CMPLT_DT', name: 'dlvCmpltDt', //서버로 전송시 데이터 명 , 데이터명
- label: ITP_MSG_LOCALE.label.dlvCmpltDt, //납품완료일
- width: '10', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- },
- {
- index: 'ITEM_ID', name: 'itemId', //서버로 전송시 데이터 명 , 데이터명
- label: ITP_MSG_LOCALE.label.itemId, //품목번호
- width: '11', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- },
- {
- index: 'ITEM_NM', name: 'itemNm', //서버로 전송시 데이터 명 , 데이터명
- label: ITP_MSG_LOCALE.label.itemNm, //품목명
- width: '10', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- },
- {
- index: 'PODR_QTY', name: 'podrQty', //서버로 전송시 데이터 명 , 데이터명
- label: ITP_MSG_LOCALE.label.podrQty, //수주수량
- width: '6', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- },
- {
- index: 'DLV_QTY', name: 'dlvQty', //서버로 전송시 데이터 명 , 데이터명
- label: ITP_MSG_LOCALE.label.dlvQty, //납품수량
- width: '6', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- },
- {
- index: 'UNIT', name: 'unit', //서버로 전송시 데이터 명 , 데이터명
- label: ITP_MSG_LOCALE.label.unit, //납품수량
- width: '6', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- },
- {
- index: 'UNIT_AMT', name: 'unitAmt', //서버로 전송시 데이터 명 , 데이터명
- label: ITP_MSG_LOCALE.label.unitAmt, //납품금액
- width: '6', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- },
- {
- index: 'WHS_NM', name: 'whsNm', //서버로 전송시 데이터 명 , 데이터명
- label: ITP_MSG_LOCALE.label.whsNm, //납품장소
- width: '6', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- },
- {
- index: 'DLV_MGR_NM', name: 'dlvMgrNm', //서버로 전송시 데이터 명 , 데이터명
- label: ITP_MSG_LOCALE.label.dlvMgrNm, //납품담당자
- width: '8', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- },
- {
- index: 'DLV_MGR_TEL_NO', name: 'dlvMgrTelNo', //서버로 전송시 데이터 명 , 데이터명
- label: ITP_MSG_LOCALE.label.dlvMgrTelNo, //납품담당연락처
- width: '10', fixed: false, align: 'center', // cell가로넓이,고정 여부 ,text정렬
- sortable: false, hidden: false //정렬가능 여부,화면표시 여부
- }
- ]
- };
- /*화면공통 Object*/
- let pageObj = {
- init: function () {
- this.ui.init();
- this.event.init();
- this.action();
- },
- ui: {
- init: function () {
- this.view();
- listObj.init();
- },
- view: function() {
- // 버튼 권한설정
- fn_proc_btn_auth('POMNG05010');
- // 공통코드 표시 sfasfdasfafas
- $('select').each(function() {
- if($(this).data('select-code')) {
- fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
- }
- });
- // 조회일자 지정
- var now = new Date();
- $('#ITP_TAB_POMNG05010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
- $('#ITP_FORM_POMNG05010_SEARCH_FROM_DT').datepicker('setDate', new Date(now.setMonth(now.getMonth() - 1)));
- $('#ITP_FORM_POMNG05010_SEARCH_TO_DT').datepicker('setDate', new Date());
- },
- },
- action: function () {
- var _this = this;
- // 검색 공급사
- $('#ITP_BTN_POMNG05010_SEARCH_SPPLY_NM').on('click', function() {
- _this.popup('SS');
- });
- // 검색 텍스트 삭제 버튼 클릭
- $('#ITP_BTN_POMNG05010_DELETE_SPPLY_NM').on('click', function() {
- $('#ITP_FORM_POMNG05010_SEARCH_SPPLY_NM').val('');
- $('#ITP_FORM_POMNG05010_SEARCH_SPPLY_ID').val('');
- });
- // 검색 납품장소
- $('#ITP_BTN_POMNG05010_SEARCH_SWHS_NM').on('click', function() {
- _this.popup('SW');
- });
- // 검색 납품장소 텍스트 삭제 버튼 클릭
- $('#ITP_BTN_POMNG05010_DELETE_SWHS_NM').on('click', function() {
- $('#ITP_FORM_POMNG05010_SEARCH_WHS_NM').val('');
- $('#ITP_FORM_POMNG05010_SEARCH_WHS_ID').val('');
- });
- },
- popup: function (arg) {
- var popFn ;
- // 팝업
- if (arg == "SW") {
- popFn = this.callback.searWhs;
- } else if (arg == "SS") {
- popFn = this.callback.searSpply;
- }
-
- const key = {brandId:fn_make_user_info.get('brandId'),storeId:fn_make_user_info.get('storeId')};
-
- if (arg == "SW" ) {
- const keya = {brandId:fn_make_user_info.get('brandId'),storeId:fn_make_user_info.get('storeId'), whsDvsn:""};
- fn_call_popup('biz', 'BIZPOP_WHS_LOCATION', '#ITP_ASIDE', popFn, keya, 'S');
- } else if (arg == "SS") {
- fn_call_popup('biz', 'BIZPOP_STORE_SPPLY', '#ITP_ASIDE', popFn, key, 'S');
- }
- },
- callback: {
- searSpply: function(rowDataPop) {
- if(rowDataPop) {
- $('#ITP_FORM_POMNG05010_SEARCH_SPPLY_NM').val(rowDataPop.spplyNm);
- $('#ITP_FORM_POMNG05010_SEARCH_SPPLY_ID').val(rowDataPop.spplyId);
- }
- },
- searWhs: function(rowDataPop) {
- if(rowDataPop) {
- $('#ITP_FORM_POMNG05010_SEARCH_WHS_NM').val(rowDataPop.whsNm);
- $('#ITP_FORM_POMNG05010_SEARCH_WHS_ID').val(rowDataPop.whsId);
- }
- }
- },
- event: {
- init: function () {
- this.button();
- },
- button: function () {
- // 버튼 클릭 이벤트
- $('button').each(function() {
- var id = $(this).attr('id');
- $(this).on('click', function() {
- switch (id) {
- case 'ITP_BTN_POMNG05010_SRH' : listObj.button.search(); break; // 조회 버튼 클릭
- case 'ITP_BTN_POMNG05010_PRT' : listObj.button.print(); // 납품서출력 버튼
- }
- });
- });
- }
- },
- screen: function() {
- $('#ITP_FORM_POMNG05010_SEARCH_BRAND_ID').val(fn_make_user_info.get('brandId'));//input hidden 값 넣기
- $('#ITP_FORM_POMNG05010_SEARCH_DTL_GUBUN').val(('dtlGubun'));
- }
- };
- /*목록화면 Object*/
- let listObj = {
- init: function () {
- this.grid.init();
- },
- itp_POMNG05010_search: false,
- button: {
- search: function() {
- listObj.itp_POMNG05010_search = true;
- let param = $('#ITP_FORM_POMNG05010_SEARCH').serializeObject();
- param.gridSize = $.jgrid.defaults.rowNum;
- param.gridPage = $.jgrid.defaults.page;
- $(POMNG05010_GRID_ID).setGridParam({'postData': JSON.stringify(param)}).trigger('reloadGrid');
- },
- print: function() {
- if(!fn_make_user_info.isEmpty()) {
- const rowKey = $(POMNG05010_GRID_ID).getGridParam('selrow'); // 그리드 셀 선택
- if (!rowKey) {//선택 안했을시
- alert("납품서를 선택해주세요 (대표 납품서번호)") ; //출력
- return; //리턴
- }
- var selectedIds = $(POMNG05010_GRID_ID).getGridParam('selarrrow');
- if(selectedIds.length > 1) { // 1이상 선택시
- alert("납품서 하나만 선택해주세요 (대표 납품서번호)") ;//출력
- return; //리턴
- }
- var selRowData ; //변수선언
-
- for (var i=selectedIds.length-1; i>=0; i--) {//1개만 선택시
- selRowData = $(POMNG05010_GRID_ID).jqGrid('getRowData', selectedIds[i]);//cell 선택
- }
- 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줄 팝업 이름,키
- }
- }
- },
- empty: {
- init: function() {
- var _this = this;
- this.push();
- $(POMNG05010_GRID_EMPTY).on('click', function() {
- _this.back();
- _this.itp_POMNG05010_param.gridSize = $.jgrid.defaults.rowNum;
- $(POMNG05010_GRID_ID).setGridParam({'postData': JSON.stringify(_this.itp_POMNG05010_param)}).trigger('reloadGrid');
- });
- },
- itp_POMNG05010_param: {},
- push: function() {
- let param = $('#ITP_FORM_POMNG05010_SEARCH').serializeObject();
- listObj.itp_POMNG05010_param = param;
- },
- },
- grid: {
- init: function () {
- listObj.empty.push();
- this.search();
- },
- colModel: gridColModel.list,
- search: function() {
- pageObj.screen();
- this.load();
- },
- load: function() {
- let param = $('#ITP_FORM_POMNG05010_SEARCH').serializeObject();
- param.gridSize = $.jgrid.defaults.rowNum;
- param.sbrandId = fn_make_user_info.get('brandId');
- var option = {
- gridId: POMNG05010_GRID_ID,
- colModel: gridColModel.list,
- param: param,
- url: DOMAIN + API_DETAIL_GRID_LIST,
- pager: POMNG05010_GRID_PAGER,
- multiselect: true,
- loadComplete: function(data) {
- itp_fn_grid_load_complete(data, POMNG05010_GRID_ID, true, 'number', 'POMNG05010', listObj.itp_POMNG05010_search, listObj.empty, true, data.gridRecords, true);
- },
- onPaging: function(action) {
- itp_fn_grid_paging(POMNG05010_GRID_ID, action, param);
- }
- };
- itp_fn_grid_make_remote(option);
- }
- }
- };
|