usable range
process
example
//可以在脚本中获取该组件
//方法1:
var documenteditor = this.form.get("fieldid"); //获取组件
//方法2
var documenteditor = this.target; //在组件事件脚本中获取
source
members
layout_copiesmwf.xapplication.process.xform.documenteditor
份数的dom对象.
type
source
layout_secretmwf.xapplication.process.xform.documenteditor
密级的dom对象.
type
source
layout_prioritymwf.xapplication.process.xform.documenteditor
紧急度的dom对象.
type
source
layout_redheadermwf.xapplication.process.xform.documenteditor
红头的dom对象.
type
source
layout_filenomwf.xapplication.process.xform.documenteditor
文号的dom对象.
type
source
layout_signermwf.xapplication.process.xform.documenteditor
签发人的dom对象.
type
source
layout_subjectmwf.xapplication.process.xform.documenteditor
标题的dom对象.
type
source
layout_mainsendmwf.xapplication.process.xform.documenteditor
主送的dom对象.
type
source
layout_filetextmwf.xapplication.process.xform.documenteditor
正文区域的dom对象.
type
source
layout_attachmentmwf.xapplication.process.xform.documenteditor
附件区域的dom对象.
type
source
layout_issuanceunitmwf.xapplication.process.xform.documenteditor
发文单位的dom对象.
type
source
layout_issuancedatemwf.xapplication.process.xform.documenteditor
发文时间的dom对象.
type
source
layout_annotationmwf.xapplication.process.xform.documenteditor
附注的dom对象.
type
source
layout_copytocontentmwf.xapplication.process.xform.documenteditor
抄送的dom对象.
type
source
layout_edition_issuance_unitmwf.xapplication.process.xform.documenteditor
印发单位的dom对象.
type
source
layout_edition_issuance_datemwf.xapplication.process.xform.documenteditor
印发时间的dom对象.
type
source
layout_sealsmwf.xapplication.process.xform.documenteditor
模拟盖章的dom对象.
type
source
nodeelement
组件的节点,mootools封装过的dom对象,可以直接使用原生的js和moootools方法访问和操作该对象。
type
-
element
example
//可以在脚本中获取该组件
var field = this.form.get("fieldid"); //获取组件对象
field.node.setstyle("font-size","12px"); //给节点设置样式
source
jsonjsonobject
组件的配置信息,比如id,类型,是否只读等等。可以在组件的queryload事件里修改该配置来对组件做一些改变。
type
-
jsonobject
example
//可以在脚本中获取该组件
var json = this.form.get("fieldid").json; //获取组件对象
var id = json.id; //获取组件的id
var type = json.type; //获取组件的类型,如textfield 为文本输入组件,select为下拉组件
//在组件queryload事件里设置组件只读。
//当前组件的queryload事件运行时还没有在form里注册,通过this.form.get("fieldid")不能获取到当前组件,需要用this.target获取。
var json = this.target.json;
json.isreadonly = true; //设置组件为只读。
source
formmwf.xapplication.process.xform.form
组件的所在表单对象.
type
example
var form = this.form.get("fieldid").form; //获取组件所在表单对象
var container = form.container; //获取表单容器
source
parentlinemwf.xapplication.process.xform.datatemplate.line|mwf.xapplication.process.xform.datatablepc.line|mwf.xapplication.process.xform.datatablemobile.line
当前组件在数据表格或者数据模板中时,可以通过此属性获取所在行(条目)对象.
type
-
mwf.xapplication.process.xform.datatemplate.line
|mwf.xapplication.process.xform.datatablepc.line
|mwf.xapplication.process.xform.datatablemobile.line
inherited from
example
//获取当前组件所在数据模板/数据表格的行(条目)对象
var line = this.target.parentline;
//获取当前字段所在行下标
var index = line.getindex();
//获取当前字段所在条目的subject字段的值
var data = line.getmodule("subject").getdata();
//设置当前字段所在条目的subject字段的值
line.getmodule("subject").setdata("test1");
source
methods
active()
激活公文编辑器编辑。设置了延迟加载的时候,可以通过这个方法来激活
example
this.form.get("fieldid").active();
source
seal(position)
summary
对正文进行模拟盖章,此方法只是进行模拟盖章,通过图片显示,并非专业盖章,不具备法律效应。
- @param src{string} 盖章图片的url.
description
对正文进行模拟盖章(模板中必须有class为“doc_layout_seal”的img对象)
parameters
-
position
integer
要盖章的位置, 默认为0.
example
this.form.get("documenteditor").seal("../custom/img/seal.png", 0); //在第一个盖章位置进行模拟盖章
source
scaleto(scale)
缩放文件内容
parameters
-
scale
number
缩放的比率
example
this.form.get("fieldid").scaleto(0.5);
source
reload()
重新计算公文编辑器的所有字段,当字段是脚本时可以使用该方法立即更新
example
this.form.get("fieldid").reload();
source
isempty() → {boolean}
summary
判断公文编辑器的正文内容是否已经填写
returns
-
boolean
是否为空
example
if( this.form.get("fieldid").isempty() ){
this.form.notice('请填写正文内容')
}
source
getdata() → {object}
summary
获取公文编辑器数据
returns
-
object
公文编辑器的数据
example
var data = this.form.get("fieldid").getdata();
source
setdata(data)
设置公文编辑器数据
parameters
-
data
object
example
var data = this.form.get("fieldid").getdata();
data.filetext = "测试内容";
this.form.get("fieldid").setdata(data);
source
getdocumenthtml() → {string}
将公文编辑器内容以html形式输出
returns
-
string
example
var html = this.form.get("fieldid").getdocumenthtml();
source
toword(callbackopt, nameopt)
summary
将公文编辑器转换成附件,转换的文件名和格式等信息与配置有关
parameters
-
callback
function
转换后的回调方法,参数是附件数据.
-
name
string
如果为空或者不传,转换的文件名和格式等信息与配置有关.
example
this.form.get("fieldid").toword( function(attachmentdata){
//attachmentdata 转换后的附件数据
})
source
validate(routenameopt) → {boolean}
summary
根据组件的校验设置进行校验。
parameters
-
routename
string
可选,路由名称.
inherited from
returns
-
boolean
是否通过校验
example
if( !this.form.get('fieldid').validate() ){
return false;
}
source
getsource(typeopt) → {source|subsource|subsourceitem}
当前组件在数据源组件中时,可以通过此方法获取所在的上级数据源/子数据源/子数项组件.
parameters
-
type
string
需要获取的类型,"source"为表示数据源,"subsource"表示子数据源,"subsourceitem"表示子数据项组件。 如果该参数省略,则获取离当前组件最近的上述组件。
inherited from
returns
-
source
subsource
subsourceitem
。
example
var source = this.target.getsource(); //获取当前组件的所在子上级数据源/子数据源/子数项组件.
var data = source.data; //获取数据
var source = this.form.get("fieldid").getsource("source"); //获取数据源组件
var data = source.data; //获取数据
source
getparentmodule(typeopt, validatefunctionopt) → {mwf.xapplication.process.xform.$module}
获取当前组件所在的祖先组件.
parameters
-
type
string
需要获取的组件类型。 如果该参数省略,则获取离当前组件最近的祖先组件。type有效值如下:
form- 表单common- 通用组件datatable- 数据表格datatableline- 数据表格行datatemplate- 数据模板datatemplateline- 数据模板行div- 容器组件elcommon- element通用组件elcontainer- element容器组件subform- 子表单source- 数据源组件subsource- 子数据源subsourceitem- 子数据项组件tab- 分页组件tabpage- 分页组件的某个分页table- 表格tabletd- 单元格widget- 部件 -
validatefunction
function
进一步校验,参数为获取到匹配到类型的组件,返回false继续往上取对应类型的组件,返回true返回该组件。
inherited from
returns
example
var module = this.target.getparentmodule(); //获取最近的祖先。
var datatemplateline = this.target.getparentmodule("datatemplateline"); //获取当前组件所在的数据模板行.
var module = this.target.getparentmodule(null, function(module){
return module.json.id === "div_1";
}); //获取当前组件id为div_1的父组件。
source
hide()
summary
隐藏组件.
inherited from
example
this.form.get("fieldid").hide(); //隐藏组件
source
show()
summary
显示组件.
inherited from
example
this.form.get("fieldid").show(); //显示组件
source
events
loadpage
当公文编辑器内容每次被渲染的时候都会触发。
see
queryload
组件加载前触发。queryload执行的时候,当前组件没有在form里注册,通过this.form.get("fieldid")不能获取到当前组件,需要用this.target获取。
postload
组件加载后触发.
load
组件加载后触发.