o2oa api: form | o2oa开发平台-游戏厅捕鱼达人

module

form对象可在流程表单或内容管理表单中可用。(仅前端脚本可用)。

usable range

process cms

syntax

//您可以在流程表单和内容管理的前端脚本中,通过this来获取form对象,如下:
var form = this.form;

source

members

static

currentroutename

在用户提交的时候,选择的路由。仅在表单的“校验意见”和“校验路由”脚本中可用。只读。(仅流程表单中可用)

syntax

var currentroutename = this.form.currentroutename;

source

static

opinion

在用户提交的时候,输入的意见。仅在表单的“校验意见”和“校验路由”脚本中可用。只读。(仅流程表单中可用)

syntax

var opinion = this.form.opinion;

source

static

medias

在提交的时候,用户的手写意见以及录音意见,仅在表单的“校验意见”和“校验路由”脚本中可用。只读。(仅流程表单中可用)

syntax

var medias = this.form.medias;

source

methods

static

publish(callback)

发布当前文档。(仅内容管理表单中可用)

syntax

this.form.publish( callback );

parameters

  • callback function

    发布后的回调方法,如果接收的参数为空表示校验未通过,如果参数不为空为发布后的回调

source

static

getinfor() → {object}

获取当前表单的基本信息。

syntax

var form = this.form.getinfor();

returns

  • object

    表单的基本信息.

    {
       "id": "db3b2766-93a1-4058-b522-0edb922bd84f",   //表单id
       "name": "报销申请表单",                         //表单名称
       "alias": "报销申请表单",                        //表单别名
       "description": "",                              //表单描述
       "application": "1dc23336-6be6-402b-bed6-36e707a1dd17",  //应用id
       "lastupdateperson": "xx@huqi@p",                //最后修改人
       "lastupdatetime": "2018-09-30 22:46:30",        //最后修改时间
       "icon": "...",                                  //表单图标
    }

source

static

getapp() → {x_component_process_work}

获取打开当前文档的component对象。平台中每一个窗口应用,就是一个component对象。此处获取到的对象为x_component_process_work。

syntax

var app = this.form.getapp();

returns

  • x_component_process_work

    打开当前文档的component对象.

example

var app = this.form.getapp();
         //所有component对象都有以下方法。
         app.openinnewwindow();  //在新窗口中打开当前应用
         app.setcurrent();   //将当前应用设置为激活状态
         app.minsize();      //应用窗口最小化
         app.maxsize();      //应用窗口最大化
         app.restoresize();  //应用窗口还原
         app.refresh();      //刷新应用
         app.close();        //关闭应用
         app.settitle(str);  //设置应用标题
         app.dialog(option); //弹出一个对话框(详见mwf.widget.dialog)
         //显示一个通知消息
         app.notice(content, type, target, where, offset);
         //显示一个确认框
         app.confirm(type, e, title, text, width, height, ok, cancel);
         //弹出一个信息框
         app.alert(type, e, title, text, width, height);
         //为应用绑定一个事件
         app.addevent(type, fun);

source

static

get(name, subformnameopt) → {formcomponent}

获取表单元素对象。

actionbar(操作条)address(地址输入框)attachment(附件框)button(按钮)
calendar(日期输入框)checkbox(多选按钮)combox(组合框)datagrid(数据网格)
div(容器)htmleditor(富文本编辑框)html(内置html)iframe(嵌入iframe)
image(图片)label(文本)log(流程意见)monitor(流程监控)
number(数字输入框)office(office控件)opinion(意见框)org(人员组织选择)
radio(单选按钮)select(选择框)sidebar(侧边操作条)stat(统计组件)
subform(子表单)tab(分页)table(表格)textarea(多行输入)
textfield(文本输入框)tree(树状控件)view(视图组件)viewselector(视图选择组件)
documenteditor(公文编辑器)imageclipper(图片编辑器)

syntax

var field = this.form.get(name);
var field = this.form.get(name, subformname);

parameters

  • name string

    字段标识

  • subformname string

    子表单/部件标识。当开发人员在插入子表单的时候,系统会检查输入类型(会在后台存值)的组件是否重名,如果重名则不允许插入。 但是布局组件(如div)重名会被允许。系统在展现表单的时候会判断子表单中组件的标识是否被使用,如果是会自动在组件前加上"子表单标识_",如:主表单有一个"div_1",则子表单"subform1"的"div_1"组件标识则变为"subform1_div_1"。 本参数就是用在这种情况下,可以正确返回子表单中的组件。

returns

  • formcomponent

    请查看本文档的classes导航下的formcomponents。

examples

var field = this.form.get("subject");
var field = this.form.get("div", "subform1"); //获取子表单“subform1”中的div,如果子表单无此组件,而主表单有,则返回主表单的组件。

source

static

getfield(name) → {formcomponent}

获取表单中可输入的字段元素对象。

address(地址输入框)attachment(附件框)calendar(日期输入框)checkbox(多选按钮)
combox(组合框)datagrid(数据网格)htmleditor(富文本编辑框)number(数字输入框)
org(人员组织选择)radio(单选按钮)select(选择框)textarea(多行输入)
textfield(文本输入框)

syntax

var field = this.form.getfield(name);

parameters

  • name string

    字段标识

returns

  • formcomponent

    请查看本文档的classes导航下的formcomponents。

example

var field = this.form.getfield("subject");

source

static

save(callbackopt, silentopt)

保存当前表单所绑定的业务数据。
this.form.save()会触发 beforesave和aftersave事件,因此在beforesave和aftersave中不允许使用本方法。同时不建议在queryload里使用本方法。

syntax

this.form.save(callback, silent);

parameters

  • callback function

    保存后的回调

  • silent boolean

    是否静默,否提示保存成功,默认为false

example

this.form.save(function(){
     //do someting
 }, true);

source

static

verify() → {boolean}

根据表单中所有组件的校验设置和“流转校验”脚本进行校验。

description

本校验不包括校验意见,校验路由;通常用在弹出提交界面时候的校验

syntax

this.form.verify()

returns

  • boolean

    是否通过校验

example

if( !this.form.verify() ){
     return false;
 }
 

source

static

process(optionopt)

对当前表单打开的流程实例进行流转。(仅流程表单中可用)
可以通过this.workcontext.getcontrol().allowprocessing来判断当前用户是否有权限进行流转。
this.form.process()会触发 beforesave、aftersave、beforeprocess、afterprocess事件,因此在上述事件中不允许使用本方法。

parameters

  • option object

    流程的相关数据,如果不带此参数,则弹出路由选择和意见填写框
    格式如下:

    
    {
    "routename": "", //流转到下一步要选择的路由名称
    "opinion": "", //流转意见
    "callback": function(json){} //回调方法,有json参数表示正常流转,json参数为流转后返回的数据。
    }
    

examples

//不带参数,弹出路由选择和意见填写框
         this.form.process();
//带参数,流转
         this.form.process({
            "routename": "送审批",
            "opinion": "同意",
            "callback": function(json){
                if(json)this.form.notice("process success", "success");
            }.bind(this)
      });

source

static

reset(optionopt)

对当前文档的待办重新设定处理人。(仅流程表单中可用)
可以通过this.workcontext.getcontrol().allowreset来判断当前用户是否有权限重置处理人。
this.form.reset()会触发 beforereset、afterreset事件,因此在上述事件中不允许使用本方法。

parameters

  • option object

    进行重置处理人的相关参数,如果不带此参数,弹出重置处理人对话框
    格式如下:

    
    {
    "names": "", //{array|string} 要重置给哪些身份
    "opinion": "", //流转意见
    "success": function(){}, //重置成功后的回调方法
    "failure": function(){} //重置失败后的回调方法
    }
    

examples

//不带参数,弹出重置处理人对话框
         this.form.reset();
//带参数,直接调用后台服务重置
         this.form.reset({
            "names": ["张三@zhangsan@i"],
            "opinion": "授权处理",
            "success": function(json){
                this.form.notice("reset success", "success");
            }.bind(this),
            "failure": function(xhr, text, error){
                //xhr--httprequest请求对象
                //text--httpresponse内容文本
                //error--错误信息
                this.form.notice("reset failure:" error, "error");
            }.bind(this)
        });

source

static

retract(optionopt)

撤回文档操作,上一个处理人收回已经流转下去的文件。(仅流程表单中可用)
这个操作只允许上一个处理人在流转文件之后,下一个处理人未处理的时候执行。
可以通过this.workcontext.getcontrol().allowretract来判断当前用户是否有权限撤回。
this.form.retract()会触发 beforeretract、afterretract事件,因此在上述事件中不允许使用本方法。

parameters

  • option object

    进行撤回的相关参数,如果不提供option参数,则弹出撤回对话框。
    格式如下:

    
    {
    "success": function(){}, //撤回成功后的回调方法
    "failure": function(){} //撤回失败后的回调方法
    }
    

examples

//不带参数,则弹出撤回对话框
         this.form.retract();
//带参数,直接调用后台服务撤回
         this.form.retract({
            "success": function(json){
                this.form.notice("retract success", "success");
            }.bind(this),
            "failure": function(xhr, text, error){
                //xhr--httprequest请求对象
                //text--httpresponse内容文本
                //error--错误信息
                this.form.notice("retract failure: " error, "error");
            }.bind(this)
        });

source

static

addsplit(optionopt)

在已拆分的工作上添加分支。(仅流程表单中可用)
可以通过this.workcontext.getcontrol().allowaddsplit来判断当前用户是否有权限。

parameters

  • option object

    添加分支的相关参数,如果不提供option参数,则弹出添加分支对话框。
    格式如下:

    
    {
    "value" : [], //splitvaluelist 添加的拆分值,拆分值取决于流程拆分节点的设置
    "trimexist" : true, //排除已经存在的拆分值.
    "success": function(){}, //执行成功后的回调方法
    "failure": function(){} //执行失败后的回调方法
    }
    

examples

//不带参数,则弹出添加分支对话框
         this.form.addsplit();
//带参数,直接添加分支
         this.form.addsplit({
            "value" : ["开发部@kfb@u"],
            "trimexist" : true,
            "success": function(json){
                this.form.notice("addsplit success", "success");
            }.bind(this),
            "failure": function(xhr, text, error){
                //xhr--httprequest请求对象
                //text--httpresponse内容文本
                //error--错误信息
                this.form.notice("addsplit failure: " error, "error");
            }.bind(this)
        });

source

static

deletework(optionopt)

删除当前工作文档。(仅流程表单中可用)
可以通过this.workcontext.getcontrol().allowdeletework来判断当前用户是否有权限删除文档。

parameters

  • option object

    删除相关参数,如果不提供option参数,则弹出删除对话框。
    格式如下:

    
    {
    "success": function(){}, //执行成功后的回调方法
    "failure": function(){} //执行失败后的回调方法
    }
    

examples

//不带参数,则弹出删除提示对话框
         this.form.deletework();
//带参数,直接调用服务删除
         this.form.deletework({
            "success": function(json){
                this.form.notice("deletework success", "success");
            }.bind(this),
            "failure": function(xhr, text, error){
                //xhr--httprequest请求对象
                //text--httpresponse内容文本
                //error--错误信息
                this.form.notice("deletework failure: " error, "error");
            }.bind(this)
        });

source

static

sendread(optionopt)

对当前工作发送待阅。(仅流程表单中可用)
能查看工作的人都有权限发送。
this.form.sendread()会触发 beforesendread、aftersendread,因此在上述事件中不允许使用本方法。

parameters

  • option object

    发送待阅的相关参数,如果不带此参数,弹出发送待阅对话框
    格式如下:

    
    {
    "identitylist": "", //{array|string} 要给哪些身份发送待阅
    "notify": true, //是否发送待阅通知(需要服务器开启消息)
    "success": function(){}, //成功后的回调方法
    "failure": function(){} //失败后的回调方法
    }
    

examples

//不带参数,弹出发送待阅对话框
         this.form.sendread();
//带参数,直接调用后台服务发送待阅
         this.form.sendread({
            "identitylist": ["张三@zhangsan@i"],
            "notify": false,
            "success": function(json){
                this.form.notice("send read success", "success");
            }.bind(this),
            "failure": function(xhr, text, error){
                //xhr--httprequest请求对象
                //text--httpresponse内容文本
                //error--错误信息
                this.form.notice("send read failure:" error, "error");
            }.bind(this)
        });

source

static

addreview(optionopt)

对当前工作添加阅读人(参阅)。(仅流程表单中可用)
能查看工作的人都有权限添加。
this.form.addreview()会触发 beforeaddreview、afteraddreview,因此在上述事件中不允许使用本方法。

parameters

  • option object

    添加阅读人的相关参数,如果不带此参数,弹出添加阅读人对话框
    格式如下:

    
    {
    "personlist": "", //{array|string} 要添加哪些阅读人
    "success": function(){}, //成功后的回调方法
    "failure": function(){} //失败后的回调方法
    }
    

examples

//不带参数,弹出添加阅读人对话框
         this.form.addreview();
//带参数,直接调用后台服务发送待阅
         this.form.addreview({
            "personlist": ["张三@zhangsan@p"],
            "success": function(json){
                this.form.notice("add review success", "success");
            }.bind(this),
            "failure": function(xhr, text, error){
                //xhr--httprequest请求对象
                //text--httpresponse内容文本
                //error--错误信息
                this.form.notice("add review failure:" error, "error");
            }.bind(this)
        });

source

static

startim(jobidopt)

创建关联当前工作的聊天群。(仅流程表单中可用)
根据当前工作的关联人员创建聊天群。

parameters

  • jobid string

    当前工作的jobid

example

//带参数,启动创建界面
         this.form.startim("jobid");

source

static

addtask(optionopt)

添加待办人,可用于加签等操作。(仅流程表单中可用)
可以通过this.workcontext.getcontrol().allowaddtask来判断当前用户是否有权限。

parameters

  • option object

    添加待办人的相关参数,如果不提供option参数,则弹出加签对话框。
    格式如下:

    
    {
      "mode" : "single", //加签模式:single,queue,parallel
      "before" : true, //是否是前加签,false后加签.
      "distinguishednamelist": [], //加签人的身份数组。
      "routename" : "", //增加待办在流程记录中显示的路由.
      "opinion" : "", //加签意见
      "success": function(){}, //执行成功后的回调方法
      "failure": function(){} //执行失败后的回调方法
    }
             

examples

//不带参数,则弹出加签对话框
this.form.addtask();
//带参数,根据参数执行添加待办操作
this.form.addtask({
  "mode" : "single",
  "before": false,
  "distinguishednamelist": ["张三@xxxx@i", "李四@xxxx@i"],
  "routename" : "添加审阅人",
  "opinion" : "请张三、李四审阅",
  "success": function(json){
      this.form.notice("addtask success", "success");
  }.bind(this),
  "failure": function(xhr, text, error){
      //xhr--httprequest请求对象
      //text--httpresponse内容文本
      //error--错误信息
      this.form.notice("addtask failure: " error, "error");
  }.bind(this)
});

source

static

confirm(type, title, text, width, height, ok, cancel)

弹出一个确认框,带确认和关闭按钮

parameters

  • type string

    要显示的信息类型。可选值:success 成功,info :信息,error :错误, wran : 警告

  • title string

    确认框标题栏显示文本。

  • text string | object

    确认框的内容显示文本。值为html的时候见下面的样例“使用html传入内容”。

  • width number

    确认框的宽度。

  • height string

    确认框的高度。

  • ok function

    点击“确定”按钮后的回调函数。

  • cancel function

    点击“取消”按钮后的回调函数。

examples

this.form.confirm("wran", "删除确认", "您确定要删除吗?", 300, 100,function(){
  //执行删除代码
  this.close();
}, function(){
  this.close();
});
//使用html传入内容, v8.1开始支持
this.form.confirm("wran", "删除确认", {
    html: "您确定要删除吗!
" }, 300, 100,function(){ //执行删除代码 this.close(); }, function(){ this.close(); });

source

static

alert(type, title, text, width, height)

弹出一个带关闭按钮的信息框

parameters

  • type string

    要显示的信息类型。可选值:success 成功,info :信息,error :错误, wran : 警告

  • title string

    信息框标题栏显示文本。

  • text string | object

    信息框的内容显示文本。值为html的时候见下面的样例“使用html传入内容”。

  • width number

    信息框宽度。

  • height string

    信息框的高度。

examples

this.form.alert("wran", "必填提醒", "请填写标题!", 300, 100);
//使用html传入内容
this.form.alert("wran", "必填提醒", {
    html: "请填写标题!
" }, 300, 100);

source

static

notice(content, typeopt, targetopt, whereopt, offsetopt, optionopt)

弹出一个提示框

parameters

  • content string

    要显示的信息文本

  • type string

    要显示的信息类型。可选值:success 成功,info :信息,error :错误, warn : 警告

  • target element

    信息框显示位置的参考dom对象。

  • where object

    信息框显示相对于target的x轴和y轴位置。
    如: {"x": "center", "y": "center"}
    x :
     水平位置,可用“left”、“right”和“center”;可以用数组定义外部(outside)位置和内部(inside)位置,如:['right', 'inside']
    y :
     垂直位置,可用“top”、“bottom”和“center”;可以用数组定义外部(outside)位置和内部(inside)位置,如:['top', 'outside']。

  • offset object

    相对位置的偏移量,允许负值。如:{"x": 10, "y": -10}

  • option object

    其他选项。如: { delayclose: 5000 } 在5秒后关闭

example

this.form.notice("this is my information", "info");

source

static

dialog(options) → {object}

弹出一个对话框层。

parameters

  • options object

    弹出框选项:
    如果有buttonlist参数,则ok,cancel参数无效。
    对话框内容的优先级为modulename、content、url、html、text,有前面的参数则后面的参数无效。
    调用弹出框对象后各事件执行先后顺序 onqueryload-->onpostload-->onqueryshow-->onpostshow。
    其他说明如下:

    {
      "style" : "default", //(string)可选,弹出框使用的样式,默认是user,系统内置一些样式,比如:user,blue_flat,o2,flat等,对应样式文件位置:webserver\o2_core\o2\widget\$dialog,用户也可以自己增加自定义样式风格,对应文件及结构参考已有样式风格。
      "title" : "", //(string)可选,弹出框头部标题,在istitle参数为true时有效。
      "width" : 300, //(number)可选,弹出框宽度。 默认值:300
      "height" : 150, //(number)可选,弹出框高度。 默认值:150
      "istitle" : true, //(boolean)可选,弹出框是否有标题栏。默认值:true。
      "ismax" : false, //(boolean)可选,标题栏是否有最大化按钮,相对应有还原按钮,默认值:false。
      "isclose" : false, //(boolean)可选,标题栏是否有关闭按钮。默认值:false。
      "isresize" : true, //(boolean)可选,弹出框大小是否可调整。默认值:true。
      "ismove" : true, //(boolean)可选,弹出框是否可移动。默认值:true。
      "offset" : {"x":-200, "y": -100}, //(object)可选,弹出框相对容器(container)的x轴y轴位置偏移量,空则居中。
      "mask" : true, //(boolean)可选,是否需要遮罩层。默认值:true。
      "duration" : true, //(number)可选,动画显示弹出框效果时间。默认值:200。
      "zindex": 100, //(number)可选,弹出框的z轴优先级,默认为100(日期控件的zindex为300,选人控件为1000,最好不要高于300)。
      "buttonlist" : [
          {
              "type": "ok", //(string) 样式,彩色底的按钮
              "text": "确定", //(string)text:按钮显示名称
              "action": function(){ //(function) 按钮对应的点击事件
                  //do something,this指向本对话框对象
                  this.close();
              }
          },
          {
              "type": "cancel", //(string) 样式,灰色底的按钮
              "text": "取消",
              "action": function(){
                  //do something
                  this.close();
              }
          }
      ], //(array)可选,定义底部按钮,数组列表。无该参数则默认有确定和取消两个按钮,这个时候options可以传入ok或者cancel方法作为回调。如果传入空数组“[]”则底部无按钮。
      "ok": function(){}, //(function) 可选,无options.buttonlist参数的时候,该方法作为“确定”按钮的回调方法,返回true关闭对话框,options.buttonlist不为空则忽略该方法。
      "close": function(){}, //(function) 可选,无options.buttonlist参数的时候,该方法作为“取消”按钮的回调方法,返回true关闭对话框,options.buttonlist不为空则忽略该方法。
      "container" : this.form.getapp().content, //(element/dom)可选,弹出框层dom对象的父dom,位置相对对象。移动端默认插入到body中,pc端默认插入到表单节点所在容器(this.form.getapp().content)。
      "modulename": "div_1", //内容参数,优先级为1,(string)可选,表示表单组件名称,系统会获取该组件的node节点作为对话框内容,关闭对话框节点会插回到原来的位置。
      "content": this.form.get("div1").node, //内容参数,优先级为2,(element/dom)可选,对话框内容,如果节点在document中,关闭对话框节点会插回到原来的位置。
      "url": "http://xxx/xxx.html", //内容参数,优先级为3,(string)可选,该参数所指向的内容作为对话框的内容。
      "html": "
    html内容
    ", //内容参数,优先级为4,(string)可选,对话框的html内容。 "text": "文本内容", //内容参数,优先级为5,(string)可选,对话框的文本内容。 "onqueryclose": function(){}, //(function) 可选,关闭弹出框前事件,this指向对话框对象。 "onpostclose": function(){}, //(function) 可选,关闭弹出框后事件,this指向对话框对象。 "onqueryload": function(){}, //(function) 可选,弹出框载入前事件,this指向对话框对象。 "onpostload": function(){}, //(function) 可选,弹出框载入后事件,this指向对话框对象。 "onqueryshow": function(){}, //(function) 可选,弹出框显示前事件,this指向对话框对象。 "onpostshow": function(){} //(function) 可选,弹出框显示后事件,this指向对话框对象。 }

returns

  • object

    对话框对象。

examples

//打开一个对话框,使用html作为内容
var _self = this;
var dlg = this.form.dialog({
  "title": "填写内容",
  "width": "500",
  "height": "300",
  "html": "
内容:
", "ok": function(){ var value = this.node.getelement("input").value; //this指向对话框对象 if( !value ){ _self.form.notice("请填写内容", "info"); return false; //返回false不关闭对话框 }else{ return true; //返回true关闭对话框 } } });
//打开一个对话框,使用表单中的div_1组件作为内容
var _self = this;
this.form.dialog({
     "title": "填写内容",
    "width": "400",
     "height": "200",
     "modulename": "div_1", //内容为表单上的组件,标识为div_1
     "buttonlist" : [
         {
             "type": "ok", //(string) 样式,彩色底的按钮
             "text": "确定", //(string)text:按钮显示名称
             "action": function(){ //(function) 按钮对应的点击事件
                 //do something,this指向本对话框对象
                 var value = _self.form.get("textfield").getdata(); //获取div_1中的组件textfield的值
                 if( !value ){
                   _self.form.notice("请填写内容","info");
                 }else{
                   this.close();
                 }
             }
         },
         {
             "type": "cancel", //(string) 样式,灰色底的按钮
             "text": "取消",
             "action": function(){
                 //do something
                 this.close();
             }
         }
     ]
});
//打开一个对话框,创建dom节点作为内容
var _self = this;
var content = new element("div");
new element("label", {
   text: "内容:"
}).inject(content);
        new element("input", {
   type: "text"
}).inject(content);
this.form.dialog({
    "title": "填写内容",
    "width": "400",
    "height": "200",
    "zindex": 301, //z轴优先级为301
    "content": content, //new element创建的内容,也可以使用 this.form.get(xx).node 作为内容
    "buttonlist" : [
        {
            "type": "ok", //(string) 样式,彩色底的按钮
            "text": "确定", //(string)text:按钮显示名称
            "action": function(){ //(function) 按钮对应的点击事件
                //do something,this指向本对话框对象
                var value = this.node.getelement("input").get("value"); //获取对话框节点中的input的值
                if( !value ){
                  _self.form.notice("请填写内容","info");
                }else{
                  this.close();
                }
            }
        },
        {
            "type": "cancel", //(string) 样式,灰色底的按钮
            "text": "取消",
            "action": function(){
                //do something
                this.close();
            }
        }
    ],
    "onqueryclose": function(){
          console.log("-onqueryclose-");
    },
    "onpostclose": function(){
          console.log("-onpostclose-");
    },
    "onqueryload":function(){
        console.log("-onqueryload-");
    },
    "onpostload": function(){
       console.log("-onpostload-");
    },
    "onqueryshow": function(){
         console.log("-onqueryshow-");
    },
    "onpostshow": function(){
        console.log("-onpostshow-");
    }.bind(this)
  });

source

static

selectorg(container, options) → {object}

弹出人员组织选择界面,支持身份、个人、组织、群组的单个选择或复合选择。该方法参数适用于 new mwf.o2selector()。

parameters

  • container element

    人员选择界面的所在容器,默认为当前应用的容器。

  • options object

    人员组织选择选项。

    {
     "type": "", //选择类型,和types二选一,可选值为 identity(身份), person(个人), unit(组织), group(群组),
     "types": [], //复合选择,和type二选一,如 ["identity", "person", "unit", "group"]
     "count": 0, //选择数量,0表示不限制
     "title": "", //选择界面的title
     "values": [], //已选择的值
     "groups": [], //选择的群组范围,选择群组时有效。
     "units": [], //选择的组织范围,选择身份和组织时有效
     "resulttype" : "", //可以设置成"person"(个人),那么结果返回个人。选择身份时有效。用在选择人员,但是需要按照组织层级展现的场景。
     "dutys": [], //选择的职务范围,选择身份时有效。
     "categorytype": "", //可使用unit或duty。如果指定了选择的职务范围(dutys不为空),按unit(组织)还是按duty(职务)来展现分类,默认为按unit。该参数在选择身份时有效。
     "nounit" : false, //在选择身份的时候,是否只使用include选项。
     "include" : [], //增加的可选项。选择身份的时候,没有传units表示选中全员,include不生效,可以使用onunit选项表示只使用include选项。
     "exclude" : [], //排除的可选项
     "expandsubenable" : true, //是否允许展开下一层,选择身份和组织时有效
     "selectallenable" : true,  //分类是否允许全选下一层,选择身份和组织时有效
     "level1indent" : 10, //第一级的缩进
     "indent" : 10, //后续的缩进
     "zindex": 1000, //选择界面的zindex,
     "oncomplete" : function( selecteditemlist ){
         //点击确定时执行
         //selecteditemlist为选中的item对象,下面的selecteddatalist为选中的数据
         var selecteddatalist = selecteditemlist.map( function(item){
             return item.data;
         })
     },
     "oncancel" : function(selector) {
         //点击取消时的事件, selector 为选择器, this为选择器
     },
     "onqueryload" : function(selector) {
         //加载选择器前事件, selector 为选择器, this为选择器
     },
     "onload" : function(selector) {
         //加载选择器后事件, selector 为选择器, this为选择器
     },
     "oncancel" : function(selector) {
         //点击取消时的事件, selector 为选择器, this为选择器
     },
     "onqueryloadcategory" : function(category) {
         //加载分类前事件, category 为 分类对象, this为选择器
     },
     "onpostloadcategory" : function(category) {
         //加载分类后事件, category 为 分类对象, this为选择器
     },
     "onselectcategory" : function(category){
         //选择分类, category 为 分类对象, this为选择器
     },
     "onunselectcategory": function(category){
         //取消选择分类, category 为 分类对象, this为选择器
     },
     "onqueryloaditem" : function(item){
         //加载项目前事件, item 为 项目对象, this为选择器
     },
     "onpostloaditem" : function(item){
         //加载项目后事件, item 为 项目对象, this为选择器
     },
     "onselectitem" : function(item){
         //选择项目事件, item 为 项目对象, this为选择器
     },
     "onunselectitem" : function(item){
         //取消选择项目事件, item 为 项目对象, this为选择器
     },
     "onexpand" : function( obj ){
         //展开分类, obj 为分类/项目, this为选择器
     },
     "oncollapse" : function(obj){
          //折叠分类,obj 为分类/项目, this为选择器
      }
    }

returns

  • object

    人员组织选择器对象。

examples

//选择身份
var selector = this.form.selectorg(null, {
  type: "identity",
  oncomplete : function( selecteditemlist ){
     //点击确定时执行
     //selecteditemlist为选中的item对象,下面的selecteddatalist为选中的数据
     var selecteddatalist = selecteditemlist.map( function(item){
         return item.data;
     })
 }
});
//在限定组织内选择身份
var selector = this.form.selectorg(null, {
  type: "identity",
  units: ["兰德纵横@landzone@u"],
  oncomplete : function( selecteditemlist ){
 }
});
//在限定职务时选择身份
var selector = this.form.selectorg(null, {
  type: "identity",
  dutys: ["部门正职"],
  oncomplete : function( selecteditemlist ){
 }
});
//同时选择组织、群组、身份、个人
var selector = this.form.selectorg(null, {
  types: ["unit", "group", "identity", "person"],
  oncomplete : function( selecteditemlist ){
 }
});

source

static

addevent(type, event)

给表单添加事件。

parameters

  • type string

    事件名称,参考本api classer->formcomponents->form的事件

  • event function

    事件方法。

example

this.form.addevent("afterload", function(){
            this.form.notice("表单载入完成", "success");
        }.bind(this));

source

static

print(applicationopt, formopt)

用一个新的浏览器窗口来打开当前文档,用于打印。(仅流程表单中可用)
如不指定表单,则使用表单设计中指定的打印表单。

parameters

  • application string

    指定表单所在的流程应用id或名称。省略此参数表示当前应用。

  • form string

    指定表单id或名称。

examples

//在新窗口中使用当前表单中配置的打印表单打开当前文档
         this.form.print();
//在新窗口中使用“订单打印表单”表单打开当前文档
         this.form.print("订单打印表单");
//在新窗口中使用“订单管理”应用中的“订单打印表单”表单打开当前文档
         this.form.print("订单管理", "订单打印表单");

source

static

openwindow(applicationopt, formopt)

同print方法。(仅流程表单中可用)

parameters

  • application string

    指定表单所在的流程应用id或名称。省略此参数表示当前应用。

  • form string

    指定表单id或名称。

see

  • this.form.print()

example

this.form.openwindow();

source

static

openwork(workidopt, workcompletedidopt, titleopt, optionsopt)

打开一个在流转或已完成的流程实例。

parameters

  • workid string

    在流转的流程实例id。workid和workcompletedid两个参数必须提供其中一个

  • workcompletedid string

    已完成的流程实例id。

  • title string

    手机端打开时的窗口标题。

  • options object

    其他选项,如只读参数。

examples

this.form.openwork(id, "", "work title");
//以只读方式打开
this.form.openwork(id, "", "work title", {
  readonly : true
});

source

static

openjob(id, choiceopt, optionsopt, callbackopt)

使用流程的jobid打开工作。

parameters

  • id string

    流程的jobid,如果流程拆分后,有多个流程实例(workid会有多个),但jobid是唯一的。

  • choice boolean

    如果有多个流程实例,是否弹出界面选择。如果传入false,则直接打开第一个工作。

  • options object

    打开工作时传入的选项。

  • callback function

    打开工作成功或失败的回调方法,如果打开成功,该方法可以获取打开的工作的对象(桌面模式)或窗口句柄(浏览器页签模式);如果打开失败,此方法第一个参数是一个error,其cause属性可获取通过jobid查询到的work数据。

examples

this.form.openjob(jobid, true);
this.form.openjob(jobid, true, {}, function(handel){
            //通过error.prototype.isprototypeof(handel)来判断handel是否是一个错误。
            //如果打开成功,handel为打开的工作的对象(桌面模式)或窗口句柄(浏览器页签模式)
            //如果打开错误,handel为为一个error对象,其cause属性可获取通过jobid查询到的work数据
         });

source

static

opendocument(id, titleopt, optionsopt)

打开一个内容管理文档。

parameters

  • id string

    内容管理文档实例的id。

  • title boolean

    手机app端打开时的窗口标题。

  • options object

    其他参数,内容如下

    {
      "readonly": true, //是否以只读方式打开,默认为true
      "forceformid": "xxxxxx", //不管编辑还是阅读都用此表单id打开,优先使用。6.0版本之前使用 printformid。
      "readformid": "xxxxxx", //强制的阅读表单id,优先于表单的readformid。6.0版本之前使用 formid。
      "editformid": "xxxxxx", //强制的编辑表单id,优先于表单的formid。6.0版本之前使用 formeditid。
       "saveonclose" : true, //关闭草稿的时候是否自动保存
       "onpostpublish" : function( documentdata ){ //发布前执行方法,但数据已经准备好,该事件在桌面模式打开有效
          //documentdata 为文档数据
       },
       "onafterpublish" : function( form, documentdata ){ //发布后执行的方法,该事件在桌面模式打开有效
          //form为内容管理form对象,documentdata 为文档数据
       },
       "onaftersave": function( form, documentdata ){ //保存后执行的方法,该事件在桌面模式打开有效
          //form为内容管理form对象,documentdata 为文档数据
       },
       "onbeforeclose": function(){ //关闭前执行的方法,该事件在桌面模式打开有效
       },
       "onpostdelete" : function(){ //删除文档后执行的方法,该事件在桌面模式打开有效
       }
    }

example

this.form.opendocument(id, "document title");

source

static

openportal(portal, pageopt, paropt)

打开一个门户页面。

parameters

  • portal string

    要打开的门户应用名称、别名或id。

  • page string

    要打开的页面名称、别名或id。如果忽略,则打开门户的默认游戏厅捕鱼达人首页

  • par object

    打开页面可以传入参数。
    在被打开的页面中,可以通过脚本this.page.parameters访问到此参数。

example

this.form.openportal(id, "", {"type": "my type"});

source

static

opencms(name)

打开一个内容管理栏目(应用)。

parameters

  • name string

    内容管理栏目的名称、别名或id。

example

this.form.opencms("游戏厅捕鱼达人的公告");

source

static

openapplication(name, optionsopt, statusopt)

打开任意一个component应用。

parameters

  • name string

    要打开的component的名称。component对应的名称可以在“控制面板-系统设置-界面设置-模块部署”中找到(即“组件路径”)。

  • options object

    打开的component的相关参数,对应该应用源码main.js中的的options。

  • status object

    打开的component的状态,对应用户的操作后的状态。请按照下面的方式获取该参数:双击桌面模式的应用,在打开应用的浏览器地址上可以查到对应的status。

examples

//打开会议管理
         this.form.openapplication("meeting");
//打开会议管理的周视图
         this.form.openapplication("meeting", null, {"action":"toweek" });
//打开一个流转中的流程实例。与 this.form.openwork(id, "", "work title");效果相同
         this.form.openapplication("process.work", {
            "workid": id,   //流程实例id
            "width": "1200",    //宽度
            "height": "800",    //高度
            "doctitle": "work title",   //app端窗口标题
            "appid": "process.work" id  //给新打开的component实例一个唯一名称
        });

source

static

createdocument(columnoroptionsopt, categoryopt, dataopt, identity | arrayopt, callbackopt, targetopt, latestopt, selectcolumnenableopt, ignoretitleopt, restricttocolumnopt)

创建一条内容管理文档。

parameters

  • columnoroptions string | object

    如果不传参数,则弹出范围为平台所有栏目的选择界面。
    当使用string时为内容管理应用(栏目)的名称、别名或id。
    当使用object时,本参数后面的参数省略,传入如下格式的内容:

    {
      "column" : column, //(string)可选,内容管理应用(栏目)的名称、别名或id
      "category" : category, //(string)可选,要创建的文档所属的分类的名称、别名或id
      "data" : data, //(json object)可选,创建文档时默认的业务数据
      "identity" : identity, //(string | array)可选,创建文档所使用的身份。如果此参数为空,且当前人有多个身份的情况下,会弹出身份选择对话框;如果此参数为数组,则弹出数组范围内的身份供选择;否则使用默认身份。
      "callback" : callback, //(funcation)可选,文档创建后的回调函数。
      "target" : target, //(boolean)可选,为true时,在当前页面打开创建的文档;否则打开新窗口。默认false。(当前表单或页面在浏览器单独打开的时候该参数有效。)
      "latest" : latest, //(boolean)可选,为true时,如果当前用户已经创建了此分类的文档,并且没有发布过,直接调用此文档为新文档;否则创建一个新文档。默认true。
      "selectcolumnenable" : selectcolumnenable, //(boolean)可选,是否可以选择应用和分类进行创建文档。有category参数时为默认false,否则默认为true。
      "ignoretitle" : ignoretitle //(boolean)可选,值为false时,创建的时候需要强制填写标题,默认为false。
      "restricttocolumn" : restricttocolumn //(boolean)可选,值为true时,会限制在传入的栏目中选择分类,默认为false。
    }
  • category string

    要创建的文档所属的分类的名称、别名或id

  • data object

    创建文档时默认的业务数据

  • identity | array string

    可选,创建文档所使用的身份。如果此参数为空,且当前人有多个身份的情况下,会弹出身份选择对话框;如果此参数为数组,则弹出数组范围内的身份供选择;否则使用默认身份。

  • callback function

    文档创建后的回调函数

  • target boolean

    为true时,在当前页面打开创建的文档;否则打开新窗口。默认false。(当前表单或页面在浏览器单独打开的时候该参数有效。)

  • latest boolean

    为true时,如果当前用户已经创建了此分类的文档,并且没有发布过,直接调用此文档为新文档;否则创建一个新文档。默认true。

  • selectcolumnenable boolean

    是否可以选择应用和分类进行创建文档。有category参数时为默认false,否则默认为true。

  • ignoretitle boolean

    值为false时,创建的时候需要强制填写标题,默认为false。

  • restricttocolumn boolean

    值为true时,会限制在传入的栏目中选择分类,默认为false。

examples

//启动一个游戏厅捕鱼达人的公告
         this.form.createdocument("", "游戏厅捕鱼达人的公告");
//启动一个游戏厅捕鱼达人的公告,标题为:关于xx的通知,启动后提示
         this.form.createdocument("", "游戏厅捕鱼达人的公告", {"subject": "关于xx的通知"}, function(json){
            this.form.notice("创建成功!", "success");
        }.bind(this));
//启动一个游戏厅捕鱼达人的公告,标题为:关于xx的通知,启动后提示
         this.form.createdocument({
            category : "游戏厅捕鱼达人的公告",
            data : {"subject": "关于xx的通知"},
            callback : function(json){
                this.form.notice("创建成功!", "success");
            }.bind(this)
         });

source

static

startprocess(app, process, dataopt, identityopt, callbackopt, targetopt, latestopt, aftercreatedopt, skipdraftcheckopt)

启动一个流程实例。

parameters

  • app string

    流程应用的名称、别名或id。

  • process string

    要启动的流程的名称、别名或id。

  • data object

    流程启动时默认的业务数据。

  • identity string | array

    流程启动所使用的身份。如果此参数为空/空字符串,且当前人有多个身份的情况下,会弹出身份选择对话框;如果此参数为数组,则弹出数组范围内的身份供选择;否则使用默认身份。

  • callback function

    流程启动后的回调函数,可以获取到启动的数据。

  • target boolean

    为true时,在当前页面打开启动的流程实例;否则打开新窗口。默认false。(当前表单或页面在浏览器单独打开的时候该参数有效。)

  • latest boolean

    为true时,如果当前用户已经创建了此流程的实例,并且没有流转过,直接调用此实例为新流程实例;否则创建一个新实例。默认false。

  • aftercreated function

    流程创建后的回调,可以获取到创建的流程work对象(桌面模式)或者window对象(浏览器模式)。

  • skipdraftcheck boolean

    是否跳过新建检查(默认根据流程的新建检查配置),设置true则不进行新建检查。

examples

//启动一个发文管理实例
         this.form.startprocess("公文管理", "发文管理");
//启动一个发文管理实例,标题为:my file title,启动后提示
         this.form.startprocess("公文管理", "发文管理", {"title": "my file title"}, "张三@kfb_zhangsan@i", function(json){
            this.form.notice("create file success!", "success");
        }, false, false, function(workapp){
              if( layout.inbrowser ){ //浏览器模式
                //workapp 为流程的window对象
              }else{
                //workapp 为流程work app对象
              }
        });

source

网站地图