diff --git a/o2web/source/x_component_query_StatementDesigner/$Statement/column.html b/o2web/source/x_component_query_StatementDesigner/$Statement/column.html index 2d0afedf021aea395d2abfcb7225017263db54f6..ebece5bcac5e63576d67165b50b67bbbdfdc65be 100644 --- a/o2web/source/x_component_query_StatementDesigner/$Statement/column.html +++ b/o2web/source/x_component_query_StatementDesigner/$Statement/column.html @@ -32,105 +32,19 @@
数据
-
- - - - - -
选择数据:
-
-
- - - - - -
选择数据:
-
- +
数据路径: + +
注:指该列相对单条数据的路径。比如 0,title,或 0.title
+
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/o2web/source/x_component_query_StatementDesigner/$Statement/view.html b/o2web/source/x_component_query_StatementDesigner/$Statement/view.html index 3e7cbb56c1a9aae97b0e8b92ffd25a1d5f9e1b70..59d4f4309b64ad28368613290bb28c54c1f61166 100644 --- a/o2web/source/x_component_query_StatementDesigner/$Statement/view.html +++ b/o2web/source/x_component_query_StatementDesigner/$Statement/view.html @@ -48,7 +48,6 @@ @@ -67,7 +66,7 @@ - + - + - - - - - + + + + + + + + + + + + +
隐藏:每页行数: -
注:每页最大行数为2000条
无分类和选择隐藏首列无选择隐藏首列 否 @@ -107,48 +106,14 @@
路径: + +
注:路径的写法是表别名.字段名,如:o.title
+
数据类型:
- 作为默认过滤条件
- 作为自定义过滤数据 -
-
@@ -371,21 +159,11 @@
-
默认过滤条件
-
自定义过滤数据
- - - - - - - -
diff --git a/o2web/source/x_component_query_StatementDesigner/Property.js b/o2web/source/x_component_query_StatementDesigner/Property.js index 40e02ce9407a14eb346485a215445b9335ef2e8b..5f81cf2f638825b4b251eb60de797247fb106749 100644 --- a/o2web/source/x_component_query_StatementDesigner/Property.js +++ b/o2web/source/x_component_query_StatementDesigner/Property.js @@ -40,5 +40,25 @@ MWF.xApplication.query.StatementDesigner.Property = MWF.SDProperty = new Class({ } else { this.propertyContent.setStyle("display", "block"); } + }, + loadViewFilter: function () { + var nodes = this.propertyContent.getElements(".MWFViewFilter"); + //var filtrData = this.view.data.data.filterList; + var customData = this.view.data.data.customFilterList; + nodes.each(function (node) { + MWF.xDesktop.requireApp("query.StatementDesigner", "widget.ViewFilter", function () { + var _slef = this; + new MWF.xApplication.query.StatementDesigner.widget.ViewFilter(node, this.view.designer, { + // "filtrData": filtrData, + "customData": customData + }, { + "onChange": function (ids) { + var data = this.getData(); + // _slef.changeJsonDate(["data", "filterList"], data.data); + _slef.changeJsonDate(["data", "customFilterList"], data.customData); + } + }); + }.bind(this)); + }.bind(this)); } }); \ No newline at end of file diff --git a/o2web/source/x_component_query_StatementDesigner/Statement.js b/o2web/source/x_component_query_StatementDesigner/Statement.js index bc442b5642a7592893a96f72a0f14cd14be71a20..87ea4e418f14f0ad51a8fcca233b00be5e3ea175 100644 --- a/o2web/source/x_component_query_StatementDesigner/Statement.js +++ b/o2web/source/x_component_query_StatementDesigner/Statement.js @@ -7,6 +7,7 @@ MWF.xDesktop.requireApp("query.StatementDesigner", "lp."+MWF.language, null, fal MWF.xDesktop.requireApp("query.StatementDesigner", "Property", null, false); MWF.xDesktop.requireApp("query.ViewDesigner", "View", null, false); o2.require("o2.widget.JavascriptEditor", null, false); +o2.require("o2.widget.UUID", null, false); MWF.xApplication.query.StatementDesigner.Statement = new Class({ Extends: MWF.widget.Common, @@ -774,6 +775,9 @@ MWF.xApplication.query.StatementDesigner.View = new Class({ }, parseData: function(){ this.json = this.data; + if( !this.json.id ){ + this.json.id = (new o2.widget.UUID).id; + } if( !this.json.data || !this.json.data.events ){ var url = "../x_component_query_StatementDesigner/$Statement/view.json"; MWF.getJSON(url, { diff --git a/o2web/source/x_component_query_StatementDesigner/widget/$PersonSelector/default/css.wcss b/o2web/source/x_component_query_StatementDesigner/widget/$PersonSelector/default/css.wcss deleted file mode 100644 index 809f47b5f63d0fb867bfafdc846fd22ddd0a3875..0000000000000000000000000000000000000000 --- a/o2web/source/x_component_query_StatementDesigner/widget/$PersonSelector/default/css.wcss +++ /dev/null @@ -1,134 +0,0 @@ -{ - "node": { - "min-height": "24px", - "overflow": "hidden", - "margin-right": "26px" - }, - "addPersonNode": { - "float": "right", - "height": "24px", - "width": "24px", - "cursor": "pointer", - "background": "url("+"../x_component_process_ProcessDesigner/widget/$PersonSelector/default/icon/addPerson.png) center center no-repeat" - }, - - "dutyMaskNode": { - "background-color": "#666", - "opacity": 0.6, - "z-index":1000 - }, - "dutyInputArea": { - "height": "510px", - "width": "355px", - "background-color": "#FFF", - "overflow": "hidden", - "border": "3px solid #666", - "border-radius": "10px", - "box-shadow": "0px 0px 15px #666", - "position": "absolute", - "z-index":1001 - }, - "dutyTitleNode": { - "height": "30px", - "background-color": "#EEE", - "border-bottom": "1px solid #CCC" - }, - - "dutyTitleTextNode": { - "margin-right": "30px", - "height": "30px", - "padding": "0px 10px", - "color": "#666", - "font-weight": "bold", - "font-size": "14px", - "line-height": "30px" - }, - "dutyTitleActionNode": { - "width": "30px", - "height": "30px", - "float": "right", - "background": "url("+"../x_component_Organization/Selector/$Selector/default/icon/close.png) no-repeat center center", - "cursor": "pointer" - }, - - "dutyContentNode": { - "overflow": "hidden", - "height": "410px", - "padding": "12px" - }, - "dutyContentAreaNode": { - "height": "410px" - }, - "dutyActionNode": { - "height": "40px", - "width": "310px", - "margin": "auto" - }, - "dutyOkActionNode": { - "width": "150px", - "height": "30px", - "background": "url("+"../x_component_Organization/Selector/$Selector/default/icon/editOk_bg.png) no-repeat center center", - "border": "0px", - "color": "#FFF", - "font-size": "18px", - "padding-left": "35px", - "border-radius": "4px", - "cursor": "pointer" - }, - "dutyCancelActionNode": { - "width": "100px", - "height": "30px", - "background": "url("+"../x_component_Organization/Selector/$Selector/default/icon/editCancel_bg.png) no-repeat center center", - "border": "0px", - "color": "#FFF", - "font-size": "18px", - "padding-left": "20px", - "border-radius": "4px", - "margin-left": "10px", - "cursor": "pointer" - }, - "dutyTextNode": { - "color": "#444", - "font-size": "14px", - "font-weight": "bold", - "height": "26px", - "margin-bottom": "6px", - "line-height": "26px" - }, - "dutyReferenceAreaNode": { - "height": "28px", - "padding": "4px 0px 0px 0px", - "overflow": "hidden" - }, - "dutyReferenceItemNode":{ - "margin": "0px 4px 4px 0px", - "height": "24px", - "line-height": "24px", - "border": "1px solid #CCC", - "border-radius": "4px", - "background": "#f3f4ff", - "color": "#666", - "float": "left", - "cursor": "pointer", - "font-size": "14px", - "padding": "0px 10px" - }, - "dutyReferenceItemNode_over": { - "background": "#e7eaff", - "border": "1px solid #999", - "color": "#666", - }, - "dutyReferenceItemNode_down": { - "background": "#626ca6", - "border": "1px solid #FFF", - "color": "#FFF", - }, - "dutyScriptAreaNode": { - "height": "316px", - "padding": "10px 0px" - }, - "dutyScriptNode": { - "height": "316px", - "border": "1px solid #EEE" - } -} \ No newline at end of file diff --git a/o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/css.wcss b/o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/css.wcss new file mode 100644 index 0000000000000000000000000000000000000000..bfa06ba9f6e2b74b776addd111d29253f17ab175 --- /dev/null +++ b/o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/css.wcss @@ -0,0 +1,60 @@ +{ + "inputAreaNode": { + "overflow": "hidden", + "margin": "5px" + }, + "actionAreaNode": { + "height": "20px", + "background": "#EEE", + "border-top": "1px solid #CCC", + "border-bottom": "1px solid #CCC", + "cursor": "pointer" + }, + "actionNode": { + "height": "20px", + "background": "url("+"../x_component_process_ViewDesigner/widget/$ViewFilter/default/down.png) no-repeat center -2px" + }, + "verificationNode": { + "background-color": "#fbe8e8", + "color": "#ff0000", + "height": "24px", + "line-height": "24px" + }, + "verificationTextNode": { + "background": "url("+"../x_component_process_ViewDesigner/widget/$ViewFilter/default/icon/error.png) no-repeat 5px center", + "padding-left": "26px" + }, + + "itemNode": { + "cursor": "pointer", + "height": "24px", + "margin": "2px 4px", + "background-color": "#f4f7fe", + "border": "1px solid #999999" + }, + "itemNode_current": { + "cursor": "pointer", + "height": "24px", + "margin": "2px 4px", + "background-color": "#e1e9ff", + "border": "1px solid #999999" + }, + "itemDeleteNode": { + "width": "20px", + "height": "24px", + "float": "right", + "background": "url("+"../x_component_process_ViewDesigner/widget/$ViewFilter/default/icon/delete1.png) no-repeat center center", + "cursor": "pointer" + }, + "itemContentNode": { + "padding-left": "5px", + "padding-right": "3px", + "margin-right": "20px", + "height": "24px", + "line-height": "24px", + "overflow": "hidden", + "text-overflow": "ellipsis", + "white-space": "nowrap" + } + +} \ No newline at end of file diff --git a/o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/down.png b/o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/down.png new file mode 100644 index 0000000000000000000000000000000000000000..1cff68039a6882222bce975ae0b3897b006d3ba3 Binary files /dev/null and b/o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/down.png differ diff --git a/o2web/source/x_component_query_StatementDesigner/widget/$PersonSelector/default/icon/addPerson.png b/o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/icon/addPerson.png similarity index 100% rename from o2web/source/x_component_query_StatementDesigner/widget/$PersonSelector/default/icon/addPerson.png rename to o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/icon/addPerson.png diff --git a/o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/icon/delete1.png b/o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/icon/delete1.png new file mode 100644 index 0000000000000000000000000000000000000000..3952f3cbb806a70afcb5bc741f46df250341d922 Binary files /dev/null and b/o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/icon/delete1.png differ diff --git a/o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/icon/error.png b/o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/icon/error.png new file mode 100644 index 0000000000000000000000000000000000000000..c37bd062e60c3b38fc82e4d1f236a8ac2fae9d8c Binary files /dev/null and b/o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/icon/error.png differ diff --git a/o2web/source/x_component_query_StatementDesigner/widget/PersonSelector.js b/o2web/source/x_component_query_StatementDesigner/widget/PersonSelector.js deleted file mode 100644 index e7e0f9b468fd407824d07bdb376ba3d3aed608e2..0000000000000000000000000000000000000000 --- a/o2web/source/x_component_query_StatementDesigner/widget/PersonSelector.js +++ /dev/null @@ -1,314 +0,0 @@ -MWF.xApplication.query.StatDesigner = MWF.xApplication.query.StatDesigner || {}; -MWF.xApplication.query.StatDesigner.widget = MWF.xApplication.query.StatDesigner.widget || {}; -MWF.require("MWF.xAction.org.express.RestActions", null,false); -MWF.require("MWF.widget.Identity", null, false); - -MWF.xApplication.query.StatDesigner.widget.PersonSelector = new Class({ - Implements: [Options, Events], - Extends: MWF.widget.Common, - options: { - "style": "default", - "type": "identity", - "names": [] - }, - initialize: function(node, app, options){ - - this.setOptions(options); - this.node = $(node); - this.app = app; - - this.path = "../x_component_query_ViewDesigner/widget/$PersonSelector/"; - this.cssPath = "../x_component_query_ViewDesigner/widget/$PersonSelector/"+this.options.style+"/css.wcss"; - this._loadCss(); - - this.identitys = []; - this.restActions = new MWF.xAction.org.express.RestActions(); - - this.name = this.node.get("name"); - this.load(); - - }, - load: function(data){ - this.node.setStyles(this.css.node); - this.createAddNode(); - this.loadIdentitys(); - }, - loadIdentitys: function(){ - var explorer = { - "actions": this.restActions, - "app": { - "lp": this.app.lp - } - }; - if (this.options.names){ - if (this.options.type.toLowerCase()=="duty"){ - var dutys = JSON.decode(this.options.names); - dutys.each(function(d){ - var dutyItem = new MWF.widget.Duty(d, this.node, explorer, true, function(e){ - var _self = this; - var text = this.selector.app.lp.deleteDutyText.replace(/{duty}/g, this.data.name); - this.selector.app.confirm("warm", e, this.selector.app.lp.deleteDutyTitle, text, 300, 120, function(){ - _self.selector.fireEvent("removeDuty", [_self]); - this.close(); - }, function(){ - this.close(); - }); - e.stopPropagation(); - }); - dutyItem.selector = this; - dutyItem.explorer = explorer; - this.identitys.push(dutyItem); - }.bind(this)); - }else{ - this.options.names.each(function(name){ - MWF.require("MWF.widget.Identity", function(){ - if (this.options.type.toLowerCase()=="identity") this.identitys.push(new MWF.widget.Identity({"name": name.name, "id": name.id}, this.node, explorer)); - if (this.options.type.toLowerCase()=="department") this.identitys.push(new MWF.widget.Department({"name": name.name, "id": name.id}, this.node, explorer)); - if (this.options.type.toLowerCase()=="company") this.identitys.push(new MWF.widget.Company({"name": name.name, "id": name.id}, this.node, explorer)); - if (this.options.type.toLowerCase()=="person") this.identitys.push(new MWF.widget.Person({"name": name.name, "id": name.id}, this.node, explorer)); - - if (this.options.type.toLowerCase()=="application") this.identitys.push(new MWF.widget.Application({"name": name.name, "id": name.id}, this.node, explorer)); - if (this.options.type.toLowerCase()=="process") this.identitys.push(new MWF.widget.Process({"name": name.name, "id": name.id}, this.node, explorer)); - }.bind(this)); - }.bind(this)); - } - } - - }, - createAddNode: function(){ - this.addNode = new Element("div", {"styles": this.css.addPersonNode}).inject(this.node, "before"); - this.addNode.addEvent("click", function(e){ - - var selecteds = []; - this.identitys.each(function(id){selecteds.push(id.data.id)}); - - var explorer = { - "actions": this.restActions, - "app": { - "lp": this.app.lp - } - }; - - var options = { - "type": this.options.type, - "count": (this.options.type.toLowerCase()=="duty")? 1: 0, - "values": selecteds, - "zIndex": 20000, - "onComplete": function(items){ - this.identitys = []; - if (this.options.type.toLowerCase()!="duty") this.node.empty(); - - MWF.require("MWF.widget.Identity", function(){ - items.each(function(item){ - if (this.options.type.toLowerCase()=="identity") this.identitys.push(new MWF.widget.Identity(item.data, this.node, explorer)); - if (this.options.type.toLowerCase()=="department") this.identitys.push(new MWF.widget.Department(item.data, this.node, explorer)); - if (this.options.type.toLowerCase()=="company") this.identitys.push(new MWF.widget.Company(item.data, this.node, explorer)); - if (this.options.type.toLowerCase()=="person") this.identitys.push(new MWF.widget.Person(item.data, this.node, explorer)); - - if (this.options.type.toLowerCase()=="application") this.identitys.push(new MWF.widget.Application(item.data, this.node, explorer)); - if (this.options.type.toLowerCase()=="process") this.identitys.push(new MWF.widget.Process(item.data, this.node, explorer)); - }.bind(this)); - if (this.options.type.toLowerCase()=="duty") { - items.each(function(item){ - new MWF.xApplication.query.StatDesigner.widget.PersonSelector.DutyInput(this, item.data, this.node, explorer, 20000); - }.bind(this)); - } - - this.fireEvent("change", [this.identitys]); - }.bind(this)); - }.bind(this) - }; - - var selector = new MWF.OrgSelector(this.app.content, options); - }.bind(this)); - } -}); -MWF.xApplication.query.StatDesigner.widget.PersonSelector.DutyInput = Class({ - Implements: [Events], - initialize: function(selector, data, node, explorer, zIndex){ - this.itemNode = $(node); - this.data = data; - this.isNew = false; - - this.selector = selector; - this.css = this.selector.css; - this.app = this.selector.app; - this.explorer = explorer; - this.zIndex = zIndex; - - this.selector.identitys = []; - this.load(); - }, - load: function(){ - this.css.dutyMaskNode["z-index"] = this.zIndex; - this.app.content.mask({ - "destroyOnHide": true, - "style": this.css.dutyMaskNode - }); - this.node = new Element("div", { - "styles": this.css.dutyInputArea - }); - - this.titleNode = new Element("div", { - "styles": this.css.dutyTitleNode - }).inject(this.node); - - this.titleActionNode = new Element("div", { - "styles": this.css.dutyTitleActionNode - }).inject(this.titleNode); - this.titleTextNode = new Element("div", { - "styles": this.css.dutyTitleTextNode, - "text": this.app.lp.dutyInputTitle - }).inject(this.titleNode); - - this.contentNode = new Element("div", { - "styles": this.css.dutyContentNode - }).inject(this.node); - this.loadContent(); - - this.actionNode = new Element("div", { - "styles": this.css.dutyActionNode - }).inject(this.node); - this.actionNode.setStyle("text-align", "center"); - this.loadAction(); - - this.node.setStyle("z-index", this.zIndex.toInt()+1); - this.node.inject(this.app.content); - this.node.position({ - relativeTo: this.app.content, - position: "center", - edge: "center" - }); - - var size = this.app.content.getSize(); - var nodeSize = this.node.getSize(); - this.node.makeDraggable({ - "handle": this.titleNode, - "limit": { - "x": [0, size.x-nodeSize.x], - "y": [0, size.y-nodeSize.y] - } - }); - - this.setEvent(); - }, - setEvent: function(){ - if (this.titleActionNode){ - this.titleActionNode.addEvent("click", function(){this.selector.fireEvent("cancel"); this.close();}.bind(this)); - } - this.okActionNode.addEvent("click", function(){ - this.selectDuty(); - this.close(); - }.bind(this)); - this.cancelActionNode.addEvent("click", function(){this.selector.fireEvent("cancel"); this.close();}.bind(this)); - }, - selectDuty: function(){ - var code = this.scriptEditor.editor.editor.getValue(); - this.data.code = code; - if (!this.item){ - var dutyItem = new MWF.widget.Duty(this.data, this.itemNode, this.explorer, true, function(e){ - var _self = this; - var text = this.selector.app.lp.deleteDutyText.replace(/{duty}/g, this.data.name); - this.selector.app.confirm("warm", e, this.selector.app.lp.deleteDutyTitle, text, 300, 120, function(){ - _self.selector.fireEvent("removeDuty", [_self]); - this.close(); - }, function(){ - this.close(); - }); - e.stopPropagation(); - }); - dutyItem.selector = this.selector; - dutyItem.explorer = this.explorer; - - this.selector.identitys.push(dutyItem); - this.selector.fireEvent("change", [this.selector.identitys]); - }else{ - this.selector.identitys.push(this.item); - this.selector.fireEvent("change", [this.selector.identitys]); - } - }, - "close": function(){ - this.node.destroy(); - this.app.content.unmask(); - MWF.release(this); - delete this; - }, - loadAction: function(){ - this.okActionNode = new Element("button", { - "styles": this.css.dutyOkActionNode, - "text": "确 定" - }).inject(this.actionNode); - this.cancelActionNode = new Element("button", { - "styles": this.css.dutyCancelActionNode, - "text": "取 消" - }).inject(this.actionNode); - }, - loadContent: function(){ - this.contentAreaNode= new Element("div", {"styles": this.css.dutyContentAreaNode}).inject(this.contentNode); - var text = this.app.lp.dutyInput.replace(/{duty}/g, this.data.name); - this.textNode = new Element("div", {"styles": this.css.dutyTextNode, "text": text}).inject(this.contentAreaNode); - this.referenceAreaNode = new Element("div", {"styles": this.css.dutyReferenceAreaNode}).inject(this.contentAreaNode); - this.scriptAreaNode = new Element("div", {"styles": this.css.dutyScriptAreaNode}).inject(this.contentAreaNode); - this.createScriptNode(); - - this.createReference(this.app.lp.creatorCompany, "return this.workContext.getWork().creatorCompany"); - this.createReference(this.app.lp.creatorDepartment, "return this.workContext.getWork().creatorDepartment"); - this.createReference(this.app.lp.currentCompany, "return this.workContext.getTask().company"); - this.createReference(this.app.lp.currentDepartment, "return this.workContext.getTask().department"); - - }, - createScriptNode: function(){ - this.scriptNode = new Element("div", {"styles": this.css.dutyScriptNode}).inject(this.scriptAreaNode); - MWF.xDesktop.requireApp("query.ProcessDesigner", "widget.ScriptText", function(){ - this.scriptEditor = new MWF.xApplication.query.ProcessDesigner.widget.ScriptText(this.scriptNode, "", this.app, { - "height": 316, - "maskNode": this.app.content, - "maxObj": this.app.content - //"onChange": function(code){ - // _self.data[node.get("name")] = code; - //} - }); - this.scriptEditor.loadEditor(function(){ - if (this.data.code) this.scriptEditor.editor.editor.setValue(this.data.code); - }.bind(this)); - }.bind(this)); - }, - createReference: function(text, code){ - var node = new Element("div", {"styles": this.css.dutyReferenceItemNode}).inject(this.referenceAreaNode); - node.set("text", text); - node.store("code", code); - var css = this.css.dutyReferenceItemNode; - var overcss = this.css.dutyReferenceItemNode_over; - var downcss = this.css.dutyReferenceItemNode_down; - var _self = this; - node.addEvents({ - "mouseover": function(){this.setStyles(overcss);}, - "mouseout": function(){this.setStyles(css);}, - "mousedown": function(){this.setStyles(downcss);}, - "mouseup": function(){this.setStyles(overcss);}, - "click": function(){ - var code = this.retrieve("code"); - var value = _self.scriptEditor.editor.editor.getValue(); - if (!value){ - _self.scriptEditor.editor.editor.setValue(code); - }else{ - value = value + "\n" +code; - _self.scriptEditor.editor.editor.setValue(value); - } - } - }); - } -}); - -MWF.widget.Duty = new Class({ - Extends: MWF.widget.Department, - setEvent: function(){ - this.node.addEvent("click", function(){ - this.modifyDuty(); - }.bind(this)); - }, - modifyDuty: function(){ - var dutyInput = new MWF.xApplication.query.ProcessDesigner.widget.PersonSelector.DutyInput(this.selector, this.data, this.selector.node, this.explorer, 20000); - dutyInput.item = this; - } -}); diff --git a/o2web/source/x_component_query_StatementDesigner/widget/ViewFilter.js b/o2web/source/x_component_query_StatementDesigner/widget/ViewFilter.js new file mode 100644 index 0000000000000000000000000000000000000000..841a9f36c2790aea760285e0b5442923712cdaba --- /dev/null +++ b/o2web/source/x_component_query_StatementDesigner/widget/ViewFilter.js @@ -0,0 +1,1012 @@ +MWF.xApplication.query = MWF.xApplication.query || {}; +MWF.xApplication.query.StatementDesigner = MWF.xApplication.query.StatementDesigner || {}; +MWF.xApplication.query.StatementDesigner.widget = MWF.xApplication.query.StatementDesigner.widget || {}; + +MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({ + Implements: [Options, Events], + Extends: MWF.widget.Common, + options: { + "style": "default", + "type": "identity", + "names": [] + }, + initialize: function(node, app, filtrData, options){ + this.setOptions(options); + this.node = $(node); + this.app = app; + this.filtrData = filtrData; + + this.path = "../x_component_query_StatementDesigner/widget/$ViewFilter/"; + this.cssPath = "../x_component_query_StatementDesigner/widget/$ViewFilter/"+this.options.style+"/css.wcss"; + this._loadCss(); + + this.items = []; + this.load(); + + }, + load: function(data){ + this.getInputNodes(); + this.createActionNode(); + //this.createAddNode(); + //this.loadIdentitys(); + this.loadData(); + }, + loadData: function(){ + if (this.filtrData.customData && this.filtrData.customData.length){ + this.filtrData.customData.each(function(data){ + data.type = "custom"; + this.items.push(new MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemCustom(this, data)); + }.bind(this)); + } + }, + createScriptArea: function(node){ + this.scriptValueArea = node; + var title = node.get("title"); + + MWF.require("MWF.widget.ScriptArea", function(){ + this.scriptArea = new MWF.widget.ScriptArea(node, { + "title": title, + "maxObj": this.app.formContentNode || this.app.pageContentNode, + "onChange": function(){ + this.scriptData = this.scriptArea.toJson(); + }.bind(this), + "onSave": function(){ + //this.app.saveForm(); + }.bind(this), + "style": "formula" + }); + var v = (this.scriptData) ? this.scriptData.code : ""; + this.scriptArea.load(v); + }.bind(this)); + }, + createCustomFilterValueScriptArea : function(node){ + var title = node.get("title"); + + MWF.require("MWF.widget.ScriptArea", function(){ + this.customFilterValueScriptArea = new MWF.widget.ScriptArea(node, { + "title": title, + "isload" : true, + "isbind" : false, + "maxObj": this.app.formContentNode || this.app.pageContentNode, + "onChange": function(){ + this.customFilterValueScriptData = this.customFilterValueScriptArea.toJson(); + }.bind(this), + "onSave": function(){ + //this.app.saveForm(); + }.bind(this), + "style": "formula" + }); + var v = (this.customFilterValueScriptData) ? this.customFilterValueScriptData.code : ""; + this.customFilterValueScriptArea.load(v); + }.bind(this)); + }, + getInputNodes: function(){ + debugger; + this.inputAreaNode = this.node.getElement(".inputAreaNode_vf"); + this.actionAreaNode = this.node.getElement(".actionAreaNode_vf"); + this.actionAreaNode.setStyles( this.css.actionAreaNode ); + // this.listAreaNode = this.node.getElement(".listAreaNode_vf"); + this.fieldListAreaNode = this.node.getElement(".fieldListAreaNode_vf"); + + this.restrictViewFilterTable = this.node.getElement(".restrictViewFilterTable_vf"); + + var scriptValueArea = this.node.getElement(".MWFFilterFormulaArea"); + if (scriptValueArea){ + this.createScriptArea(scriptValueArea); + } + + this.titleInput = this.inputAreaNode.getElement(".titleInput_vf"); + this.pathInput = this.inputAreaNode.getElement(".pathInput_vf"); + this.datatypeInput = this.inputAreaNode.getElement(".datatypeInput_vf"); + + // this.restrictFilterInput = this.inputAreaNode.getElement(".restrictFilterInput_vf"); + // this.customFilterInput = this.inputAreaNode.getElement(".customFilterInput_vf"); + + // this.logicInput = this.inputAreaNode.getElement(".logicInput_vf"); + + // this.comparisonInput = this.inputAreaNode.getElement(".comparisonInput_vf"); + // this.comparisonInput.addEvent("change", function(){ + // this.switchInputDisplay(); + // }.bind(this)) + + // this.valueTextInput = this.inputAreaNode.getElement(".valueTextInput_vf"); + // this.valueNumberInput = this.inputAreaNode.getElement(".valueNumberInput_vf"); + // this.valueDatetimeInput = this.inputAreaNode.getElement(".valueDatetimeInput_vf"); + // this.valueBooleanInput = this.inputAreaNode.getElement(".valueBooleanInput_vf"); + // this.valueDateInput = this.inputAreaNode.getElement(".valueDateInput_vf"); + // this.valueTimeInput = this.inputAreaNode.getElement(".valueTimeInput_vf"); + + if( this.app.statement.view ){ + var dataId = this.app.statement.view.data.id; + this.customFilterValueTypes = this.inputAreaNode.getElements("[name='"+dataId+"viewCustomFilterValueType']"); + + this.customFilterValueScriptDiv = this.inputAreaNode.getElement("#"+dataId+"viewCustomFilterValueScriptDiv"); + this.customFilterValueScript = this.inputAreaNode.getElement("[name='"+dataId+"viewCustomFilterValueScript']"); + if( this.customFilterValueScript ){ + this.createCustomFilterValueScriptArea(this.customFilterValueScript); + } + } + + // MWF.require("MWF.widget.Calendar", function(){ + // this.calendar = new MWF.widget.Calendar(this.valueDatetimeInput, { + // "style": "xform", + // "isTime": true, + // "secondEnable": true, + // "target": this.app.content, + // "format": "db", + // "onComplate": function(){ + // this.node.getElement("#"+id+"viewFilterDateFormulaSelector").getElements("input").set("checked", false); + // }.bind(this) + // }); + // new MWF.widget.Calendar(this.valueDateInput, { + // "style": "xform", + // "isTime": false, + // "target": this.app.content, + // "format": "%Y-%m-%d" + // }); + // new MWF.widget.Calendar(this.valueTimeInput, { + // "style": "xform", + // "timeOnly": true, + // "secondEnable": true, + // "target": this.app.content, + // "format": "%H:%M:%S" + // }); + // }.bind(this)); + + // this.datatypeInput.addEvent("change", function(){ + // this.switchInputDisplay(); + // }.bind(this)); + + // this.valueTextInput.addEvent("keydown", function(e){ + // if (e.code==13) this.modifyOrAddFilterItem(); + // }.bind(this)); + // this.valueNumberInput.addEvent("keydown", function(e){ + // if (e.code==13) this.modifyOrAddFilterItem(); + // }.bind(this)); + + // if (this.app.view){ + // var id = this.app.view.data.id; + // var div = this.node.getElement("#"+id+"viewFilterValueArea2"); + // // inputs = div.getElements("input"); + // if( div ){ + // this.valueTextInput2 = div.getElement(".valueTextInput2_vf") || null; + // this.valueNumberInput2 = div.getElement(".valueNumberInput2_vf") || null; + // this.valueDatetimeInput2 = div.getElement(".valueDatetimeInput2_vf") || null; + // this.valueDateInput2 = div.getElement(".valueDateInput2_vf") || null; + // this.valueTimeInput2 = div.getElement(".valueTimeInput2_vf") || null; + // this.valueBooleanInput2 = div.getElement(".valueBooleanInput2_vf") || null; + // + // MWF.require("MWF.widget.Calendar", function(){ + // this.calendar = new MWF.widget.Calendar(this.valueDatetimeInput2, { + // "style": "xform", + // "isTime": true, + // "secondEnable": true, + // "target": this.app.content, + // "format": "db", + // "onComplate": function(){ + // this.node.getElement("#"+id+"viewFilterDateFormulaSelector2").getElements("input").set("checked", false); + // }.bind(this) + // }); + // new MWF.widget.Calendar(this.valueDateInput2, { + // "style": "xform", + // "isTime": false, + // "target": this.app.content, + // "format": "%Y-%m-%d" + // }); + // new MWF.widget.Calendar(this.valueTimeInput2, { + // "style": "xform", + // "timeOnly": true, + // "secondEnable": true, + // "target": this.app.content, + // "format": "%H:%M:%S" + // }); + // }.bind(this)); + // + // this.valueTextInput2.addEvent("keydown", function(e){ + // if (e.code==13) this.modifyOrAddFilterItem(); + // }.bind(this)); + // this.valueNumberInput2.addEvent("keydown", function(e){ + // if (e.code==13) this.modifyOrAddFilterItem(); + // }.bind(this)); + // } + // } + }, + // switchInputDisplay : function(){ + // var id = ""; + // if( this.app.view ){ + // id = this.app.view.data.id; + // } + // + // var config = { + // "textValue": { + // "equals": { + // "selectorArea" : ["#"+id+"viewFilterTextFormulaSelector"] //["input", "@person", "@unitList", "@unitAllList", "@identityList" ], + // }, + // "notEquals": { + // "selectorArea" : ["#"+id+"viewFilterTextFormulaSelector"] //["input", "@person", "@unitList", "@unitAllList", "@identityList" ], + // }, + // "greaterThan": { + // "invalidValue" : ["@person", "@unitList", "@unitAllList", "@identityList" ] + // }, + // "greaterThanOrEqualTo": { + // "invalidValue" : ["@person", "@unitList", "@unitAllList", "@identityList" ] + // }, + // "lessThan": { + // "invalidValue" : ["@person", "@unitList", "@unitAllList", "@identityList" ] + // }, + // "lessThanOrEqualTo": { + // "invalidValue" : ["@person", "@unitList", "@unitAllList", "@identityList" ] + // }, + // "like": { + // "invalidValue" : ["@person", "@unitList", "@unitAllList", "@identityList" ] + // }, + // "notLike": { + // "invalidValue" : ["@person", "@unitList", "@unitAllList", "@identityList" ] + // }, + // "range": { + // "invalidValue" : ["@person", "@unitList", "@unitAllList", "@identityList" ] + // } + // }, + // "numberValue": { + // "equals": {}, //["input"] + // "notEquals": {}, + // "greaterThan": {}, + // "greaterThanOrEqualTo": {}, + // "lessThan": {}, + // "lessThanOrEqualTo": {}, + // "range": {} + // }, + // "dateTimeValue": { + // "equals": { + // "invalidValue" : ["@year","@season","@month","@time","@date"] + // }, + // "notEquals": { + // "selectorArea" : ["#"+id+"viewFilterDateFormulaSelector"] + // }, + // "greaterThan": { + // "selectorArea" : ["#"+id+"viewFilterDateFormulaSelector"] + // }, + // "greaterThanOrEqualTo": { + // "selectorArea" : ["#"+id+"viewFilterDateFormulaSelector"] + // }, + // "lessThan": { + // "selectorArea" : ["#"+id+"viewFilterDateFormulaSelector"] + // }, + // "lessThanOrEqualTo": { + // "selectorArea" : ["#"+id+"viewFilterDateFormulaSelector"] + // }, + // "range": { + // "invalidValue" : ["@year","@season","@month","@time","@date"] + // } + // }, + // "dateValue": { + // "equals": { + // "invalidValue" : ["@year","@season","@month","@date"] + // }, + // "notEquals": { + // "selectorArea" : ["#"+id+"viewFilterDateOnlyFormulaSelector"] + // }, + // "greaterThan":{ + // "selectorArea" : ["#"+id+"viewFilterDateOnlyFormulaSelector"] + // }, + // "greaterThanOrEqualTo": { + // "selectorArea" : ["#"+id+"viewFilterDateOnlyFormulaSelector"] + // }, + // "lessThan": { + // "selectorArea" : ["#"+id+"viewFilterDateOnlyFormulaSelector"] + // }, + // "lessThanOrEqualTo": { + // "selectorArea" : ["#"+id+"viewFilterDateOnlyFormulaSelector"] + // }, + // "range": { + // "invalidValue" : ["@year","@season","@month","@date"] + // } + // }, + // "timeValue": { + // "equals": { + // "invalidValue" : ["@time"] + // }, + // "notEquals": { + // "selectorArea" : ["#"+id+"viewFilterTimeOnlyFormulaSelector"] + // }, + // "greaterThan": { + // "selectorArea" : ["#"+id+"viewFilterTimeOnlyFormulaSelector"] + // }, + // "greaterThanOrEqualTo": { + // "selectorArea" : ["#"+id+"viewFilterTimeOnlyFormulaSelector"] + // }, + // "lessThan": { + // "selectorArea" : ["#"+id+"viewFilterTimeOnlyFormulaSelector"] + // }, + // "lessThanOrEqualTo": { + // "selectorArea" : ["#"+id+"viewFilterTimeOnlyFormulaSelector"] + // }, + // "range": { + // "invalidValue" : ["@time"] + // } + // }, + // "booleanValue": { + // "equals": {}, + // "notEquals": {} + // } + // }; + // + // debugger; + // + // var formulaSelectorIdList = [ + // "#"+id+"viewFilterTextFormulaSelector", + // "#"+id+"viewFilterDateFormulaSelector", + // "#"+id+"viewFilterDateOnlyFormulaSelector", + // "#"+id+"viewFilterTimeOnlyFormulaSelector" + // ]; + // + // var formatType = this.datatypeInput.options[this.datatypeInput.selectedIndex].value; + // var object = config[formatType]; + // + // var availableComparisonList = Object.keys( object ); + // var options = this.comparisonInput.options; + // + // var comparison = options[this.comparisonInput.selectedIndex].value; + // + // if( !this.originalComparisonOptions ){ + // this.originalComparisonOptions = []; + // for( var i=0; i< options.length; i++ ){ + // this.originalComparisonOptions.push({ + // "text" : options[i].text, + // "value" : options[i].value + // }); + // } + // } + // + // while( this.comparisonInput.options && this.comparisonInput.options.length ){ + // this.comparisonInput.options[0].destroy(); + // } + // + // for( var i=0; i