O2OA API

Module

view

您可以通过view对象,获取视图数据或选择视图数据。

Syntax

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

Methods

static

lookup(view, callback, asyncopt)

获取指定视图的数据。

Syntax

this.view.lookup(view, callback, async);

Parameters

  • view Object

    要访问的视图信息。数据格式如下:

    以下的filter参数参考ViewFilter
    
    {
     "view" : "testView", //(String)必选,视图的名称、别名或ID
     "application" : "test数据中心应用", //(String)必选,视图所在数据应用的名称、别名或ID
     "filter": [ //(Array of Object)可选,对视图进行过滤的条件。json数组格式,每个数组元素描述一个过滤条件。
          {
              "logic":"and",
              "path":"$work.title",
              "comparison":"like",
              "value":"7月",
              "formatType":"textValue"
          }
     ]
    }
    
  • callback function

    访问成功后的回调函数

  • async Boolean <optional>

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

Examples

//获取“财务管理”应用中“报销审批数据”视图中的数据
//过滤条件为标题($work.title)包含包含(like))“7月”。
this.view.lookup({
  "view": "报销审批数据",
  "application": "财务管理",
  "filter": [
      {
          "logic":"and",
          "path":"$work.title",
          "comparison":"like",
          "value":"7月",
          "formatType":"textValue"
      }
  ]
}, function(data){
  var grid = data.grid; //得到过滤后的数据
  var groupGrid = data.groupGrid; //如果有分类,得到带分类的数据
  //......
});
//获取“财务管理”应用中“报销审批数据”视图中的数据
//过滤条件为标题($work.title)包含包含(like))“7月”,并且总金额大于500小于5000
this.view.lookup({
  "view": "报销审批数据",
  "application": "财务管理",
  "filter": [
      {
          "logic":"and",
          "path":"$work.title",
          "comparison":"like",
          "value":"7月",
          "formatType":"textValue"
      },
      {
          "logic":"and",
          "path":"amount",
          "comparison":"range",
          "value":500,
          "otherValue":5000,
          "formatType":"numberValue"
      },
  ]
}, function(data){
  var grid = data.grid; //得到过滤后的数据
  var groupGrid = data.groupGrid; //如果有分类,得到带分类的数据
  //......
});

Source

results matching

    No results matching ''