| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 | 
							- BemsWebApplication.WorkList = function (params, viewInfo) {
 
-     "use strict";
 
-     var businessFieldDataSource = BemsWebApplication.db.createDataSource('CmBusinessField', true, true, true),
 
-         workTypeDataSource = BemsWebApplication.db.createDataSource('FmsWorkCodeType'),
 
-         progressDataSource = BemsWebApplication.db.createDataSource('FmsWorkCodeProgress'),
 
-         businessFields = ko.observableArray(),
 
-         workTypes = ko.observableArray(),
 
-         progresses = ko.observableArray();
 
-     var popup;
 
-     var deferredForSearch = new $.Deferred();
 
-     var workTypesForSearch = ko.observableArray(),
 
-         businessFieldsForSearch = ko.observableArray(),
 
-         progressesForSearch = ko.observableArray();
 
-     var eq = BWA.DataUtil.constructEqualFilter,
 
-         and = BWA.DataUtil.andFilter,
 
-         noteq = BWA.DataUtil.constructNotEqualFilter;
 
-     var selectedFacilityData = ko.observable(),
 
-         selectedUserData = params.selectedUserData || ko.observable();
 
-     var dataSourceOptions = {
 
-         select: [
 
-             'SiteId', 'WorkRequestId',
 
-             'FmsWorkRequest/WorkTypeId', 'Title', 'OrderDate', 'FmsWorkRequest/WorkProgressId',
 
-             'CmUser/Name', // 작업지시자
 
-             //'CmUser1/Name', // 반려자
 
-             'FmsWorkRequest/FmsWorkCodeType/Name',
 
-             'CmBusinessField/Name',
 
-             'FmsWorkRequest/FmsWorkCodeProgress/Name'
 
-         ],
 
-         expand: [
 
-             'FmsWorkRequest',
 
-             'FmsWorkRequest/FmsWorkCodeType',
 
-             'FmsWorkRequest/FmsWorkCodeProgress',
 
-             'CmBusinessField', 'CmUser'],
 
-         //expand: ['FmsWorkCodeType', 'CmBusinessField', 'FmsWorkCodeProgress', 'CmUser', 'CmUser1'],
 
-         extendOptions: {
 
-             forceOriginalField: true
 
-         },
 
-         filter: [
 
-             eq('SiteId', BWA.UserInfo.SiteId()),
 
-             and,
 
-             ['FmsWorkRequest/WorkProgressId', '>=', 3]
 
-         ]
 
-     };
 
-     var viewModel = BWA.DataGrid.createViewWithDataGrid(params, viewInfo, 'FmsWorkOrder', {
 
-         popupWidth: 1200,
 
-         dataSourceOptions: dataSourceOptions,
 
-         columns: [
 
-             { dataField: 'WorkRequestId', caption: $G('number'), width: '8%', alignment: 'center' },
 
-             {
 
-                 dataField: 'OrderDate', caption: $G('orderedDate'), width: '12%', alignment: 'center',visible:false,
 
-                 customizeText: function (cellInfo) {
 
-                     return $G.date(cellInfo.value);
 
-                 }
 
-             },
 
-             { dataField: 'FmsWorkRequest/FmsWorkCodeProgress/Name', caption: $G('workProgressName'), width: '10%', alignment: 'center' },
 
-             { dataField: 'FmsWorkRequest/FmsWorkCodeType/Name', caption: $G('workTypeName'), width: '10%', alignment: 'center' },
 
-             { dataField: 'CmBusinessField/Name', caption: $G('businessFieldName'), width: '10%', alignment: 'center' },
 
-             { dataField: 'Title', caption: '작업명', width: '35%', alignment: 'center' },
 
-             { dataField: 'CmUser/Name', caption: '작업지시자', width: '15%', alignment: 'center' }
 
-         ],
 
-         promiseDataInSearchView: deferredForSearch.promise(),
 
-         //searchViewItems: _.compact([
 
-         //    executionPlanViewOptions ? null : { id: 'BusinessFieldId', ignoreValue: 0, defaultValue: 0, dataSource: businessFieldsForSearch },
 
-         //    executionPlanViewOptions ? null : { id: 'WorkTypeId', ignoreValue: 0, defaultValue: 0, dataSource: workTypesForSearch },
 
-         //    { id: 'CmUser/Name' },
 
-         //    { id: 'Title' },
 
-         //    { id: 'WorkProgressId', ignoreValue: 0, defaultValue: 0, dataSource: progressesForSearch },
 
-         //    { id: 'RequestDate', type: 'dateRange' }
 
-         //]),
 
-         getAddedToolbarItemsInPopup: function (e) {
 
-             var isEditModeInPopup = e.isEditModeInPopup;
 
-             return [{
 
-                 location: 'after', widget: 'button', options: {
 
-                     text: $G('facilityInsertion'), icon: 'search', visible: isEditModeInPopup,
 
-                     clickAction: function () {
 
-                         popup.facilitySearchPopup.show();
 
-                     }
 
-                 }
 
-             },
 
-             {
 
-                 location: 'after', widget: 'button', options: {
 
-                     text: $G('facilityDeletion'), icon: 'remove', type: 'danger', visible: isEditModeInPopup,
 
-                     clickAction: function () {
 
-                         if (popup && popup.handleDeleteSelectedFacilities) {
 
-                             popup.handleDeleteSelectedFacilities();
 
-                         }
 
-                     }
 
-                 }
 
-             }];
 
-         },
 
-         beforeInsertingDataViewModel: function (dataModel) {
 
-             //if (popup && popup.beforeInsertingDataViewModel) {
 
-             //    popup.beforeInsertingDataViewModel();
 
-             //}
 
-             //dataModel.ProgressId($Code.WorkProgress.WORK_PLAN);
 
-             //dataModel.RequestDate(new Date());
 
-             return true;
 
-         },
 
-         handleDataGridRowClick: function (id, dataGrid, clickRow, popupVisible) {
 
-             dataGrid.clearSelection();
 
-             var data = clickRow.data;
 
-             var dataModel = viewModel.dataModel;
 
-             if (popup && popup.handleBeforeShowingPopupForEdit) {
 
-                 popup.handleBeforeShowingPopupForEdit(data, dataModel);
 
-             }
 
-             popupVisible(true);
 
-         },
 
-         handleBeforePopupShowingPromise: function () {
 
-             if (popup && popup.handleBeforePopupShowingPromise) {
 
-                 popup.handleBeforePopupShowingPromise.apply(popup, arguments);
 
-             }
 
-         },
 
-         handleAfterLoadingModelByKey: function () {
 
-             if (popup && popup.handleAfterLoadingModelByKey) {
 
-                 popup.handleAfterLoadingModelByKey.apply(popup, arguments);
 
-             }
 
-         },
 
-         handlePopupShowing: function () {
 
-             if (popup && popup.handlePopupShowing) {
 
-                 //viewModel.toolbarItems[4].options.visible = false;
 
-                 popup.handlePopupShowing.apply(this, arguments);
 
-             }
 
-         },
 
-         handlePopupShown: function (editMode, isNewInPopup, dataModel) {
 
-             if (popup && popup.handlePopupShowing) {
 
-                 popup.handlePopupShown.apply(this, arguments);
 
-             }
 
-         },
 
-         handleSaveButtonInPopup: function (isInsert) {
 
-             if (isInsert === false) {
 
-                 if (popup && popup.handleAfterSave) {
 
-                     popup.handleAfterSave(undefined);
 
-                 }
 
-             }
 
-         },
 
-         handleAfterSaveInPopup: function (responseKey, response) {
 
-             if (popup && popup.handleAfterSave) {
 
-                 popup.handleAfterSave(responseKey, response);
 
-             }
 
-         },
 
-         handleViewShowing: function (dataModel) {
 
-             $.when(
 
-                 businessFieldDataSource.load(),
 
-                 workTypeDataSource.load(),
 
-                 progressDataSource.load()
 
-             ).done(function (businessFieldResult, workTypeResult, progressResult) {
 
-                 businessFields(businessFieldResult[0]);
 
-                 workTypes(workTypeResult[0]);
 
-                 progresses(progressResult[0]);
 
-                 businessFieldsForSearch($SearchView.createArrayOfSelectBox('BusinessFieldId', businessFields()));
 
-                 workTypesForSearch($SearchView.createArrayOfSelectBox('WorkTypeId', workTypes()));
 
-                 progressesForSearch($SearchView.createArrayOfSelectBox('ProgressId', progresses()));
 
-                 deferredForSearch.resolve();
 
-             });
 
-         },
 
-         handleViewShown: function () {
 
-         }
 
-     });
 
-     viewModel.businessFields = businessFields;
 
-     viewModel.workTypes = workTypes;
 
-     popup = viewModel.popup = BWA.Popup.WorkList.create(viewInfo, viewModel);
 
-     //popup = viewModel.popup = BWA.Popup.WorkList.create(viewModel, params);
 
-     return viewModel;
 
- };
 
 
  |