소스 검색

修复日常安排删除的问题

unknown 5 년 전
부모
커밋
da04e57620

+ 3 - 0
o2web/source/o2_core/o2/lp/zh-cn.js

@@ -189,6 +189,9 @@ o2.LP.desktop = {
         "attendanceAppealRejectMessage": "考勤申述未通过",
         "attendanceAppealReject": "{subject}",
 
+        "canlendarAlarmMessage" : "日程提醒",
+        "canlendarAlarm" : "{title}",
+
         "teamwork":{
             "executor":"责任人",
             "creatorPerson":"创建者"

+ 47 - 1
o2web/source/o2_core/o2/xDesktop/WebSocket.js

@@ -149,7 +149,7 @@ MWF.xDesktop.WebSocket = new Class({
                                 this.receiveAttendanceAppealRejectMessage(data);
                                 break;
                             case "calendar_alarm":
-                                this.receiveAttendanceAppealRejectMessage(data);
+                                this.receiveCalendarAlarmMessage(data);
                                 break;
                             case "teamwork_taskCreate":
                             case "teamwork_taskUpdate":
@@ -595,6 +595,52 @@ MWF.xDesktop.WebSocket = new Class({
             layout.desktop.openApplication(e, "Attendance", {"curNaviId":"12"});
         });
     },
+    receiveCalendarAlarmMessage: function(data){
+        debugger;
+        var content = MWF.LP.desktop.messsage.canlendarAlarm;
+        content = content.replace(/{title}/g, data.title);
+
+        var msg = {
+            "subject": MWF.LP.desktop.messsage.canlendarAlarmMessage,
+            "content": content
+        };
+        var messageItem = layout.desktop.message.addMessage(msg);
+        var tooltipItem = layout.desktop.message.addTooltip(msg);
+        tooltipItem.contentNode.addEvent("click", function(e){
+            layout.desktop.message.hide();
+            if ( layout.desktop.apps && layout.desktop.apps["Calendar"] ) {
+                if( layout.desktop.apps["Calendar"].openEvent ){
+                    layout.desktop.apps["Calendar"].setCurrent();
+                    layout.desktop.apps["Calendar"].openEvent( data.body.id );
+                }else if(layout.desktop.apps["Calendar"].options){
+                    layout.desktop.apps["Calendar"].options.eventId = data.body.id;
+                    layout.desktop.apps["Calendar"].setCurrent();
+                }else{
+                    layout.desktop.openApplication(e, "Calendar", {"eventId": data.body.id });
+                }
+            }else{
+                layout.desktop.openApplication(e, "Calendar", {"eventId": data.body.id });
+            }
+        });
+
+        messageItem.contentNode.addEvent("click", function(e){
+            layout.desktop.message.addUnread(-1);
+            layout.desktop.message.hide();
+            if ( layout.desktop.apps && layout.desktop.apps["Calendar"] ) {
+                if( layout.desktop.apps["Calendar"].openEvent ){
+                    layout.desktop.apps["Calendar"].setCurrent();
+                    layout.desktop.apps["Calendar"].openEvent( data.body.id );
+                }else if(layout.desktop.apps["Calendar"].options){
+                    layout.desktop.apps["Calendar"].options.eventId = data.body.id;
+                    layout.desktop.apps["Calendar"].setCurrent();
+                }else{
+                    layout.desktop.openApplication(e, "Calendar", {"eventId": data.body.id });
+                }
+            }else{
+                layout.desktop.openApplication(e, "Calendar", {"eventId": data.body.id });
+            }
+        });
+    },
     receiveTeamWorkMessage: function(data){
         debugger;
         var task = data.body;

+ 24 - 20
o2web/source/x_component_Calendar/Common.js

@@ -145,22 +145,26 @@ MWFCalendar.EventForm = new Class({
 
         var remind;
         if( data.valarmTime_config ){ //天、时、分、秒
-            var valarmTime_configList = data.valarmTime_config.split(",");
-            valarmTime_configList.each( function( v, i ){
-                var unit;
-                if( i == 0 ){
-                    unit = "天"
-                }else if( i == 1 ){
-                    unit = "小时";
-                }else if( i==2 ){
-                    unit = "分钟"
-                }else{
-                    unit = "秒"
-                }
-                if( v && v!="0" ){
-                    remind = "提前"+ Math.abs(v)+unit+"提醒";
-                }
-            }.bind(this))
+            if( data.valarmTime_config === "0,0,0,-5" ){
+                remind = "开始时提醒";
+            }else{
+                var valarmTime_configList = data.valarmTime_config.split(",");
+                valarmTime_configList.each( function( v, i ){
+                    var unit;
+                    if( i == 0 ){
+                        unit = "天"
+                    }else if( i == 1 ){
+                        unit = "小时";
+                    }else if( i==2 ){
+                        unit = "分钟"
+                    }else{
+                        unit = "秒"
+                    }
+                    if( v && v!="0" ){
+                        remind = "提前"+ Math.abs(v)+unit+"提醒";
+                    }
+                }.bind(this))
+            }
         }
 
         var calendarName =  this.calendarNames[ this.calendarIds.indexOf( data.calendarId ) ];
@@ -866,7 +870,7 @@ MWFCalendar.EventForm = new Class({
         var _self = this;
         var data = this.data;
         var postDelete = function(){
-            this.view.reload();
+            if(this.view)this.view.reload();
             this.close();
         }.bind(this);
         if( this.oldRecurrenceRule ) { //如果是原来是重复的
@@ -893,7 +897,7 @@ MWFCalendar.EventForm = new Class({
     _cancelEvent: function(){
         var view = this.view;
         this.app.actions.deleteSingleEvent(this.data.id, function(){
-            view.reload();
+            if(view)view.reload();
             this.close();
         }.bind(this))
     },
@@ -1031,7 +1035,7 @@ MWFCalendar.EventForm = new Class({
         if( this.formMaskNode )this.formMaskNode.destroy();
         this.formAreaNode.destroy();
         this.fireEvent("postClose");
-        if( this.waitReload )this.view.reload();
+        if( this.waitReload && this.view)this.view.reload();
         delete this;
     }
 });
@@ -1292,7 +1296,7 @@ MWFCalendar.CalendarForm = new Class({
         if( this.formMaskNode )this.formMaskNode.destroy();
         this.formAreaNode.destroy();
         this.fireEvent("postClose");
-        if( this.waitReload )this.view.reload();
+        if( this.waitReload && this.view)this.view.reload();
         delete this;
     }
 });

+ 28 - 0
o2web/source/x_component_Calendar/Main.js

@@ -18,6 +18,7 @@ MWF.xApplication.Calendar.Main = new Class({
         "height": "600",
         "isResize": true,
         "isMax": true,
+        "eventId" : "",
         "title": MWF.xApplication.Calendar.LP.title
     },
     onQueryLoad: function(){
@@ -320,6 +321,10 @@ MWF.xApplication.Calendar.Main = new Class({
         this.getListView(function(){
             this.listView.show();
             this.currentView = this.listView;
+            if( this.options.eventId ){
+                this.openEvent( this.options.eventId );
+                this.options.eventId = "";
+            }
         }.bind(this));
     },
     getListView: function(callback){
@@ -350,6 +355,11 @@ MWF.xApplication.Calendar.Main = new Class({
         this.getMonthView(function(){
             this.monthView.show();
             this.currentView = this.monthView;
+            debugger;
+            if( this.options.eventId ){
+                this.openEvent( this.options.eventId );
+                this.options.eventId = "";
+            }
         }.bind(this));
     },
     getMonthView: function(callback){
@@ -380,6 +390,10 @@ MWF.xApplication.Calendar.Main = new Class({
         this.getWeekView(function(){
             this.weekView.show();
             this.currentView = this.weekView;
+            if( this.options.eventId ){
+                this.openEvent( this.options.eventId );
+                this.options.eventId = "";
+            }
         }.bind(this));
     },
     getWeekView: function(callback){
@@ -410,6 +424,10 @@ MWF.xApplication.Calendar.Main = new Class({
         this.getDayView(function(){
             this.dayView.show();
             this.currentView = this.dayView;
+            if( this.options.eventId ){
+                this.openEvent( this.options.eventId );
+                this.options.eventId = "";
+            }
         }.bind(this), d);
     },
     getDayView: function(callback, d){
@@ -597,6 +615,16 @@ MWF.xApplication.Calendar.Main = new Class({
             this.currentView.resetNodeSize();
         }
         if( this.leftNavi )this.leftNavi.resizeNode();
+    },
+    openEvent : function (id) {
+        debugger;
+        this.actions.getEvent( id, function (json) {
+            var form = new MWF.xApplication.Calendar.EventForm(this, json.data, {
+                isFull : true
+            }, {app:this});
+            form.view = this.currentView;
+            form.open();
+        }.bind(this))
     }
 });