|
|
@@ -17,44 +17,44 @@ MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
|
|
|
MWF.xApplication.process.Xform.Actionbar = MWF.APPActionbar = new Class(
|
|
|
/** @lends MWF.xApplication.process.Xform.Actionbar# */
|
|
|
{
|
|
|
- Extends: MWF.APP$Module,
|
|
|
- options: {
|
|
|
+ Extends: MWF.APP$Module,
|
|
|
+ options: {
|
|
|
+ /**
|
|
|
+ * 组件加载前触发。
|
|
|
+ * @event MWF.xApplication.process.Xform.Actionbar#queryLoad
|
|
|
+ * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
|
|
|
+ */
|
|
|
+ /**
|
|
|
+ * 组件加载时触发。
|
|
|
+ * @event MWF.xApplication.process.Xform.Actionbar#load
|
|
|
+ * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
|
|
|
+ */
|
|
|
+ /**
|
|
|
+ * 组件加载后事件.由于加载过程中有异步处理,这个时候操作条有可能还未生成。
|
|
|
+ * @event MWF.xApplication.process.Xform.Actionbar#postLoad
|
|
|
+ * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
|
|
|
+ */
|
|
|
+ /**
|
|
|
+ * 组件加载后事件。这个时候操作条已生成
|
|
|
+ * @event MWF.xApplication.process.Xform.Actionbar#afterLoad
|
|
|
+ * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
|
|
|
+ */
|
|
|
+ "moduleEvents": ["load", "queryLoad", "postLoad", "afterLoad"]
|
|
|
+ },
|
|
|
/**
|
|
|
- * 组件加载前触发。
|
|
|
- * @event MWF.xApplication.process.Xform.Actionbar#queryLoad
|
|
|
- * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
|
|
|
+ * @summary 重新加载操作条.
|
|
|
+ * @example
|
|
|
+ * this.form.get("name").reload(); //显示操作条
|
|
|
*/
|
|
|
- /**
|
|
|
- * 组件加载时触发。
|
|
|
- * @event MWF.xApplication.process.Xform.Actionbar#load
|
|
|
- * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
|
|
|
- */
|
|
|
- /**
|
|
|
- * 组件加载后事件.由于加载过程中有异步处理,这个时候操作条有可能还未生成。
|
|
|
- * @event MWF.xApplication.process.Xform.Actionbar#postLoad
|
|
|
- * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
|
|
|
- */
|
|
|
- /**
|
|
|
- * 组件加载后事件。这个时候操作条已生成
|
|
|
- * @event MWF.xApplication.process.Xform.Actionbar#afterLoad
|
|
|
- * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
|
|
|
- */
|
|
|
- "moduleEvents": ["load", "queryLoad", "postLoad", "afterLoad"]
|
|
|
- },
|
|
|
- /**
|
|
|
- * @summary 重新加载操作条.
|
|
|
- * @example
|
|
|
- * this.form.get("name").reload(); //显示操作条
|
|
|
- */
|
|
|
- reload : function(){
|
|
|
- this._loadUserInterface();
|
|
|
- },
|
|
|
- _loadUserInterface: function(){
|
|
|
- // if (this.form.json.mode == "Mobile"){
|
|
|
- // this.node.empty();
|
|
|
- // }else if (COMMON.Browser.Platform.isMobile){
|
|
|
- // this.node.empty();
|
|
|
- // }else{
|
|
|
+ reload : function(){
|
|
|
+ this._loadUserInterface();
|
|
|
+ },
|
|
|
+ _loadUserInterface: function(){
|
|
|
+ // if (this.form.json.mode == "Mobile"){
|
|
|
+ // this.node.empty();
|
|
|
+ // }else if (COMMON.Browser.Platform.isMobile){
|
|
|
+ // this.node.empty();
|
|
|
+ // }else{
|
|
|
this.toolbarNode = this.node.getFirst("div");
|
|
|
if(!this.toolbarNode)return;
|
|
|
|
|
|
@@ -145,182 +145,214 @@ MWF.xApplication.process.Xform.Actionbar = MWF.APPActionbar = new Class(
|
|
|
}
|
|
|
}
|
|
|
}.bind(this));
|
|
|
- // }
|
|
|
- },
|
|
|
+ // }
|
|
|
+ },
|
|
|
|
|
|
- setCustomToolbars: function(tools, node){
|
|
|
- var path = "../x_component_process_FormDesigner/Module/Actionbar/";
|
|
|
- var iconPath = "";
|
|
|
- if( this.json.customIconStyle ){
|
|
|
- iconPath = this.json.customIconStyle+"/";
|
|
|
- }
|
|
|
- tools.each(function(tool){
|
|
|
- var flag = true;
|
|
|
- if (this.readonly){
|
|
|
- flag = tool.readShow;
|
|
|
- }else{
|
|
|
- flag = tool.editShow;
|
|
|
+ setCustomToolbars: function(tools, node){
|
|
|
+ var path = "../x_component_process_FormDesigner/Module/Actionbar/";
|
|
|
+ var iconPath = "";
|
|
|
+ if( this.json.customIconStyle ){
|
|
|
+ iconPath = this.json.customIconStyle+"/";
|
|
|
}
|
|
|
- if (flag){
|
|
|
- flag = true;
|
|
|
- if (tool.control){
|
|
|
- flag = this.form.businessData.control[tool.control]
|
|
|
- }
|
|
|
- if (tool.condition){
|
|
|
- var hideFlag = this.form.Macro.exec(tool.condition, this);
|
|
|
- flag = !hideFlag;
|
|
|
+ tools.each(function(tool){
|
|
|
+ var flag = true;
|
|
|
+ if (this.readonly){
|
|
|
+ flag = tool.readShow;
|
|
|
+ }else{
|
|
|
+ flag = tool.editShow;
|
|
|
}
|
|
|
if (flag){
|
|
|
- var actionNode = new Element("div", {
|
|
|
- "id": tool.id,
|
|
|
- "MWFnodetype": tool.type,
|
|
|
- "MWFButtonImage": path+""+this.form.options.style+"/custom/"+iconPath+tool.img,
|
|
|
- "title": tool.title,
|
|
|
- "MWFButtonAction": "runCustomAction",
|
|
|
- "MWFButtonText": tool.text
|
|
|
- }).inject(node);
|
|
|
- if( this.json.customIconOverStyle ){
|
|
|
- actionNode.set("MWFButtonImageOver" , path+""+this.form.options.style +"/custom/"+this.json.customIconOverStyle+ "/" +tool.img );
|
|
|
+ flag = true;
|
|
|
+ if (tool.control){
|
|
|
+ flag = this.form.businessData.control[tool.control]
|
|
|
}
|
|
|
- if( tool.properties ){
|
|
|
- actionNode.set(tool.properties);
|
|
|
+ if (tool.condition){
|
|
|
+ var hideFlag = this.form.Macro.exec(tool.condition, this);
|
|
|
+ flag = !hideFlag;
|
|
|
}
|
|
|
- if (tool.actionScript){
|
|
|
- actionNode.store("script", tool.actionScript);
|
|
|
- }
|
|
|
- if (tool.sub){
|
|
|
- var subNode = node.getLast();
|
|
|
- this.setCustomToolbars(tool.sub, subNode);
|
|
|
+ if (flag){
|
|
|
+ var actionNode = new Element("div", {
|
|
|
+ "id": tool.id,
|
|
|
+ "MWFnodetype": tool.type,
|
|
|
+ "MWFButtonImage": path+""+this.form.options.style+"/custom/"+iconPath+tool.img,
|
|
|
+ "title": tool.title,
|
|
|
+ "MWFButtonAction": "runCustomAction",
|
|
|
+ "MWFButtonText": tool.text
|
|
|
+ }).inject(node);
|
|
|
+ if( this.json.customIconOverStyle ){
|
|
|
+ actionNode.set("MWFButtonImageOver" , path+""+this.form.options.style +"/custom/"+this.json.customIconOverStyle+ "/" +tool.img );
|
|
|
+ }
|
|
|
+ if( tool.properties ){
|
|
|
+ actionNode.set(tool.properties);
|
|
|
+ }
|
|
|
+ if (tool.actionScript){
|
|
|
+ actionNode.store("script", tool.actionScript);
|
|
|
+ }
|
|
|
+ if (tool.sub){
|
|
|
+ var subNode = node.getLast();
|
|
|
+ this.setCustomToolbars(tool.sub, subNode);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- }.bind(this));
|
|
|
- },
|
|
|
+ }.bind(this));
|
|
|
+ },
|
|
|
|
|
|
- setToolbarItem: function(tool, node, readonly, noCondition){
|
|
|
- var path = "../x_component_process_FormDesigner/Module/Actionbar/";
|
|
|
- var flag = true;
|
|
|
- if (tool.control){
|
|
|
- flag = this.form.businessData.control[tool.control]
|
|
|
- }
|
|
|
- if (!noCondition) if (tool.condition){
|
|
|
- var hideFlag = this.form.Macro.exec(tool.condition, this);
|
|
|
- flag = flag && (!hideFlag);
|
|
|
- }
|
|
|
- // if (tool.id == "action_processWork"){
|
|
|
- // if (!this.form.businessData.task){
|
|
|
- // flag = false;
|
|
|
- // }
|
|
|
- // }
|
|
|
- if (tool.id == "action_downloadAll" || tool.id == "action_print"){
|
|
|
- if (!this.form.businessData.work.startTime){
|
|
|
- flag = false;
|
|
|
+ setToolbarItem: function(tool, node, readonly, noCondition){
|
|
|
+ var path = "../x_component_process_FormDesigner/Module/Actionbar/";
|
|
|
+ var flag = true;
|
|
|
+ if (tool.control){
|
|
|
+ flag = this.form.businessData.control[tool.control]
|
|
|
}
|
|
|
- }
|
|
|
- if (tool.id == "action_delete"){
|
|
|
- if (!this.form.businessData.work || !this.form.businessData.work.id){
|
|
|
- flag = false;
|
|
|
+ if (!noCondition) if (tool.condition){
|
|
|
+ var hideFlag = this.form.Macro.exec(tool.condition, this);
|
|
|
+ flag = flag && (!hideFlag);
|
|
|
+ }
|
|
|
+ // if (tool.id == "action_processWork"){
|
|
|
+ // if (!this.form.businessData.task){
|
|
|
+ // flag = false;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ if (tool.id == "action_downloadAll" || tool.id == "action_print"){
|
|
|
+ if (!this.form.businessData.work.startTime){
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (tool.id == "action_delete"){
|
|
|
+ if (!this.form.businessData.work || !this.form.businessData.work.id){
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
|
|
- if (tool.id == "action_rollback") tool.read = true;
|
|
|
- if (readonly) if (!tool.read) flag = false;
|
|
|
- if (flag){
|
|
|
- var actionNode = new Element("div", {
|
|
|
- "id": tool.id,
|
|
|
- "MWFnodetype": tool.type,
|
|
|
- //"MWFButtonImage": this.form.path+""+this.form.options.style+"/actionbar/"+tool.img,
|
|
|
- "MWFButtonImage": path+(this.options.style||"default") +"/tools/"+ (this.json.style || "default") +"/"+tool.img,
|
|
|
- "title": tool.title,
|
|
|
- "MWFButtonAction": tool.action,
|
|
|
- "MWFButtonText": tool.text
|
|
|
- }).inject(node);
|
|
|
- if( this.json.iconOverStyle ){
|
|
|
- actionNode.set("MWFButtonImageOver" , path+""+(this.options.style||"default")+"/tools/"+( this.json.iconOverStyle || "default" )+"/"+tool.img );
|
|
|
+ if (tool.id == "action_rollback") tool.read = true;
|
|
|
+ if (readonly) if (!tool.read) flag = false;
|
|
|
+ if (flag){
|
|
|
+ var actionNode = new Element("div", {
|
|
|
+ "id": tool.id,
|
|
|
+ "MWFnodetype": tool.type,
|
|
|
+ //"MWFButtonImage": this.form.path+""+this.form.options.style+"/actionbar/"+tool.img,
|
|
|
+ "MWFButtonImage": path+(this.options.style||"default") +"/tools/"+ (this.json.style || "default") +"/"+tool.img,
|
|
|
+ "title": tool.title,
|
|
|
+ "MWFButtonAction": tool.action,
|
|
|
+ "MWFButtonText": tool.text
|
|
|
+ }).inject(node);
|
|
|
+ if( this.json.iconOverStyle ){
|
|
|
+ actionNode.set("MWFButtonImageOver" , path+""+(this.options.style||"default")+"/tools/"+( this.json.iconOverStyle || "default" )+"/"+tool.img );
|
|
|
+ }
|
|
|
+ if( tool.properties ){
|
|
|
+ actionNode.set(tool.properties);
|
|
|
+ }
|
|
|
+ if (tool.sub){
|
|
|
+ var subNode = node.getLast();
|
|
|
+ this.setToolbars(tool.sub, subNode, readonly, noCondition);
|
|
|
+ }
|
|
|
}
|
|
|
- if( tool.properties ){
|
|
|
- actionNode.set(tool.properties);
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @summary 根据操作id获取操作,该方法在操作条的afterLoad事件中有效,操作的操作脚本有效。
|
|
|
+ * @param {String} id - 必选,操作id.
|
|
|
+ * @return {o2.widget.ToolbarButton} 操作
|
|
|
+ * @example
|
|
|
+ * var actionbar = this.form.get("name"); //获取操作条
|
|
|
+ * var item = actionbar.getItem( "action_delete" ); //获取删除操作
|
|
|
+ * item.node.hide(); //隐藏删除操作的节点
|
|
|
+ * item.node.click(); //触发操作的click事件
|
|
|
+ */
|
|
|
+ getItem : function( id ){
|
|
|
+ if( this.toolbarWidget && id ){
|
|
|
+ return this.toolbarWidget.items[id]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @summary 获取所有操作,该方法在操作条的afterLoad事件中有效,操作的操作脚本有效。
|
|
|
+ * @return {Array} 操作数组
|
|
|
+ * @example
|
|
|
+ * var actionbar = this.form.get("name"); //获取操作条
|
|
|
+ * var itemList = actionbar.getAllItem(); //获取操作数组
|
|
|
+ * itemList[1].node.hide(); //隐藏第一个操作
|
|
|
+ */
|
|
|
+ getAllItem : function(){
|
|
|
+ return this.toolbarWidget ? this.toolbarWidget.childrenButton : [];
|
|
|
+ },
|
|
|
+ setToolbars: function(tools, node, readonly, noCondition){
|
|
|
+ tools.each(function(tool){
|
|
|
+ this.setToolbarItem(tool, node, readonly, noCondition);
|
|
|
+ }.bind(this));
|
|
|
+ },
|
|
|
+ runCustomAction: function(bt){
|
|
|
+ var script = bt.node.retrieve("script");
|
|
|
+ this.form.Macro.exec(script, this);
|
|
|
+ },
|
|
|
+ saveWork: function(){
|
|
|
+ this.form.saveWork();
|
|
|
+ },
|
|
|
+ closeWork: function(){
|
|
|
+ this.form.closeWork();
|
|
|
+ },
|
|
|
+ processWork: function(){
|
|
|
+ this.form.processWork();
|
|
|
+ },
|
|
|
+ resetWork: function(){
|
|
|
+ this.form.resetWork();
|
|
|
+ },
|
|
|
+ retractWork: function(e, ev){
|
|
|
+ this.form.retractWork(e, ev);
|
|
|
+ },
|
|
|
+ rerouteWork: function(e, ev){
|
|
|
+ this.form.rerouteWork(e, ev);
|
|
|
+ },
|
|
|
+ deleteWork: function(){
|
|
|
+ this.form.deleteWork();
|
|
|
+ },
|
|
|
+ printWork: function(){
|
|
|
+ this.form.printWork();
|
|
|
+ },
|
|
|
+ readedWork: function(b,e){
|
|
|
+ this.form.readedWork(e);
|
|
|
+ },
|
|
|
+ addSplit: function(e){
|
|
|
+ this.form.addSplit(e);
|
|
|
+ },
|
|
|
+ rollback: function(e){
|
|
|
+ this.form.rollback(e);
|
|
|
+ },
|
|
|
+ downloadAll: function(e){
|
|
|
+ this.form.downloadAll(e);
|
|
|
+ },
|
|
|
+ pressWork: function(e){
|
|
|
+ this.form.pressWork(e);
|
|
|
+ },
|
|
|
+ pauseTask: function(e){
|
|
|
+ var p = this.form.pauseTask(e);
|
|
|
+ if (p){
|
|
|
+ p.then(function(){
|
|
|
+ e.setText(MWF.xApplication.process.Xform.LP.resume);
|
|
|
+ e.options.action = "resumeTask";
|
|
|
+
|
|
|
+ var img = e.picNode.getElement("img");
|
|
|
+ var src = img.get("src");
|
|
|
+ src = src.substr(0, src.lastIndexOf("/"));
|
|
|
+ src = src+"/resume.png";
|
|
|
+ img.set("src", src);
|
|
|
+
|
|
|
+ }.bind(this), function(){});
|
|
|
}
|
|
|
- if (tool.sub){
|
|
|
- var subNode = node.getLast();
|
|
|
- this.setToolbars(tool.sub, subNode, readonly, noCondition);
|
|
|
+ },
|
|
|
+ resumeTask: function(e){
|
|
|
+ var p = this.form.resumeTask(e);
|
|
|
+ if (p){
|
|
|
+ p.then(function(){
|
|
|
+ e.setText( MWF.xApplication.process.Xform.LP.pause);
|
|
|
+ e.options.action = "pauseTask";
|
|
|
+
|
|
|
+ var img = e.picNode.getElement("img");
|
|
|
+ var src = img.get("src");
|
|
|
+ src = src.substr(0, src.lastIndexOf("/"));
|
|
|
+ src = src+"/pause.png";
|
|
|
+ img.set("src", src);
|
|
|
+
|
|
|
+ }.bind(this), function(){});
|
|
|
}
|
|
|
}
|
|
|
- },
|
|
|
- /**
|
|
|
- * @summary 根据操作id获取操作,该方法在操作条的afterLoad事件中有效,操作的操作脚本有效。
|
|
|
- * @param {String} id - 必选,操作id.
|
|
|
- * @return {o2.widget.ToolbarButton} 操作
|
|
|
- * @example
|
|
|
- * var actionbar = this.form.get("name"); //获取操作条
|
|
|
- * var item = actionbar.getItem( "action_delete" ); //获取删除操作
|
|
|
- * item.node.hide(); //隐藏删除操作的节点
|
|
|
- * item.node.click(); //触发操作的click事件
|
|
|
- */
|
|
|
- getItem : function( id ){
|
|
|
- if( this.toolbarWidget && id ){
|
|
|
- return this.toolbarWidget.items[id]
|
|
|
- }
|
|
|
- },
|
|
|
- /**
|
|
|
- * @summary 获取所有操作,该方法在操作条的afterLoad事件中有效,操作的操作脚本有效。
|
|
|
- * @return {Array} 操作数组
|
|
|
- * @example
|
|
|
- * var actionbar = this.form.get("name"); //获取操作条
|
|
|
- * var itemList = actionbar.getAllItem(); //获取操作数组
|
|
|
- * itemList[1].node.hide(); //隐藏第一个操作
|
|
|
- */
|
|
|
- getAllItem : function(){
|
|
|
- return this.toolbarWidget ? this.toolbarWidget.childrenButton : [];
|
|
|
- },
|
|
|
- setToolbars: function(tools, node, readonly, noCondition){
|
|
|
- tools.each(function(tool){
|
|
|
- this.setToolbarItem(tool, node, readonly, noCondition);
|
|
|
- }.bind(this));
|
|
|
- },
|
|
|
- runCustomAction: function(bt){
|
|
|
- var script = bt.node.retrieve("script");
|
|
|
- this.form.Macro.exec(script, this);
|
|
|
- },
|
|
|
- saveWork: function(){
|
|
|
- this.form.saveWork();
|
|
|
- },
|
|
|
- closeWork: function(){
|
|
|
- this.form.closeWork();
|
|
|
- },
|
|
|
- processWork: function(){
|
|
|
- this.form.processWork();
|
|
|
- },
|
|
|
- resetWork: function(){
|
|
|
- this.form.resetWork();
|
|
|
- },
|
|
|
- retractWork: function(e, ev){
|
|
|
- this.form.retractWork(e, ev);
|
|
|
- },
|
|
|
- rerouteWork: function(e, ev){
|
|
|
- this.form.rerouteWork(e, ev);
|
|
|
- },
|
|
|
- deleteWork: function(){
|
|
|
- this.form.deleteWork();
|
|
|
- },
|
|
|
- printWork: function(){
|
|
|
- this.form.printWork();
|
|
|
- },
|
|
|
- readedWork: function(b,e){
|
|
|
- this.form.readedWork(e);
|
|
|
- },
|
|
|
- addSplit: function(e){
|
|
|
- this.form.addSplit(e);
|
|
|
- },
|
|
|
- rollback: function(e){
|
|
|
- this.form.rollback(e);
|
|
|
- },
|
|
|
- downloadAll: function(e){
|
|
|
- this.form.downloadAll(e);
|
|
|
- },
|
|
|
- pressWork: function(e){
|
|
|
- this.form.pressWork(e);
|
|
|
- }
|
|
|
|
|
|
-});
|
|
|
+ });
|