|
@@ -0,0 +1,219 @@
|
|
|
+
|
|
|
+stsAccessKeyId = ""
|
|
|
+stsAccessKeySecret = ""
|
|
|
+stsToken = ""
|
|
|
+var checkpoint_temp;
|
|
|
+var requestUrl;
|
|
|
+var returnUrl;
|
|
|
+var str;
|
|
|
+var buckName='newxgccpm'
|
|
|
+
|
|
|
+function reportDataMultipartUploadWithSts(storeAs, file,attachmentId,attachmentFlag,uploadPath,divId,size, cpt) {
|
|
|
+ console.log("-----------------------start");
|
|
|
+ multitest(storeAs, file,attachmentId,attachmentFlag,uploadPath,divId,size, cpt);
|
|
|
+};
|
|
|
+
|
|
|
+function multitest (storeAs, file,attachmentId,attachmentFlag,uploadPath,divId, size,cpt) {
|
|
|
+ var formdata = new FormData();
|
|
|
+ formdata.append("storeAs",storeAs);
|
|
|
+ formdata.append("file",file);
|
|
|
+ var names = storeAs.split("/");
|
|
|
+ var name = names[names.length-1];
|
|
|
+ $.ajax({
|
|
|
+ type:'post',
|
|
|
+ url:realPath+"/bos/upload",
|
|
|
+ data:formdata,
|
|
|
+ contentType: false,
|
|
|
+ processData: false,
|
|
|
+ success:function (data1) {
|
|
|
+ if(data1.code==='1'){
|
|
|
+ returnUrl = realPath+"/sys/workattachment/saveAttachment";
|
|
|
+ var p = Math.floor(1*100);
|
|
|
+ $("#jindutiao"+divId).attr("style","width: "+p+"%");
|
|
|
+ $("#jindutiao"+divId).attr("aria-valuenow",p+"%");
|
|
|
+ $("#baifenbi"+divId).html(p+"%");
|
|
|
+ $("#fileName"+divId).html(name);
|
|
|
+ $.ajax({
|
|
|
+ type:'post',
|
|
|
+ url:returnUrl,
|
|
|
+ data:{
|
|
|
+ "attachmentName":file['name'],
|
|
|
+ "attachmentId":attachmentId,
|
|
|
+ "attachmentFlag":attachmentFlag,
|
|
|
+ "url":data1.url,
|
|
|
+ "divIdType":divId
|
|
|
+ },
|
|
|
+ success:function(data){
|
|
|
+ console.log('url : ' + data.url);
|
|
|
+ if(data.status=="Success"){
|
|
|
+ parent.layer.msg("上传成功!",{icon:1});
|
|
|
+ var lenght =$(".trIdAdds").length;
|
|
|
+ if (size != 0){
|
|
|
+ lenght += size;
|
|
|
+ }
|
|
|
+ var addFile = "addFile"+divId;
|
|
|
+ var str = '<tr class="trIdAdds">'+
|
|
|
+ '<td class="text-center">' ;
|
|
|
+ if (isContains("jpg,png,gif,bmp,jpeg",data.type)){
|
|
|
+ str = str +'<img src="'+data1.url+'" width="50" height="50" onclick="openDialogView(\'预览\',\''+realPath+ '/a/sys/picturepreview/picturePreview?url=' +data1.url+ '\',\'90%\',\'90%\')" alt="'+data.attachmentName+'"/>';
|
|
|
+ }else if(isContains("pdf",data.type)){
|
|
|
+ str = str + '<a class="attention-info" href="javascript:void(0)" onclick="preview(\'预览\',\''+data1.url+'\',\'90%\',\'90%\',\'1\')">'+data.attachmentName+'</a>';
|
|
|
+ }else {
|
|
|
+ str = str + '<a class="attention-info" href="javascript:void(0)" onclick="preview(\'预览\',\''+data1.url+'\',\'90%\',\'90%\')">'+data.attachmentName+'</a>';
|
|
|
+ }
|
|
|
+ str = str +'</td>'+
|
|
|
+ '<td >'+data.createByName+'</td>'+
|
|
|
+ '<td >'+data.createDate+
|
|
|
+ '<input name="workAttachments['+lenght+'].id" type="hidden" readonly="readonly" maxlength="20" style="width:140px;" class="form-control" value=""/>'+
|
|
|
+ '<input name="workAttachments['+lenght+'].attachmentId" type="hidden" readonly="readonly" maxlength="20" style="width:140px;" class="form-control" value="'+data.attachmentId+'"/>'+
|
|
|
+ '<input name="workAttachments['+lenght+'].url" type="hidden" readonly="readonly" maxlength="20" style="width:140px;" class="form-control" value="'+data1.url+'"/>'+
|
|
|
+ '<input name="workAttachments['+lenght+'].attachmentName" type="hidden" readonly="readonly" maxlength="20" style="width:140px;" class="form-control" value="'+data.attachmentName+'"/>'+
|
|
|
+ '<input name="workAttachments['+lenght+'].createBy.id" type="hidden" readonly="readonly" maxlength="20" style="width:140px;" class="form-control" value="'+data.createBy+'"/>'+
|
|
|
+ '<input name="workAttachments['+lenght+'].type" type="hidden" readonly="readonly" maxlength="20" style="width:140px;" class="form-control" value="'+data.type+'"/>'+
|
|
|
+ '<input name="workAttachments['+lenght+'].attachmentFlag" type="hidden" readonly="readonly" maxlength="20" style="width:140px;" class="form-control" value="'+data.attachmentFlag+'"/>'+
|
|
|
+ '<input name="workAttachments['+lenght+'].quoteResult" type="hidden" readonly="readonly" maxlength="20" style="width:140px;" class="form-control" value="0"/>'+
|
|
|
+ '</td>'+
|
|
|
+ '<td >否</td>'+
|
|
|
+ '<td class="op-td">'+
|
|
|
+ '<div class="op-btn-box">' +
|
|
|
+ // '<a href="javascript:location.href=\''+realPath+'/a/workfullmanage/workFullManage/downLoadAttach?file=\'+encodeURIComponent(\''+data.url+'\');" class="op-btn op-btn-download"><i class="fa fa-download"></i> 下载</a>'+
|
|
|
+ '<a href="'+data1.url+'" class="op-btn op-btn-download"><i class="fa fa-download"></i> 下载</a>'+
|
|
|
+ '<a href="javascript:void(0)" onclick="deleteFileFromAliyun(this,\''+realPath+'/sys/workattachment/deleteFileFromAliyun?url='+data.url+'&id='+data.id+'&type=2\',\''+addFile+'\',\''+divId+'\')" class="op-btn op-btn-delete" ><i class="fa fa-trash"></i> 删除</a>'+
|
|
|
+ '</div>' +
|
|
|
+ '</td>'+
|
|
|
+ '</tr>';
|
|
|
+ console.log("file:"+divId);
|
|
|
+ console.log("str="+str);
|
|
|
+ $("#file"+divId).append(str);
|
|
|
+ }else {
|
|
|
+ parent.layer.msg("上传失败!",{icon:2});
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else {
|
|
|
+ parent.layer.msg("上传失败!",{icon:2});
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+};
|
|
|
+
|
|
|
+function quoteFile (data,divId) {
|
|
|
+ parent.layer.msg("引用成果文件成功!",{icon:1});
|
|
|
+ var lenght =$(".trIdAdds").length;
|
|
|
+ var addFile = "addFile"+divId;
|
|
|
+ var str = '<tr class="trIdAdds">'+
|
|
|
+ '<td class="text-center">' ;
|
|
|
+ if (isContains("jpg,png,gif,bmp,jpeg",data.type)){
|
|
|
+ str = str +'<img src="'+data.url+'" width="50" height="50" onclick="openDialogView(\'预览\',\''+realPath+ '/a/sys/picturepreview/picturePreview?url=' +data.url+ '\',\'90%\',\'90%\')" alt="'+data.attachmentName+'"/>';
|
|
|
+ }else if(isContains("pdf",data.type)){
|
|
|
+ str = str + '<a class="attention-info" href="javascript:void(0)" onclick="preview(\'预览\',\''+data.url+'\',\'90%\',\'90%\',\'1\')">'+data.attachmentName+'</a>';
|
|
|
+ }else {
|
|
|
+ str = str + '<a class="attention-info" href="javascript:void(0)" onclick="preview(\'预览\',\''+data.url+'\',\'90%\',\'90%\')">'+data.attachmentName+'</a>';
|
|
|
+ }
|
|
|
+ str = str +'</td>'+
|
|
|
+ '<td >'+data.attachmentUser+'</td>'+
|
|
|
+ '<td >'+data.createDate+
|
|
|
+ '<input name="workAttachments['+lenght+'].id" type="hidden" readonly="readonly" maxlength="20" style="width:140px;" class="form-control" value=""/>'+
|
|
|
+ '<input name="workAttachments['+lenght+'].attachmentId" type="hidden" readonly="readonly" maxlength="20" style="width:140px;" class="form-control" value=""/>'+
|
|
|
+ '<input name="workAttachments['+lenght+'].url" type="hidden" readonly="readonly" maxlength="20" style="width:140px;" class="form-control" value="'+data.url+'"/>'+
|
|
|
+ '<input name="workAttachments['+lenght+'].attachmentName" type="hidden" readonly="readonly" maxlength="20" style="width:140px;" class="form-control" value="'+data.attachmentName+'"/>'+
|
|
|
+ '<input name="workAttachments['+lenght+'].type" type="hidden" readonly="readonly" maxlength="20" style="width:140px;" class="form-control" value="'+data.type+'"/>'+
|
|
|
+ '<input name="workAttachments['+lenght+'].attachmentFlag" type="hidden" readonly="readonly" maxlength="20" style="width:140px;" class="form-control" value="84"/>'+
|
|
|
+ '<input name="workAttachments['+lenght+'].quoteResult" type="hidden" readonly="readonly" maxlength="20" style="width:140px;" class="form-control" value="1"/>'+
|
|
|
+ '<input name="workAttachments['+lenght+'].quoteId" type="hidden" readonly="readonly" maxlength="20" style="width:140px;" class="form-control" value="'+data.id+'"/>'+
|
|
|
+ '</td>'+
|
|
|
+ '<td >是</td>'+
|
|
|
+ '<td class="op-td">'+
|
|
|
+ '<div class="op-btn-box">' +
|
|
|
+ '<a href="'+data.url+'" class="op-btn op-btn-download"><i class="fa fa-download"></i> 下载</a>'+
|
|
|
+ '<a href="javascript:void(0)" onclick="quoteDeleteAddFileFromAliyun(this,\''+addFile+'\')" class="op-btn op-btn-delete" ><i class="fa fa-trash"></i> 删除</a>'+
|
|
|
+ '</div>' +
|
|
|
+ '</td>'+
|
|
|
+ '</tr>';
|
|
|
+ console.log("file:"+divId);
|
|
|
+ console.log("str="+str);
|
|
|
+ $("#file"+divId).append(str);
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+function quoteDeleteAddFileFromAliyun(obj,addFile){
|
|
|
+ parent.layer.msg('删除成功',{icon:1});
|
|
|
+ $(obj).parent().parent().parent().remove();
|
|
|
+ $("#"+addFile).hide();
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
+function quoteDeleteFileFromAliyun(obj,deleteUrl,addFile){
|
|
|
+ $.ajax({
|
|
|
+ type:"post",
|
|
|
+ url:deleteUrl,
|
|
|
+ success:function(data){
|
|
|
+ if(data.str){
|
|
|
+ parent.layer.msg('删除成功',{icon:1});
|
|
|
+ $(obj).parent().parent().parent().remove();
|
|
|
+ $("#"+addFile).hide();
|
|
|
+ }else {
|
|
|
+ parent.layer.msg('删除失败',{icon:2});
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+function isContains(str, substr) {
|
|
|
+ return str.indexOf(substr) >= 0;
|
|
|
+}
|
|
|
+
|
|
|
+function deleteFileFromAliyun(obj,deleteUrl,addFile,divId){
|
|
|
+ console.log("---------------------------------:");
|
|
|
+ console.log(divId);
|
|
|
+ console.log("---------------------------------");
|
|
|
+ if (divId==null || divId== undefined || divId == ''){
|
|
|
+ divId = "_attachment";
|
|
|
+ }
|
|
|
+ var fileDiv = divId.substr(1,divId.length)+"_file";
|
|
|
+ console.log("---------------------------------:");
|
|
|
+ console.log(fileDiv);
|
|
|
+ console.log("---------------------------------");
|
|
|
+ $("#"+fileDiv).val("");
|
|
|
+ $.ajax({
|
|
|
+ type:"post",
|
|
|
+ url:deleteUrl,
|
|
|
+ success:function(data){
|
|
|
+ if(data.str){
|
|
|
+ parent.layer.msg('删除成功',{icon:1});
|
|
|
+ $(obj).parent().parent().parent().remove();
|
|
|
+ $("#"+addFile).hide();
|
|
|
+ }else {
|
|
|
+ parent.layer.msg('删除失败',{icon:2});
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+function deleteFileFrom(obj,deleteUrl,addFile,divId,trId){
|
|
|
+ console.log("---------------------------------:");
|
|
|
+ console.log(divId);
|
|
|
+ console.log("---------------------------------");
|
|
|
+ if (divId==null || divId== undefined || divId == ''){
|
|
|
+ divId = "_attachment";
|
|
|
+ }
|
|
|
+ var fileDiv = divId.substr(1,divId.length)+"_file";
|
|
|
+ console.log("---------------------------------:");
|
|
|
+ console.log(fileDiv);
|
|
|
+ console.log("---------------------------------");
|
|
|
+ $("#"+fileDiv).val("");
|
|
|
+ $.ajax({
|
|
|
+ type:"post",
|
|
|
+ url:deleteUrl,
|
|
|
+ success:function(data){
|
|
|
+ if(data.str){
|
|
|
+ parent.layer.msg('删除成功',{icon:1});
|
|
|
+ //$(obj).parent().parent().parent().remove();
|
|
|
+ $("#"+trId).hide();
|
|
|
+ }else {
|
|
|
+ parent.layer.msg('删除失败',{icon:2});
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|