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

module

您可以通过importer对象,执行导入模型的excel导入数据功能。

syntax

//您可以在流程表单、内容管理表单、门户页面或视图中,通过this来获取statement对象,如下:
var importer = this.importer;

source

methods

static

upload(options, callbackopt, asyncopt)

根据指定的导入模型进行上传。

syntax

this.importer.upload(options, callback, async);

parameters

  • options object

    要执行的导入模型的选项。数据格式如下:

    {
     "name" : "testimporter", //(string)必选,导入模型的名称、别名或id
     "application" : "testquery" //(string)必选,导入模型所在应用的名称、别名或id
    }
    
  • callback function

    导入成功后的回调函数

  • async boolean

    同步或异步调用。true:异步;false:同步。默认为true。

example

this.importer.upload({
 "name": "testimporter",
 "application" : "testquery",
}, function(json){
});

source

static

downloadtemplate(options, filename, callback)

根据指定的导入模型下载excel模板。

syntax

this.importer.downloadtemplate(object, filename, callback);

parameters

  • options object

    要执行的导入模型的选项。数据格式如下:

    {
     "name" : "testimporter", //(string)必选,导入模型的名称、别名或id
     "application" : "testquery" //(string)必选,导入模型所在应用的名称、别名或id
    }
    
  • filename string

    导出的excel名称

  • callback function

    整理好数据,在导出之前执行的方法,可接收参数如下:

    {
     "data" : ["标题","拟稿人"], //导出的表头数组
     "colwidtharray" : [200, 150] //列宽度
    }
    

example

this.importer.downloadtemplate({
 "name": "testimporter",
 "application" : "testquery",
},"导入模板", function( object ){
    //添加一项
    object.data[0].push("备注");
    object.colwidtharray.push(300)
});

source

网站地图