Просмотр исходного кода

修复分组重复选择,任务数量错误等问题

jinfei 5 лет назад
Родитель
Сommit
8827e95b7d

+ 16 - 13
o2web/source/x_component_TeamWork/GroupSelect.js

@@ -44,7 +44,7 @@ MWF.xApplication.TeamWork.GroupSelect = new Class({
 
         this.commonGroupContainer = new Element("div.commonGroupContainer",{styles:this.css.commonGroupContainer}).inject(this.contentNode);
         this.app.setScrollBar(this.commonGroupContainer);
-        this.createCommonGroup();
+        this.createCommonGroup(data);
 
         this.newGroupContainer = new Element("div.newGroupContainer",{styles:this.css.newGroupContainer}).inject(this.contentNode);
         this.newGroupContainer.addEvents({
@@ -160,7 +160,7 @@ MWF.xApplication.TeamWork.GroupSelect = new Class({
 
     },
 
-    createCommonGroup:function(){
+    createCommonGroup:function(newData){
         var _self = this;
         this.app.setLoading(this.commonGroupContainer);
         this.rootActions.ProjectGroupAction.listGroups(function(json){
@@ -171,19 +171,22 @@ MWF.xApplication.TeamWork.GroupSelect = new Class({
             if(data){
                 data.each(function (d,i) {
                     if(i<100){
-                        var groupItemContainer = new Element("div.groupItemContainer",{styles:this.css.groupItemContainer}).inject(this.commonGroupContainer);
-                        var groupItemIcon = new Element("div.groupItemIcon",{styles:this.css.groupItemIcon,id:d.id}).inject(groupItemContainer);
-                        groupItemIcon.addEvents({
-                            click:function(){
-                                _self.selectGroupIcon(this);
-
+                        if(!newData || newData.id!=d.id){
+                            var groupItemContainer = new Element("div.groupItemContainer",{styles:this.css.groupItemContainer}).inject(this.commonGroupContainer);
+                            var groupItemIcon = new Element("div.groupItemIcon",{styles:this.css.groupItemIcon,id:d.id}).inject(groupItemContainer);
+                            groupItemIcon.addEvents({
+                                click:function(){
+                                    _self.selectGroupIcon(this);
+
+                                }
+                            });
+                            var groupItemText = new Element("div.groupItemText",{styles:this.css.groupItemText,text:d.name}).inject(groupItemContainer);
+                            if(_self.getIdInArr(d.id)){
+                                groupItemIcon.setStyle("background-image",groupItemIcon.getStyle("background-image").replace("icon_circle.png","icon_renwu_ywc_click.png"));
+                                groupItemIcon.set("cc","yes");
                             }
-                        });
-                        var groupItemText = new Element("div.groupItemText",{styles:this.css.groupItemText,text:d.name}).inject(groupItemContainer);
-                        if(_self.getIdInArr(d.id)){
-                            groupItemIcon.setStyle("background-image",groupItemIcon.getStyle("background-image").replace("icon_circle.png","icon_renwu_ywc_click.png"));
-                            groupItemIcon.set("cc","yes");
                         }
+
                     }
 
                 }.bind(this))

+ 22 - 0
o2web/source/x_component_TeamWork/Project.js

@@ -275,6 +275,7 @@ MWF.xApplication.TeamWork.Project = new Class({
                 var opt = {
                     onCreateTask:function(){
                         this.createTaskGroup();
+                        this.reloadTaskCountInfor()
                     }.bind(this)
                 };
                 var newTask = new MWF.xApplication.TeamWork.Project.NewTask(this,data,opt,{});
@@ -322,6 +323,24 @@ MWF.xApplication.TeamWork.Project = new Class({
         this.loadTaskLine();
 
         //this.naviTopMyTaskLayout.click();
+    },
+    reloadTaskCountInfor:function(){debugger
+        //刷新任务数量区域
+        window.setTimeout(function(){
+            this.rootActions.TaskAction.statiticMyProject(this.data.id,function(json){
+                this.projectGroupData = json.data;
+                if(this.projectGroupData.groups && this.projectGroupData.groups.length>0){
+                    this.currentProjectGroupData = this.projectGroupData.groups[0]; //默认只有一个分组
+                    this.naviTopMyTaskCount.set("text","("+this.currentProjectGroupData.completedTotal+"/"+this.currentProjectGroupData.taskTotal+")")
+                    this.loadTaskLine();
+                }
+
+            }.bind(this));
+        }.bind(this),1000)
+
+
+
+
     },
     loadTaskLine:function(){
         this.completeLine = new Element("div.completeLine",{styles:this.css.completeLine}).inject(this.naviTopTaskLine);
@@ -565,6 +584,7 @@ MWF.xApplication.TeamWork.Project = new Class({
                             var opt = {
                                 onCreateTask:function(){
                                     this.createTaskGroup();
+                                    this.reloadTaskCountInfor()
                                 }.bind(this)
                             };
                             var newTaskGroup = new MWF.xApplication.TeamWork.Project.NewTaskGroup(this,data,opt,{});
@@ -639,6 +659,7 @@ MWF.xApplication.TeamWork.Project = new Class({
                 var opt = {
                     onCreateTask:function(){
                         this.createTaskGroup();
+                        this.reloadTaskCountInfor()
                     }.bind(this)
                 };
                 var newTask = new MWF.xApplication.TeamWork.Project.NewTask(this,pdata,opt,{});
@@ -1010,6 +1031,7 @@ MWF.xApplication.TeamWork.Project = new Class({
                         callback()
                     }
                     //this.createTaskGroup();
+                    this.reloadTaskCountInfor()
                 }
             }.bind(this)
         };

+ 1 - 1
o2web/source/x_component_TeamWork/ProjectList.js

@@ -402,7 +402,7 @@ MWF.xApplication.TeamWork.ProjectList = new Class({
                     }.bind(this),
                     onPostClose:function(json){
                         //this.reloadLayoutList();
-                        if(json.data && json.data.id){
+                        if(json && json.data && json.data.id){
                             //this.actions.projectGet(json.data.id,function(jsonr){
                             this.actions.get(json.data.id,function(jsonr){
                                 if(jsonr.data){

+ 5 - 2
o2web/source/x_component_TeamWork/Task.js

@@ -175,7 +175,8 @@ MWF.xApplication.TeamWork.Task = new Class({
                                 if(rd.act == "remove"){
                                     this.close(rd);
                                     if(this.data.projectObj){ //reload project
-                                        this.data.projectObj.createTaskGroup()
+                                        this.data.projectObj.createTaskGroup();
+                                        //this.data.projectObj.reloadTaskCountInfor()
                                     }
                                 }
                             }.bind(this)
@@ -365,7 +366,9 @@ MWF.xApplication.TeamWork.Task = new Class({
                     this.selectPerson(this.participateTitleIcon,null,["identity","unit"],0,
                         function(json){
                             if(json.length>0){
-                                this.taskData.participantList = this.taskData.participantList.concat(json);
+                                if(this.taskData.participantList.indexOf(json)>-1){
+                                    this.taskData.participantList = this.taskData.participantList.concat(json);
+                                }
                                 //this.actions.updateParticipantList(this.taskData.id,{participantList:this.taskData.participantList},function(json){
                                 this.actions.updateParticipant(this.taskData.id,{participantList:this.taskData.participantList},function(json){
                                     if(json.data.dynamics){