|
发表于 2015-7-1 09:12:53
|
显示全部楼层
参考 文章 Attachment相关组件
http://wex5.com/cn/attachment1/
attachmentSimple的上传、下载、预览等都是通过一个.j完成
$UI/system/service/doc/common/simpleFileStore.j (当是get的时候就是下载/浏览,post的时候就是上传),详细代码可以参考这个.j的实现。
所以这个组件只有一个api 就是获取下载、预览的url
getFileUrl : function(realFileName,storeFileName,ownerID,operateType){
var url = '$UI/system/service/doc/common/simpleFileStore.j?realFileName=' + realFileName + '&storeFileName='+storeFileName + '&ownerID='+ownerID + '&operateType=' + operateType;
return require.toUrl(url);
},
案例
if (row != undefined) {
var jsonList = eval("(" + row.val('fFJ') + ")");
var ownerID = row.getID();
if (jsonList != undefined) {
var realFileName = jsonList[0]["realFileName"];
var storeFileName = jsonList[0]["storeFileName"];
var operateType = "browse";
var url = '$UI/system/service/doc/common/simpleFileStore.j?realFileName=' + realFileName + '&storeFileName=' + storeFileName + '&ownerID=' + ownerID + '&operateType=' + operateType;
return require.toUrl(url);
}
} |
|