123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- $(function () {
- 'use strict';
- BWA.Popup.BudgetExecute = BWA.Popup.BudgetExecute || {};
- BWA.Popup.BudgetExecute.create = function (viewModel, options) {
- options = options || {};
- var onSelectedBudgets = options.onSelectedBudgets;
- var popupVisible = ko.observable(false);
- var budgetDataSource = BWA.DataUtil.createDataSource({
- dataSourceOptions: {
- store: BemsWebApplication.odata.FmsBudgetDetailExecutionEx,
- select: ['SiteId', 'Year', 'Month']
- }
- });
- var selectedYear = ko.observable();
- var selectedMonth = ko.observable();
- var dataViewModel = new BemsWebApplication.FmsBudgetViewModel(),
- initialized = false,
- gridView;
- //
- // equipmentFactory = BemsWebApplication.Factory.Equipment,
- // dataSource = BWA.DataUtil.createDataSource({ dataSourceOptions: equipmentFactory.getDataSourceForDataGrid() }, 'FmsEquipmentEx');
- var eq = BWA.DataUtil.constructEqualFilter,
- and = BWA.DataUtil.andFilter;
- // 자재 검색시 나타나는 팝업은 공통 및 자신이 포함된 비즈니스 영역만 해당됨
- var userInfo = BWA.UserInfo;
- var dataGridOptions = utils.datagrid.defaultOptions({
- pager: {
- showPageSizeSelector: false,
- allowedPageSizes: []
- },
- dxDataSource: budgetDataSource,
- // 아래들이 동작하지 않음
- selectedSourceItem: dataViewModel,
- handleDataGridRowClick: function () {
- },
- columns: [
- { dataField: 'Year', caption: 'Year', alignment: 'center', sortOrder: 'desc' },
- { dataField: 'Month', caption: 'Month', alignment: 'center', sortOrder: 'desc' },
- ],
- wordWrapEnabled: true
- // cellPrepared: BemsWebApplication.Factory.Equipment.cellPrepared
- });
- dataGridOptions.handleDataGridRowClick = function (id, dataGrid, clickRow) {
- var data = clickRow.data;
- if (!_.isUndefined(onSelectedBudgets)) {
- onSelectedBudgets([BWA.DataUtil.convertViewModelToJS(data)]);
- }
- popupVisible(false);
- }
-
- var toolbarItems = [
- { location: 'before', text: '실적등록 월 선택' },
- { location: 'after', widget: 'button', options: { text: $G('select'), icon: 'save', clickAction: handlePopupButtonSelect } }, //, visible: isMultipleSelect,
- { location: 'after', widget: 'button', options: { text: $G('close'), icon: 'close', clickAction: handlePopupButtonClose } } //
- ];
- var popupOptions = {
- width: '400px',
- height: 'auto',
- visible: popupVisible,
- closeOnOutsideClick: true,
- //showingAction: handlePopupShowing,
- shownAction: handlePopupShown,
- animation: window.utils.popup.createAnimation()
- };
- function handlePopupShown() {
- if (initialized === false) {
- gridView = $('#budgetDataGridForYear').dxDataGrid('instance');
- initialized = true;
- }
- gridView.clearSelection();
- gridView.refresh();
- }
- function handlePopupButtonSelect() {
- //dataViewModel = gridView.getSelectedRowsData()[0];
- //selectedYear = dataViewModel.Year();
- //popupVisible(false);
- var array = gridView.getSelectedRowsData()[0];
- if (!_.isUndefined(onSelectedBudgets)) {
- onSelectedBudgets(array);
- }
- popupVisible(false);
- }
- function handlePopupButtonClose() {
- popupVisible(false);
- }
- return {
- dataModel: dataViewModel,
- //dataSource: dataSource,
- selectedYear: selectedYear,
- selectedMonth: selectedMonth,
- popupOptions: popupOptions,
- toolbarItems: toolbarItems,
- dataGridOptions: dataGridOptions,
- popupVisible: popupVisible,
- onSelectedBudgets:onSelectedBudgets, // hcLee 2015 12 09
- show: function () {
- popupVisible(true);
- }
- };
- };
- });
|