API
Component

ImportExcel ($UI/system/components/justep/excel/importExcel)

使用范围:UI2

Contents

component ImportExcel ($UI/system/components/justep/excel/importExcel) extends BindComponent

<b>将excel中数据导入</b> ## <b>文档链接</b>:#http://docs.newdao.net/zhuo-mian-biao-dan-zu-jian/exceldao-516526-excel-dao-chu.html#

Constructor Top

  ImportExcel ()
  ImportExcel ( options)

Properties Top

action = importExcel

指定导入excel的action

data

导入的Data xid,目前只支持bizData

mappings

导入的映射配置文件URL,支持多个配置文件使用","分隔

to = DB

导入的数据方式,取值范围:"UI"/"DB"

boolean useDefault = false

是否使用默认映射文件中导入参数配置

Attributes Top

action = importExcel

指定导入excel的action

data

导入的Data xid,目前只支持bizData

mappings

导入的映射配置文件URL,支持多个配置文件使用","分隔

to = DB

导入的数据方式,取值范围:"UI"/"DB"

boolean useDefault = false

是否使用默认映射文件中导入参数配置

xid

xid标识

Methods Top

Object get (String name)
string getActivity ()
Data getData ()
string getProcess ()
void importExcel ()
void set (json arg)

Operations Top

void ImportExcel ()

Events Top

boolean onBeforeImport (BeforeEvent event)
void onError (ErrorEvent event)
void onImportCreateParam (ImportCreateParam event)
void onSuccess (SuccessEvent event)
void onUploadStart (ViewEvent event)
void onUploadSuccess (ViewEvent event)

Constructor details Top

public ImportExcel ()

<b>将excel中数据导入</b> ## <b>文档链接</b>:#http://docs.newdao.net/zhuo-mian-biao-dan-zu-jian/exceldao-516526-excel-dao-chu.html#

public ImportExcel ( options)

构造函数

Inherited from ViewComponent

	
		参数options格式类似{parent:xx, config:{}},parent是组件的父节点,允许为空或不指定,config是组件的参数选项
	 

Parameters

options

参数选项

Properties Detail Top

public action = importExcel

指定导入excel的action

public data

导入的Data xid,目前只支持bizData

public mappings

导入的映射配置文件URL,支持多个配置文件使用","分隔

 
	映射配置文件格式说明:
	
	<mapping>
		<default-config>
			<sheet all="false" start="1" end="1"/>
			<row all="false" start="2" end="100"/>
		</default-config>
		<concept name="SA_OPPerson"> 
		    <primary-key>
		    	<key-value cell-number="1" check="true"/>
		    </primary-key>
			<relation name="sName" cell-number="2" check="true"/>
			<relation name="sCode" cell-number="3"/>
			<relation name="sSex" cell-number="4"/>
			<relation name="sMobilePhone" cell-number="5"/>
			<relation name="sMainOrgID" cell-number="6"/>
			<relation name="sBirthday" cell-number="7"/>		
		</concept>	
	</mapping>
	

	default-config: 导入默认参数
		sheet:excel页
			all:是否导入全部页
			start:导入开始页
			end:导入结束页
		row:excel行
			all:是否导入全部行
			start:导入开始行
			end:导入全部行
	concept:数据映射
	    check: excel中行数据是否有效判断,当check="true"时cell-number对应列值为空,认为此行数据无效将被忽略
		name:概念名称 
    	relation:关系
        	name: 关系名称
         	value-type:数据类型,需要转换成的数据类型,没有定义时取relation的类型。类型包括:string,integer,float,date,datetime,time,decimal,text
         	cell-number:关系在excel中对应的列号,从1开始。
         	date-pattern:数据转换格式,如excel中为文本类型,导入关系为日期类型时,可通过定义该属性设置转换规则,格式如:"yyyy-MM-dd hh:mm:ss"
	         
   	注意:
    	系统会读取excel单元格类型,当excel单元格的类型与所导入关系类型不一致时,需要通过定义 value-type或date-pattern属性进行格式转换。否则将造成导入失败的问题。

public to = DB

导入的数据方式,取值范围:"UI"/"DB"

 
	UI:excel中的数据以新增方式导入UI;
	DB:使用data关联的createAction、saveAction将数据导入数据库

public boolean useDefault = false

是否使用默认映射文件中导入参数配置

Attributes Detail Top

public action = importExcel

指定导入excel的action

public data

导入的Data xid,目前只支持bizData

public mappings

导入的映射配置文件URL,支持多个配置文件使用","分隔

 
	映射配置文件格式说明:
	
	<mapping>
		<default-config>
			<sheet all="false" start="1" end="1"/>
			<row all="false" start="2" end="100"/>
		</default-config>
		<concept name="SA_OPPerson"> 
		    <primary-key>
		    	<key-value cell-number="1" check="true"/>
		    </primary-key>
			<relation name="sName" cell-number="2" check="true"/>
			<relation name="sCode" cell-number="3"/>
			<relation name="sSex" cell-number="4"/>
			<relation name="sMobilePhone" cell-number="5"/>
			<relation name="sMainOrgID" cell-number="6"/>
			<relation name="sBirthday" cell-number="7"/>		
		</concept>	
	</mapping>
	

	default-config: 导入默认参数
		sheet:excel页
			all:是否导入全部页
			start:导入开始页
			end:导入结束页
		row:excel行
			all:是否导入全部行
			start:导入开始行
			end:导入全部行
	concept:数据映射
	    check: excel中行数据是否有效判断,当check="true"时cell-number对应列值为空,认为此行数据无效将被忽略
		name:概念名称 
    	relation:关系
        	name: 关系名称
         	value-type:数据类型,需要转换成的数据类型,没有定义时取relation的类型。类型包括:string,integer,float,date,datetime,time,decimal,text
         	cell-number:关系在excel中对应的列号,从1开始。
         	date-pattern:数据转换格式,如excel中为文本类型,导入关系为日期类型时,可通过定义该属性设置转换规则,格式如:"yyyy-MM-dd hh:mm:ss"
	         
   	注意:
    	系统会读取excel单元格类型,当excel单元格的类型与所导入关系类型不一致时,需要通过定义 value-type或date-pattern属性进行格式转换。否则将造成导入失败的问题。

public to = DB

导入的数据方式,取值范围:"UI"/"DB"

 
	UI:excel中的数据以新增方式导入UI;
	DB:使用data关联的createAction、saveAction将数据导入数据库

public boolean useDefault = false

是否使用默认映射文件中导入参数配置

public xid

xid标识

Methods Detail Top

public Object get (String name)

获取属性值

Parameters

String name

属性名称,取值范围:"data"、"to"、"action"、"mappings"、"useDefault"

Return Value

Object

public string getActivity ()

获取导入动作使用的Activity

Return Value

string

public Data getData ()

获取导入的data对象

Return Value

Data

public string getProcess ()

获取导入动作使用的Process

Return Value

string

public void importExcel ()

导入excel

	this.comp("excelImport1").importExcel();

Return Value

void

public void set (json arg)

设置属性值

Parameters

json arg

属性值对
结构如下:

{ "data" : {string} data xid, "to: {string} 导入的数据方式,取值范围:"UI"/"DB" "action: {string} 指定导入excel的action "mappings: {string} 导入的映射配置文件URL,支持多个配置文件使用","分隔 "useDefault: {boolean} 是否使用默认映射文件中导入参数配置 }

Return Value

void

Operations Detail Top

public void ImportExcel ()

导入Excel

Return Value

void

Events Detail Top

public boolean onBeforeImport (BeforeEvent event)

[回调型事件]导入前

Parameters

BeforeEvent event


参数结构如下:

{ "source" : 组件的js对象 "bindingContext" : 组件绑定的上下文,包含$model、$object等具体请参考bindingContext说明 "cancel" : 取消导入 }

Return Value

boolean

控制 导入动作是否继续

public void onError (ErrorEvent event)

[回调型事件]导入失败

Parameters

ErrorEvent event


参数结构如下:

{ "source" : 组件的js对象, "bindingContext" : 组件绑定的上下文,包含$model、$object等具体请参考bindingContext说明 "message" : 导出错误信息, "result" : http请求返回 }

Return Value

void

public void onImportCreateParam (ImportCreateParam event)

[回调型事件]创建导入参数

Parameters

ImportCreateParam event


参数结构如下:

{ "source" : 组件的js对象, "bindingContext" : 组件绑定的上下文,包含$model、$object等具体请参考bindingContext说明 "param" : {Object} 创建导入参数对象,可以直接使用event.param['...']=...;方式扩展传递参数 }

Return Value

void

public void onSuccess (SuccessEvent event)

[回调型事件]导入成功

Parameters

SuccessEvent event


参数结构如下:

{ "source" : 组件的js对象, "bindingContext" : 组件绑定的上下文,包含$model、$object等具体请参考bindingContext说明 "response" : 返回的结果 }

Return Value

void

public void onUploadStart (ViewEvent event)

[回调型事件]开始提交Excel文件前

Parameters

ViewEvent event


结构如下:

{ "source" : 组件的js对象, "bindingContext" : 组件绑定的上下文,包含$model、$object等具体请参考bindingContext说明 }

Return Value

void

public void onUploadSuccess (ViewEvent event)

[回调型事件]提交Excel文件成功

Parameters

ViewEvent event


结构如下:

{ "source" : 组件的js对象, "bindingContext" : 组件绑定的上下文,包含$model、$object等具体请参考bindingContext说明 }

Return Value

void