| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 | 
							- BemsWebApplication.AccidentCodeType = function (params, viewInfo) {
 
-     "use strict";
 
-     var FmsAccidentCodeTypeDataSource = BemsWebApplication.db.createDataSource('FmsAccidentCodeType');
 
-     var AccidentCodeTypeInfo = ko.observableArray();
 
-     var RowName;
 
-     var viewModel = BWA.DataGrid.createViewWithDataGrid(params, viewInfo, 'FmsAccidentCodeType', {
 
-         columns: [
 
-             { dataField: 'AccidentTypeId', caption: $G('number'), width: '20%', alignment: 'center', sortOrder: 'desc' },
 
-             { dataField: 'Name', caption: '사고코드명', width: '80%', alignment: 'center' },
 
-         ],
 
-         popupWidth: 480,
 
-         NoSearchView: true,     // 2019.07.25 kgpark 검색버튼 삭제
 
-         handlePopupShowing: function (that) {
 
-             FmsAccidentCodeTypeDataSource.filter([
 
-                 ["SiteId", "=", BWA.UserInfo.SiteId()]
 
-             ]);
 
-             FmsAccidentCodeTypeDataSource.load().done(function (result) {
 
-                 AccidentCodeTypeInfo(result);
 
-             });
 
-         },
 
-         handleDataGridRowClick: function (id, dataGrid, clickRow, popupVisible) {
 
-             var data = clickRow.data;
 
-             RowName = data.Name;
 
-             popupVisible(true);
 
-         },
 
-         beforeInsertingDataViewModel: function (dataModel, dbModelId) {
 
-             var dfd = $.Deferred();
 
-             var isDuplicated = false;
 
-             for (var i = 0; i < AccidentCodeTypeInfo().length; i++) {
 
-                 if (dataModel.Name() == AccidentCodeTypeInfo()[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 < AccidentCodeTypeInfo().length; i++) {
 
-                 if (viewModel.dataModel.Name() == AccidentCodeTypeInfo()[i].Name() && (RowName() != AccidentCodeTypeInfo()[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;
 
- };
 
 
  |