Jelajahi Sumber

修复新的表单载入机制中,按钮样式和表格边框样式和原方式不一致的问题

huqi 5 tahun lalu
induk
melakukan
344570ee2e

+ 1 - 0
o2web/source/x_component_process_FormDesigner/Module/$Module.js

@@ -959,6 +959,7 @@ MWF.xApplication.process.FormDesigner.Module.$Module = MWF.FC$Module = new Class
 				delete this.json.styles[key];
 			}
 		}.bind(this));
+		this.json.preprocessing = "y";
 	},
 	_recoveryModuleData: function(){
 		if (this.json.recoveryStyles) this.json.styles = this.json.recoveryStyles;

+ 94 - 2
o2web/source/x_component_process_FormDesigner/Module/Button.js

@@ -22,7 +22,7 @@ MWF.xApplication.process.FormDesigner.Module.Button = MWF.FCButton = new Class({
 		this.container = null;
 		this.containerNode = null;
 	},
-	
+
 	_createMoveNode: function(){
 		this.moveNode = new Element("div", {
 			"MWFType": "button",
@@ -94,5 +94,97 @@ MWF.xApplication.process.FormDesigner.Module.Button = MWF.FCButton = new Class({
                 if (button) button.set("text", this.json.id);
 			}
 		}
-	}
+	},
+	_preprocessingModuleData: function(){
+		var button = this.node.getElement("button");
+		button.clearStyles();
+		debugger;
+		button.setStyles(this.css.buttonStyles);
+
+		//if (this.initialStyles) this.node.setStyles(this.initialStyles);
+		this.json.recoveryStyles = Object.clone(this.json.styles);
+
+		if (this.json.recoveryStyles) Object.each(this.json.recoveryStyles, function(value, key){
+			if ((value.indexOf("x_processplatform_assemble_surface")!=-1 || value.indexOf("x_portal_assemble_surface")!=-1)){
+				//需要运行时处理
+			}else{
+				button.setStyle(key, value);
+				delete this.json.styles[key];
+			}
+		}.bind(this));
+		this.json.preprocessing = "y";
+	},
+	_recoveryModuleData: function(){
+		// var button = this.node.getElement("button");
+		// button.clearStyles();
+		// button.setStyles(this.css.buttonIcon);
+		//
+		if (this.json.recoveryStyles) this.json.styles = this.json.recoveryStyles;
+		this.json.recoveryStyles = null;
+	},
+	setCustomStyles: function(){
+		this._recoveryModuleData();
+		//debugger;
+		var border = this.node.getStyle("border");
+		this.node.clearStyles();
+		this.node.setStyles(this.css.moduleNode);
+
+		if (this.initialStyles) this.node.setStyles(this.initialStyles);
+		this.node.setStyle("border", border);
+
+		var button = this.node.getElement("button");
+		button.clearStyles();
+		button.setStyles(this.css.buttonIcon);
+
+		if (this.json.styles) Object.each(this.json.styles, function(value, key){
+			if ((value.indexOf("x_processplatform_assemble_surface")!=-1 || value.indexOf("x_portal_assemble_surface")!=-1)){
+				var host1 = MWF.Actions.getHost("x_processplatform_assemble_surface");
+				var host2 = MWF.Actions.getHost("x_portal_assemble_surface");
+				if (value.indexOf("/x_processplatform_assemble_surface")!==-1){
+					value = value.replace("/x_processplatform_assemble_surface", host1+"/x_processplatform_assemble_surface");
+				}else if (value.indexOf("x_processplatform_assemble_surface")!==-1){
+					value = value.replace("x_processplatform_assemble_surface", host1+"/x_processplatform_assemble_surface");
+				}
+				if (value.indexOf("/x_portal_assemble_surface")!==-1){
+					value = value.replace("/x_portal_assemble_surface", host2+"/x_portal_assemble_surface");
+				}else if (value.indexOf("x_portal_assemble_surface")!==-1){
+					value = value.replace("x_portal_assemble_surface", host2+"/x_portal_assemble_surface");
+				}
+			}
+
+			var reg = /^border\w*/ig;
+			if (!key.test(reg)){
+				if (key){
+					if (key.toString().toLowerCase()==="display"){
+						if (value.toString().toLowerCase()==="none"){
+							this.node.setStyle("opacity", 0.3);
+						}else{
+							this.node.setStyle("opacity", 1);
+							this.node.setStyle(key, value);
+						}
+					}else{
+						button.setStyle(key, value);
+					}
+				}
+			}
+			//this.node.setStyle(key, value);
+		}.bind(this));
+
+		// Object.each(this.json.styles, function(value, key){
+		// 	var reg = /^border\w*/ig;
+		// 	if (!key.test(reg)){
+		// 		if (key){
+		// 			if (key.toString().toLowerCase()==="display"){
+		// 				if (value.toString().toLowerCase()==="none"){
+		//                    this.node.setStyle("opacity", 0.3);
+		// 				}else{
+		//                    this.node.setStyle("opacity", 1);
+		// 				}
+		// 			}else{
+		//                this.node.setStyle(key, value);
+		// 			}
+		// 		}
+		// 	}
+		// }.bind(this));
+	},
 });

+ 19 - 2
o2web/source/x_component_process_FormDesigner/Module/Button/default/css.wcss

@@ -50,6 +50,23 @@
 		"cursor": "pointer",
 		"border": "0px",
 		"margin": "0px"
-	}
+	},
+	"buttonStyles": {
+        "color" : "#777",
+        "border-radius": "5px",
+        "border-top": "1px solid #ccc",
+        "border-left": "1px solid #ccc",
+        "border-right": "1px solid #ccc",
+        "border-bottom": "1px solid #ccc",
+        "overflow": "hidden",
+        "cursor": "pointer",
+        "-webkit-user-select": "none",
+        "-moz-user-select": "none",
+        "position": "static",
+        "top": "auto",
+        "left": "auto",
+        "opacity": 1,
+        "height": "26px"
+    }
 	
-}
+}

+ 7 - 1
o2web/source/x_component_process_FormDesigner/Module/Datagrid.js

@@ -97,6 +97,9 @@ MWF.xApplication.process.FormDesigner.Module.Datagrid = MWF.FCDatagrid = new Cla
 					tdContainer = new MWF.FCDatagrid$Data(this.form);
 					tdContainer.load(moduleData, td, this);
 				}else{
+					var moduleData = Object.clone(data);
+					Object.merge(moduleData, json);
+					Object.merge(json, moduleData);
 					tdContainer = new MWF.FCDatagrid$Data(this.form);
 					tdContainer.load(json, td, this);
 				}
@@ -117,6 +120,9 @@ MWF.xApplication.process.FormDesigner.Module.Datagrid = MWF.FCDatagrid = new Cla
 					thElement = new MWF.FCDatagrid$Title(this.form);
 					thElement.load(moduleData, th, this);
 				}else{
+					var moduleData = Object.clone(data);
+					Object.merge(moduleData, json);
+					Object.merge(json, moduleData);
 					thElement = new MWF.FCDatagrid$Title(this.form);
 					thElement.load(json, th, this);
 				}
@@ -394,4 +400,4 @@ MWF.xApplication.process.FormDesigner.Module.Datagrid = MWF.FCDatagrid = new Cla
         }.bind(this));
     }
 	
-});
+});

+ 7 - 1
o2web/source/x_component_process_FormDesigner/Module/Tab.js

@@ -215,6 +215,9 @@ MWF.xApplication.process.FormDesigner.Module.Tab = MWF.FCTab = new Class({
 					tabPage.page = page;
 					tabPage.load(moduleData, page.tabNode, this);
 				}else{
+					var moduleData = Object.clone(data);
+					Object.merge(moduleData, json);
+					Object.merge(json, moduleData);
 					tabPage = new MWF.FCTab$Page(this, page);
 					tabPage.page = page;
 					tabPage.load(json, page.tabNode, this);
@@ -236,6 +239,9 @@ MWF.xApplication.process.FormDesigner.Module.Tab = MWF.FCTab = new Class({
 					tabContent.page = page;
 					tabContent.load(moduleData, page.contentNode, this);
 				}else{
+					var moduleData = Object.clone(data);
+					Object.merge(moduleData, json);
+					Object.merge(json, moduleData);
 					tabContent = new MWF.FCTab$Content(this, page);
 					tabContent.page = page;
 					tabContent.load(json, page.contentNode, this);
@@ -398,4 +404,4 @@ MWF.xApplication.process.FormDesigner.Module.Tab = MWF.FCTab = new Class({
 	setCustomStyles: function(){
 		this._recoveryModuleData();
 	}
-});
+});

+ 24 - 1
o2web/source/x_component_process_FormDesigner/Module/Table.js

@@ -280,6 +280,9 @@ MWF.xApplication.process.FormDesigner.Module.Table = MWF.FCTable = new Class({
                     tdContainer.table = this;
 					tdContainer.load(moduleData, td, this);
 				}else{
+					var moduleData = Object.clone(data);
+					Object.merge(moduleData, json);
+					Object.merge(json, moduleData);
 					tdContainer = new MWF.FCTable$Td(this.form);
                     tdContainer.table = this;
 					tdContainer.load(json, td, this);
@@ -551,6 +554,26 @@ MWF.xApplication.process.FormDesigner.Module.Table = MWF.FCTable = new Class({
 	getContainerNodes: function(){
 		//return this.node.getElements("td");
         return this._getTds();
+	},
+	_preprocessingModuleData: function(){
+		this.node.clearStyles();
+		//if (this.initialStyles) this.node.setStyles(this.initialStyles);
+		this.json.recoveryStyles = Object.clone(this.json.styles);
+
+		if (this.json.recoveryStyles) Object.each(this.json.recoveryStyles, function(value, key){
+			if ((value.indexOf("x_processplatform_assemble_surface")!=-1 || value.indexOf("x_portal_assemble_surface")!=-1)){
+				//需要运行时处理
+			}else{
+				var reg = /^border\w*/ig;
+				if (!key.test(reg)){
+					if (key){
+						this.node.setStyle(key, value);
+						delete this.json.styles[key];
+					}
+				}
+			}
+		}.bind(this));
+		this.json.preprocessing = "y";
 	}
 	
-});
+});

+ 1 - 0
o2web/source/x_component_process_Xform/$Module.js

@@ -1,3 +1,4 @@
+
 MWF.require("MWF.widget.Common", null, false);
 MWF.xApplication.process.Xform.$Module = MWF.APP$Module =  new Class({
     Implements: [Events],

+ 10 - 3
o2web/source/x_component_process_Xform/Button.js

@@ -5,16 +5,23 @@ MWF.xApplication.process.Xform.Button = MWF.APPButton =  new Class({
     iconStyle: "personfieldIcon",
 
     _loadUserInterface: function(){
-        var button = new Element("button");
+        // var button = new Element("button");
+        // button.inject(this.node, "after");
+        // this.node.destroy();
+        // this.node = button;
+
+        var button = this.node.getElement("button");
         button.inject(this.node, "after");
         this.node.destroy();
         this.node = button;
+
         this.node.set({
             "id": this.json.id,
             "text": this.json.name || this.json.id,
-            "styles": this.form.css.buttonStyles,
             "MWFType": this.json.type
         });
+        if (!this.json.preprocessing) this.node.setStyles(this.form.css.buttonStyles);
+
     }
 
-}); 
+}); 

+ 2 - 2
o2web/source/x_component_process_Xform/Table.js

@@ -66,7 +66,7 @@ MWF.xApplication.process.Xform.Table = MWF.APPTable =  new Class({
             tds.setStyles({
                 "border-bottom": this.json.styles.border,
                 "border-right": this.json.styles.border,
-                "background": "transparent"
+                //"background": "transparent"
             });
         }
     },
@@ -156,4 +156,4 @@ MWF.xApplication.process.Xform.Table$Td = MWF.APPTable$Td =  new Class({
             }.bind(this))
         }
     }
-});
+});