提交 060e2888 编写于 作者: 蔡祥熠

Merge branch 'feature/JSDoc' into 'wrdp'

Merge of feature/JSDoc to wrdp

See merge request o2oa/o2oa!2602
......@@ -10,25 +10,19 @@ MWF.xApplication.process.Xform.$Module = MWF.APP$Module = new Class(
Implements: [Events],
options: {
/**
* 组件加载前事件。<br/>
* 平台执行queryLoad事件的时候,组件还没有开始加载,这个时候可以根据条件修改组件的配置信息以改变加载细节。
* 组件加载前触发。
* @event MWF.xApplication.process.Xform.$Module#queryLoad
* {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|事件的使用}
* @example
* var field = this.form.get("fieldName");
* field.addEvent("queryLoad", function(){
*
* };
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* 组件加载事件.
* 组件加载时触发.
* @event MWF.xApplication.process.Xform.$Module#load
* {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|事件的使用}
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* 组件加载后事件.
* 组件加载后触发.
* @event MWF.xApplication.process.Xform.$Module#postLoad
* {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|事件的使用}
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"moduleEvents": ["load", "queryLoad", "postLoad"]
},
......
......@@ -18,6 +18,26 @@ MWF.xApplication.process.Xform.Actionbar = MWF.APPActionbar = new Class(
{
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"]
},
/**
......
......@@ -1084,6 +1084,49 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class(
{
Extends: MWF.APP$Module,
options: {
/**
* @event MWF.xApplication.process.Xform.Attachment#queryLoad
* @ignore
*/
/**
* @event MWF.xApplication.process.Xform.Attachment#postLoad
* @ignore
*/
/**
* 附件上传后触发。本事件中可以通过this.event获取上传附件的数据
* @event MWF.xApplication.process.Xform.Attachment#upload
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* 删除附件前触发。本事件中可以通过this.event获取被删附件的数据
* @event MWF.xApplication.process.Xform.Attachment#delete
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* 删除附件后触发。本事件中可以通过this.event获取被删附件的数据
* @event MWF.xApplication.process.Xform.Attachment#afterDelete
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* 附件容器加载时触发。
* @event MWF.xApplication.process.Xform.Attachment#load
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* 附件有变化的时候会被触发,包括上传、删除、排序
* @event MWF.xApplication.process.Xform.Attachment#change
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* 下载附件后触发。本事件中可以通过this.event获取被下载附件对象
* @event MWF.xApplication.process.Xform.Attachment#download
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* 打开附件后触发。本事件中可以通过this.event获取被打开附件对象
* @event MWF.xApplication.process.Xform.Attachment#open
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"moduleEvents": ["upload", "delete", "afterDelete", "load", "change","download","open"]
},
......
......@@ -17,6 +17,31 @@ MWF.xApplication.process.Xform.Calendar = MWF.APPCalendar = new Class(
Extends: MWF.APP$Input,
iconStyle: "calendarIcon",
options: {
/**
* 日期选择完成时触发.
* @event MWF.xApplication.process.Xform.Calendar#complete
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* 日期选择器上点清空时触发.
* @event MWF.xApplication.process.Xform.Calendar#clear
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* 值改变时触发.
* @event MWF.xApplication.process.Xform.Calendar#change
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* 显示日期选择器时触发.
* @event MWF.xApplication.process.Xform.Calendar#show
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* 隐藏日期选择器时触发.
* @event MWF.xApplication.process.Xform.Calendar#hide
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"moduleEvents": ["queryLoad","postLoad","load","complete", "clear", "change","show","hide"]
},
_loadNode: function(){
......
......@@ -17,6 +17,16 @@ MWF.xApplication.process.Xform.Combox = MWF.APPCombox = new Class(
Extends: MWF.APP$Input,
iconStyle: "selectIcon",
options: {
/**
* 手工输入完成后触发。
* @event MWF.xApplication.process.Xform.Combox#commitInput
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* 值改变时触发。
* @event MWF.xApplication.process.Xform.Combox#change
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"moduleEvents": ["load", "queryLoad", "postLoad", "commitInput", "change"]
},
......
......@@ -17,6 +17,31 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class(
Extends: MWF.APP$Module,
isEdit: false,
options: {
/**
* 当前条目编辑完成时触发。通过this.event可以获取对应的table。
* @event MWF.xApplication.process.Xform.DatagridMobile#completeLineEdit
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* 添加条目时触发。通过this.event可以获取对应的table。
* @event MWF.xApplication.process.Xform.DatagridMobile#addLine
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* 删除条目前触发。通过this.event可以获取对应的table。
* @event MWF.xApplication.process.Xform.DatagridMobile#deleteLine
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* 删除条目后触发。
* @event MWF.xApplication.process.Xform.DatagridMobile#afterDeleteLine
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* 编辑条目时触发。
* @event MWF.xApplication.process.Xform.DatagridMobile#editLine
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"moduleEvents": ["queryLoad","postLoad","load","completeLineEdit", "addLine", "deleteLine", "afterDeleteLine","editLine"]
},
......
......@@ -84,6 +84,31 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
Extends: MWF.APP$Module,
isEdit: false,
options: {
/**
* 当前条目编辑完成时触发。通过this.event可以获取对应的tr。
* @event MWF.xApplication.process.Xform.DatagridPC#completeLineEdit
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* 添加条目时触发。通过this.event可以获取对应的tr。
* @event MWF.xApplication.process.Xform.DatagridPC#addLine
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* 删除条目前触发。通过this.event可以获取对应的tr。
* @event MWF.xApplication.process.Xform.DatagridPC#deleteLine
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* 删除条目后触发。
* @event MWF.xApplication.process.Xform.DatagridPC#afterDeleteLine
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* 编辑条目时触发。
* @event MWF.xApplication.process.Xform.DatagridPC#editLine
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"moduleEvents": ["queryLoad","postLoad","load","completeLineEdit", "addLine", "deleteLine", "afterDeleteLine","editLine"]
},
......
......@@ -15,6 +15,11 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla
{
Extends: MWF.APP$Module,
options: {
/**
* 当公文编辑器内容每次被渲染的时候都会触发。
* @event MWF.xApplication.process.Xform.Documenteditor#loadPage
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"moduleEvents": ["load", "queryLoad", "beforeLoad", "postLoad", "afterLoad", "loadPage"],
"docPageHeight": 850.4,
"docPageFullWidth": 794,
......
......@@ -25,28 +25,139 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class(
"cssPath": "",
"macro": "FormContext",
"parameters": null,
"moduleEvents": ["queryLoad",
"moduleEvents": [
/**
* 表单加载前触发。数据(businessData)、预加载脚本和表单html已经就位。
* @event MWF.xApplication.process.Xform.Form#queryLoad
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"queryLoad",
/**
* 表单加载前触发。已提示抢办锁定。
* @event MWF.xApplication.process.Xform.Form#beforeLoad
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"beforeLoad",
/**
* 表单的所有组件加载前触发,此时表单的样式和js head已经加载。
* @event MWF.xApplication.process.Xform.Form#beforeModulesLoad
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"beforeModulesLoad",
/**
* 表单加载后触发。主表单的组件加载完成,但不保证子表单、子页面、部件加载完成。
* @event MWF.xApplication.process.Xform.Form#postLoad
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"postLoad",
/**
* 表单的所有组件后触发。表单包含有子表单、子页面、部件时,此事件会在这些组件加载后触发。
* @event MWF.xApplication.process.Xform.Form#afterModulesLoad
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"afterModulesLoad",
/**
* 表单加载后触发。表单包含有子表单、子页面、部件时,此事件会在这些组件加载后触发。
* @event MWF.xApplication.process.Xform.Form#afterLoad
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"afterLoad",
/**
* 保存前触发。流转前也会触发本事件。
* @event MWF.xApplication.process.Xform.Form#beforeSave
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"beforeSave",
/**
* 保存后触发。流转后也会触发本事件。
* @event MWF.xApplication.process.Xform.Form#afterSave
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"afterSave",
/**
* 关闭前触发。
* @event MWF.xApplication.process.Xform.Form#beforeClose
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"beforeClose",
"beforeProcess",
/**
* 弹出提交界面前触发。
* @event MWF.xApplication.process.Xform.Form#beforeProcessWork
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"beforeProcessWork",
/**
* 流转前触发。
* @event MWF.xApplication.process.Xform.Form#beforeProcess
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"beforeProcess",
/**
* 流转后触发。
* @event MWF.xApplication.process.Xform.Form#afterProcess
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"afterProcess",
/**
* 重置处理人前触发。
* @event MWF.xApplication.process.Xform.Form#beforeReset
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"beforeReset",
/**
* 重置处理人后触发。
* @event MWF.xApplication.process.Xform.Form#afterReset
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"afterReset",
/**
* 撤回前触发。
* @event MWF.xApplication.process.Xform.Form#beforeRetract
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"beforeRetract",
/**
* 撤回后触发。
* @event MWF.xApplication.process.Xform.Form#afterRetract
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"afterRetract",
/**
* 调度前触发。
* @event MWF.xApplication.process.Xform.Form#beforeReroute
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"beforeReroute",
/**
* 调度后触发。
* @event MWF.xApplication.process.Xform.Form#afterReroute
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"afterReroute",
/**
* 删除工作前触发。
* @event MWF.xApplication.process.Xform.Form#beforeDelete
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"beforeDelete",
/**
* 删除工作后触发。
* @event MWF.xApplication.process.Xform.Form#afterDelete
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"afterDelete",
"beforeModulesLoad",
"resize",
"afterModulesLoad",
/**
* 已阅前触发。
* @event MWF.xApplication.process.Xform.Form#beforeReaded
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"beforeReaded",
/**
* 已阅后触发。
* @event MWF.xApplication.process.Xform.Form#afterReaded
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"afterReaded"]
},
initialize: function (node, data, options) {
......
MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
MWF.xApplication.process.Xform.Htmleditor = MWF.APPHtmleditor = new Class({
/** @class Htmleditor HTML编辑器。
* @example
* //可以在脚本中获取该组件
* //方法1:
* var attachment = this.form.get("name"); //获取组件
* //方法2
* var attachment = this.target; //在组件事件脚本中获取
* @extends MWF.xApplication.process.Xform.$Module
* @category FormComponents
* @hideconstructor
*/
MWF.xApplication.process.Xform.Htmleditor = MWF.APPHtmleditor = new Class(
/** @lends MWF.xApplication.process.Xform.Htmleditor# */
{
Extends: MWF.APP$Module,
options: {
"moduleEvents": ["load", "postLoad", "afterLoad"]
......@@ -376,16 +389,58 @@ MWF.xApplication.process.Xform.Htmleditor = MWF.APPHtmleditor = new Class({
_loadValue: function(){
var data = this._getBusinessData();
},
/**
* @summary 重置组件的值为默认值或置空。
* @example
* this.form.get('fieldName').resetData();
*/
resetData: function(){
this.setData(this._getBusinessData());
},
/**
* @summary 判断组件值是否为空.
* @example
* if( this.form.get('fieldName').isEmpty() ){
* this.form.notice('HTML编辑器不能为空', 'warn');
* }
* @return {Boolean} 值是否为空.
*/
isEmpty : function(){
return !this.getData().trim();
},
/**
* 当表单上没有对应组件的时候,可以使用this.data[fieldName]获取值,但是this.form.get('fieldName')无法获取到组件。
* @summary 获取组件值。
* @example
* var data = this.form.get('fieldName').getData();
* @example
* //如果无法确定表单上是否有组件,需要判断
* var data;
* if( this.form.get('fieldName') ){ //判断表单是否有无对应组件
* data = this.form.get('fieldName').getData();
* }else{
* data = this.data['fieldName']; //直接从数据中获取字段值
* }
* @return 组件的数据.
*/
getData: function(){
this.clearEcnetNodes();
return this.editor ? this.editor.getData() : "";
},
/**
* 当表单上没有对应组件的时候,可以使用this.data[fieldName] = data赋值。
* @summary 为组件赋值。
* @param data{String} .
* @example
* this.form.get("fieldName").setData("test"); //赋文本值
* @example
* //如果无法确定表单上是否有组件,需要判断
* if( this.form.get('fieldName') ){ //判断表单是否有无对应组件
* this.form.get('fieldName').setData( data );
* }else{
* this.data['fieldName'] = data;
* }
*/
setData: function(data){
this._setBusinessData(data);
if (this.editor) this.editor.setData(data);
......@@ -519,7 +574,15 @@ MWF.xApplication.process.Xform.Htmleditor = MWF.APPHtmleditor = new Class({
}
return true;
},
/**
* @summary 根据组件的校验设置进行校验。
* @param {String} [routeName] - 可选,路由名称.
* @example
* if( !this.form.get('fieldName').validation() ){
* return false;
* }
* @return {Boolean} 是否通过校验
*/
validation: function(routeName, opinion){
if (!this.validationConfig(routeName, opinion)) return false;
......
MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
/** @class Iframe HTML iframe。
* @example
* //可以在脚本中获取该组件
* //方法1:
* var attachment = this.form.get("name"); //获取组件
* //方法2
* var attachment = this.target; //在组件事件脚本中获取
* @extends MWF.xApplication.process.Xform.$Module
* @category FormComponents
* @hideconstructor
*/
MWF.xApplication.process.Xform.Iframe = MWF.APPIframe = new Class({
Extends: MWF.APP$Module,
......
MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
MWF.xApplication.process.Xform.Image = MWF.APPImage = new Class({
/** @class Image 图片。
* @example
* //可以在脚本中获取该组件
* //方法1:
* var attachment = this.form.get("name"); //获取组件
* //方法2
* var attachment = this.target; //在组件事件脚本中获取
* @extends MWF.xApplication.process.Xform.$Module
* @category FormComponents
* @hideconstructor
*/
MWF.xApplication.process.Xform.Image = MWF.APPImage = new Class(
{
Extends: MWF.APP$Module,
_loadUserInterface: function(){
if (this.json.properties && this.json.properties["src"]){
......
MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
MWF.xApplication.process.Xform.ImageClipper = MWF.APPImageClipper = new Class({
/** @class ImageClipper 图片编辑组件。
* @example
* //可以在脚本中获取该组件
* //方法1:
* var attachment = this.form.get("name"); //获取组件
* //方法2
* var attachment = this.target; //在组件事件脚本中获取
* @extends MWF.xApplication.process.Xform.$Module
* @category FormComponents
* @hideconstructor
*/
MWF.xApplication.process.Xform.ImageClipper = MWF.APPImageClipper = new Class(
/** @lends MWF.xApplication.process.Xform.ImageClipper# */
{
Implements: [Events],
Extends: MWF.APP$Module,
initialize: function(node, json, form, options){
......@@ -86,9 +99,24 @@ MWF.xApplication.process.Xform.ImageClipper = MWF.APPImageClipper = new Class({
var value = this._getBusinessData() || "";
return {"value": [value], "text": [value]};
},
/**
* @summary 判断组件值是否为空.
* @example
* if( this.form.get('fieldName').isEmpty() ){
* this.form.notice('请上传图片', 'warn');
* }
* @return {Boolean} 值是否为空.
*/
isEmpty : function(){
return !this.getData();
},
/**
* 获取上传的图片ID。
* @summary 获取上传的图片ID。
* @example
* var id = this.form.get('fieldName').getData(); //获取上传的图片id
* var url = MWF.xDesktop.getImageSrc( id ); //获取图片的url
*/
getData: function( data ){
return this._getBusinessData() || "";
},
......@@ -279,6 +307,15 @@ MWF.xApplication.process.Xform.ImageClipper = MWF.APPImageClipper = new Class({
}
return true;
},
/**
* @summary 根据组件的校验设置进行校验。
* @param {String} [routeName] - 可选,路由名称.
* @example
* if( !this.form.get('fieldName').validation() ){
* return false;
* }
* @return {Boolean} 是否通过校验
*/
validation: function(routeName, opinion){
if (!this.validationConfig(routeName, opinion)) return false;
......
MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
MWF.xApplication.process.Xform.Label = MWF.APPLabel = new Class({
/** @class Label 文本组件。
* @example
* //可以在脚本中获取该组件
* //方法1:
* var attachment = this.form.get("name"); //获取组件
* //方法2
* var attachment = this.target; //在组件事件脚本中获取
* @extends MWF.xApplication.process.Xform.$Module
* @category FormComponents
* @hideconstructor
*/
MWF.xApplication.process.Xform.Label = MWF.APPLabel = new Class(
/** @lends MWF.xApplication.process.Xform.Label# */
{
Implements: [Events],
Extends: MWF.APP$Module,
......@@ -55,6 +68,18 @@ MWF.xApplication.process.Xform.Label = MWF.APPLabel = new Class({
//this.node.set("text", value || "");
}
},
/**当参数为Promise的时候,请参考文档: {@link https://www.yuque.com/o2oa/ixsnyt/ws07m0|使用Promise处理表单异步}<br/>
* @summary 为组件设置文本,该文本不会被保存到后台。
* @param text{String|Promise} .
* @example
* this.form.get("fieldName").setText("test"); //赋文本值
* @example
* //使用Promise
* var field = this.form.get("fieldName");
* var dict = new this.Dict("test"); //test为数据字典名称
* var promise = dict.get("tools", true); //异步使用数据字典的get方法时返回Promise,参数true表示异步
* field.setText( promise );
*/
setText: function(text){
if (!!text){
o2.promiseAll(text).then(function(v){
......
MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
MWF.xApplication.process.Xform.Log = MWF.APPLog = new Class({
/** @class Log 流程记录组件。
* @example
* //可以在脚本中获取该组件
* //方法1:
* var attachment = this.form.get("name"); //获取组件
* //方法2
* var attachment = this.target; //在组件事件脚本中获取
* @extends MWF.xApplication.process.Xform.$Module
* @category FormComponents
* @hideconstructor
*/
MWF.xApplication.process.Xform.Log = MWF.APPLog = new Class(
/** @lends MWF.xApplication.process.Xform.Log# */
{
Extends: MWF.APP$Module,
options: {
/**
* 加载数据后事件。
* @event MWF.xApplication.process.Xform.Log#postLoadData
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
* @example
* //触发该事件的时候可以获取到流程数据workLog
* var workLog = this.target.workLog;
* //可以修改workLog达到定制化流程记录的效果
* do something
*/
/**
* 加载每行流程信息以后触发,可以通过this.event获得下列信息:
* <pre><code>
{
"data" : {}, //当前行流程信息
"node" : logTaskNode, //当前节点
"log" : object, //指向流程记录
"type" : "task" //"task"表示待办,"taskCompleted"表示已办
}
</code></pre>
* @event MWF.xApplication.process.Xform.Log#postLoadLine
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"moduleEvents": ["load", "queryLoad", "postLoad", "postLoadData", "postLoadLine"]
},
......
MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
//MWF.xDesktop.requireApp("process.Xform", "widget.Monitor", null, false);
MWF.xApplication.process.Xform.Monitor = MWF.APPMonitor = new Class({
/** @class Monitor 流程图组件。
* @example
* //可以在脚本中获取该组件
* //方法1:
* var attachment = this.form.get("name"); //获取组件
* //方法2
* var attachment = this.target; //在组件事件脚本中获取
* @extends MWF.xApplication.process.Xform.$Module
* @category FormComponents
* @hideconstructor
*/
MWF.xApplication.process.Xform.Monitor = MWF.APPMonitor = new Class(
/** @lends MWF.xApplication.process.Xform.Monitor# */
{
Extends: MWF.APP$Module,
_loadUserInterface: function(){
......@@ -9,6 +22,9 @@ MWF.xApplication.process.Xform.Monitor = MWF.APPMonitor = new Class({
MWF.xDesktop.requireApp("process.Xform", "widget.Monitor", function(){
// debugger;
var process = (this.form.businessData.work) ? this.form.businessData.work.process : this.form.businessData.workCompleted.process;
/**
* @summary 流程图对象,是一个 MWF.xApplication.process.Xform.widget.Monitor 类实例
*/
this.monitor = new MWF.xApplication.process.Xform.widget.Monitor(this.node, this.form.businessData.workLogList, process,{
"onPostLoad" : function(){
this.fireEvent("postLoad");
......
MWF.xDesktop.requireApp("process.Xform", "Textfield", null, false);
/** @class Number 数字输入组件。
* @example
* //可以在脚本中获取该组件
* //方法1:
* var attachment = this.form.get("name"); //获取组件
* //方法2
* var attachment = this.target; //在组件事件脚本中获取
* @extends MWF.xApplication.process.Xform.Textfield
* @category FormComponents
* @hideconstructor
*/
MWF.xApplication.process.Xform.Number = MWF.APPNumber = new Class({
Implements: [Events],
Extends: MWF.APPTextfield,
......
MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
MWF.xApplication.process.Xform.Office = MWF.APPOffice = new Class({
/** @class Office Office控件。
* @example
* //可以在脚本中获取该组件
* //方法1:
* var attachment = this.form.get("name"); //获取组件
* //方法2
* var attachment = this.target; //在组件事件脚本中获取
* @extends MWF.xApplication.process.Xform.$Module
* @category FormComponents
* @hideconstructor
*/
MWF.xApplication.process.Xform.Office = MWF.APPOffice = new Class(
/** @lends MWF.xApplication.process.Xform.Office# */
{
Extends: MWF.APP$Module,
isActive: false,
options:{
......@@ -20,7 +33,62 @@ MWF.xApplication.process.Xform.Office = MWF.APPOffice = new Class({
"pdfCodeBase64": "../o2_lib/officecontrol/5040/ntkooledocall64.cab",
"files": ["doc","docx","dotx","dot","xls","xlsx","xlsm","xlt","xltx","pptx","ppt","pot","potx","potm","pdf"],
/**
* @event MWF.xApplication.process.Xform.Office#queryLoad
* @ignore
*/
/**
* @event MWF.xApplication.process.Xform.Office#postLoad
* @ignore
*/
/**
* 点击套红按钮触发。
* @event MWF.xApplication.process.Xform.Office#redFile
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* 点击盖章按钮触发。
* @event MWF.xApplication.process.Xform.Office#seal
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* Ntko控件执行AfterOpenFromURL事件(BeginOpenFromURL方法执行完毕之后被触发)时执行。</br>
* 本事件可以通过this.event获取当前打开的文档对象。比如,对于一个Word文档,第二个参数是一个Word.Document对象。
* @event MWF.xApplication.process.Xform.Office#afterOpen
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* Ntko控件执行OnDocumentOpened事件(Office文档打开完毕)时触发。<br/>
* 本事件可以通过this.event获取以下内容
* <pre><code>
{
url : url, //Office文档路径或者URL
doc : doc //Office文档的自动化接口,比如,对于一个Word文档,第二个参数是一个Word.Document对象。
}
</pre></code>
* @event MWF.xApplication.process.Xform.Office#afterOpenOffice
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* 在新建Office文档后触发。
* @event MWF.xApplication.process.Xform.Office#afterCreate
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* 在保存Office文档前触发。
* @event MWF.xApplication.process.Xform.Office#beforeSave
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* 在保存Office文档后触发。
* @event MWF.xApplication.process.Xform.Office#afterSave
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* 在关闭Office文档时执行。
* @event MWF.xApplication.process.Xform.Office#afterCloseOffice
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"moduleEvents": ["redFile",
"afterOpen",
"afterOpenOffice",
......@@ -263,15 +331,30 @@ MWF.xApplication.process.Xform.Office = MWF.APPOffice = new Class({
return this.getTempleteUrl();
}
},
/**
* @summary 允许编辑Office文档
* @example
* this.form.get("fieldName").editEnabled();
*/
editEnabled: function(){
try {
this.officeOCX.ActiveDocument.Unprotect();
}catch(e){}
},
/**
* @summary 设置Office文档为只读
* @example
* this.form.get("fieldName").docReadonly();
*/
docReadonly: function(){
this.protect(3);
},
/**
* @summary 设置Office文档状态
* @example
* this.form.get("fieldName").protect(1);
* @param {Number} type 1(批注),2(填写窗体),3(只读),0(修订),-1(限制编辑样式)
*/
protect: function(type){
// wdAllowOnlyComments = 1 //批注
// wdAllowOnlyFormFields = 2 //填写窗体
......@@ -282,6 +365,9 @@ MWF.xApplication.process.Xform.Office = MWF.APPOffice = new Class({
this.officeOCX.ActiveDocument.Protect(type);
}catch(e){}
},
/**
* @summary 设置Office文档保留痕迹
*/
startRevisions: function(){
if (this.officeOCX && (this.officeOCX.DocType==1 || this.officeOCX.DocType==6)){
this.officeOCX.ActiveDocument.Application.UserName = layout.desktop.session.user.name;
......@@ -305,6 +391,9 @@ MWF.xApplication.process.Xform.Office = MWF.APPOffice = new Class({
}
//this.officeOCX.FullScreenMode = true;
},
/**
* @summary 设置Office文档取消保留痕迹
*/
stopRevisions: function(accept){
this.officeOCX.ActiveDocument.TrackRevisions = false;
this.officeOCX.ActiveDocument.showRevisions = false;
......@@ -607,9 +696,15 @@ MWF.xApplication.process.Xform.Office = MWF.APPOffice = new Class({
button.setText(MWF.xApplication.process.Xform.LP.menu_hideHistory)
}
},
/**
* @summary 盖章
*/
seal: function(){
this.fireEvent("seal");
},
/**
* @summary 套红
*/
redFile: function(){
// try {
if (this.officeOCX.ActiveDocument.ActiveWindow.View.RevisionsFilter){
......@@ -636,6 +731,9 @@ MWF.xApplication.process.Xform.Office = MWF.APPOffice = new Class({
// throw e;
// }
},
/**
* @summary 显示痕迹
*/
showRevisions: function(){
try {
if (this.officeOCX.ActiveDocument.ActiveWindow.View.RevisionsFilter) {
......@@ -645,6 +743,9 @@ MWF.xApplication.process.Xform.Office = MWF.APPOffice = new Class({
this.officeOCX.ActiveDocument.showRevisions = true;
}catch(e){}
},
/**
* @summary 隐藏痕迹
*/
hideRevisions: function(){
try {
if (this.officeOCX.ActiveDocument.ActiveWindow.View.RevisionsFilter) {
......@@ -1122,7 +1223,10 @@ MWF.xApplication.process.Xform.Office = MWF.APPOffice = new Class({
this.afterOpen();
this.loadMenu();
this.fireEvent("afterOpenOffice");
this.fireEvent("afterOpenOffice", {
url : url,
doc : doc
});
},
AfterOpenFromURL: function(doc, statusCode){
this.fireEvent("afterOpen", [doc, statusCode]);
......@@ -1179,6 +1283,13 @@ MWF.xApplication.process.Xform.Office = MWF.APPOffice = new Class({
this.officeNode.set("html", objectHtml);
this.officeForm = this.officeNode.getFirst();
/**
@summary Ntko Office 控件对象, 第三方控件
@see {@link http://ieoffice.ntko.com/pro/show/mid/1_8/pid/2731|NTKO官网 }
@example
var officeOCX = this.form.get("fieldName").officeOCX;
var activeDocument = officeOCX.ActiveDocument //返回一个Office Document 对象,该对象代表活动文档。
*/
this.officeOCX = this.officeNode.getFirst().getFirst();
if(window.navigator.platform=="Win64"){
......@@ -1218,6 +1329,10 @@ MWF.xApplication.process.Xform.Office = MWF.APPOffice = new Class({
}
},
setData: function(){},
/**
* @summary 保存Office文档到后台
* @param {Boolean} history - 是否生产保留痕迹文件
*/
save: function(history){
//if (!this.uploadFileAreaNode) this.createUploadFileNode();
if (!this.readonly){
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册