技术文章
在o2oa流程中把表单保存成附件的实现方式
var html = '<style>table{border-collapse:collapse}td{border:1px solid rgb(3,3,3)}.title{font-weight:bold;height:30px;line-height:30px;width:22%;text-align:center}.content{width:30%;padding-left:10px}</style><table cellspacing="0"style="width: 700px; background-color: rgb(255, 255, 255);"><tr><td colspan="4"style="width: 100%;text-align: center;font-size: 24px; line-height: 60px; font-weight: bold; height: 60px; color: black;">教育系统国内公务考察活动审批表</td></tr><tr><td class="title">主题</td><td colspan="3"class="content">余杭小学外出考察学习审批</td></tr><tr><td class="title">经办人</td><td class="content">张安</td><td class="title">联系电话</td><td class="content">15858248111</td></tr></table>';
var action = this.Actions.load("x_processplatform_assemble_surface");
var fileName = "转换后的pdf标题.pdf";
//html转换成pdf
action.AttachmentAction.htmlToPdf({
"workHtml" :html,
"title" : fileName
},function( json ){
//上传到附件
var url = "http://host/x_processplatform_assemble_surface/jaxrs/attachment/download/transfer/flag/" + json.data.id;
action.AttachmentAction.uploadWithUrl({
"workId" : "26dc4e1c-56b8-4f23-a332-4fdabe41c58c",
"fileName" : fileName,
"fileUrl" : url,
"site" : "attachment",
"person" : "xadmin"
},function(){})
}.bind(this));先调用html 转pdf 接口,生成的pdf再调用附件上传接口,实现表单转存到附件功能。