Jelajahi Sumber

Merge branch 'fix/CMS.list_error' into 'release'

Merge of fix/[内容管理]修复设置列表的时候刷新出错的问题 to release

See merge request o2oa/o2oa!363
蔡祥熠 5 tahun lalu
induk
melakukan
80c4669df4

+ 3 - 2
o2web/source/x_component_cms_Module/Main.js

@@ -1172,6 +1172,7 @@ MWF.xApplication.cms.Module.NaviCategory = new Class({
 		}
 	},
 	getRevealData: function(){
+		debugger;
 		var j = this.data.extContent;
 		if( j ){
 			this.extContent = JSON.parse( j );
@@ -1195,10 +1196,10 @@ MWF.xApplication.cms.Module.NaviCategory = new Class({
 			}.bind(this), null, false );
 		}
 
-		this.extContent.reveal.each( function( r ){
+		this.extContent.reveal.each( function( r, i ){
 			if(this.data.defaultViewName && r.id == this.data.defaultViewName ){
 				this.defaultRevealData = r;
-			}else{
+			}else if( i>0 ){
 				this.isExpended = true;
 				this.hasSub = true;
 			}

+ 12 - 13
o2web/source/x_component_cms_ViewDesigner/$Main/fieldConfig.json

@@ -70,26 +70,25 @@
       "name":"creatorPerson",
       "type":"string"
     },
-    {
-      "name":"creatorPersonShort",
-      "type":"string"
-    },
+//    {
+//      "name":"creatorPersonShort",
+//      "type":"string"
+//    },
     {
       "name":"creatorUnitName",
       "type":"string"
     },
-    {
-      "name":"creatorUnitNameShort",
-      "type":"string"
-    },
+//    {
+//      "name":"creatorUnitNameShort",
+//      "type":"string"
+//    },
     {
       "name":"creatorTopUnitName",
       "type":"string"
-    },
-
-    {
-      "name":"creatorTopUnitNameShort",
-      "type":"string"
     }
+//    {
+//      "name":"creatorTopUnitNameShort",
+//      "type":"string"
+//    }
   ]
 }

+ 53 - 23
o2web/source/x_component_cms_ViewDesigner/Main.js

@@ -22,9 +22,25 @@ MWF.xApplication.cms.ViewDesigner.Main = new Class({
 	onQueryLoad: function(){
         this.shortcut = true;
         if (!this.options.id && this.status){
-            this.options.application = this.status.applicationId;
-            this.application = this.status.application;
             this.options.id = this.status.id;
+            // this.options.application = this.status.applicationId;
+        }else if( this.options.id && this.options.id.toLowerCase().indexOf("viewdesigner") > -1 ){
+            if( this.status && this.status.id ){
+                this.options.id = this.status.id;
+            }else{
+                this.options.id = "";
+            }
+        }
+
+        if( !this.options.formId && this.status && this.status.formId ){
+            this.options.formId = this.status.formId;
+        }
+
+        if( !this.application && this.status && this.status.applicationId ){
+            this.application = {
+                id : this.status.applicationId,
+                appName : this.status.applicationName
+            }
         }
 
 		if (!this.options.id){
@@ -145,7 +161,7 @@ MWF.xApplication.cms.ViewDesigner.Main = new Class({
 
     loadViewList: function(){
         this.actions.listView(this.application.id, function (json) {
-            json.data.each(function(view){
+            ( json.data || [] ).each(function(view){
                 this.createListViewItem(view);
             }.bind(this));
         }.bind(this), null, false);
@@ -185,7 +201,14 @@ MWF.xApplication.cms.ViewDesigner.Main = new Class({
 
     loadRelativeForm : function( formId, callback ){
         this.actions.getForm(formId, function(json){
+            debugger;
             this.relativeFormData = (json.data.data) ? JSON.decode(MWF.decodeJsonString(json.data.data)): null;
+            if( !this.relativeForm ){
+                this.relativeForm = {
+                    id : this.relativeFormData.json.id,
+                    name : this.relativeFormData.json.name
+                }
+            }
            this.getFields( callback );
         }.bind(this));
     },
@@ -386,26 +409,26 @@ MWF.xApplication.cms.ViewDesigner.Main = new Class({
 		}
 	},
 	loadNewViewData: function(callback){
-        var data = {
-            "content": {
-                "isNew" : true,
-                "name": "",
-                "id": this.actions.getUUID(),
-                "application": this.application.id,
-                "applicationName" : this.application.appName,
-                "alias": "",
-                "description": "",
-                "relativeForm" : this.relativeForm,
-                "events" : null,
-                "columns" :[],
-                "jsheader" : null,
-                "sortType" : "DESC"
-            }
-        };
-        this.createListViewItem(data, true); 
         this.loadRelativeForm( this.options.formId || this.relativeForm.id, function(){
+            var data = {
+                "content": {
+                    "isNew" : true,
+                    "name": "",
+                    "id": this.actions.getUUID(),
+                    "application": this.application.id,
+                    "applicationName" : this.application.appName,
+                    "alias": "",
+                    "description": "",
+                    "relativeForm" : this.relativeForm,
+                    "events" : null,
+                    "columns" :[],
+                    "jsheader" : null,
+                    "sortType" : "DESC"
+                }
+            };
+            this.createListViewItem(data, true);
             if (callback) callback(data);
-        })
+        }.bind(this))
 	},
 	loadViewData: function(id, callback){
 		this.actions.getView(id, function(data){
@@ -463,12 +486,19 @@ MWF.xApplication.cms.ViewDesigner.Main = new Class({
             var currentId = this.tab.showPage.view.data.id;
             var status = {
                 "id": this.options.id,
-                "application": this.application,
+                "applicationId": this.application.id,
+                "applicationName" : this.application.appName,
+                "formId" : this.options.formId || this.relativeForm.id,
                 "openViews": openViews,
                 "currentId": currentId
             };
             return status;
         }
-        return {"id": this.options.id, "application": this.application};
+        return {
+            "id": this.options.id,
+            "applicationId": this.application.id,
+            "applicationName" : this.application.appName,
+            "formId" : this.options.formId || this.relativeForm.id
+        };
     }
 });

+ 3 - 3
o2web/source/x_component_query_ViewDesigner/Property.js

@@ -450,7 +450,7 @@ MWF.xApplication.query.ViewDesigner.Property = MWF.FVProperty = new Class({
             personUnitNodes.each(function(node){
                 new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.view.designer, {
                     "type": "unit",
-                    "names": (this.data.data.where) ? this.data.data.where.unitList : [],
+                    "names": (this.data.data.where) ? this.data.data.where.creatorUnitList : [],
                     "onChange": function(ids){this.savePersonSelectItem(node, ids);}.bind(this)
                 });
             }.bind(this));
@@ -458,7 +458,7 @@ MWF.xApplication.query.ViewDesigner.Property = MWF.FVProperty = new Class({
             personNodes.each(function(node){
                 new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.view.designer, {
                     "type": "person",
-                    "names": (this.data.data.where) ? this.data.data.where.personList : [],
+                    "names": (this.data.data.where) ? this.data.data.where.creatorPersonList : [],
                     "onChange": function(ids){this.savePersonSelectItem(node, ids);}.bind(this)
                 });
             }.bind(this));
@@ -466,7 +466,7 @@ MWF.xApplication.query.ViewDesigner.Property = MWF.FVProperty = new Class({
             identityNodes.each(function(node){
                 new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.view.designer, {
                     "type": "identity",
-                    "names": (this.data.data.where) ? this.data.data.where.identityList : [],
+                    "names": (this.data.data.where) ? this.data.data.where.creatorIdentityList : [],
                     "onChange": function(ids){this.savePersonSelectItem(node, ids);}.bind(this)
                 });
             }.bind(this));

+ 46 - 0
o2web/source/x_component_query_ViewDesigner/View.js

@@ -628,6 +628,28 @@ MWF.xApplication.query.ViewDesigner.View = new Class({
             return false;
         }
 
+        var list;
+        if( this.data.data && this.data.data.where ){
+            if( this.data.data.where.creatorIdentityList ){
+                list = this.data.data.where.creatorIdentityList;
+                for( var i=0; i< list.length ; i++){
+                    if( typeOf( list[i] ) === "object" )list[i] = list[i].name || "";
+                }
+            }
+            if( this.data.data.where.creatorPersonList ){
+                list = this.data.data.where.creatorPersonList;
+                for( var i=0; i< list.length ; i++){
+                    if( typeOf( list[i] ) === "object" )list[i] = list[i].name || "";
+                }
+            }
+            if( this.data.data.where.creatorUnitList ){
+                list = this.data.data.where.creatorIdentityList;
+                for( var i=0; i< list.length ; i++){
+                    if( typeOf( list[i] ) === "object" )list[i] = list[i].name || "";
+                }
+            }
+        }
+
         this.designer.actions.saveView(this.data, function(json){
             this.data.id = json.data.id;
             this.isNewView = false;
@@ -645,6 +667,30 @@ MWF.xApplication.query.ViewDesigner.View = new Class({
                 return false;
             }
         //}
+
+        debugger;
+            var list;
+            if( this.data.data && this.data.data.where ){
+                if( this.data.data.where.creatorIdentityList ){
+                    list = this.data.data.where.creatorIdentityList;
+                    for( var i=0; i< list.length ; i++){
+                        if( typeOf( list[i] ) === "object" )list[i] = list[i].name || "";
+                    }
+                }
+                if( this.data.data.where.creatorPersonList ){
+                    list = this.data.data.where.creatorPersonList;
+                    for( var i=0; i< list.length ; i++){
+                        if( typeOf( list[i] ) === "object" )list[i] = list[i].name || "";
+                    }
+                }
+                if( this.data.data.where.creatorUnitList ){
+                    list = this.data.data.where.creatorUnitList;
+                    for( var i=0; i< list.length ; i++){
+                        if( typeOf( list[i] ) === "object" )list[i] = list[i].name || "";
+                    }
+                }
+            }
+
         this.designer.actions.saveView(this.data, function(json){
             this.designer.notice(this.designer.lp.notice.save_success, "success", this.node, {"x": "left", "y": "bottom"});
             this.isNewView = false;