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

修复页面设置树组件样式无效的问题

unknown 5 лет назад
Родитель
Сommit
84c014907a
1 измененных файлов с 24 добавлено и 23 удалено
  1. 24 23
      o2web/source/x_component_process_FormDesigner/Module/Tree.js

+ 24 - 23
o2web/source/x_component_process_FormDesigner/Module/Tree.js

@@ -7,10 +7,10 @@ MWF.xApplication.process.FormDesigner.Module.Tree = MWF.FCTree = new Class({
 		"style": "default",
 		"propertyPath": "../x_component_process_FormDesigner/Module/Tree/tree.html"
 	},
-	
+
 	initialize: function(form, options){
 		this.setOptions(options);
-		
+
 		this.path = "../x_component_process_FormDesigner/Module/Tree/";
 		this.cssPath = "../x_component_process_FormDesigner/Module/Tree/"+this.options.style+"/css.wcss";
 
@@ -22,7 +22,7 @@ MWF.xApplication.process.FormDesigner.Module.Tree = MWF.FCTree = new Class({
 		this.container = null;
 		this.containerNode = null;
 	},
-	
+
 	_createMoveNode: function(){
 		this.moveNode = new Element("div", {
 			"MWFType": "tree",
@@ -37,7 +37,7 @@ MWF.xApplication.process.FormDesigner.Module.Tree = MWF.FCTree = new Class({
 	},
 	_initModule: function(){
 		this._setNodeProperty();
-        if (!this.form.isSubform) this._createIconAction();
+		if (!this.form.isSubform) this._createIconAction();
 		this._setNodeEvent();
 		this._refreshTree();
 	},
@@ -49,13 +49,13 @@ MWF.xApplication.process.FormDesigner.Module.Tree = MWF.FCTree = new Class({
 			this._setTreeWidgetStyles();
 			this._refreshTree();
 		}
-        if (name=="dataType") this._refreshTree();
+		if (name=="dataType") this._refreshTree();
 	},
 	_setTreeStyles: function(){
-		this.json.areaNodeStyle = this.tree.css.areaNode;
-		this.json.treeItemNodeStyle = this.tree.css.treeItemNode;
-		this.json.textDivNodeStyle = this.tree.css.textDivNode;
-		this.json.textDivNodeSelectedStyle = this.tree.css.textDivNodeSelected;
+		this.json.areaNodeStyle = Object.merge( this.tree.css.areaNode , this.json.areaNodeStyle||{});
+		this.json.treeItemNodeStyle = Object.merge( this.tree.css.treeItemNode, this.json.treeItemNodeStyle||{});
+		this.json.textDivNodeStyle = Object.merge( this.tree.css.textDivNode, this.json.textDivNodeStyle||{});
+		this.json.textDivNodeSelectedStyle = Object.merge( this.tree.css.textDivNodeSelected, this.json.textDivNodeSelectedStyle||{});
 	},
 	_setTreeWidgetStyles: function(){
 		this.tree.css.areaNode = this.json.areaNodeStyle;
@@ -65,24 +65,25 @@ MWF.xApplication.process.FormDesigner.Module.Tree = MWF.FCTree = new Class({
 	},
 	_refreshTree: function(){
 
-        var treeData = this.json.data
-        if (this.json.dataType == "script"){
-            treeData = [
-                {
-                    "title": "[script]",
-                    "text": "[script]",
-                    "id": "1",
-                    "icon": "none",
-                    "action": "",
-                    "expand": true,
-                    "sub": []
-                }
-            ];
-        }
+		var treeData = this.json.data;
+		if (this.json.dataType == "script"){
+			treeData = [
+				{
+					"title": "[script]",
+					"text": "[script]",
+					"id": "1",
+					"icon": "none",
+					"action": "",
+					"expand": true,
+					"sub": []
+				}
+			];
+		}
 
 		if (!this.tree){
 			this.node.empty();
 			this.tree = new MWF.widget.Tree(this.node, {"style":"form"});
+			this._setTreeWidgetStyles();
 			this.tree.load(treeData);
 			this._setTreeStyles();
 		}else{