فهرست منبع

设计搜索功能

huqi 5 سال پیش
والد
کامیت
9bfaaa4700
2فایلهای تغییر یافته به همراه105 افزوده شده و 48 حذف شده
  1. 89 31
      o2web/source/x_component_FindDesigner/FindWorker.js
  2. 16 17
      o2web/source/x_component_FindDesigner/Main.js

+ 89 - 31
o2web/source/x_component_FindDesigner/FindWorker.js

@@ -322,66 +322,124 @@ _worker._setFilterOptionRegex = function(){
     }
     }
 };
 };
 
 
-_worker._findProcessPlatformParse_script = function(designer, option){
+_worker._findProcessPlatformParse_script = function(designer, option, module){
     if (designer.patternList && designer.patternList.length){
     if (designer.patternList && designer.patternList.length){
-        var action = this.findData.actions.getProcessScript;
-
-        var p = _worker.action.sendRequest(_worker._getRequestOption({"url": action}, {"id": designer.designerId}));
-        p.then(function(json){
+        // var action = this.findData.actions.getProcessScript;
+        //
+        // var p = _worker.action.sendRequest(_worker._getRequestOption({"url": action}, {"id": designer.designerId}));
+        // p.then(function(json){
             designer.patternList.forEach(function(pattern){
             designer.patternList.forEach(function(pattern){
                 if (pattern.property=="text"){
                 if (pattern.property=="text"){
-                    var scriptLines = json.data.text.split(/\n/);
+                    //var scriptLines = json.data.text.split(/\n/);
                     pattern.lines.forEach(function(line){
                     pattern.lines.forEach(function(line){
-                        var scriptText = scriptLines[line-1];
-                        while ((arr = this.keywordRegexp.exec(scriptText)) !== null) {
-                            var col = arr.index;
-                            var key = arr[0];
-                            var value = arr.input;
-                            _worker._findMessageReply(_worker._createFindMessageReplyData("processPlatform", designer, json.data.aliase, {
-                                "property": pattern.property,
-                                "value": value,
-                                "line": line,
-                                "column": col,
-                                "key": key
-                            }), option);
-                        }
+                        var scriptText = line.lineValue;
+                        _worker._findMessageReply(_worker._createFindMessageReplyData(module, designer, "", {
+                            "property": pattern.property,
+                            "value": scriptText,
+                            "line": line.line
+                        }), option);
+
+                        // var scriptText = scriptLines[line-1];
+                        // while ((arr = this.keywordRegexp.exec(scriptText)) !== null) {
+                        //     var col = arr.index;
+                        //     var key = arr[0];
+                        //     var value = arr.input;
+                        //     _worker._findMessageReply(_worker._createFindMessageReplyData("processPlatform", designer, json.data.aliase, {
+                        //         "property": pattern.property,
+                        //         "value": value,
+                        //         "line": line,
+                        //         "column": col,
+                        //         "key": key
+                        //     }), option);
+                        // }
                     });
                     });
                 }else{
                 }else{
-                    _worker._findMessageReply(_worker._createFindMessageReplyData("processPlatform", designer, json.data.aliase, {
+                    _worker._findMessageReply(_worker._createFindMessageReplyData(module, designer, "", {
                         "property": pattern.property,
                         "property": pattern.property,
-                        "value": json.data[pattern.property]
+                        "value": pattern.propertyValue
                     }), option);
                     }), option);
                 }
                 }
             });
             });
-        }, function(){});
+        //}, function(){});
     }
     }
 };
 };
 
 
-_worker._findProcessPlatformParse_form = function(designer){
+_worker._findProcessPlatformParse_form = function(designer, option, module){
+    if (designer.patternList && designer.patternList.length){
+        var patternPropertys = designer.patternList.map(function(a){return a.property;});
+
+
+        //designer.patternList.forEach(function(pattern){
+            //if (pattern.property=="data"){
+
+
+                var action = "";
+                if (module=="processPlatform") action = this.findData.actions.getProcessForm
+                else if (module=="cms") action = this.findData.actions.getCmsForm;
 
 
+                if (action){
+                    var p = _worker.action.sendRequest(_worker._getRequestOption({"url": action}, {"id": designer.designerId}));
+                    p.then(function(json){
+                        if (patternPropertys.indexOf("data")!=-1){
+                            var formData = JSON.decode(MWF.decodeJsonString(json.data.data));
+
+
+                        }
+
+                        if (patternPropertys.indexOf("mobileData")!=-1){
+
+                        }
+
+                    }, function(){});
+                }
+
+
+
+                //var scriptLines = json.data.text.split(/\n/);
+                // pattern.lines.forEach(function(line){
+                //     var scriptText = line.lineValue;
+                //     _worker._findMessageReply(_worker._createFindMessageReplyData(module, designer, "", {
+                //         "property": pattern.property,
+                //         "value": scriptText,
+                //         "line": line.line
+                //     }), option);
+                //
+                //
+                // });
+            //}
+            // else{
+            //     _worker._findMessageReply(_worker._createFindMessageReplyData(module, designer, "", {
+            //         "property": pattern.property,
+            //         "value": pattern.propertyValue
+            //     }), option);
+            // }
+        //});
+    }
 };
 };
 
 
 _worker._findProcessPlatformParse_process = function(designer){
 _worker._findProcessPlatformParse_process = function(designer){
 
 
 };
 };
 
 
-_worker._findProcessPlatformParse = function(resultList, option){
+_worker._findProcessPlatformParse = function(resultList, option, module){
     resultList.forEach(function(designer){
     resultList.forEach(function(designer){
         switch (designer.designerType){
         switch (designer.designerType){
             case "script":
             case "script":
-                _worker._findProcessPlatformParse_script(designer, option);
+                _worker._findProcessPlatformParse_script(designer, option, module);
                 break;
                 break;
             case "form":
             case "form":
-                _worker._findProcessPlatformParse_form(designer, option);
+                _worker._findProcessPlatformParse_form(designer, option, module);
                 break;
                 break;
             case "process":
             case "process":
-                _worker._findProcessPlatformParse_process(designer, option);
+                _worker._findProcessPlatformParse_process(designer, option, module);
                 break;
                 break;
         }
         }
     });
     });
 };
 };
 
 
 
 
+
+
 _worker._doFindDesigner = function(option, idx){
 _worker._doFindDesigner = function(option, idx){
 
 
     var option = this.filterOptionList[idx];
     var option = this.filterOptionList[idx];
@@ -407,19 +465,19 @@ _worker._doFindDesigner = function(option, idx){
                 //     "pattern": json.data.processPlatformList
                 //     "pattern": json.data.processPlatformList
                 // });
                 // });
 
 
-               _worker._findProcessPlatformParse(json.data.processPlatformList, option);
+               _worker._findProcessPlatformParse(json.data.processPlatformList, option, "processPlatform");
             }
             }
             if (json.data.cmsList && json.data.cmsList.length){
             if (json.data.cmsList && json.data.cmsList.length){
-
+                _worker._findProcessPlatformParse(json.data.cmsList, option, "cms");
             }
             }
             if (json.data.portalList && json.data.portalList.length){
             if (json.data.portalList && json.data.portalList.length){
-
+                _worker._findProcessPlatformParse(json.data.portalList, option, "portal");
             }
             }
             if (json.data.queryList && json.data.queryList.length){
             if (json.data.queryList && json.data.queryList.length){
 
 
             }
             }
             if (json.data.serviceList && json.data.serviceList.length){
             if (json.data.serviceList && json.data.serviceList.length){
-
+                _worker._findProcessPlatformParse(json.data.serviceList, option, "service");
             }
             }
             _worker._findOptionReply();
             _worker._findOptionReply();
 
 

+ 16 - 17
o2web/source/x_component_FindDesigner/Main.js

@@ -493,40 +493,39 @@ MWF.xApplication.FindDesigner.Main = new Class({
 
 
 		//}.bind(this));
 		//}.bind(this));
 	},
 	},
-	getPatternPropertyValue: function(value, regexp){
+	getPatternValue: function(value, regexp){
 		regexp.lastIndex = 0;
 		regexp.lastIndex = 0;
 		var valueHtml = "";
 		var valueHtml = "";
 		var idx = 0;
 		var idx = 0;
 		while ((arr = regexp.exec(value)) !== null) {
 		while ((arr = regexp.exec(value)) !== null) {
-			valueHtml += value.substring(idx, arr.index);
-			valueHtml += "<span style='background-color: #ffef8f'>"+value.substring(arr.index, regexp.lastIndex)+"</span>";
+			valueHtml += o2.common.encodeHtml(value.substring(idx, arr.index));
+			valueHtml += "<span style='background-color: #ffef8f'>"+o2.common.encodeHtml(value.substring(arr.index, regexp.lastIndex))+"</span>";
 			idx = regexp.lastIndex;
 			idx = regexp.lastIndex;
 		}
 		}
-		valueHtml += value.substring(idx, value.length);
-		return valueHtml;
-	},
-	getPatternScriptValue: function(pattern, regexp){
-		regexp.lastIndex = 0;
-		var valueHtml = "";
-
-		valueHtml += pattern.value.substring(0, pattern.column);
-		valueHtml += "<span style='background-color: #ffef8f'><b>"+pattern.value.substring(pattern.column, pattern.column+pattern.key.length)+"</b></span>";
-		valueHtml += pattern.value.substring(pattern.column+pattern.key.length, pattern.value.length);
-
+		valueHtml += o2.common.encodeHtml(value.substring(idx, value.length));
 		return valueHtml;
 		return valueHtml;
 	},
 	},
+	// getPatternScriptValue: function(pattern, regexp){
+	// 	regexp.lastIndex = 0;
+	// 	var valueHtml = "";
+	//
+	// 	valueHtml += pattern.value.substring(0, pattern.column);
+	// 	valueHtml += "<span style='background-color: #ffef8f'><b>"+pattern.value.substring(pattern.column, pattern.column+pattern.key.length)+"</b></span>";
+	// 	valueHtml += pattern.value.substring(pattern.column+pattern.key.length, pattern.value.length);
+	//
+	// 	return valueHtml;
+	// },
 	createScriptPatternNode: function(data, node, regexp){
 	createScriptPatternNode: function(data, node, regexp){
 		debugger;
 		debugger;
 		var patternNode;
 		var patternNode;
 		var text;
 		var text;
 		if (data.pattern.property=="text"){
 		if (data.pattern.property=="text"){
-			text = "<span style='color: #666666'>"+data.pattern.line+"</span>"+this.getPatternScriptValue(data.pattern, regexp);
+			text = "<span style='color: #666666'>"+data.pattern.line+"</span>&nbsp;&nbsp;"+this.getPatternValue(data.pattern.value, regexp);
 			patternNode = this.createResultPatternItem(text, "", node);
 			patternNode = this.createResultPatternItem(text, "", node);
 		}else{
 		}else{
-			text = this.lp.property+":<b>"+data.pattern.property+"</b> "+this.lp.value+":"+this.getPatternPropertyValue(data.pattern.value, regexp);
+			text = this.lp.property+":&nbsp;<b>"+data.pattern.property+"</b> "+this.lp.value+":&nbsp;"+this.getPatternValue(data.pattern.value, regexp);
 			patternNode = this.createResultPatternItem(text, "", node);
 			patternNode = this.createResultPatternItem(text, "", node);
 		}
 		}
-
 	},
 	},
 	getFilterOptionRegex: function(option){
 	getFilterOptionRegex: function(option){
 		var keyword = option.keyword;
 		var keyword = option.keyword;