| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 | 
							- BemsWebApplication.ContractType = function( params, viewInfo ) {
 
-     "use strict";
 
-     var FmsContractTypeDataSource = BemsWebApplication.db.createDataSource('FmsContractType');
 
-     var ContractTypeInfo = ko.observableArray();
 
-     var RowName;
 
-     var viewModel = BWA.DataGrid.createViewWithDataGrid( params, viewInfo, 'FmsContractType', {
 
-         columns: [
 
-             { dataField: 'ContractTypeId', caption: '번호', width: '20%', alignment: 'center' , sortOrder: 'desc'},
 
-             { dataField: 'Name', caption: '계약종류', width: '60%', alignment: 'center' },
 
-             utils.datagrid.columnIsUse( '20%' )
 
-         ],
 
-         popupWidth: 480,
 
-         NoSearchView: true,     // 2019.07.25 kgpark 검색버튼 삭제
 
-         // 이름 중복 방지
 
-         handlePopupShowing: function (that) {
 
-             FmsContractTypeDataSource.filter([
 
-                 ["SiteId", "=", BWA.UserInfo.SiteId()]
 
-             ]);
 
-             FmsContractTypeDataSource.load().done(function (result) {
 
-                 ContractTypeInfo(result);
 
-             });
 
-         },
 
-         handleDataGridRowClick: function (id, dataGrid, clickRow, popupVisible) {
 
-             dataGrid.clearSelection();
 
-             var data = clickRow.data;
 
-             RowName = data.Name;
 
-             popupVisible(true);
 
-         },
 
-         beforeInsertingDataViewModel: function (dataModel, dbModelId) {
 
-             var dfd = $.Deferred();
 
-             var isDuplicated = false;
 
-             for (var i = 0; i < ContractTypeInfo().length; i++) {
 
-                 if (dataModel.Name() == ContractTypeInfo()[i].Name()) {
 
-                     isDuplicated = true;
 
-                 }
 
-             }
 
-             if (!BWA.DataUtil.isValidInputValue(dataModel.Name()))
 
-                 return dfd.resolve(false, '저장 혹은 수정 반드시 필수 입력 정보(*)를 모두 입력하셔야 합니다 (앞뒤공백 허용안함)');
 
-             else {
 
-                 if (isDuplicated)
 
-                     return dfd.resolve(false, '이미 동일 정보가 존재합니다.');
 
-                 else
 
-                     return dfd.resolve(true);
 
-             }
 
-         },
 
-         beforeUpdateDataViewModel: function () {
 
-             var isDuplicated = false;
 
-             for (var i = 0; i < ContractTypeInfo().length; i++) {
 
-                 if (viewModel.dataModel.Name() == ContractTypeInfo()[i].Name() && (RowName() != ContractTypeInfo()[i].Name())) {
 
-                     isDuplicated = true;
 
-                 }
 
-             }
 
-             if (!BWA.DataUtil.isValidInputValue(viewModel.dataModel.Name())) {
 
-                 utils.toast.show('저장 혹은 수정 반드시 필수 입력 정보(*)를 모두 입력하셔야 합니다 (앞뒤공백 허용안함)', 'error');
 
-                 return 0;
 
-             }
 
-             else {
 
-                 if (isDuplicated) {
 
-                     utils.toast.show('이미 동일 이름이 존재합니다.', 'error');
 
-                     return 0;
 
-                 }
 
-                 else
 
-                     return 2;
 
-             }
 
-         },
 
-     } );
 
-     
 
-     return viewModel;
 
- };
 
 
  |