diff --git a/o2web/source/x_component_process_FormDesigner/Module/Elautocomplete.js b/o2web/source/x_component_process_FormDesigner/Module/Elautocomplete.js
index 82bfca628f8a5df711ce30ccfb42a2f919970dee..4b788697b07ccfeab33f64c9e09b1912e00bd6e9 100644
--- a/o2web/source/x_component_process_FormDesigner/Module/Elautocomplete.js
+++ b/o2web/source/x_component_process_FormDesigner/Module/Elautocomplete.js
@@ -1,40 +1,29 @@
MWF.xApplication.process.FormDesigner.Module = MWF.xApplication.process.FormDesigner.Module || {};
MWF.xDesktop.requireApp("process.FormDesigner", "Module.$ElElement", null, false);
-MWF.xApplication.process.FormDesigner.Module.Elinput = MWF.FCElinput = new Class({
+MWF.xApplication.process.FormDesigner.Module.Elautocomplete = MWF.FCElautocomplete = new Class({
Extends: MWF.FC$ElElement,
Implements: [Options, Events],
options: {
"style": "default",
- "propertyPath": "../x_component_process_FormDesigner/Module/Elinput/elinput.html"
+ "propertyPath": "../x_component_process_FormDesigner/Module/Elautocomplete/elautocomplete.html"
},
_initModuleType: function(){
- this.className = "Elinput";
+ this.className = "Elautocomplete";
this.moduleType = "element";
- this.moduleName = "elinput";
+ this.moduleName = "elautocomplete";
},
_createElementHtml: function(){
- debugger;
//var html = "";
- var html = "";
+ html += " value=\""+this.json.id+"\">";
+ if (this.json.vueSlot) html += this.json.vueSlot;
+ html += "";
return html;
},
+ _createVueExtend: function(callback){
+ var _self = this;
+ return {
+ data: this._createVueData(),
+ mounted: function(){
+ _self._afterMounted(this.$el, callback);
+ },
+ methods: {
+ $fetchSuggestions: function(qs, cb){
+ if (this.json.itemType!=='script'){
+ if (this.json.itemValues){
+ cb(this.json.itemValues.map(function(v){
+ return {"value": v};
+ }));
+ return;
+ }
+ }
+ cb([]);
+ }.bind(this)
+ }
+ };
+ },
_createCopyNode: function(){
this.copyNode = new Element("div", {
"styles": this.css.moduleNodeShow
diff --git a/o2web/source/x_component_process_FormDesigner/Module/Elautocomplete/default/css.wcss b/o2web/source/x_component_process_FormDesigner/Module/Elautocomplete/default/css.wcss
new file mode 100644
index 0000000000000000000000000000000000000000..d87fddb807ef97b9d1d318f36715e8f6e10329e4
--- /dev/null
+++ b/o2web/source/x_component_process_FormDesigner/Module/Elautocomplete/default/css.wcss
@@ -0,0 +1,56 @@
+{
+ "moduleNodeMove": {
+ "border-radius": "5px",
+ "border": "1px solid #ffa200",
+ "overflow": "hidden",
+ "margin": "3px",
+ "-webkit-user-select": "none",
+ "-moz-user-select": "none",
+ "position": "absolute",
+ "z-index": 10002,
+ "opacity": 0.7,
+ "cursor": "move",
+ "height": "26px",
+ "line-height": "26px",
+ "padding": "0 10px",
+ "display": "block"
+ },
+ "moduleNodeShow": {
+ "border": "1px solid #333",
+ "margin": "3px",
+ "-webkit-user-select": "none",
+ "-moz-user-select": "none",
+ "position": "static",
+ "top": "auto",
+ "left": "auto",
+ "width": "18px",
+ "height": "2px",
+ "opacity": 0.5,
+ "display": "inline-block",
+ "background": "#ffa200"
+ },
+ "moduleNode": {
+ "border-radius": "5px",
+ "border-top": "1px solid #999",
+ "border-left": "1px solid #999",
+ "border-right": "1px solid #333",
+ "border-bottom": "1px solid #333",
+ "overflow": "hidden",
+ "cursor": "pointer",
+ "margin": "3px",
+ "-webkit-user-select": "none",
+ "-moz-user-select": "none",
+ "position": "static",
+ "top": "auto",
+ "left": "auto",
+ "opacity": 1,
+ "display": "inline-block"
+ },
+ "buttonIcon": {
+ "height": "26px",
+ "cursor": "pointer",
+ "border": "0px",
+ "margin": "0px"
+ }
+
+}
diff --git a/o2web/source/x_component_process_FormDesigner/Module/Elautocomplete/default/icon/copy1.png b/o2web/source/x_component_process_FormDesigner/Module/Elautocomplete/default/icon/copy1.png
new file mode 100644
index 0000000000000000000000000000000000000000..1398026fb8577130ad7d3bfebf8f4f148dc312a9
Binary files /dev/null and b/o2web/source/x_component_process_FormDesigner/Module/Elautocomplete/default/icon/copy1.png differ
diff --git a/o2web/source/x_component_process_FormDesigner/Module/Elautocomplete/default/icon/delete1.png b/o2web/source/x_component_process_FormDesigner/Module/Elautocomplete/default/icon/delete1.png
new file mode 100644
index 0000000000000000000000000000000000000000..8f420087aae2f5a6e8cb22376e257d0ee8b2e12e
Binary files /dev/null and b/o2web/source/x_component_process_FormDesigner/Module/Elautocomplete/default/icon/delete1.png differ
diff --git a/o2web/source/x_component_process_FormDesigner/Module/Elautocomplete/default/icon/move1.png b/o2web/source/x_component_process_FormDesigner/Module/Elautocomplete/default/icon/move1.png
new file mode 100644
index 0000000000000000000000000000000000000000..c50bda51149245dfc2f8d081b359c898173eb2f3
Binary files /dev/null and b/o2web/source/x_component_process_FormDesigner/Module/Elautocomplete/default/icon/move1.png differ
diff --git a/o2web/source/x_component_process_FormDesigner/Module/Elautocomplete/elautocomplete.html b/o2web/source/x_component_process_FormDesigner/Module/Elautocomplete/elautocomplete.html
new file mode 100644
index 0000000000000000000000000000000000000000..10ceab24c0a510f2b81af3f1e8c1f51159c357c1
--- /dev/null
+++ b/o2web/source/x_component_process_FormDesigner/Module/Elautocomplete/elautocomplete.html
@@ -0,0 +1,113 @@
+
diff --git a/o2web/source/x_component_process_FormDesigner/lp/en.js b/o2web/source/x_component_process_FormDesigner/lp/en.js
index 41a3a4dfd795de35ad680a060db49f3b001dae7e..7c1bd1b9fb559403d78c338f48494a63b126011e 100644
--- a/o2web/source/x_component_process_FormDesigner/lp/en.js
+++ b/o2web/source/x_component_process_FormDesigner/lp/en.js
@@ -1001,7 +1001,35 @@ MWF.xApplication.process.FormDesigner.LP = {
"ckeditConfigInfor4": "For more configuration, please check the official website of Ckeditor",
"ckeditConfigInfor5": "https://ckeditor.com/ckeditor-4/",
- "ckeditConfigInfor6": "Note: After the editor properties are customized, the text format may no longer meet the national party and government agency official document format standards"
+ "ckeditConfigInfor6": "Note: After the editor properties are customized, the text format may no longer meet the national party and government agency official document format standards",
+
+ "password": "password",
+ "search": "search",
+ "email": "email",
+ "datetime-local":"datetime-local",
+ "month": "month",
+ "date": "date",
+ "time": "time",
+ "week": "week",
+ "textarea": "textarea",
+ "wordNumber": "wordNumber",
+ "maxlength": "maxlength",
+ "clearable": "clearable",
+ "showPassword": "showPassword",
+ "prefixIcon": "prefixIcon",
+ "suffixIcon": "suffixIcon",
+ "textareaRows": "Textarea Rows",
+ "autosize": "autosize",
+ "minRows": "minRows",
+ "maxRows": "maxRows",
+ "resize": "resize",
+ "resizeNone": "none",
+ "resizeBoth": "both",
+ "resizeHorizontal": "horizontal",
+ "resizeVertical": "vertical",
+ "el_placement": "placement",
+ "popperClass": "Popper Class",
+ "triggerOnFocus": "trigger on focus"
},
"actionBar": {
"close":"Close",
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 d3e814e718dd474b09ad3b81a784a25fcb11343b..b5ce1f79b07fc763e23f3b8fb720c49ee0ce1489 100644
--- a/o2web/source/x_component_process_FormDesigner/lp/zh-cn.js
+++ b/o2web/source/x_component_process_FormDesigner/lp/zh-cn.js
@@ -1032,7 +1032,11 @@ MWF.xApplication.process.FormDesigner.LP = {
"resizeNone": "不允许",
"resizeBoth": "允许",
"resizeHorizontal": "横向",
- "resizeVertical": "纵向"
+ "resizeVertical": "纵向",
+ "el_placement": "弹出位置",
+ "popperClass": "列表类名",
+ "triggerOnFocus": "激活即列出输入建议"
+
},
"actionBar": {
"close":"关闭",
diff --git a/o2web/source/x_component_process_Xform/$ElInput.js b/o2web/source/x_component_process_Xform/$ElInput.js
index 358639465fb3b8fb9fb30bacdee39ccab47d52d1..278945e6319eb16421a79607fd1045be4ac1cd71 100644
--- a/o2web/source/x_component_process_Xform/$ElInput.js
+++ b/o2web/source/x_component_process_Xform/$ElInput.js
@@ -22,9 +22,10 @@ Object.assign(o2.APP$Elinput.prototype, {
if (this.readonly || this.json.isReadonly) this.node.set("text", value);
if (old!==data) this.fireEvent("change");
this.moduleValueAG = null;
+ this.validationMode();
},
getInputData: function(){
- return this.json[this.json.id] || this._getBusinessData();
+ return this.json[this.json.id];
},
_loadNodeEdit: function(){
this.node.appendHTML(this._createElementHtml(), "before");
diff --git a/o2web/source/x_component_process_Xform/$ElModule.js b/o2web/source/x_component_process_Xform/$ElModule.js
index 90c7a842ec60be5093de25cc82ce6b769cd657b2..c66e81ee04b4fa9faa5e075d9d4aa0af39d5c23f 100644
--- a/o2web/source/x_component_process_Xform/$ElModule.js
+++ b/o2web/source/x_component_process_Xform/$ElModule.js
@@ -80,7 +80,8 @@ o2.xApplication.process.Xform.$ElModule = MWF.APP$ElModule = new Class(
* @see https://vuejs.org/
* @member {VueInstance}
*/
- this.vm = new Vue(this.vueApp).$mount(this.node);
+ this.vm = new Vue(this.vueApp);
+ this.vm.$mount(this.node);
},
_createVueExtend: function(){
@@ -91,10 +92,20 @@ o2.xApplication.process.Xform.$ElModule = MWF.APP$ElModule = new Class(
_self._afterMounted(this.$el);
}
};
+ app.methods = this._createVueMethods(app);
this.appendVueExtend(app);
return app;
},
+ appendVueMethods: function(app){},
appendVueExtend: function(app){},
+ _createVueMethods: function(){
+ var methods = {};
+ if (this.json.vueMethods && this.json.vueMethods.code){
+ methods = this.form.Macro.exec(this.json.vueMethods.code, this);
+ }
+ this.appendVueMethods();
+ return methods || {};
+ },
_createVueData: function(){
if (this.json.vueData && this.json.vueData.code){
var d = this.form.Macro.exec(this.json.vueData.code, this);
diff --git a/o2web/source/x_component_process_Xform/Elautocomplete.js b/o2web/source/x_component_process_Xform/Elautocomplete.js
new file mode 100644
index 0000000000000000000000000000000000000000..264d80818b678189b54a8255a0157b9bcd29ae6f
--- /dev/null
+++ b/o2web/source/x_component_process_Xform/Elautocomplete.js
@@ -0,0 +1,119 @@
+o2.xDesktop.requireApp("process.Xform", "$Elinput", null, false);
+/** @class Elautocomplete 基于Element UI的自动完成输入框组件。
+ * @example
+ * //可以在脚本中获取该组件
+ * //方法1:
+ * var input = this.form.get("name"); //获取组件
+ * //方法2
+ * var input = this.target; //在组件事件脚本中获取
+ * @extends MWF.xApplication.process.Xform.$Module
+ * @o2category FormComponents
+ * @o2range {Process|CMS|Portal}
+ * @hideconstructor
+ */
+MWF.xApplication.process.Xform.Elautocomplete = MWF.APPElautocomplete = new Class(
+ /** @lends o2.xApplication.process.Xform.Elautocomplete# */
+ {
+ Implements: [Events],
+ Extends: MWF.APP$Elinput,
+ options: {
+ "moduleEvents": ["load", "queryLoad", "postLoad"],
+ "elEvents": ["select", "change"]
+ },
+ /**
+ * @summary 组件的配置信息,同时也是Vue组件的data。
+ * @member MWF.xApplication.process.Xform.Elinput#json {JsonObject}
+ * @example
+ * //可以在脚本中获取此对象,下面两行代码是等价的,它们获取的是同一个对象
+ * var json = this.form.get("elinput").json; //获取组件的json对象
+ * var json = this.form.get("elinput").vm.$data; //获取Vue组件的data数据,
+ *
+ * //通过json对象操作Element组件
+ * json.size = "mini"; //改变输入框大小
+ * json.disabled = true; //设置输入框为禁用
+ */
+ _appendVueData: function(){
+ if (!this.json[this.json.id]){
+ this.json[this.json.id] = this._getBusinessData();
+ }
+
+ if (!this.json.placement) this.json.placement = "bottom-start";
+ if (!this.json.popperClass) this.json.popperClass = "";
+ if (!this.json.triggerOnFocus && this.json.triggerOnFocus!==false) this.json.triggerOnFocus = true;
+ if (!this.json.prefixIcon) this.json.prefixIcon = "";
+ if (!this.json.suffixIcon) this.json.suffixIcon = "";
+ if (!this.json.description) this.json.description = "";
+ },
+ appendVueExtend: function(app){
+ if (!app.methods) app.methods = {};
+ app.methods.$loadElEvent = function(ev){
+ this.validationMode();
+ if (this.json.events[ev] && this.json.events[ev].code){
+ this.form.Macro.fire(this.json.events[ev].code, this, event);
+ }
+ }.bind(this);
+ app.methods.$fetchSuggestions = function(qs, cb){
+ debugger;
+ if (this.json.itemType!=='script'){
+ if (this.json.itemValues){
+ var items = this.json.itemValues.filter(function(v){
+ return !qs || v.indexOf(qs)!=-1;
+ }).map(function(v){
+ return {"value": v};
+ })
+ cb(items);
+ return;
+ }
+ cb();
+ }else{
+ this.form.Macro.environment.queryString = qs;
+ var list = this.form.Macro.exec(this.json.itemScript.code, this);
+ Promise.resolve(list).then(function(items){
+ cb(items);
+ delete this.form.Macro.environment.queryString;
+ }).catch(function(){
+ cb();
+ delete this.form.Macro.environment.queryString;
+ });
+ }
+ }.bind(this);
+ },
+ _createElementHtml: function(){
+ var html = "
";
+
+ if (this.json.vueSlot) html += this.json.vueSlot;
+
+ html += "";
+ return html;
+ }
+});
diff --git a/o2web/source/x_component_process_Xform/Elinput.js b/o2web/source/x_component_process_Xform/Elinput.js
index a6a08c7daf3f3322205c8a3f5494a4ac6853baa7..3376cde04defbddcac7896f8e064fbce5793f57d 100644
--- a/o2web/source/x_component_process_Xform/Elinput.js
+++ b/o2web/source/x_component_process_Xform/Elinput.js
@@ -11,7 +11,7 @@ o2.xDesktop.requireApp("process.Xform", "$Elinput", null, false);
* @o2range {Process|CMS|Portal}
* @hideconstructor
*/
-v = MWF.APPElinput = new Class(
+MWF.xApplication.process.Xform.Elinput = MWF.APPElinput = new Class(
/** @lends o2.xApplication.process.Xform.Elinput# */
{
Implements: [Events],
@@ -62,13 +62,20 @@ v = MWF.APPElinput = new Class(
if (!this.json.autosize) this.json.autosize = false;
if (!this.json.readonly) this.json.readonly = false;
if (!this.json.resize) this.json.resize = "none";
+ if (!this.json.description) this.json.description = "";
},
appendVueExtend: function(app){
if (!app.methods) app.methods = {};
app.methods.$loadElEvent = function(ev){
- alert(ev);
- //return this.form.Macro.fire(e.code, this, event);
- }.bind(this)
+ this.validationMode();
+ // if (ev=="change"){
+ // debugger;
+ // this._setBusinessData(this.getInputData("change"));
+ // }
+ if (this.json.events[ev] && this.json.events[ev].code){
+ this.form.Macro.fire(this.json.events[ev].code, this, event);
+ }
+ }.bind(this);
},
_createElementHtml: function(){
var html = "
"+((this.json.circle!=="yes" && this.json.isText!=="no") ? (this.json.name || this.json.id) : "")+"";
+ html += ">";
+
+ if (this.json.vueSlot) html += this.json.vueSlot;
+
+ html += "";
return html;
}
});
diff --git a/o2web/source/x_desktop/js/initialScriptText.js b/o2web/source/x_desktop/js/initialScriptText.js
index cb22218a8f99882a4c9b58ecb599ef7e5d51c5ed..3202589edab439e0e7b5d8bb882e5d2de409be46 100644
--- a/o2web/source/x_desktop/js/initialScriptText.js
+++ b/o2web/source/x_desktop/js/initialScriptText.js
@@ -1,6 +1,6 @@
bind = {};
var library = {
- 'version': '4.0',
+ 'version': '6.2',
"defineProperties": Object.defineProperties || function (obj, properties) {
function convertToDescriptor(desc) {
function hasProperty(obj, prop) {
@@ -151,23 +151,22 @@ var wrapWorkContext = {
//applications
-var includedScripts = [];
-var _self = this;
-var include = function(name, callback){
- if (includedScripts.indexOf(name)==-1){
- var json = JSON.parse(_self.workContext.getScript(name, includedScripts));
- includedScripts = includedScripts.concat(json.importedList);
- if (json.text){
- //MWF.Macro.exec(json.data.text, bind);
- var f = eval("(function(){return function(){\n"+json.text+"\n}})();");
- returnValue = f.apply(bind);
-
- if (callback) callback.apply(bind);
- }
- }
-};
-
-var define = function(name, fun, overwrite){
+// var includedScripts = [];
+// var _self = this;
+// var include = function(name, callback){
+// if (includedScripts.indexOf(name)==-1){
+// var json = JSON.parse(_self.workContext.getScript(name, includedScripts));
+// includedScripts = includedScripts.concat(json.importedList);
+// if (json.text){
+// //MWF.Macro.exec(json.data.text, bind);
+// var f = eval("(function(){return function(){\n"+json.text+"\n}})();");
+// returnValue = f.apply(bind);
+//
+// if (callback) callback.apply(bind);
+// }
+// }
+// };
+var _define = function(name, fun, overwrite){
var over = true;
if (overwrite===false) over = false;
var o = {};
@@ -175,29 +174,30 @@ var define = function(name, fun, overwrite){
library.defineProperties(bind, o);
};
-var Dict = function(name){
- var dictionary = _self.dictionary;
- this.name = name;
- this.get = function(path){
- return JSON.parse(dictionary.select(this.name, path));
- };
- this.set = function(path, value){
- try {
- dictionary.update(this.name, library.JSONEncode(value), path);
- return true;
- }catch(e){
- return false;
- }
- };
- this.add = function(path, value){
- try {
- dictionary.insert(this.name, library.JSONEncode(value), path);
- return true;
- }catch(e){
- return false;
- }
- };
-};
+// var Dict = function(name){
+// var dictionary = _self.dictionary;
+// this.name = name;
+// this.get = function(path){
+// return JSON.parse(dictionary.select(this.name, path));
+// };
+// this.set = function(path, value){
+// try {
+// dictionary.update(this.name, library.JSONEncode(value), path);
+// return true;
+// }catch(e){
+// return false;
+// }
+// };
+// this.add = function(path, value){
+// try {
+// dictionary.insert(this.name, library.JSONEncode(value), path);
+// return true;
+// }catch(e){
+// return false;
+// }
+// };
+// };
+
if ((typeof JSON) == 'undefined'){
JSON = {};
}
@@ -814,6 +814,200 @@ var _Actions = {
};
bind.Actions = _Actions;
+//定义所需的服务
+var _processActions = new _Action("x_processplatform_assemble_surface", {
+ "getDictionary": {"uri": "/jaxrs/applicationdict/{applicationDict}/application/{applicationFlag}"},
+ "getDictRoot": {"uri": "/jaxrs/applicationdict/{applicationDict}/application/{application}/data"},
+ "getDictData": {"uri": "/jaxrs/applicationdict/{applicationDict}/application/{application}/{path}/data"},
+ "setDictData": {"uri": "/jaxrs/applicationdict/{applicationDict}/application/{application}/{path}/data", "method": "PUT"},
+ "addDictData": {"uri": "/jaxrs/applicationdict/{applicationDict}/application/{application}/{path}/data", "method": "POST"},
+ "deleteDictData": {"uri": "/jaxrs/applicationdict/{applicationDict}/application/{application}/{path}/data", "method": "DELETE"},
+ "getScript": {"uri": "/jaxrs/script/{flag}/application/{applicationFlag}", "method": "POST"},
+});
+var _cmsActions = new _Action("x_cms_assemble_control", {
+ "getDictionary": {"uri": "/jaxrs/design/appdict/{appDictId}"},
+ "getDictRoot": {"uri": "/jaxrs/surface/appdict/{appDictId}/appInfo/{appId}/data"},
+ "getDictData": {"uri": "/jaxrs/surface/appdict/{appDictId}/appInfo/{appId}/{path}/data"},
+ "setDictData": {"uri": "/jaxrs/surface/appdict/{appDictId}/appInfo/{appId}/{path}/data", "method": "PUT"},
+ "addDictData": {"uri": "/jaxrs/surface/appdict/{appDictId}/appInfo/{appId}/{path}/data", "method": "POST"},
+ "deleteDictData": {"uri": "/jaxrs/surface/appdict/{appDictId}/appInfo/{appId}/{path}/data", "method": "DELETE"},
+ "getDictRootAnonymous" : {"uri": "/jaxrs/anonymous/surface/appdict/{appDictId}/appInfo/{appId}/data"},
+ "getDictDataAnonymous" : {"uri": "/jaxrs/anonymous/surface/appdict/{appDictId}/appInfo/{appId}/{path}/data"},
+ "getScript": {"uri": "/jaxrs/script/{flag}/appInfo/{appInfoFlag}", "method": "POST"},
+});
+var _portalActions = new _Action("x_portal_assemble_surface", {
+ "getScript": {"uri": "/jaxrs/script/portal/{portal}/name/{ }","method": "POST"}
+});
+
+//include 引用脚本
+//optionsOrName : {
+// type : "", 默认为process, 可以为 portal process cms
+// application : "", 门户/流程/CMS的名称/别名/id, 默认为当前应用
+// name : "" // 脚本名称/别名/id
+//}
+//或者name: "" // 脚本名称/别名/id
+var _exec = function(code, _self){
+ var returnValue;
+ //try{
+ if (!_self) _self = this;
+ try {
+ var f = eval("(function(){return function(){\n"+code+"\n}})();");
+ returnValue = f.apply(_self);
+ }catch(e){
+ console.log("exec", new Error("exec script error"));
+ console.log(e);
+ }
+ return returnValue;
+}
+
+var includedScripts = this.includedScripts || {};
+this.includedScripts = includedScripts;
+
+var _include = function( optionsOrName , callback ){
+ var options = optionsOrName;
+ if( typeOf( options ) == "string" ){
+ options = { name : options };
+ }
+ var name = options.name;
+ var type = ( options.type && options.application ) ? options.type : "process";
+ var application = options.application
+
+ if (!name || !type || !application){
+ console.log("include", new Error("can not find script. missing script name or application"));
+ return false;
+ }
+
+ if (!includedScripts[application]) includedScripts[application] = [];
+
+ if (includedScripts[application].indexOf( name )> -1){
+ if (callback) callback.apply(this);
+ return;
+ }
+
+ var scriptAction;
+ var scriptData;
+ switch ( type ){
+ case "portal" :
+ _portalActions.getScript( application, name, {"importedList":includedScripts[application]}, function(json){
+ if (json.data){
+ includedScripts[application] = includedScripts[application].concat(json.data.importedList);
+ scriptData = json.data;
+ }
+ }.bind(this));
+ break;
+ case "process" :
+ _processActions.getScript( name, application, {"importedList":includedScripts[application]}, function(json){
+ if (json.data){
+ includedScripts[application] = includedScripts[application].concat(json.data.importedList);
+ scriptData = json.data;
+ }
+ }.bind(this));
+ break;
+ case "cms" :
+ _cmsActions.getScript(name, application, {"importedList":includedScripts[application]}, function(json){
+ if (json.data){
+ includedScripts[application] = includedScripts[application].concat(json.data.importedList);
+ scriptData = json.data;
+ }
+ }.bind(this));
+ break;
+ }
+ includedScripts[application].push(name);
+ if (scriptData && scriptData.text){
+ bind.exec(scriptData.text, this);
+ if (callback) callback.apply(this);
+ }
+};
+
+var _createDict = function(application){
+ //optionsOrName : {
+ // type : "", //默认为process, 可以为 process cms
+ // application : "", //流程/CMS的名称/别名/id, 默认为当前应用
+ // name : "", // 数据字典名称/别名/id
+ // enableAnonymous : false //允许在未登录的情况下读取CMS的数据字典
+ //}
+ //或者name: "" // 数据字典名称/别名/id
+ return function(optionsOrName){
+ var options = optionsOrName;
+ if( typeOf( options ) == "string" ){
+ options = { name : options };
+ }
+ var name = this.name = options.name;
+ var type = ( options.type && options.application ) ? options.type : "process";
+ var applicationId = options.application || application;
+ var enableAnonymous = options.enableAnonymous || false;
+
+ //MWF.require("MWF.xScript.Actions.DictActions", null, false);
+ if( type == "cms" ){
+ var action = bind.cmsActions;
+ }else{
+ var action = bind.processActions;
+ }
+
+ var encodePath = function( path ){
+ var arr = path.split(/\./g);
+ var ar = arr.map(function(v){
+ return encodeURIComponent(v);
+ });
+ return ar.join("/");
+ };
+
+ this.get = function(path, success, failure){
+ var value = null;
+ if (path){
+ var p = encodePath( path );
+ action[(enableAnonymous && type == "cms") ? "getDictDataAnonymous" : "getDictData"](encodeURIComponent(this.name), applicationId, p, function(json){
+ value = json.data;
+ if (success) success(json.data);
+ }, function(xhr, text, error){
+ if (failure) failure(xhr, text, error);
+ });
+ }else{
+ action[(enableAnonymous && type == "cms") ? "getDictRootAnonymous" : "getDictRoot"](encodeURIComponent(this.name), applicationId, function(json){
+ value = json.data;
+ if (success) success(json.data);
+ }, function(xhr, text, error){
+ if (failure) failure(xhr, text, error);
+ }, false);
+ }
+
+ return value;
+ };
+
+ this.set = function(path, value, success, failure){
+ var p = encodePath( path );
+ //var p = path.replace(/\./g, "/");
+ action.setDictData(encodeURIComponent(this.name), applicationId, p, value, function(json){
+ if (success) success(json.data);
+ }, function(xhr, text, error){
+ if (failure) failure(xhr, text, error);
+ }, false, false);
+ };
+ this.add = function(path, value, success, failure){
+ var p = encodePath( path );
+ //var p = path.replace(/\./g, "/");
+ action.addDictData(encodeURIComponent(this.name), applicationId, p, value, function(json){
+ if (success) success(json.data);
+ }, function(xhr, text, error){
+ if (failure) failure(xhr, text, error);
+ }, false, false);
+ };
+ this["delete"] = function(path, success, failure){
+ var p = encodePath( path );
+ //var p = path.replace(/\./g, "/");
+ action.deleteDictData(encodeURIComponent(this.name), applicationId, p, function(json){
+ if (success) success(json.data);
+ }, function(xhr, text, error){
+ if (failure) failure(xhr, text, error);
+ }, false, false);
+ };
+ this.destory = this["delete"];
+ }
+};
+bind.exec = _exec;
+bind.include = _include;
+bind.Dict = _createDict();
+
try{
oPrint = oPrint;
}catch(e){
@@ -836,9 +1030,9 @@ bind.service = this.webservicesClient;
bind.org = _org;
bind.Action = _Action;
//bind.organization = this.organization;
-bind.include = include;
-bind.define = define;
-bind.Dict = Dict;
+//bind.include = include;
+bind.define = _define;
+//bind.Dict = Dict;
bind.form = null;
bind.body = {
"set": function(data){
@@ -928,55 +1122,6 @@ Object.defineProperty(response, "get", {enumerable: true,configurable: true,
});
bind.response = response;
-// bind.response = (function(){
-// // var _self = this;
-// // if (this.jaxrsResponse){
-// if (this.jaxrsResponse.get()){
-// var value = this.jaxrsResponse.get();
-// if (JSON.validate(value)){
-// return {
-// "status": this.jaxrsResponse.status,
-// "value": JSON.decode(value),
-// "get": function(){ JSON.decode(value) }
-// };
-// }else{
-// return {
-// "status": this.jaxrsResponse.status,
-// "value": value,
-// "get": function(){ return value; }
-// };
-// }
-// }else{
-// return {
-// "status": this.jaxrsResponse.status,
-// "value": this.jaxrsResponse.value,
-// "get": function(){ return _self.jaxrsResponse.value; }
-// };
-// }
-// }else{
-// return {
-// "get": function(){
-// return _self.jaxwsResponse || null;
-// // if (_self.jaxwsResponse && _self.jaxwsResponse.get()){
-// // if (JSON.validate(_self.jaxwsResponse.get())){
-// // return {
-// // "status": _self.jaxwsResponse.status,
-// // "value": JSON.decode(_self.jaxwsResponse.get())
-// // };
-// // }else{
-// // return {
-// // "status": _self.jaxwsResponse.status,
-// // "value": _self.jaxwsResponse.value
-// // };
-// // }
-// // }else{
-// // return {"status": _self.jaxwsResponse.status};
-// // }
-// }
-// }
-// }
-// }).apply(this);
-
bind.assginData = {
"data": null,
"get": function(){