zhiyemaoxianji 发表于 2024-10-16 10:09:58

您好,请问如何在视图中实现附件点击下载!!

管理员您好,我在视图中添加了 附件一栏 ,数据路径是attachmen.*可以显示 全部名称,然后在事件中添加了click事件,想实现点击下载具体是 如下图片中 :


`var attachmentList = this.workContext.getAttachmentList();
for( var j=0;j<attachmentList.length; j++ ){
var url = o2.Actions.getHost( "x_processplatform_assemble_surface")+ "/x_procesplatfor_asemble_surface/jaxrs/attachment/download/"+attachmentList.id
window .open(url)`
}
点击 无任何效果

论坛管理员 发表于 2024-10-16 11:11:29

F12看看报什么错

zhiyemaoxianji 发表于 2024-10-16 11:21:08

感谢您的回复,F12 调试页面我点击附件的名字 无反应

论坛管理员 发表于 2024-10-18 09:49:07

`var attachmentList = this.workContext.getAttachmentList();
for( var j=0;j<attachmentList.length; j++ ){
var url = o2.Actions.getHost( "x_processplatform_assemble_surface")+ "/x_procesplatfor_asemble_surface/jaxrs/attachment/download/"+attachmentList.id
window .open(url)`
}

this.workContext.getAttachmentList()这个方式是在表单或者流程图上才有校的,视图里无法这样获取,可以使用this.target.data获取当前列的值

zhiyemaoxianji 发表于 2024-10-21 10:09:38

感谢您的回复,我测试一下。

zhiyemaoxianji 发表于 2024-10-21 10:23:34

您好,修改如下
`var attachmentList = this.target.data;
for( var j=0;j<attachmentList.length; j++ ){
var url = o2.Actions.getHost( "x_processplatform_assemble_surface")+ "/x_procesplatfor_asemble_surface/jaxrs/attachment/download/"+attachmentList.id
window .open(url)`
}可是点击后跳转后 乱码 ,因为没识别“http://xxxx/x_procesplatfor_asemble_surface/jaxrs/attachment/download/undefined”{type :errorexceptionEntityNoexist}
页: [1]
查看完整版本: 您好,请问如何在视图中实现附件点击下载!!