123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629 |
- 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 STINFO06010_GRID_ID = '#ITP_STINFO06010_jqGrid';
- const STINFO06010_GRID_LIST = '#ITP_STINFO06010_jqGrid_list';
- const STINFO06010_GRID_PAGER = '#ITP_STINFO06010_jqGridPager';
- const STINFO06010_GRID_EMPTY = '#ITP_STINFO06010_jqGridEmpty';
- const STINFO06010_DETAIL_GRID_ID = '#ITP_STINFO06010_DETAIL_jqGrid';
- const STINFO06010_DETAIL_GRID_LIST = '#ITP_STINFO06010_DETAIL_jqGrid_list';
- const STINFO06010_DETAIL_GRID_PAGER = '#ITP_STINFO06010_DETAIL_jqGridPager';
- const STINFO06010_DETAIL_GRID_EMPTY = '#ITP_STINFO06010_DETAIL_jqGridEmpty';
- let STINFO06010_GRID_LAST_ROW_ID;
- /* 공통코드 리스트 */
- let ITP_COMMON_CD_DSTRBT_COST_UNIT = fn_make_common_cd_list(CODE_LIST, 'DSTRBT_COST_UNIT', true, '기본단위');
- let ITP_COMMON_CD_CURR = fn_make_common_cd_list(CODE_LIST, 'CURR', true, '통화');
- let ITP_COMMON_CD_UNIT_TARGET_CD = fn_make_common_cd_list(CODE_LIST, 'UNIT_TARGET_CD', true, '대상여부');
- /*API URL*/
- let API_DETAIL_GRID_LIST = '/api/itemunit/store-unit-grid-list'; // 목록
- let API_DETAIL_INFO = '/api/itemunit/info-storeitemunit'; // 상세
- let API_DETAIL_NEW = '/api/itemunit/new-info-storeitemunit'; // 신규
- let API_DETAIL_SAVE = '/api/itemunit/save-store-itemunit'; // 저장
- /*화면 Grid ColModel*/
- const gridColModel = {
- list: [
- {
- index: 'BRAND_ID', name: 'brandId',
- label: ITP_MSG_LOCALE.label.brandId, //브랜드ID
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'STORE_ID', name: 'storeId',
- label: ITP_MSG_LOCALE.label.storeId, //매장ID
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'STORE_NM', name: 'storeNm',
- label: ITP_MSG_LOCALE.label.storeNm, //매장명
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'CONT_STT_DT', name: 'contSttDt',
- label: ITP_MSG_LOCALE.label.contSttDt, //계약시작일
- width: '15', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'CONT_END_DT', name: 'contEndDt',
- label: ITP_MSG_LOCALE.label.contEndDt, //계약종료일
- width: '6', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'SYS_REG_DTTM', name: 'sysRegDttm',
- label: ITP_MSG_LOCALE.label.sysRegDt, //계약생성일
- width: '6', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'ITEM_CNT', name: 'itemCnt',
- label: ITP_MSG_LOCALE.label.itemCnt, //계약품목수
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: false
- }
- ],
- detail: [
- {
- index: 'VIEW_CD', name: 'viewCd',
- label: ITP_MSG_LOCALE.label.brandId, //공급단가
- width: '6', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'BRAND_ID', name: 'brandId',
- label: ITP_MSG_LOCALE.label.brandId, //브랜드ID
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'BRAND_UNIT_UNQ_NO', name: 'brandUnitUnqNo',
- label: ITP_MSG_LOCALE.label.brandId, //브랜드ID
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'STORE_UNIT_UNQ_NO', name: 'storeUnitUnqNo',
- label: ITP_MSG_LOCALE.label.storeId, //브랜드ID
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'ITEM_ID', name: 'itemId',
- label: ITP_MSG_LOCALE.label.itemId, //품목번호
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'ITEM_NM', name: 'itemNm',
- label: ITP_MSG_LOCALE.label.itemNm, //품목명
- width: '13', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'CONT_STT_DT', name: 'contSttDt',
- label: ITP_MSG_LOCALE.label.contSttDt, //계약시작일
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'CONT_END_DT', name: 'contEndDt',
- label: ITP_MSG_LOCALE.label.contEndDt, //계약종료일
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'UNIT', name: 'unit',
- label: ITP_MSG_LOCALE.label.unit, //기본단위
- width: '9', fixed: false, align: 'center',
- sortable: false, editable: true, formatter: 'select', edittype: 'select',
- editoptions: {value: ITP_COMMON_CD_DSTRBT_COST_UNIT},
- editrules: {required: true}
- },
- {
- index: 'STDD_QYT', name: 'stddQty',
- label: ITP_MSG_LOCALE.label.stddQty, //기준수량
- width: '6', fixed: false, align: 'center',
- sortable: true, editable: true, edittype: 'text',
- editrules: {required: true}
- },
- {
- index: 'CURR', name: 'curr',
- label: ITP_MSG_LOCALE.label.curr, //통화
- width: '9', fixed: false, align: 'center',
- sortable: false, editable: true, formatter: 'select', edittype: 'select',
- editoptions: {value: ITP_COMMON_CD_CURR},
- editrules: {required: true}
- },
- {
- index: 'UNIT_AMT', name: 'unitAmt',
- label: ITP_MSG_LOCALE.label.unitAmt, //단가
- width: '10', fixed: false, align: 'center',
- sortable: true, editable: true, edittype: 'text',
- editrules: {required: true}
- },
- {
- index: 'UNIT_TARGET_CD', name: 'unitTargetCd',
- label: ITP_MSG_LOCALE.label.unitTargetCd, //대상여부
- width: '10', fixed: false, align: 'center',
- sortable: false, editable: true, formatter: 'select', edittype: 'select',
- editoptions: {value: ITP_COMMON_CD_UNIT_TARGET_CD},
- editrules: {required: true}
- },
- {
- index: 'SPPLY_UNIT_AMT', name: 'spplyUnitAmt',
- label: ITP_MSG_LOCALE.label.spplyUnitAmt, //공급단가
- width: '6', fixed: false, align: 'center',
- sortable: false, hidden: false
- }
- ]
- };
- /*화면공통 Object*/
- let pageObj = {
- init: function () {
- this.ui.init();
- this.event.init();
- },
- screenMode: 'LIST',
- ui: {
- init: function () {
- this.view();
- this.grid();
- this.ready();
- },
- view: function() {
- // 버튼 권한설정
- fn_proc_btn_auth('STINFO06010');
- // 공통코드 표시
- $('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_STINFO06010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
- $('#ITP_FORM_STINFO06010_SEARCH_FROM_DT').datepicker('setDate', new Date(now.setMonth(now.getMonth() - 1)));
- $('#ITP_FORM_STINFO06010_SEARCH_TO_DT').datepicker('setDate', new Date());
- },
- grid: function() {
- itp_fn_jqgrid_resize(STINFO06010_GRID_ID, STINFO06010_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_STINFO06010_SRH' : listObj.button.search(); break; // 조회 버튼 클릭
- case 'ITP_BTN_STINFO06010_NEWREG' : listObj.button.create(); break; // 신규등록 버튼
- case 'ITP_BTN_STINFO06010_CANCELLIST' : listObj.grid.search(); break; // 취소/목록 버튼
- case 'ITP_BTN_STINFO06010_SAVE' : createObj.button.save(); break; // 저장 버튼
- }
- });
- });
- $('body').on('click', function(e) {
- var gridId = STINFO06010_DETAIL_GRID_ID.replace('#', '');
- itp_fn_grid_reset_selection(e, STINFO06010_GRID_LAST_ROW_ID, gridId, 'STINFO06010');
- });
- }
- },
- switchScreen: function(mode) {
- this.screenMode = mode;
- $('.itp_det_head').find('button[id^="ITP_BTN_STINFO06010_"]').each(function(i) {
- $(this).hide();
- });
- $('#ITP_TAB_STINFO06010').find('div[id$="_CONTAINER"]').each(function(i) {
- $(this).hide();
- });
- if(mode == 'ADD') {
- $('#ITP_FORM_STINFO06010_DETAIL .contDt').show();
- } else {
- $('#ITP_FORM_STINFO06010_DETAIL .contDt').hide();
- }
- if(mode == 'LIST') { // 목록
- $('#ITP_AJAX_STINFO06010_LIST_CONTAINER').show();
- if(fn_make_user_info.get('authTpCd') === '50') {
- fn_show_btn_auth_array(['#ITP_BTN_STINFO06010_SRH']);
- $('#ITP_FORM_STINFO06010_SEARCH_STORE_ID').val(fn_make_user_info.get('storeId'));
- $('#ITP_FORM_STINFO06010_SEARCH_STORE').hide();
- } else {
- fn_show_btn_auth_array(['#ITP_BTN_STINFO06010_SRH', '#ITP_BTN_STINFO06010_NEWREG']);
- }
- $('#ITP_FORM_STINFO06010_SEARCH_BRAND_ID').val(fn_make_user_info.get('brandId'));
- } else if(mode == 'ADD') { // 등록
- itp_fn_form_clear_validate(null, '#ITP_FORM_STINFO07010_DETAIL');
- $('#ITP_FORM_STINFO06010_DETAIL').find('input, textarea, select, checkbox').each(function(i, elem) {
- $(this).attr('id') === 'ITP_FORM_STINFO06010_DETAIL_VIEW_CD' ? $(this).val('C') : $(this).val('');
- if(elem.type === 'select') {
- $(this).val('').prop('selected', true);
- }
- });
- $('#ITP_AJAX_STINFO06010_DETAIL_CONTAINER').show();
- fn_show_btn_auth_array(['#ITP_BTN_STINFO06010_CANCELLIST', '#ITP_BTN_STINFO06010_SAVE']);
- $('#ITP_BTN_STINFO06010_DETAIL_SEARCH_STORE').removeAttr('disabled');
- $('#ITP_BTN_STINFO06010_DETAIL_DELETE_STORE').removeAttr('disabled');
- // 가맹점 정보 설정
- $('#ITP_FORM_STINFO06010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
- } else if(mode == 'MODIFY') { // 수정
- $('#ITP_AJAX_STINFO06010_DETAIL_CONTAINER').show();
- if(fn_make_user_info.get('authTpCd') === '50') {
- fn_show_btn_auth_array(['#ITP_BTN_STINFO06010_CANCELLIST']);
- } else {
- fn_show_btn_auth_array(['#ITP_BTN_STINFO06010_CANCELLIST', '#ITP_BTN_STINFO06010_SAVE']);
- }
- $('#ITP_BTN_STINFO06010_DETAIL_SEARCH_STORE').attr('disabled', true);
- $('#ITP_BTN_STINFO06010_DETAIL_DELETE_STORE').attr('disabled', true);
- // 가맹점 정보 설정
- $('#ITP_FORM_STINFO06010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
- } else if(mode == 'VIEW') { // 보기
- $('#ITP_AJAX_STINFO06010_VIEW_CONTAINER').show();
- fn_show_btn_auth_array(['#ITP_BTN_STINFO06010_MODIFY', '#ITP_BTN_STINFO06010_CANCELLIST']);
- }
- this.screenMode = mode;
- }
- };
- /*목록화면 Object*/
- let listObj = {
- init: function () {
- this.grid.init();
- },
- itp_STINFO06010_search: false,
- button: {
- search: function() {
- listObj.itp_STINFO06010_search = true;
- let param = $('#ITP_FORM_STINFO06010_SEARCH').serializeObject();
- param.gridSize = $.jgrid.defaults.rowNum;
- param.gridPage = $.jgrid.defaults.page;
- $(STINFO06010_GRID_ID).setGridParam({'postData': JSON.stringify(param)}).trigger('reloadGrid');
- },
- create: function() {
- createObj.init();
- }
- },
- empty: {
- init: function() {
- var _this = this;
- this.push();
- $(STINFO06010_GRID_EMPTY).on('click', function() {
- _this.back();
- _this.itp_STINFO06010_param.gridSize = $.jgrid.defaults.rowNum;
- $(STINFO06010_GRID_ID).setGridParam({'postData': JSON.stringify(_this.itp_STINFO06010_param)}).trigger('reloadGrid');
- });
- },
- itp_STINFO06010_param: {},
- push: function() {
- let param = $('#ITP_FORM_STINFO06010_SEARCH').serializeObject();
- listObj.itp_STINFO06010_param = param;
- },
- back: function() {
- $('#ITP_FORM_STINFO06010_SERVICE_ST_CD').val(this.itp_STINFO06010_param.sstoreNm);
- }
- },
- grid: {
- init: function () {
- // 데이터 없을때
- listObj.empty.push();
- this.search();
- },
- search: function() {
- pageObj.switchScreen('LIST');
- this.unload();
- this.load();
- },
- load: function() {
- let param = $('#ITP_FORM_STINFO06010_SEARCH').serializeObject();
- param.gridSize = $.jgrid.defaults.rowNum;
- param.sbrandId = fn_make_user_info.get('brandId');
- var option = {
- gridId: STINFO06010_GRID_ID,
- colModel: gridColModel.list,
- param: param,
- url: DOMAIN + API_DETAIL_GRID_LIST,
- pager: STINFO06010_GRID_PAGER,
- onCellSelect: function(rowId, cellIdx, cellValue) {
- var cm = $(this).jqGrid('getGridParam', 'colModel');
- var colNm = cm[cellIdx].name;
- if (colNm === 'contSttDt') {
- const storeId = $(this).jqGrid('getCell', rowId, 'storeId');
- const storeNm = $(this).jqGrid('getCell', rowId, 'storeNm');
- const contSttDt = $(this).jqGrid('getCell', rowId, 'contSttDt');
- const contEndDt = $(this).jqGrid('getCell', rowId, 'contEndDt');
- $('#ITP_FORM_STINFO06010_DETAIL_STORE_ID').val(storeId);
- $('#ITP_FORM_STINFO06010_DETAIL_STORE_NM').val(storeNm);
- const key = {brandId:fn_make_user_info.get('brandId'), storeId: storeId, contSttDt: contSttDt, contEndDt: contEndDt, viewCd: 'R'};
- var param = $.param(key);
- modifyObj.init(param);
- }
- },
- loadComplete: function(data) {
- console.log(data);
- itp_fn_grid_load_complete(data, STINFO06010_GRID_ID, true, 'number', 'STINFO06010', listObj.itp_STINFO06010_search, listObj.empty, true, data.gridRecords, true);
- var ids = $(STINFO06010_GRID_ID).getDataIDs();
- $.each(ids, function(idx, rowId) {
- $(STINFO06010_GRID_ID).jqGrid('setCell', rowId, 'contSttDt', '', ITP_GRID_COL_STYLE.link);
- });
- },
- onPaging: function(action) {
- itp_fn_grid_paging(STINFO06010_GRID_ID, action, param);
- }
- };
- itp_fn_grid_make_remote(option);
- },
- clearData : function() {
- $(STINFO06010_GRID_ID).jqGrid('clearGridData', true);
- $(STINFO06010_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
- $(STINFO06010_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
- $(STINFO06010_GRID_EMPTY).show();
- },
- unload : function() {
- $.jgrid.gridUnload(STINFO06010_GRID_ID);
- }
- }
- };
- /*수정화면 Object*/
- let modifyObj = {
- init: function (param) {
- pageObj.switchScreen('MODIFY');
- // var param = $.param($('#ITP_FORM_STINFO06010_DETAIL').serializeObject());
- this.grid.init(param);
- },
- itp_STINFO06010_search: false,
- search: function() {
- listObj.itp_STINFO06010_search = true;
- let param = $('#ITP_FORM_STINFO06010_DETAIL').serializeObject();
- param.gridSize = $.jgrid.defaults.rowNum;
- param.gridPage = $.jgrid.defaults.page;
- $(STINFO06010_DETAIL_GRID_ID).setGridParam({'postData': JSON.stringify(param)}).trigger('reloadGrid');
- },
- button: {
- },
- empty: {
- init: function() {
- var _this = this;
- this.push();
- $(STINFO06010_DETAIL_GRID_EMPTY).on('click', function() {
- _this.back();
- _this.itp_STINFO06010_param.gridSize = $.jgrid.defaults.rowNum;
- $(STINFO06010_DETAIL_GRID_ID).setGridParam($.param(_this.itp_STINFO06010_param)).trigger('reloadGrid');
- });
- },
- itp_STINFO06010_param: {},
- push: function() {
- let param = $('#ITP_FORM_STINFO06010_DETAIL').serializeObject();
- listObj.itp_STINFO06010_param = param;
- },
- back: function() {
- }
- },
- grid: {
- init: function (param) {
- // 데이터 없을때
- listObj.empty.push();
- this.unload();
- this.load(param);
- },
- prevRowId: null,
- load: function(param) {
- var _this = this;
- console.log(param);
- var option = {
- gridId: STINFO06010_DETAIL_GRID_ID,
- colModel: gridColModel.detail,
- param: param,
- url: DOMAIN + API_DETAIL_INFO,
- loadComplete: function(data) {
- console.log(data);
- createObj.rows = data.gridRows;
- itp_fn_grid_load_complete(data, STINFO06010_DETAIL_GRID_ID, false, 'number', 'STINFO06010', modifyObj.itp_STINFO06010_search, modifyObj.empty, true, data.gridRecords, true);
- },
- onCellSelect: function(rowid, cellIdx, cellValue) {
- if(fn_make_user_info.get('authTpCd') !== '50') {
- STINFO06010_GRID_LAST_ROW_ID = itp_fn_set_data_editable(rowid, cellIdx, STINFO06010_GRID_LAST_ROW_ID, STINFO06010_DETAIL_GRID_ID, ['actionId']);
- }
- },
- onPaging: function(action) {
- itp_fn_grid_paging(STINFO06010_GRID_ID, action, param);
- }
- };
- itp_fn_grid_make_remote(option);
- },
- clearData : function() {
- $(STINFO06010_DETAIL_GRID_ID).jqGrid('clearGridData', true);
- $(STINFO06010_DETAIL_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
- $(STINFO06010_DETAIL_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
- $(STINFO06010_DETAIL_GRID_EMPTY).show();
- },
- unload : function() {
- $.jgrid.gridUnload(STINFO06010_DETAIL_GRID_ID);
- }
- }
- };
- /*신규화면 Object*/
- let createObj = {
- init: function () {
- pageObj.switchScreen('ADD');
- var param = $.param($('#ITP_FORM_STINFO06010_DETAIL').serializeObject());
- this.grid.init(param);
- this.button.init();
- },
- button: {
- init: function() {
- // 가맹점 조회 버튼 클릭
- $('#ITP_BTN_STINFO06010_DETAIL_SEARCH_STORE').one('click', function() {
- createObj.popup();
- });
- // 가맹점 텍스트 삭제 버튼 클릭
- $('#ITP_BTN_STINFO06010_DETAIL_DELETE_STORE').one('click', function() {
- $('#ITP_FORM_STINFO06010_DETAIL_BRAND_ID').val('');
- $('#ITP_FORM_STINFO06010_DETAIL_STORE_ID').val('');
- $('#ITP_FORM_STINFO06010_DETAIL_STORE_NM').val('');
- });
- },
- cancel: function() {
- listObj.grid.search();
- },
- save: function() {
- const formId = '#ITP_FORM_STINFO06010_DETAIL';
- var isValid = true;
- if(pageObj.screenMode === 'ADD') {
- isValid = itp_fn_form_event.isValid(formId)
- }
- if (isValid) {
- itp_fn_grid_save_rows(STINFO06010_DETAIL_GRID_ID);
- var rows = $(STINFO06010_DETAIL_GRID_ID).getRowData();
- let param = {};
- var gridInsertData = [];
- var gridUpdateData = [];
- var changeRows = createObj.changeRows(rows);
- $.each(changeRows, function (index, item) {
- if(pageObj.screenMode === 'ADD') {
- item['contSttDt'] = $('#ITP_FORM_STINFO06010_DETAIL_FROM_DT').val();
- item['contEndDt'] = $('#ITP_FORM_STINFO06010_DETAIL_TO_DT').val();
- gridInsertData.push(item);
- } else {
- if(item.viewCd === 'C') {
- gridInsertData.push(item);
- } else if(item.viewCd === 'U') {
- gridUpdateData.push(item);
- }
- }
- });
- param['viewCd'] = 'U';
- param['brandId'] = fn_make_user_info.get('brandId');
- param['storeId'] = $('#ITP_FORM_STINFO06010_DETAIL_STORE_ID').val();
- param['gridInsertData'] = gridInsertData;
- param['gridUpdateData'] = gridUpdateData;
- console.log(JSON.stringify(param));
- var searhFn = function() {
- listObj.grid.search();
- };
- fn_ajax_call(API_DETAIL_SAVE, JSON.stringify(param), searhFn, 'POST');
- }
- }
- },
- grid: {
- init: function (param) {
- // 데이터 없을때
- listObj.empty.push();
- this.unload();
- this.load(param);
- },
- rows: [],
- prevRowId: null,
- load: function(param) {
- var _this = this;
- console.log(param);
- var option = {
- gridId: STINFO06010_DETAIL_GRID_ID,
- colModel: gridColModel.detail,
- mtype: 'GET',
- param: param,
- url: DOMAIN + API_DETAIL_NEW,
- loadComplete: function(data) {
- console.log(data);
- createObj.rows = data.gridRows;
- itp_fn_grid_load_complete(data, STINFO06010_DETAIL_GRID_ID, false, 'number', 'STINFO06010', modifyObj.itp_STINFO06010_search, modifyObj.empty, true, data.gridRecords, true);
- },
- onCellSelect: function(rowid, cellIdx, cellValue) {
- STINFO06010_GRID_LAST_ROW_ID = itp_fn_set_data_editable(rowid, cellIdx, STINFO06010_GRID_LAST_ROW_ID, STINFO06010_DETAIL_GRID_ID, ['actionId']);
- },
- onPaging: function(action) {
- itp_fn_grid_paging(STINFO06010_GRID_ID, action, param);
- }
- };
- itp_fn_grid_make_remote(option);
- },
- clearData : function() {
- $(STINFO06010_DETAIL_GRID_ID).jqGrid('clearGridData', true);
- $(STINFO06010_DETAIL_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
- $(STINFO06010_DETAIL_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
- $(STINFO06010_DETAIL_GRID_EMPTY).show();
- },
- unload : function() {
- $.jgrid.gridUnload(STINFO06010_DETAIL_GRID_ID);
- }
- },
- popup: function() {
- var popFn = function(rowDataPop) {
- console.log(rowDataPop);
- if(rowDataPop && rowDataPop.length > 0) {
- $('#ITP_FORM_STINFO06010_DETAIL_BRAND_ID').val(rowDataPop[0].brandId);
- $('#ITP_FORM_STINFO06010_DETAIL_STORE_ID').val(rowDataPop[0].storeId);
- $('#ITP_FORM_STINFO06010_DETAIL_STORE_NM').val(rowDataPop[0].storeNm);
- }
- };
- fn_call_popup('biz', 'BIZPOP_BRAND_STORE', '#ITP_ASIDE', popFn, null, 'S');
- },
- rows: [],
- changeRows: function(gridRows) {
- var modifyRows = [];
- var chkColumns = ['unit', 'stddQty', 'curr', 'unitAmt', 'unitTargetCd'];
- $.each(this.rows, function(index, item) {
- var row = gridRows[index];
- if(row.viewCd === 'C') {
- modifyRows.push(item);
- } else {
- if(row.itemId === item.itemId) {
- $.each(chkColumns, function(index, column) {
- if(row[column].toString() !== item[column].toString()) {
- row.viewCd = 'U';
- modifyRows.push(row);
- return false;
- }
- });
- }
- }
- });
- return modifyRows;
- }
- };
|