123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273 |
- /********************************************************
- --------------------------------------------------------
- - Object 목록 -
- --------------------------------------------------------
- * const gridColModel = {} : 화면 Grid Object *
- * let pageObj = {} : 화면공통 Object *
- * let listObj = {} : 목록화면 Object *
- * let viewObj = {} : 상세화면 Object *
- * let modifyObj = {} : 수정화면 Object *
- * let createObj = {} : 신규화면 Object *
- * let locInfoObj = {} : 로케이션정보 Object *
- *******************************************************/
- /*화면 변수*/
- const STOCKMNG01010_GRID_ID = '#ITP_STOCKMNG01010_jqGrid';
- const STOCKMNG01010_GRID_LIST = '#ITP_STOCKMNG01010_jqGrid_list';
- const STOCKMNG01010_GRID_PAGER = '#ITP_STOCKMNG01010_jqGridPager';
- const STOCKMNG01010_GRID_EMPTY = '#ITP_STOCKMNG01010_jqGridEmpty';
- let ITP_FORM_STOCKMNG01010_DETAIL_IS_DUPLICATE = false;
- let ITP_FORM_STOCKMNG01010_DETAIL_IS_WRITING = false;
- let STOCKMNG01010_DETAIL_GRID_LAST_ROW_ID;
- /*API URL*/
- let STOCK_MNG_DETAIL_GRID_LIST = '/api/stock/mng/detail-grid-list';
- let WHS_MNG_ADD_WHS = '/api/whs/mng/add-whs';
- /*화면 Grid ColModel*/
- const gridColModel = {
- list: [
- {
- index: 'BRAND_ID', name: 'brandId',
- label: "브랜드ID",
- width: '0', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'STORE_ID', name: 'storeId',
- label: "매장ID",
- width: '0', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'BRAND_NM', name: 'brandNm',
- label: ITP_MSG_LOCALE.label.brandNm, //브랜드
- width: '13', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'STORE_NM', name: 'storeNm',
- label: "매장명",
- width: '13', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'WHS_ID', name: 'whsId',
- label: "창고번호",
- width: '8', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'WHS_NM', name: 'whsNm',
- label: "창고명",
- width: '13', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'WHS_ST_NM', name: 'whsStNm',
- label: ITP_MSG_LOCALE.label.status, //상태
- width: '6', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'MGR_NM', name: 'mgrNm',
- label: "담당자명",
- width: '8', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'MGR_TEL_NO', name: 'mgrTelNo',
- label: "연락처",
- width: '8', fixed: false, align: 'center',
- sortable: false, hidden: false
- }
- ]
- };
- require(['config'], function() {
- require([
- ], function($) {
- pageObj.init();
- });
- });
- /*화면공통 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('STOCKMNG01010');
-
- // 브랜드ID 지정
- var data = JSON.parse(sessionStorage.getItem('itp_manage_brand_cd'));
- $('#ITP_FORM_STOCKMNG01010_SEARCH_BRAND_ID').val(data.brandId);
-
- // 공통코드 표시
- // fn_make_select(CODE_LIST, 'WHS_DVSN', 'ITP_FORM_STOCKMNG01010_WHS_DVSN');
- // fn_make_select(CODE_LIST, 'WHS_ST_CD', 'ITP_FORM_STOCKMNG01010_WHS_ST_CD');
- // fn_make_select(CODE_LIST, 'WHS_ST_CD', 'ITP_FORM_STOCKMNG01010_DETAIL_WHS_ST_CD', true, '선택');
- // 조회일자 지정
- $('#ITP_TAB_STOCKMNG01010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
- },
- grid: function() {
- itp_fn_jqgrid_resize(STOCKMNG01010_GRID_ID, STOCKMNG01010_GRID_LIST, 'lg');
- listObj.empty.init();
- itp_fn_fire_window_resize();
- },
- 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_STOCKMNG01010_SRH' : listObj.button.search(); break; // 조회 버튼
- case 'ITP_BTN_STOCKMNG01010_ADDROW' : locInfoObj.button.addRow(); break; // 재고처리 버튼
- case 'ITP_BTN_STOCKMNG01010_DELROW' : locInfoObj.button.delRow(); break; // 재고이력 버튼
- }
- });
- });
- $('body').on('click', function(e) {
-
- });
- }
- },
- switchScreen: function(mode) {
- if(mode == 'LIST') { // 목록
- fn_show_btn_auth('#ITP_BTN_STOCKMNG01010_SRH');
- $('#ITP_AJAX_STOCKMNG01010_LIST_CONTAINER').show();
- }
- }
- };
- /*목록화면 Object*/
- let listObj = {
- init: function () {
- this.grid.init();
- },
- itp_STOCKMNG01010_search: false,
- button: {
- search: function() {
- listObj.itp_STOCKMNG01010_search = true;
- let param = $('#ITP_FORM_STOCKMNG01010_SEARCH').serializeObject();
- param.gridSize = $.jgrid.defaults.rowNum;
- param.gridPage = $.jgrid.defaults.page;
- $(STOCKMNG01010_GRID_ID).setGridParam({'postData': JSON.stringify(param)}).trigger('reloadGrid');
- },
- create: function() {
- pageObj.switchScreen('ADD');
- itp_fn_form_clear_validate(null, '#ITP_FORM_STOCKMNG01010_DETAIL');
- // 로케이션 리스트 조회
- createObj.init();
- }
- },
- empty: {
- init: function() {
- var _this = this;
- this.push();
- $(STOCKMNG01010_GRID_EMPTY).on('click', function() {
- _this.back();
- _this.itp_STOCKMNG01010_param.gridSize = $.jgrid.defaults.rowNum;
- $(STOCKMNG01010_GRID_ID).setGridParam({'postData': JSON.stringify(_this.itp_STOCKMNG01010_param)}).trigger('reloadGrid');
- });
- },
- itp_STOCKMNG01010_param: {},
- push: function() {
- let param = $('#ITP_FORM_STOCKMNG01010_SEARCH').serializeObject();
- listObj.itp_STOCKMNG01010_param = param;
- },
- back: function() {
- $('#ITP_FORM_STOCKMNG01010_DEVI_TP_CD').val(this.itp_STOCKMNG01010_param.deviTpCd);
- $('#ITP_FORM_STOCKMNG01010_ORDER_YN').val(this.itp_STOCKMNG01010_param.orderYn);
- $('#ITP_FORM_STOCKMNG01010_ADT_AUTH_CD').val(this.itp_STOCKMNG01010_param.adtAuthCd);
- $('#ITP_FORM_STOCKMNG01010_EMAIL_RCV_YN').val(this.itp_STOCKMNG01010_param.emailRcvYn);
- $('#ITP_FORM_STOCKMNG01010_MEMB_EXIT_DT').val(this.itp_STOCKMNG01010_param.membExitDt);
- $('#ITP_FORM_STOCKMNG01010_FROM_DT').val(this.itp_STOCKMNG01010_param.fromDt);
- $('#ITP_FORM_STOCKMNG01010_TO_DT').val(this.itp_STOCKMNG01010_param.toDt);
- $('#ITP_FORM_STOCKMNG01010_KEYWORD').val(this.itp_STOCKMNG01010_param.keyword);
- }
- },
- grid: {
- init: function () {
- // 데이터 없을때
- listObj.empty.push();
- this.search();
- },
- colModel: gridColModel.list,
- search: function() {
- pageObj.switchScreen('LIST');
- this.unload();
- this.load();
- },
- load: function() {
- var data = JSON.parse(sessionStorage.getItem('itp_manage_brand_cd'));
- $('#ITP_FORM_STOCKMNG01010_SEARCH_BRAND_ID').val(data.brandId);
-
- let param = $('#ITP_FORM_STOCKMNG01010_SEARCH').serializeObject();
- param.gridSize = $.jgrid.defaults.rowNum;
- var option = {
- gridId: STOCKMNG01010_GRID_ID,
- colModel: gridColModel.list,
- param: JSON.stringify(param),
- url: DOMAIN + STOCK_MNG_DETAIL_GRID_LIST,
- pager: STOCKMNG01010_GRID_PAGER,
- onCellSelect: function(rowId, cellIdx, cellValue) {
- var cm = $(this).jqGrid('getGridParam', 'colModel');
- var colNm = cm[cellIdx].name;
- if (colNm == 'whsNm') {
- const brandIdVal = $(this).jqGrid('getCell', rowId, 'brandId');
- const whsIdVal = $(this).jqGrid('getCell', rowId, 'whsId');
-
- const key = {brandId: brandIdVal, whsId: whsIdVal, viewCd: 'R'};
- var param = $.param(key);
- viewObj.init(param);
- }
- },
- loadComplete: function(data) {
- console.log(data);
- itp_fn_grid_load_complete(data, STOCKMNG01010_GRID_ID, true, 'number', 'STOCKMNG01010', listObj.itp_STOCKMNG01010_search, listObj.empty, true, data.gridRecords, true);
- var ids = $(STOCKMNG01010_GRID_ID).getDataIDs();
- $.each(ids, function(idx, rowId) {
- $(STOCKMNG01010_GRID_ID).jqGrid('setCell', rowId, 'whsNm', '', ITP_GRID_COL_STYLE.link);
- });
- },
- onPaging: function(action) {
- itp_fn_grid_paging(STOCKMNG01010_GRID_ID, action, param);
- }
- };
- itp_fn_grid_make_remote(option);
- },
- clearData : function() {
- $(STOCKMNG01010_GRID_ID).jqGrid('clearGridData', true);
- $(STOCKMNG01010_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
- $(STOCKMNG01010_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
- $(STOCKMNG01010_GRID_EMPTY).show();
- },
- unload : function() {
- $.jgrid.gridUnload(STOCKMNG01010_GRID_ID);
- }
- }
- };
|