a1e4192fd2fa5511c18f162da93910a0bc9cea69.svn-base 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. 
  2. $(function() {
  3. "use strict";
  4. BWA.Popup = BWA.Popup || {};
  5. BWA.Popup.WorkOrderGenerationPopup = function(viewModel, selectedDate, schedules, viewInfo) {
  6. var dataViewModel = new BemsWebApplication.FmsBusinessSeniorViewModel(),
  7. popupVisible = ko.observable(false),
  8. hasnotModificationPermission = ko.observable(true),
  9. workRequestDataSource = BemsWebApplication.db.createDataSource('FmsWorkOrder', true),
  10. workOrderDataSource = BemsWebApplication.db.createDataSource('FmsWorkResult', true);
  11. var dataGridOptions = {
  12. dataSource: schedules,
  13. columns: [
  14. //{ dataField: 'CmBusinessField_Name', caption: $G('businessFieldName'), width: '20%', alignment: 'center', allowFiltering: false },
  15. { dataField: 'title', caption: $G('facilityCheckScheduleName'), width: '40%', alignment: 'center', allowFiltering: false },
  16. //{ dataField: 'FmsFacilityCodeCycleType_Name', caption: $G('facilityCheckScheduleCycleTypeName'), width: '20%', alignment: 'center' },
  17. //{
  18. // dataField: 'StartDate',
  19. // caption: $G('facilityCheckScheduleStartDate'),
  20. // width: '20%',
  21. // alignment: 'center',
  22. // allowFiltering: false,
  23. // customizeText: function(cellInfo) {
  24. // return $G.date(cellInfo.value);
  25. // }
  26. //}
  27. ],
  28. };
  29. function handlePopupShowing(e) {
  30. }
  31. function handlePopupShown() {
  32. // hasnotModificationPermission(!BWA.UserInfo.hasPermissionOfModification(viewInfo.viewName));
  33. }
  34. function handlePopupButtonGeneration() {
  35. var postData = [];
  36. $.each(schedules(), function(i, item) {
  37. postData.push({
  38. SiteId: BWA.UserInfo.SiteId(),
  39. ScheduleId: item.scheduleId
  40. });
  41. });
  42. BemsWebApplication.api.post(
  43. 'FmsWorkOrder/GenerateWorkRequestOrder', postData, {
  44. UserId: BWA.UserInfo.UserId(),
  45. Date: $G.date(selectedDate())
  46. }
  47. ).done(function () {
  48. utils.toast.show('성공적으로 작업지시를 생성하였습니다.');
  49. });
  50. popupVisible(false);
  51. }
  52. function handlePopupButtonClose() {
  53. popupVisible(false);
  54. }
  55. var toolbarItems = [
  56. { location: 'before', text: '작업지시 생성' },
  57. { location: 'after', widget: 'button', options: { text: $G('generation'), icon: 'plus', disabled: !BWA.UserInfo.hasPermissionOfModification(viewInfo.viewName), clickAction: handlePopupButtonGeneration } },
  58. { location: 'after', widget: 'button', options: { text: $G('close'), icon: 'close', clickAction: handlePopupButtonClose } }
  59. ];
  60. var popupOptions = {
  61. width: '520px',
  62. height: 'auto',
  63. visible: popupVisible,
  64. shading: false,
  65. closeOnOutsideClick: true,
  66. showingAction: handlePopupShowing,
  67. shownAction: handlePopupShown,
  68. animation: utils.popup.createAnimation()
  69. };
  70. return {
  71. popupOptions: popupOptions,
  72. toolbarItems: toolbarItems,
  73. dataGridOptions: dataGridOptions,
  74. show: function() {
  75. popupVisible(true);
  76. }
  77. };
  78. }
  79. });