From c98d62e4e3ba2f46c65179da9f2ce3dfac2384e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=94=A1=E7=A5=A5=E7=86=A0?= Date: Mon, 7 Sep 2020 16:33:40 +0000 Subject: [PATCH] Merge branch 'fix/Process.include_dictionarty' into 'wrdp' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge of fix/Process.include_dictionarty to wrdp See merge request o2oa/o2oa!1568 (cherry picked from commit 1d6bae746ce23f8757540733629f9bcc43dcb710) 0d5f68f5 表单中允许选择数据字典 --- .../source/o2_core/o2/xScript/Environment.js | 228 +++++++++++++- o2web/source/x_component_Meeting/Main.js | 2 +- .../source/x_component_Meeting/MeetingView.js | 2 +- .../source/x_component_Selector/Dictionary.js | 3 + .../Module/Form/form.html | 3 + .../Property.js | 22 +- .../lp/zh-cn.js | 11 + .../$DictionaryIncluder/default/css.wcss | 150 +++++++++ .../default/icon/delete1.png | Bin 0 -> 214 bytes .../default/icon/error.png | Bin 0 -> 701 bytes .../widget/DictionaryIncluder.js | 290 ++++++++++++++++++ .../source/x_component_process_Xform/Form.js | 138 +++++---- 12 files changed, 772 insertions(+), 77 deletions(-) create mode 100644 o2web/source/x_component_process_FormDesigner/widget/$DictionaryIncluder/default/css.wcss create mode 100644 o2web/source/x_component_process_FormDesigner/widget/$DictionaryIncluder/default/icon/delete1.png create mode 100644 o2web/source/x_component_process_FormDesigner/widget/$DictionaryIncluder/default/icon/error.png create mode 100644 o2web/source/x_component_process_FormDesigner/widget/DictionaryIncluder.js diff --git a/o2web/source/o2_core/o2/xScript/Environment.js b/o2web/source/o2_core/o2/xScript/Environment.js index 3e5e7d4787..08dab00e5f 100644 --- a/o2web/source/o2_core/o2/xScript/Environment.js +++ b/o2web/source/o2_core/o2/xScript/Environment.js @@ -1642,7 +1642,195 @@ MWF.xScript.JSONData = function(data, callback, key, parent, _form){ // this.destory = this["delete"]; // } //}; -var dictLoaded = {}; +// var dictLoaded = {}; +MWF.xScript.dictLoaded = {}; + +MWF.xScript.addDictToCache = function ( options, path, json ) { + + debugger; + + // if( !key ){ + // var name = options.name || options.id || options.alias; + // var type = options.appType || "process"; + // var application = options.appName || options.appId || options.application || options.appAlias; + // var enableAnonymous = options.enableAnonymous || false; + // key = name+type+application+enableAnonymous; + // } + + if( !path )path = "root"; + if( path.indexOf("root") !== 0 )path = "root." + path ; + + // if( MWF.xScript.dictLoaded[key] ){ + // var dicts = MWF.xScript.dictLoaded[key]; + // var arr = path.split(/\./g); + // var p; + // for( var i=0 ; i +
预加载数据字典
+
+ diff --git a/o2web/source/x_component_process_FormDesigner/Property.js b/o2web/source/x_component_process_FormDesigner/Property.js index 755a70ad4e..c10557b431 100644 --- a/o2web/source/x_component_process_FormDesigner/Property.js +++ b/o2web/source/x_component_process_FormDesigner/Property.js @@ -86,6 +86,7 @@ MWF.xApplication.process.FormDesigner.Property = MWF.FCProperty = new Class({ this.loadViewFilter(); this.loadDocumentTempleteSelect(); this.loadScriptIncluder(); + this.loadDictionaryIncluder(); //this.testRestful(); // this.loadScriptInput(); //MWF.process.widget.EventsEditor @@ -1407,7 +1408,6 @@ debugger; }.bind(this)); dictionaryNodes.each(function(node){ - debugger; var data = this.data[node.get("name")]; new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.form.designer, { "type": "Dictionary", @@ -1419,6 +1419,7 @@ debugger; if( ids.length > 0 ){ // var d = ids[0].data; ids.each( function (id) { + debugger; var d = id.data; data.push({ "type" : "dictionary", @@ -1426,6 +1427,7 @@ debugger; "alias": d.alias, "id": d.id, "appName" : d.appName || d.applicationName, + "appAlias" : d.appAlias || d.applicationAlias, "appId": d.appId, "application": d.application, "appType" : d.appType @@ -1482,6 +1484,24 @@ debugger; }.bind(this)); }, + loadDictionaryIncluder : function(){ + var nodes = this.propertyContent.getElements(".MWFDictionaryIncluder"); + if (nodes.length){ + nodes.each(function(node){ + var name = node.get("name"); + MWF.xDesktop.requireApp("process.FormDesigner", "widget.DictionaryIncluder", function(){ + var dictionaryIncluder = new MWF.xApplication.process.FormDesigner.widget.DictionaryIncluder(node, this.designer, { + "onChange": function(){ + var data = dictionaryIncluder.getData(); + this.data[name] = data; + }.bind(this) + }); + dictionaryIncluder.load(this.data[name]) + }.bind(this)); + }.bind(this)); + } + + }, loadScriptIncluder : function(){ var nodes = this.propertyContent.getElements(".MWFScriptIncluder"); if (nodes.length){ diff --git a/o2web/source/x_component_process_FormDesigner/lp/zh-cn.js b/o2web/source/x_component_process_FormDesigner/lp/zh-cn.js index 1160c08039..ca1f54bec8 100644 --- a/o2web/source/x_component_process_FormDesigner/lp/zh-cn.js +++ b/o2web/source/x_component_process_FormDesigner/lp/zh-cn.js @@ -102,6 +102,17 @@ MWF.xApplication.process.FormDesigner.LP = { "delete_title": "取消加载脚本确认", "delete_text": "您确定要取消加载选择的脚本?" }, + "dictionaryIncluder" : { + "selectDictionary" : "选择:", + "repeatAddDictionaryNotice" : "请不要重复添加数据字典", + "rootDictionaryExistNotice" : "已经添加了该数据字典的根路径,无需再添加", + "parentDictionaryExistNotice" : "已经添加了该数据字典的父路径,无需再添加", + "subDictionaryExistNotice" : "已经存在该数据字典的子路径,请先删除再添加", + "selectDictionaryNotice" : "请先选择数据字典", + "path" : "路径:", + "delete_title": "取消加载数据字典确认", + "delete_text": "您确定要取消加载选择的数据字典?" + }, "validation": { "validation": "校验", "anytime": "任何时候", diff --git a/o2web/source/x_component_process_FormDesigner/widget/$DictionaryIncluder/default/css.wcss b/o2web/source/x_component_process_FormDesigner/widget/$DictionaryIncluder/default/css.wcss new file mode 100644 index 0000000000..4d221209a1 --- /dev/null +++ b/o2web/source/x_component_process_FormDesigner/widget/$DictionaryIncluder/default/css.wcss @@ -0,0 +1,150 @@ +{ + "titleNode": { + "height": "24px", + "background-color": "#eeeeee", + "line-height": "24px", + "text-align": "center", + "border-top": "1px solid #999" + }, + "editorNode": { + "border-top": "0px", + "overflow": "hidden" + }, + "actionNode":{ + "height": "30px", + "text-align": "center" + }, + "listNode": { + "border-top": "1px solid #bbb", + "min-height": "60px", + "padding-top": "2px", + "overflow": "hidden" + }, + "editTableTdValue": { + "height": "24px", + "line-height": "24px", + "border-bottom": "1px dashed #CCC" + }, + "decisionNameInput": { + "color": "#666", + "width": "90%", + "border-top": "1px solid #AAA", + "border-left": "1px solid #AAA", + "border-bottom": "1px solid #CCC", + "border-right": "1px solid #CCC" + }, + "valueInput":{ + "color": "#666", + "width": "90%", + "border-top": "1px solid #AAA", + "border-left": "1px solid #AAA", + "border-bottom": "1px solid #CCC", + "border-right": "1px solid #CCC" + }, + "promptInput": { + "color": "#666", + "width": "90%", + "border-top": "1px solid #AAA", + "border-left": "1px solid #AAA", + "border-bottom": "1px solid #CCC", + "border-right": "1px solid #CCC" + }, + "valueSelect": { + "color": "#666", + "width": "auto", + "border-top": "1px solid #AAA", + "border-left": "1px solid #AAA", + "border-bottom": "1px solid #CCC", + "border-right": "1px solid #CCC" + }, + "titleTd": { + "width": "60px", + "font-weight": "bold", + "font-size": "12px", + "height": "24px", + "line-height": "24px" + }, + "actionAreaNode": { + "width": "110px", + "height": "22px", + "margin": "auto", + "margin-top": "4px" + }, + "addAction": { + "width": "50px", + "height": "20px", + "line-height": "20px", + "float": "left", + "cursor": "pointer", + "border-radius": "3px", + "border": "1px solid #999", + "background-color": "#798795", + "color": "#FFF" + }, + "modifyAction": { + "width": "50px", + "height": "20px", + "line-height": "20px", + "float": "right", + "cursor": "pointer", + "border-radius": "3px", + "border": "1px solid #999", + "background-color": "#798795", + "color": "#FFF" + }, + "modifyAction_disabled": { + "width": "50px", + "height": "20px", + "line-height": "20px", + "float": "right", + "cursor": "pointer", + "border-radius": "3px", + "border": "1px solid #999", + "background-color": "#d1dee9", + "color": "#999" + }, + "errorNode": { + "height": "24px", + "background-color": "#fbe8e8", + "color": "#FF0000" + }, + "errorTextNode": { + "height": "24px", + "line-height": "24px", + "background": "url("+"../x_component_process_FormDesigner/widget/$ValidationEditor/default/icon/error.png) no-repeat 5px center", + "padding-left": "30px" + }, + "dictionaryNode" : { + "padding-left" : "5px", + "padding-top" : "5px" + }, + "itemNode": { + "cursor": "pointer", + "height": "auto", + "margin": "2px 4px", + "background-color": "#fff", + "border": "1px solid #ddd" + }, + "itemNode_current": { + "cursor": "pointer", + "height": "auto", + "margin": "2px 4px", + "background-color": "#eee", + "border": "1px solid #bbb" + }, + "itemDeleteNode": { + "width": "20px", + "height": "24px", + "float": "right", + "background": "url("+"../x_component_process_FormDesigner/widget/$ValidationEditor/default/icon/delete1.png) no-repeat center center", + "cursor": "pointer" + }, + "itemContentNode": { + "padding": "5px", + "margin-right": "20px", + "height": "auto", + "overflow": "hidden", + "text-overflow": "ellipsis", + "white-space": "nowrap" + } +} \ No newline at end of file diff --git a/o2web/source/x_component_process_FormDesigner/widget/$DictionaryIncluder/default/icon/delete1.png b/o2web/source/x_component_process_FormDesigner/widget/$DictionaryIncluder/default/icon/delete1.png new file mode 100644 index 0000000000000000000000000000000000000000..3952f3cbb806a70afcb5bc741f46df250341d922 GIT binary patch literal 214 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`b3I)gLo9mVPITltWFX)=|LE4~ zk^+Sf*NKQPE&r$zrUg z-@!bg;mN!2EAEH;us>kxNh=fm&fvGooVO~0>D&PhlPo=>_N#0$9Ug7g~-`rQ^qx~m@y2OU8A z#zh~=7n#Z$Z*fx-GOtDf07cgx0suCz_W(2~Y(0tf@FX@P6EPuM_dgn$vj9LucO)%W zw%HgMW>=#oL>nZ>M&NEf08>)#)k<{$fCT_r>rPi=BV=hFh6WS^qqze>C6Ek}o{M5% za|@JGowu0t{&hgNzySHZxy@LTNh);YzZ2zSp_ zl$^T&Dnc|NLb&RD_!4>pt@VHdP)ZGER%5ZmWEe$lryR&y;2u^3cOkO4#6c%-(EY6a{600000NkvXXu0mjfxS2AI literal 0 HcmV?d00001 diff --git a/o2web/source/x_component_process_FormDesigner/widget/DictionaryIncluder.js b/o2web/source/x_component_process_FormDesigner/widget/DictionaryIncluder.js new file mode 100644 index 0000000000..6bd7e660a2 --- /dev/null +++ b/o2web/source/x_component_process_FormDesigner/widget/DictionaryIncluder.js @@ -0,0 +1,290 @@ +MWF.xApplication.process.FormDesigner.widget = MWF.xApplication.process.FormDesigner.widget || {}; +MWF.require("MWF.widget.UUID", null, false); +MWF.require("MWF.widget.O2Identity", null, false); +MWF.xApplication.process.FormDesigner.widget.DictionaryIncluder = new Class({ + Implements: [Options, Events], + Extends: MWF.widget.Common, + options: { + "style": "default", + "maxObj": document.body + }, + initialize: function(node, designer, options){ + this.setOptions(options); + this.node = $(node); + this.designer = designer; + + this.path = "../x_component_process_FormDesigner/widget/$DictionaryIncluder/"; + this.cssPath = "../x_component_process_FormDesigner/widget/$DictionaryIncluder/"+this.options.style+"/css.wcss"; + this._loadCss(); + this.lp = this.designer.lp.dictionaryIncluder; + + this.items = []; + }, + load: function(data){ + this.editorNode = new Element("div", {"styles": this.css.editorNode}).inject(this.node); + this.actionNode = new Element("div", {"styles": this.css.actionNode}).inject(this.node); + this.listNode = new Element("div", {"styles": this.css.listNode}).inject(this.node); + this.loadEditorNode(); + this.loadActionNode(); + this.loadListNode(data); + }, + loadEditorNode: function(){ + debugger; + var html = "" + + "" + + ""+ + "
"+this.lp.selectDictionary+"
"+this.lp.path+"
"; + this.editorNode.set("html", html); + var tds = this.editorNode.getElements("td").setStyles(this.css.editTableTdValue); + this.dictionarySelectorArea = this.editorNode.getElement(".dictionarySelectorArea"); + this.pathField = this.editorNode.getElement("input[type='text']"); + this.loadDictionarySelector(); + }, + loadDictionarySelector: function( data ){ + MWF.xDesktop.requireApp("process.ProcessDesigner", "widget.PersonSelector", function(){ + var _self = this; + if( !data )data = []; + this.dictionarySelector = new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(this.dictionarySelectorArea, this.designer, { + "type": "Dictionary", + "count": 1, + "names": data, + "onChange": function(ids){ + var json; + if( ids.length ){ + var d = ids[0].data; + json = { + "type" : "dictionary", + "name": d.name, + "alias": d.alias, + "id": d.id, + "appName" : d.appName || d.applicationName, + "appId": d.appId || d.application, + "appAilas": d.appAilas || d.applicationAilas, + "appType" : d.appType + }; + } + this.currentSelectDictionary = json; + }.bind(this) + }); + }.bind(this)); + }, + loadActionNode: function(){ + this.actionAreaNode = new Element("div", {"styles": this.css.actionAreaNode}).inject(this.actionNode); + this.addAction = new Element("div", {"styles": this.css.addAction, "text": this.designer.lp.validation.add}).inject(this.actionAreaNode); + this.modifyAction = new Element("div", {"styles": this.css.modifyAction_disabled, "text": this.designer.lp.validation.modify}).inject(this.actionAreaNode); + + this.addAction.addEvent("click", function(){ + this.add(); + }.bind(this)); + this.modifyAction.addEvent("click", function(){ + this.modify(); + }.bind(this)); + }, + getCurrentData: function(){ + return { + "path": this.pathField.get("value"), + "dictionary": this.currentSelectDictionary || null + }; + }, + add: function(){ + debugger; + this.hideErrorNode(); + var data = this.getCurrentData(); + + if ( !data.dictionary ){ + this.showErrorNode(this.lp.selectDictionaryNotice); + return false; + } + for( var i=0; i