123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682 |
- require(['config'], function() {
- require([
- ], function($) {
- pageObj.init();
- });
- });
- //화면변수
- const RTNMNG04010_GRID_ID = '#ITP_RTNMNG04010_jqGrid';
- const RTNMNG04010_GRID_LIST = '#ITP_RTNMNG04010_jqGrid_list';
- const RTNMNG04010_GRID_PAGER = '#ITP_RTNMNG04010_jqGridPager';
- const RTNMNG04010_GRID_EMPTY = '#ITP_RTNMNG04010_jqGridEmpty';
- const RTNMNG04010_DETAIL_GRID_ID = '#ITP_RTNMNG04010_DETAIL_jqGrid';
- const RTNMNG04010_DETAIL_GRID_LIST = '#ITP_RTNMNG04010_DETAIL_jqGrid_list';
- const RTNMNG04010_DETAIL_GRID_PAGER = '#ITP_RTNMNG04010_DETAIL_jqGridPager';
- const RTNMNG04010_DETAIL_GRID_EMPTY = '#ITP_RTNMNG04010_DETAIL_jqGridEmpty';
- let ITP_PODR_DTL_ST_CD = fn_make_common_cd_list(CODE_LIST, 'PODR_DTL_ST_CD', true, '구매발주상세상태코드');
- //[grid]
- //API URL
- let API_RTNMNG_RTN_DETAIL_GRID_LIST = '/api/rtnmng/rtn/detail-grid-list';
- let API_RTNMNG_RTN_INFO_RTNODR = '/api/rtnmng/rtn/info-rtnOdr';
- let API_RTNMNG_RTN_CANCEL_RTNPO = '/api/rtnmng/rtn/cancel-rtnPo';
- //화면 grid ColModel
- const gridColModel = {
- list:[
- {
- index: 'VIEW_CD', name: 'viewCd',
- label: ITP_MSG_LOCALE.label.viewCd,
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'RTN_PODR_UNQ_NO', name: 'rtnPodrUnqNo',
- label: '반품발주번호',
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'RTN_ODR_ST_NM', name: 'rtnOdrStNm',
- label: '발주상태',
- width: '7', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'RTN_ODR_REG_DT', name: 'rtnOdrRegDt',
- label: '반품발주일자',
- width: '8', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'RTN_WHS_NM', name: 'rtnWhsNm',
- label: '수거창고',
- width: '9', fixed: false, align: 'left',
- sortable: false, hidden: false, classes: 'ui-ellipsis'
- },
- {
- index: 'SPPLY_NM', name: 'spplyNm',
- label: ITP_MSG_LOCALE.label.spplyNm, // 공급업체명
- width: '10', fixed: false, align: 'left',
- sortable: false, hidden: false, classes: 'ui-ellipsis'
- },
- {
- index: 'RTN_DODR_TOTAL_AMT', name: 'rtnDodrTotalAmt',
- label: '총 반품발주금액',
- width: '8', fixed: false, align: 'right',
- sortable: false, hidden: false,
- formatter: 'integer', formatoptions: {thousandsSeparator: ','}
- },
- {
- index: 'rtn_Dodr_Item_Qty', name: 'rtnDodrItemQty',
- label: '반품발주품목수',
- width: '8', fixed: false, align: 'right',
- sortable: false, hidden: false,
- formatter: 'integer', formatoptions: {thousandsSeparator: ','}
- },
- {
- index: 'COL_REQ_DT', name: 'colReqDt',
- label: '수거요청일',
- width: '8', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'col_Dvsn_Nm', name: 'colDvsnNm',
- label: '수거구분',
- width: '7', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'BRAND_NM', name: 'brandNm',
- label: ITP_MSG_LOCALE.label.brandNm, // 브랜드명
- width: '9', fixed: false, align: 'left',
- sortable: false, hidden: false, classes: 'ui-ellipsis'
- }
- ],
- view: [],
- detail: [
- {
- index: 'VIEW_CD', name: 'viewCd',
- label: ITP_MSG_LOCALE.label.viewCd,
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'RTN_PODR_DTL_NO', name: 'rtnPodrDtlNo',
- label: ITP_MSG_LOCALE.label.pchPodrDtlNo, // 발주항번
- width: '4', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'ITEM_ID', name: 'itemId',
- label: ITP_MSG_LOCALE.label.itemId, // 품목번호
- width: '8', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'ITEM_NM', name: 'itemNm',
- label: ITP_MSG_LOCALE.label.itemNm, // 품목명
- width: '10', fixed: false, align: 'left',
- sortable: false, hidden: false, classes: 'ui-ellipsis'
- },
- {
- index: 'RODR_DTL_ST_NM', name: 'rodrDtlStNm',
- label: '발주상세상태',
- width: '5', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'UNIT_AMT', name: 'unitAmt',
- label: ITP_MSG_LOCALE.label.unitAmt, // 단가
- width: '5', fixed: false, align: 'right',
- sortable: false, hidden: false,
- formatter: 'integer', formatoptions: {thousandsSeparator: ','}
- },
- {
- index: 'UNIT', name: 'unit',
- label: ITP_MSG_LOCALE.label.unit, // 기본단위
- width: '4', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'RTN_REQ_QTY', name: 'rtnReqQty',
- label: '반품요청수량',
- width: '5', fixed: false, align: 'right',
- sortable: false, hidden: false,
- formatter: 'integer', formatoptions: {thousandsSeparator: ','}
- },
- {
- index: 'RTN_ODR_QTY', name: 'rtnOdrQty',
- label: '반품발주수량',
- width: '5', fixed: false, align: 'right',
- sortable: false, hidden: false,
- formatter: 'integer', formatoptions: {thousandsSeparator: ','}
- },
- {
- index: 'RTN_ODR_AMT', name: 'rtnOdrAmt',
- label: ITP_MSG_LOCALE.label.podrAmt, // 발주금액
- width: '6', fixed: false, align: 'right',
- sortable: false, hidden: false,
- formatter: 'integer', formatoptions: {thousandsSeparator: ','}
- }
- ]
- };
- /*화면공통 Object*/
- let pageObj = {
- init: function() {
- this.ui.init();
- this.event.init();
- },
- ui: {
- init: function() {
- this.view();
- this.grid();
- this.ready();
- },
- view: function() {
- // 버튼 권한설정
- fn_proc_btn_auth('RTNMNG04010');
- // 공통코드 표시
- $('select').each(function() {
- if($(this).data('select-code')) {
- fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
- }
- });
- // 조회일자 지정
- var now = new Date();
- var fromDate = new Date(now);
- fromDate.setDate(now.getDate() - 7);
- var toDate = new Date(now);
- $('#ITP_FORM_RTNMNG04010_SEARCH_FROM_DT').val(itp_fn_get_before_month() );
- $('#ITP_FORM_RTNMNG04010_SEARCH_TO_DT').val(itp_fn_get_today_ko() );
- $('#ITP_TAB_RTNMNG04010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
- $('#ITP_FORM_RTNMNG04010_SEARCH_FROM_DT').datepicker();
- $('#ITP_FORM_RTNMNG04010_SEARCH_TO_DT').datepicker();
- },
- grid: function() {
-
- listObj.empty.init();
-
- },
- ready: function() {
- listObj.init();
- }
- },
- event: {
- init: function() {
- this.button();
- },
- button: function() {
- // 버튼 클릭 이벤트
- $('button').each(function() {
- var id = $(this).attr('id');
- $(this).on('click', function() {
- switch (id) {
- case 'ITP_BTN_RTNMNG04010_SRH' : listObj.button.search(); break; // 조회 버튼 클릭
- case 'ITP_BTN_RTNMNG04010_NEWREG' : listObj.button.create(); break; // 신규등록 버튼
- case 'ITP_BTN_RTNMNG04010_MODIFY' : modifyObj.button.modify(); break; // 수정 버튼
- case 'ITP_BTN_RTNMNG04010_CANCELLIST' : modifyObj.button.cancel(); break; // 취소/목록 버튼
- case 'ITP_BTN_RTNMNG04010_RTNCANCEL' : modifyObj.button.del(); break; // 발주 취소 버튼(예정)
- case 'ITP_BTN_RTNMNG04010_EXCEL' : listObj.excelDown(); break; // 엑셀 다운로드
- }
- });
- });
- }
- },
- switchScreen: function(mode) {
- $('.itp_det_head').find('button[id^="ITP_BTN_RTNMNG04010_"]').each(function(i) {
- $(this).hide();
- });
- $('#ITP_TAB_RTNMNG04010').find('div[id$="_CONTAINER"]').each(function(i) {
- $(this).hide();
- });
- if(mode == 'LIST') { // 목록
- itp_fn_fire_window_resize();
- fn_show_btn_auth_array(['#ITP_BTN_RTNMNG04010_SRH', '#ITP_BTN_RTNMNG04010_NEWREG']);
- $('#ITP_AJAX_RTNMNG04010_LIST_CONTAINER').show();
- $('#ITP_FORM_RTNMNG04010_SEARCH #ITP_FORM_RTNMNG04010_SEARCH_BRAND_ID').val(fn_make_user_info.get('brandId'));
- $('#ITP_BTN_RTNMNG04010_SEARCH_SPPLY_ID').show();
- $('#ITP_BTN_RTNMNG04010_DELETE_SPPLY_ID').show();
- $('#ITP_BTN_RTNMNG04010_SEARCH_WHS_ID').show();
- $('#ITP_BTN_RTNMNG04010_SEARCH_DEL_SWHS_NM').show();
- $('#ITP_BTN_RTNMNG04010_SEARCH_DEL_SRTN_WHS_NM').show();
- $('#ITP_BTN_RTNMNG04010_SEARCH_DEL_SSPPLY_NM').show();
- $('#ITP_BTN_RTNMNG04010_EXCEL').show();
-
- } else if(mode == 'MODIFY') { // 수정
- $('#ITP_AJAX_RTNMNG04010_DETAIL_CONTAINER').show();
- fn_show_btn_auth_array(['#ITP_BTN_RTNMNG04010_CANCELLIST', '#ITP_BTN_RTNMNG04010_RTNCANCEL']);
- $('#ITP_BTN_RTNMNG04010_CANCELLIST').show();
- $('#ITP_BTN_RTNMNG04010_DELETE').show();
-
- $('#ITP_FORM_RTNMNG04010_DETAIL_BRAND_ID').attr('readonly', true);
- $('#ITP_FORM_RTNMNG04010_DETAIL_BRAND_NM').attr('readonly', true);
- $('#ITP_FORM_RTNMNG04010_DETAIL_BSNS_REG_NO').attr('readonly', true);
- $('#ITP_FORM_RTNMNG04010_DETAIL_CORP_REG_NO').attr('readonly', true);
- $('#ITP_FORM_RTNMNG04010_DETAIL_SEARCH_AFFL_SHOP').hide();
- $('#ITP_FORM_RTNMNG04010_DETAIL_DELETE_AFFL_SHOP').hide();
- $('#ITP_FORM_RTNMNG04010_DETAIL .itp_form_info').show();
- $('#ITP_FORM_RTNMNG04010_DETAIL .itp_form_change').hide();
- $('#ITP_FORM_RTNMNG04010_DETAIL #ITP_FORM_RTNMNG04010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
- }
- }
- };
- /*목록화면 Object*/
- let listObj = {
- init: function() {
- this.grid.init();
- this.action();
- },
- itp_RTNMNG04010_param: {},
- itp_RTNMNG04010_search: false,
- button: {
- search: function() {
- listObj.itp_RTNMNG04010_search = true;
- let param = $('#ITP_FORM_RTNMNG04010_SEARCH').serializeObject();
- param.gridSize = $.jgrid.defaults.rowNum;
- param.gridPage = $.jgrid.defaults.page;
- param.sidx = '';
- $(RTNMNG04010_GRID_ID).data('grid-param',param);
- $(RTNMNG04010_GRID_ID).setGridParam({'postData': JSON.stringify(param)}).trigger('reloadGrid');
- }
- },
- empty: {
- init: function() {
- var _this = this;
- this.push();
- $(RTNMNG04010_GRID_EMPTY).on('click', function() {
- _this.back();
- listObj.itp_RTNMNG04010_param.gridSize = $.jgrid.defaults.rowNum;
- $(RTNMNG04010_GRID_ID).setGridParam({'postData': JSON.stringify(listObj.itp_RTNMNG04010_param)}).trigger('reloadGrid');
- });
- },
- push: function() {
- let param = $('#ITP_FORM_RTNMNG04010_SEARCH').serializeObject();
- listObj.itp_RTNMNG04010_param = param;
- param.sidx = '';
- },
- back: function() {
- $('#ITP_FORM_RTNMNG04010_SERVICE_BRAND_TYPE').val(listObj.itp_RTNMNG04010_param.brandType);
- $('#ITP_FORM_RTNMNG04010_SERVICE_ST_CD').val(listObj.itp_RTNMNG04010_param.stCd);
- $('#ITP_FORM_RTNMNG04010_SEARCH_BRAND_NM').val(listObj.itp_RTNMNG04010_param.brandNm);
- }
- },
- grid: {
- init: function() {
- // 데이터 없을때
- itp_fn_jqgrid_resize(RTNMNG04010_GRID_ID, RTNMNG04010_GRID_LIST, 'lg');
- listObj.empty.push();
- this.search();
- },
- colModel: gridColModel.list,
- search: function() {
- pageObj.switchScreen('LIST');
- this.unload();
- this.load();
- },
- load: function() {
- let param = $('#ITP_FORM_RTNMNG04010_SEARCH').serializeObject();
- param.gridSize = $.jgrid.defaults.rowNum;
- param.sidx = '';
- var option = {
- gridId: RTNMNG04010_GRID_ID,
- colModel: gridColModel.list,
- param: param,
- url: DOMAIN + API_RTNMNG_RTN_DETAIL_GRID_LIST,
- pager: RTNMNG04010_GRID_PAGER,
- onCellSelect: function(rowId, cellIdx, cellValue) {
- var cm = $(this).jqGrid('getGridParam', 'colModel');
- var colNm = cm[cellIdx].name;
- if (colNm === 'rtnPodrUnqNo') {
- const rtnPodrUnqNoVal = $(this).jqGrid('getCell', rowId, 'rtnPodrUnqNo');
- const brandIdVal = $(this).jqGrid('getCell', rowId, 'brandId');
- const key = {rtnPodrUnqNo: rtnPodrUnqNoVal, brandId: brandIdVal};
- var param = $.param(key);
- modifyObj.init(param);
- }
- },
- loadComplete: function(data) {
- itp_fn_grid_load_complete(data, RTNMNG04010_GRID_ID, true, 'number', 'RTNMNG04010', listObj.itp_RTNMNG04010_search, listObj.empty, true, data.gridRecords, true);
- var ids = $(RTNMNG04010_GRID_ID).getDataIDs();
- $.each(ids, function(idx, rowId) {
- $(RTNMNG04010_GRID_ID).jqGrid('setCell', rowId, 'rtnPodrUnqNo', '', ITP_GRID_COL_STYLE.link);
- });
- const self=this;
- if(self.sortUse) return;
- self.sortUse=true;
- self['sort2']='desc';
- const th=$(RTNMNG04010_GRID_LIST).find('.ui-jqgrid-labels .ui-th-div').eq(2);
- th.find('.s-ico').show();
- th.find('.ui-grid-ico-sort').hide();
- th.find('.glyphicon-triangle-top').show();//asc 는 bottom 으로
- //$(RTNMNG04010_GRID_LIST).find('.ui-jqgrid-labels .ui-th-div').css('cursor','default');
- $(RTNMNG04010_GRID_LIST).find('th').eq(2).css({cursor:'pointer',background:'#FFEBCD'});
- $(RTNMNG04010_GRID_LIST).find('th').eq(4).css({cursor:'pointer',background:'#FFEBCD'});
- $(RTNMNG04010_GRID_LIST).find('th').eq(9).css({cursor:'pointer',background:'#FFEBCD'});
- $(RTNMNG04010_GRID_LIST).find('.ui-jqgrid-labels>th').on('click', function() {
- const idx=$(this).index();
- console.log("xxxx grid header click xxxxxxx index=="+idx, param );
- if(idx==2 || idx==4 || idx==9) {
- var field='',sort=self['sort'+idx];
- if(sort ) {
- sort=sort=='asc'?'desc':'asc';
- } else {
- // 등록일 내림차순, 제목 오름차순
- sort=idx==2? 'asc':idx==4? 'desc': 'asc';
- }
- const icon=sort=='asc'? '.glyphicon-triangle-bottom': '.glyphicon-triangle-top';
- self['sort'+idx]=sort;
- if(idx==2) {
- field='rtnPodrUnqNo';
- } else if(idx==4) {
- field='colReqDt';
- } else if(idx==9) {
- field='rtnOdrRegDt';
- }
- param.page=1;
- param.sidx=field;
- param.sord=sort;
-
- $(RTNMNG04010_GRID_ID).jqGrid('setGridParam',{
- postData:JSON.stringify(param)
- }).trigger('reloadGrid');
- $(this).find('.s-ico').show();
- $(this).find('.ui-grid-ico-sort').hide();
- $(this).find(icon).show();
- }
- });
- },
- onPaging: function(action) {
- itp_fn_grid_paging(RTNMNG04010_GRID_ID, action, param);
- }
- };
- itp_fn_grid_make_remote(option);
- },
- clearData: function() {
- $(RTNMNG04010_GRID_ID).jqGrid('clearGridData', true);
- $(RTNMNG04010_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
- $(RTNMNG04010_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
- $(RTNMNG04010_GRID_EMPTY).show();
- },
- unload: function() {
- $.jgrid.gridUnload(RTNMNG04010_GRID_ID);
- }
- },
- action: function() {
- var _this = this;
- // 매장/창고 조회 버튼 클릭
- $('#ITP_BTN_RTNMNG04010_SEARCH_POP_SWHS_NM').on('click', function() {
- _this.popup('whs');
- });
- // 매장/창고 텍스트 삭제 버튼 클릭
- $('#ITP_BTN_RTNMNG04010_SEARCH_DEL_SWHS_NM').on('click', function() {
- $('#ITP_FORM_RTNMNG04010_SEARCH_SWHS_NM').val('');
- $('#ITP_FORM_RTNMNG04010_SEARCH_SWHS_ID').val('');
- });
-
- // 매장/창고 조회 버튼 클릭
- $('#ITP_BTN_RTNMNG04010_SEARCH_POP_SRTN_WHS_NM').on('click', function() {
- _this.popup('rwhs');
- });
- // 매장/창고 텍스트 삭제 버튼 클릭
- $('#ITP_BTN_RTNMNG04010_SEARCH_DEL_SRTN_WHS_NM').on('click', function() {
- $('#ITP_FORM_RTNMNG04010_SEARCH_SRTN_WHS_NM').val('');
- $('#ITP_FORM_RTNMNG04010_SEARCH_SRTN_WHS_ID').val('');
- });
-
- // 공급업체 조회 버튼 클릭
- $('#ITP_BTN_RTNMNG04010_SEARCH_POP_SSPPLY_NM').on('click', function() {
- _this.popup('spply');
- });
- // 공급업체 텍스트 삭제 버튼 클릭
- $('#ITP_BTN_RTNMNG04010_SEARCH_DEL_SSPPLY_NM').on('click', function() {
- $('#ITP_FORM_RTNMNG04010_SEARCH_SSPPLY_NM').val('');
- $('#ITP_FORM_RTNMNG04010_SEARCH_SSPPLY_ID').val('');
- });
-
- },
- popup: function(keyword) {
- if(keyword === 'spply'){
- var popFn = this.callback.spply;
- const key = {brandId:fn_make_user_info.get('brandId'),storeId:fn_make_user_info.get('storeId')};
- fn_call_popup('biz', 'BIZPOP_STORE_SPPLY', '#ITP_ASIDE', popFn, key, 'S');
- } else if(keyword === 'whs'){
- var popFn = this.callback.whs;
- const key1 = {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, key1, 'S');
- } else if(keyword === 'rwhs'){
- var popFn = this.callback.rwhs;
- const key1 = {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, key1, 'S');
- }
- },
- callback: {
- whs: function(rowDataPop) {
- $('#ITP_FORM_RTNMNG04010_SEARCH_SWHS_NM').val(rowDataPop.whsNm);
- $('#ITP_FORM_RTNMNG04010_SEARCH_SWHS_ID').val(rowDataPop.whsId);
- },
- rwhs: function(rowDataPop) {
- $('#ITP_FORM_RTNMNG04010_SEARCH_SRTN_WHS_NM').val(rowDataPop.whsNm);
- $('#ITP_FORM_RTNMNG04010_SEARCH_SRTN_WHS_ID').val(rowDataPop.whsId);
- },
- spply: function(rowDataPop) {
- $('#ITP_FORM_RTNMNG04010_SEARCH_SSPPLY_NM').val(rowDataPop.spplyNm);
- $('#ITP_FORM_RTNMNG04010_SEARCH_SSPPLY_ID').val(rowDataPop.spplyId);
- }
- },
- excelDown: function() {
- var param = {
- 'url': API_RTNMNG_RTN_DETAIL_GRID_LIST,
- 'param': $('#ITP_FORM_RTNMNG04010_SEARCH').serializeObject(),
- 'gridColumns': $(RTNMNG04010_GRID_ID).jqGrid('getGridParam', 'colModel'),
- 'fileName': '반품발주현황.xlsx',
- 'sheetName': '반품발주현황리스트'
- };
- itp_fn_remote_to_excel(param);
- }
- };
- /*수정화면 Object*/
- let modifyObj = {
- init: function(param) {
- this.load(param);
- },
- itp_RTNMNG04010_param: {},
- itp_RTNMNG04010_search: false,
- button: {
- cancel: function() {
- listObj.grid.search();
- },
- del: function() {
-
- var modalFn = {
- callBack: () => {
- var param = {brandId: $('#ITP_FORM_RTNMNG04010_DETAIL_BRAND_ID').val(), rtnPodrUnqNo: $('#ITP_FORM_RTNMNG04010_DETAIL_RTN_PODR_UNQ_NO').val()};
- var searhFn = function () {
- listObj.grid.search();
- }
- fn_ajax_call(API_RTNMNG_RTN_CANCEL_RTNPO, JSON.stringify(param), searhFn, 'POST');
- }
- };
- itp_fn_modal_confirm('반품발주를 취소 하시겠습니까?', modalFn);
- }
- },
- empty: {
- init: function() {
- var _this = this;
- this.push();
- $(RTNMNG04010_VIEW_GRID_EMPTY).on('click', function() {
- _this.back();
- viewObj.itp_RTNMNG04010_param.gridSize = $.jgrid.defaults.rowNum;
- $(RTNMNG04010_GRID_ID).setGridParam({'postData': JSON.stringify(viewObj.itp_RTNMNG04010_param)}).trigger('reloadGrid');
- });
- },
- push: function() {
- let param = $('#ITP_FORM_RTNMNG04010_DETAIL').serializeObject();
- viewObj.itp_RTNMNG04010_param = param;
- },
- back: function() {
- $('#ITP_FORM_RTNMNG04010_SERVICE_BRAND_TYPE').val(viewObj.itp_RTNMNG04010_param.brandType);
- $('#ITP_FORM_RTNMNG04010_SERVICE_ST_CD').val(viewObj.itp_RTNMNG04010_param.stCd);
- $('#ITP_FORM_RTNMNG04010_SEARCH_BRAND_NM').val(viewObj.itp_RTNMNG04010_param.brandNm);
- }
- },
- load: function(param) {
- fn_ajax_call(API_RTNMNG_RTN_INFO_RTNODR, param, this.callback, 'GET');
- },
- callback: function(result) {
-
- // 그리드 전화번호 '-' 함수
- let telNo = '';
- if(result.rtnMgrTelNo != '') {
- function convertTel(value){
- answer = (value.startsWith('0')) ? value.replace(/[^0-9]/g, "")
- .replace(/(^02|^0505|^1[0-9]{3}|^0[0-9]{2})([0-9]+)?([0-9]{4})$/,"$1-$2-$3")
- .replace("--", "-") : '';
- return answer;
- }
- telNo = convertTel(result.rtnMgrTelNo);
- }
-
- pageObj.switchScreen('MODIFY');
- $('#ITP_FORM_RTNMNG04010_DETAIL #ITP_FORM_RTNMNG04010_DETAIL_BRAND_ID').val(result.brandId);
- $('#ITP_FORM_RTNMNG04010_DETAIL #ITP_FORM_RTNMNG04010_DETAIL_RTN_PODR_UNQ_NO').val(result.rtnPodrUnqNo);
- $('#ITP_FORM_RTNMNG04010_DETAIL #ITP_FORM_RTNMNG04010_DETAIL_RTN_ODR_ST_CD').val(result.rtnOdrStCd);
-
- $('#ITP_FORM_RTNMNG04010_DETAIL .fnBrandNm').text(result.brandNm);
- $('#ITP_FORM_RTNMNG04010_DETAIL .fnRtnPodrUnqNo').text(result.rtnPodrUnqNo + ' / ' + result.rtnOdrStNm);
- $('#ITP_FORM_RTNMNG04010_DETAIL .fnColPlace').text(result.rtnWhsNm + ' - ' + result.rtnLocationNm);
- $('#ITP_FORM_RTNMNG04010_DETAIL .fnWhsNm').text(result.whsNm + ' - ' + result.locationNm);
- $('#ITP_FORM_RTNMNG04010_DETAIL .fnSpplyNm').text(result.spplyNm);
- $('#ITP_FORM_RTNMNG04010_DETAIL .fnRtnOdrRegDt').text(result.rtnOdrRegDt);
- $('#ITP_FORM_RTNMNG04010_DETAIL .fnPodrMgrNm').text(result.rtnMgrNm);
- $('#ITP_FORM_RTNMNG04010_DETAIL .fnPodrMgrTelNo').text(telNo);
- $('#ITP_FORM_RTNMNG04010_DETAIL .fnColDvsnNm').text(result.colDvsnNm);
- $('#ITP_FORM_RTNMNG04010_DETAIL .fnRtnDodrTotalAmt').text(itp_fn_number_comma(result.rtnDodrTotalAmt));
-
- if('RO20' == result.rtnOdrStCd) { // 반품발주요청
- $('#ITP_BTN_RTNMNG04010_RTNCANCEL').show();
- } else {
- $('#ITP_BTN_RTNMNG04010_RTNCANCEL').hide();
- }
-
- modifyObj.grid.init('MODIFY', result.rtnOdrDtlList)
-
- },
- grid: {
- init: function(mode, gridData) {
- this.mode = mode;
- this.gridId = (mode === 'VIEW') ? RTNMNG04010_VIEW_GRID_ID : RTNMNG04010_DETAIL_GRID_ID;
- this.gridList = (mode === 'VIEW') ? RTNMNG04010_VIEW_GRID_LIST : RTNMNG04010_DETAIL_GRID_LIST;
- this.gridEmpty = (mode === 'VIEW') ? RTNMNG04010_VIEW_GRID_EMPTY : RTNMNG04010_DETAIL_GRID_EMPTY;
- itp_fn_jqgrid_resize(this.gridId, this.gridList, 'lg');
- this.unload();
- this.load(mode, gridData);
- },
- mode: '',
- colModel: gridColModel.view,
- load: function(mode, gridData) {
- var _this = this;
- var option = {
- gridId: _this.gridId,
- colModel: gridColModel.detail,
- data: gridData,
- // multiselect: true,
- onSelectRow: function(index, status) {
- if(index) {
- var row = $(RTNMNG04010_DETAIL_GRID_ID).jqGrid('getRowData', index);
- if(row.podrDtlStCd == 'POD2') {
- $("#jqg_ITP_RTNMNG04010_DETAIL_jqGrid_" + index).prop("checked", false);
- }
- }
- },
- onSelectAll: function(rowIds, status) {
- for(let i = 0; i < rowIds.length; i++){
- let podrDtlStCd = $(RTNMNG04010_DETAIL_GRID_ID).getCell(rowIds[i], 'podrDtlStCd');
- if(podrDtlStCd == 'POD2') {
- $("#jqg_ITP_RTNMNG04010_DETAIL_jqGrid_" + rowIds[i]).prop("checked", false);
- } else {
- $("#jqg_ITP_RTNMNG04010_DETAIL_jqGrid_" + rowIds[i]).prop("checked", status);
- }
- }
- },
- loadComplete: function(data) {
- let datas = data.rows;
- for(let i = 0; i < datas.length; i++) {
- let podrDtlStCd = datas[i].podrDtlStCd;
- if(podrDtlStCd == 'POD2') {
- $('#jqg_ITP_RTNMNG04010_DETAIL_jqGrid_' + (i + 1)).attr('disabled', true);
- }
- }
- itp_fn_grid_load_complete(data, RTNMNG04010_DETAIL_GRID_ID, true, 'number', 'RTNMNG04010', modifyObj.itp_RTNMNG04010_search, modifyObj.empty, true, data.gridRecords, true);
- const self=this;
- if(self.sortUse) return;
- self.sortUse=true;
- self['sort1']='asc';
- const th=$(RTNMNG04010_DETAIL_GRID_LIST).find('.ui-jqgrid-labels .ui-th-div').eq(1);
- th.find('.s-ico').show();
- th.find('.ui-grid-ico-sort').hide();
- th.find('.glyphicon-triangle-bottom').show();//asc 는 bottom 으로
- //$(RTNMNG04010_DETAIL_GRID_LIST).find('.ui-jqgrid-labels .ui-th-div').css('cursor','default');
- $(RTNMNG04010_DETAIL_GRID_LIST).find('th').eq(1).css({cursor:'pointer',background:'#FFEBCD'});
- $(RTNMNG04010_DETAIL_GRID_LIST).find('.ui-jqgrid-labels>th').on('click', function() {
- const idx=$(this).index();
- console.log("xxxx grid header click xxxxxxx index=="+idx, param );
- if(idx==1 ) {
- var field='',sort=self['sort'+idx];
- if(sort ) {
- sort=sort=='asc'?'desc':'asc';
- } else {
- // 등록일 내림차순, 제목 오름차순
- sort=idx==1? 'asc':idx==2? 'desc': 'asc';
- }
- const icon=sort=='asc'? '.glyphicon-triangle-bottom': '.glyphicon-triangle-top';
- self['sort'+idx]=sort;
- if(idx==1) {
- field='rtnReqUnqNo';
- }
- param.page=1;
- param.sidx=field;
- param.sord=sort;
-
- $(RTNMNG04010_DETAIL_GRID_ID).jqGrid('setGridParam',{
- postData:JSON.stringify(param)
- }).trigger('reloadGrid');
- $(this).find('.s-ico').show();
- $(this).find('.ui-grid-ico-sort').hide();
- $(this).find(icon).show();
- }
- });
- }
- };
- itp_fn_grid_make_local(option);
- },
- unload: function() {
- $.jgrid.gridUnload(this.gridId);
- }
- },
- isValid: function(formId) {
- var isValid = false;
- $(formId).find('input, select, checkbox, textarea').each(function(k) {
- if($(this).data('check-required')) {
- var arry = $(this).data('check-required').split(',');
- isValid = itp_fn_form_validate(formId, '#' + $(this).attr('id'), arry, undefined);
- if(!isValid) return false;
- }
- });
- return isValid;
- },
- };
|