1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
-
- $(function() {
- "use strict";
- BWA.Popup = BWA.Popup || {};
- BWA.Popup.WorkOrderGenerationPopup = function(viewModel, selectedDate, schedules, viewInfo) {
- var dataViewModel = new BemsWebApplication.FmsBusinessSeniorViewModel(),
- popupVisible = ko.observable(false),
- hasnotModificationPermission = ko.observable(true),
- workRequestDataSource = BemsWebApplication.db.createDataSource('FmsWorkOrder', true),
- workOrderDataSource = BemsWebApplication.db.createDataSource('FmsWorkResult', true);
- var dataGridOptions = {
- dataSource: schedules,
- columns: [
- //{ dataField: 'CmBusinessField_Name', caption: $G('businessFieldName'), width: '20%', alignment: 'center', allowFiltering: false },
- { dataField: 'title', caption: $G('facilityCheckScheduleName'), width: '40%', alignment: 'center', allowFiltering: false },
- //{ dataField: 'FmsFacilityCodeCycleType_Name', caption: $G('facilityCheckScheduleCycleTypeName'), width: '20%', alignment: 'center' },
- //{
- // dataField: 'StartDate',
- // caption: $G('facilityCheckScheduleStartDate'),
- // width: '20%',
- // alignment: 'center',
- // allowFiltering: false,
- // customizeText: function(cellInfo) {
- // return $G.date(cellInfo.value);
- // }
- //}
- ],
- };
- function handlePopupShowing(e) {
- }
- function handlePopupShown() {
- // hasnotModificationPermission(!BWA.UserInfo.hasPermissionOfModification(viewInfo.viewName));
- }
- function handlePopupButtonGeneration() {
- var postData = [];
- $.each(schedules(), function(i, item) {
- postData.push({
- SiteId: BWA.UserInfo.SiteId(),
- ScheduleId: item.scheduleId
- });
- });
- BemsWebApplication.api.post(
- 'FmsWorkOrder/GenerateWorkRequestOrder', postData, {
- UserId: BWA.UserInfo.UserId(),
- Date: $G.date(selectedDate())
- }
- ).done(function () {
- utils.toast.show('성공적으로 작업지시를 생성하였습니다.');
- });
- popupVisible(false);
- }
- function handlePopupButtonClose() {
- popupVisible(false);
- }
- var toolbarItems = [
- { location: 'before', text: '작업지시 생성' },
- { location: 'after', widget: 'button', options: { text: $G('generation'), icon: 'plus', disabled: !BWA.UserInfo.hasPermissionOfModification(viewInfo.viewName), clickAction: handlePopupButtonGeneration } },
- { location: 'after', widget: 'button', options: { text: $G('close'), icon: 'close', clickAction: handlePopupButtonClose } }
- ];
- var popupOptions = {
- width: '520px',
- height: 'auto',
- visible: popupVisible,
- shading: false,
- closeOnOutsideClick: true,
- showingAction: handlePopupShowing,
- shownAction: handlePopupShown,
- animation: utils.popup.createAnimation()
- };
- return {
- popupOptions: popupOptions,
- toolbarItems: toolbarItems,
- dataGridOptions: dataGridOptions,
- show: function() {
- popupVisible(true);
- }
- };
- }
- });
|