@big-bear
2017-05-22T10:36:59.000000Z
字数 1117
阅读 1428
云宝 api
BaseModel需要增加一个url属性 string
/api/model
使用该model的query方法
参数除了查询与分页等已有的参数外,需要在param上加一个export参数用于描述导出的相关信息,具体如下
params.export={"title":"体检报告", //导出的excel工作簿的名称,例如"体检报告"等"cols"//数组,描述导出列的字段名以及显示名称,导出的excel将按照数组的先后顺序排序[{"name":"customer.name", //需要导出的字段名,多个model关联时用"."分割"title":"体检人姓名" //导出excel时候该字段对应的表头名称},{"name":"title","title":"体检名称"},{"name":"contents","title":"内容"},{"name":"createTime","title":"体检时间"}],"format":[//数组,如果是时间字段,需要格式化的,加上格式化的表达式{"colName":"createTime",//需要格式化字段的字段名"format":"yyyy-MM-dd" //格式化表达式}]};
会返回一个只有一个该model的值的列表,导出文件的url在该数据的url中,如下
{"data": [{"type": "physicalReport","id": "2","attributes": {"picPath": "2017-04-16/1491469072_3c109932ea9d1fce5e339f077b8bfc21.jpg","contents": "666","createTime": 1491790703,"delStatus": 0,"title": "666","url": "http://localhost:6081/20170510152707.xls" //导出excel文件的下载地址},"relationships": {...},"links": {"self": "http://localhost:9080/api/physicalReport/2"}}],"included": []}
ExportThreadParam
Integer statusValue //未导出0, 导出中1, 导出完成2;
api/exportThreadParam
filter.url:"http://localhost:6081/20170516111304.xls"
返回一个ExportThreadParam
